diff --git a/README.md b/README.md index 9ee6ba2..84de14b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # dhtmlxGantt # [![dhtmlx.com](https://img.shields.io/badge/made%20by-DHTMLX-blue)](https://dhtmlx.com/) -[![npm: v.8.0.0](https://img.shields.io/badge/npm-v.8.0.0-blue.svg)](https://www.npmjs.com/package/dhtmlx-gantt) +[![npm: v.8.0.1](https://img.shields.io/badge/npm-v.8.0.1-blue.svg)](https://www.npmjs.com/package/dhtmlx-gantt) [![License: GPL v2](https://img.shields.io/badge/license-GPL%20v2-blue.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) [Getting started](#getting-started) | [Features](#features) | [License](#license) | [Useful links](#links) | [Follow us](#followus) @@ -117,7 +117,7 @@ Resource management, critical path calculation, auto scheduling, and other enhan ## License ## -dhtmlxGantt v.7.1.13 Standard +dhtmlxGantt v.8.0.1 Standard This version of dhtmlxGantt is distributed under GPL 2.0 license and can be legally used in GPL projects. diff --git a/bower.json b/bower.json index 62d37df..34cdad6 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "gantt", - "version": "8.0.0", + "version": "8.0.1", "homepage": "https://dhtmlx.com/docs/products/dhtmlxGantt/", "description": "An open source JavaScript Gantt chart that helps you illustrate a project schedule in a nice-looking chart.", "main": [ diff --git a/codebase/dhtmlxgantt.d.ts b/codebase/dhtmlxgantt.d.ts index 3aa5e2f..58d00e6 100644 --- a/codebase/dhtmlxgantt.d.ts +++ b/codebase/dhtmlxgantt.d.ts @@ -1,4 +1,4 @@ -// Type definitions for dhtmlxGantt 8.0.0 +// Type definitions for dhtmlxGantt 8.0.1 // Project: https://dhtmlx.com/docs/products/dhtmlxGantt type GanttCallback = (...args: any[]) => any; diff --git a/codebase/dhtmlxgantt.js b/codebase/dhtmlxgantt.js index 3c93194..756cfd7 100644 --- a/codebase/dhtmlxgantt.js +++ b/codebase/dhtmlxgantt.js @@ -1,7 +1,7 @@ /* @license -dhtmlxGantt v.8.0.0 Standard +dhtmlxGantt v.8.0.1 Standard This version of dhtmlxGantt is distributed under GPL 2.0 license and can be legally used in GPL projects. @@ -10,7 +10,7 @@ To use dhtmlxGantt in non-GPL projects (and get Pro version of the product), ple (c) XB Software Ltd. */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("dhtmlxgantt",[],e):"object"==typeof exports?exports.dhtmlxgantt=e():t.dhtmlxgantt=e()}(window,function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/codebase/",n(n.s=257)}([function(t,e,n){function i(t){"@babel/helpers - typeof";return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var r,a=n(2),o={}.constructor.toString();t.exports={copy:function t(e){var n,r;if(e&&"object"==i(e))switch(!0){case a.isDate(e):r=new Date(e);break;case a.isArray(e):for(r=new Array(e.length),n=0;n=0}function a(t){return!{a:!0,area:!0}[t.nodeName.loLowerCase()]||!!t.getAttribute("href")}function o(t){return!{input:!0,select:!0,textarea:!0,button:!0,object:!0}[t.nodeName.toLowerCase()]||!t.hasAttribute("disabled")}function s(t){if(!t)return"";var e=t.className||"";return e.baseVal&&(e=e.baseVal),e.indexOf||(e=""),d(e)}var l;function c(t){var e;return t.tagName?e=t:(e=(t=t||window.event).target||t.srcElement).shadowRoot&&t.composedPath&&(e=t.composedPath()[0]),e}function d(t){return(String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")}).apply(t)}function u(){return document.head.createShadowRoot||document.head.attachShadow}function h(t){if(!t)return document.body;if(!u())return document.body;for(;t.parentNode&&(t=t.parentNode);)if(t instanceof ShadowRoot)return t.host;return document.body}t.exports={getNodePosition:n,getFocusableNodes:function(t){for(var e=t.querySelectorAll(["a[href]","area[href]","input","select","textarea","button","iframe","object","embed","[tabindex]","[contenteditable]"].join(", ")),n=Array.prototype.slice.call(e,0),s=0;s=0){if(!n)return i;var o=0===a||!d(r.charAt(a-1)),l=a+e.length>=r.length||!d(r.charAt(a+e.length));if(o&&l)return i}}i=i.parentNode}return null},locateAttribute:function(t,e){if(e){for(var n=c(t);n;){if(n.getAttribute&&n.getAttribute(e))return n;n=n.parentNode}return null}},getTargetNode:c,getRelativeEventPosition:function(t,e){var i=document.documentElement,r=n(e);return{x:t.clientX+i.scrollLeft-i.clientLeft-r.x+e.scrollLeft,y:t.clientY+i.scrollTop-i.clientTop-r.y+e.scrollTop}},isChildOf:function(t,e){if(!t||!e)return!1;for(;t&&t!=e;)t=t.parentNode;return t===e},hasClass:function(t,e){return"classList"in t?t.classList.contains(e):new RegExp("\\b"+e+"\\b").test(t.className)},closest:function(t,e){if(t.closest)return t.closest(e);if(t.matches||t.msMatchesSelector||t.webkitMatchesSelector){var n=t;if(!document.documentElement.contains(n))return null;do{if((n.matches||n.msMatchesSelector||n.webkitMatchesSelector).call(n,e))return n;n=n.parentElement||n.parentNode}while(null!==n&&1===n.nodeType);return null}return console.error("Your browser is not supported"),null},getRootNode:h,hasShadowParent:function(t){return!!h(t)},isShadowDomSupported:u,getActiveElement:function(){var t=document.activeElement;return t.shadowRoot&&(t=t.shadowRoot.activeElement),t===document.body&&document.getSelection&&(t=document.getSelection().focusNode||document.body),t}}},function(t,e){function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i={second:1,minute:60,hour:3600,day:86400,week:604800,month:2592e3,quarter:7776e3,year:31536e3};function r(t){return!(!t||"object"!==n(t))&&!!(t.getFullYear&&t.getMonth&&t.getDate)}function a(t,e){var n=[];if(t.filter)return t.filter(e);for(var i=0;ie)){for(;+t[n]==+t[n+1];)n++;return n}if(!isNaN(r)&&r=0||navigator.userAgent.indexOf("Trident")>=0),isIE6:n&&!XMLHttpRequest&&navigator.userAgent.indexOf("MSIE")>=0,isIE7:n&&navigator.userAgent.indexOf("MSIE 7.0")>=0&&navigator.userAgent.indexOf("Trident")<0,isIE8:n&&navigator.userAgent.indexOf("MSIE 8.0")>=0&&navigator.userAgent.indexOf("Trident")>=0,isOpera:n&&navigator.userAgent.indexOf("Opera")>=0,isChrome:n&&navigator.userAgent.indexOf("Chrome")>=0,isKHTML:n&&(navigator.userAgent.indexOf("Safari")>=0||navigator.userAgent.indexOf("Konqueror")>=0),isFF:n&&navigator.userAgent.indexOf("Firefox")>=0,isIPad:n&&navigator.userAgent.search(/iPad/gi)>=0,isEdge:n&&-1!=navigator.userAgent.indexOf("Edge"),isNode:!n||"undefined"==typeof navigator};t.exports=i},function(t,e,n){var i=n(0),r=n(4),a=n(1),o=function(){"use strict";function t(t,e,n,o){t&&(this.$container=a.toNode(t),this.$parent=t),this.$config=i.mixin(e,{headerHeight:33}),this.$gantt=o,this.$domEvents=o._createDomEventScope(),this.$id=e.id||"c"+i.uid(),this.$name="cell",this.$factory=n,r(this)}return t.prototype.destructor=function(){this.$parent=this.$container=this.$view=null,this.$gantt.$services.getService("mouseEvents").detach("click","gantt_header_arrow",this._headerClickHandler),this.$domEvents.detachAll(),this.callEvent("onDestroy",[]),this.detachAllEvents()},t.prototype.cell=function(t){return null},t.prototype.scrollTo=function(t,e){var n=this.$view;this.$config.html&&(n=this.$view.firstChild),1*t==t&&(n.scrollLeft=t),1*e==e&&(n.scrollTop=e)},t.prototype.clear=function(){this.getNode().innerHTML="",this.getNode().className="gantt_layout_content",this.getNode().style.padding="0"},t.prototype.resize=function(t){if(this.$parent)return this.$parent.resize(t);!1===t&&(this.$preResize=!0);var e=this.$container,n=e.offsetWidth,i=e.offsetHeight,r=this.getSize();e===document.body&&(n=document.body.offsetWidth,i=document.body.offsetHeight),nr.maxWidth&&(n=r.maxWidth),ir.maxHeight&&(i=r.maxHeight),this.setSize(n,i),this.$preResize,this.$preResize=!1},t.prototype.hide=function(){this._hide(!0),this.resize()},t.prototype.show=function(t){this._hide(!1),t&&this.$parent&&this.$parent.show(),this.resize()},t.prototype._hide=function(t){if(!0===t&&this.$view.parentNode)this.$view.parentNode.removeChild(this.$view);else if(!1===t&&!this.$view.parentNode){var e=this.$parent.cellIndex(this.$id);this.$parent.moveView(this,e)}this.$config.hidden=t},t.prototype.$toHTML=function(t,e){void 0===t&&(t=""),e=[e||"",this.$config.css||""].join(" ");var n=this.$config,i="";n.raw?t="string"==typeof n.raw?n.raw:"":(t||(t="
"+(n.html||"")+"
"),n.header&&(i="
"+(n.canCollapse?"
":"")+"
"+n.header+"
"));return"
"+i+t+"
"},t.prototype.$fill=function(t,e){this.$view=t,this.$parent=e,this.init()},t.prototype.getNode=function(){return this.$view.querySelector("gantt_layout_cell")||this.$view},t.prototype.init=function(){var t=this;this._headerClickHandler=function(e){a.locateAttribute(e,"data-cell-id")==t.$id&&t.toggle()},this.$gantt.$services.getService("mouseEvents").delegate("click","gantt_header_arrow",this._headerClickHandler),this.callEvent("onReady",[])},t.prototype.toggle=function(){this.$config.collapsed=!this.$config.collapsed,this.resize()},t.prototype.getSize=function(){var t={height:this.$config.height||0,width:this.$config.width||0,gravity:this.$config.gravity||1,minHeight:this.$config.minHeight||0,minWidth:this.$config.minWidth||0,maxHeight:this.$config.maxHeight||1e11,maxWidth:this.$config.maxWidth||1e11};if(this.$config.collapsed){var e="x"===this.$config.mode;t[e?"width":"height"]=t[e?"maxWidth":"maxHeight"]=this.$config.headerHeight}return t},t.prototype.getContentSize=function(){var t=this.$lastSize.contentX;t!==1*t&&(t=this.$lastSize.width);var e=this.$lastSize.contentY;return e!==1*e&&(e=this.$lastSize.height),{width:t,height:e}},t.prototype._getBorderSizes=function(){var t={top:0,right:0,bottom:0,left:0,horizontal:0,vertical:0};return this._currentBorders&&(this._currentBorders[this._borders.left]&&(t.left=1,t.horizontal++),this._currentBorders[this._borders.right]&&(t.right=1,t.horizontal++),this._currentBorders[this._borders.top]&&(t.top=1,t.vertical++),this._currentBorders[this._borders.bottom]&&(t.bottom=1,t.vertical++)),t},t.prototype.setSize=function(t,e){this.$view.style.width=t+"px",this.$view.style.height=e+"px";var n=this._getBorderSizes(),i=e-n.vertical,r=t-n.horizontal;this.$lastSize={x:t,y:e,contentX:r,contentY:i},this.$config.header?this._sizeHeader():this._sizeContent()},t.prototype._borders={left:"gantt_layout_cell_border_left",right:"gantt_layout_cell_border_right",top:"gantt_layout_cell_border_top",bottom:"gantt_layout_cell_border_bottom"},t.prototype._setBorders=function(t,e){e||(e=this);var n=e.$view;for(var i in this._borders)a.removeClassName(n,this._borders[i]);"string"==typeof t&&(t=[t]);var r={};for(i=0;i";return e+=r.getHtmlSelect(t.options,[{key:"style",value:"width:100%;"}]),e+=""},a.prototype.set_value=function(t,e,n,i){var r=t.firstChild;!r._dhx_onchange&&i.onchange&&(r.onchange=i.onchange,r._dhx_onchange=!0),void 0===e&&(e=(r.options[0]||{}).value),r.value=e||""},a.prototype.get_value=function(t){return t.firstChild.value},a.prototype.focus=function(e){var n=e.firstChild;t._focus(n,!0)},a}},function(t,e){t.exports=function(t,e,n,i,r){if(!t.start_date||!t.end_date)return null;var a=n.getItemTop(t.id),o=n.getItemHeight(t.id);if(a>e.y_end||a+oe.x_end||dn.getBranchIndex(t)&&(i.targetIndex-=1),i},firstChildTarget:function(t,e,n){var i=this.createDropTargetObject();return i.targetId=e,i.targetParent=i.targetId,i.targetIndex=0,i.child=!0,i},lastChildTarget:function(t,e,n){var i=n.getChildren(e),r=this.createDropTargetObject();return r.targetId=i[i.length-1],r.targetParent=e,r.targetIndex=i.length,r.nextSibling=!0,r}}},function(t,e,n){var i=n(14);t.exports=function(t,e,n,r){var a=e.width[t];if(a<=0)return!1;if(!r.config.smart_rendering||i(r))return!0;var o=e.left[t]-a,s=e.left[t]+a;return o<=n.x_end&&s>=n.x}},function(t,e){t.exports=function(t,e){var n=0,i=t.left.length-1;if(e)for(var r=0;re.x_end){i=r;break}}return{start:n,end:i}}},function(t,e){t.exports=function(t,e,n){return{top:e.getItemTop(t.id),height:e.getItemHeight(t.id),left:0,right:1/0}}},function(t,e){t.exports=function(t){function e(e,a,o){if(!t._isAllowedUnscheduledTask(e)&&t._isTaskInTimelineLimits(e)){var s=a.getItemPosition(e),l=o,c=a.$getTemplates(),d=t.getTaskType(e.type),u=a.getBarHeight(e.id,d==l.types.milestone),h=0;d==l.types.milestone&&(h=(u-s.height)/2);var f=Math.floor((a.getItemHeight(e.id)-u)/2);d==l.types.milestone&&(s.left-=Math.round(u/2),s.width=u);var _=document.createElement("div"),g=Math.round(s.width);a.$config.item_attribute&&(_.setAttribute(a.$config.item_attribute,e.id),_.setAttribute(a.$config.bind+"_id",e.id)),l.show_progress&&d!=l.types.milestone&&function(e,n,i,r,a){var o=1*e.progress||0;i=Math.max(i-2,0);var s=document.createElement("div"),l=Math.round(i*o);l=Math.min(i,l),e.progressColor&&(s.style.backgroundColor=e.progressColor,s.style.opacity=1),s.style.width=l+"px",s.className="gantt_task_progress",s.innerHTML=a.progress_text(e.start_date,e.end_date,e),r.rtl&&(s.style.position="absolute",s.style.right="0px");var c=document.createElement("div");if(c.className="gantt_task_progress_wrapper",c.appendChild(s),n.appendChild(c),t.config.drag_progress&&!t.isReadonly(e)){var d=document.createElement("div"),u=l;r.rtl&&(u=i-l),d.style.left=u+"px",d.className="gantt_task_progress_drag",s.appendChild(d),n.appendChild(d)}}(e,_,g,l,c);var p=function(e,n,i){var r=document.createElement("div");return t.getTaskType(e.type)!=t.config.types.milestone?r.innerHTML=i.task_text(e.start_date,e.end_date,e):t.getTaskType(e.type)==t.config.types.milestone&&n&&(r.style.height=r.style.width=n+"px"),r.className="gantt_task_content",r}(e,g,c);e.textColor&&(p.style.color=e.textColor),_.appendChild(p);var v=function(e,n,i,r){var a=r.$getConfig(),o=[e];n&&o.push(n);var s=t.getState(),l=t.getTask(i);if(t.getTaskType(l.type)==a.types.milestone?o.push("gantt_milestone"):t.getTaskType(l.type)==a.types.project&&o.push("gantt_project"),o.push("gantt_bar_"+t.getTaskType(l.type)),t.isSummaryTask(l)&&o.push("gantt_dependent_task"),t.isSplitTask(l)&&(a.open_split_tasks&&!l.$open||!a.open_split_tasks)&&o.push("gantt_split_parent"),a.select_task&&t.isSelectedTask(i)&&o.push("gantt_selected"),i==s.drag_id&&(o.push("gantt_drag_"+s.drag_mode),s.touch_drag&&o.push("gantt_touch_"+s.drag_mode)),s.link_source_id==i&&o.push("gantt_link_source"),s.link_target_id==i&&o.push("gantt_link_target"),a.highlight_critical_path&&t.isCriticalTask&&t.isCriticalTask(l)&&o.push("gantt_critical_task"),s.link_landing_area&&s.link_target_id&&s.link_source_id&&s.link_target_id!=s.link_source_id&&(s.link_target_id==i||s.link_source_id==i)){var c=s.link_source_id,d=s.link_from_start,u=s.link_to_start,h=t.isLinkAllowed(c,i,d,u),f="";f=h?u?"link_start_allow":"link_finish_allow":u?"link_start_deny":"link_finish_deny",o.push(f)}return o.join(" ")}("gantt_task_line",c.task_class(e.start_date,e.end_date,e),e.id,a);(e.color||e.progressColor||e.textColor)&&(v+=" gantt_task_inline_color"),s.width<20&&(v+=" gantt_thin_task"),_.className=v;var m=["left:"+s.left+"px","top:"+(f+s.top)+"px","height:"+(d==l.types.milestone?s.height:u)+"px","line-height:"+Math.max(u<30?u-2:u,0)+"px","width:"+g+"px"];e.color&&m.push("background-color:"+e.color),e.textColor&&m.push("color:"+e.textColor),_.style.cssText=m.join(";");var y=function(t,e,r,a){var o="gantt_left "+i(!e.rtl,t),s=null;return a&&(s={type:"marginRight",value:a}),n(t,r.leftside_text,o,s)}(e,l,c,h);y&&_.appendChild(y),(y=function(t,e,r,a){var o="gantt_right "+i(!!e.rtl,t),s=null;return a&&(s={type:"marginLeft",value:a}),n(t,r.rightside_text,o,s)}(e,l,c,h))&&_.appendChild(y),t._waiAria.setTaskBarAttr(e,_);var k=t.getState();return t.isReadonly(e)||(l.drag_resize&&!t.isSummaryTask(e)&&d!=l.types.milestone&&r(_,"gantt_task_drag",e,function(t){var e=document.createElement("div");return e.className=t,e},l),l.drag_links&&l.show_links&&r(_,"gantt_link_control",e,function(t){var e=document.createElement("div");e.className=t,e.style.cssText=["height:"+u+"px","line-height:"+u+"px"].join(";");var n=document.createElement("div");n.className="gantt_link_point";var i=!1;return k.link_source_id&&l.touch&&(i=!0),n.style.display=i?"block":"",e.appendChild(n),e},l,h)),_}}function n(t,e,n,i){if(!e)return null;var r=e(t.start_date,t.end_date,t);if(!r)return null;var a=document.createElement("div");return a.className="gantt_side_content "+n,a.innerHTML=r,i&&(a.style[i.type]=Math.abs(i.value)+"px"),a}function i(e,n){var i=function(e){return e?{$source:[t.config.links.start_to_start],$target:[t.config.links.start_to_start,t.config.links.finish_to_start]}:{$source:[t.config.links.finish_to_start,t.config.links.finish_to_finish],$target:[t.config.links.finish_to_finish]}}(e);for(var r in i)for(var a=n[r],o=0;o=+l.min_date&&((s=r([n,a.rtl?"task_right":"task_left","task_start_date"].join(" "))).setAttribute("data-bind-property","start_date"),o&&(s.style.marginLeft=o+"px"),e.appendChild(s)),+i.end_date<=+l.max_date&&((s=r([n,a.rtl?"task_left":"task_right","task_end_date"].join(" "))).setAttribute("data-bind-property","end_date"),o&&(s.style.marginRight=o+"px"),e.appendChild(s))}return function(n,i,r){var a=(r=i.$getConfig()).type_renderers[t.getTaskType(n.type)],o=e;return a?a.call(t,n,function(e){return o.call(t,e,i,r)},i):o.call(t,n,i,r)}}},function(t,e,n){var i=n(26),r=n(4),a=n(0),o=n(2),s=n(36),l=n(106),c=function(t,e,n,o){this.$config=a.mixin({},e||{}),this.$scaleHelper=new i(o),this.$gantt=o,this._posFromDateCache={},this._timelineDragScroll=null,a.mixin(this,s(this)),r(this)};c.prototype={init:function(t){t.innerHTML+="
",this.$task=t.childNodes[0],this.$task.innerHTML="
",this.$task_scale=this.$task.childNodes[0],this.$task_data=this.$task.childNodes[1],this.$task_data.innerHTML="
",this.$task_bg=this.$task_data.childNodes[0],this.$task_links=this.$task_data.childNodes[1],this.$task_bars=this.$task_data.childNodes[2],this._tasks={col_width:0,width:[],full_width:0,trace_x:[],rendered:{}};var e=this.$getConfig(),n=e[this.$config.bind+"_attribute"],i=e[this.$config.bindLinks+"_attribute"];!n&&this.$config.bind&&(n="data-"+this.$config.bind+"-id"),!i&&this.$config.bindLinks&&(i="data-"+this.$config.bindLinks+"-id"),this.$config.item_attribute=n||null,this.$config.link_attribute=i||null;var r=this._createLayerConfig();this.$config.layers||(this.$config.layers=r.tasks),this.$config.linkLayers||(this.$config.linkLayers=r.links),this._attachLayers(this.$gantt),this.callEvent("onReady",[]),this.$gantt.ext.dragTimeline&&(this._timelineDragScroll=this.$gantt.ext.dragTimeline.create(),this._timelineDragScroll.attach(this))},setSize:function(t,e){var n=this.$getConfig();if(1*t===t&&(this.$config.width=t),1*e===e){this.$config.height=e;var i=Math.max(this.$config.height-n.scale_height);this.$task_data.style.height=i+"px"}this.refresh(),this.$task_bg.style.backgroundImage="",n.smart_rendering&&this.$config.rowStore?this.$task_bg.style.height=this.getTotalHeight()+"px":this.$task_bg.style.height="";for(var r=this._tasks,a=this.$task_data.childNodes,o=0,s=a.length;o'+this._prepareScaleHtml(t[a],e,n)+"")}return i.join("")},_prepareScaleHtml:function(t,e,n){var i=this.$getConfig(),r=this.$gantt.templates,a=[],s=null,l=null,c=t.format||t.template||t.date;"string"==typeof c&&(c=this.$gantt.date.date_to_str(c));var d=0,u=t.count;!i.smart_scales||isNaN(e)||isNaN(n)||(d=o.findBinary(t.left,e),u=o.findBinary(t.left,n)+1),l=t.css||function(){},!t.css&&i.inherit_scale_class&&(l=r.scale_cell_class);for(var h=d;h"+f+"";a.push(k)}}return a.join("")},dateFromPos:function(t){var e=this._tasks;if(t<0||t>e.full_width||!e.full_width)return null;var n=o.findBinary(this._tasks.left,t),i=this._tasks.left[n],r=e.width[n]||e.col_width,a=0;r&&(a=(t-i)/r,e.rtl&&(a=1-a));var s=0;return a&&(s=this._getColumnDuration(e,e.trace_x[n])),new Date(e.trace_x[n].valueOf()+Math.round(a*s))},posFromDate:function(t){if(!this.isVisible())return 0;if(!t)return 0;var e=String(t.valueOf());if(void 0!==this._posFromDateCache[e])return this._posFromDateCache[e];var n=this.columnIndexByDate(t);this.$gantt.assert(n>=0,"Invalid day index");var i=Math.floor(n),r=n%1,a=this._tasks.left[Math.min(i,this._tasks.width.length-1)];i==this._tasks.width.length&&(a+=this._tasks.width[this._tasks.width.length-1]),r&&(i=r.max_date)return this._tasks.rtl?0:n.length;var a=o.findBinary(n,e),s=this._getClosestVisibleColumn(a,n,i),l=n[s],c=this._tasks.trace_index_transition;if(!l)return c?c[0]:0;var d=(t-n[s])/this._getColumnDuration(this._tasks,n[s]);return c?c[s]+(1-d):s+d},getItemPosition:function(t,e,n){var i,r,a;return this._tasks.rtl?(r=this.posFromDate(e||t.start_date),i=this.posFromDate(n||t.end_date)):(i=this.posFromDate(e||t.start_date),r=this.posFromDate(n||t.end_date)),a=Math.max(r-i,0),{left:i,top:this.getItemTop(t.id),height:this.getBarHeight(t.id),width:a,rowHeight:this.getItemHeight(t.id)}},getBarHeight:function(t,e){var n=this.$getConfig(),i=this.$config.rowStore.getItem(t),r=i.task_height||i.bar_height||n.bar_height||n.task_height,a=this.getItemHeight(t);"full"==r&&(r=a-(n.task_height_offset||5));return r=Math.min(r,a),e&&(r=Math.round(r/Math.sqrt(2))),Math.max(r,0)},getScale:function(){return this._tasks},_getScales:function(){var t=this.$getConfig(),e=this.$scaleHelper,n=[e.primaryScale(t)].concat(e.getSubScales(t));return e.sortScales(n),n},_getColumnDuration:function(t,e){return this.$gantt.date.add(e,t.step,t.unit)-e},_bindStore:function(){if(this.$config.bind){var t=this.$gantt.getDatastore(this.$config.bind);if(this.$config.rowStore=t,t&&!t._timelineCacheAttached){var e=this;t._timelineCacheAttached=t.attachEvent("onBeforeFilter",function(){e._resetTopPositionHeight()})}}},_unbindStore:function(){if(this.$config.bind){var t=this.$gantt.getDatastore(this.$config.bind);t&&t._timelineCacheAttached&&(t.detachEvent(t._timelineCacheAttached),t._timelineCacheAttached=!1)}},refresh:function(){this._bindStore(),this.$config.bindLinks&&(this.$config.linkStore=this.$gantt.getDatastore(this.$config.bindLinks)),this._resetTopPositionHeight(),this._resetHeight(),this._initStaticBackgroundRender(),this._render_tasks_scales()},destructor:function(){var t=this.$gantt;this._clearLayers(t),this._unbindStore(),this.$task=null,this.$task_scale=null,this.$task_data=null,this.$task_bg=null,this.$task_links=null,this.$task_bars=null,this.$gantt=null,this.$config.rowStore&&(this.$config.rowStore.detachEvent(this._staticBgHandler),this.$config.rowStore=null),this.$config.linkStore&&(this.$config.linkStore=null),this._timelineDragScroll&&(this._timelineDragScroll.destructor(),this._timelineDragScroll=null),this.callEvent("onDestroy",[]),this.detachAllEvents()}},t.exports=c},function(t,e){t.exports=function(t,e,n){return{top:e.getItemTop(t.id),height:e.getItemHeight(t.id),left:0,right:1/0}}},function(t,e){t.exports=function(t){var e=[];return{delegate:function(n,i,r,a){e.push([n,i,r,a]),t.$services.getService("mouseEvents").delegate(n,i,r,a)},destructor:function(){for(var n=t.$services.getService("mouseEvents"),i=0;i",this.$grid=t.childNodes[0],this.$grid.innerHTML="
",this.$grid_scale=this.$grid.childNodes[0],this.$grid_data=this.$grid.childNodes[1];var d=a[this.$config.bind+"_attribute"];if(!d&&this.$config.bind&&(d="data-"+this.$config.bind+"-id"),this.$config.item_attribute=d||null,!this.$config.layers){var u=this._createLayerConfig();this.$config.layers=u}var h=o(e,this);h.init(),this._renderHeaderResizers=h.doOnRender,this._mouseDelegates=n(24)(e),l(e,this).init(),this._addLayers(this.$gantt),this._initEvents(),s&&(this._columnDND=new c(e,this),this._columnDND.init()),this.callEvent("onReady",[])},_validateColumnWidth:function(t,e){var n=t[e];if(n&&"*"!=n){var i=this.$gantt,r=1*n;isNaN(r)?i.assert(!1,"Wrong "+e+" value of column "+t.name):t[e]=r}},setSize:function(t,e){this.$config.width=this.$state.width=t,this.$config.height=this.$state.height=e;for(var n,i=this.getGridColumns(),r=0,a=(u=this.$getConfig()).grid_elastic_columns,o=0,s=i.length;od.max_width&&(u=d.max_width-d.width),r-=d.width,d.width+=u,l-=u}for(var h=l>0?1:-1;l>0&&1===h||l<0&&-1===h;){var f=l;for(o=e+1;o-1&&((_=i[e].width+l)==this._getColumnWidth(i[e],n,_)&&(i[e].width=_));return this._getColsTotalWidth()},_getColsTotalWidth:function(){for(var t=this.getGridColumns(),e=0,n=0;no+h&&(u.width=h=f-o),o+=h;var _=t._sort&&u.name==t._sort.name?"
":"",g=["gantt_grid_head_cell","gantt_grid_head_"+u.name,d?"gantt_last_cell":"",i.grid_header_class(u.name,u)].join(" "),p="width:"+(h-(d?1:0))+"px;",v=u.label||s["column_"+u.name]||s[u.name];v=v||"";var m="
"+v+_+"
";a.push(m)}this.$grid_scale.style.height=e.scale_height+"px",this.$grid_scale.style.lineHeight=l+"px",this.$grid_scale.innerHTML=a.join(""),this._renderHeaderResizers&&this._renderHeaderResizers()},_getGridWidth:function(){return this.$config.width},destructor:function(){this._clearLayers(this.$gantt),this._mouseDelegates&&(this._mouseDelegates.destructor(),this._mouseDelegates=null),this._unbindStore(),this.$grid=null,this.$grid_scale=null,this.$grid_data=null,this.$gantt=null,this.$config.rowStore&&(this.$config.rowStore.detachEvent(this._staticBgHandler),this.$config.rowStore=null),this.callEvent("onDestroy",[]),this.detachAllEvents()}},t.exports=d},function(t,e,n){var i=n(0);t.exports=function(t){var e=t.date,n=t.$services;return{getSum:function(t,e,n){void 0===n&&(n=t.length-1),void 0===e&&(e=0);for(var i=0,r=e;r<=n;r++)i+=t[r];return i},setSumWidth:function(t,e,n,i){var r=e.width;void 0===i&&(i=r.length-1),void 0===n&&(n=0);var a=i-n+1;if(!(n>r.length-1||a<=0||i>r.length-1)){var o=t-this.getSum(r,n,i);this.adjustSize(o,r,n,i),this.adjustSize(-o,r,i+1),e.full_width=this.getSum(r)}},splitSize:function(t,e){for(var n=[],i=0;in(e.unit,e.step)?-1:0});for(var i=0;i=0;d--){var u=d==t.length-1,h=this.initScaleConfig(t[d],r,a);u&&this.processIgnores(h),this.initColSizes(h,e,l,s[d]),this.limitVisibleRange(h),u&&(l=h.full_width),c.unshift(h)}for(d=0;d=+l&&(l=e.add(c,i,n));+c<+l;){o.call(this,new Date(c));var d=c.getTimezoneOffset();c=e.add(c,i,n),c=t._correct_dst_change(c,d,i,n),e[n+"_start"]&&(c=e[n+"_start"](c))}},limitVisibleRange:function(t){var n=t.trace_x,i=t.width.length-1,r=0;if(+n[0]<+t.min_date&&0!=i){var a=Math.floor(t.width[0]*((n[1]-t.min_date)/(n[1]-n[0])));r+=t.width[0]-a,t.width[0]=a,n[0]=new Date(t.min_date)}var o=n.length-1,s=n[o],l=e.add(s,t.step,t.unit);if(+l>+t.max_date&&o>0&&(a=t.width[o]-Math.floor(t.width[o]*((l-t.max_date)/(l-s))),r+=t.width[o]-a,t.width[o]=a),r){for(var c=this.getSum(t.width),d=0,u=0;u"}};function a(t,e,n){return e=e||[],"<"+t+o(n||[])+">"+(e.innerHTML||"")+""}function o(t){var e="";return i.forEach(t,function(t){e+=" "+t.key+"='"+t.value+"'"}),e}t.exports=r},function(t,e,n){var i=n(2);t.exports=function(t){var e={};return t.$data.tasksStore.attachEvent("onStoreUpdated",function(){e={}}),function(n,r,a,o){var s=n.id+"_"+r+"_"+a.unit+"_"+a.step;return e[s]?e[s]:e[s]=function(e,n,r,a){var o,s=!1,l={};t.config.process_resource_assignments&&n===t.config.resource_property?(o="task"==e.$role?t.getResourceAssignments(e.$resource_id,e.$task_id):t.getResourceAssignments(e.id),s=!0):o="task"==e.$role?[]:t.getTaskBy(n,e.id);for(var c,d,u,h,f,l=function(e,n,r){for(var a=n.unit,o=n.step,s={},l={},c=0;c0?t[o].$parent.getNextSibling(t[o].$id):t[o].$parent.getPrevSibling(t[o].$id);"resizer"==l.$name&&(l=i>0?l.$parent.getNextSibling(l.$id):l.$parent.getPrevSibling(l.$id));var c=l.getSize();if(a)t[o].$config.gravity=r;else if(l[n]){var d=s.gravity+c.gravity,u=s[n]+c[n],h=d/u;t[o].$config.gravity=h*r,l.$config[n]=u-r,l.$config.gravity=d-h*r}else t[o].$config[n]=r;var f=this.$gantt.$ui.getView("grid");!f||t[o].$content!==f||f.$config.scrollable||a||(this.$gantt.config.grid_width=r)}},e.prototype.resize=function(e){var n=!1;if(this.$root&&!this._resizeInProgress&&(this.callEvent("onBeforeResize",[]),n=!0,this._resizeInProgress=!0),t.prototype.resize.call(this,!0),t.prototype.resize.call(this,!1),n){var i=[];i=(i=(i=i.concat(this.getCellsByType("viewCell"))).concat(this.getCellsByType("viewLayout"))).concat(this.getCellsByType("hostCell"));for(var r=this.getCellsByType("scroller"),a=0;a=0&&this.$cells[e+1]?this.$cells[e+1]:null},e.prototype.getPrevSibling=function(t){var e=this.cellIndex(t);return e>=0&&this.$cells[e-1]?this.$cells[e-1]:null},e.prototype.cell=function(t){for(var e=0;e=n.childNodes.length?n.appendChild(t.$view):n.insertBefore(t.$view,n.childNodes[e])},e.prototype._parseConfig=function(t){this.$cells=[],this._xLayout=!t.rows;for(var e=t.rows||t.cols||t.views,n=0;n=0;i--){var a=this.$cells[i];a.$fill(n[i],this),a.$config.hidden&&a.$view.parentNode.removeChild(a.$view)}},e.prototype.$toHTML=function(){for(var e=this._xLayout?"x":"y",n=[],i=0;i=1e5&&(c.maxWidth=i),c.maxHeight>=1e5&&(c.maxHeight=a),c.minWidth=c.minWidth!=c.minWidth?0:c.minWidth,c.minHeight=c.minHeight!=c.minHeight?0:c.minHeight,this._xLayout?(c.minWidth+=this.$config.margin*this.$cells.length||0,c.minWidth+=2*this.$config.padding||0,c.minHeight+=2*this.$config.padding||0):(c.minHeight+=this.$config.margin*this.$cells.length||0,c.minHeight+=2*this.$config.padding||0),c},e.prototype._calcFreeSpace=function(t,e,n){var i=n?e.minWidth:e.minHeight,r=e.maxWidth,a=t;return a?(a>r&&(a=r),ar&&(a=r,this._free-=a,this._gravity-=e.gravity),aa&&(i=a),i=0;i--)if(!e[i].$config.hidden){n=i;break}for(i=0;i=n,a="";!r&&e[i+1]&&"scrollbar"==e[i+1].$config.view&&(this._xLayout?r=!0:a="gantt_layout_cell_border_transparent"),this._setBorders(r?[]:[t,a],e[i])}},e.prototype._updateCellVisibility=function(){for(var t=this._visibleCells||{},e=!this._visibleCells,n={},i=null,r=[],a=0;as+l&&e.y>c+d)return!1;if(e.y_endh){var g=h;h=u,u=g}if(f>_){g=_;_=f,f=g}return u+=-100,h+=100,f+=-100,_+=100,!(e.x>h&&e.x>_)&&!(e.x_endc.x&&f.topc.y&&d.push(h.id)}return{ids:d}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(174),r=n(173),a=n(172);e.LargerUnitsCache=a.LargerUnitsCache,e.createCacheObject=function(){return"undefined"!=typeof Map?new i.WorkUnitsMapCache:new r.WorkUnitsObjectCache}},function(t,e,n){var i=n(0),r=n(2);function a(t,e,n,i,r){return this.date=t,this.unit=e,this.task=n,this.id=i,this.calendar=r,this}function o(t,e,n,i,r,a){return this.date=t,this.dir=e,this.unit=n,this.task=i,this.id=r,this.calendar=a,this}function s(t,e,n,i,r,a,o){return this.start_date=t,this.duration=e,this.unit=n,this.step=i,this.task=r,this.id=a,this.calendar=o,this}function l(t,e,n,i){return this.start_date=t,this.end_date=e,this.task=n,this.calendar=i,this.unit=null,this.step=null,this}t.exports=function(t){return{getWorkHoursArguments:function(){var e=arguments[0];if(e=r.isDate(e)?{date:e}:i.mixin({},e),!r.isValidDate(e.date))throw t.assert(!1,"Invalid date argument for getWorkHours method"),new Error("Invalid date argument for getWorkHours method");return e},setWorkTimeArguments:function(){return arguments[0]},unsetWorkTimeArguments:function(){return arguments[0]},isWorkTimeArguments:function(){var e,n=arguments[0];if(n instanceof a)return n;if((e=n.date?new a(n.date,n.unit,n.task,null,n.calendar):new a(arguments[0],arguments[1],arguments[2],null,arguments[3])).unit=e.unit||t.config.duration_unit,!r.isValidDate(e.date))throw t.assert(!1,"Invalid date argument for isWorkTime method"),new Error("Invalid date argument for isWorkTime method");return e},getClosestWorkTimeArguments:function(e){var n,i=arguments[0];if(i instanceof o)return i;if(n=r.isDate(i)?new o(i):new o(i.date,i.dir,i.unit,i.task,null,i.calendar),i.id&&(n.task=i),n.dir=i.dir||"any",n.unit=i.unit||t.config.duration_unit,!r.isValidDate(n.date))throw t.assert(!1,"Invalid date argument for getClosestWorkTime method"),new Error("Invalid date argument for getClosestWorkTime method");return n},_getStartEndConfig:function(e){var n,i=l;if(e instanceof i)return e;if(r.isDate(e)?n=new i(arguments[0],arguments[1],arguments[2],arguments[3]):(n=new i(e.start_date,e.end_date,e.task),null!==e.id&&void 0!==e.id&&(n.task=e)),n.unit=n.unit||t.config.duration_unit,n.step=n.step||t.config.duration_step,n.start_date=n.start_date||n.start||n.date,!r.isValidDate(n.start_date))throw t.assert(!1,"Invalid start_date argument for getDuration method"),new Error("Invalid start_date argument for getDuration method");if(!r.isValidDate(n.end_date))throw t.assert(!1,"Invalid end_date argument for getDuration method"),new Error("Invalid end_date argument for getDuration method");return n},getDurationArguments:function(t,e,n,i){return this._getStartEndConfig.apply(this,arguments)},hasDurationArguments:function(t,e,n,i){return this._getStartEndConfig.apply(this,arguments)},calculateEndDateArguments:function(e,n,i,a){var o,l=arguments[0];if(l instanceof s)return l;if(o=r.isDate(l)?new s(arguments[0],arguments[1],arguments[2],void 0,arguments[3],void 0,arguments[4]):new s(l.start_date,l.duration,l.unit,l.step,l.task,null,l.calendar),null!==l.id&&void 0!==l.id&&(o.task=l,o.unit=null,o.step=null),o.unit=o.unit||t.config.duration_unit,o.step=o.step||t.config.duration_step,!r.isValidDate(o.start_date))throw t.assert(!1,"Invalid start_date argument for calculateEndDate method"),new Error("Invalid start_date argument for calculateEndDate method");return o}}}},function(t,e,n){var i=n(186);t.exports=function(t){var e={},n={},r=null,a=-1,o=null,s=i(t);return{_resetTopPositionHeight:function(){e={},n={},s.resetCache()},_resetHeight:function(){var t=this.$config.rowStore,e=this.getCacheStateTotalHeight(t);o?this.shouldClearHeightCache(o,e)&&(o=e,r=null):o=e,a=-1,s.resetCache()},getRowTop:function(t){if(s.canUseSimpleCalculation())return s.getRowTop(t);var e=this.$config.rowStore;if(!e)return 0;if(void 0!==n[t])return n[t];for(var i=e.getIndexRange(),r=0,a=0,o=0;o=i&&t=n.$level)return!1;for(;n&&this.exists(i);){if((n=this.getItem(i))&&n.id==e)return!0;i=this.getParent(n)}return!1},getSiblings:function(t){if(!this.exists(t))return i.$create();var e=this.getParent(t);return this.getChildren(e)},getNextSibling:function(t){for(var e=this.getSiblings(t),n=0,i=e.length;n0&&(r="0"),r||null}return null},getPrevSibling:function(t){for(var e=this.getSiblings(t),n=0,i=e.length;n0&&(r="0"),r||null}return null},getParent:function(t){var e=null;return(e=void 0!==t.id?t:this.getItem(t))?e[this.$parentProperty]:this.$getRootId()},clearAll:function(){this._branches={},o.prototype.clearAll.call(this)},calculateItemLevel:function(t){var e=0;return this.eachParent(function(){e++},t),e},_setParentInner:function(t,e,n){n||(t.hasOwnProperty("$rendered_parent")?this._move_branch(t,t.$rendered_parent,e):this._move_branch(t,t[this.$parentProperty],e))},setParent:function(t,e,n){this._setParentInner(t,e,n),t[this.$parentProperty]=e},_eachItemCached:function(t,e){for(var n=0,i=e.length;n=0;s--)i.push(o[s])}},eachItem:function(t,e){var n=this.$getRootId();r.defined(e)||(e=n);var i=l(e,n)||n,a=!1,o=!1,s=null;i===n&&(this._eachItemMainRangeCache?(a=!0,s=this._eachItemMainRangeCache):(o=!0,s=this._eachItemMainRangeCache=[])),a?this._eachItemCached(t,s):this._eachItemIterate(t,i,o?s:null)},eachParent:function(t,e){for(var n={},i=e,r=this.getParent(i);this.exists(r);){if(n[r])throw new Error("Invalid tasks tree. Cyclic reference has been detected on task "+r);n[r]=!0,i=this.getItem(r),t.call(this,i),r=this.getParent(i)}},_add_branch:function(t,e,n){var r=void 0===n?this.getParent(t):n;this.hasChild(r)||(this._branches[r]=i.$create());for(var a=this.getChildren(r),o=!1,s=0,l=a.length;sn[t]?1:-1}:t;if(e){var r=i;i=function(t,e){return r(e,t)}}var o=this.getChildren(n);if(o){for(var s=[],l=o.length-1;l>=0;l--)s[l]=this.getItem(o[l]);s.sort(i);for(l=0;l=0&&this.splice(t,e||1)},$remove:function(t){this.$removeAt(this.$find(t))},$insertAt:function(t,e){if(e||0===e){var n=this.splice(e,this.length-e);this[e]=t,this.push.apply(this,n)}else this.push(t)},$find:function(t){for(var e=0;ei&&(e=Math.min(n.length,e))}this.pull[t.id]=t,this.isSilent()||this._updateOrder(function(){-1===this.$find(t.id)&&this.$insertAt(t.id,e)}),this.filter()},isVisible:function(t){return this.visibleOrder.$find(t)>-1},getVisibleItems:function(){return this.getIndexRange()},addItem:function(t,e){return r.defined(t.id)||(t.id=r.uid()),this.$initItem&&(t=this.$initItem(t)),!(!this.isSilent()&&!1===this.callEvent("onBeforeAdd",[t.id,t]))&&(this._addItemInner(t,e),this.isSilent()||(this.callEvent("onAfterAdd",[t.id,t]),this.callEvent("onStoreUpdated",[t.id,t,"add"])),t.id)},_changeIdInner:function(t,e){this.pull[t]&&(this.pull[e]=this.pull[t]);var n=this._searchVisibleOrder[t];this.pull[e].id=e,this._updateOrder(function(){this[this.$find(t)]=e}),this._searchVisibleOrder[e]=n,delete this._searchVisibleOrder[t],delete this.pull[t]},changeId:function(t,e){this._changeIdInner(t,e),this.callEvent("onIdChange",[t,e])},exists:function(t){return!!this.pull[t]},_moveInner:function(t,e){var n=this.getIdByIndex(t);this._updateOrder(function(){this.$removeAt(t),this.$insertAt(n,Math.min(this.length,e))})},move:function(t,e){var n=this.getIdByIndex(t),i=this.getItem(n);this._moveInner(t,e),this.isSilent()||this.callEvent("onStoreUpdated",[i.id,i,"move"])},clearAll:function(){this.$destroyed||(this.silent(function(){this.unselect()}),this.pull={},this.visibleOrder=i.$create(),this.fullOrder=i.$create(),this.isSilent()||(this.callEvent("onClearAll",[]),this.refresh()))},silent:function(t,e){var n=!1;this.isSilent()&&(n=!0),this._skip_refresh=!0,t.call(e||this),n||(this._skip_refresh=!1)},isSilent:function(){return!!this._skip_refresh},arraysEqual:function(t,e){if(t.length!==e.length)return!1;for(var n=0;n1)for(var n=1;n","gm"),n=new RegExp(" +","gm");function i(t){return(t+"").replace(e," ").replace(n," ")}var r=new RegExp("'","gm");function a(t){return(t+"").replace(r,"'")}for(var o in t._waiAria={getAttributeString:function(t){var e=[" "];for(var n in t){var r=a(i(t[n]));e.push(n+"='"+r+"'")}return e.push(" "),e.join(" ")},getTimelineCellAttr:function(e){return t._waiAria.getAttributeString({"aria-label":e})},_taskCommonAttr:function(e,n){e.start_date&&e.end_date&&(n.setAttribute("aria-label",i(t.templates.tooltip_text(e.start_date,e.end_date,e))),e.$dataprocessor_class&&n.setAttribute("aria-busy",!0),n.setAttribute("aria-selected",t.isSelectedTask(e.id)?"true":"false"))},setTaskBarAttr:function(e,n){this._taskCommonAttr(e,n),!t.isReadonly(e)&&t.config.drag_move&&(e.id!=t.getState("tasksDnd").drag_id?n.setAttribute("aria-grabbed",!1):n.setAttribute("aria-grabbed",!0))},taskRowAttr:function(e,n){this._taskCommonAttr(e,n),!t.isReadonly(e)&&t.config.order_branch&&n.setAttribute("aria-grabbed",!1),n.setAttribute("role","row"),n.setAttribute("aria-level",e.$level),t.hasChild(e.id)&&n.setAttribute("aria-expanded",e.$open?"true":"false")},linkAttr:function(e,n){var r=t.config.links,a=e.type==r.finish_to_start||e.type==r.start_to_start,o=e.type==r.start_to_start||e.type==r.start_to_finish,s=t.locale.labels.link+" "+t.templates.drag_link(e.source,o,e.target,a);n.setAttribute("aria-label",i(s)),t.isReadonly(e)&&n.setAttribute("aria-readonly",!0)},gridSeparatorAttr:function(t){t.setAttribute("role","separator")},lightboxHiddenAttr:function(t){t.setAttribute("aria-hidden","true")},lightboxVisibleAttr:function(t){t.setAttribute("aria-hidden","false")},lightboxAttr:function(t){t.setAttribute("role","dialog"),t.setAttribute("aria-hidden","true"),t.firstChild.setAttribute("role","heading")},lightboxButtonAttrString:function(e){return this.getAttributeString({role:"button","aria-label":t.locale.labels[e],tabindex:"0"})},lightboxHeader:function(t,e){t.setAttribute("aria-label",e)},lightboxSelectAttrString:function(e){var n="";switch(e){case"%Y":n=t.locale.labels.years;break;case"%m":n=t.locale.labels.months;break;case"%d":n=t.locale.labels.days;break;case"%H:%i":n=t.locale.labels.hours+t.locale.labels.minutes}return t._waiAria.getAttributeString({"aria-label":n})},lightboxDurationInputAttrString:function(e){return this.getAttributeString({"aria-label":t.locale.labels.column_duration,"aria-valuemin":"0"})},gridAttrString:function(){return[" role='treegrid'",t.config.multiselect?"aria-multiselectable='true'":"aria-multiselectable='false'"," "].join(" ")},gridScaleRowAttrString:function(){return"role='row'"},gridScaleCellAttrString:function(e,n){var i="";if("add"==e.name)i=this.getAttributeString({role:"button","aria-label":t.locale.labels.new_task});else{var r={role:"columnheader","aria-label":n};t._sort&&t._sort.name==e.name&&("asc"==t._sort.direction?r["aria-sort"]="ascending":r["aria-sort"]="descending"),i=this.getAttributeString(r)}return i},gridDataAttrString:function(){return"role='rowgroup'"},gridCellAttrString:function(e,n,i){var r={role:"gridcell","aria-label":n};return e.editor&&!t.isReadonly(i)||(r["aria-readonly"]=!0),this.getAttributeString(r)},gridAddButtonAttrString:function(e){return this.getAttributeString({role:"button","aria-label":t.locale.labels.new_task})},messageButtonAttrString:function(t){return"tabindex='0' role='button' aria-label='"+t+"'"},messageInfoAttr:function(t){t.setAttribute("role","alert")},messageModalAttr:function(t,e){t.setAttribute("role","dialog"),e&&t.setAttribute("aria-labelledby",e)},quickInfoAttr:function(t){t.setAttribute("role","dialog")},quickInfoHeaderAttrString:function(){return" role='heading' "},quickInfoHeader:function(t,e){t.setAttribute("aria-label",e)},quickInfoButtonAttrString:function(e){return t._waiAria.getAttributeString({role:"button","aria-label":e,tabindex:"0"})},tooltipAttr:function(t){t.setAttribute("role","tooltip")},tooltipVisibleAttr:function(t){t.setAttribute("aria-hidden","false")},tooltipHiddenAttr:function(t){t.setAttribute("aria-hidden","true")}},t._waiAria)t._waiAria[o]=function(e){return function(){return t.config.wai_aria_attributes?e.apply(this,arguments):""}}(t._waiAria[o])}},function(t,e){t.exports=function(t){t._extend_to_optional=function(e){var n=e,i={render:n.render,focus:n.focus,set_value:function(e,r,a,o){var s=t._resolve_default_mapping(o);if(!a[s.start_date]||"start_date"==s.start_date&&this._isAllowedUnscheduledTask(a)){i.disable(e,o);var l={};for(var c in s)l[s[c]]=a[c];return n.set_value.call(t,e,r,l,o)}return i.enable(e,o),n.set_value.call(t,e,r,a,o)},get_value:function(e,i,r){return r.disabled?{start_date:null}:n.get_value.call(t,e,i,r)},update_block:function(e,n){if(t.callEvent("onSectionToggle",[t._lightbox_id,n]),e.style.display=n.disabled?"none":"block",n.button){var i=e.previousSibling.querySelector(".gantt_custom_button_label"),r=t.locale.labels,a=n.disabled?r[n.name+"_enable_button"]:r[n.name+"_disable_button"];i.innerHTML=a}t.resizeLightbox()},disable:function(t,e){e.disabled=!0,i.update_block(t,e)},enable:function(t,e){e.disabled=!1,i.update_block(t,e)},button_click:function(e,n,r,a){if(!1!==t.callEvent("onSectionButton",[t._lightbox_id,r])){var o=t._get_typed_lightbox_config()[e];o.disabled?i.enable(a,o):i.disable(a,o)}}};return i},t.form_blocks.duration_optional=t._extend_to_optional(t.form_blocks.duration),t.form_blocks.time_optional=t._extend_to_optional(t.form_blocks.time)}},function(t,e,n){var i=n(3);t.exports=function(t){var e=n(12)(t);function r(){return e.apply(this,arguments)||this}return i(r,e),r.prototype.render=function(n){var i=t.config.types,r=t.locale.labels,a=[],o=n.filter||function(t,e){return!i.placeholder||e!==i.placeholder};for(var s in i)!1==!o(s,i[s])&&a.push({key:i[s],label:r["type_"+s]});n.options=a;var l=n.onchange;return n.onchange=function(){t.changeLightboxType(this.value),this.value===t.config.types.task&&(t._lightbox_new_type="task"),"function"==typeof l&&l.apply(this,arguments)},e.prototype.render.apply(this,arguments)},r}},function(t,e,n){var i=n(3),r=n(29);t.exports=function(t){var e=n(6)(t);function a(){return e.apply(this,arguments)||this}function o(e){return!e||e===t.config.constraint_types.ASAP||e===t.config.constraint_types.ALAP}function s(t,e){for(var n=o(e),i=0;i",a=[];for(var o in t.config.constraint_types)a.push({key:t.config.constraint_types[o],label:t.locale.labels[t.config.constraint_types[o]]});return e.options=e.options||a,i+=""+r.getHtmlSelect(e.options,[{key:"data-type",value:"constraint-type"}])+"",i+="",i+=""},a.prototype.set_value=function(e,n,i,r){var a=e.querySelector("[data-constraint-type-select] select"),o=e.querySelectorAll("[data-constraint-time-select] select"),l=r._time_format_order,c=t._resolve_default_mapping(r);a._eventsInitialized||(a.addEventListener("change",function(t){s(o,t.target.value)}),a._eventsInitialized=!0);var d=i[c.constraint_date]||new Date;t.form_blocks._fill_lightbox_select(o,0,d,l,r);var u=i[c.constraint_type]||t.getConstraintType(i);a.value=u,s(o,u)},a.prototype.get_value=function(e,n,i){var r=e.querySelector("[data-constraint-type-select] select"),a=e.querySelectorAll("[data-constraint-time-select] select"),s=r.value,l=null;return o(s)||(l=t.form_blocks.getTimePickerValue(a,i)),{constraint_type:s,constraint_date:l}},a.prototype.focus=function(e){t._focus(e.querySelector("select"))},a}},function(t,e,n){var i=n(3);t.exports=function(t){var e=n(12)(t);function r(){return e.apply(this,arguments)||this}function a(e,n){var i=[],r=[];n&&(i=t.getTaskByTime(),e.allow_root&&i.unshift({id:t.config.root_id,text:e.root_label||""}),i=function(e,n,i){var r=n.filter||function(){return!0};e=e.slice(0);for(var a=0;a",i=" "+t.locale.labels[t.config.duration_unit+"s"]+" ",r=e.single_date?" style='display:none'":"",a=e.readonly?" disabled='disabled'":"",o=t._waiAria.lightboxDurationInputAttrString(e),s="gantt_duration_value";e.formatter&&(i="",s+=" gantt_duration_value_formatted");var l="
"+i+"
";return"
"+n+" "+l+"
"},a.prototype.set_value=function(e,n,i,r){var a,c,d,u,h=e.getElementsByTagName("select"),f=e.getElementsByTagName("input"),_=f[1],g=[f[0],f[2]],p=e.getElementsByTagName("span")[0],v=r._time_format_order;function m(){var n=s.call(t,e,r),a=l.call(t,e,r),o=t.calculateEndDate({start_date:n,duration:a,task:i}),c=t.templates.task_end_date||t.templates.task_date;p.innerHTML=c(o)}function y(t){var e=_.value;e=o(r).parse(e),window.isNaN(e)&&(e=0),(e+=t)<1&&(e=1),_.value=o(r).format(e),m()}g[0].onclick=t.bind(function(){y(-1*t.config.duration_step)},this),g[1].onclick=t.bind(function(){y(1*t.config.duration_step)},this),h[0].onchange=m,h[1].onchange=m,h[2].onchange=m,h[3]&&(h[3].onchange=m),_.onkeydown=t.bind(function(e){var n;return(n=(e=e||window.event).charCode||e.keyCode||e.which)==t.constants.KEY_CODES.DOWN?(y(-1*t.config.duration_step),!1):n==t.constants.KEY_CODES.UP?(y(1*t.config.duration_step),!1):void window.setTimeout(m,1)},this),_.onchange=t.bind(m,this),"string"==typeof(a=t._resolve_default_mapping(r))&&(a={start_date:a}),c=i[a.start_date]||new Date,d=i[a.end_date]||t.calculateEndDate({start_date:c,duration:1,task:i}),u=Math.round(i[a.duration])||t.calculateDuration({start_date:c,end_date:d,task:i}),u=o(r).format(u),t.form_blocks._fill_lightbox_select(h,0,c,v,r),_.value=u,m()},a.prototype.get_value=function(e,n,i){var r=s(e,i),a=l(e,i),o=t.calculateEndDate({start_date:r,duration:a,task:n});return"string"==typeof t._resolve_default_mapping(i)?r:{start_date:r,end_date:o,duration:a}},a.prototype.focus=function(e){t._focus(e.getElementsByTagName("select")[0])},a}},function(t,e,n){var i=n(3);t.exports=function(t){var e=n(6)(t);function r(){return e.apply(this,arguments)||this}return i(r,e),r.prototype.render=function(t){var e="
";if(t.options&&t.options.length)for(var n=0;n"+t.options[n].label+"";return e+="
"},r.prototype.set_value=function(t,e,n,i){var r;i.options&&i.options.length&&(r=t.querySelector("input[type=radio][value='"+e+"']")||t.querySelector("input[type=radio][value='"+i.default_value+"']"))&&(!t._dhx_onchange&&i.onchange&&(t.onchange=i.onchange,t._dhx_onchange=!0),r.checked=!0)},r.prototype.get_value=function(t,e){var n=t.querySelector("input[type=radio]:checked");return n?n.value:""},r.prototype.focus=function(e){t._focus(e.querySelector("input[type=radio]"))},r}},function(t,e,n){var i=n(2),r=n(3);t.exports=function(t){var e=n(6)(t);function a(){return e.apply(this,arguments)||this}return r(a,e),a.prototype.render=function(t){var e="
";if(t.options&&t.options.length)for(var n=0;n"+t.options[n].label+"";else t.single_value=!0,e+="";return e+="
"},a.prototype.set_value=function(t,e,n,r){var a=Array.prototype.slice.call(t.querySelectorAll("input[type=checkbox]"));(!t._dhx_onchange&&r.onchange&&(t.onchange=r.onchange,t._dhx_onchange=!0),r.single_value)?a[0].checked=!!e:i.forEach(a,function(t){t.checked=!!e&&e.indexOf(t.value)>=0})},a.prototype.get_value=function(t,e,n){return n.single_value?t.querySelector("input[type=checkbox]").checked:i.arrayMap(Array.prototype.slice.call(t.querySelectorAll("input[type=checkbox]:checked")),function(t){return t.value})},a.prototype.focus=function(e){t._focus(e.querySelector("input[type=checkbox]"))},a}},function(t,e,n){var i=n(3);t.exports=function(t){var e=n(6)(t);function r(){return e.apply(this,arguments)||this}return i(r,e),r.prototype.render=function(e){var n=t.form_blocks.getTimePicker.call(this,e),i="
";return i+=n,e.single_date?(n=t.form_blocks.getTimePicker.call(this,e,!0),i+=""):i+="  –  ",i+=n,i+="
"},r.prototype.set_value=function(e,n,i,r){var a=r,o=e.getElementsByTagName("select"),s=r._time_format_order;if(a.auto_end_date)for(var l=function(){u=new Date(o[s[2]].value,o[s[1]].value,o[s[0]].value,0,0),h=t.calculateEndDate({start_date:u,duration:1,task:i}),t.form_blocks._fill_lightbox_select(o,s.size,h,s,a)},c=0;c<4;c++)o[c].onchange=l;var d=t._resolve_default_mapping(r);"string"==typeof d&&(d={start_date:d});var u=i[d.start_date]||new Date,h=i[d.end_date]||t.calculateEndDate({start_date:u,duration:1,task:i});t.form_blocks._fill_lightbox_select(o,0,u,s,a),t.form_blocks._fill_lightbox_select(o,s.size,h,s,a)},r.prototype.get_value=function(e,n,i){var r,a=e.getElementsByTagName("select"),o=i._time_format_order;return r=t.form_blocks.getTimePickerValue(a,i),"string"==typeof t._resolve_default_mapping(i)?r:{start_date:r,end_date:function(e,n,r){var a=t.form_blocks.getTimePickerValue(e,i,n.size);return a<=r&&(!1!==i.autofix_end||i.single_date)?t.date.add(r,t._get_timepicker_step(),"minute"):a}(a,o,r)}},r.prototype.focus=function(e){t._focus(e.getElementsByTagName("select")[0])},r}},function(t,e,n){var i=n(3);t.exports=function(t){var e=n(6)(t);function r(){return e.apply(this,arguments)||this}return i(r,e),r.prototype.render=function(t){return"
"},r.prototype.set_value=function(e,n){t.form_blocks.textarea._get_input(e).value=n||""},r.prototype.get_value=function(e){return t.form_blocks.textarea._get_input(e).value},r.prototype.focus=function(e){var n=t.form_blocks.textarea._get_input(e);t._focus(n,!0)},r.prototype._get_input=function(t){return t.querySelector("textarea")},r}},function(t,e,n){var i=n(3);t.exports=function(t){var e=n(6)(t);function r(){return e.apply(this,arguments)||this}return i(r,e),r.prototype.render=function(t){return"
"},r.prototype.set_value=function(t,e){t.innerHTML=e||""},r.prototype.get_value=function(t){return t.innerHTML||""},r.prototype.focus=function(){},r}},function(t,e,n){function i(t){"@babel/helpers - typeof";return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t.exports=function(t){var e=n(1),r=n(2),a=n(56)(t),o=n(55)(t),s=n(54)(t),l=n(12)(t),c=n(53)(t),d=n(52)(t),u=n(51)(t),h=n(50)(t),f=n(12)(t),_=n(49)(t),g=n(48)(t);function p(e,n){var i,r,a="";for(r=0;r
"+t.locale.labels[i]+"
";return a}function v(e,n,i){var r,a,o,s,l,c,d="";switch(i.timeFormat[n]){case"%Y":for(e._time_format_order[2]=n,e._time_format_order.size++,e.year_range&&(isNaN(e.year_range)?e.year_range.push&&(o=e.year_range[0],s=e.year_range[1]):r=e.year_range),r=r||10,a=a||Math.floor(r/2),o=o||i.date.getFullYear()-a,s=s||t.getState().max_date.getFullYear()+a,l=o;l"+l+"";break;case"%m":for(e._time_format_order[1]=n,e._time_format_order.size++,l=0;l<12;l++)d+="";break;case"%d":for(e._time_format_order[0]=n,e._time_format_order.size++,l=1;l<32;l++)d+="";break;case"%H:%i":for(e._time_format_order[3]=n,e._time_format_order.size++,l=i.first,c=i.date.getDate(),e._time_values=[];l"+t.templates.time_picker(i.date)+"",e._time_values.push(l),i.date.setTime(i.date.valueOf()+60*t._get_timepicker_step()*1e3),l=24*(i.date.getDate()!=c?1:0)*60+60*i.date.getHours()+i.date.getMinutes()}return d}t._lightbox_methods={},t._lightbox_template="
 
",t._lightbox_root=t.$root,t.$services.getService("state").registerProvider("lightbox",function(){return{lightbox:t._lightbox_id}}),t.showLightbox=function(t){if(this.callEvent("onBeforeLightbox",[t])){var e=this.getTask(t),n=this.getLightbox(this.getTaskType(e.type));this._center_lightbox(n),this.showCover(),this._fill_lightbox(t,n),this._waiAria.lightboxVisibleAttr(n),this.callEvent("onLightbox",[t])}},t._get_timepicker_step=function(){if(this.config.round_dnd_dates){var e;if(function(t){var e=t.$ui.getView("timeline");return!(!e||!e.isVisible())}(this)){var n=t.getScale();e=r.getSecondsInUnit(n.unit)*n.step/60}return(!e||e>=1440)&&(e=this.config.time_step),e}return this.config.time_step},t.getLabel=function(t,e){for(var n=this._get_typed_lightbox_config(),i=0;i
"+this.locale.labels["button_"+t[n].button]+"
"),this.config.wide_form&&(e+="
"),e+="
"+i.render.call(this,t[n]),e+="
"}}return e},t.resizeLightbox=function(){if(this._lightbox){var t=this._lightbox.querySelector(".gantt_cal_larea");t.style.height="0px",t.style.height=t.scrollHeight+"px",this._lightbox.style.height=t.scrollHeight+this.config.lightbox_additional_height+"px",t.style.height=t.scrollHeight+"px"}},t._center_lightbox=function(e){if(e){e.style.display="block";var n=window.pageYOffset||t._lightbox_root.scrollTop||document.documentElement.scrollTop,i=window.pageXOffset||t._lightbox_root.scrollLeft||document.documentElement.scrollLeft,r=window.innerHeight||document.documentElement.clientHeight;e.style.top=n?Math.round(n+Math.max((r-e.offsetHeight)/2,0))+"px":Math.round(Math.max((r-e.offsetHeight)/2,0)+9)+"px",document.documentElement.scrollWidth>t._lightbox_root.offsetWidth?e.style.left=Math.round(i+(t._lightbox_root.offsetWidth-e.offsetWidth)/2)+"px":e.style.left=Math.round((t._lightbox_root.offsetWidth-e.offsetWidth)/2)+"px"}},t.showCover=function(){this._cover||(this._cover=document.createElement("DIV"),this._cover.className="gantt_cal_cover",t._lightbox_root.appendChild(this._cover))},t.event(window,"deviceorientation",function(){t.getState().lightbox&&t._center_lightbox(t.getLightbox())}),t._init_lightbox_events=function(){t.lightbox_events={},t.lightbox_events.gantt_save_btn=function(){t._save_lightbox()},t.lightbox_events.gantt_delete_btn=function(){t._lightbox_new_type=null,t.callEvent("onLightboxDelete",[t._lightbox_id])&&(t.isTaskExists(t._lightbox_id)?t.$click.buttons.delete(t._lightbox_id):t.hideLightbox())},t.lightbox_events.gantt_cancel_btn=function(){t._cancel_lightbox()},t.lightbox_events.default=function(n,i){if(i.getAttribute("data-dhx-button"))t.callEvent("onLightboxButton",[i.className,i,n]);else{var r,a,o=e.getClassName(i);if(-1!=o.indexOf("gantt_custom_button"))if(-1!=o.indexOf("gantt_custom_button_"))for(r=i.parentNode.getAttribute("data-index"),a=i;a&&-1==e.getClassName(a).indexOf("gantt_cal_lsection");)a=a.parentNode;else r=i.getAttribute("data-index"),a=i.parentNode,i=i.firstChild;var s=t._get_typed_lightbox_config();r&&(r*=1,t.form_blocks[s[1*r].type].button_click(r,i,a,a.nextSibling))}},this.event(t.getLightbox(),"click",function(n){n=n||window.event;var i=e.getTargetNode(n),r=e.getClassName(i);return r||(i=i.previousSibling,r=e.getClassName(i)),i&&r&&0===r.indexOf("gantt_btn_set")&&(i=i.firstChild,r=e.getClassName(i)),!(!i||!r)&&(t.defined(t.lightbox_events[i.className])?t.lightbox_events[i.className]:t.lightbox_events.default)(n,i)}),t.getLightbox().onkeydown=function(n){var i=n||window.event,r=n.target||n.srcElement,a=e.getClassName(r).indexOf("gantt_btn_set")>-1;switch((n||i).keyCode){case t.constants.KEY_CODES.SPACE:if((n||i).shiftKey)return;a&&r.click&&r.click();break;case t.keys.edit_save:if((n||i).shiftKey)return;a&&r.click?r.click():t._save_lightbox();break;case t.keys.edit_cancel:t._cancel_lightbox()}}},t._cancel_lightbox=function(){var e=this.getLightboxValues();this.callEvent("onLightboxCancel",[this._lightbox_id,e.$new]),t.isTaskExists(e.id)&&e.$new&&this.silent(function(){t.$data.tasksStore.removeItem(e.id),t._update_flags(e.id,null)}),this.refreshData(),this.hideLightbox()},t._save_lightbox=function(){var t=this.getLightboxValues();this.callEvent("onLightboxSave",[this._lightbox_id,t,!!t.$new])&&(t.$new?(delete t.$new,this.addTask(t,t.parent,this.getTaskIndex(t.id))):this.isTaskExists(t.id)&&(this.mixin(this.getTask(t.id),t,!0),this.refreshTask(t.id),this.updateTask(t.id)),this.refreshData(),this.hideLightbox())},t._resolve_default_mapping=function(t){var e=t.map_to;return!{time:!0,time_optional:!0,duration:!0,duration_optional:!0}[t.type]?"constraint"===t.type&&(t.map_to&&"string"!=typeof t.map_to||(e={constraint_type:"constraint_type",constraint_date:"constraint_date"})):"auto"==t.map_to?e={start_date:"start_date",end_date:"end_date",duration:"duration"}:"string"==typeof t.map_to&&(e={start_date:t.map_to}),e},t.getLightboxValues=function(){var e={};t.isTaskExists(this._lightbox_id)&&(e=this.mixin({},this.getTask(this._lightbox_id)));for(var n=this._get_typed_lightbox_config(),r=0;r0&&(s+=" "),(a=v(e,i,c))&&(o=t._waiAria.lightboxSelectAttrString(c.timeFormat[i]),s+="");return s},getTimePickerValue:function(e,n,i){var r,a=n._time_format_order,o=t.defined(a[3]),s=0,l=0,c=i||0;return o&&(r=parseInt(e[a[3]+c].value,10),s=Math.floor(r/60),l=r%60),new Date(e[a[2]+c].value,e[a[1]+c].value,e[a[0]+c].value,s,l)},_fill_lightbox_select:function(e,n,i,r){if(e[n+r[0]].value=i.getDate(),e[n+r[1]].value=i.getMonth(),e[n+r[2]].value=i.getFullYear(),t.defined(r[3])){var a=60*i.getHours()+i.getMinutes();a=Math.round(a/t._get_timepicker_step())*t._get_timepicker_step();var o=e[n+r[3]];o.value=a,o.setAttribute("data-value",a)}},template:new a,textarea:new o,select:new l,time:new s,duration:new u,parent:new h,radio:new d,checkbox:new c,resources:new f,constraint:new _,typeselect:new g},t._is_lightbox_timepicker=function(){for(var t=this._get_typed_lightbox_config(),e=0;e1),this.config.touch){var t=!0;try{document.createEvent("TouchEvent")}catch(e){t=!1}t?this._touch_events(["touchmove","touchstart","touchend"],function(t){return t.touches&&t.touches.length>1?null:t.touches[0]?{target:t.target,pageX:t.touches[0].pageX,pageY:t.touches[0].pageY,clientX:t.touches[0].clientX,clientY:t.touches[0].clientY}:t},function(){return!1}):window.navigator.pointerEnabled?this._touch_events(["pointermove","pointerdown","pointerup"],function(t){return"mouse"==t.pointerType?null:t},function(t){return!t||"mouse"==t.pointerType}):window.navigator.msPointerEnabled&&this._touch_events(["MSPointerMove","MSPointerDown","MSPointerUp"],function(t){return t.pointerType==t.MSPOINTER_TYPE_MOUSE?null:t},function(t){return!t||t.pointerType==t.MSPOINTER_TYPE_MOUSE})}},t));var i=[];t._touch_events=function(r,a,o){for(var s,l=0,c=!1,d=!1,u=null,h=null,f=null,_=[],g=null,p=0;p5||Math.abs(p)>5)&&(d=!0,l=0,s=g?e(g):t.getScrollState()),d){var m,y=s.x+_,k=s.y+p;if(g?(!function(e,n,i){var r=e.$config.scrollX?t.$ui.getView(e.$config.scrollX):null,a=e.$config.scrollY?t.$ui.getView(e.$config.scrollY):null;r&&r.scrollTo(n,null),a&&a.scrollTo(null,i)}(g,y,k),m=e(g)):(t.scrollTo(y,k),m=t.getScrollState()),s.x!=m.x&&p>2*_||s.y!=m.y&&_>2*p)return v(i)}}return v(i)}return!0}}]),i.push([this.$container,"contextmenu",function(t){if(c)return v(t)}]),i.push([this.$container,r[1],function(e){if(document&&document.body&&document.body.classList.add("gantt_touch_active"),!o(e))if(e.touches&&e.touches.length>1)c=!1;else{u=a(e),g=function(e){for(var n=t.$layout.getCellsByType("viewCell"),i=0;i=r.left&&e.clientX<=r.right&&e.clientY<=r.bottom&&e.clientY>=r.top)return n[i]}}(u),t._locate_css(u,"gantt_hor_scroll")||t._locate_css(u,"gantt_ver_scroll")||(c=!0);var i=n();h=setTimeout(function(){var e=t.locate(u);i&&e&&!t._locate_css(u,"gantt_link_control")&&!t._locate_css(u,"gantt_grid_data")&&(i.on_mouse_down(u),i.drag&&i.drag.start_drag&&(!function(e){var n=t._getTaskLayers(),i=t.getTask(e);if(i&&t.isTaskVisible(e)){f=e;for(var r=0;re._levels.length-1||e.setLevel(t)},this.getCurrentLevel=function(){return e._activeLevelIndex},this.getLevels=function(){return e._levels},this.setLevel=function(t){var n=e._getZoomIndexByName(t);-1===n&&e.$gantt.assert(-1!==n,"Invalid zoom level for gantt.ext.zoom.setLevel. "+t+" is not an expected value."),e._setLevel(n,0)},this._getZoomIndexByName=function(t){var n=-1;if("string"==typeof t){if(!isNaN(Number(t))&&e._levels[Number(t)])n=Number(t);else for(var i=0;i0&&(r=!0),t.preventDefault(),t.stopPropagation(),e._setScaleSettings(r,i)},this._setScaleDates=function(){e._initialStartDate&&e._initialEndDate&&(e.$gantt.config.start_date=e._initialStartDate,e.$gantt.config.end_date=e._initialEndDate)},this.$gantt=t,this._domEvents=this.$gantt._createDomEventScope()}return t.prototype.init=function(t){var e=this;this.$gantt.env.isNode||(this._initialStartDate=t.startDate,this._initialEndDate=t.endDate,this._activeLevelIndex=t.activeLevelIndex?t.activeLevelIndex:0,this._levels=this._mapScales(t.levels||o),this._handler=t.handler||this._defaultHandler,this._minColumnWidth=t.minColumnWidth||60,this._maxColumnWidth=t.maxColumnWidth||240,this._widthStep=t.widthStep||3/8*t.minColumnWidth,this._useKey=t.useKey,this._initialized||(r(this),this.$gantt.attachEvent("onGanttScroll",function(){e._getVisibleDate()})),this._domEvents.detachAll(),"wheel"===t.trigger&&(this.$gantt.$root?this._attachWheelEvent(t):this.$gantt.attachEvent("onGanttReady",function(){e._attachWheelEvent(t)})),this._initialized=!0,this.setLevel(this._activeLevelIndex))},t.prototype._mapScales=function(t){return t.map(function(t){return Array.isArray(t)?{scales:t}:t})},t.prototype._setScaleSettings=function(t,e){t?this._stepUp(e):this._stepDown(e)},t.prototype._stepUp=function(t){if(!(this._activeLevelIndex>=this._levels.length-1)){var e=this._activeLevelIndex;if(this._setScaleDates(),this._widthStep){var n=this.$gantt.config.min_column_width+this._widthStep;n>this._maxColumnWidth&&(n=this._minColumnWidth,e++),this.$gantt.config.min_column_width=n}else e++;this._setLevel(e,t)}},t.prototype._stepDown=function(t){if(!(this._activeLevelIndex<1)){var e=this._activeLevelIndex;if(this._setScaleDates(),this._widthStep){var n=this.$gantt.config.min_column_width-this._widthStep;n0&&v+y>=k+2&&(_=0),c&&!w?c=0:c<0&&!b?c=0:c>0&&b+w>=x&&(c=0);var $=t.config.autoscroll_step;$&&$<2&&($=2),c*=$||n,_*=$||n,(c||_)&&function(e,n){var i=t.getScrollState(),r=null,a=null;e&&(r=i.x+e,r=Math.min(i.width,r),r=Math.max(0,r));n&&(a=i.y+n,a=Math.min(i.height,a),a=Math.max(0,a));t.scrollTo(r,a)}(c,_)}}function m(t,n,i){return t-e<0&&tn-e&&t>i?1:0}t.attachEvent("onGanttReady",function(){if(!r(t)){var e=i.getRootNode(t.$root)||document.body;t.eventRemove(e,"mousemove",p),t.event(e,"mousemove",p),t.eventRemove(e,"touchmove",p),t.event(e,"touchmove",p),t.eventRemove(e,"pointermove",p),t.event(e,"pointermove",p)}}),t.attachEvent("onDestroy",function(){g(!1)})}},function(t,e,n){t.exports=function(t){t.ext||(t.ext={});for(var e=[n(62),n(61),n(60)],i=0;i-1&&(n.className=n.className.slice(0,t))},200))})}},function(t,e){t.exports=function(t){t.skins.broadway={config:{grid_width:360,row_height:35,scale_height:35,link_line_width:1,link_arrow_size:7,lightbox_additional_height:86},_second_column_width:90,_third_column_width:80,_lightbox_template:"
 
",_config_buttons_left:{},_config_buttons_right:{gantt_delete_btn:"icon_delete",gantt_save_btn:"icon_save"}}}},function(t,e){t.exports=function(t){t.skins.terrace={config:{grid_width:360,row_height:35,scale_height:35,link_line_width:2,link_arrow_size:6,lightbox_additional_height:75},_second_column_width:90,_third_column_width:70}}},function(t,e){t.exports=function(t){t.skins.meadow={config:{grid_width:350,row_height:27,scale_height:30,link_line_width:2,link_arrow_size:6,lightbox_additional_height:72},_second_column_width:95,_third_column_width:80}}},function(t,e){t.exports=function(t){t.skins.skyblue={config:{grid_width:350,row_height:27,scale_height:27,link_line_width:1,link_arrow_size:8,lightbox_additional_height:75},_second_column_width:95,_third_column_width:80}}},function(t,e){function n(t,e){var n=e.skin;if(!n||t)for(var i=document.getElementsByTagName("link"),r=0;rl.width?l.min_width:l.width,l.width=l.max_width&&l.max_widthl[1]&&(t.config.grid_width=l[1]),r&&t.config.show_chart){if(a.$config.width=t.config.grid_width-1,!a.$config.scrollable&&a.$config.scrollY&&t.$root.offsetWidth){var c=a.$gantt.$layout.$container.offsetWidth,d=t.$ui.getView(a.$config.scrollY).$config.width,u=c-(a.$config.width+d);u<0&&(a.$config.width+=u,t.config.grid_width+=u)}if(n)a.$parent.$config.width=t.config.grid_width,a.$parent.$config.group&&t.$layout._syncCellSizes(a.$parent.$config.group,{value:a.$parent.$config.width,isGravity:!1});else if(r&&!i.isChildOf(r.$task,e.$view)){if(!a.$config.original_grid_width){var h=t.skins[t.skin];h&&h.config&&h.config.grid_width?a.$config.original_grid_width=h.config.grid_width:a.$config.original_grid_width=0}t.config.grid_width=a.$config.original_grid_width,a.$parent.$config.width=t.config.grid_width}else a.$parent._setContentSize(a.$config.width,null),t.$layout._syncCellSizes(a.$parent.$config.group,{value:t.config.grid_width,isGravity:!1})}else r&&i.isChildOf(r.$task,e.$view)&&(a.$config.original_grid_width=t.config.grid_width),n||(a.$parent.$config.width=0)}n=!1}}),this._initScrollStateEvents(e)},_initScrollStateEvents:function(e){t._getVerticalScrollbar=this.getVerticalScrollbar,t._getHorizontalScrollbar=this.getHorizontalScrollbar;var n=this.getVerticalScrollbar(),i=this.getHorizontalScrollbar();n&&n.attachEvent("onScroll",function(e,n,i){var r=t.getScrollState();t.callEvent("onGanttScroll",[r.x,e,r.x,n])}),i&&i.attachEvent("onScroll",function(e,n,i){var r=t.getScrollState();t.callEvent("onGanttScroll",[e,r.y,n,r.y]);var a=t.$ui.getView("grid");a&&a.$grid_data&&!a.$config.scrollable&&(a.$grid_data.style.left=a.$grid.scrollLeft+"px",a.$grid_data.scrollLeft=a.$grid.scrollLeft)}),e.attachEvent("onResize",function(){n&&!t.$scroll_ver&&(t.$scroll_ver=n.$scroll_ver),i&&!t.$scroll_hor&&(t.$scroll_hor=i.$scroll_hor)})},_findGridResizer:function(t,e){for(var n,i=t.getCellsByType("resizer"),r=!0,a=0;aa.bottom+u&&(h.y=a.bottom+u-r.height-s),h.right>a.right&&(h.x=a.right-r.width-o),h}function v(t){var n=d(),i=["gantt_link_tooltip"];n.link_source_id&&n.link_target_id&&(e.isLinkAllowed(n.link_source_id,n.link_target_id,n.link_from_start,n.link_to_start)?i.push("gantt_allowed_link"):i.push("gantt_invalid_link"));var r=e.templates.drag_link_class(n.link_source_id,n.link_from_start,n.link_target_id,n.link_to_start);r&&i.push(r);var a="
"+e.templates.drag_link(n.link_source_id,n.link_from_start,n.link_target_id,n.link_to_start)+"
";t.innerHTML=a}function m(){o=s=r=null,a=!0}function y(n,i,r,a){var o=function(){_._direction&&_._direction.parentNode||(_._direction=document.createElement("div"),t.$task_links.appendChild(_._direction));return _._direction}(),s=d(),l=["gantt_link_direction"];e.templates.link_direction_class&&l.push(e.templates.link_direction_class(s.link_source_id,s.link_from_start,s.link_target_id,s.link_to_start));var c=Math.sqrt(Math.pow(r-n,2)+Math.pow(a-i,2));if(c=Math.max(0,c-3)){o.className=l.join(" ");var u=(a-i)/(r-n),h=Math.atan(u);2==k(n,r,i,a)?h+=Math.PI:3==k(n,r,i,a)&&(h-=Math.PI);var f=Math.sin(h),g=Math.cos(h),p=Math.round(i),v=Math.round(n),m=["-webkit-transform: rotate("+h+"rad)","-moz-transform: rotate("+h+"rad)","-ms-transform: rotate("+h+"rad)","-o-transform: rotate("+h+"rad)","transform: rotate("+h+"rad)","width:"+Math.round(c)+"px"];if(-1!=window.navigator.userAgent.indexOf("MSIE 8.0")){m.push('-ms-filter: "'+function(t,e){return"progid:DXImageTransform.Microsoft.Matrix(M11 = "+e+",M12 = -"+t+",M21 = "+t+",M22 = "+e+",SizingMethod = 'auto expand')"}(f,g)+'"');var y=Math.abs(Math.round(n-r)),b=Math.abs(Math.round(a-i));switch(k(n,r,i,a)){case 1:p-=b;break;case 2:v-=y,p-=b;break;case 3:v-=y}}m.push("top:"+p+"px"),m.push("left:"+v+"px"),o.style.cssText=m.join(";")}}function k(t,e,n,i){return e>=t?i<=n?1:4:i<=n?2:3}_.attachEvent("onBeforeDragStart",e.bind(function(n,r){var a=r.target||r.srcElement;if(m(),e.getState("tasksDnd").drag_id)return!1;if(i.locateClassName(a,"gantt_link_point")){i.locateClassName(a,"task_start_date")&&(s=!0);var l=e.locate(r);o=l;var c=e.getTask(l);if(e.isReadonly(c))return m(),!1;return this._dir_start=g(c,!!s,0,t.$getConfig(),!0),!0}return!1},this)),_.attachEvent("onAfterDragStart",e.bind(function(t,n){e.config.touch&&e.refreshData(),v(_.config.marker)},this)),_.attachEvent("onDragMove",e.bind(function(o,s){var l=_.config,c=p(s,l.marker);!function(t,e){t.style.left=e.x+"px",t.style.top=e.y+"px"}(l.marker,c);var d=!!i.locateClassName(s,"gantt_link_control"),u=r,h=n,f=a,m=e.locate(s),k=!0,b=i.getTargetNode(s);if(i.isChildOf(b,e.$root)||(d=!1,m=null),d&&(k=!i.locateClassName(s,"task_end_date"),d=!!m),r=m,n=d,a=k,d){var w=e.getTask(m),x=t.$getConfig(),$=i.locateClassName(s,"gantt_link_control"),S=0;$&&(S=Math.floor($.offsetWidth/2)),this._dir_end=g(w,!!a,S,x)}else this._dir_end=i.getRelativeEventPosition(s,t.$task_data),e.env.isEdge&&(this._dir_end.y+=window.scrollY);var T=!(h==d&&u==m&&f==k);return T&&(u&&e.refreshTask(u,!1),m&&e.refreshTask(m,!1)),T&&v(l.marker),y(this._dir_start.x,this._dir_start.y,this._dir_end.x,this._dir_end.y),!0},this)),_.attachEvent("onDragEnd",e.bind(function(){var t=d();if(t.link_source_id&&t.link_target_id&&t.link_source_id!=t.link_target_id){var n=e._get_link_type(t.link_from_start,t.link_to_start),i={source:t.link_source_id,target:t.link_target_id,type:n};i.type&&e.isLinkAllowed(i)&&e.callEvent("onLinkCreated",[i])&&e.addLink(i)}m(),e.config.touch?e.refreshData():(t.link_source_id&&e.refreshTask(t.link_source_id,!1),t.link_target_id&&e.refreshTask(t.link_target_id,!1)),_._direction&&(_._direction.parentNode&&_._direction.parentNode.removeChild(_._direction),_._direction=null)},this)),e.attachEvent("onGanttRender",e.bind(function(){_._direction&&y(this._dir_start.x,this._dir_start.y,this._dir_end.x,this._dir_end.y)},this))};t.exports={createLinkDND:function(){return{init:r}}}},function(t,e,n){var i=n(1),r=n(0),a=n(44),o=n(2);t.exports={createTaskDND:function(){var t;return{extend:function(e){e.roundTaskDates=function(e){t.round_task_dates(e)}},init:function(e,n){return t=function(t,e){var n=e.$services;return{drag:null,dragMultiple:{},_events:{before_start:{},before_finish:{},after_finish:{}},_handlers:{},init:function(){this._domEvents=e._createDomEventScope(),this.clear_drag_state();var t=e.config.drag_mode;this.set_actions(),n.getService("state").registerProvider("tasksDnd",r.bind(function(){return{drag_id:this.drag?this.drag.id:void 0,drag_mode:this.drag?this.drag.mode:void 0,drag_from_start:this.drag?this.drag.left:void 0}},this));var i={before_start:"onBeforeTaskDrag",before_finish:"onBeforeTaskChanged",after_finish:"onAfterTaskDrag"};for(var a in this._events)for(var o in t)this._events[a][o]=i[a];this._handlers[t.move]=this._move,this._handlers[t.resize]=this._resize,this._handlers[t.progress]=this._resize_progress},set_actions:function(){var n=t.$task_data;this._domEvents.attach(n,"mousemove",e.bind(function(t){this.on_mouse_move(t)},this)),this._domEvents.attach(n,"mousedown",e.bind(function(t){this.on_mouse_down(t)},this)),this._domEvents.attach(document.body,"mouseup",e.bind(function(t){this.on_mouse_up(t)},this))},clear_drag_state:function(){this.drag={id:null,mode:null,pos:null,start_x:null,start_y:null,obj:null,left:null},this.dragMultiple={}},_resize:function(n,i,r){var a=t.$getConfig(),o=this._drag_task_coords(n,r);r.left?(n.start_date=e.dateFromPos(o.start+i),n.start_date||(n.start_date=new Date(e.getState().min_date))):(n.end_date=e.dateFromPos(o.end+i),n.end_date||(n.end_date=new Date(e.getState().max_date)));var s=this._calculateMinDuration(a.min_duration,a.duration_unit);n.end_date-n.start_datec){var d=c-s.end;(di||void 0===i)&&(i=u)}}return i},_move:function(t,n,i,r){var a=this._drag_task_coords(t,i),o=null,s=null;r?(o=new Date(+i.obj.start_date+r),s=new Date(+i.obj.end_date+r)):(o=e.dateFromPos(a.start+n),s=e.dateFromPos(a.end+n)),o?s?(t.start_date=o,t.end_date=s):(t.end_date=new Date(e.getState().max_date),t.start_date=e.dateFromPos(e.posFromDate(t.end_date)-(a.end-a.start))):(t.start_date=new Date(e.getState().min_date),t.end_date=e.dateFromPos(e.posFromDate(t.start_date)+(a.end-a.start)))},_drag_task_coords:function(t,n){return{start:n.obj_s_x=n.obj_s_x||e.posFromDate(t.start_date),end:n.obj_e_x=n.obj_e_x||e.posFromDate(t.end_date)}},_mouse_position_change:function(t,e){var n=t.x-e.x,i=t.y-e.y;return Math.sqrt(n*n+i*i)},_is_number:function(t){return!isNaN(parseFloat(t))&&isFinite(t)},on_mouse_move:function(t){if(this.drag.start_drag){var n=i.getRelativeEventPosition(t,e.$task_data),r=this.drag.start_drag.start_x,o=this.drag.start_drag.start_y;(Date.now()-this.drag.timestamp>50||this._is_number(r)&&this._is_number(o)&&this._mouse_position_change({x:r,y:o},n)>20)&&this._start_dnd(t)}if(this.drag.mode){if(!a(this,40))return;this._update_on_move(t)}},_update_item_on_move:function(t,n,i,r,a,o){var s=e.getTask(n),l=e.mixin({},s),c=e.mixin({},s);this._handlers[i].apply(this,[c,t,r,o]),e.mixin(s,c,!0),e.callEvent("onTaskDrag",[s.id,i,c,l,a]),e.mixin(s,c,!0),e.refreshTask(n)},_update_on_move:function(n){var a=this.drag,o=t.$getConfig();if(a.mode){var s=i.getRelativeEventPosition(n,t.$task_data);if(a.pos&&a.pos.x==s.x)return;a.pos=s;var l=e.dateFromPos(s.x);if(!l||isNaN(l.getTime()))return;var c=s.x-a.start_x,d=e.getTask(a.id);if(this._handlers[a.mode]){if(a.mode===o.drag_mode.move){var u={};this._isMultiselect()&&e.getSelectedTasks().indexOf(a.id)>=0&&(u=this.dragMultiple);var h=!1;if(e.isSummaryTask(d)&&e.config.drag_project){var f={};f[a.id]=r.copy(a),h=!0,u=r.mixin(f,this.dragMultiple)}var _=this._find_max_shift(u,c);for(var g in void 0!==_&&(c=_),this._update_item_on_move(c,a.id,a.mode,a,n),u){var p=u[g];if(h&&p.id!=a.id&&(e._bulk_dnd=!0),void 0===_&&(h||Object.keys(u).length>1))var v=l-e.dateFromPos(a.start_x);this._update_item_on_move(c,p.id,p.mode,p,n,v)}e._bulk_dnd=!1}else this._update_item_on_move(c,a.id,a.mode,a,n);e._update_parents(a.id)}}},on_mouse_down:function(n,r){if(2!=n.button||void 0===n.button){var a=t.$getConfig(),o=e.locate(n),s=null;if(e.isTaskExists(o)&&(s=e.getTask(o)),!e.isReadonly(s)&&!this.drag.mode){this.clear_drag_state(),r=r||n.target||n.srcElement;var l=i.getClassName(r),c=this._get_drag_mode(l,r);if(!l||!c)return r.parentNode?this.on_mouse_down(n,r.parentNode):void 0;if(c)if(c.mode&&c.mode!=a.drag_mode.ignore&&a["drag_"+c.mode]){if(o=e.locate(r),s=e.copy(e.getTask(o)||{}),e.isReadonly(s))return this.clear_drag_state(),!1;if(e.isSummaryTask(s)&&!a.drag_project&&c.mode!=a.drag_mode.progress)return void this.clear_drag_state();c.id=o;var d=i.getRelativeEventPosition(n,e.$task_data);c.start_x=d.x,c.start_y=d.y,c.obj=s,this.drag.start_drag=c,this.drag.timestamp=Date.now()}else this.clear_drag_state();else if(e.checkEvent("onMouseDown")&&e.callEvent("onMouseDown",[l.split(" ")[0]])&&r.parentNode)return this.on_mouse_down(n,r.parentNode)}}},_fix_dnd_scale_time:function(n,i){var r=t.$getConfig(),a=e.getScale().unit,o=e.getScale().step;function s(n){if(e.config.correct_work_time){var i=t.$getConfig();e.isWorkTime(n.start_date,void 0,n)||(n.start_date=e.calculateEndDate({start_date:n.start_date,duration:-1,unit:i.duration_unit,task:n}))}}r.round_dnd_dates||(a="minute",o=r.time_step),i.mode==r.drag_mode.resize?i.left?(n.start_date=e.roundDate({date:n.start_date,unit:a,step:o}),s(n)):(n.end_date=e.roundDate({date:n.end_date,unit:a,step:o}),function(n){if(e.config.correct_work_time){var i=t.$getConfig();e.isWorkTime(new Date(n.end_date-1),void 0,n)||(n.end_date=e.calculateEndDate({start_date:n.end_date,duration:1,unit:i.duration_unit,task:n}))}}(n)):i.mode==r.drag_mode.move&&(n.start_date=e.roundDate({date:n.start_date,unit:a,step:o}),s(n),n.end_date=e.calculateEndDate(n))},_fix_working_times:function(n,i){var r=t.$getConfig();(i=i||{mode:r.drag_mode.move}).mode==r.drag_mode.resize?i.left?n.start_date=e.getClosestWorkTime({date:n.start_date,dir:"future",task:n}):n.end_date=e.getClosestWorkTime({date:n.end_date,dir:"past",task:n}):i.mode==r.drag_mode.move&&e.correctTaskWorkTime(n)},_finalize_mouse_up:function(t,n,i,r){var a=e.getTask(t);if(n.work_time&&n.correct_work_time&&this._fix_working_times(a,i),this._fix_dnd_scale_time(a,i),this._fireEvent("before_finish",i.mode,[t,i.mode,e.copy(i.obj),r])){var o=t;e._init_task_timing(a),this.clear_drag_state(),e.updateTask(a.id),this._fireEvent("after_finish",i.mode,[o,i.mode,r])}else this.clear_drag_state(),t==i.id&&(i.obj._dhx_changed=!1,e.mixin(a,i.obj,!0)),e.refreshTask(a.id)},on_mouse_up:function(n){var i=this.drag;if(i.mode&&i.id){var r=t.$getConfig(),a=e.getTask(i.id),o=this.dragMultiple,s=!1,l=0;i.mode===r.drag_mode.move&&(e.isSummaryTask(a)&&r.drag_project||this._isMultiselect())&&(s=!0,l=Object.keys(o).length);var c=function(){if(s)for(var t in o)this._finalize_mouse_up(o[t].id,r,o[t],n);this._finalize_mouse_up(i.id,r,i,n)};s&&l>10?e.batchUpdate(function(){c.call(this)}.bind(this)):c.call(this)}this.clear_drag_state()},_get_drag_mode:function(e,n){var i=t.$getConfig().drag_mode,r={mode:null,left:null};switch((e||"").split(" ")[0]){case"gantt_task_line":case"gantt_task_content":r.mode=i.move;break;case"gantt_task_drag":r.mode=i.resize;var a=n.getAttribute("data-bind-property");r.left="start_date"==a;break;case"gantt_task_progress_drag":r.mode=i.progress;break;case"gantt_link_control":case"gantt_link_point":r.mode=i.ignore;break;default:r=null}return r},_start_dnd:function(n){var i=this.drag=this.drag.start_drag;delete i.start_drag;var r=t.$getConfig(),a=i.id;if(r["drag_"+i.mode]&&e.callEvent("onBeforeDrag",[a,i.mode,n])&&this._fireEvent("before_start",i.mode,[a,i.mode,n])){delete i.start_drag;var s=e.getTask(a);if(e.isReadonly(s))return void this.clear_drag_state();if(this._isMultiselect()){var l=e.getSelectedTasks();l.indexOf(i.id)>=0&&o.forEach(l,e.bind(function(t){var n=e.getTask(t);e.isSummaryTask(n)&&e.config.drag_project&&i.mode==r.drag_mode.move&&this._addSubtasksToDragMultiple(n.id),this.dragMultiple[t]=e.mixin({id:n.id,obj:e.copy(n)},this.drag)},this))}e.isSummaryTask(s)&&e.config.drag_project&&i.mode==r.drag_mode.move&&this._addSubtasksToDragMultiple(s.id),e.callEvent("onTaskDragStart",[])}else this.clear_drag_state()},_fireEvent:function(t,n,i){e.assert(this._events[t],"Invalid stage:{"+t+"}");var r=this._events[t][n];return e.assert(r,"Unknown after drop mode:{"+n+"}"),e.assert(i,"Invalid event arguments"),!e.checkEvent(r)||e.callEvent(r,i)},round_task_dates:function(e){var n=this.drag,i=t.$getConfig();n||(n={mode:i.drag_mode.move}),this._fix_dnd_scale_time(e,n)},destructor:function(){this._domEvents.detachAll()},_isMultiselect:function(){return e.config.drag_multiple&&!!(e.getSelectedTasks&&e.getSelectedTasks().length>0)},_addSubtasksToDragMultiple:function(t){e.eachTask(function(t){this.dragMultiple[t.id]=e.mixin({id:t.id,obj:e.copy(t)},this.drag)},t,this)}}}(e,n),e._tasks_dnd=t,t.init(n)},destructor:function(){t&&(t.destructor(),t=null)}}}}},function(t,e,n){var i=n(0),r=n(76),a=n(75),o=n(1),s=function(t){var e=t.$services;return{onCreated:function(e){var o=e.$config;o.bind=i.defined(o.bind)?o.bind:"task",o.bindLinks=i.defined(o.bindLinks)?o.bindLinks:"link",e._linksDnD=a.createLinkDND(),e._tasksDnD=r.createTaskDND(),e._tasksDnD.extend(e),this._mouseDelegates=n(24)(t)},onInitialized:function(e){this._attachDomEvents(t),this._attachStateProvider(t,e),e._tasksDnD.init(e,t),e._linksDnD.init(e,t),"timeline"==e.$config.id&&this.extendDom(e)},onDestroyed:function(e){this._clearDomEvents(t),this._clearStateProvider(t),e._tasksDnD&&e._tasksDnD.destructor()},extendDom:function(e){t.$task=e.$task,t.$task_scale=e.$task_scale,t.$task_data=e.$task_data,t.$task_bg=e.$task_bg,t.$task_links=e.$task_links,t.$task_bars=e.$task_bars},_clearDomEvents:function(){this._mouseDelegates.destructor(),this._mouseDelegates=null},_attachDomEvents:function(t){function e(e,n){if(e&&this.callEvent("onLinkDblClick",[e,n])){var i=this.getLink(e);if(this.isReadonly(i))return;var r=this.locale.labels.link+" "+this.templates.link_description(this.getLink(e))+" "+this.locale.labels.confirm_link_deleting;window.setTimeout(function(){t._simple_confirm(r,"",function(){t.deleteLink(e)})},this.config.touch?300:1)}}this._mouseDelegates.delegate("click","gantt_task_link",t.bind(function(t,e){var n=this.locate(t,this.config.link_attribute);n&&this.callEvent("onLinkClick",[n,t])},t),this.$task),this._mouseDelegates.delegate("click","gantt_scale_cell",t.bind(function(e,n){var i=o.getRelativeEventPosition(e,t.$task_data),r=t.dateFromPos(i.x),a=Math.floor(t.columnIndexByDate(r)),s=t.getScale().trace_x[a];t.callEvent("onScaleClick",[e,s])},t),this.$task),this._mouseDelegates.delegate("doubleclick","gantt_task_link",t.bind(function(n,i,r){i=this.locate(n,t.config.link_attribute),e.call(this,i,n)},t),this.$task),this._mouseDelegates.delegate("doubleclick","gantt_link_point",t.bind(function(t,n,i){n=this.locate(t);var r=this.getTask(n),a=null;return i.parentNode&&o.getClassName(i.parentNode)&&(a=o.getClassName(i.parentNode).indexOf("_left")>-1?r.$target[0]:r.$source[0]),a&&e.call(this,a,t),!1},t),this.$task)},_attachStateProvider:function(t,n){var i=n;e.getService("state").registerProvider("tasksTimeline",function(){return{scale_unit:i._tasks?i._tasks.unit:void 0,scale_step:i._tasks?i._tasks.step:void 0}})},_clearStateProvider:function(){e.getService("state").unregisterProvider("tasksTimeline")}}};t.exports=s},function(t,e,n){var i=n(1);function r(t,e){var n=i.getNodePosition(e.$grid_data);return t.x+=n.x+e.$grid.scrollLeft,t.y+=n.y-e.$grid_data.scrollTop,t}function a(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=i.getNodePosition(t.$root);return e>r.width&&(e=r.width-n-2),e}t.exports={removeLineHighlight:function(t){t.markerLine&&t.markerLine.parentNode&&t.markerLine.parentNode.removeChild(t.markerLine),t.markerLine=null},highlightPosition:function(t,e,n){var o=function(t,e){var n=i.getNodePosition(e.$grid_data),r=i.getRelativeEventPosition(t,e.$grid_data),o=n.x+e.$grid.scrollLeft,s=r.y-10,l=e.getItemHeight(t.targetId);sn.y+c-l&&(s=n.y+c-l),n.x=o,n.y=s,n.width=a(e.$gantt,n.width,9),n}(t,n);e.marker.style.left=o.x+9+"px",e.marker.style.width=o.width+"px",e.marker.style.overflow="hidden";var s=e.markerLine;s||((s=document.createElement("div")).className="gantt_drag_marker gantt_grid_dnd_marker",s.innerHTML="
",s.style.pointerEvents="none"),t.child?function(t,e,n){var i=t.targetParent,o=r({x:0,y:n.getItemTop(i)},n),s=n.$grid_data.getBoundingClientRect().bottom+window.scrollY,l=a(n.$gantt,n.$grid_data.offsetWidth);e.innerHTML="
",e.style.width=l+"px",e.style.top=o.y+"px",e.style.left=o.x+"px",e.style.height=n.getItemHeight(i)+"px",o.y>s&&(e.style.top=s+"px")}(t,s,n):function(t,e,n){var i=function(t,e){var n=e.$config.rowStore,i={x:0,y:0},o=e.$grid_data.querySelector(".gantt_tree_indent"),s=15,l=0;if(o&&(s=o.offsetWidth),t.targetId!==n.$getRootId()){var c=e.getItemTop(t.targetId),d=e.getItemHeight(t.targetId);if(l=n.exists(t.targetId)?n.calculateItemLevel(n.getItem(t.targetId)):0,t.prevSibling)i.y=c;else if(t.nextSibling){var u=0;n.eachItem(function(t){-1!==n.getIndexById(t.id)&&u++},t.targetId),i.y=c+d+u*d}else i.y=c+d,l+=1}return i.x=40+l*s,i.width=a(e.$gantt,Math.max(e.$grid_data.offsetWidth-i.x,0),i.x),r(i,e)}(t,n),o=n.$grid_data.getBoundingClientRect().bottom+window.scrollY;e.innerHTML="
",e.style.left=i.x+"px",e.style.height="4px";var s=i.y-2;e.style.top=s+"px",e.style.width=i.width+"px",s>o&&(e.style.top=o+"px")}(t,s,n),e.markerLine||(document.body.appendChild(s),e.markerLine=s)}}},function(t,e,n){var i=n(17);t.exports=function(t,e,n,r,a){var o;if(e!==a.$getRootId())o=n<.25?i.prevSiblingTarget(t,e,a):!(n>.6)||a.hasChild(e)&&a.getItem(e).$open?i.firstChildTarget(t,e,a):i.nextSiblingTarget(t,e,a);else{var s=a.$getRootId();o=a.hasChild(s)&&r>=0?i.lastChildTarget(t,s,a):i.firstChildTarget(t,s,a)}return o}},function(t,e,n){var i=n(17);function r(t,e,n,r,a){for(var o=e;r.exists(o);){var s=r.calculateItemLevel(r.getItem(o));if((s===n||s===n-1)&&r.getBranchIndex(o)>-1)break;o=a?r.getPrev(o):r.getNext(o)}return r.exists(o)?r.calculateItemLevel(r.getItem(o))===n?a?i.nextSiblingTarget(t,o,r):i.prevSiblingTarget(t,o,r):i.firstChildTarget(t,o,r):null}function a(t,e,n,i){return r(t,e,n,i,!0)}function o(t,e,n,i){return r(t,e,n,i,!1)}t.exports=function(t,e,n,r,s,l){var c;if(e!==s.$getRootId()){var d=s.getItem(e),u=s.calculateItemLevel(d);if(u===l){var h=s.getPrevSibling(e);n<.5&&!h?c=i.prevSiblingTarget(t,e,s):(n<.5&&(e=h),c=i.nextSiblingTarget(t,e,s))}else if(u>l)s.eachParent(function(t){s.calculateItemLevel(t)===l&&(e=t.id)},d),c=a(t,e,l,s);else{var f=a(t,e,l,s),_=o(t,e,l,s);c=n<.5?f:_}}else{var g=s.$getRootId(),p=s.getChildren(g);c=i.createDropTargetObject(),c=p.length&&r>=0?a(t,function(t){for(var e=t.getNext();t.exists(e);){var n=t.getNext(e);if(!t.exists(n))return e;e=n}return null}(s),l,s):o(t,g,l,s)}return c}},function(t,e,n){var i=n(1),r=n(17),a=n(80),o=n(79),s=n(78),l=n(11);t.exports={init:function(t,e){var n=t.$services.getService("dnd");if(e.$config.bind&&t.getDatastore(e.$config.bind)){var c=new n(e.$grid_data,{updates_per_second:60});t.defined(e.$getConfig().dnd_sensitivity)&&(c.config.sensitivity=e.$getConfig().dnd_sensitivity),c.attachEvent("onBeforeDragStart",t.bind(function(n,r){var a=d(r);if(!a)return!1;if(t.hideQuickInfo&&t._hideQuickInfo(),i.closest(r.target,".gantt_grid_editor_placeholder"))return!1;var o=a.getAttribute(e.$config.item_attribute),s=e.$config.rowStore.getItem(o);return!t.isReadonly(s)&&!u(o)&&(c.config.initial_open_state=s.$open,!!t.callEvent("onRowDragStart",[o,r.target||r.srcElement,r])&&void 0)},t)),c.attachEvent("onAfterDragStart",t.bind(function(t,n){var i=d(n);c.config.marker.innerHTML=i.outerHTML;var a=c.config.marker.firstChild;a&&(c.config.marker.style.opacity=.4,a.style.position="static",a.style.pointerEvents="none"),c.config.id=i.getAttribute(e.$config.item_attribute);var o=e.$config.rowStore,s=o.getItem(c.config.id);c.config.level=o.calculateItemLevel(s),c.config.drop_target=r.createDropTargetObject({targetParent:o.getParent(s.id),targetIndex:o.getBranchIndex(s.id),targetId:s.id,nextSibling:!0}),s.$open=!1,s.$transparent=!0,this.refreshData()},t)),c.attachEvent("onDragMove",t.bind(function(n,i){var a=h(i);return a&&!1!==t.callEvent("onBeforeRowDragMove",[c.config.id,a.targetParent,a.targetIndex])||(a=r.createDropTargetObject(c.config.drop_target)),s.highlightPosition(a,c.config,e),c.config.drop_target=a,this.callEvent("onRowDragMove",[c.config.id,a.targetParent,a.targetIndex]),!0},t)),c.attachEvent("onDragEnd",t.bind(function(){var n=e.$config.rowStore,i=n.getItem(c.config.id);s.removeLineHighlight(c.config),i.$transparent=!1,i.$open=c.config.initial_open_state;var r=c.config.drop_target;!1===this.callEvent("onBeforeRowDragEnd",[c.config.id,r.targetParent,r.targetIndex])?i.$drop_target=null:(n.move(c.config.id,r.targetIndex,r.targetParent),t.render(),this.callEvent("onRowDragEnd",[c.config.id,r.targetParent,r.targetIndex])),n.refresh(i.id)},t))}function d(t){return i.locateAttribute(t,e.$config.item_attribute)}function u(n){return l(n,t,t.getDatastore(e.$config.bind))}function h(n){var r,s=function(n){var r=i.getRelativeEventPosition(n,e.$grid_data).y,a=e.$config.rowStore;document.doctype||(r+=window.scrollY),r=r||0;var o=e.$state.scrollTop||0,s=t.$grid_data.getBoundingClientRect().height+o+window.scrollY,l=o,d=e.getItemIndexByTopPosition(e.$state.scrollTop);if(a.exists(d)||(d=a.countVisible()-1),d<0)return a.$getRootId();var h=a.getIdByIndex(d),f=e.$state.scrollTop/e.getItemHeight(h),_=f-Math.floor(f);_>.1&&_<.9&&(s-=e.getItemHeight(h)*_,l+=e.getItemHeight(h)*(1-_));var g=i.getNodePosition(e.$grid_data),p=g.y+g.height,v=c.config.marker.offsetHeight;r+v+window.scrollY>=s&&(c.config.marker.style.top=p-v+"px"),r>=s?r=s:r<=l&&(r=l,c.config.marker.style.top=g.y+"px");var m=e.getItemIndexByTopPosition(r);if(m>a.countVisible()-1||m<0)return a.$getRootId();var y=a.getIdByIndex(m);return u(y)?a.getPrevSibling(y):a.getIdByIndex(m)}(n),l=null,d=e.$config.rowStore,h=!e.$getConfig().order_branch_free,f=i.getRelativeEventPosition(n,e.$grid_data).y;return document.doctype||(f+=window.scrollY),s!==d.$getRootId()&&(l=(f-e.getItemTop(s))/e.getItemHeight(s)),h?(r=a(c.config.id,s,l,f,d,c.config.level))&&r.targetParent&&u(r.targetParent)&&(s=d.getPrevSibling(r.targetParent),r=a(c.config.id,s,l,f,d,c.config.level)):r=o(c.config.id,s,l,f,d),r}}}},function(t,e,n){var i=n(1),r=n(11);t.exports={init:function(t,e){var n=t.$services.getService("dnd");if(e.$config.bind&&t.getDatastore(e.$config.bind)){var a=new n(e.$grid_data,{updates_per_second:60});t.defined(e.$getConfig().dnd_sensitivity)&&(a.config.sensitivity=e.$getConfig().dnd_sensitivity),a.attachEvent("onBeforeDragStart",t.bind(function(n,r){var c=o(r);if(!c)return!1;if(t.hideQuickInfo&&t._hideQuickInfo(),i.closest(r.target,".gantt_grid_editor_placeholder"))return!1;var d=c.getAttribute(e.$config.item_attribute);if(l(d))return!1;var u=s().getItem(d);return!t.isReadonly(u)&&(a.config.initial_open_state=u.$open,!!t.callEvent("onRowDragStart",[d,r.target||r.srcElement,r])&&void 0)},t)),a.attachEvent("onAfterDragStart",t.bind(function(t,n){var i=o(n);a.config.marker.innerHTML=i.outerHTML;var r=a.config.marker.firstChild;r&&(r.style.position="static"),a.config.id=i.getAttribute(e.$config.item_attribute);var l=s(),c=l.getItem(a.config.id);a.config.index=l.getBranchIndex(a.config.id),a.config.parent=c.parent,c.$open=!1,c.$transparent=!0,this.refreshData()},t)),a.lastTaskOfLevel=function(t){for(var e=null,n=s().getItems(),i=0,r=n.length;in.y+l-s&&(o=n.y+l-s);var c=n.y+n.height;return o>c-s&&(o=c-s),n.x=r,n.y=o,n},t),a._getTargetY=t.bind(function(n){var r=i.getNodePosition(e.$grid_data),a=e.$state.scrollTop||0,o=t.$grid_data.getBoundingClientRect().height+a,s=n.pageY-r.y+a;return s>o?s=o:si.countVisible()-1?null:i.getIdByIndex(r)},t),a.attachEvent("onDragMove",t.bind(function(n,r){var o=t.$grid_data.getBoundingClientRect(),c=o.height+o.y+(e.$state.scrollTop||0)+window.scrollY,d=a.config,u=a._getGridPos(r),h=e.$getConfig(),f=s();u.y_.width&&(d.marker.style.width=_.width-10-2+"px",d.marker.style.overflow="hidden");var g=f.getItem(a.config.id),p=a._getTargetY(r),v=a._getTaskByY(p,f.getIndexById(g.id));function m(t,e){return!f.isChildOf(y.id,e.id)&&(t.$level==e.$level||h.order_branch_free)}if(f.exists(v)||(v=a.lastTaskOfLevel(h.order_branch_free?g.$level:0))==a.config.id&&(v=null),f.exists(v)){var y=f.getItem(v),k=e.getItemTop(y.id),b=e.getItemHeight(y.id);if(k+b/2=0;)S=f.getIdByIndex(w-C),T=f.getItem(S),C++;if(g.id==y.id||l(y.id))return;m(y,g)&&g.id!=y.id?f.move(g.id,0,0,y.id):y.$level!=g.$level-1||f.getChildren(y.id).length?T&&m(T,g)&&g.id!=T.id&&f.move(g.id,-1,f.getParent(T.id)):f.move(g.id,0,y.id)}return!0},t)),a.attachEvent("onDragEnd",t.bind(function(){var e=s(),n=e.getItem(a.config.id);n.$transparent=!1,n.$open=a.config.initial_open_state,!1===this.callEvent("onBeforeRowDragEnd",[a.config.id,a.config.parent,a.config.index])?(e.move(a.config.id,a.config.index,a.config.parent),n.$drop_target=null):this.callEvent("onRowDragEnd",[a.config.id,n.$drop_target]),t.render(),this.refreshData()},t))}function o(t){return i.locateAttribute(t,e.$config.item_attribute)}function s(){return t.getDatastore(e.$config.bind)}function l(e){return r(e,t,s())}}}},function(t,e,n){var i=n(0),r=n(82),a=n(81),o=function(t){return{onCreated:function(e){e.$config=i.mixin(e.$config,{bind:"task"}),"grid"==e.$config.id&&(this.extendGantt(e),t.ext.inlineEditors=t.ext._inlineEditors.createEditors(e),t.ext.inlineEditors.init()),this._mouseDelegates=n(24)(t)},onInitialized:function(e){var n=e.$getConfig();n.order_branch&&("marker"==n.order_branch?a.init(e.$gantt,e):r.init(e.$gantt,e)),this.initEvents(e,t),"grid"==e.$config.id&&this.extendDom(e)},onDestroyed:function(e){"grid"==e.$config.id&&t.ext.inlineEditors.destructor(),this.clearEvents(e,t)},initEvents:function(t,e){this._mouseDelegates.delegate("click","gantt_row",e.bind(function(n,i,r){var a=t.$getConfig();if(null!==i){var o=this.getTask(i);a.scroll_on_click&&!e._is_icon_open_click(n)&&this.showDate(o.start_date),e.callEvent("onTaskRowClick",[i,r])}},e),t.$grid),this._mouseDelegates.delegate("click","gantt_grid_head_cell",e.bind(function(n,i,r){var a=r.getAttribute("data-column-id");if(e.callEvent("onGridHeaderClick",[a,n])){var o=t.$getConfig();if("add"!=a){if(o.sort&&a){for(var s,l=a,c=0;c",a.setAttribute(r.task_grid_row_resizer_attribute,e.id),t._waiAria.gridSeparatorAttr(a),a},update:null,getRectangle:i,getVisibleRange:r}}},function(t,e,n){var i=n(20),r=n(5),a=n(19),o=n(18),s=n(30);function l(t,e,n,i){var r=100*(1-(1*t||0)),a=i.posFromDate(e),o=i.posFromDate(n),s=document.createElement("div");return s.className="gantt_histogram_hor_bar",s.style.top=r+"%",s.style.left=a+"px",s.style.width=o-a+1+"px",s}function c(t,e,n){if(t===e)return null;var i=1-Math.max(t,e),r=Math.abs(t-e),a=document.createElement("div");return a.className="gantt_histogram_vert_bar",a.style.top=100*i+"%",a.style.height=100*r+"%",a.style.left=n+"px",a}t.exports=function(t){var e=s(t),n={},d={},u={};function h(t,e){var i=n[t];i&&i[e]&&i[e].parentNode&&i[e].parentNode.removeChild(i[e])}function f(e,n,i,r,o,s,d){var h=u[e.id];h&&h.parentNode&&h.parentNode.removeChild(h);var f=function(e,n,i,r){for(var o=n.getScale(),s=document.createElement("div"),d=a(o,r),u=d.start;u<=d.end;u++){var h=o.trace_x[u],f=o.trace_x[u+1]||t.date.add(h,o.step,o.unit),_=o.trace_x[u].valueOf(),g=Math.min(e[_]/i,1)||0;if(g<0)return null;var p=Math.min(e[f.valueOf()]/i,1)||0,v=l(g,h,f,n);v&&s.appendChild(v);var m=c(g,p,n.posFromDate(f));m&&s.appendChild(m)}return s}(i,o,s,d);return f&&n&&(f.setAttribute("data-resource-id",e.id),f.setAttribute(o.$config.item_attribute,e.id),f.style.position="absolute",f.style.top=n.top+1+"px",f.style.height=o.getItemHeight(e.id)-1+"px",f.style.left=0),f}function _(t,e,n,i,r,a,o){var s=r.histogram_cell_class(a.start_date,a.end_date,t,a.tasks,a.assignments),l=r.histogram_cell_label(a.start_date,a.end_date,t,a.tasks,a.assignments),c=r.histogram_cell_allocated(a.start_date,a.end_date,t,a.tasks,a.assignments),d=o.getItemHeight(t.id)-1;if(s||l){var u=document.createElement("div");return u.className=["gantt_histogram_cell",s].join(" "),u.setAttribute(o.$config.item_attribute,t.id),u.style.cssText=["left:"+e.left+"px","width:"+e.width+"px","height:"+d+"px","line-height:"+d+"px","top:"+(e.top+1)+"px"].join(";"),l&&(l="
"+l+"
"),c&&(l="
"+l),l&&(u.innerHTML=l),u}return null}return{render:function(i,r,s,l){var c=r.$getTemplates(),h=r.getScale(),g=e(i,s.resource_property,h,r),p=[],v={},m=i.capacity||r.$config.capacity||24;n[i.id]={},d[i.id]=null,u[i.id]=null;for(var y=!!l,k=a(h,l),b=k.start;b<=k.end;b++){var w=g[b];if(w&&(!y||o(b,h,l,t))){var x=c.histogram_cell_capacity(w.start_date,w.end_date,i,w.tasks,w.assignments);v[w.start_date.valueOf()]=x||0;var $=r.getItemPosition(i,w.start_date,w.end_date),S=_(i,$,m,0,c,w,r);S&&(p.push(S),n[i.id][b]=S)}}var T=null;if(p.length){T=document.createElement("div");for(var C=0;C",f=""):(h=g.template?g.template(e):e[g.name],r.isDate(h)&&(h=s.date_grid(h,e,g.name)),null!==h&&void 0!==h||(h=""),f=h,h="
"+h+"
");var p="gantt_cell"+(_?" gantt_last_cell":""),v=[];if(g.tree){p+=" gantt_cell_tree";for(var m=0;m"+v.join("")+"",c.push(u)}switch(p="",l.$config.name){case"task":p=t.getGlobalTaskIndex(e.id)%2==0?"":" odd";break;case"resource":p=l.visibleOrder.indexOf(e.id)%2==0?"":" odd"}if(p+=e.$transparent?" gantt_transparent":"",p+=e.$dataprocessor_class?" "+e.$dataprocessor_class:"",s.grid_row_class){var w=s.grid_row_class.call(t,e.start_date,e.end_date,e);w&&(p+=" "+w)}l.isSelected(e.id)&&(p+=" gantt_selected");var x=document.createElement("div");x.className="gantt_row"+p+" gantt_row_"+t.getTaskType(e.type);var $=n.getItemHeight(e.id);return x.style.height=$+"px",x.style.lineHeight=$+"px",i.smart_rendering&&(x.style.position="absolute",x.style.left="0px",x.style.top=n.getItemTop(e.id)+"px"),n.$config.item_attribute&&(x.setAttribute(n.$config.item_attribute,e.id),x.setAttribute(n.$config.bind+"_id",e.id)),t._waiAria.taskRowAttr(e,x),x.innerHTML=c.join(""),x},update:null,getRectangle:a,getVisibleRange:o,onrender:function(e,n,r){for(var a=r.getGridColumns(),o=0;ot.x?this.dirs.right:e.y>t.y?this.dirs.down:this.dirs.up}},n={path:[],clear:function(){this.path=[]},current:function(){return this.path[this.path.length-1]},point:function(e){return e?(this.path.push(t.copy(e)),e):this.current()},point_to:function(n,i,r){r=r?{x:r.x,y:r.y}:t.copy(this.point());var a=e.dirs;switch(n){case a.left:r.x-=i;break;case a.right:r.x+=i;break;case a.up:r.y-=i;break;case a.down:r.y+=i}return this.point(r)},get_points:function(n,i,r,a){var o=this.get_endpoint(n,i,r,a),s=t.config,l=o.e_y-o.y,c=o.e_x-o.x,d=e.dirs,u=i.getItemHeight(n.source);this.clear(),this.point({x:o.x,y:o.y});var h=2*s.link_arrow_size,f=this.get_line_type(n,i.$getConfig()),_=o.e_x>o.x;if(f.from_start&&f.to_start)this.point_to(d.left,h),_?(this.point_to(d.down,l),this.point_to(d.right,c)):(this.point_to(d.right,c),this.point_to(d.down,l)),this.point_to(d.right,h);else if(!f.from_start&&f.to_start)if(_=o.e_x>o.x+2*h,this.point_to(d.right,h),_)c-=h,this.point_to(d.down,l),this.point_to(d.right,c);else{c-=2*h;var g=l>0?1:-1;this.point_to(d.down,g*(u/2)),this.point_to(d.right,c),this.point_to(d.down,g*(Math.abs(l)-u/2)),this.point_to(d.right,h)}else f.from_start||f.to_start?f.from_start&&!f.to_start&&(_=o.e_x>o.x-2*h,this.point_to(d.left,h),_?(c+=2*h,g=l>0?1:-1,this.point_to(d.down,g*(u/2)),this.point_to(d.right,c),this.point_to(d.down,g*(Math.abs(l)-u/2)),this.point_to(d.left,h)):(c+=h,this.point_to(d.down,l),this.point_to(d.right,c))):(this.point_to(d.right,h),_?(this.point_to(d.right,c),this.point_to(d.down,l)):(this.point_to(d.down,l),this.point_to(d.right,c)),this.point_to(d.left,h));return this.path},get_line_type:function(e,n){var i=n.links,r=!1,a=!1;return e.type==i.start_to_start?r=a=!0:e.type==i.finish_to_finish?r=a=!1:e.type==i.finish_to_start?(r=!1,a=!0):e.type==i.start_to_finish?(r=!0,a=!1):t.assert(!1,"Invalid link type"),n.rtl&&(r=!r,a=!a),{from_start:r,to_start:a}},get_endpoint:function(t,e,n,i){var r=e.$getConfig(),o=this.get_line_type(t,r),s=o.from_start,l=o.to_start,c=a(n,e,r),d=a(i,e,r);return{x:s?c.left:c.left+c.width,e_x:l?d.left:d.left+d.width,y:c.top+c.rowHeight/2-1,e_y:d.top+d.rowHeight/2-1}}};function a(e,n,i){var r=n.getItemPosition(e);if(t.getTaskType(e.type)==i.types.milestone){var a=n.getBarHeight(e.id,!0),o=Math.sqrt(2*a*a);r.left-=o/2,r.width=o}return r}return{render:function(i,r,a){var o=t.getTask(i.source);if(!o.hide_bar){var s=t.getTask(i.target);if(!s.hide_bar){var l=n.get_endpoint(i,r,o,s),c=l.e_y-l.y;if(!(l.e_x-l.x||c))return null;var d=n.get_points(i,r,o,s),u=e.get_lines(d,r),h=document.createElement("div"),f="gantt_task_link";i.color&&(f+=" gantt_link_inline_color");var _=t.templates.link_class?t.templates.link_class(i):"";_&&(f+=" "+_),a.highlight_critical_path&&t.isCriticalLink&&t.isCriticalLink(i)&&(f+=" gantt_critical_link"),h.className=f,r.$config.link_attribute&&(h.setAttribute(r.$config.link_attribute,i.id),h.setAttribute("link_id",i.id));for(var g=0;gv.end)&&d(t.id,y)}n[t.id]={};for(var k=v.start;k<=v.end;k++){var b=f(l,k,t,s,_,g,p,a);!b&&c(t,k)?d(t.id,k):b&&!b.parentNode&&i.appendChild(b)}}},getRectangle:i,getVisibleRange:a,prepareData:l}}},function(t,e,n){var i=n(21),r=n(13),a=n(5);t.exports=function(t){var e=i(t);return{render:function(n,i){if(!1!==n.rollup&&n.$rollup&&n.$rollup.length){var r=document.createElement("div"),a=t.getTaskPosition(n);return n.$rollup.forEach(function(o){var s=t.copy(t.getTask(o));if(s.$rendered_at=n.id,!1!==t.callEvent("onBeforeRollupTaskDisplay",[s.id,s,n.id])){var l=e(s,i);if(l){var c=i.getBarHeight(n.id,s.type==t.config.types.milestone),d=Math.floor((i.getItemHeight(n.id)-c)/2);l.style.top=a.top+d+"px",l.classList.add("gantt_rollup_child"),l.setAttribute("data-rollup-parent-id",n.id),r.appendChild(l)}}}),r}return!1},update:null,isInViewPort:r,getVisibleRange:a}}},function(t,e,n){var i=n(13);t.exports=function(t,e,n,r,a){if(!a.isSplitTask(t))return!1;var o=a.getSubtaskDates(t.id);return i({id:t.id,start_date:o.start_date,end_date:o.end_date,parent:t.parent},e,n,a)}},function(t,e,n){var i=n(21),r=n(5),a=n(92),o=n(13);t.exports=function(t){var e=i(t),n={};function s(t,e,n,i,r){var a=!t.hide_bar;return i.smart_rendering&&a&&(a=o(t,e,n,i,r)),a}function l(n,i,r,a){var o=t.isSummaryTask(i);o&&t.resetProjectDates(i);var s=e(i,r);if(s){var l=r.getBarHeight(n.id,i.type==t.config.types.milestone),c=Math.floor((r.getItemHeight(n.id)-l)/2);return s.style.top=a.top+c+"px",s.classList.add("gantt_split_child"),o&&s.classList.add("gantt_split_subproject"),s}}return{render:function(e,i,r,a){if(t.isSplitTask(e)&&(t.config.open_split_tasks&&!e.$open||!t.config.open_split_tasks)){var o=document.createElement("div"),c=t.getTaskPosition(e);return t.hasChild(e.id)&&t.eachTask(function(d){if(s(d,a,i,r,t)&&!d.hide_bar){var u=t.copy(t.getTask(d.id));if(u.$rendered_at=e.id,!1!==t.callEvent("onBeforeSplitTaskDisplay",[u.id,u,e.id])){var h=l(e,d,i,c);n[d.id]=h,o.appendChild(h)}}},e.id),o}return!1},update:function(e,i,r,a,o){if(t.hasChild(e.id)){var c=document.createElement("div"),d=t.getTaskPosition(e);t.eachTask(function(u){var h=s(u,o,r,a,t);if(h!==!!n[u.id])if(h){var f=l(e,u,r,d);n[u.id]=f}else n[u.id]=!1;n[u.id]&&c.appendChild(n[u.id]),i.innerHTML=c.innerHTML},e.id)}},isInViewPort:a,getVisibleRange:r}}},function(t,e,n){var i=n(13),r=n(5),a=n(21);t.exports=function(t){return{render:a(t),update:null,isInViewPort:i,getVisibleRange:r}}},function(t,e){t.exports=function(t){return function(n,i,r){"keepDates"==r?function(e,n){"duration"==n?e.end_date=t.calculateEndDate(e):"end_date"!=n&&"start_date"!=n||(e.duration=t.calculateDuration(e))}(n,i):"keepDuration"==r?function(n,i){"end_date"==i?n.start_date=e(n):"start_date"!=i&&"duration"!=i||(n.end_date=t.calculateEndDate(n))}(n,i):function(n,i){t.config.schedule_from_end?"end_date"==i||"duration"==i?n.start_date=e(n):"start_date"==i&&(n.duration=t.calculateDuration(n)):"start_date"==i||"duration"==i?n.end_date=t.calculateEndDate(n):"end_date"==i&&(n.duration=t.calculateDuration(n))}(n,i)};function e(e){return t.calculateEndDate({start_date:e.end_date,duration:-e.duration,task:e})}}},function(t,e,n){t.exports=function(t){var e=n(7)(t),i=n(0);function r(){return e.apply(this,arguments)||this}function a(e){return e.formatter||t.ext.formatters.durationFormatter()}return n(3)(r,e),i.mixin(r.prototype,{show:function(t,e,n,i){var r="
";i.innerHTML=r},set_value:function(t,e,n,i){this.get_input(i).value=a(n.editor).format(t)},get_value:function(t,e,n){return a(e.editor).parse(this.get_input(n).value||"")}},!0),r}},function(t,e,n){t.exports=function(t){var e=n(7)(t),i=n(0);function r(){return e.apply(this,arguments)||this}function a(e){return e.formatter||t.ext.formatters.linkFormatter()}function o(t,e){for(var n=(t||"").split(e.delimiter||","),i=0;i";i.innerHTML=r},hide:function(){},set_value:function(e,n,i,r){this.get_input(r).value=s(e,i.editor,t)},get_value:function(t,e,n){return o(this.get_input(n).value||"",e.editor)},save:function(e,n,i){var r=c(t.getTask(e),this.get_value(e,n,i),n.editor);(r.add.length||r.remove.length)&&t.batchUpdate(function(){r.add.forEach(function(e){t.addLink(e)}),r.remove.forEach(function(e){t.deleteLink(e)}),t.autoSchedule&&t.autoSchedule()})},is_changed:function(e,n,i,r){var a=this.get_value(n,i,r),l=o(s(e,i.editor,t),i.editor);return a.join()!==l.join()}},!0),r}},function(t,e,n){t.exports=function(t){var e=n(7)(t),i=n(0),r="%Y-%m-%d",a=null,o=null;function s(){return e.apply(this,arguments)||this}return n(3)(s,e),i.mixin(s.prototype,{show:function(e,n,i,s){a||(a=t.date.date_to_str(r)),o||(o=t.date.str_to_date(r));var l=null,c=null;l="function"==typeof i.min?i.min(e,n):i.min,c="function"==typeof i.max?i.max(e,n):i.max;var d="
";s.innerHTML=d},set_value:function(t,e,n,i){t&&t.getFullYear?this.get_input(i).value=a(t):this.get_input(i).value=t},is_valid:function(t,e,n,i){return!(!t||isNaN(t.getTime()))},get_value:function(t,e,n){var i;try{i=o(this.get_input(n).value||"")}catch(t){i=null}return i}},!0),s}},function(t,e,n){t.exports=function(t){var e=n(7)(t),i=n(0);function r(){return e.apply(this,arguments)||this}return n(3)(r,e),i.mixin(r.prototype,{show:function(t,e,n,i){for(var r="
",i.innerHTML=r},get_input:function(t){return t.querySelector("select")}},!0),r}},function(t,e,n){t.exports=function(t){var e=n(7)(t),i=n(0);function r(){return e.apply(this,arguments)||this}return n(3)(r,e),i.mixin(r.prototype,{show:function(t,e,n,i){var r="
";i.innerHTML=r},get_value:function(t,e,n){return this.get_input(n).value||""},is_valid:function(t,e,n,i){return!isNaN(parseInt(t,10))}},!0),r}},function(t,e,n){t.exports=function(t){var e=n(7)(t),i=n(0);function r(){return e.apply(this,arguments)||this}return n(3)(r,e),i.mixin(r.prototype,{show:function(t,e,n,i){var r="
";i.innerHTML=r}},!0),r}},function(t,e){t.exports={init:function(t,e){var n=t,i=e.$gantt,r=null,a=i.ext.keyboardNavigation;a.attachEvent("onBeforeFocus",function(e){var i=t.locateCell(e);if(clearTimeout(r),i){var a=i.columnName,o=i.id,s=n.getState();if(n.isVisible()&&s.id==o&&s.columnName===a)return!1}return!0}),a.attachEvent("onFocus",function(e){var i=t.locateCell(e),a=t.getState();return clearTimeout(r),!i||i.id==a.id&&i.columnName==a.columnName||n.isVisible()&&n.save(),!0}),t.attachEvent("onHide",function(){clearTimeout(r)}),a.attachEvent("onBlur",function(){return r=setTimeout(function(){n.save()}),!0}),i.attachEvent("onTaskDblClick",function(e,n){var i=t.getState(),r=t.locateCell(n.target);return!r||!t.isVisible()||r.columnName!=i.columnName}),i.attachEvent("onTaskClick",function(e,n){if(i._is_icon_open_click(n))return!0;var r=t.getState(),a=t.locateCell(n.target);return!a||!t.getEditorConfig(a.columnName)||(t.isVisible()&&r.id==a.id&&r.columnName==a.columnName||t.startEdit(a.id,a.columnName),!1)}),i.attachEvent("onEmptyClick",function(){return n.save(),!0}),a.attachEvent("onKeyDown",function(e,r){var o=t.locateCell(r.target),s=!!o&&t.getEditorConfig(o.columnName),l=t.getState(),c=i.constants.KEY_CODES,d=r.keyCode,u=!1;switch(d){case c.ENTER:t.isVisible()?(t.save(),r.preventDefault(),u=!0):s&&!(r.ctrlKey||r.metaKey||r.shiftKey)&&(n.startEdit(o.id,o.columnName),r.preventDefault(),u=!0);break;case c.ESC:t.isVisible()&&(t.hide(),r.preventDefault(),u=!0);break;case c.UP:case c.DOWN:break;case c.LEFT:case c.RIGHT:(s&&t.isVisible()||"date"===l.editorType)&&(u=!0);break;case c.SPACE:t.isVisible()&&(u=!0),s&&!t.isVisible()&&(n.startEdit(o.id,o.columnName),r.preventDefault(),u=!0);break;case c.DELETE:s&&!t.isVisible()?(n.startEdit(o.id,o.columnName),u=!0):s&&t.isVisible()&&(u=!0);break;case c.TAB:if(t.isVisible()){r.shiftKey?t.editPrevCell(!0):t.editNextCell(!0);var h=t.getState();h.id&&a.focus({type:"taskCell",id:h.id,column:h.columnName}),r.preventDefault(),u=!0}break;default:if(t.isVisible())u=!0;else if(d>=48&&d<=57||d>95&&d<112||d>=64&&d<=91||d>185&&d<193||d>218&&d<223){var f=e.modifiers,_=f.alt||f.ctrl||f.meta||f.shift;f.alt||_&&a.getCommandHandler(e,"taskCell")||s&&!t.isVisible()&&(n.startEdit(o.id,o.columnName),u=!0)}}return!u})},onShow:function(t,e,n){},onHide:function(t,e,n){n.$gantt.focus()},destroy:function(){}}},function(t,e){t.exports={init:function(t,e){var n=e.$gantt;n.attachEvent("onTaskClick",function(e,i){if(n._is_icon_open_click(i))return!0;var r=t.getState(),a=t.locateCell(i.target);return!a||!t.getEditorConfig(a.columnName)||(t.isVisible()&&r.id==a.id&&r.columnName==a.columnName||t.startEdit(a.id,a.columnName),!1)}),n.attachEvent("onEmptyClick",function(){return t.isVisible()&&t.isChanged()?t.save():t.hide(),!0}),n.attachEvent("onTaskDblClick",function(e,n){var i=t.getState(),r=t.locateCell(n.target);return!r||!t.isVisible()||r.columnName!=i.columnName})},onShow:function(t,e,n){var i=n.$gantt;i.ext&&i.ext.keyboardNavigation&&i.ext.keyboardNavigation.attachEvent("onKeyDown",function(e,n){var r=i.constants.KEY_CODES,a=!1;switch(n.keyCode){case r.SPACE:t.isVisible()&&(a=!0)}return!a});e.onkeydown=function(e){e=e||window.event;var n=i.constants.KEY_CODES;if(!(e.defaultPrevented||e.shiftKey&&e.keyCode!=n.TAB)){var r=!0;switch(e.keyCode){case i.keys.edit_save:t.save();break;case i.keys.edit_cancel:t.hide();break;case n.UP:case n.DOWN:t.isVisible()&&(t.hide(),r=!1);break;case n.TAB:e.shiftKey?t.editPrevCell(!0):t.editNextCell(!0);break;default:r=!1}r&&e.preventDefault()}}},onHide:function(){},destroy:function(){}}},function(t,e,n){var i=n(103),r=n(102);t.exports=function(t){var e=null;return{setMapping:function(t){e=t},getMapping:function(){return e||(t.config.keyboard_navigation_cells&&t.ext.keyboardNavigation?r:i)}}}},function(t,e,n){var i=n(104),r=n(101),a=n(100),o=n(99),s=n(98),l=n(97),c=n(96),d=n(0),u=n(1),h=n(4),f=n(95);function _(t){t.config.editor_types={text:new(r(t)),number:new(a(t)),select:new(o(t)),date:new(s(t)),predecessor:new(l(t)),duration:new(c(t))}}t.exports=function(t){var e=i(t),n={};h(n);var r={init:_,createEditors:function(i){function r(t,e){var n=i.$getConfig(),r=function(t,e){for(var n=i.$getConfig(),r=i.getItemTop(t),a=i.getItemHeight(t),o=i.getGridColumns(),s=0,l=0,c=0,d=0;d0?t.getNext:t.getPrev,i=(n=t.bind(n,t))(this._itemId);t.isTaskExists(i)&&t.isReadonly(t.getTask(i));)i=n(i);return i},editNextRow:function(e){var n=this.getState().id;if(t.isTaskExists(n)){var i=null;i=e?this.moveRow(1):t.getNext(n),t.isTaskExists(i)&&this.startEdit(i,this._columnName)}},editPrevRow:function(e){var n=this.getState().id;if(t.isTaskExists(n)){var i=null;i=e?this.moveRow(-1):t.getPrev(n),t.isTaskExists(i)&&this.startEdit(i,this._columnName)}},destructor:function(){o.forEach(function(t){l.detachEvent(t)}),s.forEach(function(e){t.detachEvent(e)}),o=[],s=[],l=null,this.hide(),this.detachAllEvents()}};return d.mixin(c,e),d.mixin(c,n),c}};return d.mixin(r,e),d.mixin(r,n),r}},function(t,e){t.exports={create:function(){return{render:function(){},destroy:function(){}}}}},function(t,e,n){var i=n(3),r=n(1),a=n(0),o=n(8),s=function(t){"use strict";var e=["altKey","shiftKey","metaKey"];function n(e,n,i,r){var o=t.apply(this,arguments)||this;this.$config=a.mixin(n,{scroll:"x"}),o._scrollHorizontalHandler=a.bind(o._scrollHorizontalHandler,o),o._scrollVerticalHandler=a.bind(o._scrollVerticalHandler,o),o._outerScrollVerticalHandler=a.bind(o._outerScrollVerticalHandler,o),o._outerScrollHorizontalHandler=a.bind(o._outerScrollHorizontalHandler,o),o._mouseWheelHandler=a.bind(o._mouseWheelHandler,o),this.$config.hidden=!0;var s=r.config.scroll_size;return r.env.isIE&&(s+=1),this._isHorizontal()?(o.$config.height=s,o.$parent.$config.height=s):(o.$config.width=s,o.$parent.$config.width=s),this.$config.scrollPosition=0,o.$name="scroller",o}return i(n,t),n.prototype.init=function(t){t.innerHTML=this.$toHTML(),this.$view=t.firstChild,this.$view||this.init(),this._isVertical()?this._initVertical():this._initHorizontal(),this._initMouseWheel(),this._initLinkedViews()},n.prototype.$toHTML=function(){return"
"},n.prototype._getRootParent=function(){for(var t=this.$parent;t&&t.$parent;)t=t.$parent;if(t)return t},n.prototype._eachView=function(){var t=[];return function t(e,n){if(n.push(e),e.$cells)for(var i=0;iu[s]&&u[o]>e&&d>u[s]-l+2&&(e=d+(i?0:2),n=u[s]);else{var h=Math.max(u[o]-d,0);(d+=h)>Math.max(u[s]-h,0)&&d>e&&(e=d,n=u[s])}}return{outerScroll:n,innerScroll:e}},n.prototype.scroll=function(t){this._isHorizontal()?this.scrollHorizontally(t):this.scrollVertically(t)},n.prototype.getScrollState=function(){return{visible:this.isVisible(),direction:this.$config.scroll,size:this.$config.outerSize,scrollSize:this.$config.scrollSize||0,position:this.$config.scrollPosition||0}},n.prototype.setSize=function(e,n){t.prototype.setSize.apply(this,arguments);var i=this._getScrollSize(),r=(this._isVertical()?n:e)-this._getScrollOffset()+(this._isHorizontal()?1:0);i.innerScroll&&r>i.outerScroll&&(i.innerScroll+=r-i.outerScroll),this.$config.scrollSize=i.innerScroll,this.$config.width=e,this.$config.height=n,this._setScrollSize(i.innerScroll)},n.prototype.isVisible=function(){return!(!this.$parent||!this.$parent.$view.parentNode)},n.prototype.shouldShow=function(){var t=this._getScrollSize();return!(!t.innerScroll&&this.$parent&&this.$parent.$view.parentNode)&&!(!t.innerScroll||this.$parent&&this.$parent.$view.parentNode)},n.prototype.shouldHide=function(){return!(this._getScrollSize().innerScroll||!this.$parent||!this.$parent.$view.parentNode)},n.prototype.toggleVisibility=function(){this.shouldHide()?this.hide():this.shouldShow()&&this.show()},n.prototype._getScaleOffset=function(t){var e=0;return!t||"timeline"!=t.$config.view&&"grid"!=t.$config.view||(e=t.$content.$getConfig().scale_height),e},n.prototype._getScrollOffset=function(){var t=0;if(this._isVertical()){var e=this.$parent.$parent;t=Math.max(this._getScaleOffset(e.getPrevSibling(this.$parent.$id)),this._getScaleOffset(e.getNextSibling(this.$parent.$id)))}else for(var n=this._getLinkedViews(),i=0;i=0&&(!t[f]||t.deltaX||t.wheelDeltaX||(u=2*h,h=0)),u&&Math.abs(u)>Math.abs(h)){if(this._isVertical())return;if(i.x)return!0;if(!this.$scroll_hor||!this.$scroll_hor.offsetWidth)return!0;var _=u/-40,g=this._oldLeft,p=g+30*_;if(this.scrollHorizontally(p),this.$scroll_hor.scrollLeft=p,g==this.$scroll_hor.scrollLeft)return!0;this._oldLeft=this.$scroll_hor.scrollLeft}else{if(this._isHorizontal())return;if(i.y)return!0;if(!this.$scroll_ver||!this.$scroll_ver.offsetHeight)return!0;_=h/-40;void 0===h&&(_=t.detail);var v=this._oldTop,m=this.$scroll_ver.scrollTop+30*_;if(this.scrollVertically(m),this.$scroll_ver.scrollTop=m,v==this.$scroll_ver.scrollTop)return!0;this._oldTop=this.$scroll_ver.scrollTop}return t.preventDefault&&t.preventDefault(),t.cancelBubble=!0,!1}},n}(n(9));t.exports=s},function(t,e){t.exports=null},function(t,e,n){var i=n(3),r=n(0),a=function(t){"use strict";function e(e,n,i){var a=t.apply(this,arguments)||this;if(n.view){n.id&&(this.$id=r.uid());var o=r.copy(n);if(delete o.config,delete o.templates,this.$content=this.$factory.createView(n.view,this,o,this),!this.$content)return!1}return a.$name="viewCell",a}return i(e,t),e.prototype.destructor=function(){this.clear(),t.prototype.destructor.call(this)},e.prototype.clear=function(){if(this.$initialized=!1,this.$content){var e=this.$content.unload||this.$content.destructor;e&&e.call(this.$content)}t.prototype.clear.call(this)},e.prototype.scrollTo=function(e,n){this.$content&&this.$content.scrollTo?this.$content.scrollTo(e,n):t.prototype.scrollTo.call(this,e,n)},e.prototype._setContentSize=function(t,e){var n=this._getBorderSizes();if("number"==typeof t){var i=t+n.horizontal;this.$config.width=i}if("number"==typeof e){var r=e+n.vertical;this.$config.height=r}},e.prototype.setSize=function(e,n){if(t.prototype.setSize.call(this,e,n),!this.$preResize&&this.$content&&!this.$initialized){this.$initialized=!0;var i=this.$view.childNodes[0],r=this.$view.childNodes[1];r||(r=i),this.$content.init(r)}},e.prototype.setContentSize=function(){!this.$preResize&&this.$content&&this.$initialized&&this.$content.setSize(this.$lastSize.contentX,this.$lastSize.contentY)},e.prototype.getContentSize=function(){var e=t.prototype.getContentSize.call(this);if(this.$content&&this.$initialized){var n=this.$content.getSize();e.width=void 0===n.contentX?n.width:n.contentX,e.height=void 0===n.contentY?n.height:n.contentY}var i=this._getBorderSizes();return e.width+=i.horizontal,e.height+=i.vertical,e},e}(n(9));t.exports=a},function(t,e,n){var i=n(3),r=n(31),a=n(9),o=function(t){"use strict";function e(e,n,i){for(var r=t.apply(this,arguments)||this,a=0;at.x_end||e.left+e.widtht.y_end||e.top+e.height-1&&r.click?r.click():(o(n,!0),i=!0)}27==e&&(o(n,!1),i=!0)}return i?(t.preventDefault&&t.preventDefault(),!(t.cancelBubble=!0)):void 0}}var l=a.getRootNode(t.$root)||document;function c(t){c.cover||(c.cover=document.createElement("div"),c.cover.onkeydown=s,c.cover.className="dhx_modal_cover",document.body.appendChild(c.cover)),c.cover.style.display=t?"inline-block":"none"}function d(e,n,i){return"
"+e+"
"}function u(e){k.area||(k.area=document.createElement("div"),k.area.className="gantt_message_area",k.area.style[k.position]="5px",document.body.appendChild(k.area)),k.hide(e.id);var n=document.createElement("div");return n.innerHTML="
"+e.text+"
",n.className="gantt-info gantt-"+e.type,n.onclick=function(){k.hide(e.id),e=null},t._waiAria.messageInfoAttr(n),"bottom"==k.position&&k.area.firstChild?k.area.insertBefore(n,k.area.firstChild):k.area.appendChild(n),e.expire>0&&(k.timers[e.id]=window.setTimeout(function(){k&&k.hide(e.id)},e.expire)),k.pull[e.id]=n,n=null,e.id}function h(){for(var t=[].slice.apply(arguments,[0]),e=0;e'+s.title+""),_+='
'+(s.content?"":s.text)+'
',l&&(_+=d(h(s.ok,t.locale.labels.message_ok,"OK"),"ok",!0)),c&&(_+=d(h(s.cancel,t.locale.labels.message_cancel,"Cancel"),"cancel",!1)),s.buttons)for(var g=0;g",u.innerHTML=_,s.content){var v=s.content;"string"==typeof v&&(v=document.getElementById(v)),"none"==v.style.display&&(v.style.display=""),u.childNodes[s.title?1:0].appendChild(v)}return u.onclick=function(t){var e=t.target||t.srcElement;if(e.className||(e=e.parentNode),a.closest(e,".gantt_popup_button")){var n=e.getAttribute("data-result");o(s,n="true"==n||"false"!=n&&n)}},s.box=u,(l||c)&&(n=s),u}(l,u,f);l.hidden||c(!0),document.body.appendChild(_);var g=Math.abs(Math.floor(((window.innerWidth||document.documentElement.offsetWidth)-_.offsetWidth)/2)),p=Math.abs(Math.floor(((window.innerHeight||document.documentElement.offsetHeight)-_.offsetHeight)/2));return"top"==l.position?_.style.top="-3px":_.style.top=p+"px",_.style.left=g+"px",_.onkeydown=s,y.focus(_),l.hidden&&y.hide(_),t.callEvent("onMessagePopup",[_]),_}function _(t){return f(t,!0,!1)}function g(t){return f(t,!0,!0)}function p(t){return f(t)}function v(t,e,n){return"object"!=i(t)&&("function"==typeof e&&(n=e,e=""),t={text:t,type:e,callback:n}),t}function m(t,e,n,a){return"object"!=i(t)&&(t={text:t,type:e,expire:n,id:a}),t.id=t.id||r.uid(),t.expire=t.expire||k.expire,t}t.event(l,"keydown",s,!0);var y=function(){var t=v.apply(this,arguments);return t.type=t.type||"alert",p(t)};y.hide=function(n){for(;n&&n.getAttribute&&!n.getAttribute(e);)n=n.parentNode;n&&(n.parentNode.removeChild(n),c(!1),t.callEvent("onAfterMessagePopup",[n]))},y.focus=function(t){setTimeout(function(){var e=a.getFocusableNodes(t);e.length&&e[0].focus&&e[0].focus()},1)};var k=function(t,e,n,i){switch((t=m.apply(this,arguments)).type=t.type||"info",t.type.split("-")[0]){case"alert":return _(t);case"confirm":return g(t);case"modalbox":return p(t);default:return u(t)}};k.seed=(new Date).valueOf(),k.uid=r.uid,k.expire=4e3,k.keyboard=!0,k.position="top",k.pull={},k.timers={},k.hideAll=function(){for(var t in k.pull)k.hide(t)},k.hide=function(t){var e=k.pull[t];e&&e.parentNode&&(window.setTimeout(function(){e.parentNode.removeChild(e),e=null},2e3),e.className+=" hidden",k.timers[t]&&window.clearTimeout(k.timers[t]),delete k.pull[t])};var b=[];return t.attachEvent("onMessagePopup",function(t){b.push(t)}),t.attachEvent("onAfterMessagePopup",function(t){for(var e=0;e3600&&o<86400){var s=e.getTimezoneOffset()-n;s&&(e=t.date.add(e,s,"minute"))}return e},t.isSplitTask=function(e){return t.assert(e&&e instanceof Object,"Invalid argument task="+e+" of gantt.isSplitTask. Task object was expected"),this.$data.tasksStore._isSplitItem(e)},t._is_icon_open_click=function(t){if(!t)return!1;var e=t.target||t.srcElement;if(!e||!e.className)return!1;var n=r.getClassName(e);return-1!==n.indexOf("gantt_tree_icon")&&(-1!==n.indexOf("gantt_close")||-1!==n.indexOf("gantt_open"))}}},function(t,e){t.exports=function(t){function e(){return t._cached_functions.update_if_changed(t),t._cached_functions.active||t._cached_functions.activate(),!0}t._cached_functions={cache:{},mode:!1,critical_path_mode:!1,wrap_methods:function(t,e){if(e._prefetch_originals)for(var n in e._prefetch_originals)e[n]=e._prefetch_originals[n];e._prefetch_originals={};for(n=0;ntask="+e+" of gantt.isUnscheduledTask. Task object was expected"),!!e.unscheduled||!e.start_date},t._isAllowedUnscheduledTask=function(e){return!(!e.unscheduled||!t.config.show_unscheduled)},t._isTaskInTimelineLimits=function(t){var e=t.start_date?t.start_date.valueOf():null,n=t.end_date?t.end_date.valueOf():null;return!!(e&&n&&e<=this._max_date.valueOf()&&n>=this._min_date.valueOf())},t.isTaskVisible=function(t){if(!this.isTaskExists(t))return!1;var e=this.getTask(t);return!(!this._isAllowedUnscheduledTask(e)&&!this._isTaskInTimelineLimits(e))&&!!(this.getGlobalTaskIndex(t)>=0)},t._getProjectEnd=function(){if(t.config.project_end)return t.config.project_end;var e=t.getTaskByTime();return(e=e.sort(function(t,e){return+t.end_date>+e.end_date?1:-1})).length?e[e.length-1].end_date:null},t._getProjectStart=function(){if(t.config.project_start)return t.config.project_start;if(t.config.start_date)return t.config.start_date;if(t.getState().min_date)return t.getState().min_date;var e=t.getTaskByTime();return(e=e.sort(function(t,e){return+t.start_date>+e.start_date?1:-1})).length?e[0].start_date:null};var e=function(e,n){var i=!!(n&&n!=t.config.root_id&&t.isTaskExists(n))&&t.getTask(n),r=null;if(i)r=t.config.schedule_from_end?t.calculateEndDate({start_date:i.end_date,duration:-t.config.duration_step,task:e}):i.start_date;else if(t.config.schedule_from_end)r=t.calculateEndDate({start_date:t._getProjectEnd(),duration:-t.config.duration_step,task:e});else{var a=t.getTaskByIndex(0);r=a?a.start_date?a.start_date:a.end_date?t.calculateEndDate({start_date:a.end_date,duration:-t.config.duration_step,task:e}):null:t.config.start_date||t.getState().min_date}return t.assert(r,"Invalid dates"),new Date(r)};t._set_default_task_timing=function(n){n.start_date=n.start_date||e(n,t.getParent(n)),n.duration=n.duration||t.config.duration_step,n.end_date=n.end_date||t.calculateEndDate(n)},t.createTask=function(n,i,r){(n=n||{},t.defined(n.id)||(n.id=t.uid()),n.start_date||(n.start_date=e(n,i)),void 0===n.text&&(n.text=t.locale.labels.new_task),void 0===n.duration&&(n.duration=1),this.isTaskExists(i))&&(this.setParent(n,i,!0),this.getTask(i).$open=!0);if(!this.callEvent("onTaskCreated",[n]))return null;if(this.config.details_on_create){if(t.isTaskExists(n.id))t.getTask(n.id).$index!=n.$index&&(n.start_date&&"string"==typeof n.start_date&&(n.start_date=this.date.parseDate(n.start_date,"parse_date")),n.end_date&&"string"==typeof n.end_date&&(n.end_date=this.date.parseDate(n.end_date,"parse_date")),this.$data.tasksStore.updateItem(n.id,n));else n.$new=!0,this.silent(function(){t.$data.tasksStore.addItem(n,r)});this.selectTask(n.id),this.refreshData(),this.showLightbox(n.id)}else this.addTask(n,i,r)&&(this.showTask(n.id),this.selectTask(n.id));return n.id},t._update_flags=function(e,n){var i=t.$data.tasksStore;void 0===e?(this._lightbox_id=null,i.silent(function(){i.unselect()}),this.getSelectedTasks&&this._multiselect.reset(),this._tasks_dnd&&this._tasks_dnd.drag&&(this._tasks_dnd.drag.id=null)):(this._lightbox_id==e&&(this._lightbox_id=n),i.getSelectedId()==e&&i.silent(function(){i.unselect(e),i.select(n)}),this._tasks_dnd&&this._tasks_dnd.drag&&this._tasks_dnd.drag.id==e&&(this._tasks_dnd.drag.id=n))};var n=function(e,n){var i=t.getTaskType(e.type),r={type:i,$no_start:!1,$no_end:!1};return n||i!=e.$rendered_type?(i==t.config.types.project?r.$no_end=r.$no_start=!0:i!=t.config.types.milestone&&(r.$no_end=!(e.end_date||e.duration),r.$no_start=!e.start_date,t._isAllowedUnscheduledTask(e)&&(r.$no_end=r.$no_start=!1)),r):(r.$no_start=e.$no_start,r.$no_end=e.$no_end,r)};function r(e){e.$effective_calendar=t.getTaskCalendar(e).id,e.start_date=t.getClosestWorkTime({dir:"future",date:e.start_date,unit:t.config.duration_unit,task:e}),e.end_date=t.calculateEndDate(e)}function a(e){var n=null,i=null,r=void 0!==e?e:t.config.root_id,a=[];return t.eachTask(function(e){t.getTaskType(e.type)==t.config.types.project||t.isUnscheduledTask(e)||(e.rollup&&a.push(e.id),e.start_date&&!e.$no_start&&(!n||n>e.start_date.valueOf())&&(n=e.start_date.valueOf()),e.end_date&&!e.$no_end&&(!i||itask="+e+" of gantt.isSummaryTask. Task object was expected");var i=n(e);return!(!i.$no_end&&!i.$no_start)},t.resetProjectDates=function(t){var i=n(t);if(i.$no_end||i.$no_start){var r=a(t.id);(function(t,n,i,r){n.$no_start&&(t.start_date=i?new Date(i):e(t,this.getParent(t)));n.$no_end&&(t.end_date=r?new Date(r):this.calculateEndDate({start_date:t.start_date,duration:this.config.duration_step,task:t}));(n.$no_start||n.$no_end)&&this._init_task_timing(t)}).call(this,t,i,r.start_date,r.end_date),t.$rollup=r.rollup}},t.getSubtaskDuration=function(e){var n=0,i=void 0!==e?e:t.config.root_id;return this.eachTask(function(e){this.getTaskType(e.type)==t.config.types.project||this.isUnscheduledTask(e)||(n+=e.duration)},i),n},t.getSubtaskDates=function(t){var e=a(t);return{start_date:e.start_date,end_date:e.end_date}},t._update_parents=function(e,i,r){if(e){var a=this.getTask(e);a.rollup&&(r=!0);var o=this.getParent(a),s=n(a),l=!0;if(r||a.start_date&&a.end_date&&(s.$no_start||s.$no_end)){var c=a.start_date.valueOf(),d=a.end_date.valueOf();t.resetProjectDates(a),r||c!=a.start_date.valueOf()||d!=a.end_date.valueOf()||(l=!1),l&&!i&&this.refreshTask(a.id,!0)}l&&o&&this.isTaskExists(o)&&this._update_parents(o,i,r)}},t.roundDate=function(e){var n=t.getScale();i.isDate(e)&&(e={date:e,unit:n?n.unit:t.config.duration_unit,step:n?n.step:t.config.duration_step});var r,a,o,s=e.date,l=e.step,c=e.unit;if(!n)return s;if(c==n.unit&&l==n.step&&+s>=+n.min_date&&+s<=+n.max_date)o=Math.floor(t.columnIndexByDate(s)),n.trace_x[o]||(o-=1,n.rtl&&(o=0)),a=new Date(n.trace_x[o]),r=t.date.add(a,l,c);else{for(o=Math.floor(t.columnIndexByDate(s)),r=t.date[c+"_start"](new Date(n.min_date)),n.trace_x[o]&&(r=t.date[c+"_start"](n.trace_x[o]));+r<+s;){var d=(r=t.date[c+"_start"](t.date.add(r,l,c))).getTimezoneOffset();r=t._correct_dst_change(r,d,r,c),t.date[c+"_start"]&&(r=t.date[c+"_start"](r))}a=t.date.add(r,-1*l,c)}return e.dir&&"future"==e.dir?r:e.dir&&"past"==e.dir?a:Math.abs(s-a)1e6&&this._resetTimestampCache();var e=null;if(t.day||0===t.day)e=t.day;else if(t.date){var n=String(t.date.valueOf());this._cached_timestamps[n]?e=this._cached_timestamps[n]:(e=Date.UTC(t.date.getFullYear(),t.date.getMonth(),t.date.getDate()),this._cached_timestamps[n]=e,this._cached_timestamps_count++)}return e},_checkIfWorkingUnit:function(t,e){if(!this["_is_work_"+e]){var n=this.$gantt.date["".concat(e,"_start")](new Date(t)),i=this.$gantt.date.add(n,1,e);return this.hasDuration(n,i)}return this["_is_work_"+e](t)},_is_work_day:function(t){var e=this._getWorkHours(t);return!!Array.isArray(e)&&e.length>0},_is_work_hour:function(t){for(var e=this._getWorkHours(t),n=t.getHours(),i=0;i=e[i].startHour&&n=e[i].start&&no.valueOf(),this._isWorkTime(a,n))(u||h&&f)&&(s=r[n+"_start"](new Date(a)),l=r.add(s,i,n)),u?(u=!1,d=this._nextDate(s,n,i),c+=(l.valueOf()-a.valueOf())/(l.valueOf()-s.valueOf())):h&&f?(h=!1,c+=(o.valueOf()-a.valueOf())/(l.valueOf()-s.valueOf())):c++;else{var _=this._getUnitOrder(n),g=this.units[_-1];g&&!this._isWorkTime(a,g)&&(d=this._getClosestWorkTimeFuture(a,g))}a=d}return c},_getMinutesPerHour:function(t){var e=this._getTimeOfDayStamp(t),n=this._getTimeOfDayStamp(this._nextDate(t,"hour",1));0===n&&(n=86400);for(var i=this._getWorkHours(t),r=0;r=a.start&&n<=a.end)return 60;if(ea.start)return(Math.min(n,a.end)-Math.max(e,a.start))/60}return 0},_getMinutesPerDay:function(t){var e=0;return this._getWorkHours(t).forEach(function(t){e+=t.durationMinutes}),e},getHoursPerDay:function(t){var e=0;return this._getWorkHours(t).forEach(function(t){e+=t.durationHours}),e},_getWorkUnitsForRange:function(t,e,n,i){var r,a=0,s=new Date(t),l=new Date(e);for(r="minute"==n?o.bind(this._getMinutesPerDay,this):o.bind(this.getHoursPerDay,this);s.valueOf()27648e5&&0===s.getDate()){var c=this._largeUnitsCache.getMinutesPerMonth(s);"hour"==n&&(c/=60),a+=c,s=this.$gantt.date.add(s,1,"month")}else{if(l-s>13824e5){var d=this.$gantt.date.week_start(new Date(s));if(s.valueOf()===d.valueOf()){c=this._largeUnitsCache.getMinutesPerWeek(s);"hour"==n&&(c/=60),a+=c,s=this.$gantt.date.add(s,7,"day");continue}}a+=r(s),s=this._nextDate(s,"day",1)}return a/i},_getMinutesBetweenSingleDay:function(t,e){for(var n=this._getIntervalTimestamp(t,e),i=this._getWorkHours(t),r=0,a=0;a=o.start&&n.start<=o.end){var s=Math.max(o.start,n.start),l=Math.min(o.end,n.end);r+=(l-s)/60,n.start=l}}return Math.floor(r)},_getMinutesBetween:function(t,e,n,i){var r=new Date(t),a=new Date(e);i=i||1;var o=new Date(r),s=this.$gantt.date.add(this.$gantt.date.day_start(new Date(r)),1,"day");if(a.valueOf()<=s.valueOf())return this._getMinutesBetweenSingleDay(t,e);var l=this.$gantt.date.day_start(new Date(a)),c=a,d=this._getMinutesBetweenSingleDay(o,s),u=this._getMinutesBetweenSingleDay(l,c);return d+this._getWorkUnitsForRange(s,l,n,i)+u},_getHoursBetween:function(t,e,n,i){var r=new Date(t),a=new Date(e);i=i||1;var o=new Date(r),s=this.$gantt.date.add(this.$gantt.date.day_start(new Date(r)),1,"day");if(a.valueOf()<=s.valueOf())return Math.round(this._getMinutesBetweenSingleDay(t,e)/60);var l=this.$gantt.date.day_start(new Date(a)),c=a,d=this._getMinutesBetweenSingleDay(o,s,n,i)/60,u=this._getMinutesBetweenSingleDay(l,c,n,i)/60,h=d+this._getWorkUnitsForRange(s,l,n,i)+u;return Math.round(h)},getConfig:function(){return this._worktime},_setConfig:function(t){this._worktime=t,this._parseSettings(),this._clearCaches()},_parseSettings:function(){var t=this.getConfig();for(var e in t.parsed={dates:{},hours:null,haveCustomWeeks:!1,customWeeks:{},customWeeksRangeStart:null,customWeeksRangeEnd:null,customWeeksBoundaries:[]},t.parsed.hours=this._parseHours(t.hours),t.dates)t.parsed.dates[e]=this._parseHours(t.dates[e]);if(t.customWeeks){var n=null,i=null;for(var e in t.customWeeks){var r=t.customWeeks[e];if(r.from&&r.to){var a=r.from,o=r.to;(!n||n>a.valueOf())&&(n=a.valueOf()),(!i||ii)for(var r=0;ri){n=n.customWeeks[n.customWeeksBoundaries[r].name];break}var a=!0;return void 0!==n.dates[i]?a=n.dates[i]:void 0!==n.dates[t.getDay()]&&(a=n.dates[t.getDay()]),!0===a?n.hours:a||[]},_getIntervalTimestamp:function(t,e){var n={start:0,end:0};n.start=60*t.getHours()*60+60*t.getMinutes()+t.getSeconds();var i=e.getHours();return!i&&!e.getMinutes()&&!e.getSeconds()&&t.valueOf()e.valueOf()){var o=e;e=t,t=o,a=-1}return r="hour"==n&&1==i?this._getHoursBetween(t,e,n,i):"minute"==n&&1==i?this._getMinutesBetween(t,e,n,i):this._getWorkUnitsBetweenGeneric(t,e,n,i),a*Math.round(r)},hasDuration:function(){var t=this.argumentsHelper.getDurationArguments.apply(this.argumentsHelper,arguments),e=t.start_date,n=t.end_date,i=t.unit,r=t.step;if(!i)return!1;var a=new Date(e),o=new Date(n);for(r=r||1;a.valueOf()=0?1:-1;n=Math.abs(1*n);var o=this;return this._dateDurationCache.getEndDate(e,n,i,r*a,function(){return o._calculateEndDate(e,n,i,r*a)})},_calculateEndDate:function(t,e,n,i){return!!n&&(1==i&&"minute"==n?this._calculateMinuteEndDate(t,e,i):-1==i&&"minute"==n?this._subtractMinuteDate(t,e,i):1==i&&"hour"==n?this._calculateHourEndDate(t,e,i):this._addInterval(t,e,n,i,null).end)},_addInterval:function(t,e,n,i,r){for(var a=0,o=t,s=!1;a0&&(c=new Date(l.valueOf()-1)),this._isWorkTime(c,n)&&!s&&a++,o=l}return{end:o,start:t,added:a}},_addHoursUntilDayEnd:function(t,e){for(var n=this.$gantt.date.add(this.$gantt.date.day_start(new Date(t)),1,"day"),i=0,r=e,a=this._getIntervalTimestamp(t,n),o=this._getWorkHours(t),s=0;s=l.start&&a.start<=l.end){var c=Math.max(l.start,a.start),d=Math.min(l.end,a.end),u=(d-c)/3600;u>r&&(u=r,d=c+60*r*60);var h=Math.round((d-c)/3600);i+=h,r-=h,a.start=d}}var f=n;return i===e&&(f=new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,a.start)),{added:i,end:f}},_calculateHourEndDate:function(t,e,n){var i=new Date(t),r=0;n=n||1,e=Math.abs(1*e);var a=this._addHoursUntilDayEnd(i,e);if(r=a.added,i=a.end,c=e-r){for(var o=i;r0?this.getHoursPerDay(new Date(s.valueOf()-1)):this.getHoursPerDay(new Date(s.valueOf()+1)))>=e)break;r+=l,o=s}i=o}if(r=l.start&&a.start<=l.end){var c=Math.max(l.start,a.start),d=Math.min(l.end,a.end),u=(d-c)/60;u>r&&(u=r,d=c+60*r);var h=Math.round((d-c)/60);r-=h,i+=h,a.start=d}}var f=n;return i===e&&(f=new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,a.start)),{added:i,end:f}},_subtractMinutesUntilHourStart:function(t,e){for(var n=this.$gantt.date.hour_start(new Date(t)),i=0,r=e,a=60*n.getHours()*60+60*n.getMinutes()+n.getSeconds(),o=60*t.getHours()*60+60*t.getMinutes()+t.getSeconds(),s=this._getWorkHours(t),l=s.length-1;l>=0&&ic.start&&a<=c.end){var d=Math.min(o,c.end),u=Math.max(a,c.start),h=(d-u)/60;h>r&&(h=r,u=d-60*r);var f=Math.abs(Math.round((d-u)/60));r-=f,i+=f,o=u}}var _=n;return i===e&&(_=new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,o)),{added:i,end:_}},_subtractMinuteDate:function(t,e,n){var i=new Date(t),r=0;n=n||-1,e=Math.abs(1*e),e=Math.round(e);var a=this._subtractMinutesUntilHourStart(i,e);r+=a.added,i=a.end;for(var o=0,s=[],l=0;rl)r+=l,i=this.$gantt.date.add(i,-1,"day");else{for(var _=!1,g=null,p=s.length-1;p>=0;p--)if(s[p].start=f-1){_=!0,g=s[p];break}if(_)if(f===g.end&&h>=g.durationMinutes)r+=g.durationMinutes,i=this.$gantt.date.add(i,-g.durationMinutes,"minute");else if(h<=f/60-g.startMinute)r+=h,i=this.$gantt.date.add(i,-h,"minute");else{var v=this._getMinutesPerHour(i);v<=h?(r+=v,i=this._nextDate(i,"hour",n)):(r+=(a=this._subtractMinutesUntilHourStart(i,h)).added,i=a.end)}else if(0===i.getHours()&&0===i.getMinutes()&&0===i.getSeconds()){if((m=this._getClosestWorkTimePast(i,"hour")).valueOf()===i.valueOf()){var m=this.$gantt.date.add(i,-1,"day"),y=this._getWorkHours(m);if(y.length){var k=y[y.length-1];m.setSeconds(k.durationSeconds)}}i=m}else i=this._getClosestWorkTimePast(new Date(i-1),"hour")}else i=this.$gantt.date.add(i,-1,"day")}if(r=h&&u>=l){if(r+=l,u==l){i=new Date(i.getFullYear(),i.getMonth(),i.getDate(),0,0,s[s.length-1].end);break}i=this.$gantt.date.add(i,1,"day"),i=this.$gantt.date.day_start(i)}else{for(var f=!1,_=null,g=0;gh){f=!0,_=s[g];break}if(f)if(h===_.start&&u>=_.durationMinutes)r+=_.durationMinutes,i=this.$gantt.date.add(i,_.durationMinutes,"minute");else if(u<=_.endMinute-h/60)r+=u,i=this.$gantt.date.add(i,u,"minute");else{var p=this._getMinutesPerHour(i);p<=u?(r+=p,i=c?this.$gantt.date.add(i,p,"minute"):this._nextDate(i,"hour",n)):(r+=(a=this._addMinutesUntilHourEnd(i,u)).added,i=a.end)}else i=this._getClosestWorkTimeFuture(i,"hour")}else i=this.$gantt.date.add(this.$gantt.date.day_start(i),1,"day")}if(r0){for(var s=0;s=o){r=new Date(i.getFullYear(),i.getMonth(),i.getDate(),0,0,n[s].start);break}}else for(s=n.length-1;s>=0;s--){if(n[s].end<=o){r=new Date(i.getFullYear(),i.getMonth(),i.getDate(),0,0,n[s].end);break}if(n[s].end>o&&n[s].start<=o){r=new Date(i.getFullYear(),i.getMonth(),i.getDate(),0,0,o);break}}return r},_getClosestWorkMinute:function(t,e,n){var i=new Date(t),r=this._getWorkHours(i),a=this._findClosestTimeInDay(i,n,r);return a||(i=this.calculateEndDate(i,n,"day"),n>0?i=this.$gantt.date.day_start(i):(i=this.$gantt.date.day_start(i),i=this.$gantt.date.add(i,1,"day"),i=new Date(i.valueOf()-1)),r=this._getWorkHours(i),a=this._findClosestTimeInDay(i,n,r)),n<0&&(a=this.$gantt.date.add(a,-1,e)),a},_getClosestWorkTimeGeneric:function(t,e,n){if("hour"===e||"minute"===e)return this._getClosestWorkMinute(t,e,n);for(var i=this._getUnitOrder(e),r=this.units[i-1],a=t,o=0;!this._isWorkTime(a,e)&&(!r||this._isWorkTime(a,r)||(a=n>0?this._getClosestWorkTimeFuture(a,r):this._getClosestWorkTimePast(a,r),!this._isWorkTime(a,e)));){if(++o>3e3)return this.$gantt.assert(!1,"Invalid working time check"),!1;var s=a.getTimezoneOffset();a=this.$gantt.date.add(a,n,e),a=this.$gantt._correct_dst_change(a,s,n,e),this.$gantt.date[e+"_start"]&&(a=this.$gantt.date[e+"_start"](a))}return a},hasWorkTime:function(){var t=this.getConfig(),e=t.dates,n=[];for(var i in t.dates)Number(i)>6&&n.push(Number(i));var r=this._checkWorkHours(t.hours),a=!1;return[0,1,2,3,4,5,6].forEach(function(t){if(!a){var n=e[t];!0===n?a=r:Array.isArray(n)&&(a=this._checkWorkHours(n))}}.bind(this)),a},_checkWorkHours:function(t){if(0===t.length)return!1;for(var e=!1,n=0;ne.length?t:e,r=t===i?e:t;i=i.slice(),r=r.slice();n=[];for(var a=0;ao.start&&(n.push({start:Math.max(o.start,l.start),end:Math.min(o.end,l.end)}),o.end>l.end&&(r.splice(s,1),s--,a--))}return n},_mergeAdjacentIntervals:function(t){var e=t.slice();e.sort(function(t,e){return t.start-e.start});for(var n=e[0],i=1;in.end&&(n.end=r.end),e.splice(i,1),i--):n=r}return e},_mergeHoursConfig:function(t,e){return this._mergeAdjacentIntervals(this._intersectHourRanges(t,e))},merge:function(t,e){var n=i.copy(t.getConfig().parsed),r=i.copy(e.getConfig().parsed),a={hours:this._toHoursArray(this._mergeHoursConfig(n.hours,r.hours)),dates:{},customWeeks:{}};for(var o in n.dates){var s=n.dates[o],l=r.dates[o];if(s&&l)if(Array.isArray(s)||Array.isArray(l)){var c=Array.isArray(s)?s:n.hours,d=Array.isArray(l)?l:r.hours;a.dates[o]=this._toHoursArray(this._mergeHoursConfig(c,d))}else a.dates[o]=!0;else a.dates[o]=!1}if(n.customWeeks)for(var o in n.customWeeks)a.customWeeks[o]=n.customWeeks[o];if(r.customWeeks)for(var o in r.customWeeks)a.customWeeks[o]=r.customWeeks[o];return a}},t.exports=r},function(t,e,n){var i=n(0),r=n(35),a=n(176),o=n(175),s=n(170),l=n(169)();function c(t){this.$gantt=t,this._calendars={},this._legacyConfig=void 0,this.$gantt.attachEvent("onGanttReady",function(){this.$gantt.config.resource_calendars&&(this._isLegacyConfig=s.isLegacyResourceCalendarFormat(this.$gantt.config.resource_calendars))}.bind(this)),this.$gantt.attachEvent("onBeforeGanttReady",function(){this.createDefaultCalendars()}.bind(this)),this.$gantt.attachEvent("onBeforeGanttRender",function(){this.createDefaultCalendars()}.bind(this))}c.prototype={_calendars:{},_convertWorkTimeSettings:function(t){var e=t.days;if(e&&!t.dates){t.dates=t.dates||{};for(var n=0;n=3?(r=n,a=i):"string"==typeof arguments[1]?r=arguments[1]:"function"==typeof arguments[1]&&(a=arguments[1]),this._load_type=r,this.callEvent("onLoadStart",[e,r]),this.ajax.get(e,t.bind(function(t){this.on_load(t,r),this.callEvent("onLoadEnd",[e,r]),"function"==typeof a&&a.call(this)},this))},t.parse=function(t,e){this.on_load({xmlDoc:{responseText:t}},e)},t.serialize=function(t){return this[t=t||"json"].serialize()},t.on_load=function(e,n){if(e.xmlDoc&&404===e.xmlDoc.status)this.assert(!1,"Failed to load the data from "+e.xmlDoc.responseURL+", server returns 404");else if(!t.$destroyed){this.callEvent("onBeforeParse",[]),n||(n="json"),this.assert(this[n],"Invalid data type:'"+n+"'");var i=e.xmlDoc.responseText,r=this[n].parse(i,e);this._process_loading(r)}},t._process_loading=function(e){e.collections&&this._load_collections(e.collections),e.resources&&this.$data.resourcesStore&&this.$data.resourcesStore.parse(e.resources);var n=e.data||e.tasks;e.assignments&&function(e,n){var i={};n.forEach(function(t){i[t.task_id]||(i[t.task_id]=[]),i[t.task_id].push(t)}),e.forEach(function(e){e[t.config.resource_property]=i[e.id]||[]})}(n,e.assignments),this.$data.tasksStore.parse(n);var i=e.links||(e.collections?e.collections.links:[]);this.$data.linksStore.parse(i),this.callEvent("onParse",[]),this.render()},t._load_collections=function(t){var e=!1;for(var n in t)if(t.hasOwnProperty(n)){e=!0;var i=t[n];this.serverList[n]=this.serverList[n]||[];var r=this.serverList[n];if(!r)continue;r.splice(0,r.length);for(var a=0;a"},_copyObject:function(t){return""},serialize:function(){for(var e=[],n=[],i=t.json.serialize(),r=0,a=i.data.length;r"+e.join("")+""+n.join("")+""}},t.oldxml={parse:function(e,n){n=t.xml._getXML(e,n,"projects");for(var i={collections:{links:[]}},r=i.data=[],a=t.ajax.xpath("//task",n),o=0;o=r-20&&(t.autoscrollRight(),t.autoscrollStart()),o<=a+20&&(t.autoscrollLeft(),t.autoscrollStart()),oa+20&&t.autoscrollStop(),!0}),this._dnd.attachEvent("onDragEnd",function(){t.autoscrollStop()}))},t.prototype.autoscrollStart=function(){var t=this;if(0!==this._scrollOrder){var e=10*this._scrollOrder,n=this._scrollView.getScrollState();this._scrollView.scrollTo(n.position+e),setTimeout(function(){t.autoscrollStart()},50)}},t.prototype.autoscrollRight=function(){this._scrollOrder=1},t.prototype.autoscrollLeft=function(){this._scrollOrder=-1},t.prototype.autoscrollStop=function(){this._scrollOrder=0},t.prototype.getCorrection=function(){return this.isScrollable()?this._scrollView.getScrollState().position:0},t.prototype.isScrollable=function(){return!!this.$grid.$config.scrollable},t}();e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),r=n(182),a=function(){function t(t,e){var n=this;this._targetMarker=null,this.calculateCurrentPosition=function(t){var e=n.$grid.$grid.getBoundingClientRect(),i=e.right,r=e.left,a=t;return a>i&&(a=i),a=e},u=function(t){return--t});for(var h=this._dragX-this.$grid.$grid.getBoundingClientRect().left+this._scrollableGrid.getCorrection(),f=l;d(f,c)&&(void 0===t||void 0===e);f=u(f))o[f].hide||(s.startX=s.endX,s.endX+=o[f].width,h>=s.startX&&(h<=s.endX||!d(u(f),c))&&(t=f,n=s.startX,i=s.endX,r=(h-s.startX)/(s.endX-s.startX)),a===o[f].name&&(e=f));return{targetIndex:t,draggedIndex:e,xBefore:n,xAfter:i,columnRelativePos:r}},t.prototype.setMarkerPosition=function(t,e){void 0===e&&(e=10);var n=this._dnd.config.marker,i=this._dnd._obj.getBoundingClientRect();n.style.top=i.y+e+"px",n.style.left=t+"px"},t.prototype.drawTargetMarker=function(t){var e,n=t.targetIndex,r=t.draggedIndex,a=t.xBefore,o=t.xAfter,s=t.columnRelativePos;this._targetMarker||(this._targetMarker=document.createElement("div"),i.addClassName(this._targetMarker,"gantt_grid_target_marker"),this._targetMarker.style.display="none",this._targetMarker.style.height=this._gridConfig.scale_height+"px"),this._targetMarker.parentNode||this.$grid.$grid_scale.appendChild(this._targetMarker),e=n>r?o:n.5?o:a,this._targetMarker.style.left=e+"px",this._targetMarker.style.display="block"},t.prototype.cleanTargetMarker=function(){this._targetMarker&&this._targetMarker.parentNode&&this.$grid.$grid_scale.removeChild(this._targetMarker),this._targetMarker=null},t}();e.ColumnsGridDnd=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(183);e.default=i.ColumnsGridDnd},function(t,e,n){var i=n(1);t.exports=function(t,e){var n={row_before_start:t.bind(function(t,n,r){var a=e.$getConfig(),o=e.$config.rowStore;if(!i.locateAttribute(r,a.task_grid_row_resizer_attribute))return!1;var s=this.locate(r,a.task_grid_row_resizer_attribute),l=o.getItem(s);return!1!==e.callEvent("onBeforeRowResize",[l])&&void 0},t),row_after_start:t.bind(function(t,n,i){var r=e.$getConfig(),a=this.locate(i,r.task_grid_row_resizer_attribute);t.config.marker.innerHTML="",t.config.marker.className+=" gantt_row_grid_resize_area",t.config.marker.style.width=e.$grid.offsetWidth+"px",t.config.drag_id=a},t),row_drag_move:t.bind(function(t,n,r){var a=e.$config.rowStore,o=e.$getConfig(),s=t.config,l=s.drag_id,c=e.getItemHeight(l),d=e.getItemTop(l),u=i.getNodePosition(e.$grid_data),h=parseInt(s.marker.style.top,10),f=d+u.y,_=0,g=o.min_task_grid_row_height;return(_=h-f)=0?"&":"?",a=t.getScrollState().y||0,o={taskId:e,url:n+r+"parent_id="+encodeURIComponent(e)};if(!1===t.callEvent("onBeforeBranchLoading",[o]))return;t.load(o.url,this._load_type,function(){a&&t.scrollTo(null,a),t.callEvent("onAfterBranchLoading",[o])}),i[e]=!0}})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){t.ext=t.ext||{},t.config.show_empty_state=!1,t.ext.emptyStateElement=t.ext.emptyStateElement||{isEnabled:function(){return!0===t.config.show_empty_state},isGanttEmpty:function(){return!t.getTaskByTime().length},renderContent:function(e){var n="
\n \n
"+t.locale.labels.empty_state_text_description+"
\n
";e.innerHTML=n},clickEvents:[],attachAddTaskEvent:function(){var e=t.attachEvent("onEmptyClick",function(e){t.utils.dom.closest(e.target,"[data-empty-state-create-task]")&&t.createTask({id:t.uid(),text:"New Task"})});this.clickEvents.push(e)},detachAddTaskEvents:function(){this.clickEvents.forEach(function(e){t.detachEvent(e)}),this.clickEvents=[]},getContainer:function(){if(t.$container){var e=t.utils.dom;if(t.$container.contains(t.$grid_data))return e.closest(t.$grid_data,".gantt_layout_content");if(t.$container.contains(t.$task_data))return e.closest(t.$task_data,".gantt_layout_content")}return null},getNode:function(){var t=this.getContainer();return t?t.querySelector(".gantt_empty_state_wrapper"):null},show:function(){var e=this.getContainer();if(!e&&this.isGanttEmpty())return null;var n=document.createElement("div");n.className="gantt_empty_state_wrapper",n.style.marginTop=t.config.scale_height-e.offsetHeight+"px";var i=t.$container.querySelectorAll(".gantt_empty_state_wrapper");Array.prototype.forEach.call(i,function(t){t.parentNode.removeChild(t)}),this.detachAddTaskEvents(),this.attachAddTaskEvent(),e.appendChild(n),this.renderContent(n)},hide:function(){var t=this.getNode();if(!t)return!1;t.parentNode.removeChild(t)},init:function(){}},t.attachEvent("onDataRender",function(){var e=t.ext.emptyStateElement;e.isEnabled()&&e.isGanttEmpty()?e.show():e.hide()})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){var e=this;this.format=function(t){return e._getWBSCode(t.source)},this.canParse=function(t){return e._linkReg.test(t)},this.parse=function(t){if(!e.canParse(t))return null;var n=e._linkReg.exec(t)[0].trim();return{id:void 0,source:e._findSource(n)||null,target:null,type:e._gantt.config.links.finish_to_start,lag:0}},this._getWBSCode=function(t){var n=e._gantt.getTask(t);return e._gantt.getWBSCode(n)},this._findSource=function(t){var n=new RegExp("^[0-9.]+","i");if(n.exec(t)){var i=n.exec(t)[0],r=e._gantt.getTaskByWBSCode(i);if(r)return r.id}return null},this._linkReg=/^[0-9\.]+/,this._gantt=t}return t.create=function(e,n){return void 0===e&&(e=null),new t(n)},t}();e.default=i},function(t,e,n){var i=n(37).default,r=n(191).default;t.exports=function(t){t.ext.formatters={durationFormatter:function(e){return e||(e={}),e.store||(e.store=t.config.duration_unit),e.enter||(e.enter=t.config.duration_unit),i.create(e,t)},linkFormatter:function(e){return r.create(e,t)}}}},function(t,e){t.exports=function(t){function e(e){return function(){return!t.config.auto_types||t.getTaskType(t.config.types.project)!=t.config.types.project||e.apply(this,arguments)}}function n(e,n){var i=t.getTask(e),r=a(i);!1!==r&&t.getTaskType(i)!==r&&(n.$needsUpdate=!0,n[i.id]={task:i,type:r})}function i(e){if(!t.getState().group_mode){var i=function(e,i){return n(e,i=i||{}),t.eachParent(function(t){n(t.id,i)},e),i}(e);i.$needsUpdate&&t.batchUpdate(function(){!function(e){for(var n in e)if(e[n]&&e[n].task){var i=e[n].task;i.type=e[n].type,t.updateTask(i.id)}}(i)})}}var r;function a(e){var n=t.config.types,i=t.hasChild(e.id),r=t.getTaskType(e.type);return i&&r===n.task?n.project:!i&&r===n.project&&n.task}var o,s,l=!0;function c(e){e!=t.config.root_id&&t.isTaskExists(e)&&i(e)}t.attachEvent("onParse",e(function(){l=!1,t.getState().group_mode||(t.batchUpdate(function(){t.eachTask(function(e){var n=a(e);!1!==n&&function(e,n){t.getState().group_mode||(e.type=n,t.updateTask(e.id))}(e,n)})}),l=!0)})),t.attachEvent("onAfterTaskAdd",e(function(t){l&&i(t)})),t.attachEvent("onAfterTaskUpdate",e(function(t){l&&i(t)})),t.attachEvent("onBeforeTaskDelete",e(function(e,n){return r=t.getParent(e),!0})),t.attachEvent("onAfterTaskDelete",e(function(t,e){c(r)})),t.attachEvent("onRowDragStart",e(function(e,n,i){return o=t.getParent(e),!0})),t.attachEvent("onRowDragEnd",e(function(t,e){c(o),i(t)})),t.attachEvent("onBeforeTaskMove",e(function(e,n,i){return s=t.getParent(e),!0})),t.attachEvent("onAfterTaskMove",e(function(t,e,n){document.querySelector(".gantt_drag_marker")||(c(s),i(t))}))}},function(t,e){t.exports=function(t){function e(e){return function(){return!t.config.placeholder_task||e.apply(this,arguments)}}function n(){var e=t.getTaskBy("type",t.config.types.placeholder);if(!e.length||!t.isTaskExists(e[0].id)){var n={unscheduled:!0,type:t.config.types.placeholder,duration:0,text:t.locale.labels.new_task};if(!1===t.callEvent("onTaskCreated",[n]))return;t.addTask(n)}}function i(e){var n=t.getTask(e);n.type==t.config.types.placeholder&&(n.start_date&&n.end_date&&n.unscheduled&&(n.unscheduled=!1),t.batchUpdate(function(){var e=t.copy(n);t.silent(function(){t.deleteTask(n.id)}),delete e["!nativeeditor_status"],e.type=t.config.types.task,e.id=t.uid(),t.addTask(e)}))}t.config.types.placeholder="placeholder",t.attachEvent("onDataProcessorReady",e(function(n){n&&!n._silencedPlaceholder&&(n._silencedPlaceholder=!0,n.attachEvent("onBeforeUpdate",e(function(e,i,r){return r.type!=t.config.types.placeholder||(n.setUpdated(e,!1),!1)})))}));var r=!1;function a(e){if(t.config.types.placeholder&&t.isTaskExists(e)&&t.getTask(e).type==t.config.types.placeholder)return!0;return!1}function o(t){return!(!a(t.source)&&!a(t.target))}t.attachEvent("onGanttReady",function(){r||(r=!0,t.attachEvent("onAfterTaskUpdate",e(i)),t.attachEvent("onAfterTaskAdd",e(function(e,i){i.type!=t.config.types.placeholder&&(t.getTaskBy("type",t.config.types.placeholder).forEach(function(e){t.silent(function(){t.isTaskExists(e.id)&&t.deleteTask(e.id)})}),n())})),t.attachEvent("onParse",e(n)))}),t.attachEvent("onLinkValidation",function(t){return!o(t)}),t.attachEvent("onBeforeLinkAdd",function(t,e){return!o(e)}),t.attachEvent("onBeforeUndoStack",function(e){for(var n=0;ni.start_date){for(var s=0;s"+l.value+"
"}return"
-
"}return""},renderSummaryLabel:function(t,e,n,i,r){var a=r.reduce(function(t,e){return t+Number(e.value)},0);return a%1&&(a=Math.round(10*a)/10),a?"
"+a+"
":""},editableResourceCellTemplate:function(t,n,i,r,a){return"task"===i.$role?e.renderEditableLabel(t,n,i,r,a):e.renderSummaryLabel(t,n,i,r,a)},editableResourceCellClass:function(t,e,n,i,r){var a=[];a.push("resource_marker"),"task"===n.$role?a.push("task_cell"):a.push("resource_cell");var o=r.reduce(function(t,e){return t+Number(e.value)},0),s=Number(n.capacity);return isNaN(s)&&(s=8),o<=s?a.push("workday_ok"):a.push("workday_over"),a.join(" ")},getSummaryResourceAssignments:function(e){var n,i=t.getDatastore(t.config.resource_store),r=i.getItem(e);return"task"===r.$role?n=t.getResourceAssignments(r.$resource_id,r.$task_id):(n=t.getResourceAssignments(e),i.eachItem&&i.eachItem(function(e){"task"!==e.$role&&(n=n.concat(t.getResourceAssignments(e.id)))},e)),n},initEditableDiagram:function(){t.config.resource_render_empty_cells=!0,function(){var e=null;function n(){return e&&cancelAnimationFrame(e),e=requestAnimationFrame(function(){Array.prototype.slice.call(t.$container.querySelectorAll(".resourceTimeline_cell [data-assignment-cell]")).forEach(function(t){t.contentEditable=!0})}),!0}t.attachEvent("onGanttReady",function(){t.getDatastore(t.config.resource_assignment_store).attachEvent("onStoreUpdated",n),t.getDatastore(t.config.resource_store).attachEvent("onStoreUpdated",n)},{once:!0}),t.attachEvent("onGanttLayoutReady",function(){t.$layout.getCellsByType("viewCell").forEach(function(t){t.$config&&"resourceTimeline"===t.$config.view&&t.$content&&t.$content.attachEvent("onScroll",n)})})}(),t.attachEvent("onGanttReady",function(){var e=!1;t.event(t.$container,"keypress",function(t){var e=t.target.closest(".resourceTimeline_cell [data-assignment-cell]");e&&(13!==t.keyCode&&27!==t.keyCode||e.blur())}),t.event(t.$container,"focusout",function(n){if(!e){e=!0,setTimeout(function(){e=!1},300);var i=n.target.closest(".resourceTimeline_cell [data-assignment-cell]");if(i){var r=(i.innerText||"").trim();"-"==r&&(r="0");var a=Number(r),o=i.getAttribute("data-row-id"),s=i.getAttribute("data-assignment-id"),l=i.getAttribute("data-task"),c=i.getAttribute("data-resource-id"),d=t.templates.parse_date(i.getAttribute("data-start-date")),u=t.templates.parse_date(i.getAttribute("data-end-date")),h=t.getDatastore(t.config.resource_assignment_store);if(isNaN(a))t.getDatastore(t.config.resource_store).refresh(o);else{var f=t.getTask(l);if(s){if(a===(g=h.getItem(s)).value)return;if(g.start_date.valueOf()===d.valueOf()&&g.end_date.valueOf()===u.valueOf())g.value=a,a?h.updateItem(g.id):h.removeItem(g.id);else{if(g.end_date.valueOf()>u.valueOf()){var _=t.copy(g);_.id=t.uid(),_.start_date=u,_.duration=t.calculateDuration({start_date:_.start_date,end_date:_.end_date,task:f}),_.delay=t.calculateDuration({start_date:f.start_date,end_date:_.start_date,task:f}),_.mode=g.mode||"default",0!==_.duration&&h.addItem(_)}g.start_date.valueOf()-1?t.indexOf("?"):t.length),this.serverProcessor=t+("/"===t.slice(-1)?"":"/")+e}else{var n=this._ganttMode+"s";this.serverProcessor=t+i.ajax.urlSeparator(t)+"gantt_mode="+n}return!0}),e.attachEvent("insertCallback",function(t,e,n,r){var a=t.data||i.xml._xmlNodeToJSON(t.firstChild),o={add:i.addTask,isExist:i.isTaskExists};"links"===r&&(o.add=i.addLink,o.isExist=i.isLinkExists),o.isExist.call(i,e)||(a.id=e,o.add.call(i,a))}),e.attachEvent("updateCallback",function(t,e){var n=t.data||i.xml._xmlNodeToJSON(t.firstChild);if(i.isTaskExists(e)){var r=i.getTask(e);for(var a in n){var o=n[a];switch(a){case"id":continue;case"start_date":case"end_date":o=i.defined(i.templates.xml_date)?i.templates.xml_date(o):i.templates.parse_date(o);break;case"duration":r.end_date=i.calculateEndDate({start_date:r.start_date,duration:o,task:r})}r[a]=o}i.updateTask(e),i.refreshData()}}),e.attachEvent("deleteCallback",function(t,e,n,r){var a={delete:i.deleteTask,isExist:i.isTaskExists};"links"===r?(a.delete=i.deleteLink,a.isExist=i.isLinkExists):"assignment"===r&&(a.delete=function(t){i.$data.assignmentsStore.remove(t)},a.isExist=function(t){return i.$data.assignmentsStore.exists(t)}),a.isExist.call(i,e)&&a.delete.call(i,e)}),this.handleResourceAssignmentCRUD(e,i)},t.prototype.clientSideDelete=function(t,e,n){var i=e.updatedRows.slice(),r=!1;"true_deleted"===n.getUserData(t,"!nativeeditor_status",e._ganttMode)&&(r=!0,e.setUpdated(t,!1));for(var a=0;a=0?"link":o.indexOf("/assignment")>=0?"assignment":"task",this.setGanttMode(a);var s,l=this.$gantt.ajax;try{s=JSON.parse(e.xmlDoc.responseText)}catch(t){e.xmlDoc.responseText.length||(s={})}var c=function(e){var n=s.action||r.getState(e)||"updated",i=s.sid||e[0],o=s.tid||e[0];t.afterUpdateCallback(i,o,n,s,a)};if(s)return Array.isArray(n)&&n.length>1?n.forEach(function(t){return c(t)}):c(n),t.finalizeUpdate(),void this.setGanttMode(a);var d=l.xmltop("data",e.xmlDoc);if(!d)return this.cleanUpdate(n);var u=l.xpath("//data/action",d);if(!u.length)return this.cleanUpdate(n);for(var h=0;hr||+n.end_date<+i)return!1}return!0}),s.attachEvent("onIdChange",function(e,n){t._update_flags(e,n);var i=t.getTask(n);s.isSilent()||(i.$split_subtask||i.rollup)&&t.eachParent(function(e){t.refreshTask(e.id)},n)}),s.attachEvent("onAfterUpdate",function(e){if(t._update_parents(e),t.getState("batchUpdate").batch_update)return!0;var n=s.getItem(e);n.$source||(n.$source=[]);for(var i=0;i=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(211),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(15))},function(t,e,n){(function(n,i,r){var a,o,s;function l(t){"@babel/helpers - typeof";return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)} +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("dhtmlxgantt",[],e):"object"==typeof exports?exports.dhtmlxgantt=e():t.dhtmlxgantt=e()}(window,function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/codebase/",n(n.s=257)}([function(t,e,n){function i(t){"@babel/helpers - typeof";return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var r,a=n(2),o={}.constructor.toString();t.exports={copy:function t(e){var n,r;if(e&&"object"==i(e))switch(!0){case a.isDate(e):r=new Date(e);break;case a.isArray(e):for(r=new Array(e.length),n=0;n=0}function a(t){return!{a:!0,area:!0}[t.nodeName.loLowerCase()]||!!t.getAttribute("href")}function o(t){return!{input:!0,select:!0,textarea:!0,button:!0,object:!0}[t.nodeName.toLowerCase()]||!t.hasAttribute("disabled")}function s(t){if(!t)return"";var e=t.className||"";return e.baseVal&&(e=e.baseVal),e.indexOf||(e=""),d(e)}var l;function c(t){var e;return t.tagName?e=t:(e=(t=t||window.event).target||t.srcElement).shadowRoot&&t.composedPath&&(e=t.composedPath()[0]),e}function d(t){return(String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")}).apply(t)}function u(){return document.head.createShadowRoot||document.head.attachShadow}function h(t){if(!t)return document.body;if(!u())return document.body;for(;t.parentNode&&(t=t.parentNode);)if(t instanceof ShadowRoot)return t.host;return document.body}t.exports={getNodePosition:n,getFocusableNodes:function(t){for(var e=t.querySelectorAll(["a[href]","area[href]","input","select","textarea","button","iframe","object","embed","[tabindex]","[contenteditable]"].join(", ")),n=Array.prototype.slice.call(e,0),s=0;s=0){if(!n)return i;var o=0===a||!d(r.charAt(a-1)),l=a+e.length>=r.length||!d(r.charAt(a+e.length));if(o&&l)return i}}i=i.parentNode}return null},locateAttribute:function(t,e){if(e){for(var n=c(t);n;){if(n.getAttribute&&n.getAttribute(e))return n;n=n.parentNode}return null}},getTargetNode:c,getRelativeEventPosition:function(t,e){var i=document.documentElement,r=n(e);return{x:t.clientX+i.scrollLeft-i.clientLeft-r.x+e.scrollLeft,y:t.clientY+i.scrollTop-i.clientTop-r.y+e.scrollTop}},isChildOf:function(t,e){if(!t||!e)return!1;for(;t&&t!=e;)t=t.parentNode;return t===e},hasClass:function(t,e){return"classList"in t?t.classList.contains(e):new RegExp("\\b"+e+"\\b").test(t.className)},closest:function(t,e){if(t.closest)return t.closest(e);if(t.matches||t.msMatchesSelector||t.webkitMatchesSelector){var n=t;if(!document.documentElement.contains(n))return null;do{if((n.matches||n.msMatchesSelector||n.webkitMatchesSelector).call(n,e))return n;n=n.parentElement||n.parentNode}while(null!==n&&1===n.nodeType);return null}return console.error("Your browser is not supported"),null},getRootNode:h,hasShadowParent:function(t){return!!h(t)},isShadowDomSupported:u,getActiveElement:function(){var t=document.activeElement;return t.shadowRoot&&(t=t.shadowRoot.activeElement),t===document.body&&document.getSelection&&(t=document.getSelection().focusNode||document.body),t}}},function(t,e){function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i={second:1,minute:60,hour:3600,day:86400,week:604800,month:2592e3,quarter:7776e3,year:31536e3};function r(t){return!(!t||"object"!==n(t))&&!!(t.getFullYear&&t.getMonth&&t.getDate)}function a(t,e){var n=[];if(t.filter)return t.filter(e);for(var i=0;ie)){for(;+t[n]==+t[n+1];)n++;return n}if(!isNaN(r)&&r=0||navigator.userAgent.indexOf("Trident")>=0),isIE6:n&&!XMLHttpRequest&&navigator.userAgent.indexOf("MSIE")>=0,isIE7:n&&navigator.userAgent.indexOf("MSIE 7.0")>=0&&navigator.userAgent.indexOf("Trident")<0,isIE8:n&&navigator.userAgent.indexOf("MSIE 8.0")>=0&&navigator.userAgent.indexOf("Trident")>=0,isOpera:n&&navigator.userAgent.indexOf("Opera")>=0,isChrome:n&&navigator.userAgent.indexOf("Chrome")>=0,isKHTML:n&&(navigator.userAgent.indexOf("Safari")>=0||navigator.userAgent.indexOf("Konqueror")>=0),isFF:n&&navigator.userAgent.indexOf("Firefox")>=0,isIPad:n&&navigator.userAgent.search(/iPad/gi)>=0,isEdge:n&&-1!=navigator.userAgent.indexOf("Edge"),isNode:!n||"undefined"==typeof navigator};t.exports=i},function(t,e,n){var i=n(0),r=n(4),a=n(1),o=function(){"use strict";function t(t,e,n,o){t&&(this.$container=a.toNode(t),this.$parent=t),this.$config=i.mixin(e,{headerHeight:33}),this.$gantt=o,this.$domEvents=o._createDomEventScope(),this.$id=e.id||"c"+i.uid(),this.$name="cell",this.$factory=n,r(this)}return t.prototype.destructor=function(){this.$parent=this.$container=this.$view=null,this.$gantt.$services.getService("mouseEvents").detach("click","gantt_header_arrow",this._headerClickHandler),this.$domEvents.detachAll(),this.callEvent("onDestroy",[]),this.detachAllEvents()},t.prototype.cell=function(t){return null},t.prototype.scrollTo=function(t,e){var n=this.$view;this.$config.html&&(n=this.$view.firstChild),1*t==t&&(n.scrollLeft=t),1*e==e&&(n.scrollTop=e)},t.prototype.clear=function(){this.getNode().innerHTML="",this.getNode().className="gantt_layout_content",this.getNode().style.padding="0"},t.prototype.resize=function(t){if(this.$parent)return this.$parent.resize(t);!1===t&&(this.$preResize=!0);var e=this.$container,n=e.offsetWidth,i=e.offsetHeight,r=this.getSize();e===document.body&&(n=document.body.offsetWidth,i=document.body.offsetHeight),nr.maxWidth&&(n=r.maxWidth),ir.maxHeight&&(i=r.maxHeight),this.setSize(n,i),this.$preResize,this.$preResize=!1},t.prototype.hide=function(){this._hide(!0),this.resize()},t.prototype.show=function(t){this._hide(!1),t&&this.$parent&&this.$parent.show(),this.resize()},t.prototype._hide=function(t){if(!0===t&&this.$view.parentNode)this.$view.parentNode.removeChild(this.$view);else if(!1===t&&!this.$view.parentNode){var e=this.$parent.cellIndex(this.$id);this.$parent.moveView(this,e)}this.$config.hidden=t},t.prototype.$toHTML=function(t,e){void 0===t&&(t=""),e=[e||"",this.$config.css||""].join(" ");var n=this.$config,i="";n.raw?t="string"==typeof n.raw?n.raw:"":(t||(t="
"+(n.html||"")+"
"),n.header&&(i="
"+(n.canCollapse?"
":"")+"
"+n.header+"
"));return"
"+i+t+"
"},t.prototype.$fill=function(t,e){this.$view=t,this.$parent=e,this.init()},t.prototype.getNode=function(){return this.$view.querySelector("gantt_layout_cell")||this.$view},t.prototype.init=function(){var t=this;this._headerClickHandler=function(e){a.locateAttribute(e,"data-cell-id")==t.$id&&t.toggle()},this.$gantt.$services.getService("mouseEvents").delegate("click","gantt_header_arrow",this._headerClickHandler),this.callEvent("onReady",[])},t.prototype.toggle=function(){this.$config.collapsed=!this.$config.collapsed,this.resize()},t.prototype.getSize=function(){var t={height:this.$config.height||0,width:this.$config.width||0,gravity:this.$config.gravity||1,minHeight:this.$config.minHeight||0,minWidth:this.$config.minWidth||0,maxHeight:this.$config.maxHeight||1e11,maxWidth:this.$config.maxWidth||1e11};if(this.$config.collapsed){var e="x"===this.$config.mode;t[e?"width":"height"]=t[e?"maxWidth":"maxHeight"]=this.$config.headerHeight}return t},t.prototype.getContentSize=function(){var t=this.$lastSize.contentX;t!==1*t&&(t=this.$lastSize.width);var e=this.$lastSize.contentY;return e!==1*e&&(e=this.$lastSize.height),{width:t,height:e}},t.prototype._getBorderSizes=function(){var t={top:0,right:0,bottom:0,left:0,horizontal:0,vertical:0};return this._currentBorders&&(this._currentBorders[this._borders.left]&&(t.left=1,t.horizontal++),this._currentBorders[this._borders.right]&&(t.right=1,t.horizontal++),this._currentBorders[this._borders.top]&&(t.top=1,t.vertical++),this._currentBorders[this._borders.bottom]&&(t.bottom=1,t.vertical++)),t},t.prototype.setSize=function(t,e){this.$view.style.width=t+"px",this.$view.style.height=e+"px";var n=this._getBorderSizes(),i=e-n.vertical,r=t-n.horizontal;this.$lastSize={x:t,y:e,contentX:r,contentY:i},this.$config.header?this._sizeHeader():this._sizeContent()},t.prototype._borders={left:"gantt_layout_cell_border_left",right:"gantt_layout_cell_border_right",top:"gantt_layout_cell_border_top",bottom:"gantt_layout_cell_border_bottom"},t.prototype._setBorders=function(t,e){e||(e=this);var n=e.$view;for(var i in this._borders)a.removeClassName(n,this._borders[i]);"string"==typeof t&&(t=[t]);var r={};for(i=0;i";return e+=r.getHtmlSelect(t.options,[{key:"style",value:"width:100%;"}]),e+=""},a.prototype.set_value=function(t,e,n,i){var r=t.firstChild;!r._dhx_onchange&&i.onchange&&(r.onchange=i.onchange,r._dhx_onchange=!0),void 0===e&&(e=(r.options[0]||{}).value),r.value=e||""},a.prototype.get_value=function(t){return t.firstChild.value},a.prototype.focus=function(e){var n=e.firstChild;t._focus(n,!0)},a}},function(t,e){t.exports=function(t,e,n,i,r){if(!t.start_date||!t.end_date)return null;var a=n.getItemTop(t.id),o=n.getItemHeight(t.id);if(a>e.y_end||a+oe.x_end||dn.getBranchIndex(t)&&(i.targetIndex-=1),i},firstChildTarget:function(t,e,n){var i=this.createDropTargetObject();return i.targetId=e,i.targetParent=i.targetId,i.targetIndex=0,i.child=!0,i},lastChildTarget:function(t,e,n){var i=n.getChildren(e),r=this.createDropTargetObject();return r.targetId=i[i.length-1],r.targetParent=e,r.targetIndex=i.length,r.nextSibling=!0,r}}},function(t,e,n){var i=n(14);t.exports=function(t,e,n,r){var a=e.width[t];if(a<=0)return!1;if(!r.config.smart_rendering||i(r))return!0;var o=e.left[t]-a,s=e.left[t]+a;return o<=n.x_end&&s>=n.x}},function(t,e){t.exports=function(t,e){var n=0,i=t.left.length-1;if(e)for(var r=0;re.x_end){i=r;break}}return{start:n,end:i}}},function(t,e){t.exports=function(t,e,n){return{top:e.getItemTop(t.id),height:e.getItemHeight(t.id),left:0,right:1/0}}},function(t,e){t.exports=function(t){function e(e,a,o){if(!t._isAllowedUnscheduledTask(e)&&t._isTaskInTimelineLimits(e)){var s=a.getItemPosition(e),l=o,c=a.$getTemplates(),d=t.getTaskType(e.type),u=a.getBarHeight(e.id,d==l.types.milestone),h=0;d==l.types.milestone&&(h=(u-s.height)/2);var f=Math.floor((a.getItemHeight(e.id)-u)/2);d==l.types.milestone&&(s.left-=Math.round(u/2),s.width=u);var _=document.createElement("div"),g=Math.round(s.width);a.$config.item_attribute&&(_.setAttribute(a.$config.item_attribute,e.id),_.setAttribute(a.$config.bind+"_id",e.id)),l.show_progress&&d!=l.types.milestone&&function(e,n,i,r,a){var o=1*e.progress||0;i=Math.max(i-2,0);var s=document.createElement("div"),l=Math.round(i*o);l=Math.min(i,l),e.progressColor&&(s.style.backgroundColor=e.progressColor,s.style.opacity=1),s.style.width=l+"px",s.className="gantt_task_progress",s.innerHTML=a.progress_text(e.start_date,e.end_date,e),r.rtl&&(s.style.position="absolute",s.style.right="0px");var c=document.createElement("div");if(c.className="gantt_task_progress_wrapper",c.appendChild(s),n.appendChild(c),t.config.drag_progress&&!t.isReadonly(e)){var d=document.createElement("div"),u=l;r.rtl&&(u=i-l),d.style.left=u+"px",d.className="gantt_task_progress_drag",s.appendChild(d),n.appendChild(d)}}(e,_,g,l,c);var p=function(e,n,i){var r=document.createElement("div");return t.getTaskType(e.type)!=t.config.types.milestone?r.innerHTML=i.task_text(e.start_date,e.end_date,e):t.getTaskType(e.type)==t.config.types.milestone&&n&&(r.style.height=r.style.width=n+"px"),r.className="gantt_task_content",r}(e,g,c);e.textColor&&(p.style.color=e.textColor),_.appendChild(p);var v=function(e,n,i,r){var a=r.$getConfig(),o=[e];n&&o.push(n);var s=t.getState(),l=t.getTask(i);if(t.getTaskType(l.type)==a.types.milestone?o.push("gantt_milestone"):t.getTaskType(l.type)==a.types.project&&o.push("gantt_project"),o.push("gantt_bar_"+t.getTaskType(l.type)),t.isSummaryTask(l)&&o.push("gantt_dependent_task"),t.isSplitTask(l)&&(a.open_split_tasks&&!l.$open||!a.open_split_tasks)&&o.push("gantt_split_parent"),a.select_task&&t.isSelectedTask(i)&&o.push("gantt_selected"),i==s.drag_id&&(o.push("gantt_drag_"+s.drag_mode),s.touch_drag&&o.push("gantt_touch_"+s.drag_mode)),s.link_source_id==i&&o.push("gantt_link_source"),s.link_target_id==i&&o.push("gantt_link_target"),a.highlight_critical_path&&t.isCriticalTask&&t.isCriticalTask(l)&&o.push("gantt_critical_task"),s.link_landing_area&&s.link_target_id&&s.link_source_id&&s.link_target_id!=s.link_source_id&&(s.link_target_id==i||s.link_source_id==i)){var c=s.link_source_id,d=s.link_from_start,u=s.link_to_start,h=t.isLinkAllowed(c,i,d,u),f="";f=h?u?"link_start_allow":"link_finish_allow":u?"link_start_deny":"link_finish_deny",o.push(f)}return o.join(" ")}("gantt_task_line",c.task_class(e.start_date,e.end_date,e),e.id,a);(e.color||e.progressColor||e.textColor)&&(v+=" gantt_task_inline_color"),s.width<20&&(v+=" gantt_thin_task"),_.className=v;var m=["left:"+s.left+"px","top:"+(f+s.top)+"px","height:"+(d==l.types.milestone?s.height:u)+"px","line-height:"+Math.max(u<30?u-2:u,0)+"px","width:"+g+"px"];e.color&&m.push("background-color:"+e.color),e.textColor&&m.push("color:"+e.textColor),_.style.cssText=m.join(";");var y=function(t,e,r,a){var o="gantt_left "+i(!e.rtl,t),s=null;return a&&(s={type:"marginRight",value:a}),n(t,r.leftside_text,o,s)}(e,l,c,h);y&&_.appendChild(y),(y=function(t,e,r,a){var o="gantt_right "+i(!!e.rtl,t),s=null;return a&&(s={type:"marginLeft",value:a}),n(t,r.rightside_text,o,s)}(e,l,c,h))&&_.appendChild(y),t._waiAria.setTaskBarAttr(e,_);var k=t.getState();return t.isReadonly(e)||(l.drag_resize&&!t.isSummaryTask(e)&&d!=l.types.milestone&&r(_,"gantt_task_drag",e,function(t){var e=document.createElement("div");return e.className=t,e},l),l.drag_links&&l.show_links&&r(_,"gantt_link_control",e,function(t){var e=document.createElement("div");e.className=t,e.style.cssText=["height:"+u+"px","line-height:"+u+"px"].join(";");var n=document.createElement("div");n.className="gantt_link_point";var i=!1;return k.link_source_id&&l.touch&&(i=!0),n.style.display=i?"block":"",e.appendChild(n),e},l,h)),_}}function n(t,e,n,i){if(!e)return null;var r=e(t.start_date,t.end_date,t);if(!r)return null;var a=document.createElement("div");return a.className="gantt_side_content "+n,a.innerHTML=r,i&&(a.style[i.type]=Math.abs(i.value)+"px"),a}function i(e,n){var i=function(e){return e?{$source:[t.config.links.start_to_start],$target:[t.config.links.start_to_start,t.config.links.finish_to_start]}:{$source:[t.config.links.finish_to_start,t.config.links.finish_to_finish],$target:[t.config.links.finish_to_finish]}}(e);for(var r in i)for(var a=n[r],o=0;o=+l.min_date&&((s=r([n,a.rtl?"task_right":"task_left","task_start_date"].join(" "))).setAttribute("data-bind-property","start_date"),o&&(s.style.marginLeft=o+"px"),e.appendChild(s)),+i.end_date<=+l.max_date&&((s=r([n,a.rtl?"task_left":"task_right","task_end_date"].join(" "))).setAttribute("data-bind-property","end_date"),o&&(s.style.marginRight=o+"px"),e.appendChild(s))}return function(n,i,r){var a=(r=i.$getConfig()).type_renderers[t.getTaskType(n.type)],o=e;return a?a.call(t,n,function(e){return o.call(t,e,i,r)},i):o.call(t,n,i,r)}}},function(t,e,n){var i=n(26),r=n(4),a=n(0),o=n(2),s=n(36),l=n(106),c=function(t,e,n,o){this.$config=a.mixin({},e||{}),this.$scaleHelper=new i(o),this.$gantt=o,this._posFromDateCache={},this._timelineDragScroll=null,a.mixin(this,s(this)),r(this)};c.prototype={init:function(t){t.innerHTML+="
",this.$task=t.childNodes[0],this.$task.innerHTML="
",this.$task_scale=this.$task.childNodes[0],this.$task_data=this.$task.childNodes[1],this.$task_data.innerHTML="
",this.$task_bg=this.$task_data.childNodes[0],this.$task_links=this.$task_data.childNodes[1],this.$task_bars=this.$task_data.childNodes[2],this._tasks={col_width:0,width:[],full_width:0,trace_x:[],rendered:{}};var e=this.$getConfig(),n=e[this.$config.bind+"_attribute"],i=e[this.$config.bindLinks+"_attribute"];!n&&this.$config.bind&&(n="data-"+this.$config.bind+"-id"),!i&&this.$config.bindLinks&&(i="data-"+this.$config.bindLinks+"-id"),this.$config.item_attribute=n||null,this.$config.link_attribute=i||null;var r=this._createLayerConfig();this.$config.layers||(this.$config.layers=r.tasks),this.$config.linkLayers||(this.$config.linkLayers=r.links),this._attachLayers(this.$gantt),this.callEvent("onReady",[]),this.$gantt.ext.dragTimeline&&(this._timelineDragScroll=this.$gantt.ext.dragTimeline.create(),this._timelineDragScroll.attach(this))},setSize:function(t,e){var n=this.$getConfig();if(1*t===t&&(this.$config.width=t),1*e===e){this.$config.height=e;var i=Math.max(this.$config.height-n.scale_height);this.$task_data.style.height=i+"px"}this.refresh(),this.$task_bg.style.backgroundImage="",n.smart_rendering&&this.$config.rowStore?this.$task_bg.style.height=this.getTotalHeight()+"px":this.$task_bg.style.height="";for(var r=this._tasks,a=this.$task_data.childNodes,o=0,s=a.length;o'+this._prepareScaleHtml(t[a],e,n)+"")}return i.join("")},_prepareScaleHtml:function(t,e,n){var i=this.$getConfig(),r=this.$gantt.templates,a=[],s=null,l=null,c=t.format||t.template||t.date;"string"==typeof c&&(c=this.$gantt.date.date_to_str(c));var d=0,u=t.count;!i.smart_scales||isNaN(e)||isNaN(n)||(d=o.findBinary(t.left,e),u=o.findBinary(t.left,n)+1),l=t.css||function(){},!t.css&&i.inherit_scale_class&&(l=r.scale_cell_class);for(var h=d;h"+f+"";a.push(k)}}return a.join("")},dateFromPos:function(t){var e=this._tasks;if(t<0||t>e.full_width||!e.full_width)return null;var n=o.findBinary(this._tasks.left,t),i=this._tasks.left[n],r=e.width[n]||e.col_width,a=0;r&&(a=(t-i)/r,e.rtl&&(a=1-a));var s=0;return a&&(s=this._getColumnDuration(e,e.trace_x[n])),new Date(e.trace_x[n].valueOf()+Math.round(a*s))},posFromDate:function(t){if(!this.isVisible())return 0;if(!t)return 0;var e=String(t.valueOf());if(void 0!==this._posFromDateCache[e])return this._posFromDateCache[e];var n=this.columnIndexByDate(t);this.$gantt.assert(n>=0,"Invalid day index");var i=Math.floor(n),r=n%1,a=this._tasks.left[Math.min(i,this._tasks.width.length-1)];i==this._tasks.width.length&&(a+=this._tasks.width[this._tasks.width.length-1]),r&&(i=r.max_date)return this._tasks.rtl?0:n.length;var a=o.findBinary(n,e),s=this._getClosestVisibleColumn(a,n,i),l=n[s],c=this._tasks.trace_index_transition;if(!l)return c?c[0]:0;var d=(t-n[s])/this._getColumnDuration(this._tasks,n[s]);return c?c[s]+(1-d):s+d},getItemPosition:function(t,e,n){var i,r,a;return this._tasks.rtl?(r=this.posFromDate(e||t.start_date),i=this.posFromDate(n||t.end_date)):(i=this.posFromDate(e||t.start_date),r=this.posFromDate(n||t.end_date)),a=Math.max(r-i,0),{left:i,top:this.getItemTop(t.id),height:this.getBarHeight(t.id),width:a,rowHeight:this.getItemHeight(t.id)}},getBarHeight:function(t,e){var n=this.$getConfig(),i=this.$config.rowStore.getItem(t),r=i.task_height||i.bar_height||n.bar_height||n.task_height,a=this.getItemHeight(t);"full"==r&&(r=a-(n.task_height_offset||5));return r=Math.min(r,a),e&&(r=Math.round(r/Math.sqrt(2))),Math.max(r,0)},getScale:function(){return this._tasks},_getScales:function(){var t=this.$getConfig(),e=this.$scaleHelper,n=[e.primaryScale(t)].concat(e.getSubScales(t));return e.sortScales(n),n},_getColumnDuration:function(t,e){return this.$gantt.date.add(e,t.step,t.unit)-e},_bindStore:function(){if(this.$config.bind){var t=this.$gantt.getDatastore(this.$config.bind);if(this.$config.rowStore=t,t&&!t._timelineCacheAttached){var e=this;t._timelineCacheAttached=t.attachEvent("onBeforeFilter",function(){e._resetTopPositionHeight()})}}},_unbindStore:function(){if(this.$config.bind){var t=this.$gantt.getDatastore(this.$config.bind);t&&t._timelineCacheAttached&&(t.detachEvent(t._timelineCacheAttached),t._timelineCacheAttached=!1)}},refresh:function(){this._bindStore(),this.$config.bindLinks&&(this.$config.linkStore=this.$gantt.getDatastore(this.$config.bindLinks)),this._resetTopPositionHeight(),this._resetHeight(),this._initStaticBackgroundRender(),this._render_tasks_scales()},destructor:function(){var t=this.$gantt;this._clearLayers(t),this._unbindStore(),this.$task=null,this.$task_scale=null,this.$task_data=null,this.$task_bg=null,this.$task_links=null,this.$task_bars=null,this.$gantt=null,this.$config.rowStore&&(this.$config.rowStore.detachEvent(this._staticBgHandler),this.$config.rowStore=null),this.$config.linkStore&&(this.$config.linkStore=null),this._timelineDragScroll&&(this._timelineDragScroll.destructor(),this._timelineDragScroll=null),this.callEvent("onDestroy",[]),this.detachAllEvents()}},t.exports=c},function(t,e){t.exports=function(t,e,n){return{top:e.getItemTop(t.id),height:e.getItemHeight(t.id),left:0,right:1/0}}},function(t,e){t.exports=function(t){var e=[];return{delegate:function(n,i,r,a){e.push([n,i,r,a]),t.$services.getService("mouseEvents").delegate(n,i,r,a)},destructor:function(){for(var n=t.$services.getService("mouseEvents"),i=0;i",this.$grid=t.childNodes[0],this.$grid.innerHTML="
",this.$grid_scale=this.$grid.childNodes[0],this.$grid_data=this.$grid.childNodes[1];var d=a[this.$config.bind+"_attribute"];if(!d&&this.$config.bind&&(d="data-"+this.$config.bind+"-id"),this.$config.item_attribute=d||null,!this.$config.layers){var u=this._createLayerConfig();this.$config.layers=u}var h=o(e,this);h.init(),this._renderHeaderResizers=h.doOnRender,this._mouseDelegates=n(24)(e),l(e,this).init(),this._addLayers(this.$gantt),this._initEvents(),s&&(this._columnDND=new c(e,this),this._columnDND.init()),this.callEvent("onReady",[])},_validateColumnWidth:function(t,e){var n=t[e];if(n&&"*"!=n){var i=this.$gantt,r=1*n;isNaN(r)?i.assert(!1,"Wrong "+e+" value of column "+t.name):t[e]=r}},setSize:function(t,e){this.$config.width=this.$state.width=t,this.$config.height=this.$state.height=e;for(var n,i=this.getGridColumns(),r=0,a=(u=this.$getConfig()).grid_elastic_columns,o=0,s=i.length;od.max_width&&(u=d.max_width-d.width),r-=d.width,d.width+=u,l-=u}for(var h=l>0?1:-1;l>0&&1===h||l<0&&-1===h;){var f=l;for(o=e+1;o-1&&((_=i[e].width+l)==this._getColumnWidth(i[e],n,_)&&(i[e].width=_));return this._getColsTotalWidth()},_getColsTotalWidth:function(){for(var t=this.getGridColumns(),e=0,n=0;no+h&&(u.width=h=f-o),o+=h;var _=t._sort&&u.name==t._sort.name?"
":"",g=["gantt_grid_head_cell","gantt_grid_head_"+u.name,d?"gantt_last_cell":"",i.grid_header_class(u.name,u)].join(" "),p="width:"+(h-(d?1:0))+"px;",v=u.label||s["column_"+u.name]||s[u.name];v=v||"";var m="
"+v+_+"
";a.push(m)}this.$grid_scale.style.height=e.scale_height+"px",this.$grid_scale.style.lineHeight=l+"px",this.$grid_scale.innerHTML=a.join(""),this._renderHeaderResizers&&this._renderHeaderResizers()},_getGridWidth:function(){return this.$config.width},destructor:function(){this._clearLayers(this.$gantt),this._mouseDelegates&&(this._mouseDelegates.destructor(),this._mouseDelegates=null),this._unbindStore(),this.$grid=null,this.$grid_scale=null,this.$grid_data=null,this.$gantt=null,this.$config.rowStore&&(this.$config.rowStore.detachEvent(this._staticBgHandler),this.$config.rowStore=null),this.callEvent("onDestroy",[]),this.detachAllEvents()}},t.exports=d},function(t,e,n){var i=n(0);t.exports=function(t){var e=t.date,n=t.$services;return{getSum:function(t,e,n){void 0===n&&(n=t.length-1),void 0===e&&(e=0);for(var i=0,r=e;r<=n;r++)i+=t[r];return i},setSumWidth:function(t,e,n,i){var r=e.width;void 0===i&&(i=r.length-1),void 0===n&&(n=0);var a=i-n+1;if(!(n>r.length-1||a<=0||i>r.length-1)){var o=t-this.getSum(r,n,i);this.adjustSize(o,r,n,i),this.adjustSize(-o,r,i+1),e.full_width=this.getSum(r)}},splitSize:function(t,e){for(var n=[],i=0;in(e.unit,e.step)?-1:0});for(var i=0;i=0;d--){var u=d==t.length-1,h=this.initScaleConfig(t[d],r,a);u&&this.processIgnores(h),this.initColSizes(h,e,l,s[d]),this.limitVisibleRange(h),u&&(l=h.full_width),c.unshift(h)}for(d=0;d=+l&&(l=e.add(c,i,n));+c<+l;){o.call(this,new Date(c));var d=c.getTimezoneOffset();c=e.add(c,i,n),c=t._correct_dst_change(c,d,i,n),e[n+"_start"]&&(c=e[n+"_start"](c))}},limitVisibleRange:function(t){var n=t.trace_x,i=t.width.length-1,r=0;if(+n[0]<+t.min_date&&0!=i){var a=Math.floor(t.width[0]*((n[1]-t.min_date)/(n[1]-n[0])));r+=t.width[0]-a,t.width[0]=a,n[0]=new Date(t.min_date)}var o=n.length-1,s=n[o],l=e.add(s,t.step,t.unit);if(+l>+t.max_date&&o>0&&(a=t.width[o]-Math.floor(t.width[o]*((l-t.max_date)/(l-s))),r+=t.width[o]-a,t.width[o]=a),r){for(var c=this.getSum(t.width),d=0,u=0;u"}};function a(t,e,n){return e=e||[],"<"+t+o(n||[])+">"+(e.innerHTML||"")+""}function o(t){var e="";return i.forEach(t,function(t){e+=" "+t.key+"='"+t.value+"'"}),e}t.exports=r},function(t,e,n){var i=n(2);t.exports=function(t){var e={};return t.$data.tasksStore.attachEvent("onStoreUpdated",function(){e={}}),function(n,r,a,o){var s=n.id+"_"+r+"_"+a.unit+"_"+a.step;return e[s]?e[s]:e[s]=function(e,n,r,a){var o,s=!1,l={};t.config.process_resource_assignments&&n===t.config.resource_property?(o="task"==e.$role?t.getResourceAssignments(e.$resource_id,e.$task_id):t.getResourceAssignments(e.id),s=!0):o="task"==e.$role?[]:t.getTaskBy(n,e.id);for(var c,d,u,h,f,l=function(e,n,r){for(var a=n.unit,o=n.step,s={},l={},c=0;c0?t[o].$parent.getNextSibling(t[o].$id):t[o].$parent.getPrevSibling(t[o].$id);"resizer"==l.$name&&(l=i>0?l.$parent.getNextSibling(l.$id):l.$parent.getPrevSibling(l.$id));var c=l.getSize();if(a)t[o].$config.gravity=r;else if(l[n]){var d=s.gravity+c.gravity,u=s[n]+c[n],h=d/u;t[o].$config.gravity=h*r,l.$config[n]=u-r,l.$config.gravity=d-h*r}else t[o].$config[n]=r;var f=this.$gantt.$ui.getView("grid");!f||t[o].$content!==f||f.$config.scrollable||a||(this.$gantt.config.grid_width=r)}},e.prototype.resize=function(e){var n=!1;if(this.$root&&!this._resizeInProgress&&(this.callEvent("onBeforeResize",[]),n=!0,this._resizeInProgress=!0),t.prototype.resize.call(this,!0),t.prototype.resize.call(this,!1),n){var i=[];i=(i=(i=i.concat(this.getCellsByType("viewCell"))).concat(this.getCellsByType("viewLayout"))).concat(this.getCellsByType("hostCell"));for(var r=this.getCellsByType("scroller"),a=0;a=0&&this.$cells[e+1]?this.$cells[e+1]:null},e.prototype.getPrevSibling=function(t){var e=this.cellIndex(t);return e>=0&&this.$cells[e-1]?this.$cells[e-1]:null},e.prototype.cell=function(t){for(var e=0;e=n.childNodes.length?n.appendChild(t.$view):n.insertBefore(t.$view,n.childNodes[e])},e.prototype._parseConfig=function(t){this.$cells=[],this._xLayout=!t.rows;for(var e=t.rows||t.cols||t.views,n=0;n=0;i--){var a=this.$cells[i];a.$fill(n[i],this),a.$config.hidden&&a.$view.parentNode.removeChild(a.$view)}},e.prototype.$toHTML=function(){for(var e=this._xLayout?"x":"y",n=[],i=0;i=1e5&&(c.maxWidth=i),c.maxHeight>=1e5&&(c.maxHeight=a),c.minWidth=c.minWidth!=c.minWidth?0:c.minWidth,c.minHeight=c.minHeight!=c.minHeight?0:c.minHeight,this._xLayout?(c.minWidth+=this.$config.margin*this.$cells.length||0,c.minWidth+=2*this.$config.padding||0,c.minHeight+=2*this.$config.padding||0):(c.minHeight+=this.$config.margin*this.$cells.length||0,c.minHeight+=2*this.$config.padding||0),c},e.prototype._calcFreeSpace=function(t,e,n){var i=n?e.minWidth:e.minHeight,r=e.maxWidth,a=t;return a?(a>r&&(a=r),ar&&(a=r,this._free-=a,this._gravity-=e.gravity),aa&&(i=a),i=0;i--)if(!e[i].$config.hidden){n=i;break}for(i=0;i=n,a="";!r&&e[i+1]&&"scrollbar"==e[i+1].$config.view&&(this._xLayout?r=!0:a="gantt_layout_cell_border_transparent"),this._setBorders(r?[]:[t,a],e[i])}},e.prototype._updateCellVisibility=function(){for(var t=this._visibleCells||{},e=!this._visibleCells,n={},i=null,r=[],a=0;as+l&&e.y>c+d)return!1;if(e.y_endh){var g=h;h=u,u=g}if(f>_){g=_;_=f,f=g}return u+=-100,h+=100,f+=-100,_+=100,!(e.x>h&&e.x>_)&&!(e.x_endc.x&&f.topc.y&&d.push(h.id)}return{ids:d}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(174),r=n(173),a=n(172);e.LargerUnitsCache=a.LargerUnitsCache,e.createCacheObject=function(){return"undefined"!=typeof Map?new i.WorkUnitsMapCache:new r.WorkUnitsObjectCache}},function(t,e,n){var i=n(0),r=n(2);function a(t,e,n,i,r){return this.date=t,this.unit=e,this.task=n,this.id=i,this.calendar=r,this}function o(t,e,n,i,r,a){return this.date=t,this.dir=e,this.unit=n,this.task=i,this.id=r,this.calendar=a,this}function s(t,e,n,i,r,a,o){return this.start_date=t,this.duration=e,this.unit=n,this.step=i,this.task=r,this.id=a,this.calendar=o,this}function l(t,e,n,i){return this.start_date=t,this.end_date=e,this.task=n,this.calendar=i,this.unit=null,this.step=null,this}t.exports=function(t){return{getWorkHoursArguments:function(){var e=arguments[0];if(e=r.isDate(e)?{date:e}:i.mixin({},e),!r.isValidDate(e.date))throw t.assert(!1,"Invalid date argument for getWorkHours method"),new Error("Invalid date argument for getWorkHours method");return e},setWorkTimeArguments:function(){return arguments[0]},unsetWorkTimeArguments:function(){return arguments[0]},isWorkTimeArguments:function(){var e,n=arguments[0];if(n instanceof a)return n;if((e=n.date?new a(n.date,n.unit,n.task,null,n.calendar):new a(arguments[0],arguments[1],arguments[2],null,arguments[3])).unit=e.unit||t.config.duration_unit,!r.isValidDate(e.date))throw t.assert(!1,"Invalid date argument for isWorkTime method"),new Error("Invalid date argument for isWorkTime method");return e},getClosestWorkTimeArguments:function(e){var n,i=arguments[0];if(i instanceof o)return i;if(n=r.isDate(i)?new o(i):new o(i.date,i.dir,i.unit,i.task,null,i.calendar),i.id&&(n.task=i),n.dir=i.dir||"any",n.unit=i.unit||t.config.duration_unit,!r.isValidDate(n.date))throw t.assert(!1,"Invalid date argument for getClosestWorkTime method"),new Error("Invalid date argument for getClosestWorkTime method");return n},_getStartEndConfig:function(e){var n,i=l;if(e instanceof i)return e;if(r.isDate(e)?n=new i(arguments[0],arguments[1],arguments[2],arguments[3]):(n=new i(e.start_date,e.end_date,e.task),null!==e.id&&void 0!==e.id&&(n.task=e)),n.unit=n.unit||t.config.duration_unit,n.step=n.step||t.config.duration_step,n.start_date=n.start_date||n.start||n.date,!r.isValidDate(n.start_date))throw t.assert(!1,"Invalid start_date argument for getDuration method"),new Error("Invalid start_date argument for getDuration method");if(!r.isValidDate(n.end_date))throw t.assert(!1,"Invalid end_date argument for getDuration method"),new Error("Invalid end_date argument for getDuration method");return n},getDurationArguments:function(t,e,n,i){return this._getStartEndConfig.apply(this,arguments)},hasDurationArguments:function(t,e,n,i){return this._getStartEndConfig.apply(this,arguments)},calculateEndDateArguments:function(e,n,i,a){var o,l=arguments[0];if(l instanceof s)return l;if(o=r.isDate(l)?new s(arguments[0],arguments[1],arguments[2],void 0,arguments[3],void 0,arguments[4]):new s(l.start_date,l.duration,l.unit,l.step,l.task,null,l.calendar),null!==l.id&&void 0!==l.id&&(o.task=l,o.unit=null,o.step=null),o.unit=o.unit||t.config.duration_unit,o.step=o.step||t.config.duration_step,!r.isValidDate(o.start_date))throw t.assert(!1,"Invalid start_date argument for calculateEndDate method"),new Error("Invalid start_date argument for calculateEndDate method");return o}}}},function(t,e,n){var i=n(186);t.exports=function(t){var e={},n={},r=null,a=-1,o=null,s=i(t);return{_resetTopPositionHeight:function(){e={},n={},s.resetCache()},_resetHeight:function(){var t=this.$config.rowStore,e=this.getCacheStateTotalHeight(t);o?this.shouldClearHeightCache(o,e)&&(o=e,r=null):o=e,a=-1,s.resetCache()},getRowTop:function(t){if(s.canUseSimpleCalculation())return s.getRowTop(t);var e=this.$config.rowStore;if(!e)return 0;if(void 0!==n[t])return n[t];for(var i=e.getIndexRange(),r=0,a=0,o=0;o=i&&t=n.$level)return!1;for(;n&&this.exists(i);){if((n=this.getItem(i))&&n.id==e)return!0;i=this.getParent(n)}return!1},getSiblings:function(t){if(!this.exists(t))return i.$create();var e=this.getParent(t);return this.getChildren(e)},getNextSibling:function(t){for(var e=this.getSiblings(t),n=0,i=e.length;n0&&(r="0"),r||null}return null},getPrevSibling:function(t){for(var e=this.getSiblings(t),n=0,i=e.length;n0&&(r="0"),r||null}return null},getParent:function(t){var e=null;return(e=void 0!==t.id?t:this.getItem(t))?e[this.$parentProperty]:this.$getRootId()},clearAll:function(){this._branches={},o.prototype.clearAll.call(this)},calculateItemLevel:function(t){var e=0;return this.eachParent(function(){e++},t),e},_setParentInner:function(t,e,n){n||(t.hasOwnProperty("$rendered_parent")?this._move_branch(t,t.$rendered_parent,e):this._move_branch(t,t[this.$parentProperty],e))},setParent:function(t,e,n){this._setParentInner(t,e,n),t[this.$parentProperty]=e},_eachItemCached:function(t,e){for(var n=0,i=e.length;n=0;s--)i.push(o[s])}},eachItem:function(t,e){var n=this.$getRootId();r.defined(e)||(e=n);var i=l(e,n)||n,a=!1,o=!1,s=null;i===n&&(this._eachItemMainRangeCache?(a=!0,s=this._eachItemMainRangeCache):(o=!0,s=this._eachItemMainRangeCache=[])),a?this._eachItemCached(t,s):this._eachItemIterate(t,i,o?s:null)},eachParent:function(t,e){for(var n={},i=e,r=this.getParent(i);this.exists(r);){if(n[r])throw new Error("Invalid tasks tree. Cyclic reference has been detected on task "+r);n[r]=!0,i=this.getItem(r),t.call(this,i),r=this.getParent(i)}},_add_branch:function(t,e,n){var r=void 0===n?this.getParent(t):n;this.hasChild(r)||(this._branches[r]=i.$create());for(var a=this.getChildren(r),o=!1,s=0,l=a.length;sn[t]?1:-1}:t;if(e){var r=i;i=function(t,e){return r(e,t)}}var o=this.getChildren(n);if(o){for(var s=[],l=o.length-1;l>=0;l--)s[l]=this.getItem(o[l]);s.sort(i);for(l=0;l=0&&this.splice(t,e||1)},$remove:function(t){this.$removeAt(this.$find(t))},$insertAt:function(t,e){if(e||0===e){var n=this.splice(e,this.length-e);this[e]=t,this.push.apply(this,n)}else this.push(t)},$find:function(t){for(var e=0;ei&&(e=Math.min(n.length,e))}this.pull[t.id]=t,this.isSilent()||this._updateOrder(function(){-1===this.$find(t.id)&&this.$insertAt(t.id,e)}),this.filter()},isVisible:function(t){return this.visibleOrder.$find(t)>-1},getVisibleItems:function(){return this.getIndexRange()},addItem:function(t,e){return r.defined(t.id)||(t.id=r.uid()),this.$initItem&&(t=this.$initItem(t)),!(!this.isSilent()&&!1===this.callEvent("onBeforeAdd",[t.id,t]))&&(this._addItemInner(t,e),this.isSilent()||(this.callEvent("onAfterAdd",[t.id,t]),this.callEvent("onStoreUpdated",[t.id,t,"add"])),t.id)},_changeIdInner:function(t,e){this.pull[t]&&(this.pull[e]=this.pull[t]);var n=this._searchVisibleOrder[t];this.pull[e].id=e,this._updateOrder(function(){this[this.$find(t)]=e}),this._searchVisibleOrder[e]=n,delete this._searchVisibleOrder[t],delete this.pull[t]},changeId:function(t,e){this._changeIdInner(t,e),this.callEvent("onIdChange",[t,e])},exists:function(t){return!!this.pull[t]},_moveInner:function(t,e){var n=this.getIdByIndex(t);this._updateOrder(function(){this.$removeAt(t),this.$insertAt(n,Math.min(this.length,e))})},move:function(t,e){var n=this.getIdByIndex(t),i=this.getItem(n);this._moveInner(t,e),this.isSilent()||this.callEvent("onStoreUpdated",[i.id,i,"move"])},clearAll:function(){this.$destroyed||(this.silent(function(){this.unselect()}),this.pull={},this.visibleOrder=i.$create(),this.fullOrder=i.$create(),this.isSilent()||(this.callEvent("onClearAll",[]),this.refresh()))},silent:function(t,e){var n=!1;this.isSilent()&&(n=!0),this._skip_refresh=!0,t.call(e||this),n||(this._skip_refresh=!1)},isSilent:function(){return!!this._skip_refresh},arraysEqual:function(t,e){if(t.length!==e.length)return!1;for(var n=0;n1)for(var n=1;n","gm"),n=new RegExp(" +","gm");function i(t){return(t+"").replace(e," ").replace(n," ")}var r=new RegExp("'","gm");function a(t){return(t+"").replace(r,"'")}for(var o in t._waiAria={getAttributeString:function(t){var e=[" "];for(var n in t){var r=a(i(t[n]));e.push(n+"='"+r+"'")}return e.push(" "),e.join(" ")},getTimelineCellAttr:function(e){return t._waiAria.getAttributeString({"aria-label":e})},_taskCommonAttr:function(e,n){e.start_date&&e.end_date&&(n.setAttribute("aria-label",i(t.templates.tooltip_text(e.start_date,e.end_date,e))),e.$dataprocessor_class&&n.setAttribute("aria-busy",!0),n.setAttribute("aria-selected",t.isSelectedTask(e.id)?"true":"false"))},setTaskBarAttr:function(e,n){this._taskCommonAttr(e,n),!t.isReadonly(e)&&t.config.drag_move&&(e.id!=t.getState("tasksDnd").drag_id?n.setAttribute("aria-grabbed",!1):n.setAttribute("aria-grabbed",!0))},taskRowAttr:function(e,n){this._taskCommonAttr(e,n),!t.isReadonly(e)&&t.config.order_branch&&n.setAttribute("aria-grabbed",!1),n.setAttribute("role","row"),n.setAttribute("aria-level",e.$level),t.hasChild(e.id)&&n.setAttribute("aria-expanded",e.$open?"true":"false")},linkAttr:function(e,n){var r=t.config.links,a=e.type==r.finish_to_start||e.type==r.start_to_start,o=e.type==r.start_to_start||e.type==r.start_to_finish,s=t.locale.labels.link+" "+t.templates.drag_link(e.source,o,e.target,a);n.setAttribute("aria-label",i(s)),t.isReadonly(e)&&n.setAttribute("aria-readonly",!0)},gridSeparatorAttr:function(t){t.setAttribute("role","separator")},lightboxHiddenAttr:function(t){t.setAttribute("aria-hidden","true")},lightboxVisibleAttr:function(t){t.setAttribute("aria-hidden","false")},lightboxAttr:function(t){t.setAttribute("role","dialog"),t.setAttribute("aria-hidden","true"),t.firstChild.setAttribute("role","heading")},lightboxButtonAttrString:function(e){return this.getAttributeString({role:"button","aria-label":t.locale.labels[e],tabindex:"0"})},lightboxHeader:function(t,e){t.setAttribute("aria-label",e)},lightboxSelectAttrString:function(e){var n="";switch(e){case"%Y":n=t.locale.labels.years;break;case"%m":n=t.locale.labels.months;break;case"%d":n=t.locale.labels.days;break;case"%H:%i":n=t.locale.labels.hours+t.locale.labels.minutes}return t._waiAria.getAttributeString({"aria-label":n})},lightboxDurationInputAttrString:function(e){return this.getAttributeString({"aria-label":t.locale.labels.column_duration,"aria-valuemin":"0"})},gridAttrString:function(){return[" role='treegrid'",t.config.multiselect?"aria-multiselectable='true'":"aria-multiselectable='false'"," "].join(" ")},gridScaleRowAttrString:function(){return"role='row'"},gridScaleCellAttrString:function(e,n){var i="";if("add"==e.name)i=this.getAttributeString({role:"button","aria-label":t.locale.labels.new_task});else{var r={role:"columnheader","aria-label":n};t._sort&&t._sort.name==e.name&&("asc"==t._sort.direction?r["aria-sort"]="ascending":r["aria-sort"]="descending"),i=this.getAttributeString(r)}return i},gridDataAttrString:function(){return"role='rowgroup'"},gridCellAttrString:function(e,n,i){var r={role:"gridcell","aria-label":n};return e.editor&&!t.isReadonly(i)||(r["aria-readonly"]=!0),this.getAttributeString(r)},gridAddButtonAttrString:function(e){return this.getAttributeString({role:"button","aria-label":t.locale.labels.new_task})},messageButtonAttrString:function(t){return"tabindex='0' role='button' aria-label='"+t+"'"},messageInfoAttr:function(t){t.setAttribute("role","alert")},messageModalAttr:function(t,e){t.setAttribute("role","dialog"),e&&t.setAttribute("aria-labelledby",e)},quickInfoAttr:function(t){t.setAttribute("role","dialog")},quickInfoHeaderAttrString:function(){return" role='heading' "},quickInfoHeader:function(t,e){t.setAttribute("aria-label",e)},quickInfoButtonAttrString:function(e){return t._waiAria.getAttributeString({role:"button","aria-label":e,tabindex:"0"})},tooltipAttr:function(t){t.setAttribute("role","tooltip")},tooltipVisibleAttr:function(t){t.setAttribute("aria-hidden","false")},tooltipHiddenAttr:function(t){t.setAttribute("aria-hidden","true")}},t._waiAria)t._waiAria[o]=function(e){return function(){return t.config.wai_aria_attributes?e.apply(this,arguments):""}}(t._waiAria[o])}},function(t,e){t.exports=function(t){t._extend_to_optional=function(e){var n=e,i={render:n.render,focus:n.focus,set_value:function(e,r,a,o){var s=t._resolve_default_mapping(o);if(!a[s.start_date]||"start_date"==s.start_date&&this._isAllowedUnscheduledTask(a)){i.disable(e,o);var l={};for(var c in s)l[s[c]]=a[c];return n.set_value.call(t,e,r,l,o)}return i.enable(e,o),n.set_value.call(t,e,r,a,o)},get_value:function(e,i,r){return r.disabled?{start_date:null}:n.get_value.call(t,e,i,r)},update_block:function(e,n){if(t.callEvent("onSectionToggle",[t._lightbox_id,n]),e.style.display=n.disabled?"none":"block",n.button){var i=e.previousSibling.querySelector(".gantt_custom_button_label"),r=t.locale.labels,a=n.disabled?r[n.name+"_enable_button"]:r[n.name+"_disable_button"];i.innerHTML=a}t.resizeLightbox()},disable:function(t,e){e.disabled=!0,i.update_block(t,e)},enable:function(t,e){e.disabled=!1,i.update_block(t,e)},button_click:function(e,n,r,a){if(!1!==t.callEvent("onSectionButton",[t._lightbox_id,r])){var o=t._get_typed_lightbox_config()[e];o.disabled?i.enable(a,o):i.disable(a,o)}}};return i},t.form_blocks.duration_optional=t._extend_to_optional(t.form_blocks.duration),t.form_blocks.time_optional=t._extend_to_optional(t.form_blocks.time)}},function(t,e,n){var i=n(3);t.exports=function(t){var e=n(12)(t);function r(){return e.apply(this,arguments)||this}return i(r,e),r.prototype.render=function(n){var i=t.config.types,r=t.locale.labels,a=[],o=n.filter||function(t,e){return!i.placeholder||e!==i.placeholder};for(var s in i)!1==!o(s,i[s])&&a.push({key:i[s],label:r["type_"+s]});n.options=a;var l=n.onchange;return n.onchange=function(){t.changeLightboxType(this.value),this.value===t.config.types.task&&(t._lightbox_new_type="task"),"function"==typeof l&&l.apply(this,arguments)},e.prototype.render.apply(this,arguments)},r}},function(t,e,n){var i=n(3),r=n(29);t.exports=function(t){var e=n(6)(t);function a(){return e.apply(this,arguments)||this}function o(e){return!e||e===t.config.constraint_types.ASAP||e===t.config.constraint_types.ALAP}function s(t,e){for(var n=o(e),i=0;i",a=[];for(var o in t.config.constraint_types)a.push({key:t.config.constraint_types[o],label:t.locale.labels[t.config.constraint_types[o]]});return e.options=e.options||a,i+=""+r.getHtmlSelect(e.options,[{key:"data-type",value:"constraint-type"}])+"",i+="",i+=""},a.prototype.set_value=function(e,n,i,r){var a=e.querySelector("[data-constraint-type-select] select"),o=e.querySelectorAll("[data-constraint-time-select] select"),l=r._time_format_order,c=t._resolve_default_mapping(r);a._eventsInitialized||(a.addEventListener("change",function(t){s(o,t.target.value)}),a._eventsInitialized=!0);var d=i[c.constraint_date]||new Date;t.form_blocks._fill_lightbox_select(o,0,d,l,r);var u=i[c.constraint_type]||t.getConstraintType(i);a.value=u,s(o,u)},a.prototype.get_value=function(e,n,i){var r=e.querySelector("[data-constraint-type-select] select"),a=e.querySelectorAll("[data-constraint-time-select] select"),s=r.value,l=null;return o(s)||(l=t.form_blocks.getTimePickerValue(a,i)),{constraint_type:s,constraint_date:l}},a.prototype.focus=function(e){t._focus(e.querySelector("select"))},a}},function(t,e,n){var i=n(3);t.exports=function(t){var e=n(12)(t);function r(){return e.apply(this,arguments)||this}function a(e,n){var i=[],r=[];n&&(i=t.getTaskByTime(),e.allow_root&&i.unshift({id:t.config.root_id,text:e.root_label||""}),i=function(e,n,i){var r=n.filter||function(){return!0};e=e.slice(0);for(var a=0;a",i=" "+t.locale.labels[t.config.duration_unit+"s"]+" ",r=e.single_date?" style='display:none'":"",a=e.readonly?" disabled='disabled'":"",o=t._waiAria.lightboxDurationInputAttrString(e),s="gantt_duration_value";e.formatter&&(i="",s+=" gantt_duration_value_formatted");var l="
"+i+"
";return"
"+n+" "+l+"
"},a.prototype.set_value=function(e,n,i,r){var a,c,d,u,h=e.getElementsByTagName("select"),f=e.getElementsByTagName("input"),_=f[1],g=[f[0],f[2]],p=e.getElementsByTagName("span")[0],v=r._time_format_order;function m(){var n=s.call(t,e,r),a=l.call(t,e,r),o=t.calculateEndDate({start_date:n,duration:a,task:i}),c=t.templates.task_end_date||t.templates.task_date;p.innerHTML=c(o)}function y(t){var e=_.value;e=o(r).parse(e),window.isNaN(e)&&(e=0),(e+=t)<1&&(e=1),_.value=o(r).format(e),m()}g[0].onclick=t.bind(function(){y(-1*t.config.duration_step)},this),g[1].onclick=t.bind(function(){y(1*t.config.duration_step)},this),h[0].onchange=m,h[1].onchange=m,h[2].onchange=m,h[3]&&(h[3].onchange=m),_.onkeydown=t.bind(function(e){var n;return(n=(e=e||window.event).charCode||e.keyCode||e.which)==t.constants.KEY_CODES.DOWN?(y(-1*t.config.duration_step),!1):n==t.constants.KEY_CODES.UP?(y(1*t.config.duration_step),!1):void window.setTimeout(m,1)},this),_.onchange=t.bind(m,this),"string"==typeof(a=t._resolve_default_mapping(r))&&(a={start_date:a}),c=i[a.start_date]||new Date,d=i[a.end_date]||t.calculateEndDate({start_date:c,duration:1,task:i}),u=Math.round(i[a.duration])||t.calculateDuration({start_date:c,end_date:d,task:i}),u=o(r).format(u),t.form_blocks._fill_lightbox_select(h,0,c,v,r),_.value=u,m()},a.prototype.get_value=function(e,n,i){var r=s(e,i),a=l(e,i),o=t.calculateEndDate({start_date:r,duration:a,task:n});return"string"==typeof t._resolve_default_mapping(i)?r:{start_date:r,end_date:o,duration:a}},a.prototype.focus=function(e){t._focus(e.getElementsByTagName("select")[0])},a}},function(t,e,n){var i=n(3);t.exports=function(t){var e=n(6)(t);function r(){return e.apply(this,arguments)||this}return i(r,e),r.prototype.render=function(t){var e="
";if(t.options&&t.options.length)for(var n=0;n"+t.options[n].label+"";return e+="
"},r.prototype.set_value=function(t,e,n,i){var r;i.options&&i.options.length&&(r=t.querySelector("input[type=radio][value='"+e+"']")||t.querySelector("input[type=radio][value='"+i.default_value+"']"))&&(!t._dhx_onchange&&i.onchange&&(t.onchange=i.onchange,t._dhx_onchange=!0),r.checked=!0)},r.prototype.get_value=function(t,e){var n=t.querySelector("input[type=radio]:checked");return n?n.value:""},r.prototype.focus=function(e){t._focus(e.querySelector("input[type=radio]"))},r}},function(t,e,n){var i=n(2),r=n(3);t.exports=function(t){var e=n(6)(t);function a(){return e.apply(this,arguments)||this}return r(a,e),a.prototype.render=function(t){var e="
";if(t.options&&t.options.length)for(var n=0;n"+t.options[n].label+"";else t.single_value=!0,e+="";return e+="
"},a.prototype.set_value=function(t,e,n,r){var a=Array.prototype.slice.call(t.querySelectorAll("input[type=checkbox]"));(!t._dhx_onchange&&r.onchange&&(t.onchange=r.onchange,t._dhx_onchange=!0),r.single_value)?a[0].checked=!!e:i.forEach(a,function(t){t.checked=!!e&&e.indexOf(t.value)>=0})},a.prototype.get_value=function(t,e,n){return n.single_value?t.querySelector("input[type=checkbox]").checked:i.arrayMap(Array.prototype.slice.call(t.querySelectorAll("input[type=checkbox]:checked")),function(t){return t.value})},a.prototype.focus=function(e){t._focus(e.querySelector("input[type=checkbox]"))},a}},function(t,e,n){var i=n(3);t.exports=function(t){var e=n(6)(t);function r(){return e.apply(this,arguments)||this}return i(r,e),r.prototype.render=function(e){var n=t.form_blocks.getTimePicker.call(this,e),i="
";return i+=n,e.single_date?(n=t.form_blocks.getTimePicker.call(this,e,!0),i+=""):i+="  –  ",i+=n,i+="
"},r.prototype.set_value=function(e,n,i,r){var a=r,o=e.getElementsByTagName("select"),s=r._time_format_order;if(a.auto_end_date)for(var l=function(){u=new Date(o[s[2]].value,o[s[1]].value,o[s[0]].value,0,0),h=t.calculateEndDate({start_date:u,duration:1,task:i}),t.form_blocks._fill_lightbox_select(o,s.size,h,s,a)},c=0;c<4;c++)o[c].onchange=l;var d=t._resolve_default_mapping(r);"string"==typeof d&&(d={start_date:d});var u=i[d.start_date]||new Date,h=i[d.end_date]||t.calculateEndDate({start_date:u,duration:1,task:i});t.form_blocks._fill_lightbox_select(o,0,u,s,a),t.form_blocks._fill_lightbox_select(o,s.size,h,s,a)},r.prototype.get_value=function(e,n,i){var r,a=e.getElementsByTagName("select"),o=i._time_format_order;return r=t.form_blocks.getTimePickerValue(a,i),"string"==typeof t._resolve_default_mapping(i)?r:{start_date:r,end_date:function(e,n,r){var a=t.form_blocks.getTimePickerValue(e,i,n.size);return a<=r&&(!1!==i.autofix_end||i.single_date)?t.date.add(r,t._get_timepicker_step(),"minute"):a}(a,o,r)}},r.prototype.focus=function(e){t._focus(e.getElementsByTagName("select")[0])},r}},function(t,e,n){var i=n(3);t.exports=function(t){var e=n(6)(t);function r(){return e.apply(this,arguments)||this}return i(r,e),r.prototype.render=function(t){return"
"},r.prototype.set_value=function(e,n){t.form_blocks.textarea._get_input(e).value=n||""},r.prototype.get_value=function(e){return t.form_blocks.textarea._get_input(e).value},r.prototype.focus=function(e){var n=t.form_blocks.textarea._get_input(e);t._focus(n,!0)},r.prototype._get_input=function(t){return t.querySelector("textarea")},r}},function(t,e,n){var i=n(3);t.exports=function(t){var e=n(6)(t);function r(){return e.apply(this,arguments)||this}return i(r,e),r.prototype.render=function(t){return"
"},r.prototype.set_value=function(t,e){t.innerHTML=e||""},r.prototype.get_value=function(t){return t.innerHTML||""},r.prototype.focus=function(){},r}},function(t,e,n){function i(t){"@babel/helpers - typeof";return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t.exports=function(t){var e=n(1),r=n(2),a=n(56)(t),o=n(55)(t),s=n(54)(t),l=n(12)(t),c=n(53)(t),d=n(52)(t),u=n(51)(t),h=n(50)(t),f=n(12)(t),_=n(49)(t),g=n(48)(t);function p(e,n){var i,r,a="";for(r=0;r
"+t.locale.labels[i]+"
";return a}function v(e,n,i){var r,a,o,s,l,c,d="";switch(i.timeFormat[n]){case"%Y":for(e._time_format_order[2]=n,e._time_format_order.size++,e.year_range&&(isNaN(e.year_range)?e.year_range.push&&(o=e.year_range[0],s=e.year_range[1]):r=e.year_range),r=r||10,a=a||Math.floor(r/2),o=o||i.date.getFullYear()-a,s=s||t.getState().max_date.getFullYear()+a,l=o;l"+l+"";break;case"%m":for(e._time_format_order[1]=n,e._time_format_order.size++,l=0;l<12;l++)d+="";break;case"%d":for(e._time_format_order[0]=n,e._time_format_order.size++,l=1;l<32;l++)d+="";break;case"%H:%i":for(e._time_format_order[3]=n,e._time_format_order.size++,l=i.first,c=i.date.getDate(),e._time_values=[];l"+t.templates.time_picker(i.date)+"",e._time_values.push(l),i.date.setTime(i.date.valueOf()+60*t._get_timepicker_step()*1e3),l=24*(i.date.getDate()!=c?1:0)*60+60*i.date.getHours()+i.date.getMinutes()}return d}t._lightbox_methods={},t._lightbox_template="
 
",t._lightbox_root=t.$root,t.$services.getService("state").registerProvider("lightbox",function(){return{lightbox:t._lightbox_id}}),t.showLightbox=function(t){if(this.callEvent("onBeforeLightbox",[t])){var e=this.getTask(t),n=this.getLightbox(this.getTaskType(e.type));this._center_lightbox(n),this.showCover(),this._fill_lightbox(t,n),this._waiAria.lightboxVisibleAttr(n),this.callEvent("onLightbox",[t])}},t._get_timepicker_step=function(){if(this.config.round_dnd_dates){var e;if(function(t){var e=t.$ui.getView("timeline");return!(!e||!e.isVisible())}(this)){var n=t.getScale();e=r.getSecondsInUnit(n.unit)*n.step/60}return(!e||e>=1440)&&(e=this.config.time_step),e}return this.config.time_step},t.getLabel=function(t,e){for(var n=this._get_typed_lightbox_config(),i=0;i
"+this.locale.labels["button_"+t[n].button]+"
"),this.config.wide_form&&(e+="
"),e+="
"+i.render.call(this,t[n]),e+="
"}}return e},t.resizeLightbox=function(){if(this._lightbox){var t=this._lightbox.querySelector(".gantt_cal_larea");t.style.height="0px",t.style.height=t.scrollHeight+"px",this._lightbox.style.height=t.scrollHeight+this.config.lightbox_additional_height+"px",t.style.height=t.scrollHeight+"px"}},t._center_lightbox=function(e){if(e){e.style.display="block";var n=window.pageYOffset||t._lightbox_root.scrollTop||document.documentElement.scrollTop,i=window.pageXOffset||t._lightbox_root.scrollLeft||document.documentElement.scrollLeft,r=window.innerHeight||document.documentElement.clientHeight;e.style.top=n?Math.round(n+Math.max((r-e.offsetHeight)/2,0))+"px":Math.round(Math.max((r-e.offsetHeight)/2,0)+9)+"px",document.documentElement.scrollWidth>t._lightbox_root.offsetWidth?e.style.left=Math.round(i+(t._lightbox_root.offsetWidth-e.offsetWidth)/2)+"px":e.style.left=Math.round((t._lightbox_root.offsetWidth-e.offsetWidth)/2)+"px"}},t.showCover=function(){this._cover||(this._cover=document.createElement("DIV"),this._cover.className="gantt_cal_cover",(t._lightbox_root||t.$root).appendChild(this._cover))},t.event(window,"deviceorientation",function(){t.getState().lightbox&&t._center_lightbox(t.getLightbox())}),t._init_lightbox_events=function(){t.lightbox_events={},t.lightbox_events.gantt_save_btn=function(){t._save_lightbox()},t.lightbox_events.gantt_delete_btn=function(){t._lightbox_new_type=null,t.callEvent("onLightboxDelete",[t._lightbox_id])&&(t.isTaskExists(t._lightbox_id)?t.$click.buttons.delete(t._lightbox_id):t.hideLightbox())},t.lightbox_events.gantt_cancel_btn=function(){t._cancel_lightbox()},t.lightbox_events.default=function(n,i){if(i.getAttribute("data-dhx-button"))t.callEvent("onLightboxButton",[i.className,i,n]);else{var r,a,o=e.getClassName(i);if(-1!=o.indexOf("gantt_custom_button"))if(-1!=o.indexOf("gantt_custom_button_"))for(r=i.parentNode.getAttribute("data-index"),a=i;a&&-1==e.getClassName(a).indexOf("gantt_cal_lsection");)a=a.parentNode;else r=i.getAttribute("data-index"),a=i.parentNode,i=i.firstChild;var s=t._get_typed_lightbox_config();r&&(r*=1,t.form_blocks[s[1*r].type].button_click(r,i,a,a.nextSibling))}},this.event(t.getLightbox(),"click",function(n){n=n||window.event;var i=e.getTargetNode(n),r=e.getClassName(i);return r||(i=i.previousSibling,r=e.getClassName(i)),i&&r&&0===r.indexOf("gantt_btn_set")&&(i=i.firstChild,r=e.getClassName(i)),!(!i||!r)&&(t.defined(t.lightbox_events[i.className])?t.lightbox_events[i.className]:t.lightbox_events.default)(n,i)}),t.getLightbox().onkeydown=function(n){var i=n||window.event,r=n.target||n.srcElement,a=e.getClassName(r).indexOf("gantt_btn_set")>-1;switch((n||i).keyCode){case t.constants.KEY_CODES.SPACE:if((n||i).shiftKey)return;a&&r.click&&r.click();break;case t.keys.edit_save:if((n||i).shiftKey)return;a&&r.click?r.click():t._save_lightbox();break;case t.keys.edit_cancel:t._cancel_lightbox()}}},t._cancel_lightbox=function(){var e=this.getLightboxValues();this.callEvent("onLightboxCancel",[this._lightbox_id,e.$new]),t.isTaskExists(e.id)&&e.$new&&this.silent(function(){t.$data.tasksStore.removeItem(e.id),t._update_flags(e.id,null)}),this.refreshData(),this.hideLightbox()},t._save_lightbox=function(){var t=this.getLightboxValues();this.callEvent("onLightboxSave",[this._lightbox_id,t,!!t.$new])&&(t.$new?(delete t.$new,this.addTask(t,t.parent,this.getTaskIndex(t.id))):this.isTaskExists(t.id)&&(this.mixin(this.getTask(t.id),t,!0),this.refreshTask(t.id),this.updateTask(t.id)),this.refreshData(),this.hideLightbox())},t._resolve_default_mapping=function(t){var e=t.map_to;return!{time:!0,time_optional:!0,duration:!0,duration_optional:!0}[t.type]?"constraint"===t.type&&(t.map_to&&"string"!=typeof t.map_to||(e={constraint_type:"constraint_type",constraint_date:"constraint_date"})):"auto"==t.map_to?e={start_date:"start_date",end_date:"end_date",duration:"duration"}:"string"==typeof t.map_to&&(e={start_date:t.map_to}),e},t.getLightboxValues=function(){var e={};t.isTaskExists(this._lightbox_id)&&(e=this.mixin({},this.getTask(this._lightbox_id)));for(var n=this._get_typed_lightbox_config(),r=0;r0&&(s+=" "),(a=v(e,i,c))&&(o=t._waiAria.lightboxSelectAttrString(c.timeFormat[i]),s+="");return s},getTimePickerValue:function(e,n,i){var r,a=n._time_format_order,o=t.defined(a[3]),s=0,l=0,c=i||0;return o&&(r=parseInt(e[a[3]+c].value,10),s=Math.floor(r/60),l=r%60),new Date(e[a[2]+c].value,e[a[1]+c].value,e[a[0]+c].value,s,l)},_fill_lightbox_select:function(e,n,i,r){if(e[n+r[0]].value=i.getDate(),e[n+r[1]].value=i.getMonth(),e[n+r[2]].value=i.getFullYear(),t.defined(r[3])){var a=60*i.getHours()+i.getMinutes();a=Math.round(a/t._get_timepicker_step())*t._get_timepicker_step();var o=e[n+r[3]];o.value=a,o.setAttribute("data-value",a)}},template:new a,textarea:new o,select:new l,time:new s,duration:new u,parent:new h,radio:new d,checkbox:new c,resources:new f,constraint:new _,typeselect:new g},t._is_lightbox_timepicker=function(){for(var t=this._get_typed_lightbox_config(),e=0;e1),this.config.touch){var t=!0;try{document.createEvent("TouchEvent")}catch(e){t=!1}t?this._touch_events(["touchmove","touchstart","touchend"],function(t){return t.touches&&t.touches.length>1?null:t.touches[0]?{target:t.target,pageX:t.touches[0].pageX,pageY:t.touches[0].pageY,clientX:t.touches[0].clientX,clientY:t.touches[0].clientY}:t},function(){return!1}):window.navigator.pointerEnabled?this._touch_events(["pointermove","pointerdown","pointerup"],function(t){return"mouse"==t.pointerType?null:t},function(t){return!t||"mouse"==t.pointerType}):window.navigator.msPointerEnabled&&this._touch_events(["MSPointerMove","MSPointerDown","MSPointerUp"],function(t){return t.pointerType==t.MSPOINTER_TYPE_MOUSE?null:t},function(t){return!t||t.pointerType==t.MSPOINTER_TYPE_MOUSE})}},t));var i=[];t._touch_events=function(r,a,o){for(var s,l=0,c=!1,d=!1,u=null,h=null,f=null,_=[],g=null,p=0;p5||Math.abs(p)>5)&&(d=!0,l=0,s=g?e(g):t.getScrollState()),d){var m,y=s.x+_,k=s.y+p;if(g?(!function(e,n,i){var r=e.$config.scrollX?t.$ui.getView(e.$config.scrollX):null,a=e.$config.scrollY?t.$ui.getView(e.$config.scrollY):null;r&&r.scrollTo(n,null),a&&a.scrollTo(null,i)}(g,y,k),m=e(g)):(t.scrollTo(y,k),m=t.getScrollState()),s.x!=m.x&&p>2*_||s.y!=m.y&&_>2*p)return v(i)}}return v(i)}return!0}}]),i.push([this.$container,"contextmenu",function(t){if(c)return v(t)}]),i.push([this.$container,r[1],function(e){if(document&&document.body&&document.body.classList.add("gantt_touch_active"),!o(e))if(e.touches&&e.touches.length>1)c=!1;else{u=a(e),g=function(e){for(var n=t.$layout.getCellsByType("viewCell"),i=0;i=r.left&&e.clientX<=r.right&&e.clientY<=r.bottom&&e.clientY>=r.top)return n[i]}}(u),t._locate_css(u,"gantt_hor_scroll")||t._locate_css(u,"gantt_ver_scroll")||(c=!0);var i=n();h=setTimeout(function(){var e=t.locate(u);i&&e&&!t._locate_css(u,"gantt_link_control")&&!t._locate_css(u,"gantt_grid_data")&&(i.on_mouse_down(u),i.drag&&i.drag.start_drag&&(!function(e){var n=t._getTaskLayers(),i=t.getTask(e);if(i&&t.isTaskVisible(e)){f=e;for(var r=0;re._levels.length-1||e.setLevel(t)},this.getCurrentLevel=function(){return e._activeLevelIndex},this.getLevels=function(){return e._levels},this.setLevel=function(t){var n=e._getZoomIndexByName(t);-1===n&&e.$gantt.assert(-1!==n,"Invalid zoom level for gantt.ext.zoom.setLevel. "+t+" is not an expected value."),e._setLevel(n,0)},this._getZoomIndexByName=function(t){var n=-1;if("string"==typeof t){if(!isNaN(Number(t))&&e._levels[Number(t)])n=Number(t);else for(var i=0;i0&&(r=!0),t.preventDefault(),t.stopPropagation(),e._setScaleSettings(r,i)},this._setScaleDates=function(){e._initialStartDate&&e._initialEndDate&&(e.$gantt.config.start_date=e._initialStartDate,e.$gantt.config.end_date=e._initialEndDate)},this.$gantt=t,this._domEvents=this.$gantt._createDomEventScope()}return t.prototype.init=function(t){var e=this;this.$gantt.env.isNode||(this._initialStartDate=t.startDate,this._initialEndDate=t.endDate,this._activeLevelIndex=t.activeLevelIndex?t.activeLevelIndex:0,this._levels=this._mapScales(t.levels||o),this._handler=t.handler||this._defaultHandler,this._minColumnWidth=t.minColumnWidth||60,this._maxColumnWidth=t.maxColumnWidth||240,this._widthStep=t.widthStep||3/8*t.minColumnWidth,this._useKey=t.useKey,this._initialized||(r(this),this.$gantt.attachEvent("onGanttScroll",function(){e._getVisibleDate()})),this._domEvents.detachAll(),"wheel"===t.trigger&&(this.$gantt.$root?this._attachWheelEvent(t):this.$gantt.attachEvent("onGanttReady",function(){e._attachWheelEvent(t)})),this._initialized=!0,this.setLevel(this._activeLevelIndex))},t.prototype._mapScales=function(t){return t.map(function(t){return Array.isArray(t)?{scales:t}:t})},t.prototype._setScaleSettings=function(t,e){t?this._stepUp(e):this._stepDown(e)},t.prototype._stepUp=function(t){if(!(this._activeLevelIndex>=this._levels.length-1)){var e=this._activeLevelIndex;if(this._setScaleDates(),this._widthStep){var n=this.$gantt.config.min_column_width+this._widthStep;n>this._maxColumnWidth&&(n=this._minColumnWidth,e++),this.$gantt.config.min_column_width=n}else e++;this._setLevel(e,t)}},t.prototype._stepDown=function(t){if(!(this._activeLevelIndex<1)){var e=this._activeLevelIndex;if(this._setScaleDates(),this._widthStep){var n=this.$gantt.config.min_column_width-this._widthStep;n0&&v+y>=k+2&&(_=0),c&&!w?c=0:c<0&&!b?c=0:c>0&&b+w>=x&&(c=0);var $=t.config.autoscroll_step;$&&$<2&&($=2),c*=$||n,_*=$||n,(c||_)&&function(e,n){var i=t.getScrollState(),r=null,a=null;e&&(r=i.x+e,r=Math.min(i.width,r),r=Math.max(0,r));n&&(a=i.y+n,a=Math.min(i.height,a),a=Math.max(0,a));t.scrollTo(r,a)}(c,_)}}function m(t,n,i){return t-e<0&&tn-e&&t>i?1:0}t.attachEvent("onGanttReady",function(){if(!r(t)){var e=i.getRootNode(t.$root)||document.body;t.eventRemove(e,"mousemove",p),t.event(e,"mousemove",p),t.eventRemove(e,"touchmove",p),t.event(e,"touchmove",p),t.eventRemove(e,"pointermove",p),t.event(e,"pointermove",p)}}),t.attachEvent("onDestroy",function(){g(!1)})}},function(t,e,n){t.exports=function(t){t.ext||(t.ext={});for(var e=[n(62),n(61),n(60)],i=0;i-1&&(n.className=n.className.slice(0,t))},200))})}},function(t,e){t.exports=function(t){t.skins.broadway={config:{grid_width:360,row_height:35,scale_height:35,link_line_width:1,link_arrow_size:7,lightbox_additional_height:86},_second_column_width:90,_third_column_width:80,_lightbox_template:"
 
",_config_buttons_left:{},_config_buttons_right:{gantt_delete_btn:"icon_delete",gantt_save_btn:"icon_save"}}}},function(t,e){t.exports=function(t){t.skins.terrace={config:{grid_width:360,row_height:35,scale_height:35,link_line_width:2,link_arrow_size:6,lightbox_additional_height:75},_second_column_width:90,_third_column_width:70}}},function(t,e){t.exports=function(t){t.skins.meadow={config:{grid_width:350,row_height:27,scale_height:30,link_line_width:2,link_arrow_size:6,lightbox_additional_height:72},_second_column_width:95,_third_column_width:80}}},function(t,e){t.exports=function(t){t.skins.skyblue={config:{grid_width:350,row_height:27,scale_height:27,link_line_width:1,link_arrow_size:8,lightbox_additional_height:75},_second_column_width:95,_third_column_width:80}}},function(t,e){function n(t,e){var n=e.skin;if(!n||t)for(var i=document.getElementsByTagName("link"),r=0;rl.width?l.min_width:l.width,l.width=l.max_width&&l.max_widthl[1]&&(t.config.grid_width=l[1]),r&&t.config.show_chart){if(a.$config.width=t.config.grid_width-1,!a.$config.scrollable&&a.$config.scrollY&&t.$root.offsetWidth){var c=a.$gantt.$layout.$container.offsetWidth,d=t.$ui.getView(a.$config.scrollY).$config.width,u=c-(a.$config.width+d);u<0&&(a.$config.width+=u,t.config.grid_width+=u)}if(n)a.$parent.$config.width=t.config.grid_width,a.$parent.$config.group&&t.$layout._syncCellSizes(a.$parent.$config.group,{value:a.$parent.$config.width,isGravity:!1});else if(r&&!i.isChildOf(r.$task,e.$view)){if(!a.$config.original_grid_width){var h=t.skins[t.skin];h&&h.config&&h.config.grid_width?a.$config.original_grid_width=h.config.grid_width:a.$config.original_grid_width=0}t.config.grid_width=a.$config.original_grid_width,a.$parent.$config.width=t.config.grid_width}else a.$parent._setContentSize(a.$config.width,null),t.$layout._syncCellSizes(a.$parent.$config.group,{value:t.config.grid_width,isGravity:!1})}else r&&i.isChildOf(r.$task,e.$view)&&(a.$config.original_grid_width=t.config.grid_width),n||(a.$parent.$config.width=0)}n=!1}}),this._initScrollStateEvents(e)},_initScrollStateEvents:function(e){t._getVerticalScrollbar=this.getVerticalScrollbar,t._getHorizontalScrollbar=this.getHorizontalScrollbar;var n=this.getVerticalScrollbar(),i=this.getHorizontalScrollbar();n&&n.attachEvent("onScroll",function(e,n,i){var r=t.getScrollState();t.callEvent("onGanttScroll",[r.x,e,r.x,n])}),i&&i.attachEvent("onScroll",function(e,n,i){var r=t.getScrollState();t.callEvent("onGanttScroll",[e,r.y,n,r.y]);var a=t.$ui.getView("grid");a&&a.$grid_data&&!a.$config.scrollable&&(a.$grid_data.style.left=a.$grid.scrollLeft+"px",a.$grid_data.scrollLeft=a.$grid.scrollLeft)}),e.attachEvent("onResize",function(){n&&!t.$scroll_ver&&(t.$scroll_ver=n.$scroll_ver),i&&!t.$scroll_hor&&(t.$scroll_hor=i.$scroll_hor)})},_findGridResizer:function(t,e){for(var n,i=t.getCellsByType("resizer"),r=!0,a=0;aa.bottom+u&&(h.y=a.bottom+u-r.height-s),h.right>a.right&&(h.x=a.right-r.width-o),h}function v(t){var n=d(),i=["gantt_link_tooltip"];n.link_source_id&&n.link_target_id&&(e.isLinkAllowed(n.link_source_id,n.link_target_id,n.link_from_start,n.link_to_start)?i.push("gantt_allowed_link"):i.push("gantt_invalid_link"));var r=e.templates.drag_link_class(n.link_source_id,n.link_from_start,n.link_target_id,n.link_to_start);r&&i.push(r);var a="
"+e.templates.drag_link(n.link_source_id,n.link_from_start,n.link_target_id,n.link_to_start)+"
";t.innerHTML=a}function m(){o=s=r=null,a=!0}function y(n,i,r,a){var o=function(){_._direction&&_._direction.parentNode||(_._direction=document.createElement("div"),t.$task_links.appendChild(_._direction));return _._direction}(),s=d(),l=["gantt_link_direction"];e.templates.link_direction_class&&l.push(e.templates.link_direction_class(s.link_source_id,s.link_from_start,s.link_target_id,s.link_to_start));var c=Math.sqrt(Math.pow(r-n,2)+Math.pow(a-i,2));if(c=Math.max(0,c-3)){o.className=l.join(" ");var u=(a-i)/(r-n),h=Math.atan(u);2==k(n,r,i,a)?h+=Math.PI:3==k(n,r,i,a)&&(h-=Math.PI);var f=Math.sin(h),g=Math.cos(h),p=Math.round(i),v=Math.round(n),m=["-webkit-transform: rotate("+h+"rad)","-moz-transform: rotate("+h+"rad)","-ms-transform: rotate("+h+"rad)","-o-transform: rotate("+h+"rad)","transform: rotate("+h+"rad)","width:"+Math.round(c)+"px"];if(-1!=window.navigator.userAgent.indexOf("MSIE 8.0")){m.push('-ms-filter: "'+function(t,e){return"progid:DXImageTransform.Microsoft.Matrix(M11 = "+e+",M12 = -"+t+",M21 = "+t+",M22 = "+e+",SizingMethod = 'auto expand')"}(f,g)+'"');var y=Math.abs(Math.round(n-r)),b=Math.abs(Math.round(a-i));switch(k(n,r,i,a)){case 1:p-=b;break;case 2:v-=y,p-=b;break;case 3:v-=y}}m.push("top:"+p+"px"),m.push("left:"+v+"px"),o.style.cssText=m.join(";")}}function k(t,e,n,i){return e>=t?i<=n?1:4:i<=n?2:3}_.attachEvent("onBeforeDragStart",e.bind(function(n,r){var a=r.target||r.srcElement;if(m(),e.getState("tasksDnd").drag_id)return!1;if(i.locateClassName(a,"gantt_link_point")){i.locateClassName(a,"task_start_date")&&(s=!0);var l=e.locate(r);o=l;var c=e.getTask(l);if(e.isReadonly(c))return m(),!1;return this._dir_start=g(c,!!s,0,t.$getConfig(),!0),!0}return!1},this)),_.attachEvent("onAfterDragStart",e.bind(function(t,n){e.config.touch&&e.refreshData(),v(_.config.marker)},this)),_.attachEvent("onDragMove",e.bind(function(o,s){var l=_.config,c=p(s,l.marker);!function(t,e){t.style.left=e.x+"px",t.style.top=e.y+"px"}(l.marker,c);var d=!!i.locateClassName(s,"gantt_link_control"),u=r,h=n,f=a,m=e.locate(s),k=!0,b=i.getTargetNode(s);if(i.isChildOf(b,e.$root)||(d=!1,m=null),d&&(k=!i.locateClassName(s,"task_end_date"),d=!!m),r=m,n=d,a=k,d){var w=e.getTask(m),x=t.$getConfig(),$=i.locateClassName(s,"gantt_link_control"),S=0;$&&(S=Math.floor($.offsetWidth/2)),this._dir_end=g(w,!!a,S,x)}else this._dir_end=i.getRelativeEventPosition(s,t.$task_data),e.env.isEdge&&(this._dir_end.y+=window.scrollY);var T=!(h==d&&u==m&&f==k);return T&&(u&&e.refreshTask(u,!1),m&&e.refreshTask(m,!1)),T&&v(l.marker),y(this._dir_start.x,this._dir_start.y,this._dir_end.x,this._dir_end.y),!0},this)),_.attachEvent("onDragEnd",e.bind(function(){var t=d();if(t.link_source_id&&t.link_target_id&&t.link_source_id!=t.link_target_id){var n=e._get_link_type(t.link_from_start,t.link_to_start),i={source:t.link_source_id,target:t.link_target_id,type:n};i.type&&e.isLinkAllowed(i)&&e.callEvent("onLinkCreated",[i])&&e.addLink(i)}m(),e.config.touch?e.refreshData():(t.link_source_id&&e.refreshTask(t.link_source_id,!1),t.link_target_id&&e.refreshTask(t.link_target_id,!1)),_._direction&&(_._direction.parentNode&&_._direction.parentNode.removeChild(_._direction),_._direction=null)},this)),e.attachEvent("onGanttRender",e.bind(function(){_._direction&&y(this._dir_start.x,this._dir_start.y,this._dir_end.x,this._dir_end.y)},this))};t.exports={createLinkDND:function(){return{init:r}}}},function(t,e,n){var i=n(1),r=n(0),a=n(44),o=n(2);t.exports={createTaskDND:function(){var t;return{extend:function(e){e.roundTaskDates=function(e){t.round_task_dates(e)}},init:function(e,n){return t=function(t,e){var n=e.$services;return{drag:null,dragMultiple:{},_events:{before_start:{},before_finish:{},after_finish:{}},_handlers:{},init:function(){this._domEvents=e._createDomEventScope(),this.clear_drag_state();var t=e.config.drag_mode;this.set_actions(),n.getService("state").registerProvider("tasksDnd",r.bind(function(){return{drag_id:this.drag?this.drag.id:void 0,drag_mode:this.drag?this.drag.mode:void 0,drag_from_start:this.drag?this.drag.left:void 0}},this));var i={before_start:"onBeforeTaskDrag",before_finish:"onBeforeTaskChanged",after_finish:"onAfterTaskDrag"};for(var a in this._events)for(var o in t)this._events[a][o]=i[a];this._handlers[t.move]=this._move,this._handlers[t.resize]=this._resize,this._handlers[t.progress]=this._resize_progress},set_actions:function(){var n=t.$task_data;this._domEvents.attach(n,"mousemove",e.bind(function(t){this.on_mouse_move(t)},this)),this._domEvents.attach(n,"mousedown",e.bind(function(t){this.on_mouse_down(t)},this)),this._domEvents.attach(document.body,"mouseup",e.bind(function(t){this.on_mouse_up(t)},this))},clear_drag_state:function(){this.drag={id:null,mode:null,pos:null,start_x:null,start_y:null,obj:null,left:null},this.dragMultiple={}},_resize:function(n,i,r){var a=t.$getConfig(),o=this._drag_task_coords(n,r);r.left?(n.start_date=e.dateFromPos(o.start+i),n.start_date||(n.start_date=new Date(e.getState().min_date))):(n.end_date=e.dateFromPos(o.end+i),n.end_date||(n.end_date=new Date(e.getState().max_date)));var s=this._calculateMinDuration(a.min_duration,a.duration_unit);n.end_date-n.start_datec){var d=c-s.end;(di||void 0===i)&&(i=u)}}return i},_move:function(t,n,i,r){var a=this._drag_task_coords(t,i),o=null,s=null;r?(o=new Date(+i.obj.start_date+r),s=new Date(+i.obj.end_date+r)):(o=e.dateFromPos(a.start+n),s=e.dateFromPos(a.end+n)),o?s?(t.start_date=o,t.end_date=s):(t.end_date=new Date(e.getState().max_date),t.start_date=e.dateFromPos(e.posFromDate(t.end_date)-(a.end-a.start))):(t.start_date=new Date(e.getState().min_date),t.end_date=e.dateFromPos(e.posFromDate(t.start_date)+(a.end-a.start)))},_drag_task_coords:function(t,n){return{start:n.obj_s_x=n.obj_s_x||e.posFromDate(t.start_date),end:n.obj_e_x=n.obj_e_x||e.posFromDate(t.end_date)}},_mouse_position_change:function(t,e){var n=t.x-e.x,i=t.y-e.y;return Math.sqrt(n*n+i*i)},_is_number:function(t){return!isNaN(parseFloat(t))&&isFinite(t)},on_mouse_move:function(t){if(this.drag.start_drag){var n=i.getRelativeEventPosition(t,e.$task_data),r=this.drag.start_drag.start_x,o=this.drag.start_drag.start_y;(Date.now()-this.drag.timestamp>50||this._is_number(r)&&this._is_number(o)&&this._mouse_position_change({x:r,y:o},n)>20)&&this._start_dnd(t)}if(this.drag.mode){if(!a(this,40))return;this._update_on_move(t)}},_update_item_on_move:function(t,n,i,r,a,o){var s=e.getTask(n),l=e.mixin({},s),c=e.mixin({},s);this._handlers[i].apply(this,[c,t,r,o]),e.mixin(s,c,!0),e.callEvent("onTaskDrag",[s.id,i,c,l,a]),e.mixin(s,c,!0),e.refreshTask(n)},_update_on_move:function(n){var a=this.drag,o=t.$getConfig();if(a.mode){var s=i.getRelativeEventPosition(n,t.$task_data);if(a.pos&&a.pos.x==s.x)return;a.pos=s;var l=e.dateFromPos(s.x);if(!l||isNaN(l.getTime()))return;var c=s.x-a.start_x,d=e.getTask(a.id);if(this._handlers[a.mode]){if(a.mode===o.drag_mode.move){var u={};this._isMultiselect()&&e.getSelectedTasks().indexOf(a.id)>=0&&(u=this.dragMultiple);var h=!1;if(e.isSummaryTask(d)&&e.config.drag_project){var f={};f[a.id]=r.copy(a),h=!0,u=r.mixin(f,this.dragMultiple)}var _=this._find_max_shift(u,c);for(var g in void 0!==_&&(c=_),this._update_item_on_move(c,a.id,a.mode,a,n),u){var p=u[g];if(h&&p.id!=a.id&&(e._bulk_dnd=!0),void 0===_&&(h||Object.keys(u).length>1))var v=l-e.dateFromPos(a.start_x);this._update_item_on_move(c,p.id,p.mode,p,n,v)}e._bulk_dnd=!1}else this._update_item_on_move(c,a.id,a.mode,a,n);e._update_parents(a.id)}}},on_mouse_down:function(n,r){if(2!=n.button||void 0===n.button){var a=t.$getConfig(),o=e.locate(n),s=null;if(e.isTaskExists(o)&&(s=e.getTask(o)),!e.isReadonly(s)&&!this.drag.mode){this.clear_drag_state(),r=r||n.target||n.srcElement;var l=i.getClassName(r),c=this._get_drag_mode(l,r);if(!l||!c)return r.parentNode?this.on_mouse_down(n,r.parentNode):void 0;if(c)if(c.mode&&c.mode!=a.drag_mode.ignore&&a["drag_"+c.mode]){if(o=e.locate(r),s=e.copy(e.getTask(o)||{}),e.isReadonly(s))return this.clear_drag_state(),!1;if(e.isSummaryTask(s)&&!a.drag_project&&c.mode!=a.drag_mode.progress)return void this.clear_drag_state();c.id=o;var d=i.getRelativeEventPosition(n,e.$task_data);c.start_x=d.x,c.start_y=d.y,c.obj=s,this.drag.start_drag=c,this.drag.timestamp=Date.now()}else this.clear_drag_state();else if(e.checkEvent("onMouseDown")&&e.callEvent("onMouseDown",[l.split(" ")[0]])&&r.parentNode)return this.on_mouse_down(n,r.parentNode)}}},_fix_dnd_scale_time:function(n,i){var r=t.$getConfig(),a=e.getScale().unit,o=e.getScale().step;function s(n){if(e.config.correct_work_time){var i=t.$getConfig();e.isWorkTime(n.start_date,void 0,n)||(n.start_date=e.calculateEndDate({start_date:n.start_date,duration:-1,unit:i.duration_unit,task:n}))}}r.round_dnd_dates||(a="minute",o=r.time_step),i.mode==r.drag_mode.resize?i.left?(n.start_date=e.roundDate({date:n.start_date,unit:a,step:o}),s(n)):(n.end_date=e.roundDate({date:n.end_date,unit:a,step:o}),function(n){if(e.config.correct_work_time){var i=t.$getConfig();e.isWorkTime(new Date(n.end_date-1),void 0,n)||(n.end_date=e.calculateEndDate({start_date:n.end_date,duration:1,unit:i.duration_unit,task:n}))}}(n)):i.mode==r.drag_mode.move&&(n.start_date=e.roundDate({date:n.start_date,unit:a,step:o}),s(n),n.end_date=e.calculateEndDate(n))},_fix_working_times:function(n,i){var r=t.$getConfig();(i=i||{mode:r.drag_mode.move}).mode==r.drag_mode.resize?i.left?n.start_date=e.getClosestWorkTime({date:n.start_date,dir:"future",task:n}):n.end_date=e.getClosestWorkTime({date:n.end_date,dir:"past",task:n}):i.mode==r.drag_mode.move&&e.correctTaskWorkTime(n)},_finalize_mouse_up:function(t,n,i,r){var a=e.getTask(t);if(n.work_time&&n.correct_work_time&&this._fix_working_times(a,i),this._fix_dnd_scale_time(a,i),this._fireEvent("before_finish",i.mode,[t,i.mode,e.copy(i.obj),r])){var o=t;e._init_task_timing(a),this.clear_drag_state(),e.updateTask(a.id),this._fireEvent("after_finish",i.mode,[o,i.mode,r])}else this.clear_drag_state(),t==i.id&&(i.obj._dhx_changed=!1,e.mixin(a,i.obj,!0)),e.refreshTask(a.id)},on_mouse_up:function(n){var i=this.drag;if(i.mode&&i.id){var r=t.$getConfig(),a=e.getTask(i.id),o=this.dragMultiple,s=!1,l=0;i.mode===r.drag_mode.move&&(e.isSummaryTask(a)&&r.drag_project||this._isMultiselect())&&(s=!0,l=Object.keys(o).length);var c=function(){if(s)for(var t in o)this._finalize_mouse_up(o[t].id,r,o[t],n);this._finalize_mouse_up(i.id,r,i,n)};s&&l>10?e.batchUpdate(function(){c.call(this)}.bind(this)):c.call(this)}this.clear_drag_state()},_get_drag_mode:function(e,n){var i=t.$getConfig().drag_mode,r={mode:null,left:null};switch((e||"").split(" ")[0]){case"gantt_task_line":case"gantt_task_content":r.mode=i.move;break;case"gantt_task_drag":r.mode=i.resize;var a=n.getAttribute("data-bind-property");r.left="start_date"==a;break;case"gantt_task_progress_drag":r.mode=i.progress;break;case"gantt_link_control":case"gantt_link_point":r.mode=i.ignore;break;default:r=null}return r},_start_dnd:function(n){var i=this.drag=this.drag.start_drag;delete i.start_drag;var r=t.$getConfig(),a=i.id;if(r["drag_"+i.mode]&&e.callEvent("onBeforeDrag",[a,i.mode,n])&&this._fireEvent("before_start",i.mode,[a,i.mode,n])){delete i.start_drag;var s=e.getTask(a);if(e.isReadonly(s))return void this.clear_drag_state();if(this._isMultiselect()){var l=e.getSelectedTasks();l.indexOf(i.id)>=0&&o.forEach(l,e.bind(function(t){var n=e.getTask(t);e.isSummaryTask(n)&&e.config.drag_project&&i.mode==r.drag_mode.move&&this._addSubtasksToDragMultiple(n.id),this.dragMultiple[t]=e.mixin({id:n.id,obj:e.copy(n)},this.drag)},this))}e.isSummaryTask(s)&&e.config.drag_project&&i.mode==r.drag_mode.move&&this._addSubtasksToDragMultiple(s.id),e.callEvent("onTaskDragStart",[])}else this.clear_drag_state()},_fireEvent:function(t,n,i){e.assert(this._events[t],"Invalid stage:{"+t+"}");var r=this._events[t][n];return e.assert(r,"Unknown after drop mode:{"+n+"}"),e.assert(i,"Invalid event arguments"),!e.checkEvent(r)||e.callEvent(r,i)},round_task_dates:function(e){var n=this.drag,i=t.$getConfig();n||(n={mode:i.drag_mode.move}),this._fix_dnd_scale_time(e,n)},destructor:function(){this._domEvents.detachAll()},_isMultiselect:function(){return e.config.drag_multiple&&!!(e.getSelectedTasks&&e.getSelectedTasks().length>0)},_addSubtasksToDragMultiple:function(t){e.eachTask(function(t){this.dragMultiple[t.id]=e.mixin({id:t.id,obj:e.copy(t)},this.drag)},t,this)}}}(e,n),e._tasks_dnd=t,t.init(n)},destructor:function(){t&&(t.destructor(),t=null)}}}}},function(t,e,n){var i=n(0),r=n(76),a=n(75),o=n(1),s=function(t){var e=t.$services;return{onCreated:function(e){var o=e.$config;o.bind=i.defined(o.bind)?o.bind:"task",o.bindLinks=i.defined(o.bindLinks)?o.bindLinks:"link",e._linksDnD=a.createLinkDND(),e._tasksDnD=r.createTaskDND(),e._tasksDnD.extend(e),this._mouseDelegates=n(24)(t)},onInitialized:function(e){this._attachDomEvents(t),this._attachStateProvider(t,e),e._tasksDnD.init(e,t),e._linksDnD.init(e,t),"timeline"==e.$config.id&&this.extendDom(e)},onDestroyed:function(e){this._clearDomEvents(t),this._clearStateProvider(t),e._tasksDnD&&e._tasksDnD.destructor()},extendDom:function(e){t.$task=e.$task,t.$task_scale=e.$task_scale,t.$task_data=e.$task_data,t.$task_bg=e.$task_bg,t.$task_links=e.$task_links,t.$task_bars=e.$task_bars},_clearDomEvents:function(){this._mouseDelegates.destructor(),this._mouseDelegates=null},_attachDomEvents:function(t){function e(e,n){if(e&&this.callEvent("onLinkDblClick",[e,n])){var i=this.getLink(e);if(this.isReadonly(i))return;var r=this.locale.labels.link+" "+this.templates.link_description(this.getLink(e))+" "+this.locale.labels.confirm_link_deleting;window.setTimeout(function(){t._simple_confirm(r,"",function(){t.deleteLink(e)})},this.config.touch?300:1)}}this._mouseDelegates.delegate("click","gantt_task_link",t.bind(function(t,e){var n=this.locate(t,this.config.link_attribute);n&&this.callEvent("onLinkClick",[n,t])},t),this.$task),this._mouseDelegates.delegate("click","gantt_scale_cell",t.bind(function(e,n){var i=o.getRelativeEventPosition(e,t.$task_data),r=t.dateFromPos(i.x),a=Math.floor(t.columnIndexByDate(r)),s=t.getScale().trace_x[a];t.callEvent("onScaleClick",[e,s])},t),this.$task),this._mouseDelegates.delegate("doubleclick","gantt_task_link",t.bind(function(n,i,r){i=this.locate(n,t.config.link_attribute),e.call(this,i,n)},t),this.$task),this._mouseDelegates.delegate("doubleclick","gantt_link_point",t.bind(function(t,n,i){n=this.locate(t);var r=this.getTask(n),a=null;return i.parentNode&&o.getClassName(i.parentNode)&&(a=o.getClassName(i.parentNode).indexOf("_left")>-1?r.$target[0]:r.$source[0]),a&&e.call(this,a,t),!1},t),this.$task)},_attachStateProvider:function(t,n){var i=n;e.getService("state").registerProvider("tasksTimeline",function(){return{scale_unit:i._tasks?i._tasks.unit:void 0,scale_step:i._tasks?i._tasks.step:void 0}})},_clearStateProvider:function(){e.getService("state").unregisterProvider("tasksTimeline")}}};t.exports=s},function(t,e,n){var i=n(1);function r(t,e){var n=i.getNodePosition(e.$grid_data);return t.x+=n.x+e.$grid.scrollLeft,t.y+=n.y-e.$grid_data.scrollTop,t}function a(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=i.getNodePosition(t.$root);return e>r.width&&(e=r.width-n-2),e}t.exports={removeLineHighlight:function(t){t.markerLine&&t.markerLine.parentNode&&t.markerLine.parentNode.removeChild(t.markerLine),t.markerLine=null},highlightPosition:function(t,e,n){var o=function(t,e){var n=i.getNodePosition(e.$grid_data),r=i.getRelativeEventPosition(t,e.$grid_data),o=n.x+e.$grid.scrollLeft,s=r.y-10,l=e.getItemHeight(t.targetId);sn.y+c-l&&(s=n.y+c-l),n.x=o,n.y=s,n.width=a(e.$gantt,n.width,9),n}(t,n);e.marker.style.left=o.x+9+"px",e.marker.style.width=o.width+"px",e.marker.style.overflow="hidden";var s=e.markerLine;s||((s=document.createElement("div")).className="gantt_drag_marker gantt_grid_dnd_marker",s.innerHTML="
",s.style.pointerEvents="none"),t.child?function(t,e,n){var i=t.targetParent,o=r({x:0,y:n.getItemTop(i)},n),s=n.$grid_data.getBoundingClientRect().bottom+window.scrollY,l=a(n.$gantt,n.$grid_data.offsetWidth);e.innerHTML="
",e.style.width=l+"px",e.style.top=o.y+"px",e.style.left=o.x+"px",e.style.height=n.getItemHeight(i)+"px",o.y>s&&(e.style.top=s+"px")}(t,s,n):function(t,e,n){var i=function(t,e){var n=e.$config.rowStore,i={x:0,y:0},o=e.$grid_data.querySelector(".gantt_tree_indent"),s=15,l=0;if(o&&(s=o.offsetWidth),t.targetId!==n.$getRootId()){var c=e.getItemTop(t.targetId),d=e.getItemHeight(t.targetId);if(l=n.exists(t.targetId)?n.calculateItemLevel(n.getItem(t.targetId)):0,t.prevSibling)i.y=c;else if(t.nextSibling){var u=0;n.eachItem(function(t){-1!==n.getIndexById(t.id)&&u++},t.targetId),i.y=c+d+u*d}else i.y=c+d,l+=1}return i.x=40+l*s,i.width=a(e.$gantt,Math.max(e.$grid_data.offsetWidth-i.x,0),i.x),r(i,e)}(t,n),o=n.$grid_data.getBoundingClientRect().bottom+window.scrollY;e.innerHTML="
",e.style.left=i.x+"px",e.style.height="4px";var s=i.y-2;e.style.top=s+"px",e.style.width=i.width+"px",s>o&&(e.style.top=o+"px")}(t,s,n),e.markerLine||(document.body.appendChild(s),e.markerLine=s)}}},function(t,e,n){var i=n(17);t.exports=function(t,e,n,r,a){var o;if(e!==a.$getRootId())o=n<.25?i.prevSiblingTarget(t,e,a):!(n>.6)||a.hasChild(e)&&a.getItem(e).$open?i.firstChildTarget(t,e,a):i.nextSiblingTarget(t,e,a);else{var s=a.$getRootId();o=a.hasChild(s)&&r>=0?i.lastChildTarget(t,s,a):i.firstChildTarget(t,s,a)}return o}},function(t,e,n){var i=n(17);function r(t,e,n,r,a){for(var o=e;r.exists(o);){var s=r.calculateItemLevel(r.getItem(o));if((s===n||s===n-1)&&r.getBranchIndex(o)>-1)break;o=a?r.getPrev(o):r.getNext(o)}return r.exists(o)?r.calculateItemLevel(r.getItem(o))===n?a?i.nextSiblingTarget(t,o,r):i.prevSiblingTarget(t,o,r):i.firstChildTarget(t,o,r):null}function a(t,e,n,i){return r(t,e,n,i,!0)}function o(t,e,n,i){return r(t,e,n,i,!1)}t.exports=function(t,e,n,r,s,l){var c;if(e!==s.$getRootId()){var d=s.getItem(e),u=s.calculateItemLevel(d);if(u===l){var h=s.getPrevSibling(e);n<.5&&!h?c=i.prevSiblingTarget(t,e,s):(n<.5&&(e=h),c=i.nextSiblingTarget(t,e,s))}else if(u>l)s.eachParent(function(t){s.calculateItemLevel(t)===l&&(e=t.id)},d),c=a(t,e,l,s);else{var f=a(t,e,l,s),_=o(t,e,l,s);c=n<.5?f:_}}else{var g=s.$getRootId(),p=s.getChildren(g);c=i.createDropTargetObject(),c=p.length&&r>=0?a(t,function(t){for(var e=t.getNext();t.exists(e);){var n=t.getNext(e);if(!t.exists(n))return e;e=n}return null}(s),l,s):o(t,g,l,s)}return c}},function(t,e,n){var i=n(1),r=n(17),a=n(80),o=n(79),s=n(78),l=n(11);t.exports={init:function(t,e){var n=t.$services.getService("dnd");if(e.$config.bind&&t.getDatastore(e.$config.bind)){var c=new n(e.$grid_data,{updates_per_second:60});t.defined(e.$getConfig().dnd_sensitivity)&&(c.config.sensitivity=e.$getConfig().dnd_sensitivity),c.attachEvent("onBeforeDragStart",t.bind(function(n,r){var a=d(r);if(!a)return!1;if(t.hideQuickInfo&&t._hideQuickInfo(),i.closest(r.target,".gantt_grid_editor_placeholder"))return!1;var o=a.getAttribute(e.$config.item_attribute),s=e.$config.rowStore.getItem(o);return!t.isReadonly(s)&&!u(o)&&(c.config.initial_open_state=s.$open,!!t.callEvent("onRowDragStart",[o,r.target||r.srcElement,r])&&void 0)},t)),c.attachEvent("onAfterDragStart",t.bind(function(t,n){var i=d(n);c.config.marker.innerHTML=i.outerHTML;var a=c.config.marker.firstChild;a&&(c.config.marker.style.opacity=.4,a.style.position="static",a.style.pointerEvents="none"),c.config.id=i.getAttribute(e.$config.item_attribute);var o=e.$config.rowStore,s=o.getItem(c.config.id);c.config.level=o.calculateItemLevel(s),c.config.drop_target=r.createDropTargetObject({targetParent:o.getParent(s.id),targetIndex:o.getBranchIndex(s.id),targetId:s.id,nextSibling:!0}),s.$open=!1,s.$transparent=!0,this.refreshData()},t)),c.attachEvent("onDragMove",t.bind(function(n,i){var a=h(i);return a&&!1!==t.callEvent("onBeforeRowDragMove",[c.config.id,a.targetParent,a.targetIndex])||(a=r.createDropTargetObject(c.config.drop_target)),s.highlightPosition(a,c.config,e),c.config.drop_target=a,this.callEvent("onRowDragMove",[c.config.id,a.targetParent,a.targetIndex]),!0},t)),c.attachEvent("onDragEnd",t.bind(function(){var n=e.$config.rowStore,i=n.getItem(c.config.id);s.removeLineHighlight(c.config),i.$transparent=!1,i.$open=c.config.initial_open_state;var r=c.config.drop_target;!1===this.callEvent("onBeforeRowDragEnd",[c.config.id,r.targetParent,r.targetIndex])?i.$drop_target=null:(n.move(c.config.id,r.targetIndex,r.targetParent),t.render(),this.callEvent("onRowDragEnd",[c.config.id,r.targetParent,r.targetIndex])),n.refresh(i.id)},t))}function d(t){return i.locateAttribute(t,e.$config.item_attribute)}function u(n){return l(n,t,t.getDatastore(e.$config.bind))}function h(n){var r,s=function(n){var r=i.getRelativeEventPosition(n,e.$grid_data).y,a=e.$config.rowStore;document.doctype||(r+=window.scrollY),r=r||0;var o=e.$state.scrollTop||0,s=t.$grid_data.getBoundingClientRect().height+o+window.scrollY,l=o,d=e.getItemIndexByTopPosition(e.$state.scrollTop);if(a.exists(d)||(d=a.countVisible()-1),d<0)return a.$getRootId();var h=a.getIdByIndex(d),f=e.$state.scrollTop/e.getItemHeight(h),_=f-Math.floor(f);_>.1&&_<.9&&(s-=e.getItemHeight(h)*_,l+=e.getItemHeight(h)*(1-_));var g=i.getNodePosition(e.$grid_data),p=g.y+g.height,v=c.config.marker.offsetHeight;r+v+window.scrollY>=s&&(c.config.marker.style.top=p-v+"px"),r>=s?r=s:r<=l&&(r=l,c.config.marker.style.top=g.y+"px");var m=e.getItemIndexByTopPosition(r);if(m>a.countVisible()-1||m<0)return a.$getRootId();var y=a.getIdByIndex(m);return u(y)?a.getPrevSibling(y):a.getIdByIndex(m)}(n),l=null,d=e.$config.rowStore,h=!e.$getConfig().order_branch_free,f=i.getRelativeEventPosition(n,e.$grid_data).y;return document.doctype||(f+=window.scrollY),s!==d.$getRootId()&&(l=(f-e.getItemTop(s))/e.getItemHeight(s)),h?(r=a(c.config.id,s,l,f,d,c.config.level))&&r.targetParent&&u(r.targetParent)&&(s=d.getPrevSibling(r.targetParent),r=a(c.config.id,s,l,f,d,c.config.level)):r=o(c.config.id,s,l,f,d),r}}}},function(t,e,n){var i=n(1),r=n(11);t.exports={init:function(t,e){var n=t.$services.getService("dnd");if(e.$config.bind&&t.getDatastore(e.$config.bind)){var a=new n(e.$grid_data,{updates_per_second:60});t.defined(e.$getConfig().dnd_sensitivity)&&(a.config.sensitivity=e.$getConfig().dnd_sensitivity),a.attachEvent("onBeforeDragStart",t.bind(function(n,r){var c=o(r);if(!c)return!1;if(t.hideQuickInfo&&t._hideQuickInfo(),i.closest(r.target,".gantt_grid_editor_placeholder"))return!1;var d=c.getAttribute(e.$config.item_attribute);if(l(d))return!1;var u=s().getItem(d);return!t.isReadonly(u)&&(a.config.initial_open_state=u.$open,!!t.callEvent("onRowDragStart",[d,r.target||r.srcElement,r])&&void 0)},t)),a.attachEvent("onAfterDragStart",t.bind(function(t,n){var i=o(n);a.config.marker.innerHTML=i.outerHTML;var r=a.config.marker.firstChild;r&&(r.style.position="static"),a.config.id=i.getAttribute(e.$config.item_attribute);var l=s(),c=l.getItem(a.config.id);a.config.index=l.getBranchIndex(a.config.id),a.config.parent=c.parent,c.$open=!1,c.$transparent=!0,this.refreshData()},t)),a.lastTaskOfLevel=function(t){for(var e=null,n=s().getItems(),i=0,r=n.length;in.y+l-s&&(o=n.y+l-s);var c=n.y+n.height;return o>c-s&&(o=c-s),n.x=r,n.y=o,n},t),a._getTargetY=t.bind(function(n){var r=i.getNodePosition(e.$grid_data),a=e.$state.scrollTop||0,o=t.$grid_data.getBoundingClientRect().height+a,s=n.pageY-r.y+a;return s>o?s=o:si.countVisible()-1?null:i.getIdByIndex(r)},t),a.attachEvent("onDragMove",t.bind(function(n,r){var o=t.$grid_data.getBoundingClientRect(),c=o.height+o.y+(e.$state.scrollTop||0)+window.scrollY,d=a.config,u=a._getGridPos(r),h=e.$getConfig(),f=s();u.y_.width&&(d.marker.style.width=_.width-10-2+"px",d.marker.style.overflow="hidden");var g=f.getItem(a.config.id),p=a._getTargetY(r),v=a._getTaskByY(p,f.getIndexById(g.id));function m(t,e){return!f.isChildOf(y.id,e.id)&&(t.$level==e.$level||h.order_branch_free)}if(f.exists(v)||(v=a.lastTaskOfLevel(h.order_branch_free?g.$level:0))==a.config.id&&(v=null),f.exists(v)){var y=f.getItem(v),k=e.getItemTop(y.id),b=e.getItemHeight(y.id);if(k+b/2=0;)S=f.getIdByIndex(w-C),T=f.getItem(S),C++;if(g.id==y.id||l(y.id))return;m(y,g)&&g.id!=y.id?f.move(g.id,0,0,y.id):y.$level!=g.$level-1||f.getChildren(y.id).length?T&&m(T,g)&&g.id!=T.id&&f.move(g.id,-1,f.getParent(T.id)):f.move(g.id,0,y.id)}return!0},t)),a.attachEvent("onDragEnd",t.bind(function(){var e=s(),n=e.getItem(a.config.id);n.$transparent=!1,n.$open=a.config.initial_open_state,!1===this.callEvent("onBeforeRowDragEnd",[a.config.id,a.config.parent,a.config.index])?(e.move(a.config.id,a.config.index,a.config.parent),n.$drop_target=null):this.callEvent("onRowDragEnd",[a.config.id,n.$drop_target]),t.render(),this.refreshData()},t))}function o(t){return i.locateAttribute(t,e.$config.item_attribute)}function s(){return t.getDatastore(e.$config.bind)}function l(e){return r(e,t,s())}}}},function(t,e,n){var i=n(0),r=n(82),a=n(81),o=function(t){return{onCreated:function(e){e.$config=i.mixin(e.$config,{bind:"task"}),"grid"==e.$config.id&&(this.extendGantt(e),t.ext.inlineEditors=t.ext._inlineEditors.createEditors(e),t.ext.inlineEditors.init()),this._mouseDelegates=n(24)(t)},onInitialized:function(e){var n=e.$getConfig();n.order_branch&&("marker"==n.order_branch?a.init(e.$gantt,e):r.init(e.$gantt,e)),this.initEvents(e,t),"grid"==e.$config.id&&this.extendDom(e)},onDestroyed:function(e){"grid"==e.$config.id&&t.ext.inlineEditors.destructor(),this.clearEvents(e,t)},initEvents:function(t,e){this._mouseDelegates.delegate("click","gantt_row",e.bind(function(n,i,r){var a=t.$getConfig();if(null!==i){var o=this.getTask(i);a.scroll_on_click&&!e._is_icon_open_click(n)&&this.showDate(o.start_date),e.callEvent("onTaskRowClick",[i,r])}},e),t.$grid),this._mouseDelegates.delegate("click","gantt_grid_head_cell",e.bind(function(n,i,r){var a=r.getAttribute("data-column-id");if(e.callEvent("onGridHeaderClick",[a,n])){var o=t.$getConfig();if("add"!=a){if(o.sort&&a){for(var s,l=a,c=0;c",a.setAttribute(r.task_grid_row_resizer_attribute,e.id),t._waiAria.gridSeparatorAttr(a),a},update:null,getRectangle:i,getVisibleRange:r}}},function(t,e,n){var i=n(20),r=n(5),a=n(19),o=n(18),s=n(30);function l(t,e,n,i){var r=100*(1-(1*t||0)),a=i.posFromDate(e),o=i.posFromDate(n),s=document.createElement("div");return s.className="gantt_histogram_hor_bar",s.style.top=r+"%",s.style.left=a+"px",s.style.width=o-a+1+"px",s}function c(t,e,n){if(t===e)return null;var i=1-Math.max(t,e),r=Math.abs(t-e),a=document.createElement("div");return a.className="gantt_histogram_vert_bar",a.style.top=100*i+"%",a.style.height=100*r+"%",a.style.left=n+"px",a}t.exports=function(t){var e=s(t),n={},d={},u={};function h(t,e){var i=n[t];i&&i[e]&&i[e].parentNode&&i[e].parentNode.removeChild(i[e])}function f(e,n,i,r,o,s,d){var h=u[e.id];h&&h.parentNode&&h.parentNode.removeChild(h);var f=function(e,n,i,r){for(var o=n.getScale(),s=document.createElement("div"),d=a(o,r),u=d.start;u<=d.end;u++){var h=o.trace_x[u],f=o.trace_x[u+1]||t.date.add(h,o.step,o.unit),_=o.trace_x[u].valueOf(),g=Math.min(e[_]/i,1)||0;if(g<0)return null;var p=Math.min(e[f.valueOf()]/i,1)||0,v=l(g,h,f,n);v&&s.appendChild(v);var m=c(g,p,n.posFromDate(f));m&&s.appendChild(m)}return s}(i,o,s,d);return f&&n&&(f.setAttribute("data-resource-id",e.id),f.setAttribute(o.$config.item_attribute,e.id),f.style.position="absolute",f.style.top=n.top+1+"px",f.style.height=o.getItemHeight(e.id)-1+"px",f.style.left=0),f}function _(t,e,n,i,r,a,o){var s=r.histogram_cell_class(a.start_date,a.end_date,t,a.tasks,a.assignments),l=r.histogram_cell_label(a.start_date,a.end_date,t,a.tasks,a.assignments),c=r.histogram_cell_allocated(a.start_date,a.end_date,t,a.tasks,a.assignments),d=o.getItemHeight(t.id)-1;if(s||l){var u=document.createElement("div");return u.className=["gantt_histogram_cell",s].join(" "),u.setAttribute(o.$config.item_attribute,t.id),u.style.cssText=["left:"+e.left+"px","width:"+e.width+"px","height:"+d+"px","line-height:"+d+"px","top:"+(e.top+1)+"px"].join(";"),l&&(l="
"+l+"
"),c&&(l="
"+l),l&&(u.innerHTML=l),u}return null}return{render:function(i,r,s,l){var c=r.$getTemplates(),h=r.getScale(),g=e(i,s.resource_property,h,r),p=[],v={},m=i.capacity||r.$config.capacity||24;n[i.id]={},d[i.id]=null,u[i.id]=null;for(var y=!!l,k=a(h,l),b=k.start;b<=k.end;b++){var w=g[b];if(w&&(!y||o(b,h,l,t))){var x=c.histogram_cell_capacity(w.start_date,w.end_date,i,w.tasks,w.assignments);v[w.start_date.valueOf()]=x||0;var $=r.getItemPosition(i,w.start_date,w.end_date),S=_(i,$,m,0,c,w,r);S&&(p.push(S),n[i.id][b]=S)}}var T=null;if(p.length){T=document.createElement("div");for(var C=0;C",f=""):(h=g.template?g.template(e):e[g.name],r.isDate(h)&&(h=s.date_grid(h,e,g.name)),null!==h&&void 0!==h||(h=""),f=h,h="
"+h+"
");var p="gantt_cell"+(_?" gantt_last_cell":""),v=[];if(g.tree){p+=" gantt_cell_tree";for(var m=0;m"+v.join("")+"",c.push(u)}switch(p="",l.$config.name){case"task":p=t.getGlobalTaskIndex(e.id)%2==0?"":" odd";break;case"resource":p=l.visibleOrder.indexOf(e.id)%2==0?"":" odd"}if(p+=e.$transparent?" gantt_transparent":"",p+=e.$dataprocessor_class?" "+e.$dataprocessor_class:"",s.grid_row_class){var w=s.grid_row_class.call(t,e.start_date,e.end_date,e);w&&(p+=" "+w)}l.isSelected(e.id)&&(p+=" gantt_selected");var x=document.createElement("div");x.className="gantt_row"+p+" gantt_row_"+t.getTaskType(e.type);var $=n.getItemHeight(e.id);return x.style.height=$+"px",x.style.lineHeight=$+"px",i.smart_rendering&&(x.style.position="absolute",x.style.left="0px",x.style.top=n.getItemTop(e.id)+"px"),n.$config.item_attribute&&(x.setAttribute(n.$config.item_attribute,e.id),x.setAttribute(n.$config.bind+"_id",e.id)),t._waiAria.taskRowAttr(e,x),x.innerHTML=c.join(""),x},update:null,getRectangle:a,getVisibleRange:o,onrender:function(e,n,r){for(var a=r.getGridColumns(),o=0;ot.x?this.dirs.right:e.y>t.y?this.dirs.down:this.dirs.up}},n={path:[],clear:function(){this.path=[]},current:function(){return this.path[this.path.length-1]},point:function(e){return e?(this.path.push(t.copy(e)),e):this.current()},point_to:function(n,i,r){r=r?{x:r.x,y:r.y}:t.copy(this.point());var a=e.dirs;switch(n){case a.left:r.x-=i;break;case a.right:r.x+=i;break;case a.up:r.y-=i;break;case a.down:r.y+=i}return this.point(r)},get_points:function(n,i,r,a){var o=this.get_endpoint(n,i,r,a),s=t.config,l=o.e_y-o.y,c=o.e_x-o.x,d=e.dirs,u=i.getItemHeight(n.source);this.clear(),this.point({x:o.x,y:o.y});var h=2*s.link_arrow_size,f=this.get_line_type(n,i.$getConfig()),_=o.e_x>o.x;if(f.from_start&&f.to_start)this.point_to(d.left,h),_?(this.point_to(d.down,l),this.point_to(d.right,c)):(this.point_to(d.right,c),this.point_to(d.down,l)),this.point_to(d.right,h);else if(!f.from_start&&f.to_start)if(_=o.e_x>o.x+2*h,this.point_to(d.right,h),_)c-=h,this.point_to(d.down,l),this.point_to(d.right,c);else{c-=2*h;var g=l>0?1:-1;this.point_to(d.down,g*(u/2)),this.point_to(d.right,c),this.point_to(d.down,g*(Math.abs(l)-u/2)),this.point_to(d.right,h)}else f.from_start||f.to_start?f.from_start&&!f.to_start&&(_=o.e_x>o.x-2*h,this.point_to(d.left,h),_?(c+=2*h,g=l>0?1:-1,this.point_to(d.down,g*(u/2)),this.point_to(d.right,c),this.point_to(d.down,g*(Math.abs(l)-u/2)),this.point_to(d.left,h)):(c+=h,this.point_to(d.down,l),this.point_to(d.right,c))):(this.point_to(d.right,h),_?(this.point_to(d.right,c),this.point_to(d.down,l)):(this.point_to(d.down,l),this.point_to(d.right,c)),this.point_to(d.left,h));return this.path},get_line_type:function(e,n){var i=n.links,r=!1,a=!1;return e.type==i.start_to_start?r=a=!0:e.type==i.finish_to_finish?r=a=!1:e.type==i.finish_to_start?(r=!1,a=!0):e.type==i.start_to_finish?(r=!0,a=!1):t.assert(!1,"Invalid link type"),n.rtl&&(r=!r,a=!a),{from_start:r,to_start:a}},get_endpoint:function(t,e,n,i){var r=e.$getConfig(),o=this.get_line_type(t,r),s=o.from_start,l=o.to_start,c=a(n,e,r),d=a(i,e,r);return{x:s?c.left:c.left+c.width,e_x:l?d.left:d.left+d.width,y:c.top+c.rowHeight/2-1,e_y:d.top+d.rowHeight/2-1}}};function a(e,n,i){var r=n.getItemPosition(e);if(t.getTaskType(e.type)==i.types.milestone){var a=n.getBarHeight(e.id,!0),o=Math.sqrt(2*a*a);r.left-=o/2,r.width=o}return r}return{render:function(i,r,a){var o=t.getTask(i.source);if(!o.hide_bar){var s=t.getTask(i.target);if(!s.hide_bar){var l=n.get_endpoint(i,r,o,s),c=l.e_y-l.y;if(!(l.e_x-l.x||c))return null;var d=n.get_points(i,r,o,s),u=e.get_lines(d,r),h=document.createElement("div"),f="gantt_task_link";i.color&&(f+=" gantt_link_inline_color");var _=t.templates.link_class?t.templates.link_class(i):"";_&&(f+=" "+_),a.highlight_critical_path&&t.isCriticalLink&&t.isCriticalLink(i)&&(f+=" gantt_critical_link"),h.className=f,r.$config.link_attribute&&(h.setAttribute(r.$config.link_attribute,i.id),h.setAttribute("link_id",i.id));for(var g=0;gv.end)&&d(t.id,y)}n[t.id]={};for(var k=v.start;k<=v.end;k++){var b=f(l,k,t,s,_,g,p,a);!b&&c(t,k)?d(t.id,k):b&&!b.parentNode&&i.appendChild(b)}}},getRectangle:i,getVisibleRange:a,prepareData:l}}},function(t,e,n){var i=n(21),r=n(13),a=n(5);t.exports=function(t){var e=i(t);return{render:function(n,i){if(!1!==n.rollup&&n.$rollup&&n.$rollup.length){var r=document.createElement("div"),a=t.getTaskPosition(n);return n.$rollup.forEach(function(o){var s=t.copy(t.getTask(o));if(s.$rendered_at=n.id,!1!==t.callEvent("onBeforeRollupTaskDisplay",[s.id,s,n.id])){var l=e(s,i);if(l){var c=i.getBarHeight(n.id,s.type==t.config.types.milestone),d=Math.floor((i.getItemHeight(n.id)-c)/2);l.style.top=a.top+d+"px",l.classList.add("gantt_rollup_child"),l.setAttribute("data-rollup-parent-id",n.id),r.appendChild(l)}}}),r}return!1},update:null,isInViewPort:r,getVisibleRange:a}}},function(t,e,n){var i=n(13);t.exports=function(t,e,n,r,a){if(!a.isSplitTask(t))return!1;var o=a.getSubtaskDates(t.id);return i({id:t.id,start_date:o.start_date,end_date:o.end_date,parent:t.parent},e,n,a)}},function(t,e,n){var i=n(21),r=n(5),a=n(92),o=n(13);t.exports=function(t){var e=i(t),n={};function s(t,e,n,i,r){var a=!t.hide_bar;return i.smart_rendering&&a&&(a=o(t,e,n,i,r)),a}function l(n,i,r,a){if(!i.hide_bar){var o=t.isSummaryTask(i);o&&t.resetProjectDates(i);var s=t.copy(t.getTask(i.id));if(s.$rendered_at=n.id,!1!==t.callEvent("onBeforeSplitTaskDisplay",[s.id,s,n.id])){var l=e(s,r);if(l){var c=r.getBarHeight(n.id,i.type==t.config.types.milestone),d=Math.floor((r.getItemHeight(n.id)-c)/2);return l.style.top=a.top+d+"px",l.classList.add("gantt_split_child"),o&&l.classList.add("gantt_split_subproject"),l}}}}function c(t,e){return t+"_"+e}function d(e,n){return t.isSplitTask(e)&&(n.open_split_tasks&&!e.$open||!n.open_split_tasks)&&t.hasChild(e.id)}return{render:function(e,i,r,a){if(d(e,r)){var o=document.createElement("div"),u=t.getTaskPosition(e);return t.hasChild(e.id)&&t.eachTask(function(d){if(s(d,a,i,r,t)){var h=l(e,d,i,u);h?(n[c(d.id,e.id)]=h,o.appendChild(h)):n[c(d.id,e.id)]=!1}},e.id),o}return!1},update:function(e,i,r,a,o){if(d(e,a)){var u=document.createElement("div"),h=t.getTaskPosition(e);t.eachTask(function(d){var f=c(d.id,e.id),_=s(d,o,r,a,t);if(_!==!!n[f])if(_){var g=l(e,d,r,h);n[f]=g||!1}else n[f]=!1;n[f]&&u.appendChild(n[f]),i.innerHTML=u.innerHTML},e.id)}},isInViewPort:a,getVisibleRange:r}}},function(t,e,n){var i=n(13),r=n(5),a=n(21);t.exports=function(t){return{render:a(t),update:null,isInViewPort:i,getVisibleRange:r}}},function(t,e){t.exports=function(t){return function(n,i,r){"keepDates"==r?function(e,n){"duration"==n?e.end_date=t.calculateEndDate(e):"end_date"!=n&&"start_date"!=n||(e.duration=t.calculateDuration(e))}(n,i):"keepDuration"==r?function(n,i){"end_date"==i?n.start_date=e(n):"start_date"!=i&&"duration"!=i||(n.end_date=t.calculateEndDate(n))}(n,i):function(n,i){t.config.schedule_from_end?"end_date"==i||"duration"==i?n.start_date=e(n):"start_date"==i&&(n.duration=t.calculateDuration(n)):"start_date"==i||"duration"==i?n.end_date=t.calculateEndDate(n):"end_date"==i&&(n.duration=t.calculateDuration(n))}(n,i)};function e(e){return t.calculateEndDate({start_date:e.end_date,duration:-e.duration,task:e})}}},function(t,e,n){t.exports=function(t){var e=n(7)(t),i=n(0);function r(){return e.apply(this,arguments)||this}function a(e){return e.formatter||t.ext.formatters.durationFormatter()}return n(3)(r,e),i.mixin(r.prototype,{show:function(t,e,n,i){var r="
";i.innerHTML=r},set_value:function(t,e,n,i){this.get_input(i).value=a(n.editor).format(t)},get_value:function(t,e,n){return a(e.editor).parse(this.get_input(n).value||"")}},!0),r}},function(t,e,n){t.exports=function(t){var e=n(7)(t),i=n(0);function r(){return e.apply(this,arguments)||this}function a(e){return e.formatter||t.ext.formatters.linkFormatter()}function o(t,e){for(var n=(t||"").split(e.delimiter||","),i=0;i";i.innerHTML=r},hide:function(){},set_value:function(e,n,i,r){this.get_input(r).value=s(e,i.editor,t)},get_value:function(t,e,n){return o(this.get_input(n).value||"",e.editor)},save:function(e,n,i){var r=c(t.getTask(e),this.get_value(e,n,i),n.editor);(r.add.length||r.remove.length)&&t.batchUpdate(function(){r.add.forEach(function(e){t.addLink(e)}),r.remove.forEach(function(e){t.deleteLink(e)}),t.autoSchedule&&t.autoSchedule()})},is_changed:function(e,n,i,r){var a=this.get_value(n,i,r),l=o(s(e,i.editor,t),i.editor);return a.join()!==l.join()}},!0),r}},function(t,e,n){t.exports=function(t){var e=n(7)(t),i=n(0),r="%Y-%m-%d",a=null,o=null;function s(){return e.apply(this,arguments)||this}return n(3)(s,e),i.mixin(s.prototype,{show:function(e,n,i,s){a||(a=t.date.date_to_str(r)),o||(o=t.date.str_to_date(r));var l=null,c=null;l="function"==typeof i.min?i.min(e,n):i.min,c="function"==typeof i.max?i.max(e,n):i.max;var d="
";s.innerHTML=d},set_value:function(t,e,n,i){t&&t.getFullYear?this.get_input(i).value=a(t):this.get_input(i).value=t},is_valid:function(t,e,n,i){return!(!t||isNaN(t.getTime()))},get_value:function(t,e,n){var i;try{i=o(this.get_input(n).value||"")}catch(t){i=null}return i}},!0),s}},function(t,e,n){t.exports=function(t){var e=n(7)(t),i=n(0);function r(){return e.apply(this,arguments)||this}return n(3)(r,e),i.mixin(r.prototype,{show:function(t,e,n,i){for(var r="
",i.innerHTML=r},get_input:function(t){return t.querySelector("select")}},!0),r}},function(t,e,n){t.exports=function(t){var e=n(7)(t),i=n(0);function r(){return e.apply(this,arguments)||this}return n(3)(r,e),i.mixin(r.prototype,{show:function(t,e,n,i){var r="
";i.innerHTML=r},get_value:function(t,e,n){return this.get_input(n).value||""},is_valid:function(t,e,n,i){return!isNaN(parseInt(t,10))}},!0),r}},function(t,e,n){t.exports=function(t){var e=n(7)(t),i=n(0);function r(){return e.apply(this,arguments)||this}return n(3)(r,e),i.mixin(r.prototype,{show:function(t,e,n,i){var r="
";i.innerHTML=r}},!0),r}},function(t,e){t.exports={init:function(t,e){var n=t,i=e.$gantt,r=null,a=i.ext.keyboardNavigation;a.attachEvent("onBeforeFocus",function(e){var i=t.locateCell(e);if(clearTimeout(r),i){var a=i.columnName,o=i.id,s=n.getState();if(n.isVisible()&&s.id==o&&s.columnName===a)return!1}return!0}),a.attachEvent("onFocus",function(e){var i=t.locateCell(e),a=t.getState();return clearTimeout(r),!i||i.id==a.id&&i.columnName==a.columnName||n.isVisible()&&n.save(),!0}),t.attachEvent("onHide",function(){clearTimeout(r)}),a.attachEvent("onBlur",function(){return r=setTimeout(function(){n.save()}),!0}),i.attachEvent("onTaskDblClick",function(e,n){var i=t.getState(),r=t.locateCell(n.target);return!r||!t.isVisible()||r.columnName!=i.columnName}),i.attachEvent("onTaskClick",function(e,n){if(i._is_icon_open_click(n))return!0;var r=t.getState(),a=t.locateCell(n.target);return!a||!t.getEditorConfig(a.columnName)||(t.isVisible()&&r.id==a.id&&r.columnName==a.columnName||t.startEdit(a.id,a.columnName),!1)}),i.attachEvent("onEmptyClick",function(){return n.save(),!0}),a.attachEvent("onKeyDown",function(e,r){var o=t.locateCell(r.target),s=!!o&&t.getEditorConfig(o.columnName),l=t.getState(),c=i.constants.KEY_CODES,d=r.keyCode,u=!1;switch(d){case c.ENTER:t.isVisible()?(t.save(),r.preventDefault(),u=!0):s&&!(r.ctrlKey||r.metaKey||r.shiftKey)&&(n.startEdit(o.id,o.columnName),r.preventDefault(),u=!0);break;case c.ESC:t.isVisible()&&(t.hide(),r.preventDefault(),u=!0);break;case c.UP:case c.DOWN:break;case c.LEFT:case c.RIGHT:(s&&t.isVisible()||"date"===l.editorType)&&(u=!0);break;case c.SPACE:t.isVisible()&&(u=!0),s&&!t.isVisible()&&(n.startEdit(o.id,o.columnName),r.preventDefault(),u=!0);break;case c.DELETE:s&&!t.isVisible()?(n.startEdit(o.id,o.columnName),u=!0):s&&t.isVisible()&&(u=!0);break;case c.TAB:if(t.isVisible()){r.shiftKey?t.editPrevCell(!0):t.editNextCell(!0);var h=t.getState();h.id&&a.focus({type:"taskCell",id:h.id,column:h.columnName}),r.preventDefault(),u=!0}break;default:if(t.isVisible())u=!0;else if(d>=48&&d<=57||d>95&&d<112||d>=64&&d<=91||d>185&&d<193||d>218&&d<223){var f=e.modifiers,_=f.alt||f.ctrl||f.meta||f.shift;f.alt||_&&a.getCommandHandler(e,"taskCell")||s&&!t.isVisible()&&(n.startEdit(o.id,o.columnName),u=!0)}}return!u})},onShow:function(t,e,n){},onHide:function(t,e,n){n.$gantt.focus()},destroy:function(){}}},function(t,e){t.exports={init:function(t,e){var n=e.$gantt;n.attachEvent("onTaskClick",function(e,i){if(n._is_icon_open_click(i))return!0;var r=t.getState(),a=t.locateCell(i.target);return!a||!t.getEditorConfig(a.columnName)||(t.isVisible()&&r.id==a.id&&r.columnName==a.columnName||t.startEdit(a.id,a.columnName),!1)}),n.attachEvent("onEmptyClick",function(){return t.isVisible()&&t.isChanged()?t.save():t.hide(),!0}),n.attachEvent("onTaskDblClick",function(e,n){var i=t.getState(),r=t.locateCell(n.target);return!r||!t.isVisible()||r.columnName!=i.columnName})},onShow:function(t,e,n){var i=n.$gantt;i.ext&&i.ext.keyboardNavigation&&i.ext.keyboardNavigation.attachEvent("onKeyDown",function(e,n){var r=i.constants.KEY_CODES,a=!1;switch(n.keyCode){case r.SPACE:t.isVisible()&&(a=!0)}return!a});e.onkeydown=function(e){e=e||window.event;var n=i.constants.KEY_CODES;if(!(e.defaultPrevented||e.shiftKey&&e.keyCode!=n.TAB)){var r=!0;switch(e.keyCode){case i.keys.edit_save:t.save();break;case i.keys.edit_cancel:t.hide();break;case n.UP:case n.DOWN:t.isVisible()&&(t.hide(),r=!1);break;case n.TAB:e.shiftKey?t.editPrevCell(!0):t.editNextCell(!0);break;default:r=!1}r&&e.preventDefault()}}},onHide:function(){},destroy:function(){}}},function(t,e,n){var i=n(103),r=n(102);t.exports=function(t){var e=null;return{setMapping:function(t){e=t},getMapping:function(){return e||(t.config.keyboard_navigation_cells&&t.ext.keyboardNavigation?r:i)}}}},function(t,e,n){var i=n(104),r=n(101),a=n(100),o=n(99),s=n(98),l=n(97),c=n(96),d=n(0),u=n(1),h=n(4),f=n(95);function _(t){t.config.editor_types={text:new(r(t)),number:new(a(t)),select:new(o(t)),date:new(s(t)),predecessor:new(l(t)),duration:new(c(t))}}t.exports=function(t){var e=i(t),n={};h(n);var r={init:_,createEditors:function(i){function r(t,e){var n=i.$getConfig(),r=function(t,e){for(var n=i.$getConfig(),r=i.getItemTop(t),a=i.getItemHeight(t),o=i.getGridColumns(),s=0,l=0,c=0,d=0;d0?t.getNext:t.getPrev,i=(n=t.bind(n,t))(this._itemId);t.isTaskExists(i)&&t.isReadonly(t.getTask(i));)i=n(i);return i},editNextRow:function(e){var n=this.getState().id;if(t.isTaskExists(n)){var i=null;i=e?this.moveRow(1):t.getNext(n),t.isTaskExists(i)&&this.startEdit(i,this._columnName)}},editPrevRow:function(e){var n=this.getState().id;if(t.isTaskExists(n)){var i=null;i=e?this.moveRow(-1):t.getPrev(n),t.isTaskExists(i)&&this.startEdit(i,this._columnName)}},destructor:function(){o.forEach(function(t){l.detachEvent(t)}),s.forEach(function(e){t.detachEvent(e)}),o=[],s=[],l=null,this.hide(),this.detachAllEvents()}};return d.mixin(c,e),d.mixin(c,n),c}};return d.mixin(r,e),d.mixin(r,n),r}},function(t,e){t.exports={create:function(){return{render:function(){},destroy:function(){}}}}},function(t,e,n){var i=n(3),r=n(1),a=n(0),o=n(8),s=function(t){"use strict";var e=["altKey","shiftKey","metaKey"];function n(e,n,i,r){var o=t.apply(this,arguments)||this;this.$config=a.mixin(n,{scroll:"x"}),o._scrollHorizontalHandler=a.bind(o._scrollHorizontalHandler,o),o._scrollVerticalHandler=a.bind(o._scrollVerticalHandler,o),o._outerScrollVerticalHandler=a.bind(o._outerScrollVerticalHandler,o),o._outerScrollHorizontalHandler=a.bind(o._outerScrollHorizontalHandler,o),o._mouseWheelHandler=a.bind(o._mouseWheelHandler,o),this.$config.hidden=!0;var s=r.config.scroll_size;return r.env.isIE&&(s+=1),this._isHorizontal()?(o.$config.height=s,o.$parent.$config.height=s):(o.$config.width=s,o.$parent.$config.width=s),this.$config.scrollPosition=0,o.$name="scroller",o}return i(n,t),n.prototype.init=function(t){t.innerHTML=this.$toHTML(),this.$view=t.firstChild,this.$view||this.init(),this._isVertical()?this._initVertical():this._initHorizontal(),this._initMouseWheel(),this._initLinkedViews()},n.prototype.$toHTML=function(){return"
"},n.prototype._getRootParent=function(){for(var t=this.$parent;t&&t.$parent;)t=t.$parent;if(t)return t},n.prototype._eachView=function(){var t=[];return function t(e,n){if(n.push(e),e.$cells)for(var i=0;iu[s]&&u[o]>e&&d>u[s]-l+2&&(e=d+(i?0:2),n=u[s]);else{var h=Math.max(u[o]-d,0);(d+=h)>Math.max(u[s]-h,0)&&d>e&&(e=d,n=u[s])}}return{outerScroll:n,innerScroll:e}},n.prototype.scroll=function(t){this._isHorizontal()?this.scrollHorizontally(t):this.scrollVertically(t)},n.prototype.getScrollState=function(){return{visible:this.isVisible(),direction:this.$config.scroll,size:this.$config.outerSize,scrollSize:this.$config.scrollSize||0,position:this.$config.scrollPosition||0}},n.prototype.setSize=function(e,n){t.prototype.setSize.apply(this,arguments);var i=this._getScrollSize(),r=(this._isVertical()?n:e)-this._getScrollOffset()+(this._isHorizontal()?1:0);i.innerScroll&&r>i.outerScroll&&(i.innerScroll+=r-i.outerScroll),this.$config.scrollSize=i.innerScroll,this.$config.width=e,this.$config.height=n,this._setScrollSize(i.innerScroll)},n.prototype.isVisible=function(){return!(!this.$parent||!this.$parent.$view.parentNode)},n.prototype.shouldShow=function(){var t=this._getScrollSize();return!(!t.innerScroll&&this.$parent&&this.$parent.$view.parentNode)&&!(!t.innerScroll||this.$parent&&this.$parent.$view.parentNode)},n.prototype.shouldHide=function(){return!(this._getScrollSize().innerScroll||!this.$parent||!this.$parent.$view.parentNode)},n.prototype.toggleVisibility=function(){this.shouldHide()?this.hide():this.shouldShow()&&this.show()},n.prototype._getScaleOffset=function(t){var e=0;return!t||"timeline"!=t.$config.view&&"grid"!=t.$config.view||(e=t.$content.$getConfig().scale_height),e},n.prototype._getScrollOffset=function(){var t=0;if(this._isVertical()){var e=this.$parent.$parent;t=Math.max(this._getScaleOffset(e.getPrevSibling(this.$parent.$id)),this._getScaleOffset(e.getNextSibling(this.$parent.$id)))}else for(var n=this._getLinkedViews(),i=0;i=0&&(!t[f]||t.deltaX||t.wheelDeltaX||(u=2*h,h=0)),u&&Math.abs(u)>Math.abs(h)){if(this._isVertical())return;if(i.x)return!0;if(!this.$scroll_hor||!this.$scroll_hor.offsetWidth)return!0;var _=u/-40,g=this._oldLeft,p=g+30*_;if(this.scrollHorizontally(p),this.$scroll_hor.scrollLeft=p,g==this.$scroll_hor.scrollLeft)return!0;this._oldLeft=this.$scroll_hor.scrollLeft}else{if(this._isHorizontal())return;if(i.y)return!0;if(!this.$scroll_ver||!this.$scroll_ver.offsetHeight)return!0;_=h/-40;void 0===h&&(_=t.detail);var v=this._oldTop,m=this.$scroll_ver.scrollTop+30*_;if(this.scrollVertically(m),this.$scroll_ver.scrollTop=m,v==this.$scroll_ver.scrollTop)return!0;this._oldTop=this.$scroll_ver.scrollTop}return t.preventDefault&&t.preventDefault(),t.cancelBubble=!0,!1}},n}(n(9));t.exports=s},function(t,e){t.exports=null},function(t,e,n){var i=n(3),r=n(0),a=function(t){"use strict";function e(e,n,i){var a=t.apply(this,arguments)||this;if(n.view){n.id&&(this.$id=r.uid());var o=r.copy(n);if(delete o.config,delete o.templates,this.$content=this.$factory.createView(n.view,this,o,this),!this.$content)return!1}return a.$name="viewCell",a}return i(e,t),e.prototype.destructor=function(){this.clear(),t.prototype.destructor.call(this)},e.prototype.clear=function(){if(this.$initialized=!1,this.$content){var e=this.$content.unload||this.$content.destructor;e&&e.call(this.$content)}t.prototype.clear.call(this)},e.prototype.scrollTo=function(e,n){this.$content&&this.$content.scrollTo?this.$content.scrollTo(e,n):t.prototype.scrollTo.call(this,e,n)},e.prototype._setContentSize=function(t,e){var n=this._getBorderSizes();if("number"==typeof t){var i=t+n.horizontal;this.$config.width=i}if("number"==typeof e){var r=e+n.vertical;this.$config.height=r}},e.prototype.setSize=function(e,n){if(t.prototype.setSize.call(this,e,n),!this.$preResize&&this.$content&&!this.$initialized){this.$initialized=!0;var i=this.$view.childNodes[0],r=this.$view.childNodes[1];r||(r=i),this.$content.init(r)}},e.prototype.setContentSize=function(){!this.$preResize&&this.$content&&this.$initialized&&this.$content.setSize(this.$lastSize.contentX,this.$lastSize.contentY)},e.prototype.getContentSize=function(){var e=t.prototype.getContentSize.call(this);if(this.$content&&this.$initialized){var n=this.$content.getSize();e.width=void 0===n.contentX?n.width:n.contentX,e.height=void 0===n.contentY?n.height:n.contentY}var i=this._getBorderSizes();return e.width+=i.horizontal,e.height+=i.vertical,e},e}(n(9));t.exports=a},function(t,e,n){var i=n(3),r=n(31),a=n(9),o=function(t){"use strict";function e(e,n,i){for(var r=t.apply(this,arguments)||this,a=0;at.x_end||e.left+e.widtht.y_end||e.top+e.height-1&&r.click?r.click():(o(n,!0),i=!0)}27==e&&(o(n,!1),i=!0)}return i?(t.preventDefault&&t.preventDefault(),!(t.cancelBubble=!0)):void 0}}var l=a.getRootNode(t.$root)||document;function c(t){c.cover||(c.cover=document.createElement("div"),c.cover.onkeydown=s,c.cover.className="dhx_modal_cover",document.body.appendChild(c.cover)),c.cover.style.display=t?"inline-block":"none"}function d(e,n,i){return"
"+e+"
"}function u(e){k.area||(k.area=document.createElement("div"),k.area.className="gantt_message_area",k.area.style[k.position]="5px",document.body.appendChild(k.area)),k.hide(e.id);var n=document.createElement("div");return n.innerHTML="
"+e.text+"
",n.className="gantt-info gantt-"+e.type,n.onclick=function(){k.hide(e.id),e=null},t._waiAria.messageInfoAttr(n),"bottom"==k.position&&k.area.firstChild?k.area.insertBefore(n,k.area.firstChild):k.area.appendChild(n),e.expire>0&&(k.timers[e.id]=window.setTimeout(function(){k&&k.hide(e.id)},e.expire)),k.pull[e.id]=n,n=null,e.id}function h(){for(var t=[].slice.apply(arguments,[0]),e=0;e'+s.title+""),_+='
'+(s.content?"":s.text)+'
',l&&(_+=d(h(s.ok,t.locale.labels.message_ok,"OK"),"ok",!0)),c&&(_+=d(h(s.cancel,t.locale.labels.message_cancel,"Cancel"),"cancel",!1)),s.buttons)for(var g=0;g",u.innerHTML=_,s.content){var v=s.content;"string"==typeof v&&(v=document.getElementById(v)),"none"==v.style.display&&(v.style.display=""),u.childNodes[s.title?1:0].appendChild(v)}return u.onclick=function(t){var e=t.target||t.srcElement;if(e.className||(e=e.parentNode),a.closest(e,".gantt_popup_button")){var n=e.getAttribute("data-result");o(s,n="true"==n||"false"!=n&&n)}},s.box=u,(l||c)&&(n=s),u}(l,u,f);l.hidden||c(!0),document.body.appendChild(_);var g=Math.abs(Math.floor(((window.innerWidth||document.documentElement.offsetWidth)-_.offsetWidth)/2)),p=Math.abs(Math.floor(((window.innerHeight||document.documentElement.offsetHeight)-_.offsetHeight)/2));return"top"==l.position?_.style.top="-3px":_.style.top=p+"px",_.style.left=g+"px",_.onkeydown=s,y.focus(_),l.hidden&&y.hide(_),t.callEvent("onMessagePopup",[_]),_}function _(t){return f(t,!0,!1)}function g(t){return f(t,!0,!0)}function p(t){return f(t)}function v(t,e,n){return"object"!=i(t)&&("function"==typeof e&&(n=e,e=""),t={text:t,type:e,callback:n}),t}function m(t,e,n,a){return"object"!=i(t)&&(t={text:t,type:e,expire:n,id:a}),t.id=t.id||r.uid(),t.expire=t.expire||k.expire,t}t.event(l,"keydown",s,!0);var y=function(){var t=v.apply(this,arguments);return t.type=t.type||"alert",p(t)};y.hide=function(n){for(;n&&n.getAttribute&&!n.getAttribute(e);)n=n.parentNode;n&&(n.parentNode.removeChild(n),c(!1),t.callEvent("onAfterMessagePopup",[n]))},y.focus=function(t){setTimeout(function(){var e=a.getFocusableNodes(t);e.length&&e[0].focus&&e[0].focus()},1)};var k=function(t,e,n,i){switch((t=m.apply(this,arguments)).type=t.type||"info",t.type.split("-")[0]){case"alert":return _(t);case"confirm":return g(t);case"modalbox":return p(t);default:return u(t)}};k.seed=(new Date).valueOf(),k.uid=r.uid,k.expire=4e3,k.keyboard=!0,k.position="top",k.pull={},k.timers={},k.hideAll=function(){for(var t in k.pull)k.hide(t)},k.hide=function(t){var e=k.pull[t];e&&e.parentNode&&(window.setTimeout(function(){e.parentNode.removeChild(e),e=null},2e3),e.className+=" hidden",k.timers[t]&&window.clearTimeout(k.timers[t]),delete k.pull[t])};var b=[];return t.attachEvent("onMessagePopup",function(t){b.push(t)}),t.attachEvent("onAfterMessagePopup",function(t){for(var e=0;e3600&&o<86400){var s=e.getTimezoneOffset()-n;s&&(e=t.date.add(e,s,"minute"))}return e},t.isSplitTask=function(e){return t.assert(e&&e instanceof Object,"Invalid argument task="+e+" of gantt.isSplitTask. Task object was expected"),this.$data.tasksStore._isSplitItem(e)},t._is_icon_open_click=function(t){if(!t)return!1;var e=t.target||t.srcElement;if(!e||!e.className)return!1;var n=r.getClassName(e);return-1!==n.indexOf("gantt_tree_icon")&&(-1!==n.indexOf("gantt_close")||-1!==n.indexOf("gantt_open"))}}},function(t,e){t.exports=function(t){function e(){return t._cached_functions.update_if_changed(t),t._cached_functions.active||t._cached_functions.activate(),!0}t._cached_functions={cache:{},mode:!1,critical_path_mode:!1,wrap_methods:function(t,e){if(e._prefetch_originals)for(var n in e._prefetch_originals)e[n]=e._prefetch_originals[n];e._prefetch_originals={};for(n=0;ntask="+e+" of gantt.isUnscheduledTask. Task object was expected"),!!e.unscheduled||!e.start_date},t._isAllowedUnscheduledTask=function(e){return!(!e.unscheduled||!t.config.show_unscheduled)},t._isTaskInTimelineLimits=function(t){var e=t.start_date?t.start_date.valueOf():null,n=t.end_date?t.end_date.valueOf():null;return!!(e&&n&&e<=this._max_date.valueOf()&&n>=this._min_date.valueOf())},t.isTaskVisible=function(t){if(!this.isTaskExists(t))return!1;var e=this.getTask(t);return!(!this._isAllowedUnscheduledTask(e)&&!this._isTaskInTimelineLimits(e))&&!!(this.getGlobalTaskIndex(t)>=0)},t._getProjectEnd=function(){if(t.config.project_end)return t.config.project_end;var e=t.getTaskByTime();return(e=e.sort(function(t,e){return+t.end_date>+e.end_date?1:-1})).length?e[e.length-1].end_date:null},t._getProjectStart=function(){if(t.config.project_start)return t.config.project_start;if(t.config.start_date)return t.config.start_date;if(t.getState().min_date)return t.getState().min_date;var e=t.getTaskByTime();return(e=e.sort(function(t,e){return+t.start_date>+e.start_date?1:-1})).length?e[0].start_date:null};var e=function(e,n){var i=!!(n&&n!=t.config.root_id&&t.isTaskExists(n))&&t.getTask(n),r=null;if(i)r=t.config.schedule_from_end?t.calculateEndDate({start_date:i.end_date,duration:-t.config.duration_step,task:e}):i.start_date;else if(t.config.schedule_from_end)r=t.calculateEndDate({start_date:t._getProjectEnd(),duration:-t.config.duration_step,task:e});else{var a=t.getTaskByIndex(0);r=a?a.start_date?a.start_date:a.end_date?t.calculateEndDate({start_date:a.end_date,duration:-t.config.duration_step,task:e}):null:t.config.start_date||t.getState().min_date}return t.assert(r,"Invalid dates"),new Date(r)};t._set_default_task_timing=function(n){n.start_date=n.start_date||e(n,t.getParent(n)),n.duration=n.duration||t.config.duration_step,n.end_date=n.end_date||t.calculateEndDate(n)},t.createTask=function(n,i,r){(n=n||{},t.defined(n.id)||(n.id=t.uid()),n.start_date||(n.start_date=e(n,i)),void 0===n.text&&(n.text=t.locale.labels.new_task),void 0===n.duration&&(n.duration=1),this.isTaskExists(i))&&(this.setParent(n,i,!0),this.getTask(i).$open=!0);if(!this.callEvent("onTaskCreated",[n]))return null;if(this.config.details_on_create){if(t.isTaskExists(n.id))t.getTask(n.id).$index!=n.$index&&(n.start_date&&"string"==typeof n.start_date&&(n.start_date=this.date.parseDate(n.start_date,"parse_date")),n.end_date&&"string"==typeof n.end_date&&(n.end_date=this.date.parseDate(n.end_date,"parse_date")),this.$data.tasksStore.updateItem(n.id,n));else n.$new=!0,this.silent(function(){t.$data.tasksStore.addItem(n,r)});this.selectTask(n.id),this.refreshData(),this.showLightbox(n.id)}else this.addTask(n,i,r)&&(this.showTask(n.id),this.selectTask(n.id));return n.id},t._update_flags=function(e,n){var i=t.$data.tasksStore;void 0===e?(this._lightbox_id=null,i.silent(function(){i.unselect()}),this.getSelectedTasks&&this._multiselect.reset(),this._tasks_dnd&&this._tasks_dnd.drag&&(this._tasks_dnd.drag.id=null)):(this._lightbox_id==e&&(this._lightbox_id=n),i.getSelectedId()==e&&i.silent(function(){i.unselect(e),i.select(n)}),this._tasks_dnd&&this._tasks_dnd.drag&&this._tasks_dnd.drag.id==e&&(this._tasks_dnd.drag.id=n))};var n=function(e,n){var i=t.getTaskType(e.type),r={type:i,$no_start:!1,$no_end:!1};return n||i!=e.$rendered_type?(i==t.config.types.project?r.$no_end=r.$no_start=!0:i!=t.config.types.milestone&&(r.$no_end=!(e.end_date||e.duration),r.$no_start=!e.start_date,t._isAllowedUnscheduledTask(e)&&(r.$no_end=r.$no_start=!1)),r):(r.$no_start=e.$no_start,r.$no_end=e.$no_end,r)};function r(e){e.$effective_calendar=t.getTaskCalendar(e).id,e.start_date=t.getClosestWorkTime({dir:"future",date:e.start_date,unit:t.config.duration_unit,task:e}),e.end_date=t.calculateEndDate(e)}function a(e){var n=null,i=null,r=void 0!==e?e:t.config.root_id,a=[];return t.eachTask(function(e){t.getTaskType(e.type)==t.config.types.project||t.isUnscheduledTask(e)||(e.rollup&&a.push(e.id),e.start_date&&!e.$no_start&&(!n||n>e.start_date.valueOf())&&(n=e.start_date.valueOf()),e.end_date&&!e.$no_end&&(!i||itask="+e+" of gantt.isSummaryTask. Task object was expected");var i=n(e);return!(!i.$no_end&&!i.$no_start)},t.resetProjectDates=function(t){var i=n(t);if(i.$no_end||i.$no_start){var r=a(t.id);(function(t,n,i,r){n.$no_start&&(t.start_date=i?new Date(i):e(t,this.getParent(t)));n.$no_end&&(t.end_date=r?new Date(r):this.calculateEndDate({start_date:t.start_date,duration:this.config.duration_step,task:t}));(n.$no_start||n.$no_end)&&this._init_task_timing(t)}).call(this,t,i,r.start_date,r.end_date),t.$rollup=r.rollup}},t.getSubtaskDuration=function(e){var n=0,i=void 0!==e?e:t.config.root_id;return this.eachTask(function(e){this.getTaskType(e.type)==t.config.types.project||this.isUnscheduledTask(e)||(n+=e.duration)},i),n},t.getSubtaskDates=function(t){var e=a(t);return{start_date:e.start_date,end_date:e.end_date}},t._update_parents=function(e,i,r){if(e){var a=this.getTask(e);a.rollup&&(r=!0);var o=this.getParent(a),s=n(a),l=!0;if(r||a.start_date&&a.end_date&&(s.$no_start||s.$no_end)){var c=a.start_date.valueOf(),d=a.end_date.valueOf();t.resetProjectDates(a),r||c!=a.start_date.valueOf()||d!=a.end_date.valueOf()||(l=!1),l&&!i&&this.refreshTask(a.id,!0)}l&&o&&this.isTaskExists(o)&&this._update_parents(o,i,r)}},t.roundDate=function(e){var n=t.getScale();i.isDate(e)&&(e={date:e,unit:n?n.unit:t.config.duration_unit,step:n?n.step:t.config.duration_step});var r,a,o,s=e.date,l=e.step,c=e.unit;if(!n)return s;if(c==n.unit&&l==n.step&&+s>=+n.min_date&&+s<=+n.max_date)o=Math.floor(t.columnIndexByDate(s)),n.trace_x[o]||(o-=1,n.rtl&&(o=0)),a=new Date(n.trace_x[o]),r=t.date.add(a,l,c);else{for(o=Math.floor(t.columnIndexByDate(s)),r=t.date[c+"_start"](new Date(n.min_date)),n.trace_x[o]&&(r=t.date[c+"_start"](n.trace_x[o]));+r<+s;){var d=(r=t.date[c+"_start"](t.date.add(r,l,c))).getTimezoneOffset();r=t._correct_dst_change(r,d,r,c),t.date[c+"_start"]&&(r=t.date[c+"_start"](r))}a=t.date.add(r,-1*l,c)}return e.dir&&"future"==e.dir?r:e.dir&&"past"==e.dir?a:Math.abs(s-a)1e6&&this._resetTimestampCache();var e=null;if(t.day||0===t.day)e=t.day;else if(t.date){var n=String(t.date.valueOf());this._cached_timestamps[n]?e=this._cached_timestamps[n]:(e=Date.UTC(t.date.getFullYear(),t.date.getMonth(),t.date.getDate()),this._cached_timestamps[n]=e,this._cached_timestamps_count++)}return e},_checkIfWorkingUnit:function(t,e){if(!this["_is_work_"+e]){var n=this.$gantt.date["".concat(e,"_start")](new Date(t)),i=this.$gantt.date.add(n,1,e);return this.hasDuration(n,i)}return this["_is_work_"+e](t)},_is_work_day:function(t){var e=this._getWorkHours(t);return!!Array.isArray(e)&&e.length>0},_is_work_hour:function(t){for(var e=this._getWorkHours(t),n=t.getHours(),i=0;i=e[i].startHour&&n=e[i].start&&no.valueOf(),this._isWorkTime(a,n))(u||h&&f)&&(s=r[n+"_start"](new Date(a)),l=r.add(s,i,n)),u?(u=!1,d=this._nextDate(s,n,i),c+=(l.valueOf()-a.valueOf())/(l.valueOf()-s.valueOf())):h&&f?(h=!1,c+=(o.valueOf()-a.valueOf())/(l.valueOf()-s.valueOf())):c++;else{var _=this._getUnitOrder(n),g=this.units[_-1];g&&!this._isWorkTime(a,g)&&(d=this._getClosestWorkTimeFuture(a,g))}a=d}return c},_getMinutesPerHour:function(t){var e=this._getTimeOfDayStamp(t),n=this._getTimeOfDayStamp(this._nextDate(t,"hour",1));0===n&&(n=86400);for(var i=this._getWorkHours(t),r=0;r=a.start&&n<=a.end)return 60;if(ea.start)return(Math.min(n,a.end)-Math.max(e,a.start))/60}return 0},_getMinutesPerDay:function(t){var e=0;return this._getWorkHours(t).forEach(function(t){e+=t.durationMinutes}),e},getHoursPerDay:function(t){var e=0;return this._getWorkHours(t).forEach(function(t){e+=t.durationHours}),e},_getWorkUnitsForRange:function(t,e,n,i){var r,a=0,s=new Date(t),l=new Date(e);for(r="minute"==n?o.bind(this._getMinutesPerDay,this):o.bind(this.getHoursPerDay,this);s.valueOf()27648e5&&0===s.getDate()){var c=this._largeUnitsCache.getMinutesPerMonth(s);"hour"==n&&(c/=60),a+=c,s=this.$gantt.date.add(s,1,"month")}else{if(l-s>13824e5){var d=this.$gantt.date.week_start(new Date(s));if(s.valueOf()===d.valueOf()){c=this._largeUnitsCache.getMinutesPerWeek(s);"hour"==n&&(c/=60),a+=c,s=this.$gantt.date.add(s,7,"day");continue}}a+=r(s),s=this._nextDate(s,"day",1)}return a/i},_getMinutesBetweenSingleDay:function(t,e){for(var n=this._getIntervalTimestamp(t,e),i=this._getWorkHours(t),r=0,a=0;a=o.start&&n.start<=o.end){var s=Math.max(o.start,n.start),l=Math.min(o.end,n.end);r+=(l-s)/60,n.start=l}}return Math.floor(r)},_getMinutesBetween:function(t,e,n,i){var r=new Date(t),a=new Date(e);i=i||1;var o=new Date(r),s=this.$gantt.date.add(this.$gantt.date.day_start(new Date(r)),1,"day");if(a.valueOf()<=s.valueOf())return this._getMinutesBetweenSingleDay(t,e);var l=this.$gantt.date.day_start(new Date(a)),c=a,d=this._getMinutesBetweenSingleDay(o,s),u=this._getMinutesBetweenSingleDay(l,c);return d+this._getWorkUnitsForRange(s,l,n,i)+u},_getHoursBetween:function(t,e,n,i){var r=new Date(t),a=new Date(e);i=i||1;var o=new Date(r),s=this.$gantt.date.add(this.$gantt.date.day_start(new Date(r)),1,"day");if(a.valueOf()<=s.valueOf())return Math.round(this._getMinutesBetweenSingleDay(t,e)/60);var l=this.$gantt.date.day_start(new Date(a)),c=a,d=this._getMinutesBetweenSingleDay(o,s,n,i)/60,u=this._getMinutesBetweenSingleDay(l,c,n,i)/60,h=d+this._getWorkUnitsForRange(s,l,n,i)+u;return Math.round(h)},getConfig:function(){return this._worktime},_setConfig:function(t){this._worktime=t,this._parseSettings(),this._clearCaches()},_parseSettings:function(){var t=this.getConfig();for(var e in t.parsed={dates:{},hours:null,haveCustomWeeks:!1,customWeeks:{},customWeeksRangeStart:null,customWeeksRangeEnd:null,customWeeksBoundaries:[]},t.parsed.hours=this._parseHours(t.hours),t.dates)t.parsed.dates[e]=this._parseHours(t.dates[e]);if(t.customWeeks){var n=null,i=null;for(var e in t.customWeeks){var r=t.customWeeks[e];if(r.from&&r.to){var a=r.from,o=r.to;(!n||n>a.valueOf())&&(n=a.valueOf()),(!i||ii)for(var r=0;ri){n=n.customWeeks[n.customWeeksBoundaries[r].name];break}var a=!0;return void 0!==n.dates[i]?a=n.dates[i]:void 0!==n.dates[t.getDay()]&&(a=n.dates[t.getDay()]),!0===a?n.hours:a||[]},_getIntervalTimestamp:function(t,e){var n={start:0,end:0};n.start=60*t.getHours()*60+60*t.getMinutes()+t.getSeconds();var i=e.getHours();return!i&&!e.getMinutes()&&!e.getSeconds()&&t.valueOf()e.valueOf()){var o=e;e=t,t=o,a=-1}return r="hour"==n&&1==i?this._getHoursBetween(t,e,n,i):"minute"==n&&1==i?this._getMinutesBetween(t,e,n,i):this._getWorkUnitsBetweenGeneric(t,e,n,i),a*Math.round(r)},hasDuration:function(){var t=this.argumentsHelper.getDurationArguments.apply(this.argumentsHelper,arguments),e=t.start_date,n=t.end_date,i=t.unit,r=t.step;if(!i)return!1;var a=new Date(e),o=new Date(n);for(r=r||1;a.valueOf()=0?1:-1;n=Math.abs(1*n);var o=this;return this._dateDurationCache.getEndDate(e,n,i,r*a,function(){return o._calculateEndDate(e,n,i,r*a)})},_calculateEndDate:function(t,e,n,i){return!!n&&(1==i&&"minute"==n?this._calculateMinuteEndDate(t,e,i):-1==i&&"minute"==n?this._subtractMinuteDate(t,e,i):1==i&&"hour"==n?this._calculateHourEndDate(t,e,i):this._addInterval(t,e,n,i,null).end)},_addInterval:function(t,e,n,i,r){for(var a=0,o=t,s=!1;a0&&(c=new Date(l.valueOf()-1)),this._isWorkTime(c,n)&&!s&&a++,o=l}return{end:o,start:t,added:a}},_addHoursUntilDayEnd:function(t,e){for(var n=this.$gantt.date.add(this.$gantt.date.day_start(new Date(t)),1,"day"),i=0,r=e,a=this._getIntervalTimestamp(t,n),o=this._getWorkHours(t),s=0;s=l.start&&a.start<=l.end){var c=Math.max(l.start,a.start),d=Math.min(l.end,a.end),u=(d-c)/3600;u>r&&(u=r,d=c+60*r*60);var h=Math.round((d-c)/3600);i+=h,r-=h,a.start=d}}var f=n;return i===e&&(f=new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,a.start)),{added:i,end:f}},_calculateHourEndDate:function(t,e,n){var i=new Date(t),r=0;n=n||1,e=Math.abs(1*e);var a=this._addHoursUntilDayEnd(i,e);if(r=a.added,i=a.end,c=e-r){for(var o=i;r0?this.getHoursPerDay(new Date(s.valueOf()-1)):this.getHoursPerDay(new Date(s.valueOf()+1)))>=e)break;r+=l,o=s}i=o}if(r=l.start&&a.start<=l.end){var c=Math.max(l.start,a.start),d=Math.min(l.end,a.end),u=(d-c)/60;u>r&&(u=r,d=c+60*r);var h=Math.round((d-c)/60);r-=h,i+=h,a.start=d}}var f=n;return i===e&&(f=new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,a.start)),{added:i,end:f}},_subtractMinutesUntilHourStart:function(t,e){for(var n=this.$gantt.date.hour_start(new Date(t)),i=0,r=e,a=60*n.getHours()*60+60*n.getMinutes()+n.getSeconds(),o=60*t.getHours()*60+60*t.getMinutes()+t.getSeconds(),s=this._getWorkHours(t),l=s.length-1;l>=0&&ic.start&&a<=c.end){var d=Math.min(o,c.end),u=Math.max(a,c.start),h=(d-u)/60;h>r&&(h=r,u=d-60*r);var f=Math.abs(Math.round((d-u)/60));r-=f,i+=f,o=u}}var _=n;return i===e&&(_=new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,o)),{added:i,end:_}},_subtractMinuteDate:function(t,e,n){var i=new Date(t),r=0;n=n||-1,e=Math.abs(1*e),e=Math.round(e);var a=this._isMinutePrecision(i),o=this._subtractMinutesUntilHourStart(i,e);r+=o.added,i=o.end;for(var s=0,l=[],c=0;rc)r+=c,i=this.$gantt.date.add(i,-1,"day");else{for(var g=!1,p=null,v=l.length-1;v>=0;v--)if(l[v].start<_-1&&l[v].end>=_-1){g=!0,p=l[v];break}if(g)if(_===p.end&&f>=p.durationMinutes)r+=p.durationMinutes,i=this.$gantt.date.add(i,-p.durationMinutes,"minute");else if(!a&&f<=_/60-p.startMinute)r+=f,i=this.$gantt.date.add(i,-f,"minute");else if(a){var m=this._getClosestWorkTime(this._nextDate(i,"hour",n),"hour"),y=this._getMinutesPerHour(m);f=h&&u>=l){if(r+=l,u==l){i=new Date(i.getFullYear(),i.getMonth(),i.getDate(),0,0,s[s.length-1].end);break}i=this.$gantt.date.add(i,1,"day"),i=this.$gantt.date.day_start(i)}else{for(var f=!1,_=null,g=0;gh){f=!0,_=s[g];break}if(f)if(h===_.start&&u>=_.durationMinutes)r+=_.durationMinutes,i=this.$gantt.date.add(i,_.durationMinutes,"minute");else if(u<=_.endMinute-h/60)r+=u,i=this.$gantt.date.add(i,u,"minute");else{var p=this._getMinutesPerHour(i);p<=u?(r+=p,i=c?this.$gantt.date.add(i,p,"minute"):this._nextDate(i,"hour",n)):(r+=(a=this._addMinutesUntilHourEnd(i,u)).added,i=a.end)}else i=this._getClosestWorkTimeFuture(i,"hour")}else i=this.$gantt.date.add(this.$gantt.date.day_start(i),1,"day")}if(r0){for(var s=0;s=o){r=new Date(i.getFullYear(),i.getMonth(),i.getDate(),0,0,n[s].start);break}}else for(s=n.length-1;s>=0;s--){if(n[s].end<=o){r=new Date(i.getFullYear(),i.getMonth(),i.getDate(),0,0,n[s].end);break}if(n[s].end>o&&n[s].start<=o){r=new Date(i.getFullYear(),i.getMonth(),i.getDate(),0,0,o);break}}return r},_getClosestWorkMinute:function(t,e,n){var i=new Date(t),r=this._getWorkHours(i),a=this._findClosestTimeInDay(i,n,r);return a||(i=this.calculateEndDate(i,n,"day"),n>0?i=this.$gantt.date.day_start(i):(i=this.$gantt.date.day_start(i),i=this.$gantt.date.add(i,1,"day"),i=new Date(i.valueOf()-1)),r=this._getWorkHours(i),a=this._findClosestTimeInDay(i,n,r)),n<0&&(a=this.$gantt.date.add(a,-1,e)),a},_getClosestWorkTimeGeneric:function(t,e,n){if("hour"===e||"minute"===e)return this._getClosestWorkMinute(t,e,n);for(var i=this._getUnitOrder(e),r=this.units[i-1],a=t,o=0;!this._isWorkTime(a,e)&&(!r||this._isWorkTime(a,r)||(a=n>0?this._getClosestWorkTimeFuture(a,r):this._getClosestWorkTimePast(a,r),!this._isWorkTime(a,e)));){if(++o>3e3)return this.$gantt.assert(!1,"Invalid working time check"),!1;var s=a.getTimezoneOffset();a=this.$gantt.date.add(a,n,e),a=this.$gantt._correct_dst_change(a,s,n,e),this.$gantt.date[e+"_start"]&&(a=this.$gantt.date[e+"_start"](a))}return a},hasWorkTime:function(){var t=this.getConfig(),e=t.dates,n=[];for(var i in t.dates)Number(i)>6&&n.push(Number(i));var r=this._checkWorkHours(t.hours),a=!1;return[0,1,2,3,4,5,6].forEach(function(t){if(!a){var n=e[t];!0===n?a=r:Array.isArray(n)&&(a=this._checkWorkHours(n))}}.bind(this)),a},_checkWorkHours:function(t){if(0===t.length)return!1;for(var e=!1,n=0;ne.length?t:e,r=t===i?e:t;i=i.slice(),r=r.slice();n=[];for(var a=0;ao.start&&(n.push({start:Math.max(o.start,l.start),end:Math.min(o.end,l.end)}),o.end>l.end&&(r.splice(s,1),s--,a--))}return n},_mergeAdjacentIntervals:function(t){var e=t.slice();e.sort(function(t,e){return t.start-e.start});for(var n=e[0],i=1;in.end&&(n.end=r.end),e.splice(i,1),i--):n=r}return e},_mergeHoursConfig:function(t,e){return this._mergeAdjacentIntervals(this._intersectHourRanges(t,e))},merge:function(t,e){var n=i.copy(t.getConfig().parsed),r=i.copy(e.getConfig().parsed),a={hours:this._toHoursArray(this._mergeHoursConfig(n.hours,r.hours)),dates:{},customWeeks:{}};for(var o in n.dates){var s=n.dates[o],l=r.dates[o];if(s&&l)if(Array.isArray(s)||Array.isArray(l)){var c=Array.isArray(s)?s:n.hours,d=Array.isArray(l)?l:r.hours;a.dates[o]=this._toHoursArray(this._mergeHoursConfig(c,d))}else a.dates[o]=!0;else a.dates[o]=!1}if(n.customWeeks)for(var o in n.customWeeks)a.customWeeks[o]=n.customWeeks[o];if(r.customWeeks)for(var o in r.customWeeks)a.customWeeks[o]=r.customWeeks[o];return a}},t.exports=r},function(t,e,n){var i=n(0),r=n(35),a=n(176),o=n(175),s=n(170),l=n(169)();function c(t){this.$gantt=t,this._calendars={},this._legacyConfig=void 0,this.$gantt.attachEvent("onGanttReady",function(){this.$gantt.config.resource_calendars&&(this._isLegacyConfig=s.isLegacyResourceCalendarFormat(this.$gantt.config.resource_calendars))}.bind(this)),this.$gantt.attachEvent("onBeforeGanttReady",function(){this.createDefaultCalendars()}.bind(this)),this.$gantt.attachEvent("onBeforeGanttRender",function(){this.createDefaultCalendars()}.bind(this))}c.prototype={_calendars:{},_convertWorkTimeSettings:function(t){var e=t.days;if(e&&!t.dates){t.dates=t.dates||{};for(var n=0;n=3?(r=n,a=i):"string"==typeof arguments[1]?r=arguments[1]:"function"==typeof arguments[1]&&(a=arguments[1]),this._load_type=r,this.callEvent("onLoadStart",[e,r]),this.ajax.get(e,t.bind(function(t){this.on_load(t,r),this.callEvent("onLoadEnd",[e,r]),"function"==typeof a&&a.call(this)},this))},t.parse=function(t,e){this.on_load({xmlDoc:{responseText:t}},e)},t.serialize=function(t){return this[t=t||"json"].serialize()},t.on_load=function(e,n){if(e.xmlDoc&&404===e.xmlDoc.status)this.assert(!1,"Failed to load the data from "+e.xmlDoc.responseURL+", server returns 404");else if(!t.$destroyed){this.callEvent("onBeforeParse",[]),n||(n="json"),this.assert(this[n],"Invalid data type:'"+n+"'");var i=e.xmlDoc.responseText,r=this[n].parse(i,e);this._process_loading(r)}},t._process_loading=function(e){e.collections&&this._load_collections(e.collections),e.resources&&this.$data.resourcesStore&&this.$data.resourcesStore.parse(e.resources);var n=e.data||e.tasks;e.assignments&&function(e,n){var i={};n.forEach(function(t){i[t.task_id]||(i[t.task_id]=[]),i[t.task_id].push(t)}),e.forEach(function(e){e[t.config.resource_property]=i[e.id]||[]})}(n,e.assignments),this.$data.tasksStore.parse(n);var i=e.links||(e.collections?e.collections.links:[]);this.$data.linksStore.parse(i),this.callEvent("onParse",[]),this.render()},t._load_collections=function(t){var e=!1;for(var n in t)if(t.hasOwnProperty(n)){e=!0;var i=t[n];this.serverList[n]=this.serverList[n]||[];var r=this.serverList[n];if(!r)continue;r.splice(0,r.length);for(var a=0;a"},_copyObject:function(t){return""},serialize:function(){for(var e=[],n=[],i=t.json.serialize(),r=0,a=i.data.length;r"+e.join("")+""+n.join("")+""}},t.oldxml={parse:function(e,n){n=t.xml._getXML(e,n,"projects");for(var i={collections:{links:[]}},r=i.data=[],a=t.ajax.xpath("//task",n),o=0;o=r-20&&(t.autoscrollRight(),t.autoscrollStart()),o<=a+20&&(t.autoscrollLeft(),t.autoscrollStart()),oa+20&&t.autoscrollStop(),!0}),this._dnd.attachEvent("onDragEnd",function(){t.autoscrollStop()}))},t.prototype.autoscrollStart=function(){var t=this;if(0!==this._scrollOrder){var e=10*this._scrollOrder,n=this._scrollView.getScrollState();this._scrollView.scrollTo(n.position+e),setTimeout(function(){t.autoscrollStart()},50)}},t.prototype.autoscrollRight=function(){this._scrollOrder=1},t.prototype.autoscrollLeft=function(){this._scrollOrder=-1},t.prototype.autoscrollStop=function(){this._scrollOrder=0},t.prototype.getCorrection=function(){return this.isScrollable()?this._scrollView.getScrollState().position:0},t.prototype.isScrollable=function(){return!!this.$grid.$config.scrollable},t}();e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),r=n(182),a=function(){function t(t,e){var n=this;this._targetMarker=null,this.calculateCurrentPosition=function(t){var e=n.$grid.$grid.getBoundingClientRect(),i=e.right,r=e.left,a=t;return a>i&&(a=i),a=e},u=function(t){return--t});for(var h=this._dragX-this.$grid.$grid.getBoundingClientRect().left+this._scrollableGrid.getCorrection(),f=l;d(f,c)&&(void 0===t||void 0===e);f=u(f))o[f].hide||(s.startX=s.endX,s.endX+=o[f].width,h>=s.startX&&(h<=s.endX||!d(u(f),c))&&(t=f,n=s.startX,i=s.endX,r=(h-s.startX)/(s.endX-s.startX)),a===o[f].name&&(e=f));return{targetIndex:t,draggedIndex:e,xBefore:n,xAfter:i,columnRelativePos:r}},t.prototype.setMarkerPosition=function(t,e){void 0===e&&(e=10);var n=this._dnd.config.marker,i=this._dnd._obj.getBoundingClientRect();n.style.top=i.y+e+"px",n.style.left=t+"px"},t.prototype.drawTargetMarker=function(t){var e,n=t.targetIndex,r=t.draggedIndex,a=t.xBefore,o=t.xAfter,s=t.columnRelativePos;this._targetMarker||(this._targetMarker=document.createElement("div"),i.addClassName(this._targetMarker,"gantt_grid_target_marker"),this._targetMarker.style.display="none",this._targetMarker.style.height=this._gridConfig.scale_height+"px"),this._targetMarker.parentNode||this.$grid.$grid_scale.appendChild(this._targetMarker),e=n>r?o:n.5?o:a,this._targetMarker.style.left=e+"px",this._targetMarker.style.display="block"},t.prototype.cleanTargetMarker=function(){this._targetMarker&&this._targetMarker.parentNode&&this.$grid.$grid_scale.removeChild(this._targetMarker),this._targetMarker=null},t}();e.ColumnsGridDnd=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(183);e.default=i.ColumnsGridDnd},function(t,e,n){var i=n(1);t.exports=function(t,e){var n={row_before_start:t.bind(function(t,n,r){var a=e.$getConfig(),o=e.$config.rowStore;if(!i.locateAttribute(r,a.task_grid_row_resizer_attribute))return!1;var s=this.locate(r,a.task_grid_row_resizer_attribute),l=o.getItem(s);return!1!==e.callEvent("onBeforeRowResize",[l])&&void 0},t),row_after_start:t.bind(function(t,n,i){var r=e.$getConfig(),a=this.locate(i,r.task_grid_row_resizer_attribute);t.config.marker.innerHTML="",t.config.marker.className+=" gantt_row_grid_resize_area",t.config.marker.style.width=e.$grid.offsetWidth+"px",t.config.drag_id=a},t),row_drag_move:t.bind(function(t,n,r){var a=e.$config.rowStore,o=e.$getConfig(),s=t.config,l=s.drag_id,c=e.getItemHeight(l),d=e.getItemTop(l),u=i.getNodePosition(e.$grid_data),h=parseInt(s.marker.style.top,10),f=d+u.y,_=0,g=o.min_task_grid_row_height;return(_=h-f)=0?"&":"?",a=t.getScrollState().y||0,o={taskId:e,url:n+r+"parent_id="+encodeURIComponent(e)};if(!1===t.callEvent("onBeforeBranchLoading",[o]))return;t.load(o.url,this._load_type,function(){a&&t.scrollTo(null,a),t.callEvent("onAfterBranchLoading",[o])}),i[e]=!0}})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){t.ext=t.ext||{},t.config.show_empty_state=!1,t.ext.emptyStateElement=t.ext.emptyStateElement||{isEnabled:function(){return!0===t.config.show_empty_state},isGanttEmpty:function(){return!t.getTaskByTime().length},renderContent:function(e){var n="
\n \n
"+t.locale.labels.empty_state_text_description+"
\n
";e.innerHTML=n},clickEvents:[],attachAddTaskEvent:function(){var e=t.attachEvent("onEmptyClick",function(e){t.utils.dom.closest(e.target,"[data-empty-state-create-task]")&&t.createTask({id:t.uid(),text:"New Task"})});this.clickEvents.push(e)},detachAddTaskEvents:function(){this.clickEvents.forEach(function(e){t.detachEvent(e)}),this.clickEvents=[]},getContainer:function(){if(t.$container){var e=t.utils.dom;if(t.$container.contains(t.$grid_data))return e.closest(t.$grid_data,".gantt_layout_content");if(t.$container.contains(t.$task_data))return e.closest(t.$task_data,".gantt_layout_content")}return null},getNode:function(){var t=this.getContainer();return t?t.querySelector(".gantt_empty_state_wrapper"):null},show:function(){var e=this.getContainer();if(!e&&this.isGanttEmpty())return null;var n=document.createElement("div");n.className="gantt_empty_state_wrapper",n.style.marginTop=t.config.scale_height-e.offsetHeight+"px";var i=t.$container.querySelectorAll(".gantt_empty_state_wrapper");Array.prototype.forEach.call(i,function(t){t.parentNode.removeChild(t)}),this.detachAddTaskEvents(),this.attachAddTaskEvent(),e.appendChild(n),this.renderContent(n)},hide:function(){var t=this.getNode();if(!t)return!1;t.parentNode.removeChild(t)},init:function(){}},t.attachEvent("onDataRender",function(){var e=t.ext.emptyStateElement;e.isEnabled()&&e.isGanttEmpty()?e.show():e.hide()})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){var e=this;this.format=function(t){return e._getWBSCode(t.source)},this.canParse=function(t){return e._linkReg.test(t)},this.parse=function(t){if(!e.canParse(t))return null;var n=e._linkReg.exec(t)[0].trim();return{id:void 0,source:e._findSource(n)||null,target:null,type:e._gantt.config.links.finish_to_start,lag:0}},this._getWBSCode=function(t){var n=e._gantt.getTask(t);return e._gantt.getWBSCode(n)},this._findSource=function(t){var n=new RegExp("^[0-9.]+","i");if(n.exec(t)){var i=n.exec(t)[0],r=e._gantt.getTaskByWBSCode(i);if(r)return r.id}return null},this._linkReg=/^[0-9\.]+/,this._gantt=t}return t.create=function(e,n){return void 0===e&&(e=null),new t(n)},t}();e.default=i},function(t,e,n){var i=n(37).default,r=n(191).default;t.exports=function(t){t.ext.formatters={durationFormatter:function(e){return e||(e={}),e.store||(e.store=t.config.duration_unit),e.enter||(e.enter=t.config.duration_unit),i.create(e,t)},linkFormatter:function(e){return r.create(e,t)}}}},function(t,e){t.exports=function(t){function e(e){return function(){return!t.config.auto_types||t.getTaskType(t.config.types.project)!=t.config.types.project||e.apply(this,arguments)}}function n(e,n){var i=t.getTask(e),r=a(i);!1!==r&&t.getTaskType(i)!==r&&(n.$needsUpdate=!0,n[i.id]={task:i,type:r})}function i(e){if(!t.getState().group_mode){var i=function(e,i){return n(e,i=i||{}),t.eachParent(function(t){n(t.id,i)},e),i}(e);i.$needsUpdate&&t.batchUpdate(function(){!function(e){for(var n in e)if(e[n]&&e[n].task){var i=e[n].task;i.type=e[n].type,t.updateTask(i.id)}}(i)})}}var r;function a(e){var n=t.config.types,i=t.hasChild(e.id),r=t.getTaskType(e.type);return i&&r===n.task?n.project:!i&&r===n.project&&n.task}var o,s,l=!0;function c(e){e!=t.config.root_id&&t.isTaskExists(e)&&i(e)}t.attachEvent("onParse",e(function(){l=!1,t.getState().group_mode||(t.batchUpdate(function(){t.eachTask(function(e){var n=a(e);!1!==n&&function(e,n){t.getState().group_mode||(e.type=n,t.updateTask(e.id))}(e,n)})}),l=!0)})),t.attachEvent("onAfterTaskAdd",e(function(t){l&&i(t)})),t.attachEvent("onAfterTaskUpdate",e(function(t){l&&i(t)})),t.attachEvent("onBeforeTaskDelete",e(function(e,n){return r=t.getParent(e),!0})),t.attachEvent("onAfterTaskDelete",e(function(t,e){c(r)})),t.attachEvent("onRowDragStart",e(function(e,n,i){return o=t.getParent(e),!0})),t.attachEvent("onRowDragEnd",e(function(t,e){c(o),i(t)})),t.attachEvent("onBeforeTaskMove",e(function(e,n,i){return s=t.getParent(e),!0})),t.attachEvent("onAfterTaskMove",e(function(t,e,n){document.querySelector(".gantt_drag_marker")||(c(s),i(t))}))}},function(t,e){t.exports=function(t){function e(e){return function(){return!t.config.placeholder_task||e.apply(this,arguments)}}function n(){var e=t.getTaskBy("type",t.config.types.placeholder);if(!e.length||!t.isTaskExists(e[0].id)){var n={unscheduled:!0,type:t.config.types.placeholder,duration:0,text:t.locale.labels.new_task};if(!1===t.callEvent("onTaskCreated",[n]))return;t.addTask(n)}}function i(e){var n=t.getTask(e);n.type==t.config.types.placeholder&&(n.start_date&&n.end_date&&n.unscheduled&&(n.unscheduled=!1),t.batchUpdate(function(){var e=t.copy(n);t.silent(function(){t.deleteTask(n.id)}),delete e["!nativeeditor_status"],e.type=t.config.types.task,e.id=t.uid(),t.addTask(e)}))}t.config.types.placeholder="placeholder",t.attachEvent("onDataProcessorReady",e(function(n){n&&!n._silencedPlaceholder&&(n._silencedPlaceholder=!0,n.attachEvent("onBeforeUpdate",e(function(e,i,r){return r.type!=t.config.types.placeholder||(n.setUpdated(e,!1),!1)})))}));var r=!1;function a(e){if(t.config.types.placeholder&&t.isTaskExists(e)&&t.getTask(e).type==t.config.types.placeholder)return!0;return!1}function o(t){return!(!a(t.source)&&!a(t.target))}t.attachEvent("onGanttReady",function(){r||(r=!0,t.attachEvent("onAfterTaskUpdate",e(i)),t.attachEvent("onAfterTaskAdd",e(function(e,i){i.type!=t.config.types.placeholder&&(t.getTaskBy("type",t.config.types.placeholder).forEach(function(e){t.silent(function(){t.isTaskExists(e.id)&&t.deleteTask(e.id)})}),n())})),t.attachEvent("onParse",e(n)))}),t.attachEvent("onLinkValidation",function(t){return!o(t)}),t.attachEvent("onBeforeLinkAdd",function(t,e){return!o(e)}),t.attachEvent("onBeforeUndoStack",function(e){for(var n=0;ni.start_date){for(var s=0;s"+l.value+"
"}return"
-
"}return""},renderSummaryLabel:function(t,e,n,i,r){var a=r.reduce(function(t,e){return t+Number(e.value)},0);return a%1&&(a=Math.round(10*a)/10),a?"
"+a+"
":""},editableResourceCellTemplate:function(t,n,i,r,a){return"task"===i.$role?e.renderEditableLabel(t,n,i,r,a):e.renderSummaryLabel(t,n,i,r,a)},editableResourceCellClass:function(t,e,n,i,r){var a=[];a.push("resource_marker"),"task"===n.$role?a.push("task_cell"):a.push("resource_cell");var o=r.reduce(function(t,e){return t+Number(e.value)},0),s=Number(n.capacity);return isNaN(s)&&(s=8),o<=s?a.push("workday_ok"):a.push("workday_over"),a.join(" ")},getSummaryResourceAssignments:function(e){var n,i=t.getDatastore(t.config.resource_store),r=i.getItem(e);return"task"===r.$role?n=t.getResourceAssignments(r.$resource_id,r.$task_id):(n=t.getResourceAssignments(e),i.eachItem&&i.eachItem(function(e){"task"!==e.$role&&(n=n.concat(t.getResourceAssignments(e.id)))},e)),n},initEditableDiagram:function(){t.config.resource_render_empty_cells=!0,function(){var e=null;function n(){return e&&cancelAnimationFrame(e),e=requestAnimationFrame(function(){Array.prototype.slice.call(t.$container.querySelectorAll(".resourceTimeline_cell [data-assignment-cell]")).forEach(function(t){t.contentEditable=!0})}),!0}t.attachEvent("onGanttReady",function(){t.getDatastore(t.config.resource_assignment_store).attachEvent("onStoreUpdated",n),t.getDatastore(t.config.resource_store).attachEvent("onStoreUpdated",n)},{once:!0}),t.attachEvent("onGanttLayoutReady",function(){t.$layout.getCellsByType("viewCell").forEach(function(t){t.$config&&"resourceTimeline"===t.$config.view&&t.$content&&t.$content.attachEvent("onScroll",n)})})}(),t.attachEvent("onGanttReady",function(){var e=!1;t.event(t.$container,"keypress",function(t){var e=t.target.closest(".resourceTimeline_cell [data-assignment-cell]");e&&(13!==t.keyCode&&27!==t.keyCode||e.blur())}),t.event(t.$container,"focusout",function(n){if(!e){e=!0,setTimeout(function(){e=!1},300);var i=n.target.closest(".resourceTimeline_cell [data-assignment-cell]");if(i){var r=(i.innerText||"").trim();"-"==r&&(r="0");var a=Number(r),o=i.getAttribute("data-row-id"),s=i.getAttribute("data-assignment-id"),l=i.getAttribute("data-task"),c=i.getAttribute("data-resource-id"),d=t.templates.parse_date(i.getAttribute("data-start-date")),u=t.templates.parse_date(i.getAttribute("data-end-date")),h=t.getDatastore(t.config.resource_assignment_store);if(isNaN(a))t.getDatastore(t.config.resource_store).refresh(o);else{var f=t.getTask(l);if(s){if(a===(g=h.getItem(s)).value)return;if(g.start_date.valueOf()===d.valueOf()&&g.end_date.valueOf()===u.valueOf())g.value=a,a?h.updateItem(g.id):h.removeItem(g.id);else{if(g.end_date.valueOf()>u.valueOf()){var _=t.copy(g);_.id=t.uid(),_.start_date=u,_.duration=t.calculateDuration({start_date:_.start_date,end_date:_.end_date,task:f}),_.delay=t.calculateDuration({start_date:f.start_date,end_date:_.start_date,task:f}),_.mode=g.mode||"default",0!==_.duration&&h.addItem(_)}g.start_date.valueOf()-1?t.indexOf("?"):t.length),this.serverProcessor=t+("/"===t.slice(-1)?"":"/")+e}else{var n=this._ganttMode+"s";this.serverProcessor=t+i.ajax.urlSeparator(t)+"gantt_mode="+n}return!0}),e.attachEvent("insertCallback",function(t,e,n,r){var a=t.data||i.xml._xmlNodeToJSON(t.firstChild),o={add:i.addTask,isExist:i.isTaskExists};"links"===r&&(o.add=i.addLink,o.isExist=i.isLinkExists),o.isExist.call(i,e)||(a.id=e,o.add.call(i,a))}),e.attachEvent("updateCallback",function(t,e){var n=t.data||i.xml._xmlNodeToJSON(t.firstChild);if(i.isTaskExists(e)){var r=i.getTask(e);for(var a in n){var o=n[a];switch(a){case"id":continue;case"start_date":case"end_date":o=i.defined(i.templates.xml_date)?i.templates.xml_date(o):i.templates.parse_date(o);break;case"duration":r.end_date=i.calculateEndDate({start_date:r.start_date,duration:o,task:r})}r[a]=o}i.updateTask(e),i.refreshData()}}),e.attachEvent("deleteCallback",function(t,e,n,r){var a={delete:i.deleteTask,isExist:i.isTaskExists};"links"===r?(a.delete=i.deleteLink,a.isExist=i.isLinkExists):"assignment"===r&&(a.delete=function(t){i.$data.assignmentsStore.remove(t)},a.isExist=function(t){return i.$data.assignmentsStore.exists(t)}),a.isExist.call(i,e)&&a.delete.call(i,e)}),this.handleResourceAssignmentCRUD(e,i)},t.prototype.clientSideDelete=function(t,e,n){var i=e.updatedRows.slice(),r=!1;"true_deleted"===n.getUserData(t,"!nativeeditor_status",e._ganttMode)&&(r=!0,e.setUpdated(t,!1));for(var a=0;a=0?"link":o.indexOf("/assignment")>=0?"assignment":"task",this.setGanttMode(a);var s,l=this.$gantt.ajax;try{s=JSON.parse(e.xmlDoc.responseText)}catch(t){e.xmlDoc.responseText.length||(s={})}var c=function(e){var n=s.action||r.getState(e)||"updated",i=s.sid||e[0],o=s.tid||e[0];t.afterUpdateCallback(i,o,n,s,a)};if(s)return Array.isArray(n)&&n.length>1?n.forEach(function(t){return c(t)}):c(n),t.finalizeUpdate(),void this.setGanttMode(a);var d=l.xmltop("data",e.xmlDoc);if(!d)return this.cleanUpdate(n);var u=l.xpath("//data/action",d);if(!u.length)return this.cleanUpdate(n);for(var h=0;hr||+n.end_date<+i)return!1}return!0}),s.attachEvent("onIdChange",function(e,n){t._update_flags(e,n);var i=t.getTask(n);s.isSilent()||(i.$split_subtask||i.rollup)&&t.eachParent(function(e){t.refreshTask(e.id)},n)}),s.attachEvent("onAfterUpdate",function(e){if(t._update_parents(e),t.getState("batchUpdate").batch_update)return!0;var n=s.getItem(e);n.$source||(n.$source=[]);for(var i=0;i=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(211),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(15))},function(t,e,n){(function(n,i,r){var a,o,s;function l(t){"@babel/helpers - typeof";return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)} /* @preserve * The MIT License (MIT) * @@ -34,5 +34,5 @@ To use dhtmlxGantt in non-GPL projects (and get Pro version of the product), ple * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * - */!function(n){"object"==l(e)&&void 0!==t?t.exports=n():(o=[],void 0===(s="function"==typeof(a=n)?a.apply(e,o):a)||(t.exports=s))}(function(){var t,e,a;return function t(e,n,i){function r(o,s){if(!n[o]){if(!e[o]){var l="function"==typeof _dereq_&&_dereq_;if(!s&&l)return l(o,!0);if(a)return a(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var d=n[o]={exports:{}};e[o][0].call(d.exports,function(t){var n=e[o][1][t];return r(n||t)},d,d.exports,t,e,n,i)}return n[o].exports}for(var a="function"==typeof _dereq_&&_dereq_,o=0;o0;)f(t)}function f(t){var e=t.shift();if("function"!=typeof e)e._settlePromises();else{var n=t.shift(),i=t.shift();e.call(n,i)}}l.prototype.setScheduler=function(t){var e=this._schedule;return this._schedule=t,this._customScheduler=!0,e},l.prototype.hasCustomScheduler=function(){return this._customScheduler},l.prototype.enableTrampoline=function(){this._trampolineEnabled=!0},l.prototype.disableTrampolineIfNecessary=function(){s.hasDevTools&&(this._trampolineEnabled=!1)},l.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},l.prototype.fatalError=function(t,e){e?(n.stderr.write("Fatal "+(t instanceof Error?t.stack:t)+"\n"),n.exit(2)):this.throwLater(t)},l.prototype.throwLater=function(t,e){if(1===arguments.length&&(e=t,t=function(){throw e}),"undefined"!=typeof setTimeout)setTimeout(function(){t(e)},0);else try{this._schedule(function(){t(e)})}catch(t){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}},s.hasDevTools?(l.prototype.invokeLater=function(t,e,n){this._trampolineEnabled?c.call(this,t,e,n):this._schedule(function(){setTimeout(function(){t.call(e,n)},100)})},l.prototype.invoke=function(t,e,n){this._trampolineEnabled?d.call(this,t,e,n):this._schedule(function(){t.call(e,n)})},l.prototype.settlePromises=function(t){this._trampolineEnabled?u.call(this,t):this._schedule(function(){t._settlePromises()})}):(l.prototype.invokeLater=c,l.prototype.invoke=d,l.prototype.settlePromises=u),l.prototype._drainQueues=function(){h(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,h(this._lateQueue)},l.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},l.prototype._reset=function(){this._isTickUsed=!1},e.exports=l,e.exports.firstLineError=r},{"./queue":26,"./schedule":29,"./util":36}],3:[function(t,e,n){"use strict";e.exports=function(t,e,n,i){var r=!1,a=function(t,e){this._reject(e)},o=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(a,a,null,this,t)},s=function(t,e){0==(50397184&this._bitField)&&this._resolveCallback(e.target)},l=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(a){r||(r=!0,t.prototype._propagateFrom=i.propagateFromFunction(),t.prototype._boundValue=i.boundValueFunction());var c=n(a),d=new t(e);d._propagateFrom(this,1);var u=this._target();if(d._setBoundTo(c),c instanceof t){var h={promiseRejectionQueued:!1,promise:d,target:u,bindingPromise:c};u._then(e,o,void 0,d,h),c._then(s,l,void 0,d,h),d._setOnCancel(c)}else d._resolveCallback(u);return d},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=2097152|this._bitField,this._boundTo=t):this._bitField=-2097153&this._bitField},t.prototype._isBound=function(){return 2097152==(2097152&this._bitField)},t.bind=function(e,n){return t.resolve(n).bind(e)}}},{}],4:[function(t,e,n){"use strict";var i;"undefined"!=typeof Promise&&(i=Promise);var r=t("./promise")();r.noConflict=function(){try{Promise===r&&(Promise=i)}catch(t){}return r},e.exports=r},{"./promise":22}],5:[function(t,e,n){"use strict";var i=Object.create;if(i){var r=i(null),a=i(null);r[" size"]=a[" size"]=0}e.exports=function(e){var n=t("./util"),i=n.canEvaluate;n.isIdentifier;function r(t){return function(t,i){var r;if(null!=t&&(r=t[i]),"function"!=typeof r){var a="Object "+n.classString(t)+" has no method '"+n.toString(i)+"'";throw new e.TypeError(a)}return r}(t,this.pop()).apply(t,this)}function a(t){return t[this]}function o(t){var e=+this;return e<0&&(e=Math.max(0,e+t.length)),t[e]}e.prototype.call=function(t){var e=[].slice.call(arguments,1);return e.push(t),this._then(r,void 0,void 0,e,void 0)},e.prototype.get=function(t){var e;if("number"==typeof t)e=o;else if(i){var n=(void 0)(t);e=null!==n?n:a}else e=a;return this._then(e,void 0,void 0,t,void 0)}}},{"./util":36}],6:[function(t,e,n){"use strict";e.exports=function(e,n,i,r){var a=t("./util"),o=a.tryCatch,s=a.errorObj,l=e._async;e.prototype.break=e.prototype.cancel=function(){if(!r.cancellation())return this._warn("cancellation is disabled");for(var t=this,e=t;t._isCancellable();){if(!t._cancelBy(e)){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}var n=t._cancellationParent;if(null==n||!n._isCancellable()){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}t._isFollowing()&&t._followee().cancel(),t._setWillBeCancelled(),e=t,t=n}},e.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},e.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},e.prototype._cancelBy=function(t){return t===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),!!this._enoughBranchesHaveCancelled()&&(this._invokeOnCancel(),!0))},e.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},e.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),l.invoke(this._cancelPromises,this,void 0))},e.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},e.prototype._unsetOnCancel=function(){this._onCancelField=void 0},e.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},e.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},e.prototype._doInvokeOnCancel=function(t,e){if(a.isArray(t))for(var n=0;n=0)return n[t]}return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return null},t._peekContext=t.prototype._peekContext=function(){},i.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,n.push(this._trace))},i.prototype._popContext=function(){if(void 0!==this._trace){var t=n.pop(),e=t._promiseCreated;return t._promiseCreated=null,e}return null},i.CapturedTrace=null,i.create=function(){if(e)return new i},i.deactivateLongStackTraces=function(){},i.activateLongStackTraces=function(){var n=t.prototype._pushContext,a=t.prototype._popContext,o=t._peekContext,s=t.prototype._peekContext,l=t.prototype._promiseCreated;i.deactivateLongStackTraces=function(){t.prototype._pushContext=n,t.prototype._popContext=a,t._peekContext=o,t.prototype._peekContext=s,t.prototype._promiseCreated=l,e=!1},e=!0,t.prototype._pushContext=i.prototype._pushContext,t.prototype._popContext=i.prototype._popContext,t._peekContext=t.prototype._peekContext=r,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&null==t._promiseCreated&&(t._promiseCreated=this)}},i}},{}],9:[function(t,e,i){"use strict";e.exports=function(e,i){var r,a,o,s=e._getDomain,c=e._async,d=t("./errors").Warning,u=t("./util"),h=t("./es5"),f=u.canAttachTrace,_=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,g=/\((?:timers\.js):\d+:\d+\)/,p=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,v=null,m=null,y=!1,k=!(0==u.env("BLUEBIRD_DEBUG")),b=!(0==u.env("BLUEBIRD_WARNINGS")||!k&&!u.env("BLUEBIRD_WARNINGS")),w=!(0==u.env("BLUEBIRD_LONG_STACK_TRACES")||!k&&!u.env("BLUEBIRD_LONG_STACK_TRACES")),x=0!=u.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(b||!!u.env("BLUEBIRD_W_FORGOTTEN_RETURN"));e.prototype.suppressUnhandledRejections=function(){var t=this._target();t._bitField=-1048577&t._bitField|524288},e.prototype._ensurePossibleRejectionHandled=function(){if(0==(524288&this._bitField)){this._setRejectionIsUnhandled();var t=this;setTimeout(function(){t._notifyUnhandledRejection()},1)}},e.prototype._notifyUnhandledRejectionIsHandled=function(){q("rejectionHandled",r,void 0,this)},e.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},e.prototype._returnedNonUndefined=function(){return 0!=(268435456&this._bitField)},e.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._settledValue();this._setUnhandledRejectionIsNotified(),q("unhandledRejection",a,t,this)}},e.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},e.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},e.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},e.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},e.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},e.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},e.prototype._warn=function(t,e,n){return z(t,e,n||this)},e.onPossiblyUnhandledRejection=function(t){var e=s();a="function"==typeof t?null===e?t:u.domainBind(e,t):void 0},e.onUnhandledRejectionHandled=function(t){var e=s();r="function"==typeof t?null===e?t:u.domainBind(e,t):void 0};var $=function(){};e.longStackTraces=function(){if(c.haveItemsQueued()&&!tt.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!tt.longStackTraces&&Y()){var t=e.prototype._captureStackTrace,n=e.prototype._attachExtraTrace,r=e.prototype._dereferenceTrace;tt.longStackTraces=!0,$=function(){if(c.haveItemsQueued()&&!tt.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");e.prototype._captureStackTrace=t,e.prototype._attachExtraTrace=n,e.prototype._dereferenceTrace=r,i.deactivateLongStackTraces(),c.enableTrampoline(),tt.longStackTraces=!1},e.prototype._captureStackTrace=H,e.prototype._attachExtraTrace=F,e.prototype._dereferenceTrace=B,i.activateLongStackTraces(),c.disableTrampolineIfNecessary()}},e.hasLongStackTraces=function(){return tt.longStackTraces&&Y()};var S=function(){try{if("function"==typeof CustomEvent){var t=new CustomEvent("CustomEvent");return u.global.dispatchEvent(t),function(t,e){var n={detail:e,cancelable:!0};h.defineProperty(n,"promise",{value:e.promise}),h.defineProperty(n,"reason",{value:e.reason});var i=new CustomEvent(t.toLowerCase(),n);return!u.global.dispatchEvent(i)}}if("function"==typeof Event){t=new Event("CustomEvent");return u.global.dispatchEvent(t),function(t,e){var n=new Event(t.toLowerCase(),{cancelable:!0});return n.detail=e,h.defineProperty(n,"promise",{value:e.promise}),h.defineProperty(n,"reason",{value:e.reason}),!u.global.dispatchEvent(n)}}return(t=document.createEvent("CustomEvent")).initCustomEvent("testingtheevent",!1,!0,{}),u.global.dispatchEvent(t),function(t,e){var n=document.createEvent("CustomEvent");return n.initCustomEvent(t.toLowerCase(),!1,!0,e),!u.global.dispatchEvent(n)}}catch(t){}return function(){return!1}}(),T=u.isNode?function(){return n.emit.apply(n,arguments)}:u.global?function(t){var e="on"+t.toLowerCase(),n=u.global[e];return!!n&&(n.apply(u.global,[].slice.call(arguments,1)),!0)}:function(){return!1};function C(t,e){return{promise:e}}var E={promiseCreated:C,promiseFulfilled:C,promiseRejected:C,promiseResolved:C,promiseCancelled:C,promiseChained:function(t,e,n){return{promise:e,child:n}},warning:function(t,e){return{warning:e}},unhandledRejection:function(t,e,n){return{reason:e,promise:n}},rejectionHandled:C},D=function(t){var e=!1;try{e=T.apply(null,arguments)}catch(t){c.throwLater(t),e=!0}var n=!1;try{n=S(t,E[t].apply(null,arguments))}catch(t){c.throwLater(t),n=!0}return n||e};function A(){return!1}function M(t,e,n){var i=this;try{t(e,n,function(t){if("function"!=typeof t)throw new TypeError("onCancel must be a function, got: "+u.toString(t));i._attachCancellationCallback(t)})}catch(t){return t}}function I(t){if(!this._isCancellable())return this;var e=this._onCancel();void 0!==e?u.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function N(){return this._onCancelField}function P(t){this._onCancelField=t}function L(){this._cancellationParent=void 0,this._onCancelField=void 0}function O(t,e){if(0!=(1&e)){this._cancellationParent=t;var n=t._branchesRemainingToCancel;void 0===n&&(n=0),t._branchesRemainingToCancel=n+1}0!=(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}e.config=function(t){if("longStackTraces"in(t=Object(t))&&(t.longStackTraces?e.longStackTraces():!t.longStackTraces&&e.hasLongStackTraces()&&$()),"warnings"in t){var n=t.warnings;tt.warnings=!!n,x=tt.warnings,u.isObject(n)&&"wForgottenReturn"in n&&(x=!!n.wForgottenReturn)}if("cancellation"in t&&t.cancellation&&!tt.cancellation){if(c.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");e.prototype._clearCancellationData=L,e.prototype._propagateFrom=O,e.prototype._onCancel=N,e.prototype._setOnCancel=P,e.prototype._attachCancellationCallback=I,e.prototype._execute=M,R=O,tt.cancellation=!0}return"monitoring"in t&&(t.monitoring&&!tt.monitoring?(tt.monitoring=!0,e.prototype._fireEvent=D):!t.monitoring&&tt.monitoring&&(tt.monitoring=!1,e.prototype._fireEvent=A)),e},e.prototype._fireEvent=A,e.prototype._execute=function(t,e,n){try{t(e,n)}catch(t){return t}},e.prototype._onCancel=function(){},e.prototype._setOnCancel=function(t){},e.prototype._attachCancellationCallback=function(t){},e.prototype._captureStackTrace=function(){},e.prototype._attachExtraTrace=function(){},e.prototype._dereferenceTrace=function(){},e.prototype._clearCancellationData=function(){},e.prototype._propagateFrom=function(t,e){};var R=function(t,e){0!=(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)};function j(){var t=this._boundTo;return void 0!==t&&t instanceof e?t.isFulfilled()?t.value():void 0:t}function H(){this._trace=new Q(this._peekContext())}function F(t,e){if(f(t)){var n=this._trace;if(void 0!==n&&e&&(n=n._parent),void 0!==n)n.attachExtraTrace(t);else if(!t.__stackCleaned__){var i=W(t);u.notEnumerableProp(t,"stack",i.message+"\n"+i.stack.join("\n")),u.notEnumerableProp(t,"__stackCleaned__",!0)}}}function B(){this._trace=void 0}function z(t,n,i){if(tt.warnings){var r,a=new d(t);if(n)i._attachExtraTrace(a);else if(tt.longStackTraces&&(r=e._peekContext()))r.attachExtraTrace(a);else{var o=W(a);a.stack=o.message+"\n"+o.stack.join("\n")}D("warning",a)||U(a,"",!0)}}function V(t){for(var e=[],n=0;n0?function(t){for(var e=t.stack.replace(/\s+$/g,"").split("\n"),n=0;n0&&"SyntaxError"!=t.name&&(e=e.slice(n)),e}(t):[" (No stack trace)"],{message:n,stack:"SyntaxError"==t.name?e:V(e)}}function U(t,e,n){if("undefined"!=typeof console){var i;if(u.isObject(t)){var r=t.stack;i=e+m(r,t)}else i=e+String(t);"function"==typeof o?o(i,n):"function"!=typeof console.log&&"object"!==l(console.log)||console.log(i)}}function q(t,e,n,i){var r=!1;try{"function"==typeof e&&(r=!0,"rejectionHandled"===t?e(i):e(n,i))}catch(t){c.throwLater(t)}"unhandledRejection"===t?D(t,n,i)||r||U(n,"Unhandled rejection "):D(t,i)}function G(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t&&"function"==typeof t.toString?t.toString():u.toString(t);if(/\[object [a-zA-Z0-9$_]+\]/.test(e))try{e=JSON.stringify(t)}catch(t){}0===e.length&&(e="(empty array)")}return"(<"+function(t){if(t.length<41)return t;return t.substr(0,38)+"..."}(e)+">, no stack trace)"}function Y(){return"function"==typeof Z}var K=function(){return!1},J=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function X(t){var e=t.match(J);if(e)return{fileName:e[1],line:parseInt(e[2],10)}}function Q(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);Z(this,Q),e>32&&this.uncycle()}u.inherits(Q,Error),i.CapturedTrace=Q,Q.prototype.uncycle=function(){var t=this._length;if(!(t<2)){for(var e=[],n={},i=0,r=this;void 0!==r;++i)e.push(r),r=r._parent;for(i=(t=this._length=i)-1;i>=0;--i){var a=e[i].stack;void 0===n[a]&&(n[a]=i)}for(i=0;i0&&(e[o-1]._parent=void 0,e[o-1]._length=1),e[i]._parent=void 0,e[i]._length=1;var s=i>0?e[i-1]:this;o=0;--c)e[c]._length=l,l++;return}}}},Q.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=W(t),n=e.message,i=[e.stack],r=this;void 0!==r;)i.push(V(r.stack.split("\n"))),r=r._parent;!function(t){for(var e=t[0],n=1;n=0;--s)if(i[s]===a){o=s;break}for(s=o;s>=0;--s){var l=i[s];if(e[r]!==l)break;e.pop(),r--}e=i}}(i),function(t){for(var e=0;e=0)return v=/@/,m=e,y=!0,function(t){t.stack=(new Error).stack};try{throw new Error}catch(t){i="stack"in t}return"stack"in r||!i||"number"!=typeof Error.stackTraceLimit?(m=function(t,e){return"string"==typeof t?t:"object"!==l(e)&&"function"!=typeof e||void 0===e.name||void 0===e.message?G(e):e.toString()},null):(v=t,m=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6})}();"undefined"!=typeof console&&void 0!==console.warn&&(o=function(t){console.warn(t)},u.isNode&&n.stderr.isTTY?o=function(t,e){var n=e?"":"";console.warn(n+t+"\n")}:u.isNode||"string"!=typeof(new Error).stack||(o=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var tt={warnings:b,longStackTraces:!1,cancellation:!1,monitoring:!1};return w&&e.longStackTraces(),{longStackTraces:function(){return tt.longStackTraces},warnings:function(){return tt.warnings},cancellation:function(){return tt.cancellation},monitoring:function(){return tt.monitoring},propagateFromFunction:function(){return R},boundValueFunction:function(){return j},checkForgottenReturns:function(t,e,n,i,r){if(void 0===t&&null!==e&&x){if(void 0!==r&&r._returnedNonUndefined())return;if(0==(65535&i._bitField))return;n&&(n+=" ");var a="",o="";if(e._trace){for(var s=e._trace.stack.split("\n"),l=V(s),c=l.length-1;c>=0;--c){var d=l[c];if(!g.test(d)){var u=d.match(p);u&&(a="at "+u[1]+":"+u[2]+":"+u[3]+" ");break}}if(l.length>0){var h=l[0];for(c=0;c0&&(o="\n"+s[c-1]);break}}}var f="a promise was created in a "+n+"handler "+a+"but was not returned from it, see http://goo.gl/rRqMUw"+o;i._warn(f,!0,e)}},setBounds:function(t,e){if(Y()){for(var n,i,r=t.stack.split("\n"),a=e.stack.split("\n"),o=-1,s=-1,l=0;l=s||(K=function(t){if(_.test(t))return!0;var e=X(t);return!!(e&&e.fileName===n&&o<=e.line&&e.line<=s)})}},warn:z,deprecated:function(t,e){var n=t+" is deprecated and will be removed in a future version.";return e&&(n+=" Use "+e+" instead."),z(n)},CapturedTrace:Q,fireDomEvent:S,fireGlobalEvent:T}}},{"./errors":12,"./es5":13,"./util":36}],10:[function(t,e,n){"use strict";e.exports=function(t){function e(){return this.value}function n(){throw this.reason}t.prototype.return=t.prototype.thenReturn=function(n){return n instanceof t&&n.suppressUnhandledRejections(),this._then(e,void 0,void 0,{value:n},void 0)},t.prototype.throw=t.prototype.thenThrow=function(t){return this._then(n,void 0,void 0,{reason:t},void 0)},t.prototype.catchThrow=function(t){if(arguments.length<=1)return this._then(void 0,n,void 0,{reason:t},void 0);var e=arguments[1];return this.caught(t,function(){throw e})},t.prototype.catchReturn=function(n){if(arguments.length<=1)return n instanceof t&&n.suppressUnhandledRejections(),this._then(void 0,e,void 0,{value:n},void 0);var i=arguments[1];i instanceof t&&i.suppressUnhandledRejections();return this.caught(n,function(){return i})}}},{}],11:[function(t,e,n){"use strict";e.exports=function(t,e){var n=t.reduce,i=t.all;function r(){return i(this)}t.prototype.each=function(t){return n(this,t,e,0)._then(r,void 0,void 0,this,void 0)},t.prototype.mapSeries=function(t){return n(this,t,e,e)},t.each=function(t,i){return n(t,i,e,0)._then(r,void 0,void 0,t,void 0)},t.mapSeries=function(t,i){return n(t,i,e,e)}}},{}],12:[function(t,e,n){"use strict";var i,r,a=t("./es5"),o=a.freeze,s=t("./util"),l=s.inherits,c=s.notEnumerableProp;function d(t,e){function n(i){if(!(this instanceof n))return new n(i);c(this,"message","string"==typeof i?i:e),c(this,"name",t),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this)}return l(n,Error),n}var u=d("Warning","warning"),h=d("CancellationError","cancellation error"),f=d("TimeoutError","timeout error"),_=d("AggregateError","aggregate error");try{i=TypeError,r=RangeError}catch(t){i=d("TypeError","type error"),r=d("RangeError","range error")}for(var g="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),p=0;p1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0)}function u(){return f.call(this,this.promise._target()._settledValue())}function h(t){if(!d(this,t))return o.e=t,o}function f(t){var r=this.promise,s=this.handler;if(!this.called){this.called=!0;var l=this.isFinallyHandler()?s.call(r._boundValue()):s.call(r._boundValue(),t);if(l===i)return l;if(void 0!==l){r._setReturnedNonUndefined();var f=n(l,r);if(f instanceof e){if(null!=this.cancelPromise){if(f._isCancelled()){var _=new a("late cancellation observer");return r._attachExtraTrace(_),o.e=_,o}f.isPending()&&f._attachCancellationCallback(new c(this))}return f._then(u,h,void 0,this,void 0)}}}return r.isRejected()?(d(this),o.e=t,o):(d(this),t)}return l.prototype.isFinallyHandler=function(){return 0===this.type},c.prototype._resultCancelled=function(){d(this.finallyHandler)},e.prototype._passThrough=function(t,e,n,i){return"function"!=typeof t?this.then():this._then(n,i,void 0,new l(this,e,t),void 0)},e.prototype.lastly=e.prototype.finally=function(t){return this._passThrough(t,0,f,f)},e.prototype.tap=function(t){return this._passThrough(t,1,f)},e.prototype.tapCatch=function(t){var n=arguments.length;if(1===n)return this._passThrough(t,1,void 0,f);var i,a=new Array(n-1),o=0;for(i=0;i0&&"function"==typeof arguments[e]&&(t=arguments[e]);var i=[].slice.call(arguments);t&&i.pop();var r=new n(i).promise();return void 0!==t?r.spread(t):r}}},{"./util":36}],18:[function(t,e,n){"use strict";e.exports=function(e,n,i,r,a,o){var s=e._getDomain,c=t("./util"),d=c.tryCatch,u=c.errorObj,h=e._async;function f(t,e,n,i){this.constructor$(t),this._promise._captureStackTrace();var r=s();this._callback=null===r?e:c.domainBind(r,e),this._preservedValues=i===a?new Array(this.length()):null,this._limit=n,this._inFlight=0,this._queue=[],h.invoke(this._asyncInit,this,void 0)}function _(t,n,r,a){if("function"!=typeof n)return i("expecting a function but got "+c.classString(n));var o=0;if(void 0!==r){if("object"!==l(r)||null===r)return e.reject(new TypeError("options argument must be an object but it is "+c.classString(r)));if("number"!=typeof r.concurrency)return e.reject(new TypeError("'concurrency' must be a number but it is "+c.classString(r.concurrency)));o=r.concurrency}return new f(t,n,o="number"==typeof o&&isFinite(o)&&o>=1?o:0,a).promise()}c.inherits(f,n),f.prototype._asyncInit=function(){this._init$(void 0,-2)},f.prototype._init=function(){},f.prototype._promiseFulfilled=function(t,n){var i=this._values,a=this.length(),s=this._preservedValues,l=this._limit;if(n<0){if(i[n=-1*n-1]=t,l>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(l>=1&&this._inFlight>=l)return i[n]=t,this._queue.push(n),!1;null!==s&&(s[n]=t);var c=this._promise,h=this._callback,f=c._boundValue();c._pushContext();var _=d(h).call(f,t,n,a),g=c._popContext();if(o.checkForgottenReturns(_,g,null!==s?"Promise.filter":"Promise.map",c),_===u)return this._reject(_.e),!0;var p=r(_,this._promise);if(p instanceof e){var v=(p=p._target())._bitField;if(0==(50397184&v))return l>=1&&this._inFlight++,i[n]=p,p._proxy(this,-1*(n+1)),!1;if(0==(33554432&v))return 0!=(16777216&v)?(this._reject(p._reason()),!0):(this._cancel(),!0);_=p._value()}i[n]=_}return++this._totalResolved>=a&&(null!==s?this._filter(i,s):this._resolve(i),!0)},f.prototype._drainQueue=function(){for(var t=this._queue,e=this._limit,n=this._values;t.length>0&&this._inFlight1){a.deprecated("calling Promise.try with more than 1 argument");var c=arguments[1],d=arguments[2];i=o.isArray(c)?s(t).apply(d,c):s(t).call(d,c)}else i=s(t)();var u=l._popContext();return a.checkForgottenReturns(i,u,"Promise.try",l),l._resolveFromSyncValue(i),l},e.prototype._resolveFromSyncValue=function(t){t===o.errorObj?this._rejectCallback(t.e,!1):this._resolveCallback(t,!0)}}},{"./util":36}],20:[function(t,e,n){"use strict";var i=t("./util"),r=i.maybeWrapAsError,a=t("./errors").OperationalError,o=t("./es5");var s=/^(?:name|message|stack|cause)$/;function l(t){var e;if(function(t){return t instanceof Error&&o.getPrototypeOf(t)===Error.prototype}(t)){(e=new a(t)).name=t.name,e.message=t.message,e.stack=t.stack;for(var n=o.keys(t),r=0;r1){var n,i=new Array(e-1),r=0;for(n=0;n0&&"function"!=typeof t&&"function"!=typeof e){var n=".then() only accepts functions but was passed: "+c.classString(t);arguments.length>1&&(n+=", "+c.classString(e)),this._warn(n)}return this._then(t,e,void 0,void 0,void 0)},D.prototype.done=function(t,e){this._then(t,e,void 0,void 0,void 0)._setIsFinal()},D.prototype.spread=function(t){return"function"!=typeof t?a("expecting a function but got "+c.classString(t)):this.all()._then(t,void 0,void 0,v,void 0)},D.prototype.toJSON=function(){var t={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(t.fulfillmentValue=this.value(),t.isFulfilled=!0):this.isRejected()&&(t.rejectionReason=this.reason(),t.isRejected=!0),t},D.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new k(this).promise()},D.prototype.error=function(t){return this.caught(c.originatesFromRejection,t)},D.getNewLibraryCopy=e.exports,D.is=function(t){return t instanceof D},D.fromNode=D.fromCallback=function(t){var e=new D(p);e._captureStackTrace();var n=arguments.length>1&&!!Object(arguments[1]).multiArgs,i=E(t)(T(e,n));return i===C&&e._rejectCallback(i.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},D.all=function(t){return new k(t).promise()},D.cast=function(t){var e=y(t);return e instanceof D||((e=new D(p))._captureStackTrace(),e._setFulfilled(),e._rejectionHandler0=t),e},D.resolve=D.fulfilled=D.cast,D.reject=D.rejected=function(t){var e=new D(p);return e._captureStackTrace(),e._rejectCallback(t,!0),e},D.setScheduler=function(t){if("function"!=typeof t)throw new _("expecting a function but got "+c.classString(t));return h.setScheduler(t)},D.prototype._then=function(t,e,n,i,r){var a=void 0!==r,o=a?r:new D(p),l=this._target(),d=l._bitField;a||(o._propagateFrom(this,3),o._captureStackTrace(),void 0===i&&0!=(2097152&this._bitField)&&(i=0!=(50397184&d)?this._boundValue():l===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,o));var u=s();if(0!=(50397184&d)){var f,_,v=l._settlePromiseCtx;0!=(33554432&d)?(_=l._rejectionHandler0,f=t):0!=(16777216&d)?(_=l._fulfillmentHandler0,f=e,l._unsetRejectionIsUnhandled()):(v=l._settlePromiseLateCancellationObserver,_=new g("late cancellation observer"),l._attachExtraTrace(_),f=e),h.invoke(v,l,{handler:null===u?f:"function"==typeof f&&c.domainBind(u,f),promise:o,receiver:i,value:_})}else l._addCallbacks(t,e,o,i,u);return o},D.prototype._length=function(){return 65535&this._bitField},D.prototype._isFateSealed=function(){return 0!=(117506048&this._bitField)},D.prototype._isFollowing=function(){return 67108864==(67108864&this._bitField)},D.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},D.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},D.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},D.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},D.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},D.prototype._isFinal=function(){return(4194304&this._bitField)>0},D.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},D.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},D.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},D.prototype._setAsyncGuaranteed=function(){h.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},D.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[4*t-4+3];if(e!==l)return void 0===e&&this._isBound()?this._boundValue():e},D.prototype._promiseAt=function(t){return this[4*t-4+2]},D.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},D.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},D.prototype._boundValue=function(){},D.prototype._migrateCallback0=function(t){t._bitField;var e=t._fulfillmentHandler0,n=t._rejectionHandler0,i=t._promise0,r=t._receiverAt(0);void 0===r&&(r=l),this._addCallbacks(e,n,i,r,null)},D.prototype._migrateCallbackAt=function(t,e){var n=t._fulfillmentHandlerAt(e),i=t._rejectionHandlerAt(e),r=t._promiseAt(e),a=t._receiverAt(e);void 0===a&&(a=l),this._addCallbacks(n,i,r,a,null)},D.prototype._addCallbacks=function(t,e,n,i,r){var a=this._length();if(a>=65531&&(a=0,this._setLength(0)),0===a)this._promise0=n,this._receiver0=i,"function"==typeof t&&(this._fulfillmentHandler0=null===r?t:c.domainBind(r,t)),"function"==typeof e&&(this._rejectionHandler0=null===r?e:c.domainBind(r,e));else{var o=4*a-4;this[o+2]=n,this[o+3]=i,"function"==typeof t&&(this[o+0]=null===r?t:c.domainBind(r,t)),"function"==typeof e&&(this[o+1]=null===r?e:c.domainBind(r,e))}return this._setLength(a+1),a},D.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},D.prototype._resolveCallback=function(t,e){if(0==(117506048&this._bitField)){if(t===this)return this._rejectCallback(i(),!1);var n=y(t,this);if(!(n instanceof D))return this._fulfill(t);e&&this._propagateFrom(n,2);var r=n._target();if(r!==this){var a=r._bitField;if(0==(50397184&a)){var o=this._length();o>0&&r._migrateCallback0(this);for(var s=1;s>>16)){if(t===this){var n=i();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=t,(65535&e)>0&&(0!=(134217728&e)?this._settlePromises():h.settlePromises(this),this._dereferenceTrace())}},D.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(this._setRejected(),this._fulfillmentHandler0=t,this._isFinal())return h.fatalError(t,c.isNode);(65535&e)>0?h.settlePromises(this):this._ensurePossibleRejectionHandled()}},D.prototype._fulfillPromises=function(t,e){for(var n=1;n0){if(0!=(16842752&t)){var n=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,n,t),this._rejectPromises(e,n)}else{var i=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,i,t),this._fulfillPromises(e,i)}this._setLength(0)}this._clearCancellationData()},D.prototype._settledValue=function(){var t=this._bitField;return 0!=(33554432&t)?this._rejectionHandler0:0!=(16777216&t)?this._fulfillmentHandler0:void 0},D.defer=D.pending=function(){return x.deprecated("Promise.defer","new Promise"),{promise:new D(p),resolve:A,reject:M}},c.notEnumerableProp(D,"_makeSelfResolutionError",i),t("./method")(D,p,y,a,x),t("./bind")(D,p,y,x),t("./cancel")(D,k,a,x),t("./direct_resolve")(D),t("./synchronous_inspection")(D),t("./join")(D,k,y,p,h,s),D.Promise=D,D.version="3.5.4",t("./map.js")(D,k,a,y,p,x),t("./call_get.js")(D),t("./using.js")(D,a,y,w,p,x),t("./timers.js")(D,p,x),t("./generators.js")(D,a,p,y,o,x),t("./nodeify.js")(D),t("./promisify.js")(D,p),t("./props.js")(D,k,y,a),t("./race.js")(D,p,y,a),t("./reduce.js")(D,k,a,y,p,x),t("./settle.js")(D,k,x),t("./some.js")(D,k,a),t("./filter.js")(D,p),t("./each.js")(D,p),t("./any.js")(D),c.toFastProperties(D),c.toFastProperties(D.prototype),I({a:1}),I({b:2}),I({c:3}),I(1),I(function(){}),I(void 0),I(!1),I(new D(p)),x.setBounds(u.firstLineError,c.lastLineError),D}},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(t,e,n){"use strict";e.exports=function(e,n,i,r,a){var o=t("./util");o.isArray;function s(t){var i=this._promise=new e(n);t instanceof e&&i._propagateFrom(t,3),i._setOnCancel(this),this._values=t,this._length=0,this._totalResolved=0,this._init(void 0,-2)}return o.inherits(s,a),s.prototype.length=function(){return this._length},s.prototype.promise=function(){return this._promise},s.prototype._init=function t(n,a){var s=i(this._values,this._promise);if(s instanceof e){var l=(s=s._target())._bitField;if(this._values=s,0==(50397184&l))return this._promise._setAsyncGuaranteed(),s._then(t,this._reject,void 0,this,a);if(0==(33554432&l))return 0!=(16777216&l)?this._reject(s._reason()):this._cancel();s=s._value()}if(null!==(s=o.asArray(s)))0!==s.length?this._iterate(s):-5===a?this._resolveEmptyArray():this._resolve(function(t){switch(t){case-2:return[];case-3:return{};case-6:return new Map}}(a));else{var c=r("expecting an array or an iterable object but got "+o.classString(s)).reason();this._promise._rejectCallback(c,!1)}},s.prototype._iterate=function(t){var n=this.getActualLength(t.length);this._length=n,this._values=this.shouldCopyValues()?new Array(n):this._values;for(var r=this._promise,a=!1,o=null,s=0;s=this._length&&(this._resolve(this._values),!0)},s.prototype._promiseCancelled=function(){return this._cancel(),!0},s.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},s.prototype._resultCancelled=function(){if(!this._isResolved()){var t=this._values;if(this._cancel(),t instanceof e)t.cancel();else for(var n=0;n=this._length){var n;if(this._isMap)n=function(t){for(var e=new a,n=t.length/2|0,i=0;i>1},e.prototype.props=function(){return u(this)},e.props=function(t){return u(t)}}},{"./es5":13,"./util":36}],26:[function(t,e,n){"use strict";function i(t){this._capacity=t,this._length=0,this._front=0}i.prototype._willBeOverCapacity=function(t){return this._capacity=this._length&&(this._resolve(this._values),!0)},a.prototype._promiseFulfilled=function(t,e){var n=new r;return n._bitField=33554432,n._settledValueField=t,this._promiseResolved(e,n)},a.prototype._promiseRejected=function(t,e){var n=new r;return n._bitField=16777216,n._settledValueField=t,this._promiseResolved(e,n)},e.settle=function(t){return i.deprecated(".settle()",".reflect()"),new a(t).promise()},e.prototype.settle=function(){return e.settle(this)}}},{"./util":36}],31:[function(t,e,n){"use strict";e.exports=function(e,n,i){var r=t("./util"),a=t("./errors").RangeError,o=t("./errors").AggregateError,s=r.isArray,l={};function c(t){this.constructor$(t),this._howMany=0,this._unwrap=!1,this._initialized=!1}function d(t,e){if((0|e)!==e||e<0)return i("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");var n=new c(t),r=n.promise();return n.setHowMany(e),n.init(),r}r.inherits(c,n),c.prototype._init=function(){if(this._initialized)if(0!==this._howMany){this._init$(void 0,-5);var t=s(this._values);!this._isResolved()&&t&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}else this._resolve([])},c.prototype.init=function(){this._initialized=!0,this._init()},c.prototype.setUnwrap=function(){this._unwrap=!0},c.prototype.howMany=function(){return this._howMany},c.prototype.setHowMany=function(t){this._howMany=t},c.prototype._promiseFulfilled=function(t){return this._addFulfilled(t),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0)},c.prototype._promiseRejected=function(t){return this._addRejected(t),this._checkOutcome()},c.prototype._promiseCancelled=function(){return this._values instanceof e||null==this._values?this._cancel():(this._addRejected(l),this._checkOutcome())},c.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var t=new o,e=this.length();e0?this._reject(t):this._cancel(),!0}return!1},c.prototype._fulfilled=function(){return this._totalResolved},c.prototype._rejected=function(){return this._values.length-this.length()},c.prototype._addRejected=function(t){this._values.push(t)},c.prototype._addFulfilled=function(t){this._values[this._totalResolved++]=t},c.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},c.prototype._getRangeError=function(t){var e="Input array must contain at least "+this._howMany+" items but contains only "+t+" items";return new a(e)},c.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},e.some=function(t,e){return d(t,e)},e.prototype.some=function(t){return d(this,t)},e._SomePromiseArray=c}},{"./errors":12,"./util":36}],32:[function(t,e,n){"use strict";e.exports=function(t){function e(t){void 0!==t?(t=t._target(),this._bitField=t._bitField,this._settledValueField=t._isFateSealed()?t._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}e.prototype._settledValue=function(){return this._settledValueField};var n=e.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},i=e.prototype.error=e.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},r=e.prototype.isFulfilled=function(){return 0!=(33554432&this._bitField)},a=e.prototype.isRejected=function(){return 0!=(16777216&this._bitField)},o=e.prototype.isPending=function(){return 0==(50397184&this._bitField)},s=e.prototype.isResolved=function(){return 0!=(50331648&this._bitField)};e.prototype.isCancelled=function(){return 0!=(8454144&this._bitField)},t.prototype.__isCancelled=function(){return 65536==(65536&this._bitField)},t.prototype._isCancelled=function(){return this._target().__isCancelled()},t.prototype.isCancelled=function(){return 0!=(8454144&this._target()._bitField)},t.prototype.isPending=function(){return o.call(this._target())},t.prototype.isRejected=function(){return a.call(this._target())},t.prototype.isFulfilled=function(){return r.call(this._target())},t.prototype.isResolved=function(){return s.call(this._target())},t.prototype.value=function(){return n.call(this._target())},t.prototype.reason=function(){var t=this._target();return t._unsetRejectionIsUnhandled(),i.call(t)},t.prototype._value=function(){return this._settledValue()},t.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},t.PromiseInspection=e}},{}],33:[function(t,e,n){"use strict";e.exports=function(e,n){var i=t("./util"),r=i.errorObj,a=i.isObject;var o={}.hasOwnProperty;return function(t,s){if(a(t)){if(t instanceof e)return t;var l=function(t){try{return function(t){return t.then}(t)}catch(t){return r.e=t,r}}(t);if(l===r){s&&s._pushContext();var c=e.reject(l.e);return s&&s._popContext(),c}if("function"==typeof l)return function(t){try{return o.call(t,"_promise0")}catch(t){return!1}}(t)?(c=new e(n),t._then(c._fulfill,c._reject,void 0,c,null),c):function(t,a,o){var s=new e(n),l=s;o&&o._pushContext(),s._captureStackTrace(),o&&o._popContext();var c=!0,d=i.tryCatch(a).call(t,function(t){s&&(s._resolveCallback(t),s=null)},function(t){s&&(s._rejectCallback(t,c,!0),s=null)});return c=!1,s&&d===r&&(s._rejectCallback(d.e,!0,!0),s=null),l}(t,l,s)}return t}}},{"./util":36}],34:[function(t,e,n){"use strict";e.exports=function(e,n,i){var r=t("./util"),a=e.TimeoutError;function o(t){this.handle=t}o.prototype._resultCancelled=function(){clearTimeout(this.handle)};var s=function(t){return l(+this).thenReturn(t)},l=e.delay=function(t,r){var a,l;return void 0!==r?(a=e.resolve(r)._then(s,null,null,t,void 0),i.cancellation()&&r instanceof e&&a._setOnCancel(r)):(a=new e(n),l=setTimeout(function(){a._fulfill()},+t),i.cancellation()&&a._setOnCancel(new o(l)),a._captureStackTrace()),a._setAsyncGuaranteed(),a};e.prototype.delay=function(t){return l(t,this)};function c(t){return clearTimeout(this.handle),t}function d(t){throw clearTimeout(this.handle),t}e.prototype.timeout=function(t,e){var n,s;t=+t;var l=new o(setTimeout(function(){n.isPending()&&function(t,e,n){var i;i="string"!=typeof e?e instanceof Error?e:new a("operation timed out"):new a(e),r.markAsOriginatingFromRejection(i),t._attachExtraTrace(i),t._reject(i),null!=n&&n.cancel()}(n,e,s)},t));return i.cancellation()?(s=this.then(),(n=s._then(c,d,void 0,l,void 0))._setOnCancel(l)):n=this._then(c,d,void 0,l,void 0),n}}},{"./util":36}],35:[function(t,e,n){"use strict";e.exports=function(e,n,i,r,a,o){var s=t("./util"),l=t("./errors").TypeError,c=t("./util").inherits,d=s.errorObj,u=s.tryCatch,h={};function f(t){setTimeout(function(){throw t},0)}function _(t,n){var r=0,o=t.length,s=new e(a);return function a(){if(r>=o)return s._fulfill();var l=function(t){var e=i(t);return e!==t&&"function"==typeof t._isDisposable&&"function"==typeof t._getDisposer&&t._isDisposable()&&e._setDisposable(t._getDisposer()),e}(t[r++]);if(l instanceof e&&l._isDisposable()){try{l=i(l._getDisposer().tryDispose(n),t.promise)}catch(t){return f(t)}if(l instanceof e)return l._then(a,f,null,null,null)}a()}(),s}function g(t,e,n){this._data=t,this._promise=e,this._context=n}function p(t,e,n){this.constructor$(t,e,n)}function v(t){return g.isDisposer(t)?(this.resources[this.index]._setDisposable(t),t.promise()):t}function m(t){this.length=t,this.promise=null,this[t-1]=null}g.prototype.data=function(){return this._data},g.prototype.promise=function(){return this._promise},g.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():h},g.prototype.tryDispose=function(t){var e=this.resource(),n=this._context;void 0!==n&&n._pushContext();var i=e!==h?this.doDispose(e,t):null;return void 0!==n&&n._popContext(),this._promise._unsetDisposable(),this._data=null,i},g.isDisposer=function(t){return null!=t&&"function"==typeof t.resource&&"function"==typeof t.tryDispose},c(p,g),p.prototype.doDispose=function(t,e){return this.data().call(t,t,e)},m.prototype._resultCancelled=function(){for(var t=this.length,n=0;n0},e.prototype._getDisposer=function(){return this._disposer},e.prototype._unsetDisposable=function(){this._bitField=-131073&this._bitField,this._disposer=void 0},e.prototype.disposer=function(t){if("function"==typeof t)return new p(t,this,r());throw new l}}},{"./errors":12,"./util":36}],36:[function(t,e,r){"use strict";var a=t("./es5"),o="undefined"==typeof navigator,s={e:{}},c,d="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==i?i:void 0!==this?this:null;function u(){try{var t=c;return c=null,t.apply(this,arguments)}catch(t){return s.e=t,s}}function h(t){return c=t,u}var f=function(t,e){var n={}.hasOwnProperty;function i(){for(var i in this.constructor=t,this.constructor$=e,e.prototype)n.call(e.prototype,i)&&"$"!==i.charAt(i.length-1)&&(this[i+"$"]=e.prototype[i])}return i.prototype=e.prototype,t.prototype=new i,t.prototype};function _(t){return null==t||!0===t||!1===t||"string"==typeof t||"number"==typeof t}function g(t){return"function"==typeof t||"object"===l(t)&&null!==t}function p(t){return _(t)?new Error(E(t)):t}function v(t,e){var n,i=t.length,r=new Array(i+1);for(n=0;n1,i=e.length>0&&!(1===e.length&&"constructor"===e[0]),r=w.test(t+"")&&a.names(t).length>0;if(n||i||r)return!0}return!1}catch(t){return!1}}function $(t){function e(){}e.prototype=t;var n=new e;function i(){return l(n.foo)}return i(),i(),t}var S=/^[a-z$_][a-z$_0-9]*$/i;function T(t){return S.test(t)}function C(t,e,n){for(var i=new Array(t),r=0;r10||t[0]>0}(),V.isNode&&V.toFastProperties(n);try{throw new Error}catch(t){V.lastLineError=t}e.exports=V},{"./es5":13}]},{},[4])(4)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise)}).call(this,n(43),n(15),n(212).setImmediate)},function(t,e,n){t.exports=n(213)},function(t,e,n){var i=n(0);t.exports=function(){var t={};return{getState:function(e){if(t[e])return t[e].method();var n={};for(var r in t)t[r].internal||i.mixin(n,t[r].method(),!0);return n},registerProvider:function(e,n,i){t[e]={method:n,internal:i}},unregisterProvider:function(e){delete t[e]}}}},function(t,e){t.exports=function(t){var e={};function n(n,i,r){r=r||n;var a=t.config,o=t.templates;t.config[n]&&e[r]!=a[n]&&(i&&o[r]||(o[r]=t.date.date_to_str(a[n]),e[r]=a[n]))}return{initTemplates:function(){var e=t.locale.labels;e.gantt_save_btn=e.icon_save,e.gantt_cancel_btn=e.icon_cancel,e.gantt_delete_btn=e.icon_delete;var i=t.date,r=i.date_to_str,a=t.config,o=r(a.xml_date||a.date_format,a.server_utc),s=i.str_to_date(a.xml_date||a.date_format,a.server_utc);n("date_scale",!0,void 0,t.config,t.templates),n("date_grid",!0,"grid_date_format",t.config,t.templates),n("task_date",!0,void 0,t.config,t.templates),t.mixin(t.templates,{xml_format:void 0,format_date:o,xml_date:void 0,parse_date:s,progress_text:function(t,e,n){return""},grid_header_class:function(t,e){return""},task_text:function(t,e,n){return n.text},task_class:function(t,e,n){return""},task_end_date:function(e){return t.templates.task_date(e)},grid_row_class:function(t,e,n){return""},task_row_class:function(t,e,n){return""},timeline_cell_class:function(t,e){return""},timeline_cell_content:function(t,e){return""},scale_cell_class:function(t){return""},scale_row_class:function(t){return""},grid_indent:function(t){return"
"},grid_folder:function(t){return"
"},grid_file:function(t){return"
"},grid_open:function(t){return"
"},grid_blank:function(t){return"
"},date_grid:function(e,n,i){return n&&t.isUnscheduledTask(n)&&t.config.show_unscheduled?t.templates.task_unscheduled_time(n):t.templates.grid_date_format(e,i)},task_time:function(e,n,i){return t.isUnscheduledTask(i)&&t.config.show_unscheduled?t.templates.task_unscheduled_time(i):t.templates.task_date(e)+" - "+t.templates.task_end_date(n)},task_unscheduled_time:function(t){return""},time_picker:r(a.time_picker),link_class:function(t){return""},link_description:function(e){var n=t.getTask(e.source),i=t.getTask(e.target);return""+n.text+""+i.text+""},drag_link:function(e,n,i,r){e=t.getTask(e);var a=t.locale.labels,o=""+e.text+" "+(n?a.link_start:a.link_end)+"
";return i&&(o+=" "+(i=t.getTask(i)).text+" "+(r?a.link_start:a.link_end)+"
"),o},drag_link_class:function(e,n,i,r){var a="";return e&&i&&(a=" "+(t.isLinkAllowed(e,i,n,r)?"gantt_link_allow":"gantt_link_deny")),"gantt_link_tooltip"+a},tooltip_date_format:i.date_to_str("%Y-%m-%d"),tooltip_text:function(e,n,i){return"Task: "+i.text+"
Start date: "+t.templates.tooltip_date_format(e)+"
End date: "+t.templates.tooltip_date_format(n)}})},initTemplate:n}}},function(t,e,n){var i=n(4),r=n(0),a=n(44),o=n(16),s=n(1);t.exports=function(t){function e(t){return{target:t.target||t.srcElement,pageX:t.pageX,pageY:t.pageY,clientX:t.clientX,clientY:t.clientY,metaKey:t.metaKey,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey}}function n(n,a){this._obj=n,this._settings=a||{},i(this);var o=this.getInputMethods();this._drag_start_timer=null,t.attachEvent("onGanttScroll",r.bind(function(t,e){this.clearDragTimer()},this));for(var l={passive:!1},c=0;cthis.config.sensitivity},initDnDMarker:function(){var t=this.config.marker=document.createElement("div");t.className="gantt_drag_marker",t.innerHTML="",document.body.appendChild(t)},backupEventTarget:function(n,i){if(t.config.touch){var r=i(n),a=r.target||r.srcElement,o=a.cloneNode(!0);this.config.original_target=e(r),this.config.original_target.target=o,this.config.backup_element=a,a.parentNode.appendChild(o),a.style.display="none",(this.config.mousemoveContainer||document.body).appendChild(a)}},getInputMethods:function(){var e=[];if(e.push({move:"mousemove",down:"mousedown",up:"mouseup",accessor:function(t){return t}}),t.config.touch){var n=!0;try{document.createEvent("TouchEvent")}catch(t){n=!1}n?e.push({move:"touchmove",down:"touchstart",up:"touchend",accessor:function(t){return t.touches&&t.touches.length>1?null:t.touches[0]?{target:document.elementFromPoint(t.touches[0].clientX,t.touches[0].clientY),pageX:t.touches[0].pageX,pageY:t.touches[0].pageY,clientX:t.touches[0].clientX,clientY:t.touches[0].clientY}:t}}):o.navigator.pointerEnabled?e.push({move:"pointermove",down:"pointerdown",up:"pointerup",accessor:function(t){return"mouse"==t.pointerType?null:t}}):o.navigator.msPointerEnabled&&e.push({move:"MSPointerMove",down:"MSPointerDown",up:"MSPointerUp",accessor:function(t){return t.pointerType==t.MSPOINTER_TYPE_MOUSE?null:t}})}return e},clearDragTimer:function(){this._drag_start_timer&&(clearTimeout(this._drag_start_timer),this._drag_start_timer=null)},dragStart:function(e,n,i){this.config&&this.config.started||(this.config={obj:e,marker:null,started:!1,pos:this.getPosition(n),sensitivity:4},this._settings&&r.mixin(this.config,this._settings,!0),this.traceDragEvents(e,i),t._prevent_touch_scroll=!0,document.body.className+=" gantt_noselect",t.config.touch&&this.dragMove(e,n,i.accessor))},dragMove:function(e,n,i){var r=i(n);if(!r)return!1;if(!this.config.marker&&!this.config.started){var a=this.getPosition(r);if(t.config.touch||this.checkPositionChange(a)){if(this.config.started=!0,this.config.ignore=!1,!1===this.callEvent("onBeforeDragStart",[e,this.config.original_target]))return this.config.ignore=!0,!1;this.backupEventTarget(n,i),this.initDnDMarker(),t._touch_feedback(),this.callEvent("onAfterDragStart",[e,this.config.original_target])}else this.config.ignore=!0}if(!this.config.ignore){if(n.targetTouches&&!r.target)return;return r.pos=this.getPosition(r),this.config.marker.style.left=r.pos.x+"px",this.config.marker.style.top=r.pos.y+"px",this.callEvent("onDragMove",[e,r]),!0}return!1},dragEnd:function(e){var n=this.config.backup_element;n&&n.parentNode&&n.parentNode.removeChild(n),t._prevent_touch_scroll=!1,this.config.marker&&(this.config.marker.parentNode.removeChild(this.config.marker),this.config.marker=null,this.callEvent("onDragEnd",[])),this.config.started=!1,document.body.className=document.body.className.replace(" gantt_noselect","")},getPosition:function(t){var e=0,n=0;return t.pageX||t.pageY?(e=t.pageX,n=t.pageY):(t.clientX||t.clientY)&&(e=t.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,n=t.clientY+document.body.scrollTop+document.documentElement.scrollTop),{x:e,y:n}}},n}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i={date_to_str:function(t,e,n){return function(i){return t.replace(/%[a-zA-Z]/g,function(t){switch(t){case"%d":return e?n.date.to_fixed(i.getUTCDate()):n.date.to_fixed(i.getDate());case"%m":return e?n.date.to_fixed(i.getUTCMonth()+1):n.date.to_fixed(i.getMonth()+1);case"%j":return e?i.getUTCDate():i.getDate();case"%n":return e?i.getUTCMonth()+1:i.getMonth()+1;case"%y":return e?n.date.to_fixed(i.getUTCFullYear()%100):n.date.to_fixed(i.getFullYear()%100);case"%Y":return e?i.getUTCFullYear():i.getFullYear();case"%D":return e?n.locale.date.day_short[i.getUTCDay()]:n.locale.date.day_short[i.getDay()];case"%l":return e?n.locale.date.day_full[i.getUTCDay()]:n.locale.date.day_full[i.getDay()];case"%M":return e?n.locale.date.month_short[i.getUTCMonth()]:n.locale.date.month_short[i.getMonth()];case"%F":return e?n.locale.date.month_full[i.getUTCMonth()]:n.locale.date.month_full[i.getMonth()];case"%h":return e?n.date.to_fixed((i.getUTCHours()+11)%12+1):n.date.to_fixed((i.getHours()+11)%12+1);case"%g":return e?(i.getUTCHours()+11)%12+1:(i.getHours()+11)%12+1;case"%G":return e?i.getUTCHours():i.getHours();case"%H":return e?n.date.to_fixed(i.getUTCHours()):n.date.to_fixed(i.getHours());case"%i":return e?n.date.to_fixed(i.getUTCMinutes()):n.date.to_fixed(i.getMinutes());case"%a":return e?i.getUTCHours()>11?"pm":"am":i.getHours()>11?"pm":"am";case"%A":return e?i.getUTCHours()>11?"PM":"AM":i.getHours()>11?"PM":"AM";case"%s":return e?n.date.to_fixed(i.getUTCSeconds()):n.date.to_fixed(i.getSeconds());case"%W":return e?n.date.to_fixed(n.date.getUTCISOWeek(i)):n.date.to_fixed(n.date.getISOWeek(i));default:return t}})}},str_to_date:function(t,e,n){return function(i){for(var r=[0,0,1,0,0,0],a=i.match(/[a-zA-Z]+|[0-9]+/g),o=t.match(/%[a-zA-Z]/g),s=0;s50?1900:2e3);break;case"%g":case"%G":case"%h":case"%H":r[3]=a[s]||0;break;case"%i":r[4]=a[s]||0;break;case"%Y":r[0]=a[s]||0;break;case"%a":case"%A":r[3]=r[3]%12+("am"===(a[s]||"").toLowerCase()?0:12);break;case"%s":r[5]=a[s]||0;break;case"%M":r[1]=n.locale.date.month_short_hash[a[s]]||0;break;case"%F":r[1]=n.locale.date.month_full_hash[a[s]]||0}return e?new Date(Date.UTC(r[0],r[1],r[2],r[3],r[4],r[5])):new Date(r[0],r[1],r[2],r[3],r[4],r[5])}}};e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i={date_to_str:function(t,e,n){t=t.replace(/%[a-zA-Z]/g,function(t){switch(t){case"%d":return'"+to_fixed(date.get'+(e?"UTC":"")+'Date())+"';case"%m":return'"+to_fixed((date.get'+(e?"UTC":"")+'Month()+1))+"';case"%j":return'"+date.get'+(e?"UTC":"")+'Date()+"';case"%n":return'"+(date.get'+(e?"UTC":"")+'Month()+1)+"';case"%y":return'"+to_fixed(date.get'+(e?"UTC":"")+'FullYear()%100)+"';case"%Y":return'"+date.get'+(e?"UTC":"")+'FullYear()+"';case"%D":return'"+locale.date.day_short[date.get'+(e?"UTC":"")+'Day()]+"';case"%l":return'"+locale.date.day_full[date.get'+(e?"UTC":"")+'Day()]+"';case"%M":return'"+locale.date.month_short[date.get'+(e?"UTC":"")+'Month()]+"';case"%F":return'"+locale.date.month_full[date.get'+(e?"UTC":"")+'Month()]+"';case"%h":return'"+to_fixed((date.get'+(e?"UTC":"")+'Hours()+11)%12+1)+"';case"%g":return'"+((date.get'+(e?"UTC":"")+'Hours()+11)%12+1)+"';case"%G":return'"+date.get'+(e?"UTC":"")+'Hours()+"';case"%H":return'"+to_fixed(date.get'+(e?"UTC":"")+'Hours())+"';case"%i":return'"+to_fixed(date.get'+(e?"UTC":"")+'Minutes())+"';case"%a":return'"+(date.get'+(e?"UTC":"")+'Hours()>11?"pm":"am")+"';case"%A":return'"+(date.get'+(e?"UTC":"")+'Hours()>11?"PM":"AM")+"';case"%s":return'"+to_fixed(date.get'+(e?"UTC":"")+'Seconds())+"';case"%W":return'"+to_fixed(getISOWeek(date))+"';case"%w":return'"+to_fixed(getWeek(date))+"';default:return t}});var i=new Function("date","to_fixed","locale","getISOWeek","getWeek",'return "'+t+'";');return function(t){return i(t,n.date.to_fixed,n.locale,n.date.getISOWeek,n.date.getWeek)}},str_to_date:function(t,e,n){for(var i="var temp=date.match(/[a-zA-Z]+|[0-9]+/g);",r=t.match(/%[a-zA-Z]/g),a=0;a50?1900:2000);";break;case"%g":case"%G":case"%h":case"%H":i+="set[3]=temp["+a+"]||0;";break;case"%i":i+="set[4]=temp["+a+"]||0;";break;case"%Y":i+="set[0]=temp["+a+"]||0;";break;case"%a":case"%A":i+="set[3]=set[3]%12+((temp["+a+"]||'').toLowerCase()=='am'?0:12);";break;case"%s":i+="set[5]=temp["+a+"]||0;";break;case"%M":i+="set[1]=locale.date.month_short_hash[temp["+a+"]]||0;";break;case"%F":i+="set[1]=locale.date.month_full_hash[temp["+a+"]]||0;"}var o="set[0],set[1],set[2],set[3],set[4],set[5]";e&&(o=" Date.UTC("+o+")");var s=new Function("date","locale","var set=[0,0,1,0,0,0]; "+i+" return new Date("+o+");");return function(t){return s(t,n.locale)}}};e.default=i},function(t,e,n){var i=n(219).default,r=n(218).default;t.exports=function(t){var e=null;function n(){var n=!1;return"auto"===t.config.csp?(null===e&&function(){try{new Function("canUseCsp = false;")}catch(t){e=!0}}(),n=e):n=t.config.csp,n}return{init:function(){for(var e=t.locale,n=e.date.month_short,i=e.date.month_short_hash={},r=0;r=9?9:n>=6?6:n>=3?3:0,t.setMonth(e),t},year_start:function(t){return t.setMonth(0),this.month_start(t)},day_start:function(t){return this.date_part(t)},hour_start:function(t){return t.getMinutes()&&t.setMinutes(0),this.minute_start(t),t},minute_start:function(t){return t.getSeconds()&&t.setSeconds(0),t.getMilliseconds()&&t.setMilliseconds(0),t},_add_days:function(t,e,n){t.setDate(t.getDate()+e);var i=e>=0,r=!n.getHours()&&t.getHours(),a=t.getDate()<=n.getDate()||t.getMonth()1&&r&&t.setHours(0),t},add:function(t,e,n){var i=new Date(t.valueOf());switch(n){case"day":i=this._add_days(i,e,t);break;case"week":i=this._add_days(i,7*e,t);break;case"month":i.setMonth(i.getMonth()+e);break;case"year":i.setYear(i.getFullYear()+e);break;case"hour":i.setTime(i.getTime()+60*e*60*1e3);break;case"minute":i.setTime(i.getTime()+60*e*1e3);break;default:return this["add_"+n](t,e,n)}return i},add_quarter:function(t,e){return this.add(t,3*e,"month")},to_fixed:function(t){return t<10?"0"+t:t},copy:function(t){return new Date(t.valueOf())},date_to_str:function(e,a){var o=i;return n()&&(o=r),o.date_to_str(e,a,t)},str_to_date:function(e,a){var o=i;return n()&&(o=r),o.str_to_date(e,a,t)},getISOWeek:function(e){return t.date._getWeekNumber(e,!0)},_getWeekNumber:function(t,e){if(!t)return!1;var n=t.getDay();e&&0===n&&(n=7);var i=new Date(t.valueOf());i.setDate(t.getDate()+(4-n));var r=i.getFullYear(),a=Math.round((i.getTime()-new Date(r,0,1).getTime())/864e5);return 1+Math.floor(a/7)},getWeek:function(e){return t.date._getWeekNumber(e,t.config.start_on_monday)},getUTCISOWeek:function(e){return t.date.getISOWeek(e)},convert_to_utc:function(t){return new Date(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds())},parseDate:function(e,n){return e&&!e.getFullYear&&("function"!=typeof n&&(n="string"==typeof n?"parse_date"===n||"xml_date"===n?t.defined(t.templates.xml_date)?t.templates.xml_date:t.templates.parse_date:t.defined(t.templates[n])?t.templates[n]:t.date.str_to_date(n):t.defined(t.templates.xml_date)?t.templates.xml_date:t.templates.parse_date),e=e?n(e):null),e}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){if("string"==typeof t||"number"==typeof t)return t;var e="";for(var n in t){var i="";t.hasOwnProperty(n)&&(i=n+"="+(i="string"==typeof t[n]?encodeURIComponent(t[n]):"number"==typeof t[n]?t[n]:encodeURIComponent(JSON.stringify(t[n]))),e.length&&(i="&"+i),e+=i)}return e}},function(t,e,n){function i(t){"@babel/helpers - typeof";return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var r=n(8),a=n(16),o=n(221).default;function s(t,e){var n={method:t};if(0===e.length)throw new Error("Arguments list of query is wrong.");if(1===e.length)return"string"==typeof e[0]?(n.url=e[0],n.async=!0):(n.url=e[0].url,n.async=e[0].async||!0,n.callback=e[0].callback,n.headers=e[0].headers),e[0].data?"string"!=typeof e[0].data?n.data=o(e[0].data):n.data=e[0].data:n.data="",n;switch(n.url=e[0],t){case"GET":case"DELETE":n.callback=e[1],n.headers=e[2];break;case"POST":case"PUT":e[1]?"string"!=typeof e[1]?n.data=o(e[1]):n.data=e[1]:n.data="",n.callback=e[2],n.headers=e[3]}return n}t.exports=function(t){return{cache:!0,method:"get",parse:function(t){return"string"!=typeof t?t:(t=t.replace(/^[\s]+/,""),"undefined"==typeof DOMParser||r.isIE?void 0!==a.ActiveXObject&&((e=new a.ActiveXObject("Microsoft.XMLDOM")).async="false",e.loadXML(t)):e=(new DOMParser).parseFromString(t,"text/xml"),e);var e},xmltop:function(e,n,i){if(void 0===n.status||n.status<400){var r=n.responseXML?n.responseXML||n:this.parse(n.responseText||n);if(r&&null!==r.documentElement&&!r.getElementsByTagName("parsererror").length)return r.getElementsByTagName(e)[0]}return-1!==i&&t.callEvent("onLoadXMLError",["Incorrect XML",arguments[1],i]),document.createElement("DIV")},xpath:function(t,e){if(e.nodeName||(e=e.responseXML||e),r.isIE)return e.selectNodes(t)||[];for(var n,i=[],a=(e.ownerDocument||e).evaluate(t,e,null,XPathResult.ANY_TYPE,null);n=a.iterateNext();)i.push(n);return i},query:function(t){return this._call(t.method||"GET",t.url,t.data||"",t.async||!0,t.callback,t.headers)},get:function(t,e,n){var i=s("GET",arguments);return this.query(i)},getSync:function(t,e){var n=s("GET",arguments);return n.async=!1,this.query(n)},put:function(t,e,n,i){var r=s("PUT",arguments);return this.query(r)},del:function(t,e,n){var i=s("DELETE",arguments);return this.query(i)},post:function(t,e,n,i){1==arguments.length?e="":2==arguments.length&&"function"==typeof e&&(e,e="");var r=s("POST",arguments);return this.query(r)},postSync:function(t,e,n){e=null===e?"":String(e);var i=s("POST",arguments);return i.async=!1,this.query(i)},_call:function(e,n,r,o,s,l){return new t.Promise(function(c,d){var u=void 0!==("undefined"==typeof XMLHttpRequest?"undefined":i(XMLHttpRequest))?new XMLHttpRequest:new a.ActiveXObject("Microsoft.XMLHTTP"),h=null!==navigator.userAgent.match(/AppleWebKit/)&&null!==navigator.userAgent.match(/Qt/)&&null!==navigator.userAgent.match(/Safari/);o&&(u.onreadystatechange=function(){if(4==u.readyState||h&&3==u.readyState){if((200!=u.status||""===u.responseText)&&!t.callEvent("onAjaxError",[u]))return;setTimeout(function(){"function"==typeof s&&s.apply(a,[{xmlDoc:u,filePath:n}]),c(u),"function"==typeof s&&(s=null,u=null)},0)}});var f=!this||!this.cache;if("GET"==e&&f&&(n+=(n.indexOf("?")>=0?"&":"?")+"dhxr"+(new Date).getTime()+"=1"),u.open(e,n,o),l)for(var _ in l)u.setRequestHeader(_,l[_]);else"POST"==e.toUpperCase()||"PUT"==e||"DELETE"==e?u.setRequestHeader("Content-Type","application/x-www-form-urlencoded"):"GET"==e&&(r=null);if(u.setRequestHeader("X-Requested-With","XMLHttpRequest"),u.send(r),!o)return{xmlDoc:u,filePath:n}})},urlSeparator:function(t){return-1!=t.indexOf("?")?"&":"?"}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),t.exports=function(){return{layout:{css:"gantt_container",rows:[{cols:[{view:"grid",scrollX:"scrollHor",scrollY:"scrollVer"},{resizer:!0,width:1},{view:"timeline",scrollX:"scrollHor",scrollY:"scrollVer"},{view:"scrollbar",id:"scrollVer"}]},{view:"scrollbar",id:"scrollHor",height:20}]},links:{finish_to_start:"0",start_to_start:"1",finish_to_finish:"2",start_to_finish:"3"},types:{task:"task",project:"project",milestone:"milestone"},auto_types:!1,duration_unit:"day",work_time:!1,correct_work_time:!1,skip_off_time:!1,cascade_delete:!0,autosize:!1,autosize_min_width:0,autoscroll:!0,autoscroll_speed:30,deepcopy_on_parse:!1,show_links:!0,show_task_cells:!0,static_background:!1,static_background_cells:!0,branch_loading:!1,branch_loading_property:"$has_child",show_loading:!1,show_chart:!0,show_grid:!0,min_duration:36e5,date_format:"%d-%m-%Y %H:%i",xml_date:void 0,start_on_monday:!0,server_utc:!1,show_progress:!0,fit_tasks:!1,select_task:!0,scroll_on_click:!0,smart_rendering:!0,preserve_scroll:!0,readonly:!1,container_resize_timeout:20,date_grid:"%Y-%m-%d",drag_links:!0,drag_progress:!0,drag_resize:!0,drag_project:!1,drag_move:!0,drag_mode:{resize:"resize",progress:"progress",move:"move",ignore:"ignore"},round_dnd_dates:!0,link_wrapper_width:20,root_id:0,autofit:!1,columns:[{name:"text",tree:!0,width:"*",resize:!0},{name:"start_date",align:"center",resize:!0},{name:"duration",align:"center"},{name:"add",width:44}],scale_offset_minimal:!0,inherit_scale_class:!1,scales:[{unit:"day",step:1,date:"%d %M"}],time_step:60,duration_step:1,task_date:"%d %F %Y",time_picker:"%H:%i",task_attribute:"data-task-id",link_attribute:"data-link-id",layer_attribute:"data-layer",buttons_left:["gantt_save_btn","gantt_cancel_btn"],_migrate_buttons:{dhx_save_btn:"gantt_save_btn",dhx_cancel_btn:"gantt_cancel_btn",dhx_delete_btn:"gantt_delete_btn"},buttons_right:["gantt_delete_btn"],lightbox:{sections:[{name:"description",height:70,map_to:"text",type:"textarea",focus:!0},{name:"time",type:"duration",map_to:"auto"}],project_sections:[{name:"description",height:70,map_to:"text",type:"textarea",focus:!0},{name:"type",type:"typeselect",map_to:"type"},{name:"time",type:"duration",readonly:!0,map_to:"auto"}],milestone_sections:[{name:"description",height:70,map_to:"text",type:"textarea",focus:!0},{name:"type",type:"typeselect",map_to:"type"},{name:"time",type:"duration",single_date:!0,map_to:"auto"}]},drag_lightbox:!0,sort:!1,details_on_create:!0,details_on_dblclick:!0,initial_scroll:!0,task_scroll_offset:100,order_branch:!1,order_branch_free:!1,task_height:void 0,bar_height:"full",min_column_width:70,min_grid_column_width:70,grid_resizer_column_attribute:"data-column-index",keep_grid_width:!1,grid_resize:!1,grid_elastic_columns:!1,show_tasks_outside_timescale:!1,show_unscheduled:!0,resize_rows:!1,task_grid_row_resizer_attribute:"data-row-index",min_task_grid_row_height:30,readonly_property:"readonly",editable_property:"editable",calendar_property:"calendar_id",resource_calendars:{},dynamic_resource_calendars:!1,inherit_calendar:!1,type_renderers:{},open_tree_initially:!1,optimize_render:!0,prevent_default_scroll:!1,show_errors:!0,wai_aria_attributes:!0,smart_scales:!0,rtl:!1,placeholder_task:!1,horizontal_scroll_key:"shiftKey",drag_timeline:{useKey:void 0,ignore:".gantt_task_line, .gantt_task_link"},drag_multiple:!0,csp:"auto"}}},function(t,e){t.exports=function(){var t={};return{services:{},setService:function(e,n){t[e]=n},getService:function(e){return t[e]?t[e]():null},dropService:function(e){t[e]&&delete t[e]},destructor:function(){for(var e in t)if(t[e]){var n=t[e];n&&n.destructor&&n.destructor()}t=null}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){return function(t){var e=this;for(var n in this.addExtension=function(t,n){e._extensions[t]=n},this.getExtension=function(t){return e._extensions[t]},this._extensions={},t)this._extensions[n]=t[n]}}();e.default=i},function(t,e){t.exports={KEY_CODES:{UP:38,DOWN:40,LEFT:37,RIGHT:39,SPACE:32,ENTER:13,DELETE:46,ESC:27,TAB:9}}},function(t,e,n){function i(t){"@babel/helpers - typeof";return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t.exports=function(t){var e=new function(){this.constants=n(226),this.version="8.0.0",this.license="gpl",this.templates={},this.ext={},this.keys={edit_save:this.constants.KEY_CODES.ENTER,edit_cancel:this.constants.KEY_CODES.ESC}},r=new(0,n(225).default)(t),a={};e.plugins=function(t){for(var n in t)if(t[n]&&!a[n]){var i=r.getExtension(n);i&&(i(e),a[n]=!0)}return a},e.$services=n(224)(),e.config=n(223)(),e.ajax=n(222)(e),e.date=n(220)(e);var o=n(217)(e);e.$services.setService("dnd",function(){return o});var s=n(216)(e);e.$services.setService("templateLoader",function(){return s}),n(4)(e);var l=new(n(215));l.registerProvider("global",function(){var t={min_date:e._min_date,max_date:e._max_date,selected_task:null};return e.$data&&e.$data.tasksStore&&(t.selected_task=e.$data.tasksStore.getSelectedId()),t}),e.getState=l.getState,e.$services.setService("state",function(){return l});var c=n(0);c.mixin(e,c),e.Promise=n(214),e.env=n(8),n(210)(e);var d=n(204);e.dataProcessor=d.DEPRECATED_api,e.createDataProcessor=d.createDataProcessor,n(199)(e),n(189)(e),n(188)(e),n(180)(e),n(179)(e),n(178)(e),n(165)(e),n(164).default(e),n(163)(e),n(162)(e),n(161)(e),n(158)(e),n(157).default(e);var u=n(156).default();return e.i18n={addLocale:u.addLocale,setLocale:function(t){if("string"==typeof t){var n=u.getLocale(t);n||(n=u.getLocale("en")),e.locale=n}else if(t)if(e.locale)for(var r in t)t[r]&&"object"===i(t[r])?(e.locale[r]||(e.locale[r]={}),e.mixin(e.locale[r],t[r],!0)):e.locale[r]=t[r];else e.locale=t},getLocale:u.getLocale},e.i18n.setLocale("en"),e}},function(t,e,n){n(28);var i=n(227);t.exports=function(t){var e=i(t);return e.env.isNode||n(122)(e),e}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=10,r=function(){function t(t){var e=this;this.maxSteps=i,this.undoEnabled=!0,this.redoEnabled=!0,this.action={create:function(t){return{commands:t?t.slice():[]}},invert:function(t){for(var n,i=e._gantt.copy(t),r=e.command,a=0;athis.maxSteps;)t.shift();return e}}},t.prototype._pop=function(t){return t.pop()},t.prototype._reorderCommands=function(t){var e={any:0,link:1,task:2},n={move:1,any:0};t.commands.sort(function(t,i){if("task"===t.entity&&"task"===i.entity)return t.type!==i.type?(n[i.type]||0)-(n[t.type]||0):"move"===t.type&&t.oldValue&&i.oldValue&&i.oldValue.parent===t.oldValue.parent?t.oldValue.$index-i.oldValue.$index:0;var r=e[t.entity]||e.any;return(e[i.entity]||e.any)-r})},t.prototype._applyAction=function(t){var e=null,n=this.command.entity,i=this.command.type,r=this._gantt,a={};a[n.task]={add:"addTask",get:"getTask",update:"updateTask",remove:"deleteTask",move:"moveTask",isExists:"isTaskExists"},a[n.link]={add:"addLink",get:"getLink",update:"updateLink",remove:"deleteLink",isExists:"isLinkExists"},r.batchUpdate(function(){for(var n=0;nn.bottom&&(a.bottom=n.bottom,a.top=a.bottom-a.height),a.leftn.right&&(a.right=n.right,a.left=a.right-a.width),c.x>=a.left&&c.x<=a.right&&(a.left=c.x-a.width-o,a.right=a.left+a.width),c.y>=a.top&&c.y<=a.bottom&&(a.top=c.y-a.height-s,a.bottom=a.top+a.height),a},t.prototype._getViewPortSize=function(){var t,e=this._gantt,n=this._getViewPort(),r=n,a=window.scrollY+document.body.scrollTop,o=window.scrollX+document.body.scrollLeft;return n===e.$task_data?(r=e.$task,a=0,o=0,t=i.getNodePosition(e.$task)):t=i.getNodePosition(r),{left:t.x+o,top:t.y+a,width:t.width,height:t.height,bottom:t.y+t.height+a,right:t.x+t.width+o}},t}();e.Tooltip=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(45),r=n(1),a=n(2),o=n(232),s=function(){function t(t){this._listeners={},this.tooltip=new o.Tooltip(t),this._gantt=t,this._domEvents=i(),this._initDelayedFunctions()}return t.prototype.destructor=function(){this.tooltip.hide(),this._domEvents.detachAll()},t.prototype.hideTooltip=function(){this.delayHide()},t.prototype.attach=function(t){var e=this,n=document.body,i=this._gantt;t.global||(n=i.$root);var a=null,o=function(n){var i=r.getTargetNode(n),o=r.closest(i,t.selector);if(!r.isChildOf(i,e.tooltip.getNode())){var s=function(){a=o,t.onmouseenter(n,o)};a?o&&o===a?t.onmousemove(n,o):(t.onmouseleave(n,a),a=null,o&&o!==a&&s()):o&&s()}};this.detach(t.selector),this._domEvents.attach(n,"mousemove",o),this._listeners[t.selector]={node:n,handler:o}},t.prototype.detach=function(t){var e=this._listeners[t];e&&this._domEvents.detach(e.node,"mousemove",e.handler)},t.prototype.tooltipFor=function(t){var e=this,n=function(t){var e=t;return document.createEventObject&&!document.createEvent&&(e=document.createEventObject(t)),e};this._initDelayedFunctions(),this.attach({selector:t.selector,global:t.global,onmouseenter:function(i,r){var a=t.html(i,r);a&&e.delayShow(n(i),a)},onmousemove:function(i,r){var a=t.html(i,r);a?e.delayShow(n(i),a):(e.delayShow.$cancelTimeout(),e.delayHide())},onmouseleave:function(){e.delayShow.$cancelTimeout(),e.delayHide()}})},t.prototype._initDelayedFunctions=function(){var t=this,e=this._gantt;this.delayShow&&this.delayShow.$cancelTimeout(),this.delayHide&&this.delayHide.$cancelTimeout(),this.tooltip.hide(),this.delayShow=a.delay(function(n,i){!1===e.callEvent("onBeforeTooltip",[n])?t.tooltip.hide():(t.tooltip.setContent(i),t.tooltip.show(n))},e.config.tooltip_timeout||1),this.delayHide=a.delay(function(){t.delayShow.$cancelTimeout(),t.tooltip.hide()},e.config.tooltip_hide_timeout||1)},t}();e.TooltipManager=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(233);e.default=function(t){t.config.tooltip_timeout=30,t.config.tooltip_offset_y=20,t.config.tooltip_offset_x=10,t.config.tooltip_hide_timeout=30;var e=new i.TooltipManager(t);t.ext.tooltips=e,t.attachEvent("onGanttReady",function(){e.tooltipFor({selector:"["+t.config.task_attribute+"]:not(.gantt_task_row)",html:function(e){if(!t.config.touch||t.config.touch_tooltip){var n=t.locate(e);if(t.isTaskExists(n)){var i=t.getTask(n);return t.templates.tooltip_text(i.start_date,i.end_date,i)}return null}},global:!1})}),t.attachEvent("onDestroy",function(){e.destructor()}),t.attachEvent("onLightbox",function(){e.hideTooltip()}),t.attachEvent("onBeforeTooltip",function(){if(t.getState().link_source_id)return!1}),t.attachEvent("onGanttScroll",function(){e.hideTooltip()})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){var e=this;this.show=function(t,n){void 0===n?e._showForTask(t):e._showAtCoordinates(t,n)},this.hide=function(t){var n=e._gantt,i=e._quickInfoBox;e._quickInfoBoxId=0;var r=e._quickInfoTask;if(e._quickInfoTask=null,i&&i.parentNode){if(n.config.quick_info_detached)return n.callEvent("onAfterQuickInfo",[r]),i.parentNode.removeChild(i);i.className+=" gantt_qi_hidden","auto"===i.style.right?i.style.left="-350px":i.style.right="-350px",t&&(i.style.left=i.style.right="",i.parentNode.removeChild(i)),n.callEvent("onAfterQuickInfo",[r])}},this.getNode=function(){return e._quickInfoBox?e._quickInfoBox:null},this.setContainer=function(t){t&&(e._container="string"==typeof t?document.getElementById(t):t)},this.setContent=function(t){var n=e._gantt,i={taskId:null,header:{title:"",date:""},content:"",buttons:n.config.quickinfo_buttons};t||(t=i),t.taskId||(t.taskId=i.taskId),t.header||(t.header=i.header),t.header.title||(t.header.title=i.header.title),t.header.date||(t.header.date=i.header.date),t.content||(t.content=i.content),t.buttons||(t.buttons=i.buttons);var r=e.getNode();r||(r=e._createQuickInfoElement()),t.taskId&&(e._quickInfoBoxId=t.taskId);var a=r.querySelector(".gantt_cal_qi_title"),o=a.querySelector(".gantt_cal_qi_tcontent"),s=a.querySelector(".gantt_cal_qi_tdate"),l=r.querySelector(".gantt_cal_qi_content"),c=r.querySelector(".gantt_cal_qi_controls");n._waiAria.quickInfoHeader(r,[t.header.title,t.header.date].join(" ")),o.innerHTML=t.header.title,s.innerHTML=t.header.date,t.header.title||t.header.date?a.style.display="":a.style.display="none",l.innerHTML=t.content;var d=t.buttons;d.length?c.style.display="":c.style.display="none";for(var u="",h=0;h
"+n.locale.labels[d[h]]+"
"}c.innerHTML=u,n.eventRemove(r,"click",e._qiButtonClickHandler),n.eventRemove(r,"keypress",e._qiKeyPressHandler),n.event(r,"click",e._qiButtonClickHandler),n.event(r,"keypress",e._qiKeyPressHandler)},this._qiButtonClickHandler=function(t){t=t||event,e._qi_button_click(t.target||t.srcElement)},this._qiKeyPressHandler=function(t){var n=(t=t||event).which||event.keyCode;13!==n&&32!==n||setTimeout(function(){e._qi_button_click(t.target||t.srcElement)},1)},this._gantt=t}return t.prototype._showAtCoordinates=function(t,e){this.hide(!0),this._quickInfoBoxId=0,this._quickInfoTask=null,this._quickInfoBox||(this._createQuickInfoElement(),this.setContent()),this._appendAtCoordinates(t,e),this._gantt.callEvent("onQuickInfo",[null])},t.prototype._showForTask=function(t){var e=this._gantt;if((t!==this._quickInfoBoxId||!e.utils.dom.isChildOf(this._quickInfoBox,document.body))&&e.config.show_quick_info){this.hide(!0);var n=this._getContainer(),i=this._get_event_counter_part(t,6,n.xViewport,n.yViewport);i&&(this._quickInfoBox=this._init_quick_info(t),this._quickInfoTask=t,this._quickInfoBox.className=this._prepare_quick_info_classname(t),this._fill_quick_data(t),this._show_quick_info(i,6),e.callEvent("onQuickInfo",[t]))}},t.prototype._get_event_counter_part=function(t,e,n,i){var r=this._gantt,a=r.getTaskNode(t);if(!a&&!(a=r.getTaskRowNode(t)))return null;var o=0,s=e+a.offsetTop+a.offsetHeight,l=a;if(r.utils.dom.isChildOf(l,n))for(;l&&l!==n;)o+=l.offsetLeft,l=l.offsetParent;var c=r.getScrollState();return l?{left:o,top:s,dx:o+a.offsetWidth/2-c.x>n.offsetWidth/2?1:0,dy:s+a.offsetHeight/2-c.y>i.offsetHeight/2?1:0,width:a.offsetWidth,height:a.offsetHeight}:null},t.prototype._createQuickInfoElement=function(){var t=this,e=this._gantt,n=document.createElement("div");n.className+="gantt_cal_quick_info",e._waiAria.quickInfoAttr(n);var i='
';if(i+='
',i+="
",n.innerHTML=i,e.config.quick_info_detached){var r=this._getContainer();e.event(r.parent,"scroll",function(){t.hide()})}return this._quickInfoBox=n,n},t.prototype._init_quick_info=function(t){var e=this._gantt,n=e.getTask(t);return"boolean"==typeof this._quickInfoReadonly&&e.isReadonly(n)!==this._quickInfoReadonly&&(this.hide(!0),this._quickInfoBox=null),this._quickInfoReadonly=e.isReadonly(n),this._quickInfoBox||(this._quickInfoBox=this._createQuickInfoElement()),this._quickInfoBox},t.prototype._prepare_quick_info_classname=function(t){var e=this._gantt,n=e.getTask(t),i="gantt_cal_quick_info",r=e.templates.quick_info_class(n.start_date,n.end_date,n);return r&&(i+=" "+r),i},t.prototype._fill_quick_data=function(t){var e=this._gantt,n=e.getTask(t);this._quickInfoBoxId=t;var i=[];if(this._quickInfoReadonly)for(var r=e.config.quickinfo_buttons,a={icon_delete:!0,icon_edit:!0},o=0;oc.offsetHeight/2&&(h=t.top-(o+t.height+2*e))t.getGlobalTaskIndex(n)?1:-1}),e},forSelected:function(t){for(var e=this.getSelected(),n=0;nl?t.getNext(c):t.getPrev(c);for(c=n;t.getGlobalTaskIndex(c)!==i;)this.select(c,e)&&!a&&(a=!0,r=c),c=i>s?t.getNext(c):t.getPrev(c)}}else o=n}.bind(this);return s&&(e.ctrlKey||e.metaKey)?(this.isSelected(n)||this.setFirstSelected(n),n&&this.toggle(n,e)):s&&e.shiftKey?(t.isTaskExists(this.getFirstSelected())&&null!==this.getFirstSelected()||this.setFirstSelected(n),i.length?c():l()):l(),this.isSelected(n)?this.setLastSelected(n):r?n==o&&this.setLastSelected(e.shiftKey?r:this.getDefaultSelected()):this.setLastSelected(null),this.getSelected().length||this.setLastSelected(null),this.getLastSelected()&&this.isSelected(this.getFirstSelected())||this.setFirstSelected(this.getLastSelected()),!0}},function(){var e=t.selectTask;t.selectTask=function(n){if(!(n=i(n,this.config.root_id)))return!1;var r=t._multiselect,a=n;return r.isActive()?(r.select(n,null)&&r.setLastSelected(n),r.setFirstSelected(r.getLastSelected())):a=e.call(this,n),a};var n=t.unselectTask;t.unselectTask=function(e){var i=t._multiselect,r=i.isActive();(e=e||i.getLastSelected())&&r&&(i.unselect(e,null),e==i.getLastSelected()&&i.setLastSelected(null),t.refreshTask(e),i.setFirstSelected(i.getLastSelected()));var a=e;return r||(a=n.call(this,e)),a},t.toggleTaskSelection=function(e){var n=t._multiselect;e&&n.isActive()&&(n.toggle(e),n.setFirstSelected(n.getLastSelected()))},t.getSelectedTasks=function(){var e=t._multiselect;return e.isActive(),e.getSelected()},t.eachSelectedTask=function(t){return this._multiselect.forSelected(t)},t.isSelectedTask=function(t){return this._multiselect.isSelected(t)},t.getLastSelectedTask=function(){return this._multiselect.getLastSelected()},t.attachEvent("onGanttReady",function(){var e=t.$data.tasksStore.isSelected;t.$data.tasksStore.isSelected=function(n){return t._multiselect.isActive()?t._multiselect.isSelected(n):e.call(this,n)}})}(),t.attachEvent("onTaskIdChange",function(e,n){var i=t._multiselect;if(!i.isActive())return!0;t.isSelectedTask(e)&&(i.unselect(e,null),i.select(n,null))}),t.attachEvent("onAfterTaskDelete",function(e,n){var i=t._multiselect;if(!i.isActive())return!0;i._selected[e]&&(i.unselect(e,null),i._selected[e]=!1,i.setLastSelected(i.getDefaultSelected())),i.forSelected(function(e){t.isTaskExists(e)||i.unselect(e,null)})}),t.attachEvent("onBeforeTaskMultiSelect",function(e,n,i){var r=t._multiselect;return!(n&&r.isActive()&&r._one_level)||r.isSameLevel(e)}),t.attachEvent("onTaskClick",function(e,n){return t._multiselect.doSelection(n)&&t.callEvent("onMultiSelect",[n]),!0})}},function(t,e){t.exports=function(t){function e(e){if(!t.config.show_markers)return!1;if(!e.start_date)return!1;var n=t.getState();if(!(+e.start_date>+n.max_date||(!e.end_date||+e.end_date<+n.min_date)&&+e.start_date<+n.min_date)){var i=document.createElement("div");i.setAttribute("data-marker-id",e.id);var r="gantt_marker";t.templates.marker_class&&(r+=" "+t.templates.marker_class(e)),e.css&&(r+=" "+e.css),e.title&&(i.title=e.title),i.className=r;var a=t.posFromDate(e.start_date);i.style.left=a+"px";var o=Math.max(t.getRowTop(t.getVisibleTaskCount()),0)+"px";if(t.config.timeline_placeholder&&(o=t.$container.scrollHeight+"px"),i.style.height=o,e.end_date){var s=t.posFromDate(e.end_date);i.style.width=Math.max(s-a,0)+"px"}return e.text&&(i.innerHTML="
"+e.text+"
"),i}}function n(){if(t.$task_data){var e=document.createElement("div");e.className="gantt_marker_area",t.$task_data.appendChild(e),t.$marker_area=e}}t._markers||(t._markers=t.createDatastore({name:"marker",initItem:function(e){return e.id=e.id||t.uid(),e}})),t.config.show_markers=!0,t.attachEvent("onBeforeGanttRender",function(){t.$marker_area||n()}),t.attachEvent("onDataRender",function(){t.$marker_area||(n(),t.renderMarkers())}),t.attachEvent("onGanttLayoutReady",function(){t.attachEvent("onBeforeGanttRender",function(){n(),t.$services.getService("layers").createDataRender({name:"marker",defaultContainer:function(){return t.$marker_area}}).addLayer(e)},{once:!0})}),t.getMarker=function(t){return this._markers?this._markers.getItem(t):null},t.addMarker=function(t){return this._markers.addItem(t)},t.deleteMarker=function(t){return!!this._markers.exists(t)&&(this._markers.removeItem(t),!0)},t.updateMarker=function(t){this._markers.refresh(t)},t._getMarkers=function(){return this._markers.getItems()},t.renderMarkers=function(){this._markers.refresh()}}},function(t,e){t.exports=function(t){t.$keyboardNavigation.dispatcher={isActive:!1,activeNode:null,globalNode:new t.$keyboardNavigation.GanttNode,enable:function(){this.isActive=!0,this.setActiveNode(this.getActiveNode())},disable:function(){this.isActive=!1},isEnabled:function(){return!!this.isActive},getDefaultNode:function(){var e;return(e=t.config.keyboard_navigation_cells?new t.$keyboardNavigation.TaskCell:new t.$keyboardNavigation.TaskRow).isValid()||(e=e.fallback()),e},setDefaultNode:function(){this.setActiveNode(this.getDefaultNode())},getActiveNode:function(){var t=this.activeNode;return t&&!t.isValid()&&(t=t.fallback()),t},fromDomElement:function(e){for(var n=[t.$keyboardNavigation.TaskRow,t.$keyboardNavigation.TaskCell,t.$keyboardNavigation.HeaderCell],i=0;i=0&&!i[r];)r--;i[r]&&(n=new t.$keyboardNavigation.TaskCell(e.taskId,r))}return n},fromDomElement:function(n){if(!t.config.keyboard_navigation_cells)return null;var i=t.locate(n);if(t.isTaskExists(i)){var r=0,a=e.locateAttribute(n,"data-column-index");return a&&(r=1*a.getAttribute("data-column-index")),new t.$keyboardNavigation.TaskCell(i,r)}return null},getNode:function(){if(t.isTaskExists(this.taskId)&&t.isTaskVisible(this.taskId)){if(t.config.show_grid){var e=t.$grid.querySelector(".gantt_row["+t.config.task_attribute+"='"+this.taskId+"']");return e?e.querySelector("[data-column-index='"+this.columnIndex+"']"):null}return t.getTaskNode(this.taskId)}},keys:{up:function(){var e=null,n=t.getPrev(this.taskId);e=t.isTaskExists(n)?new t.$keyboardNavigation.TaskCell(n,this.columnIndex):new t.$keyboardNavigation.HeaderCell(this.columnIndex),this.moveTo(e)},down:function(){var e=t.getNext(this.taskId);t.isTaskExists(e)&&this.moveTo(new t.$keyboardNavigation.TaskCell(e,this.columnIndex))},left:function(){this.columnIndex>0&&this.moveTo(new t.$keyboardNavigation.TaskCell(this.taskId,this.columnIndex-1))},right:function(){var e=t.getGridColumns();this.columnIndex-1},fallback:function(){if(!t.getVisibleTaskCount()){var e=new t.$keyboardNavigation.HeaderCell;return e.isValid()?e:null}var n=-1;if(t.getTaskByIndex(this.globalIndex-1))n=this.globalIndex-1;else if(t.getTaskByIndex(this.globalIndex+1))n=this.globalIndex+1;else for(var i=this.globalIndex;i>=0;){if(t.getTaskByIndex(i)){n=i;break}i--}if(n>-1)return new t.$keyboardNavigation.TaskRow(t.getTaskByIndex(n).id)},fromDomElement:function(e){if(t.config.keyboard_navigation_cells)return null;var n=t.locate(e);return t.isTaskExists(n)?new t.$keyboardNavigation.TaskRow(n):null},getNode:function(){if(t.isTaskExists(this.taskId)&&t.isTaskVisible(this.taskId))return t.config.show_grid?t.$grid.querySelector(".gantt_row["+t.config.task_attribute+"='"+this.taskId+"']"):t.getTaskNode(this.taskId)},focus:function(e){if(!e){var n,i,r=t.getTaskPosition(t.getTask(this.taskId)),a=t.getTaskHeight(this.taskId),o=t.getScrollState();n=t.$task?t.$task.offsetWidth:o.inner_width,i=t.$grid_data||t.$task_data?(t.$grid_data||t.$task_data).offsetHeight:o.inner_height,r.topo.y+i?t.scrollTo(null,r.top-5*a):t.config.scroll_on_click&&t.config.show_chart&&(r.left>o.x+n?t.scrollTo(r.left-t.config.task_scroll_offset):r.left+r.width=0&&!e[n];)n--;return e[n]?new t.$keyboardNavigation.HeaderCell(n):null},fromDomElement:function(n){var i=e.locateClassName(n,"gantt_grid_head_cell");if(i){for(var r=0;i&&i.previousSibling;)i=i.previousSibling,r+=1;return new t.$keyboardNavigation.HeaderCell(r)}return null},getNode:function(){return t.$grid_scale.childNodes[this.index]},keys:{left:function(){this.index>0&&this.moveTo(new t.$keyboardNavigation.HeaderCell(this.index-1))},right:function(){var e=t.getGridColumns();this.index=r.length-1){var c=r[0];if(c)return c.focus(),i.preventDefault(),!0}return!1}}()}},function(t,e){t.exports=function(t){t.$keyboardNavigation.EventHandler={_handlers:null,findHandler:function(e){this._handlers||(this._handlers={});var n=t.$keyboardNavigation.shortcuts.getHash(e);return this._handlers[n]},doAction:function(e,n){var i=this.findHandler(e);if(i){if(!1===t.$keyboardNavigation.facade.callEvent("onBeforeAction",[e,n]))return;i.call(this,n),n.preventDefault?n.preventDefault():n.returnValue=!1}},bind:function(e,n){this._handlers||(this._handlers={});for(var i=t.$keyboardNavigation.shortcuts,r=i.parse(e),a=0;a=96&&e.keyCode<=105&&(e.keyCode-=48);var n=String.fromCharCode(e.keyCode);return n&&(e.keyCode=n.toLowerCase().charCodeAt(0)),e},getHashFromEvent:function(t){return this.getHash(this.getCommandFromEvent(t))},getHash:function(t){var e=[];for(var n in t.modifiers)t.modifiers[n]&&e.push(n);return e.push(t.keyCode),e.join(this.junctionChar)},getExpressions:function(t){return t.split(this.junctionChar)},getWords:function(t){return t.split(this.combinationChar)},trim:function(t){return t.replace(/\s/g,"")},junctionChar:",",combinationChar:"+",commandKeys:{shift:16,alt:18,ctrl:17,meta:!0},specialKeys:{backspace:8,tab:9,enter:13,esc:27,space:32,up:38,down:40,left:37,right:39,home:36,end:35,pageup:33,pagedown:34,delete:46,insert:45,plus:107,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123}}}},function(t,e,n){t.exports=function(t){var e=n(4);!function(t){t.config.keyboard_navigation=!0,t.config.keyboard_navigation_cells=!1,t.$keyboardNavigation={},t._compose=function(){for(var t=Array.prototype.slice.call(arguments,0),e={},n=0;n=10){for(var t=e._trace.slice(e._trace.length-10),n=[],i=1;i75&&(i=0)),{x:e._scrollState.x+i,y:e._scrollState.y+r}},this._setScrollPosition=function(t,n){var i=e._gantt;requestAnimationFrame(function(){i.$ui.getView(t.$config.scrollX).scroll(n.x),i.$ui.getView(t.$config.scrollY).scroll(n.y)})},this._stopDrag=function(t){var n=e._gantt;if(e._trace=[],n.$root.classList.remove("gantt_noselect"),void 0!==e._originalReadonly&&(n.config.readonly=e._originalReadonly),void 0!==e._originAutoscroll&&(n.config.autoscroll=e._originAutoscroll),n.config.drag_timeline){var i=n.config.drag_timeline.useKey;if(i&&!0!==t[i])return}e._mouseDown=!1},this._startDrag=function(t){var n=e._gantt;e._originAutoscroll=n.config.autoscroll,n.config.autoscroll=!1,n.$root.classList.add("gantt_noselect"),e._originalReadonly=n.config.readonly,n.config.readonly=!0,e._trace=[],e._mouseDown=!0;var i=e._getScrollPosition(e._timeline),r=i.x,a=i.y;e._scrollState={x:r,y:a},e._startPoint={x:t.clientX,y:t.clientY},e._trace.push(e._startPoint)},this._gantt=t,this._domEvents=t._createDomEventScope(),this._trace=[]}return t.create=function(e){return new t(e)},t.prototype.destructor=function(){this._domEvents.detachAll()},t.prototype.attach=function(t){var e=this;this._timeline=t;var n=this._gantt;this._domEvents.attach(t.$task,"mousedown",function(t){if(n.config.drag_timeline){var i=n.config.drag_timeline,r=i.useKey,a=i.ignore;if(!1!==i.enabled){var o=".gantt_task_line, .gantt_task_link";void 0!==a&&(o=a instanceof Array?a.join(", "):a),o&&n.utils.dom.closest(t.target,o)||r&&!0!==t[r]||e._startDrag(t)}}}),this._domEvents.attach(document,"keydown",function(t){if(n.config.drag_timeline){var i=n.config.drag_timeline.useKey;i&&!0===t[i]&&e._applyDndReadyStyles()}}),this._domEvents.attach(document,"keyup",function(t){if(n.config.drag_timeline){var i=n.config.drag_timeline.useKey;i&&!1===t[i]&&(e._clearDndReadyStyles(),e._stopDrag(t))}}),this._domEvents.attach(document,"mouseup",function(t){e._stopDrag(t)}),this._domEvents.attach(n.$root,"mouseup",function(t){e._stopDrag(t)}),this._domEvents.attach(document,"mouseleave",function(t){e._stopDrag(t)}),this._domEvents.attach(n.$root,"mouseleave",function(t){e._stopDrag(t)}),this._domEvents.attach(n.$root,"mousemove",function(i){if(n.config.drag_timeline){var r=n.config.drag_timeline.useKey;if(!r||!0===i[r]){var a=e._gantt.ext.clickDrag,o=(e._gantt.config.click_drag||{}).useKey;if((!a||!o||r||!i[o])&&!0===e._mouseDown){e._trace.push({x:i.clientX,y:i.clientY});var s=e._countNewScrollPosition({x:i.clientX,y:i.clientY});e._setScrollPosition(t,s),e._scrollState=s,e._startPoint={x:i.clientX,y:i.clientY}}}}})},t}();e.EventsManager=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(251);e.default=function(t){t.ext||(t.ext={}),t.ext.dragTimeline={create:function(){return i.EventsManager.create(t)}},t.config.drag_timeline={enabled:!0}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(4),r=n(2),a=function(){function t(t,e,n){var a=this;this._el=document.createElement("div"),this.defaultRender=function(t,e){a._el||(a._el=document.createElement("div"));var n=a._el,i=Math.min(t.relative.top,e.relative.top),r=Math.max(t.relative.top,e.relative.top),o=Math.min(t.relative.left,e.relative.left),s=Math.max(t.relative.left,e.relative.left);if(a._singleRow){var l=a._getTaskPositionByTop(a._startPoint.relative.top);n.style.height=l.height+"px",n.style.top=l.top+"px"}else n.style.height=Math.abs(r-i)+"px",n.style.top=i+"px";return n.style.width=Math.abs(s-o)+"px",n.style.left=o+"px",n},this._gantt=e,this._view=n,this._viewPort=t.viewPort,this._el.classList.add(t.className),"function"==typeof t.callback&&(this._callback=t.callback),this.render=function(){var e;(e=t.render?t.render(a._startPoint,a._endPoint):a.defaultRender(a._startPoint,a._endPoint))!==a._el&&(a._el&&a._el.parentNode&&a._el.parentNode.removeChild(a._el),a._el=e),""!==t.className&&a._el.classList.add(t.className),a.draw()},r.isEventable(this._viewPort)||i(this._viewPort),this._singleRow=t.singleRow,this._useRequestAnimationFrame=t.useRequestAnimationFrame}return t.prototype.draw=function(){var t=this;if(this._useRequestAnimationFrame)return requestAnimationFrame(function(){t._viewPort.appendChild(t.getElement())});this._viewPort.appendChild(this.getElement())},t.prototype.clear=function(){var t=this;if(this._useRequestAnimationFrame)return requestAnimationFrame(function(){t._el.parentNode&&t._viewPort.removeChild(t._el)});this._el.parentNode&&this._viewPort.removeChild(this._el)},t.prototype.getElement=function(){return this._el},t.prototype.getViewPort=function(){return this._viewPort},t.prototype.setStart=function(t){var e=this._gantt;this._startPoint=t,this._startDate=e.dateFromPos(this._startPoint.relative.left),this._viewPort.callEvent("onBeforeDrag",[this._startPoint])},t.prototype.setEnd=function(t){var e=this._gantt;if(this._endPoint=t,this._singleRow){var n=this._getTaskPositionByTop(this._startPoint.relative.top);this._endPoint.relative.top=n.top}this._endDate=e.dateFromPos(this._endPoint.relative.left),this._startPoint.relative.left>this._endPoint.relative.left&&(this._positionPoint={relative:{left:this._endPoint.relative.left,top:this._positionPoint.relative.top},absolute:{left:this._endPoint.absolute.left,top:this._positionPoint.absolute.top}}),this._startPoint.relative.top>this._endPoint.relative.top&&(this._positionPoint={relative:{left:this._positionPoint.relative.left,top:this._endPoint.relative.top},absolute:{left:this._positionPoint.absolute.left,top:this._endPoint.absolute.top}}),this._viewPort.callEvent("onDrag",[this._startPoint,this._endPoint])},t.prototype.setPosition=function(t){this._positionPoint=t},t.prototype.dragEnd=function(t){var e,n=this._gantt;t.relative.left<0&&(t.relative.left=0),this._viewPort.callEvent("onBeforeDragEnd",[this._startPoint,t]),this.setEnd(t),this._endDate=this._endDate||n.getState().max_date,this._startDate.valueOf()>this._endDate.valueOf()&&(e=[this._endDate,this._startDate],this._startDate=e[0],this._endDate=e[1]),this.clear();var i=n.getTaskByTime(this._startDate,this._endDate),r=this._getTasksByTop(this._startPoint.relative.top,this._endPoint.relative.top);this._viewPort.callEvent("onDragEnd",[this._startPoint,this._endPoint]),this._callback&&this._callback(this._startPoint,this._endPoint,this._startDate,this._endDate,i,r)},t.prototype.getInBounds=function(){return this._singleRow},t.prototype._getTasksByTop=function(t,e){var n=this._gantt,i=t,r=e;t>e&&(i=e,r=t);for(var a=this._getTaskPositionByTop(i).index,o=this._getTaskPositionByTop(r).index,s=[],l=a;l<=o;l++){n.getTaskByIndex(l)&&s.push(n.getTaskByIndex(l))}return s},t.prototype._getTaskPositionByTop=function(t){var e=this._gantt,n=this._view,i=n.getItemIndexByTopPosition(t),r=e.getTaskByIndex(i);if(r){var a=n.getItemHeight(r.id);return{top:n.getItemTop(r.id)||0,height:a||0,index:i}}var o=n.getTotalHeight();return{top:t>o?o:0,height:e.config.row_height,index:t>o?e.getTaskCount():0}},t}();e.SelectedRegion=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),r=function(){function t(t){this._mouseDown=!1,this._gantt=t,this._domEvents=t._createDomEventScope()}return t.prototype.attach=function(t,e,n){var r=this,a=this._gantt,o=t.getViewPort();this._originPosition=window.getComputedStyle(o).display,this._restoreOriginPosition=function(){o.style.position=r._originPosition},"static"===this._originPosition&&(o.style.position="relative");var s=a.$services.getService("state");s.registerProvider("clickDrag",function(){return{autoscroll:!1}});var l=null;this._domEvents.attach(o,"mousedown",function(i){l=null;var o=".gantt_task_line, .gantt_task_link";void 0!==n&&(o=n instanceof Array?n.join(", "):n),o&&a.utils.dom.closest(i.target,o)||(s.registerProvider("clickDrag",function(){return{autoscroll:r._mouseDown}}),e&&!0!==i[e]||(l=r._getCoordinates(i,t)))});var c=i.getRootNode(a.$root)||document.body;this._domEvents.attach(c,"mouseup",function(n){if(l=null,(!e||!0===n[e])&&!0===r._mouseDown){r._mouseDown=!1;var i=r._getCoordinates(n,t);t.dragEnd(i)}}),this._domEvents.attach(o,"mousemove",function(n){if(!e||!0===n[e]){var i=r._gantt.ext.clickDrag,o=(r._gantt.config.drag_timeline||{}).useKey;if(!i||!o||e||!n[o]){var s=null;if(!r._mouseDown&&l)return s=r._getCoordinates(n,t),void(Math.abs(l.relative.left-s.relative.left)>5&&l&&(r._mouseDown=!0,t.setStart(a.copy(l)),t.setPosition(a.copy(l)),t.setEnd(a.copy(l)),l=null));!0===r._mouseDown&&(s=r._getCoordinates(n,t),t.setEnd(s),t.render())}}})},t.prototype.detach=function(){var t=this._gantt;this._domEvents.detachAll(),this._restoreOriginPosition&&this._restoreOriginPosition(),t.$services.getService("state").unregisterProvider("clickDrag")},t.prototype.destructor=function(){this.detach()},t.prototype._getCoordinates=function(t,e){var n=e.getViewPort(),i=n.getBoundingClientRect(),r=t.clientX,a=t.clientY;return{absolute:{left:r,top:a},relative:{left:r-i.left+n.scrollLeft,top:a-i.top+n.scrollTop}}},t}();e.EventsManager=r},function(t,e,n){"use strict";var i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,i=arguments.length;n0;)f(t)}function f(t){var e=t.shift();if("function"!=typeof e)e._settlePromises();else{var n=t.shift(),i=t.shift();e.call(n,i)}}l.prototype.setScheduler=function(t){var e=this._schedule;return this._schedule=t,this._customScheduler=!0,e},l.prototype.hasCustomScheduler=function(){return this._customScheduler},l.prototype.enableTrampoline=function(){this._trampolineEnabled=!0},l.prototype.disableTrampolineIfNecessary=function(){s.hasDevTools&&(this._trampolineEnabled=!1)},l.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},l.prototype.fatalError=function(t,e){e?(n.stderr.write("Fatal "+(t instanceof Error?t.stack:t)+"\n"),n.exit(2)):this.throwLater(t)},l.prototype.throwLater=function(t,e){if(1===arguments.length&&(e=t,t=function(){throw e}),"undefined"!=typeof setTimeout)setTimeout(function(){t(e)},0);else try{this._schedule(function(){t(e)})}catch(t){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}},s.hasDevTools?(l.prototype.invokeLater=function(t,e,n){this._trampolineEnabled?c.call(this,t,e,n):this._schedule(function(){setTimeout(function(){t.call(e,n)},100)})},l.prototype.invoke=function(t,e,n){this._trampolineEnabled?d.call(this,t,e,n):this._schedule(function(){t.call(e,n)})},l.prototype.settlePromises=function(t){this._trampolineEnabled?u.call(this,t):this._schedule(function(){t._settlePromises()})}):(l.prototype.invokeLater=c,l.prototype.invoke=d,l.prototype.settlePromises=u),l.prototype._drainQueues=function(){h(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,h(this._lateQueue)},l.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},l.prototype._reset=function(){this._isTickUsed=!1},e.exports=l,e.exports.firstLineError=r},{"./queue":26,"./schedule":29,"./util":36}],3:[function(t,e,n){"use strict";e.exports=function(t,e,n,i){var r=!1,a=function(t,e){this._reject(e)},o=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(a,a,null,this,t)},s=function(t,e){0==(50397184&this._bitField)&&this._resolveCallback(e.target)},l=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(a){r||(r=!0,t.prototype._propagateFrom=i.propagateFromFunction(),t.prototype._boundValue=i.boundValueFunction());var c=n(a),d=new t(e);d._propagateFrom(this,1);var u=this._target();if(d._setBoundTo(c),c instanceof t){var h={promiseRejectionQueued:!1,promise:d,target:u,bindingPromise:c};u._then(e,o,void 0,d,h),c._then(s,l,void 0,d,h),d._setOnCancel(c)}else d._resolveCallback(u);return d},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=2097152|this._bitField,this._boundTo=t):this._bitField=-2097153&this._bitField},t.prototype._isBound=function(){return 2097152==(2097152&this._bitField)},t.bind=function(e,n){return t.resolve(n).bind(e)}}},{}],4:[function(t,e,n){"use strict";var i;"undefined"!=typeof Promise&&(i=Promise);var r=t("./promise")();r.noConflict=function(){try{Promise===r&&(Promise=i)}catch(t){}return r},e.exports=r},{"./promise":22}],5:[function(t,e,n){"use strict";var i=Object.create;if(i){var r=i(null),a=i(null);r[" size"]=a[" size"]=0}e.exports=function(e){var n=t("./util"),i=n.canEvaluate;n.isIdentifier;function r(t){return function(t,i){var r;if(null!=t&&(r=t[i]),"function"!=typeof r){var a="Object "+n.classString(t)+" has no method '"+n.toString(i)+"'";throw new e.TypeError(a)}return r}(t,this.pop()).apply(t,this)}function a(t){return t[this]}function o(t){var e=+this;return e<0&&(e=Math.max(0,e+t.length)),t[e]}e.prototype.call=function(t){var e=[].slice.call(arguments,1);return e.push(t),this._then(r,void 0,void 0,e,void 0)},e.prototype.get=function(t){var e;if("number"==typeof t)e=o;else if(i){var n=(void 0)(t);e=null!==n?n:a}else e=a;return this._then(e,void 0,void 0,t,void 0)}}},{"./util":36}],6:[function(t,e,n){"use strict";e.exports=function(e,n,i,r){var a=t("./util"),o=a.tryCatch,s=a.errorObj,l=e._async;e.prototype.break=e.prototype.cancel=function(){if(!r.cancellation())return this._warn("cancellation is disabled");for(var t=this,e=t;t._isCancellable();){if(!t._cancelBy(e)){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}var n=t._cancellationParent;if(null==n||!n._isCancellable()){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}t._isFollowing()&&t._followee().cancel(),t._setWillBeCancelled(),e=t,t=n}},e.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},e.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},e.prototype._cancelBy=function(t){return t===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),!!this._enoughBranchesHaveCancelled()&&(this._invokeOnCancel(),!0))},e.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},e.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),l.invoke(this._cancelPromises,this,void 0))},e.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},e.prototype._unsetOnCancel=function(){this._onCancelField=void 0},e.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},e.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},e.prototype._doInvokeOnCancel=function(t,e){if(a.isArray(t))for(var n=0;n=0)return n[t]}return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return null},t._peekContext=t.prototype._peekContext=function(){},i.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,n.push(this._trace))},i.prototype._popContext=function(){if(void 0!==this._trace){var t=n.pop(),e=t._promiseCreated;return t._promiseCreated=null,e}return null},i.CapturedTrace=null,i.create=function(){if(e)return new i},i.deactivateLongStackTraces=function(){},i.activateLongStackTraces=function(){var n=t.prototype._pushContext,a=t.prototype._popContext,o=t._peekContext,s=t.prototype._peekContext,l=t.prototype._promiseCreated;i.deactivateLongStackTraces=function(){t.prototype._pushContext=n,t.prototype._popContext=a,t._peekContext=o,t.prototype._peekContext=s,t.prototype._promiseCreated=l,e=!1},e=!0,t.prototype._pushContext=i.prototype._pushContext,t.prototype._popContext=i.prototype._popContext,t._peekContext=t.prototype._peekContext=r,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&null==t._promiseCreated&&(t._promiseCreated=this)}},i}},{}],9:[function(t,e,i){"use strict";e.exports=function(e,i){var r,a,o,s=e._getDomain,c=e._async,d=t("./errors").Warning,u=t("./util"),h=t("./es5"),f=u.canAttachTrace,_=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,g=/\((?:timers\.js):\d+:\d+\)/,p=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,v=null,m=null,y=!1,k=!(0==u.env("BLUEBIRD_DEBUG")),b=!(0==u.env("BLUEBIRD_WARNINGS")||!k&&!u.env("BLUEBIRD_WARNINGS")),w=!(0==u.env("BLUEBIRD_LONG_STACK_TRACES")||!k&&!u.env("BLUEBIRD_LONG_STACK_TRACES")),x=0!=u.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(b||!!u.env("BLUEBIRD_W_FORGOTTEN_RETURN"));e.prototype.suppressUnhandledRejections=function(){var t=this._target();t._bitField=-1048577&t._bitField|524288},e.prototype._ensurePossibleRejectionHandled=function(){if(0==(524288&this._bitField)){this._setRejectionIsUnhandled();var t=this;setTimeout(function(){t._notifyUnhandledRejection()},1)}},e.prototype._notifyUnhandledRejectionIsHandled=function(){q("rejectionHandled",r,void 0,this)},e.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},e.prototype._returnedNonUndefined=function(){return 0!=(268435456&this._bitField)},e.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._settledValue();this._setUnhandledRejectionIsNotified(),q("unhandledRejection",a,t,this)}},e.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},e.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},e.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},e.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},e.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},e.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},e.prototype._warn=function(t,e,n){return z(t,e,n||this)},e.onPossiblyUnhandledRejection=function(t){var e=s();a="function"==typeof t?null===e?t:u.domainBind(e,t):void 0},e.onUnhandledRejectionHandled=function(t){var e=s();r="function"==typeof t?null===e?t:u.domainBind(e,t):void 0};var $=function(){};e.longStackTraces=function(){if(c.haveItemsQueued()&&!tt.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!tt.longStackTraces&&Y()){var t=e.prototype._captureStackTrace,n=e.prototype._attachExtraTrace,r=e.prototype._dereferenceTrace;tt.longStackTraces=!0,$=function(){if(c.haveItemsQueued()&&!tt.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");e.prototype._captureStackTrace=t,e.prototype._attachExtraTrace=n,e.prototype._dereferenceTrace=r,i.deactivateLongStackTraces(),c.enableTrampoline(),tt.longStackTraces=!1},e.prototype._captureStackTrace=j,e.prototype._attachExtraTrace=F,e.prototype._dereferenceTrace=B,i.activateLongStackTraces(),c.disableTrampolineIfNecessary()}},e.hasLongStackTraces=function(){return tt.longStackTraces&&Y()};var S=function(){try{if("function"==typeof CustomEvent){var t=new CustomEvent("CustomEvent");return u.global.dispatchEvent(t),function(t,e){var n={detail:e,cancelable:!0};h.defineProperty(n,"promise",{value:e.promise}),h.defineProperty(n,"reason",{value:e.reason});var i=new CustomEvent(t.toLowerCase(),n);return!u.global.dispatchEvent(i)}}if("function"==typeof Event){t=new Event("CustomEvent");return u.global.dispatchEvent(t),function(t,e){var n=new Event(t.toLowerCase(),{cancelable:!0});return n.detail=e,h.defineProperty(n,"promise",{value:e.promise}),h.defineProperty(n,"reason",{value:e.reason}),!u.global.dispatchEvent(n)}}return(t=document.createEvent("CustomEvent")).initCustomEvent("testingtheevent",!1,!0,{}),u.global.dispatchEvent(t),function(t,e){var n=document.createEvent("CustomEvent");return n.initCustomEvent(t.toLowerCase(),!1,!0,e),!u.global.dispatchEvent(n)}}catch(t){}return function(){return!1}}(),T=u.isNode?function(){return n.emit.apply(n,arguments)}:u.global?function(t){var e="on"+t.toLowerCase(),n=u.global[e];return!!n&&(n.apply(u.global,[].slice.call(arguments,1)),!0)}:function(){return!1};function C(t,e){return{promise:e}}var E={promiseCreated:C,promiseFulfilled:C,promiseRejected:C,promiseResolved:C,promiseCancelled:C,promiseChained:function(t,e,n){return{promise:e,child:n}},warning:function(t,e){return{warning:e}},unhandledRejection:function(t,e,n){return{reason:e,promise:n}},rejectionHandled:C},D=function(t){var e=!1;try{e=T.apply(null,arguments)}catch(t){c.throwLater(t),e=!0}var n=!1;try{n=S(t,E[t].apply(null,arguments))}catch(t){c.throwLater(t),n=!0}return n||e};function A(){return!1}function M(t,e,n){var i=this;try{t(e,n,function(t){if("function"!=typeof t)throw new TypeError("onCancel must be a function, got: "+u.toString(t));i._attachCancellationCallback(t)})}catch(t){return t}}function I(t){if(!this._isCancellable())return this;var e=this._onCancel();void 0!==e?u.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function N(){return this._onCancelField}function P(t){this._onCancelField=t}function L(){this._cancellationParent=void 0,this._onCancelField=void 0}function O(t,e){if(0!=(1&e)){this._cancellationParent=t;var n=t._branchesRemainingToCancel;void 0===n&&(n=0),t._branchesRemainingToCancel=n+1}0!=(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}e.config=function(t){if("longStackTraces"in(t=Object(t))&&(t.longStackTraces?e.longStackTraces():!t.longStackTraces&&e.hasLongStackTraces()&&$()),"warnings"in t){var n=t.warnings;tt.warnings=!!n,x=tt.warnings,u.isObject(n)&&"wForgottenReturn"in n&&(x=!!n.wForgottenReturn)}if("cancellation"in t&&t.cancellation&&!tt.cancellation){if(c.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");e.prototype._clearCancellationData=L,e.prototype._propagateFrom=O,e.prototype._onCancel=N,e.prototype._setOnCancel=P,e.prototype._attachCancellationCallback=I,e.prototype._execute=M,R=O,tt.cancellation=!0}return"monitoring"in t&&(t.monitoring&&!tt.monitoring?(tt.monitoring=!0,e.prototype._fireEvent=D):!t.monitoring&&tt.monitoring&&(tt.monitoring=!1,e.prototype._fireEvent=A)),e},e.prototype._fireEvent=A,e.prototype._execute=function(t,e,n){try{t(e,n)}catch(t){return t}},e.prototype._onCancel=function(){},e.prototype._setOnCancel=function(t){},e.prototype._attachCancellationCallback=function(t){},e.prototype._captureStackTrace=function(){},e.prototype._attachExtraTrace=function(){},e.prototype._dereferenceTrace=function(){},e.prototype._clearCancellationData=function(){},e.prototype._propagateFrom=function(t,e){};var R=function(t,e){0!=(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)};function H(){var t=this._boundTo;return void 0!==t&&t instanceof e?t.isFulfilled()?t.value():void 0:t}function j(){this._trace=new Q(this._peekContext())}function F(t,e){if(f(t)){var n=this._trace;if(void 0!==n&&e&&(n=n._parent),void 0!==n)n.attachExtraTrace(t);else if(!t.__stackCleaned__){var i=W(t);u.notEnumerableProp(t,"stack",i.message+"\n"+i.stack.join("\n")),u.notEnumerableProp(t,"__stackCleaned__",!0)}}}function B(){this._trace=void 0}function z(t,n,i){if(tt.warnings){var r,a=new d(t);if(n)i._attachExtraTrace(a);else if(tt.longStackTraces&&(r=e._peekContext()))r.attachExtraTrace(a);else{var o=W(a);a.stack=o.message+"\n"+o.stack.join("\n")}D("warning",a)||U(a,"",!0)}}function V(t){for(var e=[],n=0;n0?function(t){for(var e=t.stack.replace(/\s+$/g,"").split("\n"),n=0;n0&&"SyntaxError"!=t.name&&(e=e.slice(n)),e}(t):[" (No stack trace)"],{message:n,stack:"SyntaxError"==t.name?e:V(e)}}function U(t,e,n){if("undefined"!=typeof console){var i;if(u.isObject(t)){var r=t.stack;i=e+m(r,t)}else i=e+String(t);"function"==typeof o?o(i,n):"function"!=typeof console.log&&"object"!==l(console.log)||console.log(i)}}function q(t,e,n,i){var r=!1;try{"function"==typeof e&&(r=!0,"rejectionHandled"===t?e(i):e(n,i))}catch(t){c.throwLater(t)}"unhandledRejection"===t?D(t,n,i)||r||U(n,"Unhandled rejection "):D(t,i)}function G(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t&&"function"==typeof t.toString?t.toString():u.toString(t);if(/\[object [a-zA-Z0-9$_]+\]/.test(e))try{e=JSON.stringify(t)}catch(t){}0===e.length&&(e="(empty array)")}return"(<"+function(t){if(t.length<41)return t;return t.substr(0,38)+"..."}(e)+">, no stack trace)"}function Y(){return"function"==typeof Z}var K=function(){return!1},J=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function X(t){var e=t.match(J);if(e)return{fileName:e[1],line:parseInt(e[2],10)}}function Q(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);Z(this,Q),e>32&&this.uncycle()}u.inherits(Q,Error),i.CapturedTrace=Q,Q.prototype.uncycle=function(){var t=this._length;if(!(t<2)){for(var e=[],n={},i=0,r=this;void 0!==r;++i)e.push(r),r=r._parent;for(i=(t=this._length=i)-1;i>=0;--i){var a=e[i].stack;void 0===n[a]&&(n[a]=i)}for(i=0;i0&&(e[o-1]._parent=void 0,e[o-1]._length=1),e[i]._parent=void 0,e[i]._length=1;var s=i>0?e[i-1]:this;o=0;--c)e[c]._length=l,l++;return}}}},Q.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=W(t),n=e.message,i=[e.stack],r=this;void 0!==r;)i.push(V(r.stack.split("\n"))),r=r._parent;!function(t){for(var e=t[0],n=1;n=0;--s)if(i[s]===a){o=s;break}for(s=o;s>=0;--s){var l=i[s];if(e[r]!==l)break;e.pop(),r--}e=i}}(i),function(t){for(var e=0;e=0)return v=/@/,m=e,y=!0,function(t){t.stack=(new Error).stack};try{throw new Error}catch(t){i="stack"in t}return"stack"in r||!i||"number"!=typeof Error.stackTraceLimit?(m=function(t,e){return"string"==typeof t?t:"object"!==l(e)&&"function"!=typeof e||void 0===e.name||void 0===e.message?G(e):e.toString()},null):(v=t,m=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6})}();"undefined"!=typeof console&&void 0!==console.warn&&(o=function(t){console.warn(t)},u.isNode&&n.stderr.isTTY?o=function(t,e){var n=e?"":"";console.warn(n+t+"\n")}:u.isNode||"string"!=typeof(new Error).stack||(o=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var tt={warnings:b,longStackTraces:!1,cancellation:!1,monitoring:!1};return w&&e.longStackTraces(),{longStackTraces:function(){return tt.longStackTraces},warnings:function(){return tt.warnings},cancellation:function(){return tt.cancellation},monitoring:function(){return tt.monitoring},propagateFromFunction:function(){return R},boundValueFunction:function(){return H},checkForgottenReturns:function(t,e,n,i,r){if(void 0===t&&null!==e&&x){if(void 0!==r&&r._returnedNonUndefined())return;if(0==(65535&i._bitField))return;n&&(n+=" ");var a="",o="";if(e._trace){for(var s=e._trace.stack.split("\n"),l=V(s),c=l.length-1;c>=0;--c){var d=l[c];if(!g.test(d)){var u=d.match(p);u&&(a="at "+u[1]+":"+u[2]+":"+u[3]+" ");break}}if(l.length>0){var h=l[0];for(c=0;c0&&(o="\n"+s[c-1]);break}}}var f="a promise was created in a "+n+"handler "+a+"but was not returned from it, see http://goo.gl/rRqMUw"+o;i._warn(f,!0,e)}},setBounds:function(t,e){if(Y()){for(var n,i,r=t.stack.split("\n"),a=e.stack.split("\n"),o=-1,s=-1,l=0;l=s||(K=function(t){if(_.test(t))return!0;var e=X(t);return!!(e&&e.fileName===n&&o<=e.line&&e.line<=s)})}},warn:z,deprecated:function(t,e){var n=t+" is deprecated and will be removed in a future version.";return e&&(n+=" Use "+e+" instead."),z(n)},CapturedTrace:Q,fireDomEvent:S,fireGlobalEvent:T}}},{"./errors":12,"./es5":13,"./util":36}],10:[function(t,e,n){"use strict";e.exports=function(t){function e(){return this.value}function n(){throw this.reason}t.prototype.return=t.prototype.thenReturn=function(n){return n instanceof t&&n.suppressUnhandledRejections(),this._then(e,void 0,void 0,{value:n},void 0)},t.prototype.throw=t.prototype.thenThrow=function(t){return this._then(n,void 0,void 0,{reason:t},void 0)},t.prototype.catchThrow=function(t){if(arguments.length<=1)return this._then(void 0,n,void 0,{reason:t},void 0);var e=arguments[1];return this.caught(t,function(){throw e})},t.prototype.catchReturn=function(n){if(arguments.length<=1)return n instanceof t&&n.suppressUnhandledRejections(),this._then(void 0,e,void 0,{value:n},void 0);var i=arguments[1];i instanceof t&&i.suppressUnhandledRejections();return this.caught(n,function(){return i})}}},{}],11:[function(t,e,n){"use strict";e.exports=function(t,e){var n=t.reduce,i=t.all;function r(){return i(this)}t.prototype.each=function(t){return n(this,t,e,0)._then(r,void 0,void 0,this,void 0)},t.prototype.mapSeries=function(t){return n(this,t,e,e)},t.each=function(t,i){return n(t,i,e,0)._then(r,void 0,void 0,t,void 0)},t.mapSeries=function(t,i){return n(t,i,e,e)}}},{}],12:[function(t,e,n){"use strict";var i,r,a=t("./es5"),o=a.freeze,s=t("./util"),l=s.inherits,c=s.notEnumerableProp;function d(t,e){function n(i){if(!(this instanceof n))return new n(i);c(this,"message","string"==typeof i?i:e),c(this,"name",t),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this)}return l(n,Error),n}var u=d("Warning","warning"),h=d("CancellationError","cancellation error"),f=d("TimeoutError","timeout error"),_=d("AggregateError","aggregate error");try{i=TypeError,r=RangeError}catch(t){i=d("TypeError","type error"),r=d("RangeError","range error")}for(var g="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),p=0;p1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0)}function u(){return f.call(this,this.promise._target()._settledValue())}function h(t){if(!d(this,t))return o.e=t,o}function f(t){var r=this.promise,s=this.handler;if(!this.called){this.called=!0;var l=this.isFinallyHandler()?s.call(r._boundValue()):s.call(r._boundValue(),t);if(l===i)return l;if(void 0!==l){r._setReturnedNonUndefined();var f=n(l,r);if(f instanceof e){if(null!=this.cancelPromise){if(f._isCancelled()){var _=new a("late cancellation observer");return r._attachExtraTrace(_),o.e=_,o}f.isPending()&&f._attachCancellationCallback(new c(this))}return f._then(u,h,void 0,this,void 0)}}}return r.isRejected()?(d(this),o.e=t,o):(d(this),t)}return l.prototype.isFinallyHandler=function(){return 0===this.type},c.prototype._resultCancelled=function(){d(this.finallyHandler)},e.prototype._passThrough=function(t,e,n,i){return"function"!=typeof t?this.then():this._then(n,i,void 0,new l(this,e,t),void 0)},e.prototype.lastly=e.prototype.finally=function(t){return this._passThrough(t,0,f,f)},e.prototype.tap=function(t){return this._passThrough(t,1,f)},e.prototype.tapCatch=function(t){var n=arguments.length;if(1===n)return this._passThrough(t,1,void 0,f);var i,a=new Array(n-1),o=0;for(i=0;i0&&"function"==typeof arguments[e]&&(t=arguments[e]);var i=[].slice.call(arguments);t&&i.pop();var r=new n(i).promise();return void 0!==t?r.spread(t):r}}},{"./util":36}],18:[function(t,e,n){"use strict";e.exports=function(e,n,i,r,a,o){var s=e._getDomain,c=t("./util"),d=c.tryCatch,u=c.errorObj,h=e._async;function f(t,e,n,i){this.constructor$(t),this._promise._captureStackTrace();var r=s();this._callback=null===r?e:c.domainBind(r,e),this._preservedValues=i===a?new Array(this.length()):null,this._limit=n,this._inFlight=0,this._queue=[],h.invoke(this._asyncInit,this,void 0)}function _(t,n,r,a){if("function"!=typeof n)return i("expecting a function but got "+c.classString(n));var o=0;if(void 0!==r){if("object"!==l(r)||null===r)return e.reject(new TypeError("options argument must be an object but it is "+c.classString(r)));if("number"!=typeof r.concurrency)return e.reject(new TypeError("'concurrency' must be a number but it is "+c.classString(r.concurrency)));o=r.concurrency}return new f(t,n,o="number"==typeof o&&isFinite(o)&&o>=1?o:0,a).promise()}c.inherits(f,n),f.prototype._asyncInit=function(){this._init$(void 0,-2)},f.prototype._init=function(){},f.prototype._promiseFulfilled=function(t,n){var i=this._values,a=this.length(),s=this._preservedValues,l=this._limit;if(n<0){if(i[n=-1*n-1]=t,l>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(l>=1&&this._inFlight>=l)return i[n]=t,this._queue.push(n),!1;null!==s&&(s[n]=t);var c=this._promise,h=this._callback,f=c._boundValue();c._pushContext();var _=d(h).call(f,t,n,a),g=c._popContext();if(o.checkForgottenReturns(_,g,null!==s?"Promise.filter":"Promise.map",c),_===u)return this._reject(_.e),!0;var p=r(_,this._promise);if(p instanceof e){var v=(p=p._target())._bitField;if(0==(50397184&v))return l>=1&&this._inFlight++,i[n]=p,p._proxy(this,-1*(n+1)),!1;if(0==(33554432&v))return 0!=(16777216&v)?(this._reject(p._reason()),!0):(this._cancel(),!0);_=p._value()}i[n]=_}return++this._totalResolved>=a&&(null!==s?this._filter(i,s):this._resolve(i),!0)},f.prototype._drainQueue=function(){for(var t=this._queue,e=this._limit,n=this._values;t.length>0&&this._inFlight1){a.deprecated("calling Promise.try with more than 1 argument");var c=arguments[1],d=arguments[2];i=o.isArray(c)?s(t).apply(d,c):s(t).call(d,c)}else i=s(t)();var u=l._popContext();return a.checkForgottenReturns(i,u,"Promise.try",l),l._resolveFromSyncValue(i),l},e.prototype._resolveFromSyncValue=function(t){t===o.errorObj?this._rejectCallback(t.e,!1):this._resolveCallback(t,!0)}}},{"./util":36}],20:[function(t,e,n){"use strict";var i=t("./util"),r=i.maybeWrapAsError,a=t("./errors").OperationalError,o=t("./es5");var s=/^(?:name|message|stack|cause)$/;function l(t){var e;if(function(t){return t instanceof Error&&o.getPrototypeOf(t)===Error.prototype}(t)){(e=new a(t)).name=t.name,e.message=t.message,e.stack=t.stack;for(var n=o.keys(t),r=0;r1){var n,i=new Array(e-1),r=0;for(n=0;n0&&"function"!=typeof t&&"function"!=typeof e){var n=".then() only accepts functions but was passed: "+c.classString(t);arguments.length>1&&(n+=", "+c.classString(e)),this._warn(n)}return this._then(t,e,void 0,void 0,void 0)},D.prototype.done=function(t,e){this._then(t,e,void 0,void 0,void 0)._setIsFinal()},D.prototype.spread=function(t){return"function"!=typeof t?a("expecting a function but got "+c.classString(t)):this.all()._then(t,void 0,void 0,v,void 0)},D.prototype.toJSON=function(){var t={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(t.fulfillmentValue=this.value(),t.isFulfilled=!0):this.isRejected()&&(t.rejectionReason=this.reason(),t.isRejected=!0),t},D.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new k(this).promise()},D.prototype.error=function(t){return this.caught(c.originatesFromRejection,t)},D.getNewLibraryCopy=e.exports,D.is=function(t){return t instanceof D},D.fromNode=D.fromCallback=function(t){var e=new D(p);e._captureStackTrace();var n=arguments.length>1&&!!Object(arguments[1]).multiArgs,i=E(t)(T(e,n));return i===C&&e._rejectCallback(i.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},D.all=function(t){return new k(t).promise()},D.cast=function(t){var e=y(t);return e instanceof D||((e=new D(p))._captureStackTrace(),e._setFulfilled(),e._rejectionHandler0=t),e},D.resolve=D.fulfilled=D.cast,D.reject=D.rejected=function(t){var e=new D(p);return e._captureStackTrace(),e._rejectCallback(t,!0),e},D.setScheduler=function(t){if("function"!=typeof t)throw new _("expecting a function but got "+c.classString(t));return h.setScheduler(t)},D.prototype._then=function(t,e,n,i,r){var a=void 0!==r,o=a?r:new D(p),l=this._target(),d=l._bitField;a||(o._propagateFrom(this,3),o._captureStackTrace(),void 0===i&&0!=(2097152&this._bitField)&&(i=0!=(50397184&d)?this._boundValue():l===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,o));var u=s();if(0!=(50397184&d)){var f,_,v=l._settlePromiseCtx;0!=(33554432&d)?(_=l._rejectionHandler0,f=t):0!=(16777216&d)?(_=l._fulfillmentHandler0,f=e,l._unsetRejectionIsUnhandled()):(v=l._settlePromiseLateCancellationObserver,_=new g("late cancellation observer"),l._attachExtraTrace(_),f=e),h.invoke(v,l,{handler:null===u?f:"function"==typeof f&&c.domainBind(u,f),promise:o,receiver:i,value:_})}else l._addCallbacks(t,e,o,i,u);return o},D.prototype._length=function(){return 65535&this._bitField},D.prototype._isFateSealed=function(){return 0!=(117506048&this._bitField)},D.prototype._isFollowing=function(){return 67108864==(67108864&this._bitField)},D.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},D.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},D.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},D.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},D.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},D.prototype._isFinal=function(){return(4194304&this._bitField)>0},D.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},D.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},D.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},D.prototype._setAsyncGuaranteed=function(){h.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},D.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[4*t-4+3];if(e!==l)return void 0===e&&this._isBound()?this._boundValue():e},D.prototype._promiseAt=function(t){return this[4*t-4+2]},D.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},D.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},D.prototype._boundValue=function(){},D.prototype._migrateCallback0=function(t){t._bitField;var e=t._fulfillmentHandler0,n=t._rejectionHandler0,i=t._promise0,r=t._receiverAt(0);void 0===r&&(r=l),this._addCallbacks(e,n,i,r,null)},D.prototype._migrateCallbackAt=function(t,e){var n=t._fulfillmentHandlerAt(e),i=t._rejectionHandlerAt(e),r=t._promiseAt(e),a=t._receiverAt(e);void 0===a&&(a=l),this._addCallbacks(n,i,r,a,null)},D.prototype._addCallbacks=function(t,e,n,i,r){var a=this._length();if(a>=65531&&(a=0,this._setLength(0)),0===a)this._promise0=n,this._receiver0=i,"function"==typeof t&&(this._fulfillmentHandler0=null===r?t:c.domainBind(r,t)),"function"==typeof e&&(this._rejectionHandler0=null===r?e:c.domainBind(r,e));else{var o=4*a-4;this[o+2]=n,this[o+3]=i,"function"==typeof t&&(this[o+0]=null===r?t:c.domainBind(r,t)),"function"==typeof e&&(this[o+1]=null===r?e:c.domainBind(r,e))}return this._setLength(a+1),a},D.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},D.prototype._resolveCallback=function(t,e){if(0==(117506048&this._bitField)){if(t===this)return this._rejectCallback(i(),!1);var n=y(t,this);if(!(n instanceof D))return this._fulfill(t);e&&this._propagateFrom(n,2);var r=n._target();if(r!==this){var a=r._bitField;if(0==(50397184&a)){var o=this._length();o>0&&r._migrateCallback0(this);for(var s=1;s>>16)){if(t===this){var n=i();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=t,(65535&e)>0&&(0!=(134217728&e)?this._settlePromises():h.settlePromises(this),this._dereferenceTrace())}},D.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(this._setRejected(),this._fulfillmentHandler0=t,this._isFinal())return h.fatalError(t,c.isNode);(65535&e)>0?h.settlePromises(this):this._ensurePossibleRejectionHandled()}},D.prototype._fulfillPromises=function(t,e){for(var n=1;n0){if(0!=(16842752&t)){var n=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,n,t),this._rejectPromises(e,n)}else{var i=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,i,t),this._fulfillPromises(e,i)}this._setLength(0)}this._clearCancellationData()},D.prototype._settledValue=function(){var t=this._bitField;return 0!=(33554432&t)?this._rejectionHandler0:0!=(16777216&t)?this._fulfillmentHandler0:void 0},D.defer=D.pending=function(){return x.deprecated("Promise.defer","new Promise"),{promise:new D(p),resolve:A,reject:M}},c.notEnumerableProp(D,"_makeSelfResolutionError",i),t("./method")(D,p,y,a,x),t("./bind")(D,p,y,x),t("./cancel")(D,k,a,x),t("./direct_resolve")(D),t("./synchronous_inspection")(D),t("./join")(D,k,y,p,h,s),D.Promise=D,D.version="3.5.4",t("./map.js")(D,k,a,y,p,x),t("./call_get.js")(D),t("./using.js")(D,a,y,w,p,x),t("./timers.js")(D,p,x),t("./generators.js")(D,a,p,y,o,x),t("./nodeify.js")(D),t("./promisify.js")(D,p),t("./props.js")(D,k,y,a),t("./race.js")(D,p,y,a),t("./reduce.js")(D,k,a,y,p,x),t("./settle.js")(D,k,x),t("./some.js")(D,k,a),t("./filter.js")(D,p),t("./each.js")(D,p),t("./any.js")(D),c.toFastProperties(D),c.toFastProperties(D.prototype),I({a:1}),I({b:2}),I({c:3}),I(1),I(function(){}),I(void 0),I(!1),I(new D(p)),x.setBounds(u.firstLineError,c.lastLineError),D}},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(t,e,n){"use strict";e.exports=function(e,n,i,r,a){var o=t("./util");o.isArray;function s(t){var i=this._promise=new e(n);t instanceof e&&i._propagateFrom(t,3),i._setOnCancel(this),this._values=t,this._length=0,this._totalResolved=0,this._init(void 0,-2)}return o.inherits(s,a),s.prototype.length=function(){return this._length},s.prototype.promise=function(){return this._promise},s.prototype._init=function t(n,a){var s=i(this._values,this._promise);if(s instanceof e){var l=(s=s._target())._bitField;if(this._values=s,0==(50397184&l))return this._promise._setAsyncGuaranteed(),s._then(t,this._reject,void 0,this,a);if(0==(33554432&l))return 0!=(16777216&l)?this._reject(s._reason()):this._cancel();s=s._value()}if(null!==(s=o.asArray(s)))0!==s.length?this._iterate(s):-5===a?this._resolveEmptyArray():this._resolve(function(t){switch(t){case-2:return[];case-3:return{};case-6:return new Map}}(a));else{var c=r("expecting an array or an iterable object but got "+o.classString(s)).reason();this._promise._rejectCallback(c,!1)}},s.prototype._iterate=function(t){var n=this.getActualLength(t.length);this._length=n,this._values=this.shouldCopyValues()?new Array(n):this._values;for(var r=this._promise,a=!1,o=null,s=0;s=this._length&&(this._resolve(this._values),!0)},s.prototype._promiseCancelled=function(){return this._cancel(),!0},s.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},s.prototype._resultCancelled=function(){if(!this._isResolved()){var t=this._values;if(this._cancel(),t instanceof e)t.cancel();else for(var n=0;n=this._length){var n;if(this._isMap)n=function(t){for(var e=new a,n=t.length/2|0,i=0;i>1},e.prototype.props=function(){return u(this)},e.props=function(t){return u(t)}}},{"./es5":13,"./util":36}],26:[function(t,e,n){"use strict";function i(t){this._capacity=t,this._length=0,this._front=0}i.prototype._willBeOverCapacity=function(t){return this._capacity=this._length&&(this._resolve(this._values),!0)},a.prototype._promiseFulfilled=function(t,e){var n=new r;return n._bitField=33554432,n._settledValueField=t,this._promiseResolved(e,n)},a.prototype._promiseRejected=function(t,e){var n=new r;return n._bitField=16777216,n._settledValueField=t,this._promiseResolved(e,n)},e.settle=function(t){return i.deprecated(".settle()",".reflect()"),new a(t).promise()},e.prototype.settle=function(){return e.settle(this)}}},{"./util":36}],31:[function(t,e,n){"use strict";e.exports=function(e,n,i){var r=t("./util"),a=t("./errors").RangeError,o=t("./errors").AggregateError,s=r.isArray,l={};function c(t){this.constructor$(t),this._howMany=0,this._unwrap=!1,this._initialized=!1}function d(t,e){if((0|e)!==e||e<0)return i("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");var n=new c(t),r=n.promise();return n.setHowMany(e),n.init(),r}r.inherits(c,n),c.prototype._init=function(){if(this._initialized)if(0!==this._howMany){this._init$(void 0,-5);var t=s(this._values);!this._isResolved()&&t&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}else this._resolve([])},c.prototype.init=function(){this._initialized=!0,this._init()},c.prototype.setUnwrap=function(){this._unwrap=!0},c.prototype.howMany=function(){return this._howMany},c.prototype.setHowMany=function(t){this._howMany=t},c.prototype._promiseFulfilled=function(t){return this._addFulfilled(t),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0)},c.prototype._promiseRejected=function(t){return this._addRejected(t),this._checkOutcome()},c.prototype._promiseCancelled=function(){return this._values instanceof e||null==this._values?this._cancel():(this._addRejected(l),this._checkOutcome())},c.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var t=new o,e=this.length();e0?this._reject(t):this._cancel(),!0}return!1},c.prototype._fulfilled=function(){return this._totalResolved},c.prototype._rejected=function(){return this._values.length-this.length()},c.prototype._addRejected=function(t){this._values.push(t)},c.prototype._addFulfilled=function(t){this._values[this._totalResolved++]=t},c.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},c.prototype._getRangeError=function(t){var e="Input array must contain at least "+this._howMany+" items but contains only "+t+" items";return new a(e)},c.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},e.some=function(t,e){return d(t,e)},e.prototype.some=function(t){return d(this,t)},e._SomePromiseArray=c}},{"./errors":12,"./util":36}],32:[function(t,e,n){"use strict";e.exports=function(t){function e(t){void 0!==t?(t=t._target(),this._bitField=t._bitField,this._settledValueField=t._isFateSealed()?t._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}e.prototype._settledValue=function(){return this._settledValueField};var n=e.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},i=e.prototype.error=e.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},r=e.prototype.isFulfilled=function(){return 0!=(33554432&this._bitField)},a=e.prototype.isRejected=function(){return 0!=(16777216&this._bitField)},o=e.prototype.isPending=function(){return 0==(50397184&this._bitField)},s=e.prototype.isResolved=function(){return 0!=(50331648&this._bitField)};e.prototype.isCancelled=function(){return 0!=(8454144&this._bitField)},t.prototype.__isCancelled=function(){return 65536==(65536&this._bitField)},t.prototype._isCancelled=function(){return this._target().__isCancelled()},t.prototype.isCancelled=function(){return 0!=(8454144&this._target()._bitField)},t.prototype.isPending=function(){return o.call(this._target())},t.prototype.isRejected=function(){return a.call(this._target())},t.prototype.isFulfilled=function(){return r.call(this._target())},t.prototype.isResolved=function(){return s.call(this._target())},t.prototype.value=function(){return n.call(this._target())},t.prototype.reason=function(){var t=this._target();return t._unsetRejectionIsUnhandled(),i.call(t)},t.prototype._value=function(){return this._settledValue()},t.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},t.PromiseInspection=e}},{}],33:[function(t,e,n){"use strict";e.exports=function(e,n){var i=t("./util"),r=i.errorObj,a=i.isObject;var o={}.hasOwnProperty;return function(t,s){if(a(t)){if(t instanceof e)return t;var l=function(t){try{return function(t){return t.then}(t)}catch(t){return r.e=t,r}}(t);if(l===r){s&&s._pushContext();var c=e.reject(l.e);return s&&s._popContext(),c}if("function"==typeof l)return function(t){try{return o.call(t,"_promise0")}catch(t){return!1}}(t)?(c=new e(n),t._then(c._fulfill,c._reject,void 0,c,null),c):function(t,a,o){var s=new e(n),l=s;o&&o._pushContext(),s._captureStackTrace(),o&&o._popContext();var c=!0,d=i.tryCatch(a).call(t,function(t){s&&(s._resolveCallback(t),s=null)},function(t){s&&(s._rejectCallback(t,c,!0),s=null)});return c=!1,s&&d===r&&(s._rejectCallback(d.e,!0,!0),s=null),l}(t,l,s)}return t}}},{"./util":36}],34:[function(t,e,n){"use strict";e.exports=function(e,n,i){var r=t("./util"),a=e.TimeoutError;function o(t){this.handle=t}o.prototype._resultCancelled=function(){clearTimeout(this.handle)};var s=function(t){return l(+this).thenReturn(t)},l=e.delay=function(t,r){var a,l;return void 0!==r?(a=e.resolve(r)._then(s,null,null,t,void 0),i.cancellation()&&r instanceof e&&a._setOnCancel(r)):(a=new e(n),l=setTimeout(function(){a._fulfill()},+t),i.cancellation()&&a._setOnCancel(new o(l)),a._captureStackTrace()),a._setAsyncGuaranteed(),a};e.prototype.delay=function(t){return l(t,this)};function c(t){return clearTimeout(this.handle),t}function d(t){throw clearTimeout(this.handle),t}e.prototype.timeout=function(t,e){var n,s;t=+t;var l=new o(setTimeout(function(){n.isPending()&&function(t,e,n){var i;i="string"!=typeof e?e instanceof Error?e:new a("operation timed out"):new a(e),r.markAsOriginatingFromRejection(i),t._attachExtraTrace(i),t._reject(i),null!=n&&n.cancel()}(n,e,s)},t));return i.cancellation()?(s=this.then(),(n=s._then(c,d,void 0,l,void 0))._setOnCancel(l)):n=this._then(c,d,void 0,l,void 0),n}}},{"./util":36}],35:[function(t,e,n){"use strict";e.exports=function(e,n,i,r,a,o){var s=t("./util"),l=t("./errors").TypeError,c=t("./util").inherits,d=s.errorObj,u=s.tryCatch,h={};function f(t){setTimeout(function(){throw t},0)}function _(t,n){var r=0,o=t.length,s=new e(a);return function a(){if(r>=o)return s._fulfill();var l=function(t){var e=i(t);return e!==t&&"function"==typeof t._isDisposable&&"function"==typeof t._getDisposer&&t._isDisposable()&&e._setDisposable(t._getDisposer()),e}(t[r++]);if(l instanceof e&&l._isDisposable()){try{l=i(l._getDisposer().tryDispose(n),t.promise)}catch(t){return f(t)}if(l instanceof e)return l._then(a,f,null,null,null)}a()}(),s}function g(t,e,n){this._data=t,this._promise=e,this._context=n}function p(t,e,n){this.constructor$(t,e,n)}function v(t){return g.isDisposer(t)?(this.resources[this.index]._setDisposable(t),t.promise()):t}function m(t){this.length=t,this.promise=null,this[t-1]=null}g.prototype.data=function(){return this._data},g.prototype.promise=function(){return this._promise},g.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():h},g.prototype.tryDispose=function(t){var e=this.resource(),n=this._context;void 0!==n&&n._pushContext();var i=e!==h?this.doDispose(e,t):null;return void 0!==n&&n._popContext(),this._promise._unsetDisposable(),this._data=null,i},g.isDisposer=function(t){return null!=t&&"function"==typeof t.resource&&"function"==typeof t.tryDispose},c(p,g),p.prototype.doDispose=function(t,e){return this.data().call(t,t,e)},m.prototype._resultCancelled=function(){for(var t=this.length,n=0;n0},e.prototype._getDisposer=function(){return this._disposer},e.prototype._unsetDisposable=function(){this._bitField=-131073&this._bitField,this._disposer=void 0},e.prototype.disposer=function(t){if("function"==typeof t)return new p(t,this,r());throw new l}}},{"./errors":12,"./util":36}],36:[function(t,e,r){"use strict";var a=t("./es5"),o="undefined"==typeof navigator,s={e:{}},c,d="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==i?i:void 0!==this?this:null;function u(){try{var t=c;return c=null,t.apply(this,arguments)}catch(t){return s.e=t,s}}function h(t){return c=t,u}var f=function(t,e){var n={}.hasOwnProperty;function i(){for(var i in this.constructor=t,this.constructor$=e,e.prototype)n.call(e.prototype,i)&&"$"!==i.charAt(i.length-1)&&(this[i+"$"]=e.prototype[i])}return i.prototype=e.prototype,t.prototype=new i,t.prototype};function _(t){return null==t||!0===t||!1===t||"string"==typeof t||"number"==typeof t}function g(t){return"function"==typeof t||"object"===l(t)&&null!==t}function p(t){return _(t)?new Error(E(t)):t}function v(t,e){var n,i=t.length,r=new Array(i+1);for(n=0;n1,i=e.length>0&&!(1===e.length&&"constructor"===e[0]),r=w.test(t+"")&&a.names(t).length>0;if(n||i||r)return!0}return!1}catch(t){return!1}}function $(t){function e(){}e.prototype=t;var n=new e;function i(){return l(n.foo)}return i(),i(),t}var S=/^[a-z$_][a-z$_0-9]*$/i;function T(t){return S.test(t)}function C(t,e,n){for(var i=new Array(t),r=0;r10||t[0]>0}(),V.isNode&&V.toFastProperties(n);try{throw new Error}catch(t){V.lastLineError=t}e.exports=V},{"./es5":13}]},{},[4])(4)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise)}).call(this,n(43),n(15),n(212).setImmediate)},function(t,e,n){t.exports=n(213)},function(t,e,n){var i=n(0);t.exports=function(){var t={};return{getState:function(e){if(t[e])return t[e].method();var n={};for(var r in t)t[r].internal||i.mixin(n,t[r].method(),!0);return n},registerProvider:function(e,n,i){t[e]={method:n,internal:i}},unregisterProvider:function(e){delete t[e]}}}},function(t,e){t.exports=function(t){var e={};function n(n,i,r){r=r||n;var a=t.config,o=t.templates;t.config[n]&&e[r]!=a[n]&&(i&&o[r]||(o[r]=t.date.date_to_str(a[n]),e[r]=a[n]))}return{initTemplates:function(){var e=t.locale.labels;e.gantt_save_btn=e.icon_save,e.gantt_cancel_btn=e.icon_cancel,e.gantt_delete_btn=e.icon_delete;var i=t.date,r=i.date_to_str,a=t.config,o=r(a.xml_date||a.date_format,a.server_utc),s=i.str_to_date(a.xml_date||a.date_format,a.server_utc);n("date_scale",!0,void 0,t.config,t.templates),n("date_grid",!0,"grid_date_format",t.config,t.templates),n("task_date",!0,void 0,t.config,t.templates),t.mixin(t.templates,{xml_format:void 0,format_date:o,xml_date:void 0,parse_date:s,progress_text:function(t,e,n){return""},grid_header_class:function(t,e){return""},task_text:function(t,e,n){return n.text},task_class:function(t,e,n){return""},task_end_date:function(e){return t.templates.task_date(e)},grid_row_class:function(t,e,n){return""},task_row_class:function(t,e,n){return""},timeline_cell_class:function(t,e){return""},timeline_cell_content:function(t,e){return""},scale_cell_class:function(t){return""},scale_row_class:function(t){return""},grid_indent:function(t){return"
"},grid_folder:function(t){return"
"},grid_file:function(t){return"
"},grid_open:function(t){return"
"},grid_blank:function(t){return"
"},date_grid:function(e,n,i){return n&&t.isUnscheduledTask(n)&&t.config.show_unscheduled?t.templates.task_unscheduled_time(n):t.templates.grid_date_format(e,i)},task_time:function(e,n,i){return t.isUnscheduledTask(i)&&t.config.show_unscheduled?t.templates.task_unscheduled_time(i):t.templates.task_date(e)+" - "+t.templates.task_end_date(n)},task_unscheduled_time:function(t){return""},time_picker:r(a.time_picker),link_class:function(t){return""},link_description:function(e){var n=t.getTask(e.source),i=t.getTask(e.target);return""+n.text+""+i.text+""},drag_link:function(e,n,i,r){e=t.getTask(e);var a=t.locale.labels,o=""+e.text+" "+(n?a.link_start:a.link_end)+"
";return i&&(o+=" "+(i=t.getTask(i)).text+" "+(r?a.link_start:a.link_end)+"
"),o},drag_link_class:function(e,n,i,r){var a="";return e&&i&&(a=" "+(t.isLinkAllowed(e,i,n,r)?"gantt_link_allow":"gantt_link_deny")),"gantt_link_tooltip"+a},tooltip_date_format:i.date_to_str("%Y-%m-%d"),tooltip_text:function(e,n,i){return"Task: "+i.text+"
Start date: "+t.templates.tooltip_date_format(e)+"
End date: "+t.templates.tooltip_date_format(n)}})},initTemplate:n}}},function(t,e,n){var i=n(4),r=n(0),a=n(44),o=n(16),s=n(1);t.exports=function(t){function e(t){return{target:t.target||t.srcElement,pageX:t.pageX,pageY:t.pageY,clientX:t.clientX,clientY:t.clientY,metaKey:t.metaKey,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey}}function n(n,a){this._obj=n,this._settings=a||{},i(this);var o=this.getInputMethods();this._drag_start_timer=null,t.attachEvent("onGanttScroll",r.bind(function(t,e){this.clearDragTimer()},this));for(var l={passive:!1},c=0;cthis.config.sensitivity},initDnDMarker:function(){var t=this.config.marker=document.createElement("div");t.className="gantt_drag_marker",t.innerHTML="",document.body.appendChild(t)},backupEventTarget:function(n,i){if(t.config.touch){var r=i(n),a=r.target||r.srcElement,o=a.cloneNode(!0);this.config.original_target=e(r),this.config.original_target.target=o,this.config.backup_element=a,a.parentNode.appendChild(o),a.style.display="none",(this.config.mousemoveContainer||document.body).appendChild(a)}},getInputMethods:function(){var e=[];if(e.push({move:"mousemove",down:"mousedown",up:"mouseup",accessor:function(t){return t}}),t.config.touch){var n=!0;try{document.createEvent("TouchEvent")}catch(t){n=!1}n?e.push({move:"touchmove",down:"touchstart",up:"touchend",accessor:function(t){return t.touches&&t.touches.length>1?null:t.touches[0]?{target:document.elementFromPoint(t.touches[0].clientX,t.touches[0].clientY),pageX:t.touches[0].pageX,pageY:t.touches[0].pageY,clientX:t.touches[0].clientX,clientY:t.touches[0].clientY}:t}}):o.navigator.pointerEnabled?e.push({move:"pointermove",down:"pointerdown",up:"pointerup",accessor:function(t){return"mouse"==t.pointerType?null:t}}):o.navigator.msPointerEnabled&&e.push({move:"MSPointerMove",down:"MSPointerDown",up:"MSPointerUp",accessor:function(t){return t.pointerType==t.MSPOINTER_TYPE_MOUSE?null:t}})}return e},clearDragTimer:function(){this._drag_start_timer&&(clearTimeout(this._drag_start_timer),this._drag_start_timer=null)},dragStart:function(e,n,i){this.config&&this.config.started||(this.config={obj:e,marker:null,started:!1,pos:this.getPosition(n),sensitivity:4},this._settings&&r.mixin(this.config,this._settings,!0),this.traceDragEvents(e,i),t._prevent_touch_scroll=!0,document.body.className+=" gantt_noselect",t.config.touch&&this.dragMove(e,n,i.accessor))},dragMove:function(e,n,i){var r=i(n);if(!r)return!1;if(!this.config.marker&&!this.config.started){var a=this.getPosition(r);if(t.config.touch||this.checkPositionChange(a)){if(this.config.started=!0,this.config.ignore=!1,!1===this.callEvent("onBeforeDragStart",[e,this.config.original_target]))return this.config.ignore=!0,!1;this.backupEventTarget(n,i),this.initDnDMarker(),t._touch_feedback(),this.callEvent("onAfterDragStart",[e,this.config.original_target])}else this.config.ignore=!0}if(!this.config.ignore){if(n.targetTouches&&!r.target)return;return r.pos=this.getPosition(r),this.config.marker.style.left=r.pos.x+"px",this.config.marker.style.top=r.pos.y+"px",this.callEvent("onDragMove",[e,r]),!0}return!1},dragEnd:function(e){var n=this.config.backup_element;n&&n.parentNode&&n.parentNode.removeChild(n),t._prevent_touch_scroll=!1,this.config.marker&&(this.config.marker.parentNode.removeChild(this.config.marker),this.config.marker=null,this.callEvent("onDragEnd",[])),this.config.started=!1,document.body.className=document.body.className.replace(" gantt_noselect","")},getPosition:function(t){var e=0,n=0;return t.pageX||t.pageY?(e=t.pageX,n=t.pageY):(t.clientX||t.clientY)&&(e=t.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,n=t.clientY+document.body.scrollTop+document.documentElement.scrollTop),{x:e,y:n}}},n}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i={date_to_str:function(t,e,n){return function(i){return t.replace(/%[a-zA-Z]/g,function(t){switch(t){case"%d":return e?n.date.to_fixed(i.getUTCDate()):n.date.to_fixed(i.getDate());case"%m":return e?n.date.to_fixed(i.getUTCMonth()+1):n.date.to_fixed(i.getMonth()+1);case"%j":return e?i.getUTCDate():i.getDate();case"%n":return e?i.getUTCMonth()+1:i.getMonth()+1;case"%y":return e?n.date.to_fixed(i.getUTCFullYear()%100):n.date.to_fixed(i.getFullYear()%100);case"%Y":return e?i.getUTCFullYear():i.getFullYear();case"%D":return e?n.locale.date.day_short[i.getUTCDay()]:n.locale.date.day_short[i.getDay()];case"%l":return e?n.locale.date.day_full[i.getUTCDay()]:n.locale.date.day_full[i.getDay()];case"%M":return e?n.locale.date.month_short[i.getUTCMonth()]:n.locale.date.month_short[i.getMonth()];case"%F":return e?n.locale.date.month_full[i.getUTCMonth()]:n.locale.date.month_full[i.getMonth()];case"%h":return e?n.date.to_fixed((i.getUTCHours()+11)%12+1):n.date.to_fixed((i.getHours()+11)%12+1);case"%g":return e?(i.getUTCHours()+11)%12+1:(i.getHours()+11)%12+1;case"%G":return e?i.getUTCHours():i.getHours();case"%H":return e?n.date.to_fixed(i.getUTCHours()):n.date.to_fixed(i.getHours());case"%i":return e?n.date.to_fixed(i.getUTCMinutes()):n.date.to_fixed(i.getMinutes());case"%a":return e?i.getUTCHours()>11?"pm":"am":i.getHours()>11?"pm":"am";case"%A":return e?i.getUTCHours()>11?"PM":"AM":i.getHours()>11?"PM":"AM";case"%s":return e?n.date.to_fixed(i.getUTCSeconds()):n.date.to_fixed(i.getSeconds());case"%W":return e?n.date.to_fixed(n.date.getUTCISOWeek(i)):n.date.to_fixed(n.date.getISOWeek(i));default:return t}})}},str_to_date:function(t,e,n){return function(i){for(var r=[0,0,1,0,0,0],a=i.match(/[a-zA-Z]+|[0-9]+/g),o=t.match(/%[a-zA-Z]/g),s=0;s50?1900:2e3);break;case"%g":case"%G":case"%h":case"%H":r[3]=a[s]||0;break;case"%i":r[4]=a[s]||0;break;case"%Y":r[0]=a[s]||0;break;case"%a":case"%A":r[3]=r[3]%12+("am"===(a[s]||"").toLowerCase()?0:12);break;case"%s":r[5]=a[s]||0;break;case"%M":r[1]=n.locale.date.month_short_hash[a[s]]||0;break;case"%F":r[1]=n.locale.date.month_full_hash[a[s]]||0}return e?new Date(Date.UTC(r[0],r[1],r[2],r[3],r[4],r[5])):new Date(r[0],r[1],r[2],r[3],r[4],r[5])}}};e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i={date_to_str:function(t,e,n){t=t.replace(/%[a-zA-Z]/g,function(t){switch(t){case"%d":return'"+to_fixed(date.get'+(e?"UTC":"")+'Date())+"';case"%m":return'"+to_fixed((date.get'+(e?"UTC":"")+'Month()+1))+"';case"%j":return'"+date.get'+(e?"UTC":"")+'Date()+"';case"%n":return'"+(date.get'+(e?"UTC":"")+'Month()+1)+"';case"%y":return'"+to_fixed(date.get'+(e?"UTC":"")+'FullYear()%100)+"';case"%Y":return'"+date.get'+(e?"UTC":"")+'FullYear()+"';case"%D":return'"+locale.date.day_short[date.get'+(e?"UTC":"")+'Day()]+"';case"%l":return'"+locale.date.day_full[date.get'+(e?"UTC":"")+'Day()]+"';case"%M":return'"+locale.date.month_short[date.get'+(e?"UTC":"")+'Month()]+"';case"%F":return'"+locale.date.month_full[date.get'+(e?"UTC":"")+'Month()]+"';case"%h":return'"+to_fixed((date.get'+(e?"UTC":"")+'Hours()+11)%12+1)+"';case"%g":return'"+((date.get'+(e?"UTC":"")+'Hours()+11)%12+1)+"';case"%G":return'"+date.get'+(e?"UTC":"")+'Hours()+"';case"%H":return'"+to_fixed(date.get'+(e?"UTC":"")+'Hours())+"';case"%i":return'"+to_fixed(date.get'+(e?"UTC":"")+'Minutes())+"';case"%a":return'"+(date.get'+(e?"UTC":"")+'Hours()>11?"pm":"am")+"';case"%A":return'"+(date.get'+(e?"UTC":"")+'Hours()>11?"PM":"AM")+"';case"%s":return'"+to_fixed(date.get'+(e?"UTC":"")+'Seconds())+"';case"%W":return'"+to_fixed(getISOWeek(date))+"';case"%w":return'"+to_fixed(getWeek(date))+"';default:return t}});var i=new Function("date","to_fixed","locale","getISOWeek","getWeek",'return "'+t+'";');return function(t){return i(t,n.date.to_fixed,n.locale,n.date.getISOWeek,n.date.getWeek)}},str_to_date:function(t,e,n){for(var i="var temp=date.match(/[a-zA-Z]+|[0-9]+/g);",r=t.match(/%[a-zA-Z]/g),a=0;a50?1900:2000);";break;case"%g":case"%G":case"%h":case"%H":i+="set[3]=temp["+a+"]||0;";break;case"%i":i+="set[4]=temp["+a+"]||0;";break;case"%Y":i+="set[0]=temp["+a+"]||0;";break;case"%a":case"%A":i+="set[3]=set[3]%12+((temp["+a+"]||'').toLowerCase()=='am'?0:12);";break;case"%s":i+="set[5]=temp["+a+"]||0;";break;case"%M":i+="set[1]=locale.date.month_short_hash[temp["+a+"]]||0;";break;case"%F":i+="set[1]=locale.date.month_full_hash[temp["+a+"]]||0;"}var o="set[0],set[1],set[2],set[3],set[4],set[5]";e&&(o=" Date.UTC("+o+")");var s=new Function("date","locale","var set=[0,0,1,0,0,0]; "+i+" return new Date("+o+");");return function(t){return s(t,n.locale)}}};e.default=i},function(t,e,n){var i=n(219).default,r=n(218).default;t.exports=function(t){var e=null;function n(){var n=!1;return"auto"===t.config.csp?(null===e&&function(){try{new Function("canUseCsp = false;")}catch(t){e=!0}}(),n=e):n=t.config.csp,n}return{init:function(){for(var e=t.locale,n=e.date.month_short,i=e.date.month_short_hash={},r=0;r=9?9:n>=6?6:n>=3?3:0,t.setMonth(e),t},year_start:function(t){return t.setMonth(0),this.month_start(t)},day_start:function(t){return this.date_part(t)},hour_start:function(t){return t.getMinutes()&&t.setMinutes(0),this.minute_start(t),t},minute_start:function(t){return t.getSeconds()&&t.setSeconds(0),t.getMilliseconds()&&t.setMilliseconds(0),t},_add_days:function(t,e,n){t.setDate(t.getDate()+e);var i=e>=0,r=!n.getHours()&&t.getHours(),a=t.getDate()<=n.getDate()||t.getMonth()1&&r&&t.setHours(0),t},add:function(t,e,n){var i=new Date(t.valueOf());switch(n){case"day":i=this._add_days(i,e,t);break;case"week":i=this._add_days(i,7*e,t);break;case"month":i.setMonth(i.getMonth()+e);break;case"year":i.setYear(i.getFullYear()+e);break;case"hour":i.setTime(i.getTime()+60*e*60*1e3);break;case"minute":i.setTime(i.getTime()+60*e*1e3);break;default:return this["add_"+n](t,e,n)}return i},add_quarter:function(t,e){return this.add(t,3*e,"month")},to_fixed:function(t){return t<10?"0"+t:t},copy:function(t){return new Date(t.valueOf())},date_to_str:function(e,a){var o=i;return n()&&(o=r),o.date_to_str(e,a,t)},str_to_date:function(e,a){var o=i;return n()&&(o=r),o.str_to_date(e,a,t)},getISOWeek:function(e){return t.date._getWeekNumber(e,!0)},_getWeekNumber:function(t,e){if(!t)return!1;var n=t.getDay();e&&0===n&&(n=7);var i=new Date(t.valueOf());i.setDate(t.getDate()+(4-n));var r=i.getFullYear(),a=Math.round((i.getTime()-new Date(r,0,1).getTime())/864e5);return 1+Math.floor(a/7)},getWeek:function(e){return t.date._getWeekNumber(e,t.config.start_on_monday)},getUTCISOWeek:function(e){return t.date.getISOWeek(e)},convert_to_utc:function(t){return new Date(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds())},parseDate:function(e,n){return e&&!e.getFullYear&&("function"!=typeof n&&(n="string"==typeof n?"parse_date"===n||"xml_date"===n?t.defined(t.templates.xml_date)?t.templates.xml_date:t.templates.parse_date:t.defined(t.templates[n])?t.templates[n]:t.date.str_to_date(n):t.defined(t.templates.xml_date)?t.templates.xml_date:t.templates.parse_date),e=e?n(e):null),e}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){if("string"==typeof t||"number"==typeof t)return t;var e="";for(var n in t){var i="";t.hasOwnProperty(n)&&(i=n+"="+(i="string"==typeof t[n]?encodeURIComponent(t[n]):"number"==typeof t[n]?t[n]:encodeURIComponent(JSON.stringify(t[n]))),e.length&&(i="&"+i),e+=i)}return e}},function(t,e,n){function i(t){"@babel/helpers - typeof";return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var r=n(8),a=n(16),o=n(221).default;function s(t,e){var n={method:t};if(0===e.length)throw new Error("Arguments list of query is wrong.");if(1===e.length)return"string"==typeof e[0]?(n.url=e[0],n.async=!0):(n.url=e[0].url,n.async=e[0].async||!0,n.callback=e[0].callback,n.headers=e[0].headers),e[0].data?"string"!=typeof e[0].data?n.data=o(e[0].data):n.data=e[0].data:n.data="",n;switch(n.url=e[0],t){case"GET":case"DELETE":n.callback=e[1],n.headers=e[2];break;case"POST":case"PUT":e[1]?"string"!=typeof e[1]?n.data=o(e[1]):n.data=e[1]:n.data="",n.callback=e[2],n.headers=e[3]}return n}t.exports=function(t){return{cache:!0,method:"get",parse:function(t){return"string"!=typeof t?t:(t=t.replace(/^[\s]+/,""),"undefined"==typeof DOMParser||r.isIE?void 0!==a.ActiveXObject&&((e=new a.ActiveXObject("Microsoft.XMLDOM")).async="false",e.loadXML(t)):e=(new DOMParser).parseFromString(t,"text/xml"),e);var e},xmltop:function(e,n,i){if(void 0===n.status||n.status<400){var r=n.responseXML?n.responseXML||n:this.parse(n.responseText||n);if(r&&null!==r.documentElement&&!r.getElementsByTagName("parsererror").length)return r.getElementsByTagName(e)[0]}return-1!==i&&t.callEvent("onLoadXMLError",["Incorrect XML",arguments[1],i]),document.createElement("DIV")},xpath:function(t,e){if(e.nodeName||(e=e.responseXML||e),r.isIE)return e.selectNodes(t)||[];for(var n,i=[],a=(e.ownerDocument||e).evaluate(t,e,null,XPathResult.ANY_TYPE,null);n=a.iterateNext();)i.push(n);return i},query:function(t){return this._call(t.method||"GET",t.url,t.data||"",t.async||!0,t.callback,t.headers)},get:function(t,e,n){var i=s("GET",arguments);return this.query(i)},getSync:function(t,e){var n=s("GET",arguments);return n.async=!1,this.query(n)},put:function(t,e,n,i){var r=s("PUT",arguments);return this.query(r)},del:function(t,e,n){var i=s("DELETE",arguments);return this.query(i)},post:function(t,e,n,i){1==arguments.length?e="":2==arguments.length&&"function"==typeof e&&(e,e="");var r=s("POST",arguments);return this.query(r)},postSync:function(t,e,n){e=null===e?"":String(e);var i=s("POST",arguments);return i.async=!1,this.query(i)},_call:function(e,n,r,o,s,l){return new t.Promise(function(c,d){var u=void 0!==("undefined"==typeof XMLHttpRequest?"undefined":i(XMLHttpRequest))?new XMLHttpRequest:new a.ActiveXObject("Microsoft.XMLHTTP"),h=null!==navigator.userAgent.match(/AppleWebKit/)&&null!==navigator.userAgent.match(/Qt/)&&null!==navigator.userAgent.match(/Safari/);o&&(u.onreadystatechange=function(){if(4==u.readyState||h&&3==u.readyState){if((200!=u.status||""===u.responseText)&&!t.callEvent("onAjaxError",[u]))return;setTimeout(function(){"function"==typeof s&&s.apply(a,[{xmlDoc:u,filePath:n}]),c(u),"function"==typeof s&&(s=null,u=null)},0)}});var f=!this||!this.cache;if("GET"==e&&f&&(n+=(n.indexOf("?")>=0?"&":"?")+"dhxr"+(new Date).getTime()+"=1"),u.open(e,n,o),l)for(var _ in l)u.setRequestHeader(_,l[_]);else"POST"==e.toUpperCase()||"PUT"==e||"DELETE"==e?u.setRequestHeader("Content-Type","application/x-www-form-urlencoded"):"GET"==e&&(r=null);if(u.setRequestHeader("X-Requested-With","XMLHttpRequest"),u.send(r),!o)return{xmlDoc:u,filePath:n}})},urlSeparator:function(t){return-1!=t.indexOf("?")?"&":"?"}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),t.exports=function(){return{layout:{css:"gantt_container",rows:[{cols:[{view:"grid",scrollX:"scrollHor",scrollY:"scrollVer"},{resizer:!0,width:1},{view:"timeline",scrollX:"scrollHor",scrollY:"scrollVer"},{view:"scrollbar",id:"scrollVer"}]},{view:"scrollbar",id:"scrollHor",height:20}]},links:{finish_to_start:"0",start_to_start:"1",finish_to_finish:"2",start_to_finish:"3"},types:{task:"task",project:"project",milestone:"milestone"},auto_types:!1,duration_unit:"day",work_time:!1,correct_work_time:!1,skip_off_time:!1,cascade_delete:!0,autosize:!1,autosize_min_width:0,autoscroll:!0,autoscroll_speed:30,deepcopy_on_parse:!1,show_links:!0,show_task_cells:!0,static_background:!1,static_background_cells:!0,branch_loading:!1,branch_loading_property:"$has_child",show_loading:!1,show_chart:!0,show_grid:!0,min_duration:36e5,date_format:"%d-%m-%Y %H:%i",xml_date:void 0,start_on_monday:!0,server_utc:!1,show_progress:!0,fit_tasks:!1,select_task:!0,scroll_on_click:!0,smart_rendering:!0,preserve_scroll:!0,readonly:!1,container_resize_timeout:20,date_grid:"%Y-%m-%d",drag_links:!0,drag_progress:!0,drag_resize:!0,drag_project:!1,drag_move:!0,drag_mode:{resize:"resize",progress:"progress",move:"move",ignore:"ignore"},round_dnd_dates:!0,link_wrapper_width:20,root_id:0,autofit:!1,columns:[{name:"text",tree:!0,width:"*",resize:!0},{name:"start_date",align:"center",resize:!0},{name:"duration",align:"center"},{name:"add",width:44}],scale_offset_minimal:!0,inherit_scale_class:!1,scales:[{unit:"day",step:1,date:"%d %M"}],time_step:60,duration_step:1,task_date:"%d %F %Y",time_picker:"%H:%i",task_attribute:"data-task-id",link_attribute:"data-link-id",layer_attribute:"data-layer",buttons_left:["gantt_save_btn","gantt_cancel_btn"],_migrate_buttons:{dhx_save_btn:"gantt_save_btn",dhx_cancel_btn:"gantt_cancel_btn",dhx_delete_btn:"gantt_delete_btn"},buttons_right:["gantt_delete_btn"],lightbox:{sections:[{name:"description",height:70,map_to:"text",type:"textarea",focus:!0},{name:"time",type:"duration",map_to:"auto"}],project_sections:[{name:"description",height:70,map_to:"text",type:"textarea",focus:!0},{name:"type",type:"typeselect",map_to:"type"},{name:"time",type:"duration",readonly:!0,map_to:"auto"}],milestone_sections:[{name:"description",height:70,map_to:"text",type:"textarea",focus:!0},{name:"type",type:"typeselect",map_to:"type"},{name:"time",type:"duration",single_date:!0,map_to:"auto"}]},drag_lightbox:!0,sort:!1,details_on_create:!0,details_on_dblclick:!0,initial_scroll:!0,task_scroll_offset:100,order_branch:!1,order_branch_free:!1,task_height:void 0,bar_height:"full",min_column_width:70,min_grid_column_width:70,grid_resizer_column_attribute:"data-column-index",keep_grid_width:!1,grid_resize:!1,grid_elastic_columns:!1,show_tasks_outside_timescale:!1,show_unscheduled:!0,resize_rows:!1,task_grid_row_resizer_attribute:"data-row-index",min_task_grid_row_height:30,readonly_property:"readonly",editable_property:"editable",calendar_property:"calendar_id",resource_calendars:{},dynamic_resource_calendars:!1,inherit_calendar:!1,type_renderers:{},open_tree_initially:!1,optimize_render:!0,prevent_default_scroll:!1,show_errors:!0,wai_aria_attributes:!0,smart_scales:!0,rtl:!1,placeholder_task:!1,horizontal_scroll_key:"shiftKey",drag_timeline:{useKey:void 0,ignore:".gantt_task_line, .gantt_task_link"},drag_multiple:!0,csp:"auto"}}},function(t,e){t.exports=function(){var t={};return{services:{},setService:function(e,n){t[e]=n},getService:function(e){return t[e]?t[e]():null},dropService:function(e){t[e]&&delete t[e]},destructor:function(){for(var e in t)if(t[e]){var n=t[e];n&&n.destructor&&n.destructor()}t=null}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){return function(t){var e=this;for(var n in this.addExtension=function(t,n){e._extensions[t]=n},this.getExtension=function(t){return e._extensions[t]},this._extensions={},t)this._extensions[n]=t[n]}}();e.default=i},function(t,e){t.exports={KEY_CODES:{UP:38,DOWN:40,LEFT:37,RIGHT:39,SPACE:32,ENTER:13,DELETE:46,ESC:27,TAB:9}}},function(t,e,n){function i(t){"@babel/helpers - typeof";return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t.exports=function(t){var e=new function(){this.constants=n(226),this.version="8.0.1",this.license="gpl",this.templates={},this.ext={},this.keys={edit_save:this.constants.KEY_CODES.ENTER,edit_cancel:this.constants.KEY_CODES.ESC}},r=new(0,n(225).default)(t),a={};e.plugins=function(t){for(var n in t)if(t[n]&&!a[n]){var i=r.getExtension(n);i&&(i(e),a[n]=!0)}return a},e.$services=n(224)(),e.config=n(223)(),e.ajax=n(222)(e),e.date=n(220)(e);var o=n(217)(e);e.$services.setService("dnd",function(){return o});var s=n(216)(e);e.$services.setService("templateLoader",function(){return s}),n(4)(e);var l=new(n(215));l.registerProvider("global",function(){var t={min_date:e._min_date,max_date:e._max_date,selected_task:null};return e.$data&&e.$data.tasksStore&&(t.selected_task=e.$data.tasksStore.getSelectedId()),t}),e.getState=l.getState,e.$services.setService("state",function(){return l});var c=n(0);c.mixin(e,c),e.Promise=n(214),e.env=n(8),n(210)(e);var d=n(204);e.dataProcessor=d.DEPRECATED_api,e.createDataProcessor=d.createDataProcessor,n(199)(e),n(189)(e),n(188)(e),n(180)(e),n(179)(e),n(178)(e),n(165)(e),n(164).default(e),n(163)(e),n(162)(e),n(161)(e),n(158)(e),n(157).default(e);var u=n(156).default();return e.i18n={addLocale:u.addLocale,setLocale:function(t){if("string"==typeof t){var n=u.getLocale(t);n||(n=u.getLocale("en")),e.locale=n}else if(t)if(e.locale)for(var r in t)t[r]&&"object"===i(t[r])?(e.locale[r]||(e.locale[r]={}),e.mixin(e.locale[r],t[r],!0)):e.locale[r]=t[r];else e.locale=t},getLocale:u.getLocale},e.i18n.setLocale("en"),e}},function(t,e,n){n(28);var i=n(227);t.exports=function(t){var e=i(t);return e.env.isNode||n(122)(e),e}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=10,r=function(){function t(t){var e=this;this.maxSteps=i,this.undoEnabled=!0,this.redoEnabled=!0,this.action={create:function(t){return{commands:t?t.slice():[]}},invert:function(t){for(var n,i=e._gantt.copy(t),r=e.command,a=0;athis.maxSteps;)t.shift();return e}}},t.prototype._pop=function(t){return t.pop()},t.prototype._reorderCommands=function(t){var e={any:0,link:1,task:2},n={move:1,any:0};t.commands.sort(function(t,i){if("task"===t.entity&&"task"===i.entity)return t.type!==i.type?(n[i.type]||0)-(n[t.type]||0):"move"===t.type&&t.oldValue&&i.oldValue&&i.oldValue.parent===t.oldValue.parent?t.oldValue.$index-i.oldValue.$index:0;var r=e[t.entity]||e.any;return(e[i.entity]||e.any)-r})},t.prototype._applyAction=function(t){var e=null,n=this.command.entity,i=this.command.type,r=this._gantt,a={};a[n.task]={add:"addTask",get:"getTask",update:"updateTask",remove:"deleteTask",move:"moveTask",isExists:"isTaskExists"},a[n.link]={add:"addLink",get:"getLink",update:"updateLink",remove:"deleteLink",isExists:"isLinkExists"},r.batchUpdate(function(){for(var n=0;nn.bottom&&(a.bottom=n.bottom,a.top=a.bottom-a.height),a.leftn.right&&(a.right=n.right,a.left=a.right-a.width),c.x>=a.left&&c.x<=a.right&&(a.left=c.x-a.width-o,a.right=a.left+a.width),c.y>=a.top&&c.y<=a.bottom&&(a.top=c.y-a.height-s,a.bottom=a.top+a.height),a},t.prototype._getViewPortSize=function(){var t,e=this._gantt,n=this._getViewPort(),r=n,a=window.scrollY+document.body.scrollTop,o=window.scrollX+document.body.scrollLeft;return n===e.$task_data?(r=e.$task,a=0,o=0,t=i.getNodePosition(e.$task)):t=i.getNodePosition(r),{left:t.x+o,top:t.y+a,width:t.width,height:t.height,bottom:t.y+t.height+a,right:t.x+t.width+o}},t}();e.Tooltip=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(45),r=n(1),a=n(2),o=n(232),s=function(){function t(t){this._listeners={},this.tooltip=new o.Tooltip(t),this._gantt=t,this._domEvents=i(),this._initDelayedFunctions()}return t.prototype.destructor=function(){this.tooltip.hide(),this._domEvents.detachAll()},t.prototype.hideTooltip=function(){this.delayHide()},t.prototype.attach=function(t){var e=this,n=document.body,i=this._gantt;t.global||(n=i.$root);var a=null,o=function(n){var i=r.getTargetNode(n),o=r.closest(i,t.selector);if(!r.isChildOf(i,e.tooltip.getNode())){var s=function(){a=o,t.onmouseenter(n,o)};a?o&&o===a?t.onmousemove(n,o):(t.onmouseleave(n,a),a=null,o&&o!==a&&s()):o&&s()}};this.detach(t.selector),this._domEvents.attach(n,"mousemove",o),this._listeners[t.selector]={node:n,handler:o}},t.prototype.detach=function(t){var e=this._listeners[t];e&&this._domEvents.detach(e.node,"mousemove",e.handler)},t.prototype.tooltipFor=function(t){var e=this,n=function(t){var e=t;return document.createEventObject&&!document.createEvent&&(e=document.createEventObject(t)),e};this._initDelayedFunctions(),this.attach({selector:t.selector,global:t.global,onmouseenter:function(i,r){var a=t.html(i,r);a&&e.delayShow(n(i),a)},onmousemove:function(i,r){var a=t.html(i,r);a?e.delayShow(n(i),a):(e.delayShow.$cancelTimeout(),e.delayHide())},onmouseleave:function(){e.delayShow.$cancelTimeout(),e.delayHide()}})},t.prototype._initDelayedFunctions=function(){var t=this,e=this._gantt;this.delayShow&&this.delayShow.$cancelTimeout(),this.delayHide&&this.delayHide.$cancelTimeout(),this.tooltip.hide(),this.delayShow=a.delay(function(n,i){!1===e.callEvent("onBeforeTooltip",[n])?t.tooltip.hide():(t.tooltip.setContent(i),t.tooltip.show(n))},e.config.tooltip_timeout||1),this.delayHide=a.delay(function(){t.delayShow.$cancelTimeout(),t.tooltip.hide()},e.config.tooltip_hide_timeout||1)},t}();e.TooltipManager=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(233);e.default=function(t){t.config.tooltip_timeout=30,t.config.tooltip_offset_y=20,t.config.tooltip_offset_x=10,t.config.tooltip_hide_timeout=30;var e=new i.TooltipManager(t);t.ext.tooltips=e,t.attachEvent("onGanttReady",function(){e.tooltipFor({selector:"["+t.config.task_attribute+"]:not(.gantt_task_row)",html:function(e){if(!t.config.touch||t.config.touch_tooltip){var n=t.locate(e);if(t.isTaskExists(n)){var i=t.getTask(n);return t.templates.tooltip_text(i.start_date,i.end_date,i)}return null}},global:!1})}),t.attachEvent("onDestroy",function(){e.destructor()}),t.attachEvent("onLightbox",function(){e.hideTooltip()}),t.attachEvent("onBeforeTooltip",function(){if(t.getState().link_source_id)return!1}),t.attachEvent("onGanttScroll",function(){e.hideTooltip()})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){var e=this;this.show=function(t,n){void 0===n?e._showForTask(t):e._showAtCoordinates(t,n)},this.hide=function(t){var n=e._gantt,i=e._quickInfoBox;e._quickInfoBoxId=0;var r=e._quickInfoTask;if(e._quickInfoTask=null,i&&i.parentNode){if(n.config.quick_info_detached)return n.callEvent("onAfterQuickInfo",[r]),i.parentNode.removeChild(i);i.className+=" gantt_qi_hidden","auto"===i.style.right?i.style.left="-350px":i.style.right="-350px",t&&(i.style.left=i.style.right="",i.parentNode.removeChild(i)),n.callEvent("onAfterQuickInfo",[r])}},this.getNode=function(){return e._quickInfoBox?e._quickInfoBox:null},this.setContainer=function(t){t&&(e._container="string"==typeof t?document.getElementById(t):t)},this.setContent=function(t){var n=e._gantt,i={taskId:null,header:{title:"",date:""},content:"",buttons:n.config.quickinfo_buttons};t||(t=i),t.taskId||(t.taskId=i.taskId),t.header||(t.header=i.header),t.header.title||(t.header.title=i.header.title),t.header.date||(t.header.date=i.header.date),t.content||(t.content=i.content),t.buttons||(t.buttons=i.buttons);var r=e.getNode();r||(r=e._createQuickInfoElement()),t.taskId&&(e._quickInfoBoxId=t.taskId);var a=r.querySelector(".gantt_cal_qi_title"),o=a.querySelector(".gantt_cal_qi_tcontent"),s=a.querySelector(".gantt_cal_qi_tdate"),l=r.querySelector(".gantt_cal_qi_content"),c=r.querySelector(".gantt_cal_qi_controls");n._waiAria.quickInfoHeader(r,[t.header.title,t.header.date].join(" ")),o.innerHTML=t.header.title,s.innerHTML=t.header.date,t.header.title||t.header.date?a.style.display="":a.style.display="none",l.innerHTML=t.content;var d=t.buttons;d.length?c.style.display="":c.style.display="none";for(var u="",h=0;h
"+n.locale.labels[d[h]]+"
"}c.innerHTML=u,n.eventRemove(r,"click",e._qiButtonClickHandler),n.eventRemove(r,"keypress",e._qiKeyPressHandler),n.event(r,"click",e._qiButtonClickHandler),n.event(r,"keypress",e._qiKeyPressHandler)},this._qiButtonClickHandler=function(t){t=t||event,e._qi_button_click(t.target||t.srcElement)},this._qiKeyPressHandler=function(t){var n=(t=t||event).which||event.keyCode;13!==n&&32!==n||setTimeout(function(){e._qi_button_click(t.target||t.srcElement)},1)},this._gantt=t}return t.prototype._showAtCoordinates=function(t,e){this.hide(!0),this._quickInfoBoxId=0,this._quickInfoTask=null,this._quickInfoBox||(this._createQuickInfoElement(),this.setContent()),this._appendAtCoordinates(t,e),this._gantt.callEvent("onQuickInfo",[null])},t.prototype._showForTask=function(t){var e=this._gantt;if((t!==this._quickInfoBoxId||!e.utils.dom.isChildOf(this._quickInfoBox,document.body))&&e.config.show_quick_info){this.hide(!0);var n=this._getContainer(),i=this._get_event_counter_part(t,6,n.xViewport,n.yViewport);i&&(this._quickInfoBox=this._init_quick_info(t),this._quickInfoTask=t,this._quickInfoBox.className=this._prepare_quick_info_classname(t),this._fill_quick_data(t),this._show_quick_info(i,6),e.callEvent("onQuickInfo",[t]))}},t.prototype._get_event_counter_part=function(t,e,n,i){var r=this._gantt,a=r.getTaskNode(t);if(!a&&!(a=r.getTaskRowNode(t)))return null;var o=0,s=e+a.offsetTop+a.offsetHeight,l=a;if(r.utils.dom.isChildOf(l,n))for(;l&&l!==n;)o+=l.offsetLeft,l=l.offsetParent;var c=r.getScrollState();return l?{left:o,top:s,dx:o+a.offsetWidth/2-c.x>n.offsetWidth/2?1:0,dy:s+a.offsetHeight/2-c.y>i.offsetHeight/2?1:0,width:a.offsetWidth,height:a.offsetHeight}:null},t.prototype._createQuickInfoElement=function(){var t=this,e=this._gantt,n=document.createElement("div");n.className+="gantt_cal_quick_info",e._waiAria.quickInfoAttr(n);var i='
';if(i+='
',i+="
",n.innerHTML=i,e.config.quick_info_detached){var r=this._getContainer();e.event(r.parent,"scroll",function(){t.hide()})}return this._quickInfoBox=n,n},t.prototype._init_quick_info=function(t){var e=this._gantt,n=e.getTask(t);return"boolean"==typeof this._quickInfoReadonly&&e.isReadonly(n)!==this._quickInfoReadonly&&(this.hide(!0),this._quickInfoBox=null),this._quickInfoReadonly=e.isReadonly(n),this._quickInfoBox||(this._quickInfoBox=this._createQuickInfoElement()),this._quickInfoBox},t.prototype._prepare_quick_info_classname=function(t){var e=this._gantt,n=e.getTask(t),i="gantt_cal_quick_info",r=e.templates.quick_info_class(n.start_date,n.end_date,n);return r&&(i+=" "+r),i},t.prototype._fill_quick_data=function(t){var e=this._gantt,n=e.getTask(t);this._quickInfoBoxId=t;var i=[];if(this._quickInfoReadonly)for(var r=e.config.quickinfo_buttons,a={icon_delete:!0,icon_edit:!0},o=0;oc.offsetHeight/2&&(h=t.top-(o+t.height+2*e))t.getGlobalTaskIndex(n)?1:-1}),e},forSelected:function(t){for(var e=this.getSelected(),n=0;nl?t.getNext(c):t.getPrev(c);for(c=n;t.getGlobalTaskIndex(c)!==i;)this.select(c,e)&&!a&&(a=!0,r=c),c=i>s?t.getNext(c):t.getPrev(c)}}else o=n}.bind(this);return s&&(e.ctrlKey||e.metaKey)?(this.isSelected(n)||this.setFirstSelected(n),n&&this.toggle(n,e)):s&&e.shiftKey?(t.isTaskExists(this.getFirstSelected())&&null!==this.getFirstSelected()||this.setFirstSelected(n),i.length?c():l()):l(),this.isSelected(n)?this.setLastSelected(n):r?n==o&&this.setLastSelected(e.shiftKey?r:this.getDefaultSelected()):this.setLastSelected(null),this.getSelected().length||this.setLastSelected(null),this.getLastSelected()&&this.isSelected(this.getFirstSelected())||this.setFirstSelected(this.getLastSelected()),!0}},function(){var e=t.selectTask;t.selectTask=function(n){if(!(n=i(n,this.config.root_id)))return!1;var r=t._multiselect,a=n;return r.isActive()?(r.select(n,null)&&r.setLastSelected(n),r.setFirstSelected(r.getLastSelected())):a=e.call(this,n),a};var n=t.unselectTask;t.unselectTask=function(e){var i=t._multiselect,r=i.isActive();(e=e||i.getLastSelected())&&r&&(i.unselect(e,null),e==i.getLastSelected()&&i.setLastSelected(null),t.refreshTask(e),i.setFirstSelected(i.getLastSelected()));var a=e;return r||(a=n.call(this,e)),a},t.toggleTaskSelection=function(e){var n=t._multiselect;e&&n.isActive()&&(n.toggle(e),n.setFirstSelected(n.getLastSelected()))},t.getSelectedTasks=function(){var e=t._multiselect;return e.isActive(),e.getSelected()},t.eachSelectedTask=function(t){return this._multiselect.forSelected(t)},t.isSelectedTask=function(t){return this._multiselect.isSelected(t)},t.getLastSelectedTask=function(){return this._multiselect.getLastSelected()},t.attachEvent("onGanttReady",function(){var e=t.$data.tasksStore.isSelected;t.$data.tasksStore.isSelected=function(n){return t._multiselect.isActive()?t._multiselect.isSelected(n):e.call(this,n)}})}(),t.attachEvent("onTaskIdChange",function(e,n){var i=t._multiselect;if(!i.isActive())return!0;t.isSelectedTask(e)&&(i.unselect(e,null),i.select(n,null))}),t.attachEvent("onAfterTaskDelete",function(e,n){var i=t._multiselect;if(!i.isActive())return!0;i._selected[e]&&(i.unselect(e,null),i._selected[e]=!1,i.setLastSelected(i.getDefaultSelected())),i.forSelected(function(e){t.isTaskExists(e)||i.unselect(e,null)})}),t.attachEvent("onBeforeTaskMultiSelect",function(e,n,i){var r=t._multiselect;return!(n&&r.isActive()&&r._one_level)||r.isSameLevel(e)}),t.attachEvent("onTaskClick",function(e,n){return t._multiselect.doSelection(n)&&t.callEvent("onMultiSelect",[n]),!0})}},function(t,e){t.exports=function(t){function e(e){if(!t.config.show_markers)return!1;if(!e.start_date)return!1;var n=t.getState();if(!(+e.start_date>+n.max_date||(!e.end_date||+e.end_date<+n.min_date)&&+e.start_date<+n.min_date)){var i=document.createElement("div");i.setAttribute("data-marker-id",e.id);var r="gantt_marker";t.templates.marker_class&&(r+=" "+t.templates.marker_class(e)),e.css&&(r+=" "+e.css),e.title&&(i.title=e.title),i.className=r;var a=t.posFromDate(e.start_date);i.style.left=a+"px";var o=Math.max(t.getRowTop(t.getVisibleTaskCount()),0)+"px";if(t.config.timeline_placeholder&&(o=t.$container.scrollHeight+"px"),i.style.height=o,e.end_date){var s=t.posFromDate(e.end_date);i.style.width=Math.max(s-a,0)+"px"}return e.text&&(i.innerHTML="
"+e.text+"
"),i}}function n(){if(t.$task_data){var e=document.createElement("div");e.className="gantt_marker_area",t.$task_data.appendChild(e),t.$marker_area=e}}t._markers||(t._markers=t.createDatastore({name:"marker",initItem:function(e){return e.id=e.id||t.uid(),e}})),t.config.show_markers=!0,t.attachEvent("onBeforeGanttRender",function(){t.$marker_area||n()}),t.attachEvent("onDataRender",function(){t.$marker_area||(n(),t.renderMarkers())}),t.attachEvent("onGanttLayoutReady",function(){t.attachEvent("onBeforeGanttRender",function(){n(),t.$services.getService("layers").createDataRender({name:"marker",defaultContainer:function(){return t.$marker_area}}).addLayer(e)},{once:!0})}),t.getMarker=function(t){return this._markers?this._markers.getItem(t):null},t.addMarker=function(t){return this._markers.addItem(t)},t.deleteMarker=function(t){return!!this._markers.exists(t)&&(this._markers.removeItem(t),!0)},t.updateMarker=function(t){this._markers.refresh(t)},t._getMarkers=function(){return this._markers.getItems()},t.renderMarkers=function(){this._markers.refresh()}}},function(t,e){t.exports=function(t){t.$keyboardNavigation.dispatcher={isActive:!1,activeNode:null,globalNode:new t.$keyboardNavigation.GanttNode,enable:function(){this.isActive=!0,this.setActiveNode(this.getActiveNode())},disable:function(){this.isActive=!1},isEnabled:function(){return!!this.isActive},getDefaultNode:function(){var e;return(e=t.config.keyboard_navigation_cells?new t.$keyboardNavigation.TaskCell:new t.$keyboardNavigation.TaskRow).isValid()||(e=e.fallback()),e},setDefaultNode:function(){this.setActiveNode(this.getDefaultNode())},getActiveNode:function(){var t=this.activeNode;return t&&!t.isValid()&&(t=t.fallback()),t},fromDomElement:function(e){for(var n=[t.$keyboardNavigation.TaskRow,t.$keyboardNavigation.TaskCell,t.$keyboardNavigation.HeaderCell],i=0;i=0&&!i[r];)r--;i[r]&&(n=new t.$keyboardNavigation.TaskCell(e.taskId,r))}return n},fromDomElement:function(n){if(!t.config.keyboard_navigation_cells)return null;var i=t.locate(n);if(t.isTaskExists(i)){var r=0,a=e.locateAttribute(n,"data-column-index");return a&&(r=1*a.getAttribute("data-column-index")),new t.$keyboardNavigation.TaskCell(i,r)}return null},getNode:function(){if(t.isTaskExists(this.taskId)&&t.isTaskVisible(this.taskId)){if(t.config.show_grid){var e=t.$grid.querySelector(".gantt_row["+t.config.task_attribute+"='"+this.taskId+"']");return e?e.querySelector("[data-column-index='"+this.columnIndex+"']"):null}return t.getTaskNode(this.taskId)}},keys:{up:function(){var e=null,n=t.getPrev(this.taskId);e=t.isTaskExists(n)?new t.$keyboardNavigation.TaskCell(n,this.columnIndex):new t.$keyboardNavigation.HeaderCell(this.columnIndex),this.moveTo(e)},down:function(){var e=t.getNext(this.taskId);t.isTaskExists(e)&&this.moveTo(new t.$keyboardNavigation.TaskCell(e,this.columnIndex))},left:function(){this.columnIndex>0&&this.moveTo(new t.$keyboardNavigation.TaskCell(this.taskId,this.columnIndex-1))},right:function(){var e=t.getGridColumns();this.columnIndex-1},fallback:function(){if(!t.getVisibleTaskCount()){var e=new t.$keyboardNavigation.HeaderCell;return e.isValid()?e:null}var n=-1;if(t.getTaskByIndex(this.globalIndex-1))n=this.globalIndex-1;else if(t.getTaskByIndex(this.globalIndex+1))n=this.globalIndex+1;else for(var i=this.globalIndex;i>=0;){if(t.getTaskByIndex(i)){n=i;break}i--}if(n>-1)return new t.$keyboardNavigation.TaskRow(t.getTaskByIndex(n).id)},fromDomElement:function(e){if(t.config.keyboard_navigation_cells)return null;var n=t.locate(e);return t.isTaskExists(n)?new t.$keyboardNavigation.TaskRow(n):null},getNode:function(){if(t.isTaskExists(this.taskId)&&t.isTaskVisible(this.taskId))return t.config.show_grid?t.$grid.querySelector(".gantt_row["+t.config.task_attribute+"='"+this.taskId+"']"):t.getTaskNode(this.taskId)},focus:function(e){if(!e){var n,i,r=t.getTaskPosition(t.getTask(this.taskId)),a=t.getTaskHeight(this.taskId),o=t.getScrollState();n=t.$task?t.$task.offsetWidth:o.inner_width,i=t.$grid_data||t.$task_data?(t.$grid_data||t.$task_data).offsetHeight:o.inner_height,r.topo.y+i?t.scrollTo(null,r.top-5*a):t.config.scroll_on_click&&t.config.show_chart&&(r.left>o.x+n?t.scrollTo(r.left-t.config.task_scroll_offset):r.left+r.width=0&&!e[n];)n--;return e[n]?new t.$keyboardNavigation.HeaderCell(n):null},fromDomElement:function(n){var i=e.locateClassName(n,"gantt_grid_head_cell");if(i){for(var r=0;i&&i.previousSibling;)i=i.previousSibling,r+=1;return new t.$keyboardNavigation.HeaderCell(r)}return null},getNode:function(){return t.$grid_scale.childNodes[this.index]},keys:{left:function(){this.index>0&&this.moveTo(new t.$keyboardNavigation.HeaderCell(this.index-1))},right:function(){var e=t.getGridColumns();this.index=r.length-1){var c=r[0];if(c)return c.focus(),i.preventDefault(),!0}return!1}}()}},function(t,e){t.exports=function(t){t.$keyboardNavigation.EventHandler={_handlers:null,findHandler:function(e){this._handlers||(this._handlers={});var n=t.$keyboardNavigation.shortcuts.getHash(e);return this._handlers[n]},doAction:function(e,n){var i=this.findHandler(e);if(i){if(!1===t.$keyboardNavigation.facade.callEvent("onBeforeAction",[e,n]))return;i.call(this,n),n.preventDefault?n.preventDefault():n.returnValue=!1}},bind:function(e,n){this._handlers||(this._handlers={});for(var i=t.$keyboardNavigation.shortcuts,r=i.parse(e),a=0;a=96&&e.keyCode<=105&&(e.keyCode-=48);var n=String.fromCharCode(e.keyCode);return n&&(e.keyCode=n.toLowerCase().charCodeAt(0)),e},getHashFromEvent:function(t){return this.getHash(this.getCommandFromEvent(t))},getHash:function(t){var e=[];for(var n in t.modifiers)t.modifiers[n]&&e.push(n);return e.push(t.keyCode),e.join(this.junctionChar)},getExpressions:function(t){return t.split(this.junctionChar)},getWords:function(t){return t.split(this.combinationChar)},trim:function(t){return t.replace(/\s/g,"")},junctionChar:",",combinationChar:"+",commandKeys:{shift:16,alt:18,ctrl:17,meta:!0},specialKeys:{backspace:8,tab:9,enter:13,esc:27,space:32,up:38,down:40,left:37,right:39,home:36,end:35,pageup:33,pagedown:34,delete:46,insert:45,plus:107,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123}}}},function(t,e,n){t.exports=function(t){var e=n(4);!function(t){t.config.keyboard_navigation=!0,t.config.keyboard_navigation_cells=!1,t.$keyboardNavigation={},t._compose=function(){for(var t=Array.prototype.slice.call(arguments,0),e={},n=0;n=10){for(var t=e._trace.slice(e._trace.length-10),n=[],i=1;i75&&(i=0)),{x:e._scrollState.x+i,y:e._scrollState.y+r}},this._setScrollPosition=function(t,n){var i=e._gantt;requestAnimationFrame(function(){i.$ui.getView(t.$config.scrollX).scroll(n.x),i.$ui.getView(t.$config.scrollY).scroll(n.y)})},this._stopDrag=function(t){var n=e._gantt;if(e._trace=[],n.$root.classList.remove("gantt_noselect"),void 0!==e._originalReadonly&&(n.config.readonly=e._originalReadonly),void 0!==e._originAutoscroll&&(n.config.autoscroll=e._originAutoscroll),n.config.drag_timeline){var i=n.config.drag_timeline.useKey;if(i&&!0!==t[i])return}e._mouseDown=!1},this._startDrag=function(t){var n=e._gantt;e._originAutoscroll=n.config.autoscroll,n.config.autoscroll=!1,n.$root.classList.add("gantt_noselect"),e._originalReadonly=n.config.readonly,n.config.readonly=!0,e._trace=[],e._mouseDown=!0;var i=e._getScrollPosition(e._timeline),r=i.x,a=i.y;e._scrollState={x:r,y:a},e._startPoint={x:t.clientX,y:t.clientY},e._trace.push(e._startPoint)},this._gantt=t,this._domEvents=t._createDomEventScope(),this._trace=[]}return t.create=function(e){return new t(e)},t.prototype.destructor=function(){this._domEvents.detachAll()},t.prototype.attach=function(t){var e=this;this._timeline=t;var n=this._gantt;this._domEvents.attach(t.$task,"mousedown",function(t){if(n.config.drag_timeline){var i=n.config.drag_timeline,r=i.useKey,a=i.ignore;if(!1!==i.enabled){var o=".gantt_task_line, .gantt_task_link";void 0!==a&&(o=a instanceof Array?a.join(", "):a),o&&n.utils.dom.closest(t.target,o)||r&&!0!==t[r]||e._startDrag(t)}}}),this._domEvents.attach(document,"keydown",function(t){if(n.config.drag_timeline){var i=n.config.drag_timeline.useKey;i&&!0===t[i]&&e._applyDndReadyStyles()}}),this._domEvents.attach(document,"keyup",function(t){if(n.config.drag_timeline){var i=n.config.drag_timeline.useKey;i&&!1===t[i]&&(e._clearDndReadyStyles(),e._stopDrag(t))}}),this._domEvents.attach(document,"mouseup",function(t){e._stopDrag(t)}),this._domEvents.attach(n.$root,"mouseup",function(t){e._stopDrag(t)}),this._domEvents.attach(document,"mouseleave",function(t){e._stopDrag(t)}),this._domEvents.attach(n.$root,"mouseleave",function(t){e._stopDrag(t)}),this._domEvents.attach(n.$root,"mousemove",function(i){if(n.config.drag_timeline){var r=n.config.drag_timeline.useKey;if(!r||!0===i[r]){var a=e._gantt.ext.clickDrag,o=(e._gantt.config.click_drag||{}).useKey;if((!a||!o||r||!i[o])&&!0===e._mouseDown){e._trace.push({x:i.clientX,y:i.clientY});var s=e._countNewScrollPosition({x:i.clientX,y:i.clientY});e._setScrollPosition(t,s),e._scrollState=s,e._startPoint={x:i.clientX,y:i.clientY}}}}})},t}();e.EventsManager=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(251);e.default=function(t){t.ext||(t.ext={}),t.ext.dragTimeline={create:function(){return i.EventsManager.create(t)}},t.config.drag_timeline={enabled:!0}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(4),r=n(2),a=function(){function t(t,e,n){var a=this;this._el=document.createElement("div"),this.defaultRender=function(t,e){a._el||(a._el=document.createElement("div"));var n=a._el,i=Math.min(t.relative.top,e.relative.top),r=Math.max(t.relative.top,e.relative.top),o=Math.min(t.relative.left,e.relative.left),s=Math.max(t.relative.left,e.relative.left);if(a._singleRow){var l=a._getTaskPositionByTop(a._startPoint.relative.top);n.style.height=l.height+"px",n.style.top=l.top+"px"}else n.style.height=Math.abs(r-i)+"px",n.style.top=i+"px";return n.style.width=Math.abs(s-o)+"px",n.style.left=o+"px",n},this._gantt=e,this._view=n,this._viewPort=t.viewPort,this._el.classList.add(t.className),"function"==typeof t.callback&&(this._callback=t.callback),this.render=function(){var e;(e=t.render?t.render(a._startPoint,a._endPoint):a.defaultRender(a._startPoint,a._endPoint))!==a._el&&(a._el&&a._el.parentNode&&a._el.parentNode.removeChild(a._el),a._el=e),""!==t.className&&a._el.classList.add(t.className),a.draw()},r.isEventable(this._viewPort)||i(this._viewPort),this._singleRow=t.singleRow,this._useRequestAnimationFrame=t.useRequestAnimationFrame}return t.prototype.draw=function(){var t=this;if(this._useRequestAnimationFrame)return requestAnimationFrame(function(){t._viewPort.appendChild(t.getElement())});this._viewPort.appendChild(this.getElement())},t.prototype.clear=function(){var t=this;if(this._useRequestAnimationFrame)return requestAnimationFrame(function(){t._el.parentNode&&t._viewPort.removeChild(t._el)});this._el.parentNode&&this._viewPort.removeChild(this._el)},t.prototype.getElement=function(){return this._el},t.prototype.getViewPort=function(){return this._viewPort},t.prototype.setStart=function(t){var e=this._gantt;this._startPoint=t,this._startDate=e.dateFromPos(this._startPoint.relative.left),this._viewPort.callEvent("onBeforeDrag",[this._startPoint])},t.prototype.setEnd=function(t){var e=this._gantt;if(this._endPoint=t,this._singleRow){var n=this._getTaskPositionByTop(this._startPoint.relative.top);this._endPoint.relative.top=n.top}this._endDate=e.dateFromPos(this._endPoint.relative.left),this._startPoint.relative.left>this._endPoint.relative.left&&(this._positionPoint={relative:{left:this._endPoint.relative.left,top:this._positionPoint.relative.top},absolute:{left:this._endPoint.absolute.left,top:this._positionPoint.absolute.top}}),this._startPoint.relative.top>this._endPoint.relative.top&&(this._positionPoint={relative:{left:this._positionPoint.relative.left,top:this._endPoint.relative.top},absolute:{left:this._positionPoint.absolute.left,top:this._endPoint.absolute.top}}),this._viewPort.callEvent("onDrag",[this._startPoint,this._endPoint])},t.prototype.setPosition=function(t){this._positionPoint=t},t.prototype.dragEnd=function(t){var e,n=this._gantt;t.relative.left<0&&(t.relative.left=0),this._viewPort.callEvent("onBeforeDragEnd",[this._startPoint,t]),this.setEnd(t),this._endDate=this._endDate||n.getState().max_date,this._startDate.valueOf()>this._endDate.valueOf()&&(e=[this._endDate,this._startDate],this._startDate=e[0],this._endDate=e[1]),this.clear();var i=n.getTaskByTime(this._startDate,this._endDate),r=this._getTasksByTop(this._startPoint.relative.top,this._endPoint.relative.top);this._viewPort.callEvent("onDragEnd",[this._startPoint,this._endPoint]),this._callback&&this._callback(this._startPoint,this._endPoint,this._startDate,this._endDate,i,r)},t.prototype.getInBounds=function(){return this._singleRow},t.prototype._getTasksByTop=function(t,e){var n=this._gantt,i=t,r=e;t>e&&(i=e,r=t);for(var a=this._getTaskPositionByTop(i).index,o=this._getTaskPositionByTop(r).index,s=[],l=a;l<=o;l++){n.getTaskByIndex(l)&&s.push(n.getTaskByIndex(l))}return s},t.prototype._getTaskPositionByTop=function(t){var e=this._gantt,n=this._view,i=n.getItemIndexByTopPosition(t),r=e.getTaskByIndex(i);if(r){var a=n.getItemHeight(r.id);return{top:n.getItemTop(r.id)||0,height:a||0,index:i}}var o=n.getTotalHeight();return{top:t>o?o:0,height:e.config.row_height,index:t>o?e.getTaskCount():0}},t}();e.SelectedRegion=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),r=function(){function t(t){this._mouseDown=!1,this._gantt=t,this._domEvents=t._createDomEventScope()}return t.prototype.attach=function(t,e,n){var r=this,a=this._gantt,o=t.getViewPort();this._originPosition=window.getComputedStyle(o).display,this._restoreOriginPosition=function(){o.style.position=r._originPosition},"static"===this._originPosition&&(o.style.position="relative");var s=a.$services.getService("state");s.registerProvider("clickDrag",function(){return{autoscroll:!1}});var l=null;this._domEvents.attach(o,"mousedown",function(i){l=null;var o=".gantt_task_line, .gantt_task_link";void 0!==n&&(o=n instanceof Array?n.join(", "):n),o&&a.utils.dom.closest(i.target,o)||(s.registerProvider("clickDrag",function(){return{autoscroll:r._mouseDown}}),e&&!0!==i[e]||(l=r._getCoordinates(i,t)))});var c=i.getRootNode(a.$root)||document.body;this._domEvents.attach(c,"mouseup",function(n){if(l=null,(!e||!0===n[e])&&!0===r._mouseDown){r._mouseDown=!1;var i=r._getCoordinates(n,t);t.dragEnd(i)}}),this._domEvents.attach(o,"mousemove",function(n){if(!e||!0===n[e]){var i=r._gantt.ext.clickDrag,o=(r._gantt.config.drag_timeline||{}).useKey;if(!i||!o||e||!n[o]){var s=null;if(!r._mouseDown&&l)return s=r._getCoordinates(n,t),void(Math.abs(l.relative.left-s.relative.left)>5&&l&&(r._mouseDown=!0,t.setStart(a.copy(l)),t.setPosition(a.copy(l)),t.setEnd(a.copy(l)),l=null));!0===r._mouseDown&&(s=r._getCoordinates(n,t),t.setEnd(s),t.render())}}})},t.prototype.detach=function(){var t=this._gantt;this._domEvents.detachAll(),this._restoreOriginPosition&&this._restoreOriginPosition(),t.$services.getService("state").unregisterProvider("clickDrag")},t.prototype.destructor=function(){this.detach()},t.prototype._getCoordinates=function(t,e){var n=e.getViewPort(),i=n.getBoundingClientRect(),r=t.clientX,a=t.clientY;return{absolute:{left:r,top:a},relative:{left:r-i.left+n.scrollLeft,top:a-i.top+n.scrollTop}}},t}();e.EventsManager=r},function(t,e,n){"use strict";var i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,i=arguments.length;n= 0;\n}\n\nfunction hasHref(node) {\n var canHaveHref = {\n \"a\": true,\n \"area\": true\n };\n\n if (canHaveHref[node.nodeName.loLowerCase()]) {\n return !!node.getAttribute(\"href\");\n }\n\n return true;\n}\n\nfunction isEnabled(node) {\n var canDisable = {\n \"input\": true,\n \"select\": true,\n \"textarea\": true,\n \"button\": true,\n \"object\": true\n };\n\n if (canDisable[node.nodeName.toLowerCase()]) {\n return !node.hasAttribute(\"disabled\");\n }\n\n return true;\n}\n\nfunction getFocusableNodes(root) {\n var nodes = root.querySelectorAll([\"a[href]\", \"area[href]\", \"input\", \"select\", \"textarea\", \"button\", \"iframe\", \"object\", \"embed\", \"[tabindex]\", \"[contenteditable]\"].join(\", \"));\n var nodesArray = Array.prototype.slice.call(nodes, 0);\n\n for (var i = 0; i < nodesArray.length; i++) {\n nodesArray[i].$position = i; // we remember original nodes order, \n // so when we sort them by tabindex we ensure order of nodes with same tabindex is preserved, \n // since some browsers do unstable sort\n } // use tabindex to sort focusable nodes\n\n\n nodesArray.sort(function (a, b) {\n if (a.tabIndex === 0 && b.tabIndex !== 0) {\n return 1;\n }\n\n if (a.tabIndex !== 0 && b.tabIndex === 0) {\n return -1;\n }\n\n if (a.tabIndex === b.tabIndex) {\n // ensure we do stable sort\n return a.$position - b.$position;\n }\n\n if (a.tabIndex < b.tabIndex) {\n return -1;\n }\n\n return 1;\n });\n\n for (var i = 0; i < nodesArray.length; i++) {\n var node = nodesArray[i];\n var isValid = (hasNonNegativeTabIndex(node) || isEnabled(node) || hasHref(node)) && isVisible(node);\n\n if (!isValid) {\n nodesArray.splice(i, 1);\n i--;\n }\n }\n\n return nodesArray;\n}\n\nfunction getScrollSize() {\n var div = document.createElement(\"div\");\n div.style.cssText = \"visibility:hidden;position:absolute;left:-1000px;width:100px;padding:0px;margin:0px;height:110px;min-height:100px;overflow-y:scroll;\";\n document.body.appendChild(div);\n var width = div.offsetWidth - div.clientWidth;\n document.body.removeChild(div);\n return width;\n}\n\nfunction getClassName(node) {\n if (!node) return \"\";\n var className = node.className || \"\";\n if (className.baseVal) //'className' exist but not a string - IE svg element in DOM\n className = className.baseVal;\n if (!className.indexOf) className = \"\";\n return _trimString(className);\n}\n\nfunction addClassName(node, className) {\n if (className && node.className.indexOf(className) === -1) {\n node.className += \" \" + className;\n }\n}\n\nfunction removeClassName(node, name) {\n name = name.split(\" \");\n\n for (var i = 0; i < name.length; i++) {\n var regEx = new RegExp(\"\\\\s?\\\\b\" + name[i] + \"\\\\b(?![-_.])\", \"\");\n node.className = node.className.replace(regEx, \"\");\n }\n}\n\nfunction hasClass(element, className) {\n if ('classList' in element) {\n return element.classList.contains(className);\n } else {\n return new RegExp(\"\\\\b\" + className + \"\\\\b\").test(element.className);\n }\n}\n\nfunction toNode(node) {\n if (typeof node === \"string\") {\n return document.getElementById(node) || document.querySelector(node) || document.body;\n }\n\n return node || document.body;\n}\n\nvar _slave;\n\nfunction insert(node, newone) {\n if (!_slave) {\n _slave = document.createElement(\"div\");\n }\n\n _slave.innerHTML = newone;\n var child = _slave.firstChild;\n node.appendChild(child);\n return child;\n}\n\nfunction remove(node) {\n if (node && node.parentNode) {\n node.parentNode.removeChild(node);\n }\n}\n\nfunction getChildren(node, css) {\n var ch = node.childNodes;\n var len = ch.length;\n var out = [];\n\n for (var i = 0; i < len; i++) {\n var obj = ch[i];\n\n if (obj.className && obj.className.indexOf(css) !== -1) {\n out.push(obj);\n }\n }\n\n return out;\n}\n\nfunction getTargetNode(e) {\n var trg;\n if (e.tagName) trg = e;else {\n e = e || window.event;\n trg = e.target || e.srcElement;\n\n if (trg.shadowRoot && e.composedPath) {\n trg = e.composedPath()[0];\n }\n }\n return trg;\n}\n\nfunction locateAttribute(e, attribute) {\n if (!attribute) return;\n var trg = getTargetNode(e);\n\n while (trg) {\n if (trg.getAttribute) {\n //text nodes has not getAttribute\n var test = trg.getAttribute(attribute);\n if (test) return trg;\n }\n\n trg = trg.parentNode;\n }\n\n return null;\n}\n\nfunction _trimString(str) {\n var func = String.prototype.trim || function () {\n return this.replace(/^\\s+|\\s+$/g, \"\");\n };\n\n return func.apply(str);\n}\n\nfunction locateClassName(e, classname, strict) {\n var trg = getTargetNode(e);\n var css = \"\";\n if (strict === undefined) strict = true;\n\n while (trg) {\n css = getClassName(trg);\n\n if (css) {\n var ind = css.indexOf(classname);\n\n if (ind >= 0) {\n if (!strict) return trg; //check that we have exact match\n\n var left = ind === 0 || !_trimString(css.charAt(ind - 1));\n var right = ind + classname.length >= css.length || !_trimString(css.charAt(ind + classname.length));\n if (left && right) return trg;\n }\n }\n\n trg = trg.parentNode;\n }\n\n return null;\n}\n/*\r\nevent position relatively to DOM element\r\n */\n\n\nfunction getRelativeEventPosition(ev, node) {\n var d = document.documentElement;\n var box = elementPosition(node);\n return {\n x: ev.clientX + d.scrollLeft - d.clientLeft - box.x + node.scrollLeft,\n y: ev.clientY + d.scrollTop - d.clientTop - box.y + node.scrollTop\n };\n}\n\nfunction isChildOf(child, parent) {\n if (!child || !parent) {\n return false;\n }\n\n while (child && child != parent) {\n child = child.parentNode;\n }\n\n return child === parent;\n}\n\nfunction closest(element, selector) {\n if (element.closest) {\n return element.closest(selector);\n } else if (element.matches || element.msMatchesSelector || element.webkitMatchesSelector) {\n var el = element;\n if (!document.documentElement.contains(el)) return null;\n\n do {\n var method = el.matches || el.msMatchesSelector || el.webkitMatchesSelector;\n if (method.call(el, selector)) return el;\n el = el.parentElement || el.parentNode;\n } while (el !== null && el.nodeType === 1);\n\n return null;\n } else {\n // eslint-disable-next-line no-console\n console.error(\"Your browser is not supported\");\n return null;\n }\n}\n\nfunction isShadowDomSupported() {\n return document.head.createShadowRoot || document.head.attachShadow;\n}\n/**\r\n * Returns element that has the browser focus, or null if no element has focus.\r\n * Works with shadow DOM, so it's prefereed to use this function instead of document.activeElement directly.\r\n * @returns HTMLElement\r\n */\n\n\nfunction getActiveElement() {\n var activeElement = document.activeElement;\n\n if (activeElement.shadowRoot) {\n activeElement = activeElement.shadowRoot.activeElement;\n }\n\n if (activeElement === document.body && document.getSelection) {\n activeElement = document.getSelection().focusNode || document.body;\n }\n\n return activeElement;\n}\n/**\r\n * Returns document.body or the host node of the ShadowRoot, if the element is attached to ShadowDom\r\n * @param {HTMLElement} element \r\n * @returns HTMLElement\r\n */\n\n\nfunction getRootNode(element) {\n if (!element) {\n return document.body;\n }\n\n if (!isShadowDomSupported()) {\n return document.body;\n }\n\n while (element.parentNode && (element = element.parentNode)) {\n if (element instanceof ShadowRoot) {\n return element.host;\n }\n }\n\n return document.body;\n}\n\nfunction hasShadowParent(element) {\n return !!getRootNode(element);\n}\n\nmodule.exports = {\n getNodePosition: elementPosition,\n getFocusableNodes: getFocusableNodes,\n getScrollSize: getScrollSize,\n getClassName: getClassName,\n addClassName: addClassName,\n removeClassName: removeClassName,\n insertNode: insert,\n removeNode: remove,\n getChildNodes: getChildren,\n toNode: toNode,\n locateClassName: locateClassName,\n locateAttribute: locateAttribute,\n getTargetNode: getTargetNode,\n getRelativeEventPosition: getRelativeEventPosition,\n isChildOf: isChildOf,\n hasClass: hasClass,\n closest: closest,\n getRootNode: getRootNode,\n hasShadowParent: hasShadowParent,\n isShadowDomSupported: isShadowDomSupported,\n getActiveElement: getActiveElement\n};","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar units = {\n \"second\": 1,\n \"minute\": 60,\n \"hour\": 60 * 60,\n \"day\": 60 * 60 * 24,\n \"week\": 60 * 60 * 24 * 7,\n \"month\": 60 * 60 * 24 * 30,\n \"quarter\": 60 * 60 * 24 * 30 * 3,\n \"year\": 60 * 60 * 24 * 365\n};\n\nfunction getSecondsInUnit(unit) {\n return units[unit] || units.hour;\n}\n\nfunction forEach(arr, callback) {\n if (arr.forEach) {\n arr.forEach(callback);\n } else {\n var workArray = arr.slice();\n\n for (var i = 0; i < workArray.length; i++) {\n callback(workArray[i], i);\n }\n }\n}\n\nfunction arrayMap(arr, callback) {\n if (arr.map) {\n return arr.map(callback);\n } else {\n var workArray = arr.slice();\n var resArray = [];\n\n for (var i = 0; i < workArray.length; i++) {\n resArray.push(callback(workArray[i], i));\n }\n\n return resArray;\n }\n}\n\nfunction arrayFind(arr, callback) {\n if (arr.find) {\n return arr.find(callback);\n } else {\n for (var i = 0; i < arr.length; i++) {\n if (callback(arr[i], i)) {\n return arr[i];\n }\n }\n }\n}\n\nfunction arrayIncludes(arr, item) {\n if (arr.includes) {\n return arr.includes(item);\n } else {\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] === item) {\n return true;\n }\n }\n\n return false;\n }\n} // iframe-safe array type check instead of using instanceof\n\n\nfunction isArray(obj) {\n if (Array.isArray) {\n return Array.isArray(obj);\n } else {\n // close enough\n return obj && obj.length !== undefined && obj.pop && obj.push;\n }\n} // non-primitive string object, e.g. new String(\"abc\")\n\n\nfunction isStringObject(obj) {\n return obj && _typeof(obj) === \"object\" && Function.prototype.toString.call(obj.constructor) === \"function String() { [native code] }\";\n} // non-primitive number object, e.g. new Number(5)\n\n\nfunction isNumberObject(obj) {\n return obj && _typeof(obj) === \"object\" && Function.prototype.toString.call(obj.constructor) === \"function Number() { [native code] }\";\n} // non-primitive number object, e.g. new Boolean(true)\n\n\nfunction isBooleanObject(obj) {\n return obj && _typeof(obj) === \"object\" && Function.prototype.toString.call(obj.constructor) === \"function Boolean() { [native code] }\";\n}\n\nfunction isDate(obj) {\n if (obj && _typeof(obj) === \"object\") {\n return !!(obj.getFullYear && obj.getMonth && obj.getDate);\n } else {\n return false;\n }\n}\n\nfunction isValidDate(obj) {\n return isDate(obj) && !isNaN(obj.getTime());\n}\n\nfunction arrayFilter(arr, callback) {\n var result = [];\n\n if (arr.filter) {\n return arr.filter(callback);\n } else {\n for (var i = 0; i < arr.length; i++) {\n if (callback(arr[i], i)) {\n result[result.length] = arr[i];\n }\n }\n\n return result;\n }\n}\n\nfunction hashToArray(hash) {\n var result = [];\n\n for (var key in hash) {\n if (hash.hasOwnProperty(key)) {\n result.push(hash[key]);\n }\n }\n\n return result;\n}\n\nfunction arraySome(arr, callback) {\n if (arr.length === 0) return false;\n\n for (var i = 0; i < arr.length; i++) {\n if (callback(arr[i], i, arr)) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction arrayDifference(arr, callback) {\n return arrayFilter(arr, function (item, i) {\n return !callback(item, i);\n });\n}\n\nfunction throttle(callback, timeout) {\n var wait = false;\n return function () {\n if (!wait) {\n callback.apply(null, arguments);\n wait = true;\n setTimeout(function () {\n wait = false;\n }, timeout);\n }\n };\n}\n\nfunction delay(callback, timeout) {\n var timer;\n\n var result = function result() {\n result.$cancelTimeout();\n result.$pending = true;\n var args = Array.prototype.slice.call(arguments);\n timer = setTimeout(function () {\n callback.apply(this, args);\n result.$pending = false;\n }, timeout);\n };\n\n result.$pending = false;\n\n result.$cancelTimeout = function () {\n clearTimeout(timer);\n result.$pending = false;\n };\n\n result.$execute = function () {\n var args = Array.prototype.slice.call(arguments);\n callback.apply(this, args);\n result.$cancelTimeout();\n };\n\n return result;\n}\n\nfunction sortArrayOfHash(arr, field, desc) {\n var compare = function compare(a, b) {\n return a < b;\n };\n\n arr.sort(function (a, b) {\n if (a[field] === b[field]) return 0;\n return desc ? compare(a[field], b[field]) : compare(b[field], a[field]);\n });\n}\n\nfunction objectKeys(obj) {\n if (Object.keys) {\n return Object.keys(obj);\n }\n\n var result = [];\n var key;\n\n for (key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n result.push(key);\n }\n }\n\n return result;\n}\n\nfunction isEventable(obj) {\n return obj.attachEvent && obj.detachEvent;\n} //GS-1090: A task should be able to have the id = 0\n\n\nfunction replaceValidZeroId(id, rootId) {\n if (checkZeroId(id) && !checkZeroId(rootId)) {\n id = \"0\";\n }\n\n return id;\n}\n\nfunction checkZeroId(id) {\n if (id === 0) {\n return true;\n }\n\n return false;\n}\n\nfunction findBinary(array, target) {\n // modified binary search, target value not exactly match array elements, looking for closest one\n var low = 0,\n high = array.length - 1,\n i,\n item,\n prev;\n\n while (low <= high) {\n i = Math.floor((low + high) / 2);\n item = +array[i];\n prev = +array[i - 1];\n\n if (item < target) {\n low = i + 1;\n continue;\n }\n\n if (item > target) {\n if (!(!isNaN(prev) && prev < target)) {\n high = i - 1;\n continue;\n } else {\n // if target is between 'i' and 'i-1' return 'i - 1'\n return i - 1;\n }\n }\n\n while (+array[i] == +array[i + 1]) {\n i++;\n }\n\n return i;\n }\n\n return array.length - 1;\n}\n\nmodule.exports = {\n getSecondsInUnit: getSecondsInUnit,\n forEach: forEach,\n arrayMap: arrayMap,\n arrayIncludes: arrayIncludes,\n arrayFind: arrayFind,\n arrayFilter: arrayFilter,\n arrayDifference: arrayDifference,\n arraySome: arraySome,\n hashToArray: hashToArray,\n sortArrayOfHash: sortArrayOfHash,\n throttle: throttle,\n isArray: isArray,\n isDate: isDate,\n isValidDate: isValidDate,\n isStringObject: isStringObject,\n isNumberObject: isNumberObject,\n isBooleanObject: isBooleanObject,\n delay: delay,\n objectKeys: objectKeys,\n isEventable: isEventable,\n replaceValidZeroId: replaceValidZeroId,\n checkZeroId: checkZeroId,\n findBinary: findBinary\n};","module.exports = function (d, b) {\n for (var p in b) {\n if (b.hasOwnProperty(p)) d[p] = b[p];\n }\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};","var EventHost = function EventHost() {\n this._silent_mode = false;\n this.listeners = {};\n};\n\nEventHost.prototype = {\n _silentStart: function _silentStart() {\n this._silent_mode = true;\n },\n _silentEnd: function _silentEnd() {\n this._silent_mode = false;\n }\n};\n\nvar createEventStorage = function createEventStorage(obj) {\n var handlers = {};\n var index = 0;\n\n var eventStorage = function eventStorage() {\n var combinedResult = true;\n\n for (var i in handlers) {\n var handlerResult = handlers[i].apply(obj, arguments);\n combinedResult = combinedResult && handlerResult;\n }\n\n return combinedResult;\n };\n\n eventStorage.addEvent = function (handler, settings) {\n if (typeof handler == \"function\") {\n var handlerId;\n\n if (settings && settings.id) {\n handlerId = settings.id;\n } else {\n handlerId = index;\n index++;\n }\n\n if (settings && settings.once) {\n var originalHandler = handler;\n\n handler = function handler() {\n originalHandler();\n eventStorage.removeEvent(handlerId);\n };\n }\n\n handlers[handlerId] = handler;\n return handlerId;\n }\n\n return false;\n };\n\n eventStorage.removeEvent = function (id) {\n delete handlers[id];\n };\n\n eventStorage.clear = function () {\n handlers = {};\n };\n\n return eventStorage;\n};\n\nfunction makeEventable(obj) {\n var eventHost = new EventHost();\n\n obj.attachEvent = function (eventName, handler, settings) {\n eventName = 'ev_' + eventName.toLowerCase();\n\n if (!eventHost.listeners[eventName]) {\n eventHost.listeners[eventName] = createEventStorage(this);\n }\n\n if (settings && settings.thisObject) {\n handler = handler.bind(settings.thisObject);\n }\n\n var innerId = eventHost.listeners[eventName].addEvent(handler, settings);\n var handlerId = eventName + ':' + innerId; //return ID (ev_eventname:1)\n\n if (settings && settings.id) {\n handlerId = settings.id;\n }\n\n return handlerId;\n };\n\n obj.attachAll = function (callback) {\n this.attachEvent('listen_all', callback);\n };\n\n obj.callEvent = function (name, eventArguments) {\n if (eventHost._silent_mode) return true;\n var handlerName = 'ev_' + name.toLowerCase();\n var listeners = eventHost.listeners;\n\n if (listeners['ev_listen_all']) {\n listeners['ev_listen_all'].apply(this, [name].concat(eventArguments));\n }\n\n if (listeners[handlerName]) return listeners[handlerName].apply(this, eventArguments);\n return true;\n };\n\n obj.checkEvent = function (name) {\n var listeners = eventHost.listeners;\n return !!listeners['ev_' + name.toLowerCase()];\n };\n\n obj.detachEvent = function (id) {\n if (id) {\n var listeners = eventHost.listeners;\n\n for (var i in listeners) {\n listeners[i].removeEvent(id); //remove event\n }\n\n var list = id.split(':'); //get EventName and ID\n\n var listeners = eventHost.listeners;\n\n if (list.length === 2) {\n var eventName = list[0];\n var eventId = list[1];\n\n if (listeners[eventName]) {\n listeners[eventName].removeEvent(eventId); //remove event\n }\n }\n }\n };\n\n obj.detachAllEvents = function () {\n for (var name in eventHost.listeners) {\n eventHost.listeners[name].clear();\n }\n };\n}\n\nmodule.exports = makeEventable;","module.exports = function getVisibleTasksRange(gantt, view, config, datastore, viewport) {\n var buffer = 1;\n var start = view.getItemIndexByTopPosition(viewport.y) || 0;\n var end = view.getItemIndexByTopPosition(viewport.y_end) || datastore.count();\n var indexStart = Math.max(0, start - buffer);\n var indexEnd = Math.min(datastore.count(), end + buffer);\n return {\n start: indexStart,\n end: indexEnd\n };\n};","function dummy() {\n // eslint-disable-next-line\n console.log(\"Method is not implemented.\");\n}\n\nfunction BaseControl() {} // base methods will be runned in gantt context\n\n\nBaseControl.prototype.render = dummy; // arguments: sns\n\nBaseControl.prototype.set_value = dummy; // arguments: node, value, ev, sns(config)\n\nBaseControl.prototype.get_value = dummy; // arguments node, ev, sns(config)\n\nBaseControl.prototype.focus = dummy; // arguments: node\n\nmodule.exports = function (gantt) {\n // we could send current instance of gantt to module\n return BaseControl;\n};","module.exports = function (gantt) {\n var BaseEditor = function BaseEditor() {};\n\n BaseEditor.prototype = {\n show: function show(id, column, config, placeholder) {},\n hide: function hide() {},\n set_value: function set_value(value, id, column, node) {\n this.get_input(node).value = value;\n },\n get_value: function get_value(id, column, node) {\n return this.get_input(node).value || \"\";\n },\n is_changed: function is_changed(value, id, column, node) {\n var currentValue = this.get_value(id, column, node);\n\n if (currentValue && value && currentValue.valueOf && value.valueOf) {\n return currentValue.valueOf() != value.valueOf();\n } else {\n return currentValue != value;\n }\n },\n is_valid: function is_valid(value, id, column, node) {\n return true;\n },\n save: function save(id, column, node) {},\n get_input: function get_input(node) {\n return node.querySelector(\"input\");\n },\n focus: function focus(node) {\n var input = this.get_input(node);\n\n if (!input) {\n return;\n }\n\n if (input.focus) {\n input.focus();\n }\n\n if (input.select) {\n input.select();\n }\n }\n };\n return BaseEditor;\n};","/* eslint-disable no-restricted-globals */\nvar isWindowAwailable = typeof window !== \"undefined\";\n/* eslint-enable no-restricted-globals */\n\nvar env = {\n isIE: isWindowAwailable && (navigator.userAgent.indexOf(\"MSIE\") >= 0 || navigator.userAgent.indexOf(\"Trident\") >= 0),\n isIE6: isWindowAwailable && !XMLHttpRequest && navigator.userAgent.indexOf(\"MSIE\") >= 0,\n isIE7: isWindowAwailable && navigator.userAgent.indexOf(\"MSIE 7.0\") >= 0 && navigator.userAgent.indexOf(\"Trident\") < 0,\n isIE8: isWindowAwailable && navigator.userAgent.indexOf(\"MSIE 8.0\") >= 0 && navigator.userAgent.indexOf(\"Trident\") >= 0,\n isOpera: isWindowAwailable && navigator.userAgent.indexOf(\"Opera\") >= 0,\n isChrome: isWindowAwailable && navigator.userAgent.indexOf(\"Chrome\") >= 0,\n isKHTML: isWindowAwailable && (navigator.userAgent.indexOf(\"Safari\") >= 0 || navigator.userAgent.indexOf(\"Konqueror\") >= 0),\n isFF: isWindowAwailable && navigator.userAgent.indexOf(\"Firefox\") >= 0,\n isIPad: isWindowAwailable && navigator.userAgent.search(/iPad/gi) >= 0,\n isEdge: isWindowAwailable && navigator.userAgent.indexOf(\"Edge\") != -1,\n isNode: !isWindowAwailable || typeof navigator == \"undefined\"\n};\nmodule.exports = env;","var utils = require(\"../../../utils/utils\"),\n eventable = require(\"../../../utils/eventable\"),\n domHelpers = require(\"../utils/dom_helpers\");\n\nvar Cell = function () {\n \"use strict\";\n\n function Cell(parent, config, factory, gantt) {\n if (parent) {\n this.$container = domHelpers.toNode(parent);\n this.$parent = parent;\n } // save config\n\n\n this.$config = utils.mixin(config, {\n headerHeight: 33\n });\n this.$gantt = gantt;\n this.$domEvents = gantt._createDomEventScope(); // set id\n\n this.$id = config.id || \"c\" + utils.uid();\n this.$name = \"cell\";\n this.$factory = factory;\n eventable(this);\n }\n\n Cell.prototype.destructor = function () {\n this.$parent = this.$container = this.$view = null;\n var mouse = this.$gantt.$services.getService(\"mouseEvents\");\n mouse.detach(\"click\", \"gantt_header_arrow\", this._headerClickHandler);\n this.$domEvents.detachAll();\n this.callEvent(\"onDestroy\", []);\n this.detachAllEvents();\n };\n\n Cell.prototype.cell = function (id) {\n return null;\n };\n\n Cell.prototype.scrollTo = function (left, top) {\n //GS-333 Add a way to scroll the HTML views:\n var cell = this.$view;\n if (this.$config.html) cell = this.$view.firstChild;\n\n if (left * 1 == left) {\n cell.scrollLeft = left;\n }\n\n if (top * 1 == top) {\n cell.scrollTop = top;\n }\n };\n\n Cell.prototype.clear = function () {\n this.getNode().innerHTML = \"\";\n this.getNode().className = \"gantt_layout_content\";\n this.getNode().style.padding = \"0\";\n };\n\n Cell.prototype.resize = function (_final) {\n if (this.$parent) {\n return this.$parent.resize(_final);\n }\n\n if (_final === false) {\n this.$preResize = true;\n }\n\n var topCont = this.$container;\n var x = topCont.offsetWidth;\n var y = topCont.offsetHeight;\n var topSize = this.getSize();\n\n if (topCont === document.body) {\n x = document.body.offsetWidth;\n y = document.body.offsetHeight;\n }\n\n if (x < topSize.minWidth) {\n x = topSize.minWidth;\n }\n\n if (x > topSize.maxWidth) {\n x = topSize.maxWidth;\n }\n\n if (y < topSize.minHeight) {\n y = topSize.minHeight;\n }\n\n if (y > topSize.maxHeight) {\n y = topSize.maxHeight;\n }\n\n this.setSize(x, y);\n\n if (!this.$preResize) {//\tself.callEvent(\"onResize\", [x, y]);\n }\n\n this.$preResize = false;\n };\n\n Cell.prototype.hide = function () {\n this._hide(true);\n\n this.resize();\n };\n\n Cell.prototype.show = function (force) {\n this._hide(false);\n\n if (force && this.$parent) {\n this.$parent.show();\n }\n\n this.resize();\n };\n\n Cell.prototype._hide = function (mode) {\n if (mode === true && this.$view.parentNode) {\n this.$view.parentNode.removeChild(this.$view);\n } else if (mode === false && !this.$view.parentNode) {\n var index = this.$parent.cellIndex(this.$id);\n this.$parent.moveView(this, index);\n }\n\n this.$config.hidden = mode;\n };\n\n Cell.prototype.$toHTML = function (content, css) {\n if (content === void 0) {\n content = \"\";\n }\n\n css = [css || \"\", this.$config.css || \"\"].join(\" \");\n var obj = this.$config;\n var header = \"\";\n\n if (obj.raw) {\n content = typeof obj.raw === \"string\" ? obj.raw : \"\";\n } else {\n if (!content) {\n content = \"
\" + (obj.html || \"\") + \"
\";\n }\n\n if (obj.header) {\n var collapseIcon = obj.canCollapse ? \"
\" : \"\";\n header = \"
\" + collapseIcon + \"
\" + obj.header + \"
\";\n }\n }\n\n return \"
\" + header + content + \"
\";\n };\n\n Cell.prototype.$fill = function (node, parent) {\n this.$view = node;\n this.$parent = parent;\n this.init();\n };\n\n Cell.prototype.getNode = function () {\n return this.$view.querySelector(\"gantt_layout_cell\") || this.$view;\n };\n\n Cell.prototype.init = function () {\n // [NOT-GOOD] code is executed for each component, while it still has only one handler, it is no good\n var self = this;\n\n this._headerClickHandler = function (e) {\n var cellId = domHelpers.locateAttribute(e, \"data-cell-id\");\n\n if (cellId == self.$id) {\n self.toggle();\n }\n };\n\n var mouse = this.$gantt.$services.getService(\"mouseEvents\");\n mouse.delegate(\"click\", \"gantt_header_arrow\", this._headerClickHandler);\n this.callEvent(\"onReady\", []);\n };\n\n Cell.prototype.toggle = function () {\n this.$config.collapsed = !this.$config.collapsed;\n this.resize();\n };\n\n Cell.prototype.getSize = function () {\n var size = {\n height: this.$config.height || 0,\n width: this.$config.width || 0,\n gravity: this.$config.gravity || 1,\n minHeight: this.$config.minHeight || 0,\n minWidth: this.$config.minWidth || 0,\n maxHeight: this.$config.maxHeight || 100000000000,\n maxWidth: this.$config.maxWidth || 100000000000\n };\n\n if (this.$config.collapsed) {\n var mode = this.$config.mode === \"x\";\n size[mode ? \"width\" : \"height\"] = size[mode ? \"maxWidth\" : \"maxHeight\"] = this.$config.headerHeight;\n }\n\n return size;\n };\n\n Cell.prototype.getContentSize = function () {\n var width = this.$lastSize.contentX;\n\n if (width !== width * 1) {\n width = this.$lastSize.width;\n }\n\n var height = this.$lastSize.contentY;\n\n if (height !== height * 1) {\n height = this.$lastSize.height;\n }\n\n return {\n width: width,\n height: height\n };\n };\n\n Cell.prototype._getBorderSizes = function () {\n var borders = {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n horizontal: 0,\n vertical: 0\n };\n\n if (this._currentBorders) {\n if (this._currentBorders[this._borders.left]) {\n borders.left = 1;\n borders.horizontal++;\n }\n\n if (this._currentBorders[this._borders.right]) {\n borders.right = 1;\n borders.horizontal++;\n }\n\n if (this._currentBorders[this._borders.top]) {\n borders.top = 1;\n borders.vertical++;\n }\n\n if (this._currentBorders[this._borders.bottom]) {\n borders.bottom = 1;\n borders.vertical++;\n }\n }\n\n return borders;\n };\n\n Cell.prototype.setSize = function (x, y) {\n this.$view.style.width = x + \"px\";\n this.$view.style.height = y + \"px\";\n\n var borders = this._getBorderSizes();\n\n var contentY = y - borders.vertical;\n var contentX = x - borders.horizontal;\n this.$lastSize = {\n x: x,\n y: y,\n contentX: contentX,\n contentY: contentY\n };\n\n if (this.$config.header) {\n this._sizeHeader();\n } else {\n this._sizeContent();\n }\n };\n\n Cell.prototype._borders = {\n \"left\": \"gantt_layout_cell_border_left\",\n \"right\": \"gantt_layout_cell_border_right\",\n \"top\": \"gantt_layout_cell_border_top\",\n \"bottom\": \"gantt_layout_cell_border_bottom\"\n };\n\n Cell.prototype._setBorders = function (css, view) {\n if (!view) {\n view = this;\n }\n\n var node = view.$view;\n\n for (var i in this._borders) {\n domHelpers.removeClassName(node, this._borders[i]);\n }\n\n if (typeof css == \"string\") {\n css = [css];\n }\n\n var cssHash = {};\n\n for (var i = 0; i < css.length; i++) {\n domHelpers.addClassName(node, css[i]);\n cssHash[css[i]] = true;\n }\n\n view._currentBorders = cssHash;\n };\n\n Cell.prototype._sizeContent = function () {\n var content = this.$view.childNodes[0];\n\n if (content && content.className == \"gantt_layout_content\") {\n content.style.height = this.$lastSize.contentY + \"px\";\n }\n };\n\n Cell.prototype._sizeHeader = function () {\n var size = this.$lastSize;\n size.contentY -= this.$config.headerHeight;\n var header = this.$view.childNodes[0];\n var content = this.$view.childNodes[1];\n var xLayout = this.$config.mode === \"x\";\n\n if (this.$config.collapsed) {\n content.style.display = \"none\";\n\n if (xLayout) {\n header.className = \"gantt_layout_header collapsed_x\";\n header.style.width = size.y + \"px\";\n var d = Math.floor(size.y / 2 - size.x / 2);\n header.style.transform = \"rotate(90deg) translate(\" + d + \"px, \" + d + \"px)\";\n content.style.display = \"none\";\n } else {\n header.className = \"gantt_layout_header collapsed_y\";\n }\n } else {\n if (xLayout) {\n header.className = \"gantt_layout_header\";\n } else {\n header.className = \"gantt_layout_header vertical\";\n }\n\n header.style.width = 'auto';\n header.style.transform = '';\n content.style.display = \"\";\n content.style.height = size.contentY + \"px\";\n }\n\n header.style.height = this.$config.headerHeight + \"px\";\n };\n\n return Cell;\n}();\n\nmodule.exports = Cell;","var utils = require(\"./env\");\n\nmodule.exports = function (gantt) {\n return utils.isNode || !gantt.$root;\n};","/**\r\n * Check the over task or draggble task is placeholder task\r\n */\nmodule.exports = function isPlaceholderTask(id, gantt, store, config) {\n // return false;\n var config = gantt ? gantt.config : config;\n\n if (config && config.placeholder_task) {\n if (store.exists(id)) {\n var item = store.getItem(id);\n return item.type === config.types.placeholder;\n }\n }\n\n return false;\n};","var __extends = require(\"../../../../utils/extends\");\n\nvar htmlHelpers = require(\"../../utils/html_helpers\");\n\nmodule.exports = function (gantt) {\n var _super = require(\"./base_control\")(gantt);\n\n function SelectControl() {\n var self = _super.apply(this, arguments) || this;\n return self;\n }\n\n __extends(SelectControl, _super);\n\n SelectControl.prototype.render = function (sns) {\n var height = (sns.height || \"23\") + \"px\";\n var html = \"
\";\n html += htmlHelpers.getHtmlSelect(sns.options, [{\n key: \"style\",\n value: \"width:100%;\"\n }]);\n html += \"
\";\n return html;\n };\n\n SelectControl.prototype.set_value = function (node, value, ev, sns) {\n var select = node.firstChild;\n\n if (!select._dhx_onchange && sns.onchange) {\n select.onchange = sns.onchange;\n select._dhx_onchange = true;\n }\n\n if (typeof value === \"undefined\") value = (select.options[0] || {}).value;\n select.value = value || \"\";\n };\n\n SelectControl.prototype.get_value = function (node) {\n return node.firstChild.value;\n };\n\n SelectControl.prototype.focus = function (node) {\n var a = node.firstChild;\n\n gantt._focus(a, true);\n };\n\n return SelectControl;\n};","// optimized checker for task bars smart rendering\n// first check the vertical position since it's easier to calculate\nmodule.exports = function isBarInViewport(item, viewport, view, config, gantt) {\n if (!item.start_date || !item.end_date) {\n return null;\n }\n\n var top = view.getItemTop(item.id);\n var height = view.getItemHeight(item.id);\n\n if (top > viewport.y_end || top + height < viewport.y) {\n return false;\n }\n\n var padding = 200;\n var startCoord = view.posFromDate(item.start_date);\n var endCoord = view.posFromDate(item.end_date);\n var left = Math.min(startCoord, endCoord) - padding;\n var right = Math.max(startCoord, endCoord) + padding;\n\n if (left > viewport.x_end || right < viewport.x) {\n return false;\n }\n\n return true;\n};","module.exports = function (gantt) {\n return gantt.config.smart_rendering && gantt._smart_render;\n};","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar g; // This works in non-strict mode\n\ng = function () {\n return this;\n}();\n\ntry {\n // This works if eval is allowed (see CSP)\n g = g || Function(\"return this\")() || (1, eval)(\"this\");\n} catch (e) {\n // This works if the window reference is available\n if ((typeof window === \"undefined\" ? \"undefined\" : _typeof(window)) === \"object\") g = window;\n} // g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\n\nmodule.exports = g;","/* eslint-disable no-restricted-globals */\nvar globalScope;\n\nif (typeof window !== \"undefined\") {\n globalScope = window;\n} else {\n globalScope = global;\n}\n/* eslint-enable no-restricted-globals */\n\n\nmodule.exports = globalScope;","/**\r\n * The state object for order branch drag and drop\r\n */\nvar utils = require(\"../../../../utils/utils\");\n\nmodule.exports = {\n createDropTargetObject: function createDropTargetObject(parent) {\n var res = {\n targetParent: null,\n targetIndex: 0,\n targetId: null,\n child: false,\n nextSibling: false,\n prevSibling: false\n };\n\n if (parent) {\n utils.mixin(res, parent, true);\n }\n\n return res;\n },\n nextSiblingTarget: function nextSiblingTarget(dndTaskId, targetTaskId, store) {\n var result = this.createDropTargetObject();\n result.targetId = targetTaskId;\n result.nextSibling = true;\n result.targetParent = store.getParent(result.targetId);\n result.targetIndex = store.getBranchIndex(result.targetId);\n\n if (store.getParent(dndTaskId) != result.targetParent || result.targetIndex < store.getBranchIndex(dndTaskId)) {\n result.targetIndex += 1;\n }\n\n return result;\n },\n prevSiblingTarget: function prevSiblingTarget(dndTaskId, targetTaskId, store) {\n var result = this.createDropTargetObject();\n result.targetId = targetTaskId;\n result.prevSibling = true;\n result.targetParent = store.getParent(result.targetId);\n result.targetIndex = store.getBranchIndex(result.targetId);\n\n if (store.getParent(dndTaskId) == result.targetParent && result.targetIndex > store.getBranchIndex(dndTaskId)) {\n result.targetIndex -= 1;\n }\n\n return result;\n },\n firstChildTarget: function firstChildTarget(dndTaskId, targetTaskId, store) {\n var result = this.createDropTargetObject();\n result.targetId = targetTaskId;\n result.targetParent = result.targetId;\n result.targetIndex = 0;\n result.child = true;\n return result;\n },\n lastChildTarget: function lastChildTarget(dndTaskId, targetTaskId, store) {\n var children = store.getChildren(targetTaskId);\n var result = this.createDropTargetObject();\n result.targetId = children[children.length - 1];\n result.targetParent = targetTaskId;\n result.targetIndex = children.length;\n result.nextSibling = true;\n return result;\n }\n};","var isLegacyRender = require(\"../is_legacy_smart_render\");\n\nmodule.exports = function isColumnVisible(columnIndex, scale, viewPort, gantt) {\n var width = scale.width[columnIndex];\n\n if (width <= 0) {\n return false;\n }\n\n if (!gantt.config.smart_rendering || isLegacyRender(gantt)) {\n return true;\n }\n\n var cellLeftCoord = scale.left[columnIndex] - width;\n var cellRightCoord = scale.left[columnIndex] + width;\n return cellLeftCoord <= viewPort.x_end && cellRightCoord >= viewPort.x; //do not render skipped columns\n};","module.exports = function getVisibleCellsRange(scale, viewport) {\n var firstCellIndex = 0;\n var lastCellIndex = scale.left.length - 1;\n\n if (viewport) {\n for (var i = 0; i < scale.left.length; i++) {\n var left = scale.left[i];\n\n if (left < viewport.x) {\n firstCellIndex = i;\n }\n\n if (left > viewport.x_end) {\n lastCellIndex = i;\n break;\n }\n }\n }\n\n return {\n start: firstCellIndex,\n end: lastCellIndex\n };\n};","module.exports = function (item, view, config) {\n return {\n top: view.getItemTop(item.id),\n height: view.getItemHeight(item.id),\n left: 0,\n right: Infinity\n };\n};","function createTaskRenderer(gantt) {\n function _render_task_element(task, view, config) {\n var config = view.$getConfig();\n var painters = config.type_renderers;\n var renderer = painters[gantt.getTaskType(task.type)],\n defaultRenderer = _task_default_render;\n\n if (!renderer) {\n return defaultRenderer.call(gantt, task, view, config);\n } else {\n return renderer.call(gantt, task, function (task) {\n return defaultRenderer.call(gantt, task, view, config);\n }, view);\n }\n }\n\n function _task_default_render(task, view, config) {\n if (gantt._isAllowedUnscheduledTask(task)) return;\n\n if (!gantt._isTaskInTimelineLimits(task)) {\n return;\n }\n\n var pos = view.getItemPosition(task);\n var cfg = config,\n templates = view.$getTemplates();\n var taskType = gantt.getTaskType(task.type);\n var height = view.getBarHeight(task.id, taskType == cfg.types.milestone);\n var controlsMargin = 0;\n\n if (taskType == cfg.types.milestone) {\n controlsMargin = (height - pos.height) / 2;\n }\n\n var padd = Math.floor((view.getItemHeight(task.id) - height) / 2); //\tif(task.type == cfg.types.milestone){\n //\t\tpadd -= 1;\n //\t}\n //\tif (taskType == cfg.types.milestone && cfg.link_line_width > 1) {\n //\t\t//little adjust milestone position, so horisontal corners would match link arrow when thickness of link line is more than 1px\n //\t\tpadd += 1;\n //\t}\n\n if (taskType == cfg.types.milestone) {\n pos.left -= Math.round(height / 2);\n pos.width = height;\n }\n\n var div = document.createElement(\"div\");\n var width = Math.round(pos.width);\n\n if (view.$config.item_attribute) {\n div.setAttribute(view.$config.item_attribute, task.id);\n div.setAttribute(view.$config.bind + \"_id\", task.id); // 'task_id'/'resource_id' for backward compatibility\n }\n\n if (cfg.show_progress && taskType != cfg.types.milestone) {\n _render_task_progress(task, div, width, cfg, templates);\n } //use separate div to display content above progress bar\n\n\n var content = _render_task_content(task, width, templates);\n\n if (task.textColor) {\n content.style.color = task.textColor;\n }\n\n div.appendChild(content);\n\n var css = _combine_item_class(\"gantt_task_line\", templates.task_class(task.start_date, task.end_date, task), task.id, view);\n\n if (task.color || task.progressColor || task.textColor) {\n css += \" gantt_task_inline_color\";\n }\n\n if (pos.width < 20) {\n css += \" gantt_thin_task\";\n }\n\n div.className = css;\n var styles = [\"left:\" + pos.left + \"px\", \"top:\" + (padd + pos.top) + 'px', \"height:\" + (taskType == cfg.types.milestone ? pos.height : height) + 'px', \"line-height:\" + Math.max(height < 30 ? height - 2 : height, 0) + 'px', \"width:\" + width + 'px'];\n\n if (task.color) {\n styles.push(\"background-color:\" + task.color);\n }\n\n if (task.textColor) {\n styles.push(\"color:\" + task.textColor);\n }\n\n div.style.cssText = styles.join(\";\");\n\n var side = _render_leftside_content(task, cfg, templates, controlsMargin);\n\n if (side) div.appendChild(side);\n side = _render_rightside_content(task, cfg, templates, controlsMargin);\n if (side) div.appendChild(side);\n\n gantt._waiAria.setTaskBarAttr(task, div);\n\n var state = gantt.getState();\n\n if (!gantt.isReadonly(task)) {\n if (cfg.drag_resize && !gantt.isSummaryTask(task) && taskType != cfg.types.milestone) {\n _render_pair(div, \"gantt_task_drag\", task, function (css) {\n var el = document.createElement(\"div\");\n el.className = css;\n return el;\n }, cfg);\n }\n\n if (cfg.drag_links && cfg.show_links) {\n _render_pair(div, \"gantt_link_control\", task, function (css) {\n var outer = document.createElement(\"div\");\n outer.className = css;\n outer.style.cssText = [\"height:\" + height + 'px', \"line-height:\" + height + 'px'].join(\";\");\n var inner = document.createElement(\"div\");\n inner.className = \"gantt_link_point\";\n var showLinkPoints = false;\n\n if (state.link_source_id && cfg.touch) {\n showLinkPoints = true;\n }\n\n inner.style.display = showLinkPoints ? \"block\" : \"\";\n outer.appendChild(inner);\n return outer;\n }, cfg, controlsMargin);\n }\n }\n\n return div;\n }\n\n function _render_side_content(task, template, cssClass, marginStyle) {\n if (!template) return null;\n var text = template(task.start_date, task.end_date, task);\n if (!text) return null;\n var content = document.createElement(\"div\");\n content.className = \"gantt_side_content \" + cssClass;\n content.innerHTML = text;\n\n if (marginStyle) {\n content.style[marginStyle.type] = Math.abs(marginStyle.value) + \"px\";\n }\n\n return content;\n }\n\n function _render_leftside_content(task, cfg, templates, margin) {\n var css = \"gantt_left \" + _get_link_crossing_css(!cfg.rtl ? true : false, task, cfg);\n\n var marginStyle = null;\n\n if (margin) {\n marginStyle = {\n type: \"marginRight\",\n value: margin\n };\n }\n\n return _render_side_content(task, templates.leftside_text, css, marginStyle);\n }\n\n function _render_rightside_content(task, cfg, templates, margin) {\n var css = \"gantt_right \" + _get_link_crossing_css(!cfg.rtl ? false : true, task, cfg);\n\n var marginStyle = null;\n\n if (margin) {\n marginStyle = {\n type: \"marginLeft\",\n value: margin\n };\n }\n\n return _render_side_content(task, templates.rightside_text, css, marginStyle);\n }\n\n function _get_link_crossing_css(left, task) {\n var cond = _get_conditions(left);\n\n for (var i in cond) {\n var links = task[i];\n\n for (var ln = 0; ln < links.length; ln++) {\n var link = gantt.getLink(links[ln]);\n\n for (var tp = 0; tp < cond[i].length; tp++) {\n if (link.type == cond[i][tp]) {\n return \"gantt_link_crossing\";\n }\n }\n }\n }\n\n return \"\";\n }\n\n function _render_task_content(task, width, templates) {\n var content = document.createElement(\"div\");\n\n if (gantt.getTaskType(task.type) != gantt.config.types.milestone) {\n content.innerHTML = templates.task_text(task.start_date, task.end_date, task);\n } else if (gantt.getTaskType(task.type) == gantt.config.types.milestone && width) {\n content.style.height = content.style.width = width + \"px\";\n }\n\n content.className = \"gantt_task_content\"; //content.style.width = width + 'px';\n\n return content;\n }\n\n function _render_task_progress(task, element, maxWidth, cfg, templates) {\n var done = task.progress * 1 || 0;\n maxWidth = Math.max(maxWidth - 2, 0); //2px for borders\n\n var pr = document.createElement(\"div\");\n var width = Math.round(maxWidth * done);\n width = Math.min(maxWidth, width);\n\n if (task.progressColor) {\n pr.style.backgroundColor = task.progressColor;\n pr.style.opacity = 1;\n }\n\n pr.style.width = width + 'px';\n pr.className = \"gantt_task_progress\";\n pr.innerHTML = templates.progress_text(task.start_date, task.end_date, task);\n\n if (cfg.rtl) {\n pr.style.position = \"absolute\";\n pr.style.right = \"0px\";\n }\n\n var wrapper = document.createElement(\"div\");\n wrapper.className = \"gantt_task_progress_wrapper\";\n wrapper.appendChild(pr);\n element.appendChild(wrapper);\n\n if (gantt.config.drag_progress && !gantt.isReadonly(task)) {\n var drag = document.createElement(\"div\");\n var markerPos = width;\n\n if (cfg.rtl) {\n markerPos = maxWidth - width;\n }\n\n drag.style.left = markerPos + 'px';\n drag.className = \"gantt_task_progress_drag\";\n pr.appendChild(drag);\n element.appendChild(drag);\n }\n }\n\n function _get_conditions(leftside) {\n if (leftside) {\n return {\n $source: [gantt.config.links.start_to_start],\n $target: [gantt.config.links.start_to_start, gantt.config.links.finish_to_start]\n };\n } else {\n return {\n $source: [gantt.config.links.finish_to_start, gantt.config.links.finish_to_finish],\n $target: [gantt.config.links.finish_to_finish]\n };\n }\n }\n\n function _combine_item_class(basic, template, itemId, view) {\n var cfg = view.$getConfig();\n var css = [basic];\n if (template) css.push(template);\n var state = gantt.getState();\n var task = gantt.getTask(itemId);\n\n if (gantt.getTaskType(task.type) == cfg.types.milestone) {\n css.push(\"gantt_milestone\");\n } else if (gantt.getTaskType(task.type) == cfg.types.project) {\n css.push(\"gantt_project\");\n }\n\n css.push(\"gantt_bar_\" + gantt.getTaskType(task.type));\n if (gantt.isSummaryTask(task)) css.push(\"gantt_dependent_task\");\n\n if (gantt.isSplitTask(task) && (cfg.open_split_tasks && !task.$open || !cfg.open_split_tasks)) {\n css.push(\"gantt_split_parent\");\n }\n\n if (cfg.select_task && gantt.isSelectedTask(itemId)) {\n css.push(\"gantt_selected\");\n }\n\n if (itemId == state.drag_id) {\n css.push(\"gantt_drag_\" + state.drag_mode);\n\n if (state.touch_drag) {\n css.push(\"gantt_touch_\" + state.drag_mode);\n }\n }\n\n if (state.link_source_id == itemId) css.push(\"gantt_link_source\");\n if (state.link_target_id == itemId) css.push(\"gantt_link_target\");\n\n if (cfg.highlight_critical_path && gantt.isCriticalTask) {\n if (gantt.isCriticalTask(task)) css.push(\"gantt_critical_task\");\n }\n\n if (state.link_landing_area && state.link_target_id && state.link_source_id && state.link_target_id != state.link_source_id && (state.link_target_id == itemId || state.link_source_id == itemId)) {\n var from_id = state.link_source_id;\n var from_start = state.link_from_start;\n var to_start = state.link_to_start;\n var allowDrag = gantt.isLinkAllowed(from_id, itemId, from_start, to_start);\n var dragClass = \"\";\n\n if (allowDrag) {\n if (to_start) dragClass = \"link_start_allow\";else dragClass = \"link_finish_allow\";\n } else {\n if (to_start) dragClass = \"link_start_deny\";else dragClass = \"link_finish_deny\";\n }\n\n css.push(dragClass);\n }\n\n return css.join(\" \");\n }\n\n function _render_pair(parent, css, task, content, config, margin) {\n var state = gantt.getState();\n var className, element;\n\n if (+task.start_date >= +state.min_date) {\n className = [css, config.rtl ? \"task_right\" : \"task_left\", \"task_start_date\"];\n element = content(className.join(\" \"));\n element.setAttribute(\"data-bind-property\", \"start_date\");\n\n if (margin) {\n element.style.marginLeft = margin + \"px\";\n }\n\n parent.appendChild(element);\n }\n\n if (+task.end_date <= +state.max_date) {\n className = [css, config.rtl ? \"task_left\" : \"task_right\", \"task_end_date\"];\n element = content(className.join(\" \"));\n element.setAttribute(\"data-bind-property\", \"end_date\");\n\n if (margin) {\n element.style.marginRight = margin + \"px\";\n }\n\n parent.appendChild(element);\n }\n }\n\n return _render_task_element;\n}\n\nmodule.exports = createTaskRenderer;","var ScaleHelper = require(\"./scales_ignore\");\n\nvar eventable = require(\"../../../utils/eventable\");\n\nvar utils = require(\"../../../utils/utils\");\n\nvar helpers = require(\"../../../utils/helpers\");\n\nvar topPositionMixin = require(\"../row_position_mixin\");\n\nvar canvasRender = require(\"./tasks_canvas_render\");\n\nvar Timeline = function Timeline(parent, config, factory, gantt) {\n this.$config = utils.mixin({}, config || {});\n this.$scaleHelper = new ScaleHelper(gantt);\n this.$gantt = gantt;\n this._posFromDateCache = {};\n this._timelineDragScroll = null;\n utils.mixin(this, topPositionMixin(this));\n eventable(this);\n};\n\nTimeline.prototype = {\n init: function init(container) {\n container.innerHTML += \"
\";\n this.$task = container.childNodes[0];\n this.$task.innerHTML = \"
\";\n this.$task_scale = this.$task.childNodes[0];\n this.$task_data = this.$task.childNodes[1];\n this.$task_data.innerHTML = \"
\";\n this.$task_bg = this.$task_data.childNodes[0];\n this.$task_links = this.$task_data.childNodes[1];\n this.$task_bars = this.$task_data.childNodes[2];\n this._tasks = {\n col_width: 0,\n width: [],\n // width of each column\n full_width: 0,\n // width of all columns\n trace_x: [],\n rendered: {}\n };\n var config = this.$getConfig();\n var attr = config[this.$config.bind + \"_attribute\"];\n var linksAttr = config[this.$config.bindLinks + \"_attribute\"];\n\n if (!attr && this.$config.bind) {\n attr = \"data-\" + this.$config.bind + \"-id\";\n }\n\n if (!linksAttr && this.$config.bindLinks) {\n linksAttr = \"data-\" + this.$config.bindLinks + \"-id\";\n }\n\n this.$config.item_attribute = attr || null;\n this.$config.link_attribute = linksAttr || null;\n\n var layers = this._createLayerConfig();\n\n if (!this.$config.layers) {\n this.$config.layers = layers.tasks;\n }\n\n if (!this.$config.linkLayers) {\n this.$config.linkLayers = layers.links;\n }\n\n this._attachLayers(this.$gantt);\n\n this.callEvent(\"onReady\", []); //this.refresh();\n\n if (this.$gantt.ext.dragTimeline) {\n this._timelineDragScroll = this.$gantt.ext.dragTimeline.create();\n\n this._timelineDragScroll.attach(this);\n }\n },\n setSize: function setSize(width, height) {\n var config = this.$getConfig();\n\n if (width * 1 === width) {\n this.$config.width = width;\n }\n\n if (height * 1 === height) {\n this.$config.height = height;\n var dataHeight = Math.max(this.$config.height - config.scale_height);\n this.$task_data.style.height = dataHeight + 'px';\n }\n\n this.refresh();\n this.$task_bg.style.backgroundImage = \"\";\n\n if (config.smart_rendering && this.$config.rowStore) {\n this.$task_bg.style.height = this.getTotalHeight() + \"px\";\n } else {\n this.$task_bg.style.height = \"\";\n }\n\n var scale = this._tasks; //timeline area layers\n\n var data_els = this.$task_data.childNodes;\n\n for (var i = 0, len = data_els.length; i < len; i++) {\n var el = data_els[i];\n if (el.hasAttribute(\"data-layer\") && el.style) el.style.width = scale.full_width + \"px\";\n }\n },\n isVisible: function isVisible() {\n if (this.$parent && this.$parent.$config) {\n return !this.$parent.$config.hidden;\n } else {\n return this.$task.offsetWidth;\n }\n },\n getSize: function getSize() {\n var config = this.$getConfig();\n var store = this.$config.rowStore;\n var contentHeight = store ? this.getTotalHeight() : 0,\n contentWidth = this.isVisible() ? this._tasks.full_width : 0;\n return {\n x: this.isVisible() ? this.$config.width : 0,\n y: this.isVisible() ? this.$config.height : 0,\n contentX: this.isVisible() ? contentWidth : 0,\n contentY: this.isVisible() ? config.scale_height + contentHeight : 0,\n scrollHeight: this.isVisible() ? contentHeight : 0,\n scrollWidth: this.isVisible() ? contentWidth : 0\n };\n },\n scrollTo: function scrollTo(left, top) {\n if (!this.isVisible()) return;\n var scrolled = false;\n this.$config.scrollTop = this.$config.scrollTop || 0;\n this.$config.scrollLeft = this.$config.scrollLeft || 0;\n\n if (top * 1 === top) {\n this.$config.scrollTop = top;\n this.$task_data.scrollTop = this.$config.scrollTop;\n scrolled = true;\n }\n\n if (left * 1 === left) {\n this.$task.scrollLeft = left;\n this.$config.scrollLeft = this.$task.scrollLeft;\n\n this._refreshScales();\n\n scrolled = true;\n }\n\n if (scrolled) {\n this.callEvent(\"onScroll\", [this.$config.scrollLeft, this.$config.scrollTop]);\n }\n },\n _refreshScales: function _refreshScales() {\n if (!this.isVisible()) return;\n var config = this.$getConfig();\n if (!config.smart_scales) return;\n var viewPort = this.getViewPort();\n var scales = this._scales;\n this.$task_scale.innerHTML = this._getScaleChunkHtml(scales, viewPort.x, viewPort.x_end);\n },\n getViewPort: function getViewPort() {\n var scrollLeft = this.$config.scrollLeft || 0;\n var scrollTop = this.$config.scrollTop || 0;\n var height = this.$config.height || 0;\n var width = this.$config.width || 0;\n return {\n y: scrollTop,\n y_end: scrollTop + height,\n x: scrollLeft,\n x_end: scrollLeft + width,\n height: height,\n width: width\n };\n },\n _createLayerConfig: function _createLayerConfig() {\n var self = this;\n\n var taskFilter = function taskFilter() {\n return self.isVisible();\n };\n\n var barVisible = function barVisible(id, task) {\n return !task.hide_bar;\n };\n\n var taskLayers = [{\n expose: true,\n renderer: this.$gantt.$ui.layers.taskBar(),\n container: this.$task_bars,\n filter: [taskFilter, barVisible]\n }, {\n renderer: this.$gantt.$ui.layers.taskSplitBar(),\n filter: [taskFilter],\n container: this.$task_bars,\n append: true\n }, {\n renderer: this.$gantt.$ui.layers.taskRollupBar(),\n filter: [taskFilter],\n container: this.$task_bars,\n append: true\n }, {\n renderer: this.$gantt.$ui.layers.taskBg(),\n container: this.$task_bg,\n filter: [//function(){\n //\treturn !self.$getConfig().static_background;\n //},\n taskFilter]\n }];\n var linkLayers = [{\n expose: true,\n renderer: this.$gantt.$ui.layers.link(),\n container: this.$task_links,\n filter: [taskFilter]\n }];\n return {\n tasks: taskLayers,\n links: linkLayers\n };\n },\n _attachLayers: function _attachLayers(gantt) {\n this._taskLayers = [];\n this._linkLayers = [];\n var self = this;\n var layers = this.$gantt.$services.getService(\"layers\");\n\n if (this.$config.bind) {\n this._bindStore();\n\n var taskRenderer = layers.getDataRender(this.$config.bind);\n\n if (!taskRenderer) {\n taskRenderer = layers.createDataRender({\n name: this.$config.bind,\n defaultContainer: function defaultContainer() {\n return self.$task_data;\n }\n });\n }\n\n taskRenderer.container = function () {\n return self.$task_data;\n };\n\n var taskLayers = this.$config.layers;\n\n for (var i = 0; taskLayers && i < taskLayers.length; i++) {\n var layer = taskLayers[i];\n\n if (typeof layer == \"string\") {\n layer = this.$gantt.$ui.layers[layer]();\n }\n\n if (typeof layer == \"function\" || layer && layer.render && layer.update) {\n layer = {\n renderer: layer\n };\n }\n\n layer.view = this;\n var bar_layer = taskRenderer.addLayer(layer);\n\n this._taskLayers.push(bar_layer);\n\n if (layer.expose) {\n this._taskRenderer = taskRenderer.getLayer(bar_layer);\n }\n }\n\n this._initStaticBackgroundRender();\n }\n\n if (this.$config.bindLinks) {\n self.$config.linkStore = self.$gantt.getDatastore(self.$config.bindLinks);\n var linkRenderer = layers.getDataRender(this.$config.bindLinks);\n\n if (!linkRenderer) {\n linkRenderer = layers.createDataRender({\n name: this.$config.bindLinks,\n defaultContainer: function defaultContainer() {\n return self.$task_data;\n }\n });\n }\n\n var linkLayers = this.$config.linkLayers;\n\n for (var i = 0; linkLayers && i < linkLayers.length; i++) {\n if (typeof layer == \"string\") {\n layer = this.$gantt.$ui.layers[layer]();\n }\n\n var layer = linkLayers[i];\n layer.view = this; //\tlayer.getViewPort = getViewPort;\n //\tsubscribeSmartRender(layer);\n\n var linkLayer = linkRenderer.addLayer(layer);\n\n this._taskLayers.push(linkLayer);\n\n if (linkLayers[i].expose) {\n this._linkRenderer = linkRenderer.getLayer(linkLayer);\n }\n }\n }\n },\n _initStaticBackgroundRender: function _initStaticBackgroundRender() {\n var self = this;\n var staticRender = canvasRender.create();\n var store = self.$config.rowStore;\n if (!store) return;\n this._staticBgHandler = store.attachEvent(\"onStoreUpdated\", function (id, item, mode) {\n if (id !== null) {\n return;\n }\n\n if (!self.isVisible()) return;\n var config = self.$getConfig();\n\n if (config.static_background || config.timeline_placeholder) {\n var store = self.$gantt.getDatastore(self.$config.bind);\n var staticBgContainer = self.$task_bg_static;\n\n if (!staticBgContainer) {\n staticBgContainer = document.createElement(\"div\");\n staticBgContainer.className = \"gantt_task_bg\";\n self.$task_bg_static = staticBgContainer;\n\n if (self.$task_bg.nextSibling) {\n self.$task_data.insertBefore(staticBgContainer, self.$task_bg.nextSibling);\n } else {\n self.$task_data.appendChild(staticBgContainer);\n }\n }\n\n if (store) {\n var staticBackgroundHeight = self.getTotalHeight();\n\n if (config.timeline_placeholder) {\n staticBackgroundHeight = config.timeline_placeholder.height || self.$task_data.offsetHeight || 99999;\n }\n\n staticRender.render(staticBgContainer, config, self.getScale(), staticBackgroundHeight, self.getItemHeight(item ? item.id : null));\n }\n } else if (config.static_background) {\n if (self.$task_bg_static && self.$task_bg_static.parentNode) {\n self.$task_bg_static.parentNode.removeChild(self.$task_bg_static);\n }\n }\n });\n this.attachEvent(\"onDestroy\", function () {\n staticRender.destroy();\n });\n\n this._initStaticBackgroundRender = function () {}; //init once\n\n },\n _clearLayers: function _clearLayers(gantt) {\n var layers = this.$gantt.$services.getService(\"layers\");\n var taskRenderer = layers.getDataRender(this.$config.bind);\n var linkRenderer = layers.getDataRender(this.$config.bindLinks);\n\n if (this._taskLayers) {\n for (var i = 0; i < this._taskLayers.length; i++) {\n taskRenderer.removeLayer(this._taskLayers[i]);\n }\n }\n\n if (this._linkLayers) {\n for (var i = 0; i < this._linkLayers.length; i++) {\n linkRenderer.removeLayer(this._linkLayers[i]);\n }\n }\n\n this._linkLayers = [];\n this._taskLayers = [];\n },\n _render_tasks_scales: function _render_tasks_scales() {\n var config = this.$getConfig();\n var scales_html = \"\",\n outer_width = 0,\n scale_height = 0;\n var state = this.$gantt.getState();\n\n if (this.isVisible()) {\n var helpers = this.$scaleHelper;\n\n var scales = this._getScales();\n\n scale_height = config.scale_height;\n var availWidth = this.$config.width;\n\n if (config.autosize == \"x\" || config.autosize == \"xy\") {\n availWidth = Math.max(config.autosize_min_width, 0);\n }\n\n var cfgs = helpers.prepareConfigs(scales, config.min_column_width, availWidth, scale_height - 1, state.min_date, state.max_date, config.rtl);\n var cfg = this._tasks = cfgs[cfgs.length - 1];\n this._scales = cfgs;\n this._posFromDateCache = {};\n scales_html = this._getScaleChunkHtml(cfgs, 0, this.$config.width);\n outer_width = cfg.full_width + \"px\"; //cfg.full_width + (this._scroll_sizes().y ? scrollSizes.scroll_size : 0) + \"px\";\n\n scale_height += \"px\";\n }\n\n this.$task_scale.style.height = scale_height;\n this.$task_data.style.width = this.$task_scale.style.width = outer_width;\n this.$task_scale.innerHTML = scales_html;\n },\n _getScaleChunkHtml: function _get_scale_chunk_html(scales, fromPos, toPos) {\n var templates = this.$gantt.templates;\n var html = [];\n var css = templates.scale_row_class;\n\n for (var i = 0; i < scales.length; i++) {\n var cssClass = \"gantt_scale_line\";\n var tplClass = css(scales[i]);\n\n if (tplClass) {\n cssClass += \" \" + tplClass;\n }\n\n html.push(\"
\" + this._prepareScaleHtml(scales[i], fromPos, toPos) + \"
\");\n }\n\n return html.join(\"\");\n },\n _prepareScaleHtml: function _prepare_scale_html(config, fromPos, toPos) {\n var globalConfig = this.$getConfig();\n var globalTemplates = this.$gantt.templates;\n var cells = [];\n var date = null,\n css = null;\n var content = config.format || config.template || config.date;\n\n if (typeof content === \"string\") {\n content = this.$gantt.date.date_to_str(content);\n }\n\n var startIndex = 0,\n endIndex = config.count;\n\n if (globalConfig.smart_scales && !isNaN(fromPos) && !isNaN(toPos)) {\n startIndex = helpers.findBinary(config.left, fromPos);\n endIndex = helpers.findBinary(config.left, toPos) + 1;\n }\n\n css = config.css || function () {};\n\n if (!config.css && globalConfig.inherit_scale_class) {\n css = globalTemplates.scale_cell_class;\n }\n\n for (var i = startIndex; i < endIndex; i++) {\n if (!config.trace_x[i]) break;\n date = new Date(config.trace_x[i]);\n var value = content.call(this, date),\n width = config.width[i],\n height = config.height,\n left = config.left[i],\n style = \"\",\n template = \"\",\n cssclass = \"\";\n\n if (width) {\n var position = globalConfig.smart_scales ? \"position:absolute;left:\" + left + \"px\" : \"\";\n style = \"width:\" + width + \"px;height:\" + height + \"px;\" + position;\n cssclass = \"gantt_scale_cell\" + (i == config.count - 1 ? \" gantt_last_cell\" : \"\");\n template = css.call(this, date);\n if (template) cssclass += \" \" + template;\n\n var ariaAttr = this.$gantt._waiAria.getTimelineCellAttr(value);\n\n var cell = \"
\" + value + \"
\";\n cells.push(cell);\n } else {//do not render ignored cells\n }\n }\n\n return cells.join(\"\");\n },\n dateFromPos: function dateFromPos(x) {\n var scale = this._tasks;\n\n if (x < 0 || x > scale.full_width || !scale.full_width) {\n return null;\n }\n\n var ind = helpers.findBinary(this._tasks.left, x);\n var summ = this._tasks.left[ind];\n var col_width = scale.width[ind] || scale.col_width;\n var part = 0;\n\n if (col_width) {\n part = (x - summ) / col_width;\n\n if (scale.rtl) {\n part = 1 - part;\n }\n }\n\n var unit = 0;\n\n if (part) {\n unit = this._getColumnDuration(scale, scale.trace_x[ind]);\n }\n\n var date = new Date(scale.trace_x[ind].valueOf() + Math.round(part * unit));\n return date;\n },\n posFromDate: function posFromDate(date) {\n if (!this.isVisible()) return 0;\n\n if (!date) {\n return 0;\n }\n\n var dateValue = String(date.valueOf());\n\n if (this._posFromDateCache[dateValue] !== undefined) {\n return this._posFromDateCache[dateValue];\n }\n\n var ind = this.columnIndexByDate(date);\n this.$gantt.assert(ind >= 0, \"Invalid day index\");\n var wholeCells = Math.floor(ind);\n var partCell = ind % 1;\n\n var pos = this._tasks.left[Math.min(wholeCells, this._tasks.width.length - 1)];\n\n if (wholeCells == this._tasks.width.length) pos += this._tasks.width[this._tasks.width.length - 1]; //for(var i=1; i <= wholeCells; i++)\n //\tpos += gantt._tasks.width[i-1];\n\n if (partCell) {\n if (wholeCells < this._tasks.width.length) {\n pos += this._tasks.width[wholeCells] * (partCell % 1);\n } else {\n pos += 1;\n }\n }\n\n var roundPos = Math.round(pos);\n this._posFromDateCache[dateValue] = roundPos;\n return Math.round(roundPos);\n },\n _getNextVisibleColumn: function _getNextVisibleColumn(startIndex, columns, ignores) {\n // iterate columns to the right\n var date = +columns[startIndex];\n var visibleDateIndex = startIndex;\n\n while (ignores[date]) {\n visibleDateIndex++;\n date = +columns[visibleDateIndex];\n }\n\n return visibleDateIndex;\n },\n _getPrevVisibleColumn: function _getPrevVisibleColumn(startIndex, columns, ignores) {\n // iterate columns to the left\n var date = +columns[startIndex];\n var visibleDateIndex = startIndex;\n\n while (ignores[date]) {\n visibleDateIndex--;\n date = +columns[visibleDateIndex];\n }\n\n return visibleDateIndex;\n },\n _getClosestVisibleColumn: function _getClosestVisibleColumn(startIndex, columns, ignores) {\n var visibleDateIndex = this._getNextVisibleColumn(startIndex, columns, ignores);\n\n if (!columns[visibleDateIndex]) {\n visibleDateIndex = this._getPrevVisibleColumn(startIndex, columns, ignores);\n }\n\n return visibleDateIndex;\n },\n columnIndexByDate: function columnIndexByDate(date) {\n var pos = new Date(date).valueOf();\n var days = this._tasks.trace_x_ascending,\n ignores = this._tasks.ignore_x;\n var state = this.$gantt.getState();\n\n if (pos <= state.min_date) {\n if (this._tasks.rtl) {\n return days.length;\n } else {\n return 0;\n }\n }\n\n if (pos >= state.max_date) {\n if (this._tasks.rtl) {\n return 0;\n } else {\n return days.length;\n }\n }\n\n var dateIndex = helpers.findBinary(days, pos);\n\n var visibleIndex = this._getClosestVisibleColumn(dateIndex, days, ignores);\n\n var visibleDate = days[visibleIndex];\n var transition = this._tasks.trace_index_transition;\n\n if (!visibleDate) {\n if (transition) {\n return transition[0];\n } else {\n return 0;\n }\n }\n\n var part = (date - days[visibleIndex]) / this._getColumnDuration(this._tasks, days[visibleIndex]);\n\n if (transition) {\n return transition[visibleIndex] + (1 - part);\n } else {\n return visibleIndex + part;\n }\n },\n getItemPosition: function getItemPosition(task, start_date, end_date) {\n var xLeft, xRight, width;\n\n if (this._tasks.rtl) {\n xRight = this.posFromDate(start_date || task.start_date);\n xLeft = this.posFromDate(end_date || task.end_date);\n } else {\n xLeft = this.posFromDate(start_date || task.start_date);\n xRight = this.posFromDate(end_date || task.end_date);\n }\n\n width = Math.max(xRight - xLeft, 0);\n var y = this.getItemTop(task.id);\n var height = this.getBarHeight(task.id);\n var rowHeight = this.getItemHeight(task.id);\n return {\n left: xLeft,\n top: y,\n height: height,\n width: width,\n rowHeight: rowHeight\n };\n },\n getBarHeight: function getBarHeight(taskId, isMilestoneRender) {\n var config = this.$getConfig();\n var task = this.$config.rowStore.getItem(taskId); // height of the bar item\n\n var height = task.task_height || task.bar_height || config.bar_height || config.task_height;\n var rowHeight = this.getItemHeight(taskId);\n\n if (height == \"full\") {\n var offset = config.task_height_offset || 5;\n height = rowHeight - offset;\n } //item height cannot be bigger than row height\n\n\n height = Math.min(height, rowHeight);\n\n if (isMilestoneRender) {\n // to get correct height for addapting Milestone to the row\n height = Math.round(height / Math.sqrt(2));\n }\n\n return Math.max(height, 0);\n },\n getScale: function getScale() {\n return this._tasks;\n },\n _getScales: function _get_scales() {\n var config = this.$getConfig();\n var helpers = this.$scaleHelper;\n var scales = [helpers.primaryScale(config)].concat(helpers.getSubScales(config));\n helpers.sortScales(scales);\n return scales;\n },\n _getColumnDuration: function _get_coll_duration(scale, date) {\n return this.$gantt.date.add(date, scale.step, scale.unit) - date;\n },\n _bindStore: function _bindStore() {\n if (this.$config.bind) {\n var rowStore = this.$gantt.getDatastore(this.$config.bind);\n this.$config.rowStore = rowStore;\n\n if (rowStore && !rowStore._timelineCacheAttached) {\n var self = this;\n rowStore._timelineCacheAttached = rowStore.attachEvent(\"onBeforeFilter\", function () {\n self._resetTopPositionHeight();\n });\n }\n }\n },\n _unbindStore: function _unbindStore() {\n if (this.$config.bind) {\n var rowStore = this.$gantt.getDatastore(this.$config.bind);\n\n if (rowStore && rowStore._timelineCacheAttached) {\n rowStore.detachEvent(rowStore._timelineCacheAttached);\n rowStore._timelineCacheAttached = false;\n }\n }\n },\n refresh: function refresh() {\n this._bindStore();\n\n if (this.$config.bindLinks) {\n this.$config.linkStore = this.$gantt.getDatastore(this.$config.bindLinks);\n }\n\n this._resetTopPositionHeight();\n\n this._resetHeight();\n\n this._initStaticBackgroundRender();\n\n this._render_tasks_scales();\n },\n destructor: function destructor() {\n var gantt = this.$gantt;\n\n this._clearLayers(gantt);\n\n this._unbindStore();\n\n this.$task = null;\n this.$task_scale = null;\n this.$task_data = null;\n this.$task_bg = null;\n this.$task_links = null;\n this.$task_bars = null;\n this.$gantt = null;\n\n if (this.$config.rowStore) {\n this.$config.rowStore.detachEvent(this._staticBgHandler);\n this.$config.rowStore = null;\n }\n\n if (this.$config.linkStore) {\n this.$config.linkStore = null;\n }\n\n if (this._timelineDragScroll) {\n this._timelineDragScroll.destructor();\n\n this._timelineDragScroll = null;\n }\n\n this.callEvent(\"onDestroy\", []);\n this.detachAllEvents();\n }\n};\nmodule.exports = Timeline;","module.exports = function (item, view, config) {\n return {\n top: view.getItemTop(item.id),\n height: view.getItemHeight(item.id),\n left: 0,\n right: Infinity\n };\n};","function create(gantt) {\n var events = [];\n return {\n delegate: function delegate(event, className, handler, root) {\n events.push([event, className, handler, root]);\n var helper = gantt.$services.getService(\"mouseEvents\");\n helper.delegate(event, className, handler, root);\n },\n destructor: function destructor() {\n var mouseEvents = gantt.$services.getService(\"mouseEvents\");\n\n for (var i = 0; i < events.length; i++) {\n var h = events[i];\n mouseEvents.detach(h[0], h[1], h[2], h[3]);\n }\n\n events = [];\n }\n };\n}\n\nmodule.exports = create;","var domHelpers = require(\"../utils/dom_helpers\"),\n utils = require(\"../../../utils/utils\"),\n eventable = require(\"../../../utils/eventable\"),\n gridResize = require(\"./grid_resize\"),\n topPositionMixin = require(\"../row_position_mixin\"),\n rowResize = require(\"./task_grid_row_resize\");\n\nvar ColumnDnd = require(\"../plugins/column_grid_dnd\")[\"default\"];\n\nvar Grid = function Grid(parent, config, factory, gantt) {\n this.$config = utils.mixin({}, config || {});\n this.$gantt = gantt;\n this.$parent = parent;\n eventable(this);\n this.$state = {};\n utils.mixin(this, topPositionMixin(this));\n};\n\nGrid.prototype = {\n init: function init(container) {\n var gantt = this.$gantt;\n\n var gridAriaAttr = gantt._waiAria.gridAttrString();\n\n var gridDataAriaAttr = gantt._waiAria.gridDataAttrString();\n\n var _ganttConfig = this.$getConfig();\n\n var reorderColumns = _ganttConfig.reorder_grid_columns || false;\n\n if (this.$config.reorder_grid_columns !== undefined) {\n reorderColumns = this.$config.reorder_grid_columns;\n }\n\n container.innerHTML = \"
\";\n this.$grid = container.childNodes[0];\n this.$grid.innerHTML = \"
\";\n this.$grid_scale = this.$grid.childNodes[0];\n this.$grid_data = this.$grid.childNodes[1];\n var attr = _ganttConfig[this.$config.bind + \"_attribute\"];\n\n if (!attr && this.$config.bind) {\n attr = \"data-\" + this.$config.bind + \"-id\";\n }\n\n this.$config.item_attribute = attr || null;\n\n if (!this.$config.layers) {\n var layers = this._createLayerConfig();\n\n this.$config.layers = layers;\n }\n\n var resizer = gridResize(gantt, this);\n resizer.init();\n this._renderHeaderResizers = resizer.doOnRender;\n this._mouseDelegates = require(\"../mouse_event_container\")(gantt);\n var resizerrow = rowResize(gantt, this);\n resizerrow.init();\n\n this._addLayers(this.$gantt);\n\n this._initEvents();\n\n if (reorderColumns) {\n this._columnDND = new ColumnDnd(gantt, this);\n\n this._columnDND.init();\n }\n\n this.callEvent(\"onReady\", []); //this.refresh();\n },\n _validateColumnWidth: function _validateColumnWidth(column, property) {\n // user can set {name:\"text\", width:\"200\",...} for some reason,\n // check and convert it to number when possible\n var value = column[property];\n\n if (value && value != \"*\") {\n var gantt = this.$gantt;\n var numericWidth = value * 1;\n\n if (isNaN(numericWidth)) {\n gantt.assert(false, \"Wrong \" + property + \" value of column \" + column.name);\n } else {\n column[property] = numericWidth;\n }\n }\n },\n setSize: function setSize(width, height) {\n this.$config.width = this.$state.width = width;\n this.$config.height = this.$state.height = height; // TODO: maybe inherit and override in a subclass instead of extending here\n\n var columns = this.getGridColumns(),\n innerWidth = 0;\n var config = this.$getConfig();\n var elasticColumns = config.grid_elastic_columns;\n\n for (var i = 0, l = columns.length; i < l; i++) {\n this._validateColumnWidth(columns[i], \"min_width\");\n\n this._validateColumnWidth(columns[i], \"max_width\");\n\n this._validateColumnWidth(columns[i], \"width\");\n\n innerWidth += columns[i].width * 1;\n }\n\n var outerWidth;\n\n if (isNaN(innerWidth) || !this.$config.scrollable) {\n outerWidth = this._setColumnsWidth(width + 1);\n innerWidth = outerWidth;\n }\n\n if (this.$config.scrollable && elasticColumns && !isNaN(innerWidth)) {\n // GS-1352: Allow resizing the grid columns, then the grid width is increased\n // or keep the grid width, but don't allow column resize to affect the grid width\n var columnProperty = \"width\";\n\n if (elasticColumns == \"min_width\") {\n columnProperty = \"min_width\";\n }\n\n var newColumnWidth = 0;\n columns.forEach(function (col) {\n newColumnWidth += col[columnProperty] || config.min_grid_column_width;\n });\n newColumnWidth--; // the total column width shouldn't match the outerWidth\n\n var columnsWidth = Math.max(newColumnWidth, width);\n innerWidth = this._setColumnsWidth(columnsWidth);\n outerWidth = width;\n }\n\n if (this.$config.scrollable) {\n this.$grid_scale.style.width = innerWidth + \"px\";\n this.$grid_data.style.width = innerWidth + \"px\";\n } else {\n this.$grid_scale.style.width = \"inherit\";\n this.$grid_data.style.width = \"inherit\";\n }\n\n this.$config.width -= 1;\n var config = this.$getConfig();\n\n if (outerWidth !== width) {\n if (outerWidth !== undefined) {\n config.grid_width = outerWidth;\n this.$config.width = outerWidth - 1;\n } else {\n if (!isNaN(innerWidth)) {\n this._setColumnsWidth(innerWidth);\n\n config.grid_width = innerWidth;\n this.$config.width = innerWidth - 1;\n }\n }\n }\n\n var dataHeight = Math.max(this.$state.height - config.scale_height, 0);\n this.$grid_data.style.height = dataHeight + \"px\";\n this.refresh();\n },\n getSize: function getSize() {\n var config = this.$getConfig();\n var store = this.$config.rowStore;\n\n var contentHeight = store ? this.getTotalHeight() : 0,\n contentWidth = this._getGridWidth();\n\n var size = {\n x: this.$state.width,\n y: this.$state.height,\n contentX: this.isVisible() ? contentWidth : 0,\n contentY: this.isVisible() ? config.scale_height + contentHeight : 0,\n scrollHeight: this.isVisible() ? contentHeight : 0,\n scrollWidth: this.isVisible() ? contentWidth : 0\n };\n return size;\n },\n _bindStore: function _bindStore() {\n if (this.$config.bind) {\n var rowStore = this.$gantt.getDatastore(this.$config.bind);\n this.$config.rowStore = rowStore;\n\n if (rowStore && !rowStore._gridCacheAttached) {\n var self = this;\n rowStore._gridCacheAttached = rowStore.attachEvent(\"onBeforeFilter\", function () {\n self._resetTopPositionHeight();\n });\n }\n }\n },\n _unbindStore: function _unbindStore() {\n if (this.$config.bind) {\n var rowStore = this.$gantt.getDatastore(this.$config.bind);\n\n if (rowStore && rowStore._gridCacheAttached) {\n rowStore.detachEvent(rowStore._gridCacheAttached);\n rowStore._gridCacheAttached = false;\n }\n }\n },\n refresh: function refresh() {\n this._bindStore();\n\n this._resetTopPositionHeight();\n\n this._resetHeight();\n\n this._initSmartRenderingPlaceholder();\n\n this._calculateGridWidth();\n\n this._renderGridHeader();\n },\n getViewPort: function getViewPort() {\n var scrollLeft = this.$config.scrollLeft || 0;\n var scrollTop = this.$config.scrollTop || 0;\n var height = this.$config.height || 0;\n var width = this.$config.width || 0;\n return {\n y: scrollTop,\n y_end: scrollTop + height,\n x: scrollLeft,\n x_end: scrollLeft + width,\n height: height,\n width: width\n };\n },\n scrollTo: function scrollTo(left, top) {\n if (!this.isVisible()) return;\n var scrolled = false;\n this.$config.scrollTop = this.$config.scrollTop || 0;\n this.$config.scrollLeft = this.$config.scrollLeft || 0;\n\n if (left * 1 == left) {\n this.$config.scrollLeft = this.$state.scrollLeft = this.$grid.scrollLeft = left;\n scrolled = true;\n } // var config = this.$getConfig();\n\n\n if (top * 1 == top) {\n this.$config.scrollTop = this.$state.scrollTop = this.$grid_data.scrollTop = top;\n scrolled = true;\n }\n\n if (scrolled) {\n this.callEvent(\"onScroll\", [this.$config.scrollLeft, this.$config.scrollTop]);\n }\n },\n getColumnIndex: function getColumnIndex(name, excludeHidden) {\n var columns = this.$getConfig().columns;\n var hiddenIndexShift = 0;\n\n for (var i = 0; i < columns.length; i++) {\n // GS-1257. If the cell is hidden, the target column index should be correct\n if (excludeHidden && columns[i].hide) {\n hiddenIndexShift++;\n }\n\n if (columns[i].name == name) {\n return i - hiddenIndexShift;\n }\n }\n\n return null;\n },\n getColumn: function getColumn(name) {\n var index = this.getColumnIndex(name);\n\n if (index === null) {\n return null;\n }\n\n return this.$getConfig().columns[index];\n },\n getGridColumns: function getGridColumns() {\n var config = this.$getConfig();\n return config.columns.slice();\n },\n isVisible: function isVisible() {\n if (this.$parent && this.$parent.$config) {\n return !this.$parent.$config.hidden;\n } else {\n return this.$grid.offsetWidth;\n }\n },\n // getItemHeight: function () {\n // \tvar config = this.$getConfig();\n // \treturn config.row_height;\n // },\n _createLayerConfig: function _createLayerConfig() {\n var gantt = this.$gantt;\n var self = this;\n var layers = [{\n renderer: gantt.$ui.layers.gridLine(),\n container: this.$grid_data,\n filter: [function () {\n return self.isVisible();\n }]\n }, {\n renderer: gantt.$ui.layers.gridTaskRowResizer(),\n container: this.$grid_data,\n append: true,\n filter: [function () {\n return gantt.config.resize_rows;\n }]\n }];\n return layers;\n },\n _addLayers: function _addLayers(gantt) {\n if (!this.$config.bind) return;\n this._taskLayers = [];\n var self = this;\n var layers = this.$gantt.$services.getService(\"layers\");\n var taskRenderer = layers.getDataRender(this.$config.bind);\n\n if (!taskRenderer) {\n taskRenderer = layers.createDataRender({\n name: this.$config.bind,\n defaultContainer: function defaultContainer() {\n return self.$grid_data;\n }\n });\n }\n\n var taskLayers = this.$config.layers;\n\n for (var i = 0; taskLayers && i < taskLayers.length; i++) {\n var layer = taskLayers[i];\n layer.view = this;\n var bar_layer = taskRenderer.addLayer(layer);\n\n this._taskLayers.push(bar_layer);\n }\n\n this._bindStore();\n\n this._initSmartRenderingPlaceholder();\n },\n _refreshPlaceholderOnStoreUpdate: function _refreshPlaceholderOnStoreUpdate(id) {\n var config = this.$getConfig(),\n store = this.$config.rowStore;\n\n if (!store || id !== null || !this.isVisible() || !config.smart_rendering) {\n return;\n }\n\n var contentHeight;\n\n if (this.$config.scrollY) {\n var scroll = this.$gantt.$ui.getView(this.$config.scrollY);\n if (scroll) contentHeight = scroll.getScrollState().scrollSize;\n }\n\n if (!contentHeight) {\n contentHeight = store ? this.getTotalHeight() : 0;\n }\n\n if (contentHeight) {\n if (this.$rowsPlaceholder && this.$rowsPlaceholder.parentNode) {\n this.$rowsPlaceholder.parentNode.removeChild(this.$rowsPlaceholder);\n }\n\n var placeholder = this.$rowsPlaceholder = document.createElement(\"div\");\n placeholder.style.visibility = \"hidden\";\n placeholder.style.height = contentHeight + \"px\";\n placeholder.style.width = \"1px\";\n this.$grid_data.appendChild(placeholder);\n }\n },\n _initSmartRenderingPlaceholder: function _initSmartRenderingPlaceholder() {\n var store = this.$config.rowStore;\n\n if (!store) {\n return;\n } else {\n this._initSmartRenderingPlaceholder = function () {};\n }\n\n this._staticBgHandler = store.attachEvent(\"onStoreUpdated\", utils.bind(this._refreshPlaceholderOnStoreUpdate, this));\n },\n _initEvents: function _initEvents() {\n var gantt = this.$gantt;\n\n this._mouseDelegates.delegate(\"click\", \"gantt_close\", gantt.bind(function (e, id, trg) {\n var store = this.$config.rowStore;\n if (!store) return true;\n var target = domHelpers.locateAttribute(e, this.$config.item_attribute);\n\n if (target) {\n store.close(target.getAttribute(this.$config.item_attribute));\n }\n\n return false;\n }, this), this.$grid);\n\n this._mouseDelegates.delegate(\"click\", \"gantt_open\", gantt.bind(function (e, id, trg) {\n var store = this.$config.rowStore;\n if (!store) return true;\n var target = domHelpers.locateAttribute(e, this.$config.item_attribute);\n\n if (target) {\n store.open(target.getAttribute(this.$config.item_attribute));\n }\n\n return false;\n }, this), this.$grid);\n },\n _clearLayers: function _clearLayers(gantt) {\n var layers = this.$gantt.$services.getService(\"layers\");\n var taskRenderer = layers.getDataRender(this.$config.bind);\n\n if (this._taskLayers) {\n for (var i = 0; i < this._taskLayers.length; i++) {\n taskRenderer.removeLayer(this._taskLayers[i]);\n }\n }\n\n this._taskLayers = [];\n },\n _getColumnWidth: function _getColumnWidth(column, config, width) {\n var min_width = column.min_width || config.min_grid_column_width;\n var new_width = Math.max(width, min_width || 10);\n if (column.max_width) new_width = Math.min(new_width, column.max_width);\n return new_width;\n },\n // set min width only if width < than config.min_grid_column_width\n _checkGridColumnMinWidthLimits: function _checkGridColumnMinWidthLimits(columns, config) {\n for (var i = 0, l = columns.length; i < l; i++) {\n var width = columns[i].width * 1;\n\n if (!columns[i].min_width && width < config.min_grid_column_width) {\n columns[i].min_width = width;\n }\n }\n },\n // return min and max possible grid width according to restricts\n _getGridWidthLimits: function _getGridWidthLimits() {\n var config = this.$getConfig(),\n columns = this.getGridColumns(),\n min_limit = 0,\n max_limit = 0;\n\n for (var i = 0; i < columns.length; i++) {\n min_limit += columns[i].min_width ? columns[i].min_width : config.min_grid_column_width;\n\n if (max_limit !== undefined) {\n max_limit = columns[i].max_width ? max_limit + columns[i].max_width : undefined;\n }\n }\n\n this._checkGridColumnMinWidthLimits(columns, config); // FIX ME: should it be before calculating limits?\n\n\n return [min_limit, max_limit];\n },\n // resize columns to get total newWidth, starting from columns[start_index]\n _setColumnsWidth: function _setColumnsWidth(newWidth, start_index) {\n var config = this.$getConfig();\n var columns = this.getGridColumns(),\n columns_width = 0,\n final_width = newWidth;\n start_index = !window.isNaN(start_index) ? start_index : -1;\n\n for (var i = 0, l = columns.length; i < l; i++) {\n columns_width += columns[i].width * 1;\n }\n\n if (window.isNaN(columns_width)) {\n this._calculateGridWidth();\n\n columns_width = 0;\n\n for (var i = 0, l = columns.length; i < l; i++) {\n columns_width += columns[i].width * 1;\n }\n }\n\n var extra_width = final_width - columns_width;\n var start_width = 0;\n\n for (var i = 0; i < start_index + 1; i++) {\n start_width += columns[i].width;\n }\n\n columns_width -= start_width;\n\n for (var i = start_index + 1; i < columns.length; i++) {\n var col = columns[i];\n var share = Math.round(extra_width * (col.width / columns_width)); // columns have 2 additional restrict fields - min_width & max_width that are set by user\n\n if (extra_width < 0) {\n if (col.min_width && col.width + share < col.min_width) share = col.min_width - col.width;else if (!col.min_width && config.min_grid_column_width && col.width + share < config.min_grid_column_width) share = config.min_grid_column_width - col.width;\n } else if (col.max_width && col.width + share > col.max_width) share = col.max_width - col.width;\n\n columns_width -= col.width;\n col.width += share;\n extra_width -= share;\n }\n\n var iterator = extra_width > 0 ? 1 : -1;\n\n while (extra_width > 0 && iterator === 1 || extra_width < 0 && iterator === -1) {\n var curExtra = extra_width;\n\n for (i = start_index + 1; i < columns.length; i++) {\n var new_width = columns[i].width + iterator;\n\n if (new_width == this._getColumnWidth(columns[i], config, new_width)) {\n extra_width -= iterator;\n columns[i].width = new_width;\n }\n\n if (!extra_width) break;\n }\n\n if (curExtra == extra_width) break;\n } // if impossible to resize the right-side columns, resize the start column\n\n\n if (extra_width && start_index > -1) {\n var new_width = columns[start_index].width + extra_width;\n if (new_width == this._getColumnWidth(columns[start_index], config, new_width)) columns[start_index].width = new_width;\n } //if (this.callEvent(\"onGridResizeEnd\", [config.grid_width, final_width]) === false)\n //\treturn;\n\n\n return this._getColsTotalWidth();\n },\n _getColsTotalWidth: function _getColsTotalWidth() {\n var columns = this.getGridColumns();\n var cols_width = 0;\n\n for (var i = 0; i < columns.length; i++) {\n var v = parseFloat(columns[i].width);\n\n if (window.isNaN(v)) {\n return false;\n }\n\n cols_width += v;\n }\n\n return cols_width;\n },\n _calculateGridWidth: function _calculateGridWidth() {\n var config = this.$getConfig();\n var columns = this.getGridColumns();\n var cols_width = 0;\n var unknown = [];\n var width = [];\n\n for (var i = 0; i < columns.length; i++) {\n var v = parseFloat(columns[i].width);\n\n if (window.isNaN(v)) {\n v = config.min_grid_column_width || 10;\n unknown.push(i);\n }\n\n width[i] = v;\n cols_width += v;\n }\n\n var gridWidth = this._getGridWidth() + 1;\n\n if (config.autofit || unknown.length) {\n var diff = gridWidth - cols_width; // TODO: logic may be improved for proportional changing of width\n // autofit adjusts columns widths to the outer grid width\n // it doesn't makes sense if grid has inner scroll with elastic columns\n\n if (config.autofit && !config.grid_elastic_columns) {\n // delta must be added for all columns\n for (var i = 0; i < width.length; i++) {\n var delta = Math.round(diff / (width.length - i));\n width[i] += delta;\n\n var new_width = this._getColumnWidth(columns[i], config, width[i]);\n\n if (new_width != width[i]) {\n delta = new_width - width[i];\n width[i] = new_width;\n }\n\n diff -= delta;\n }\n } else if (unknown.length) {\n // there are several columns with undefined width\n for (var i = 0; i < unknown.length; i++) {\n var delta = Math.round(diff / (unknown.length - i)); // no float values, just integer\n\n var index = unknown[i];\n width[index] += delta;\n\n var new_width = this._getColumnWidth(columns[index], config, width[index]);\n\n if (new_width != width[index]) {\n delta = new_width - width[index];\n width[index] = new_width;\n }\n\n diff -= delta;\n }\n }\n\n for (var i = 0; i < width.length; i++) {\n columns[i].width = width[i];\n }\n } else {\n var changed = gridWidth != cols_width;\n this.$config.width = cols_width - 1;\n config.grid_width = cols_width;\n\n if (changed) {\n this.$parent._setContentSize(this.$config.width, null);\n }\n }\n },\n _renderGridHeader: function _renderGridHeader() {\n var gantt = this.$gantt;\n var config = this.$getConfig();\n var locale = this.$gantt.locale;\n var templates = this.$gantt.templates;\n var columns = this.getGridColumns();\n\n if (config.rtl) {\n columns = columns.reverse();\n }\n\n var cells = [];\n var width = 0,\n labels = locale.labels;\n var lineHeigth = config.scale_height - 1;\n\n for (var i = 0; i < columns.length; i++) {\n var last = i == columns.length - 1;\n var col = columns[i]; // ensure columns have non-empty names\n\n if (!col.name) {\n col.name = gantt.uid() + \"\";\n }\n\n var colWidth = col.width * 1;\n\n var gridWidth = this._getGridWidth();\n\n if (last && gridWidth > width + colWidth) col.width = colWidth = gridWidth - width;\n width += colWidth;\n var sort = gantt._sort && col.name == gantt._sort.name ? \"
\" : \"\";\n var cssClass = [\"gantt_grid_head_cell\", \"gantt_grid_head_\" + col.name, last ? \"gantt_last_cell\" : \"\", templates.grid_header_class(col.name, col)].join(\" \");\n var style = \"width:\" + (colWidth - (last ? 1 : 0)) + \"px;\";\n var label = col.label || labels[\"column_\" + col.name] || labels[col.name];\n label = label || \"\";\n\n var ariaAttrs = gantt._waiAria.gridScaleCellAttrString(col, label);\n\n var cell = \"
\" + label + sort + \"
\";\n cells.push(cell);\n }\n\n this.$grid_scale.style.height = config.scale_height + \"px\";\n this.$grid_scale.style.lineHeight = lineHeigth + \"px\"; //this.$grid_scale.style.width = \"inherit\";\n\n this.$grid_scale.innerHTML = cells.join(\"\");\n\n if (this._renderHeaderResizers) {\n this._renderHeaderResizers();\n }\n },\n _getGridWidth: function _getGridWidth() {\n // TODO: refactor/remove/comment some of _getGridWidth/this.$config.width/this.$state.width, it's not clear what they do\n return this.$config.width;\n },\n destructor: function destructor() {\n this._clearLayers(this.$gantt);\n\n if (this._mouseDelegates) {\n this._mouseDelegates.destructor();\n\n this._mouseDelegates = null;\n }\n\n this._unbindStore();\n\n this.$grid = null;\n this.$grid_scale = null;\n this.$grid_data = null;\n this.$gantt = null;\n\n if (this.$config.rowStore) {\n this.$config.rowStore.detachEvent(this._staticBgHandler);\n this.$config.rowStore = null;\n }\n\n this.callEvent(\"onDestroy\", []);\n this.detachAllEvents();\n }\n};\nmodule.exports = Grid;","var utils = require(\"../../../utils/utils\");\n\nfunction ScaleHelper(gantt) {\n var dateHelper = gantt.date;\n var services = gantt.$services;\n return {\n getSum: function getSum(sizes, from, to) {\n if (to === undefined) to = sizes.length - 1;\n if (from === undefined) from = 0;\n var summ = 0;\n\n for (var i = from; i <= to; i++) {\n summ += sizes[i];\n }\n\n return summ;\n },\n setSumWidth: function setSumWidth(sum_width, scale, from, to) {\n var parts = scale.width;\n if (to === undefined) to = parts.length - 1;\n if (from === undefined) from = 0;\n var length = to - from + 1;\n if (from > parts.length - 1 || length <= 0 || to > parts.length - 1) return;\n var oldWidth = this.getSum(parts, from, to);\n var diff = sum_width - oldWidth;\n this.adjustSize(diff, parts, from, to);\n this.adjustSize(-diff, parts, to + 1);\n scale.full_width = this.getSum(parts);\n },\n splitSize: function splitSize(width, count) {\n var arr = [];\n\n for (var i = 0; i < count; i++) {\n arr[i] = 0;\n }\n\n this.adjustSize(width, arr);\n return arr;\n },\n adjustSize: function adjustSize(width, parts, from, to) {\n if (!from) from = 0;\n if (to === undefined) to = parts.length - 1;\n var length = to - from + 1;\n var full = this.getSum(parts, from, to);\n\n for (var i = from; i <= to; i++) {\n var share = Math.floor(width * (full ? parts[i] / full : 1 / length));\n full -= parts[i];\n width -= share;\n length--;\n parts[i] += share;\n }\n\n parts[parts.length - 1] += width;\n },\n sortScales: function sortScales(scales) {\n function cellSize(unit, step) {\n var d = new Date(1970, 0, 1);\n return dateHelper.add(d, step, unit) - d;\n }\n\n scales.sort(function (a, b) {\n if (cellSize(a.unit, a.step) < cellSize(b.unit, b.step)) {\n return 1;\n } else if (cellSize(a.unit, a.step) > cellSize(b.unit, b.step)) {\n return -1;\n } else {\n return 0;\n }\n });\n\n for (var i = 0; i < scales.length; i++) {\n scales[i].index = i;\n }\n },\n _isLegacyMode: function _isLegacyMode(config) {\n var scaleConfig = config || gantt.config;\n return scaleConfig.scale_unit || scaleConfig.date_scale || scaleConfig.subscales;\n },\n _prepareScaleObject: function _prepareScaleObject(scale) {\n var format = scale.format;\n\n if (!format) {\n format = scale.template || scale.date || \"%d %M\";\n }\n\n if (typeof format === \"string\") {\n format = gantt.date.date_to_str(format);\n }\n\n return {\n unit: scale.unit || \"day\",\n step: scale.step || 1,\n format: format,\n css: scale.css\n };\n },\n primaryScale: function primaryScale(config) {\n var templates = services.getService(\"templateLoader\");\n\n var legacyMode = this._isLegacyMode(config);\n\n var scaleConfig = config || gantt.config;\n var result;\n\n if (legacyMode) {\n templates.initTemplate(\"date_scale\", undefined, undefined, scaleConfig, gantt.config.templates);\n result = {\n unit: gantt.config.scale_unit,\n step: gantt.config.step,\n template: gantt.templates.date_scale,\n date: gantt.config.date_scale,\n css: gantt.templates.scale_cell_class\n };\n } else {\n var primaryScale = scaleConfig.scales[0];\n result = {\n unit: primaryScale.unit,\n step: primaryScale.step,\n template: primaryScale.template,\n format: primaryScale.format,\n date: primaryScale.date,\n css: primaryScale.css || gantt.templates.scale_cell_class\n };\n }\n\n return this._prepareScaleObject(result);\n },\n getSubScales: function getSubScales(config) {\n var legacyMode = this._isLegacyMode(config);\n\n var scaleConfig = config || gantt.config;\n var scales;\n\n if (legacyMode) {\n scales = scaleConfig.subscales || [];\n } else {\n scales = scaleConfig.scales.slice(1);\n }\n\n return scales.map(function (scale) {\n return this._prepareScaleObject(scale);\n }.bind(this));\n },\n prepareConfigs: function prepareConfigs(scales, min_coll_width, container_width, scale_height, minDate, maxDate, rtl) {\n var heights = this.splitSize(scale_height, scales.length);\n var full_width = container_width;\n var configs = [];\n\n for (var i = scales.length - 1; i >= 0; i--) {\n var main_scale = i == scales.length - 1;\n var cfg = this.initScaleConfig(scales[i], minDate, maxDate);\n\n if (main_scale) {\n this.processIgnores(cfg);\n }\n\n this.initColSizes(cfg, min_coll_width, full_width, heights[i]);\n this.limitVisibleRange(cfg);\n\n if (main_scale) {\n full_width = cfg.full_width;\n }\n\n configs.unshift(cfg);\n }\n\n for (var i = 0; i < configs.length - 1; i++) {\n this.alineScaleColumns(configs[configs.length - 1], configs[i]);\n }\n\n for (var i = 0; i < configs.length; i++) {\n if (rtl) {\n this.reverseScale(configs[i]);\n }\n\n this.setPosSettings(configs[i]);\n }\n\n return configs;\n },\n reverseScale: function reverseScale(scale) {\n scale.width = scale.width.reverse();\n scale.trace_x = scale.trace_x.reverse();\n var indexes = scale.trace_indexes;\n scale.trace_indexes = {};\n scale.trace_index_transition = {};\n scale.rtl = true;\n\n for (var i = 0; i < scale.trace_x.length; i++) {\n scale.trace_indexes[scale.trace_x[i].valueOf()] = i;\n scale.trace_index_transition[indexes[scale.trace_x[i].valueOf()]] = i;\n }\n\n return scale;\n },\n setPosSettings: function setPosSettings(config) {\n for (var i = 0, len = config.trace_x.length; i < len; i++) {\n config.left.push((config.width[i - 1] || 0) + (config.left[i - 1] || 0));\n }\n },\n _ignore_time_config: function _ignore_time_config(date, scale) {\n if (gantt.config.skip_off_time) {\n var skip = true;\n var probe = date; // check dates in case custom scale unit, e.g. {unit: \"month\", step: 3}\n\n for (var i = 0; i < scale.step; i++) {\n if (i) {\n probe = dateHelper.add(date, i, scale.unit);\n }\n\n skip = skip && !this.isWorkTime(probe, scale.unit);\n }\n\n return skip;\n }\n\n return false;\n },\n //defined in an extension\n processIgnores: function processIgnores(config) {\n config.ignore_x = {};\n config.display_count = config.count;\n },\n initColSizes: function initColSizes(config, min_col_width, full_width, line_height) {\n var cont_width = full_width;\n config.height = line_height;\n var column_count = config.display_count === undefined ? config.count : config.display_count;\n if (!column_count) column_count = 1;\n config.col_width = Math.floor(cont_width / column_count);\n\n if (min_col_width) {\n if (config.col_width < min_col_width) {\n config.col_width = min_col_width;\n cont_width = config.col_width * column_count;\n }\n }\n\n config.width = [];\n var ignores = config.ignore_x || {};\n\n for (var i = 0; i < config.trace_x.length; i++) {\n if (ignores[config.trace_x[i].valueOf()] || config.display_count == config.count) {\n config.width[i] = 0;\n } else {\n // width of month columns should be proportional month duration\n var width = 1;\n\n if (config.unit == \"month\") {\n var days = Math.round((dateHelper.add(config.trace_x[i], config.step, config.unit) - config.trace_x[i]) / (1000 * 60 * 60 * 24));\n width = days;\n }\n\n config.width[i] = width;\n }\n }\n\n this.adjustSize(cont_width - this.getSum(config.width)\n /* 1 width per column from the code above */\n , config.width);\n config.full_width = this.getSum(config.width);\n },\n initScaleConfig: function initScaleConfig(config, min_date, max_date) {\n var cfg = utils.mixin({\n count: 0,\n col_width: 0,\n full_width: 0,\n height: 0,\n width: [],\n left: [],\n trace_x: [],\n trace_indexes: {},\n min_date: new Date(min_date),\n max_date: new Date(max_date)\n }, config);\n this.eachColumn(config.unit, config.step, min_date, max_date, function (date) {\n cfg.count++;\n cfg.trace_x.push(new Date(date));\n cfg.trace_indexes[date.valueOf()] = cfg.trace_x.length - 1;\n });\n cfg.trace_x_ascending = cfg.trace_x.slice();\n return cfg;\n },\n iterateScales: function iterateScales(lower_scale, upper_scale, from, to, callback) {\n var upper_dates = upper_scale.trace_x;\n var lower_dates = lower_scale.trace_x;\n var prev = from || 0;\n var end = to || lower_dates.length - 1;\n var prevUpper = 0;\n\n for (var up = 1; up < upper_dates.length; up++) {\n var target_index = lower_scale.trace_indexes[+upper_dates[up]];\n\n if (target_index !== undefined && target_index <= end) {\n if (callback) {\n callback.apply(this, [prevUpper, up, prev, target_index]);\n }\n\n prev = target_index;\n prevUpper = up;\n continue;\n }\n }\n },\n alineScaleColumns: function alineScaleColumns(lower_scale, upper_scale, from, to) {\n this.iterateScales(lower_scale, upper_scale, from, to, function (upper_start, upper_end, lower_start, lower_end) {\n var targetWidth = this.getSum(lower_scale.width, lower_start, lower_end - 1);\n var actualWidth = this.getSum(upper_scale.width, upper_start, upper_end - 1);\n\n if (actualWidth != targetWidth) {\n this.setSumWidth(targetWidth, upper_scale, upper_start, upper_end - 1);\n }\n });\n },\n eachColumn: function eachColumn(unit, step, min_date, max_date, callback) {\n var start = new Date(min_date),\n end = new Date(max_date);\n\n if (dateHelper[unit + \"_start\"]) {\n start = dateHelper[unit + \"_start\"](start);\n }\n\n var curr = new Date(start);\n\n if (+curr >= +end) {\n end = dateHelper.add(curr, step, unit);\n }\n\n while (+curr < +end) {\n callback.call(this, new Date(curr));\n var tzOffset = curr.getTimezoneOffset();\n curr = dateHelper.add(curr, step, unit);\n curr = gantt._correct_dst_change(curr, tzOffset, step, unit);\n if (dateHelper[unit + '_start']) curr = dateHelper[unit + \"_start\"](curr);\n }\n },\n limitVisibleRange: function limitVisibleRange(cfg) {\n var dates = cfg.trace_x;\n var left = 0,\n right = cfg.width.length - 1;\n var diff = 0;\n\n if (+dates[0] < +cfg.min_date && left != right) {\n var width = Math.floor(cfg.width[0] * ((dates[1] - cfg.min_date) / (dates[1] - dates[0])));\n diff += cfg.width[0] - width;\n cfg.width[0] = width;\n dates[0] = new Date(cfg.min_date);\n }\n\n var last = dates.length - 1;\n var lastDate = dates[last];\n var outDate = dateHelper.add(lastDate, cfg.step, cfg.unit);\n\n if (+outDate > +cfg.max_date && last > 0) {\n var width = cfg.width[last] - Math.floor(cfg.width[last] * ((outDate - cfg.max_date) / (outDate - lastDate)));\n diff += cfg.width[last] - width;\n cfg.width[last] = width;\n }\n\n if (diff) {\n var full = this.getSum(cfg.width);\n var shared = 0;\n\n for (var i = 0; i < cfg.width.length; i++) {\n var share = Math.floor(diff * (cfg.width[i] / full));\n cfg.width[i] += share;\n shared += share;\n }\n\n this.adjustSize(diff - shared, cfg.width);\n }\n }\n };\n}\n\nmodule.exports = ScaleHelper;","var helpers = require(\"../../../utils/helpers\");\n\nvar htmlHelpers = {\n getHtmlSelect: function getHtmlSelect(options, attributes, value) {\n var innerHTML = \"\";\n\n var _this = this;\n\n options = options || [];\n helpers.forEach(options, function (entry) {\n var _attributes = [{\n key: \"value\",\n value: entry.key\n }];\n\n if (value == entry.key) {\n _attributes[_attributes.length] = {\n key: \"selected\",\n value: \"selected\"\n };\n }\n\n if (entry.attributes) {\n _attributes = _attributes.concat(entry.attributes);\n }\n\n innerHTML += _this.getHtmlOption({\n innerHTML: entry.label\n }, _attributes);\n });\n return _getHtmlContainer(\"select\", {\n innerHTML: innerHTML\n }, attributes);\n },\n getHtmlOption: function getHtmlOption(options, attributes) {\n return _getHtmlContainer(\"option\", options, attributes);\n },\n getHtmlButton: function getHtmlButton(options, attributes) {\n return _getHtmlContainer(\"button\", options, attributes);\n },\n getHtmlDiv: function getHtmlDiv(options, attributes) {\n return _getHtmlContainer(\"div\", options, attributes);\n },\n getHtmlLabel: function getHtmlLabel(options, attributes) {\n return _getHtmlContainer(\"label\", options, attributes);\n },\n getHtmlInput: function getHtmlInput(attributes) {\n return \"\";\n }\n};\n\nfunction _getHtmlContainer(tag, options, attributes) {\n var html;\n options = options || [];\n html = \"<\" + tag + _getHtmlAttributes(attributes || []) + \">\" + (options.innerHTML || \"\") + \"\";\n return html;\n}\n\nfunction _getHtmlAttributes(attributes) {\n var html = \"\";\n helpers.forEach(attributes, function (entry) {\n html += \" \" + entry.key + \"='\" + entry.value + \"'\";\n });\n return html;\n}\n\nmodule.exports = htmlHelpers;","var helpers = require(\"../utils/helpers\");\n\nmodule.exports = function createResourceTimelineBuilder(gantt) {\n var resourceTaskCache = {};\n gantt.$data.tasksStore.attachEvent(\"onStoreUpdated\", function () {\n resourceTaskCache = {};\n });\n\n function getResourceLoad(resource, resourceProperty, scale, timeline) {\n var cacheKey = resource.id + \"_\" + resourceProperty + \"_\" + scale.unit + \"_\" + scale.step;\n var res;\n\n if (!resourceTaskCache[cacheKey]) {\n res = resourceTaskCache[cacheKey] = calculateResourceLoad(resource, resourceProperty, scale, timeline);\n } else {\n res = resourceTaskCache[cacheKey];\n }\n\n return res;\n }\n\n function calculateResourceLoadFromAssignments(items, scale, assignmentsPassed) {\n var scaleUnit = scale.unit;\n var scaleStep = scale.step;\n var timegrid = {};\n var precalculatedTimes = {};\n\n for (var i = 0; i < items.length; i++) {\n var item = items[i];\n var task = item;\n\n if (assignmentsPassed) {\n task = gantt.getTask(item.task_id);\n }\n\n var minDate = item.start_date || task.start_date;\n var maxDate = item.end_date || task.end_date;\n\n if (assignmentsPassed) {\n if (item.start_date) {\n minDate = new Date(Math.max(item.start_date.valueOf(), task.start_date.valueOf()));\n }\n\n if (item.end_date) {\n maxDate = new Date(Math.min(item.end_date.valueOf(), task.end_date.valueOf()));\n }\n }\n\n var firstColumn = helpers.findBinary(scale.trace_x, minDate.valueOf());\n var currDate = new Date(scale.trace_x[firstColumn] || gantt.date[scaleUnit + \"_start\"](new Date(minDate)));\n var calendar = gantt.config.work_time ? gantt.getTaskCalendar(task) : gantt;\n precalculatedTimes[calendar.id] = {};\n\n while (currDate < maxDate) {\n var cachedTimes = precalculatedTimes[calendar.id];\n var date = currDate;\n var timestamp = date.valueOf();\n currDate = gantt.date.add(currDate, scaleStep, scaleUnit);\n\n if (cachedTimes[timestamp] === false) {\n continue;\n }\n\n var isWorkTime = calendar.isWorkTime({\n date: date,\n task: task,\n unit: scaleUnit\n });\n\n if (!isWorkTime) {\n cachedTimes[timestamp] = false;\n continue;\n }\n\n if (!timegrid[timestamp]) {\n timegrid[timestamp] = {\n tasks: [],\n assignments: []\n };\n }\n\n timegrid[timestamp].tasks.push(task);\n\n if (assignmentsPassed) {\n timegrid[timestamp].assignments.push(item);\n }\n }\n }\n\n return timegrid;\n }\n\n function calculateResourceLoad(resource, resourceProperty, scale, timeline) {\n var items;\n var assignmentsPassed = false;\n var timegrid = {};\n\n if (gantt.config.process_resource_assignments && resourceProperty === gantt.config.resource_property) {\n if (resource.$role == \"task\") {\n items = gantt.getResourceAssignments(resource.$resource_id, resource.$task_id);\n } else {\n items = gantt.getResourceAssignments(resource.id);\n }\n\n assignmentsPassed = true;\n } else if (resource.$role == \"task\") {\n items = [];\n } else {\n items = gantt.getTaskBy(resourceProperty, resource.id);\n }\n\n var timegrid = calculateResourceLoadFromAssignments(items, scale, assignmentsPassed);\n var scaleUnit = scale.unit;\n var scaleStep = scale.step;\n var timetable = [];\n var start, end, tasks, assignments, cell;\n var config = timeline.$getConfig();\n\n for (var i = 0; i < scale.trace_x.length; i++) {\n start = new Date(scale.trace_x[i]);\n end = gantt.date.add(start, scaleStep, scaleUnit);\n cell = timegrid[start.valueOf()] || {};\n tasks = cell.tasks || [];\n assignments = cell.assignments || [];\n\n if (tasks.length || config.resource_render_empty_cells) {\n timetable.push({\n start_date: start,\n end_date: end,\n tasks: tasks,\n assignments: assignments\n });\n } else {\n timetable.push(null);\n }\n }\n\n return timetable;\n }\n\n return getResourceLoad;\n};","var __extends = require(\"../../../utils/extends\"),\n domHelpers = require(\"../utils/dom_helpers\"),\n Cell = require(\"./cell\");\n\nvar Layout = function (_super) {\n \"use strict\";\n\n __extends(Layout, _super);\n\n function Layout(parent, config, factory) {\n var _this = _super.apply(this, arguments) || this;\n\n if (parent) _this.$root = true;\n\n _this._parseConfig(config);\n\n _this.$name = \"layout\";\n return _this;\n }\n\n Layout.prototype.destructor = function () {\n if (this.$container && this.$view) {\n domHelpers.removeNode(this.$view);\n }\n\n for (var i = 0; i < this.$cells.length; i++) {\n var child = this.$cells[i];\n child.destructor();\n }\n\n this.$cells = [];\n\n _super.prototype.destructor.call(this);\n };\n\n Layout.prototype._resizeScrollbars = function (autosize, scrollbars) {\n var scrollChanged = false;\n var visibleScrollbars = [],\n hiddenScrollbars = [];\n\n function showScrollbar(scrollbar) {\n scrollbar.$parent.show();\n scrollChanged = true;\n visibleScrollbars.push(scrollbar);\n }\n\n function hideScrollbar(scrollbar) {\n scrollbar.$parent.hide();\n scrollChanged = true;\n hiddenScrollbars.push(scrollbar);\n }\n\n var scrollbar;\n\n for (var i = 0; i < scrollbars.length; i++) {\n scrollbar = scrollbars[i];\n\n if (autosize[scrollbar.$config.scroll]) {\n hideScrollbar(scrollbar);\n } else if (scrollbar.shouldHide()) {\n hideScrollbar(scrollbar);\n } else if (scrollbar.shouldShow()) {\n showScrollbar(scrollbar);\n } else {\n if (scrollbar.isVisible()) {\n visibleScrollbars.push(scrollbar);\n } else {\n hiddenScrollbars.push(scrollbar);\n }\n }\n }\n\n var visibleGroups = {};\n\n for (var i = 0; i < visibleScrollbars.length; i++) {\n if (visibleScrollbars[i].$config.group) {\n visibleGroups[visibleScrollbars[i].$config.group] = true;\n }\n }\n\n for (var i = 0; i < hiddenScrollbars.length; i++) {\n scrollbar = hiddenScrollbars[i];\n\n if (scrollbar.$config.group && visibleGroups[scrollbar.$config.group]) {\n showScrollbar(scrollbar); // GS-707 If the scrollbar was hidden then showed, the container resize shouldn't happen because of that\n\n for (var j = 0; j < visibleScrollbars.length; j++) {\n if (visibleScrollbars[j] == scrollbar) {\n this.$gantt.$scrollbarRepaint = true;\n break;\n }\n }\n }\n }\n\n return scrollChanged;\n };\n\n Layout.prototype._syncCellSizes = function (groupName, newSize) {\n if (!groupName) return;\n var groups = {};\n\n this._eachChild(function (cell) {\n if (cell.$config.group && cell.$name != \"scrollbar\" && cell.$name != \"resizer\") {\n if (!groups[cell.$config.group]) {\n groups[cell.$config.group] = [];\n }\n\n groups[cell.$config.group].push(cell);\n }\n });\n\n if (groups[groupName]) {\n this._syncGroupSize(groups[groupName], newSize);\n }\n\n return groups[groupName];\n };\n\n Layout.prototype._syncGroupSize = function (cells, newSize) {\n if (!cells.length) return;\n var property = cells[0].$parent._xLayout ? \"width\" : \"height\";\n var direction = cells[0].$parent.getNextSibling(cells[0].$id) ? 1 : -1;\n var newSizeValue = newSize.value;\n var isGravity = newSize.isGravity;\n\n for (var i = 0; i < cells.length; i++) {\n var ownSize = cells[i].getSize();\n var resizeSibling = direction > 0 ? cells[i].$parent.getNextSibling(cells[i].$id) : cells[i].$parent.getPrevSibling(cells[i].$id);\n\n if (resizeSibling.$name == \"resizer\") {\n resizeSibling = direction > 0 ? resizeSibling.$parent.getNextSibling(resizeSibling.$id) : resizeSibling.$parent.getPrevSibling(resizeSibling.$id);\n }\n\n var siblingSize = resizeSibling.getSize();\n\n if (!isGravity) {\n if (resizeSibling[property]) {\n var totalGravity = ownSize.gravity + siblingSize.gravity;\n var totalSize = ownSize[property] + siblingSize[property];\n var k = totalGravity / totalSize;\n cells[i].$config.gravity = k * newSizeValue;\n resizeSibling.$config[property] = totalSize - newSizeValue;\n resizeSibling.$config.gravity = totalGravity - k * newSizeValue;\n } else {\n cells[i].$config[property] = newSizeValue;\n }\n } else {\n cells[i].$config.gravity = newSizeValue;\n }\n\n var mainGrid = this.$gantt.$ui.getView(\"grid\");\n\n if (mainGrid && cells[i].$content === mainGrid && !mainGrid.$config.scrollable && !isGravity) {\n this.$gantt.config.grid_width = newSizeValue;\n }\n }\n };\n\n Layout.prototype.resize = function (startStage) {\n var mainCall = false;\n\n if (this.$root && !this._resizeInProgress) {\n this.callEvent(\"onBeforeResize\", []);\n mainCall = true;\n this._resizeInProgress = true;\n }\n\n _super.prototype.resize.call(this, true);\n\n _super.prototype.resize.call(this, false);\n\n if (mainCall) {\n var contentViews = [];\n contentViews = contentViews.concat(this.getCellsByType(\"viewCell\"));\n contentViews = contentViews.concat(this.getCellsByType(\"viewLayout\"));\n contentViews = contentViews.concat(this.getCellsByType(\"hostCell\"));\n var scrollbars = this.getCellsByType(\"scroller\");\n\n for (var i = 0; i < contentViews.length; i++) {\n if (!contentViews[i].$config.hidden) contentViews[i].setContentSize();\n }\n\n var autosize = this._getAutosizeMode(this.$config.autosize);\n /* // possible to rollback set content size when autisize is disabled, not sure if need to\r\n \t\tcontentViews.forEach(function(view){\r\n \t\t\tconst parent = view.$parent;\r\n \t\t\tif(!autosize.x){\r\n \t\t\t\tif(parent.$config.$originalWidthStored){\r\n \t\t\t\t\tparent.$config.$originalWidthStored = false;\r\n \t\t\t\t\tparent.$config.width = parent.$config.$originalWidth;\r\n \t\t\t\t\tparent.$config.$originalWidth = undefined;\r\n \t\t\t\t}\r\n \t\t\t}\r\n \n \t\t\tif(!autosize.y){\r\n \t\t\t\tif(parent.$config.$originalHeightStored){\r\n \t\t\t\t\tparent.$config.$originalHeightStored = false;\r\n \t\t\t\t\tparent.$config.height = parent.$config.$originalHeight;\r\n \t\t\t\t\tparent.$config.$originalHeight = undefined;\r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\t});*/\n\n\n var scrollChanged = this._resizeScrollbars(autosize, scrollbars);\n\n if (this.$config.autosize) {\n this.autosize(this.$config.autosize);\n contentViews.forEach(function (view) {\n var parent = view.$parent;\n var sizes = parent.getContentSize(autosize);\n\n if (autosize.x) {\n if (!parent.$config.$originalWidthStored) {\n parent.$config.$originalWidthStored = true;\n parent.$config.$originalWidth = parent.$config.width;\n }\n\n parent.$config.width = sizes.width;\n }\n\n if (autosize.y) {\n if (!parent.$config.$originalHeightStored) {\n parent.$config.$originalHeightStored = true;\n parent.$config.$originalHeight = parent.$config.height;\n }\n\n parent.$config.height = sizes.height;\n }\n });\n scrollChanged = true;\n }\n\n if (scrollChanged) {\n this.resize();\n\n for (var i = 0; i < contentViews.length; i++) {\n if (!contentViews[i].$config.hidden) contentViews[i].setContentSize();\n }\n }\n\n this.callEvent(\"onResize\", []);\n }\n\n if (mainCall) {\n this._resizeInProgress = false;\n }\n };\n\n Layout.prototype._eachChild = function (code, cell) {\n cell = cell || this;\n code(cell);\n\n if (cell.$cells) {\n for (var i = 0; i < cell.$cells.length; i++) {\n this._eachChild(code, cell.$cells[i]);\n }\n }\n };\n\n Layout.prototype.isChild = function (view) {\n var res = false;\n\n this._eachChild(function (child) {\n if (child === view || child.$content === view) {\n res = true;\n }\n });\n\n return res;\n };\n\n Layout.prototype.getCellsByType = function (type) {\n var res = [];\n\n if (type === this.$name) {\n res.push(this);\n }\n\n if (this.$content && this.$content.$name == type) {\n res.push(this.$content);\n }\n\n if (this.$cells) {\n for (var i = 0; i < this.$cells.length; i++) {\n var children = Layout.prototype.getCellsByType.call(this.$cells[i], type);\n\n if (children.length) {\n res.push.apply(res, children);\n }\n }\n }\n\n return res;\n };\n\n Layout.prototype.getNextSibling = function (cellId) {\n var index = this.cellIndex(cellId);\n\n if (index >= 0 && this.$cells[index + 1]) {\n return this.$cells[index + 1];\n } else {\n return null;\n }\n };\n\n Layout.prototype.getPrevSibling = function (cellId) {\n var index = this.cellIndex(cellId);\n\n if (index >= 0 && this.$cells[index - 1]) {\n return this.$cells[index - 1];\n } else {\n return null;\n }\n };\n\n Layout.prototype.cell = function (id) {\n for (var i = 0; i < this.$cells.length; i++) {\n var child = this.$cells[i];\n\n if (child.$id === id) {\n return child;\n }\n\n var sub = child.cell(id);\n\n if (sub) {\n return sub;\n }\n }\n };\n\n Layout.prototype.cellIndex = function (id) {\n for (var i = 0; i < this.$cells.length; i++) {\n if (this.$cells[i].$id === id) {\n return i;\n }\n }\n\n return -1;\n };\n\n Layout.prototype.moveView = function (view, ind) {\n if (this.$cells[ind] !== view) {\n return window.alert(\"Not implemented\");\n } else {\n ind += this.$config.header ? 1 : 0;\n var node = this.$view;\n\n if (ind >= node.childNodes.length) {\n node.appendChild(view.$view);\n } else {\n node.insertBefore(view.$view, node.childNodes[ind]);\n }\n }\n };\n\n Layout.prototype._parseConfig = function (config) {\n this.$cells = [];\n this._xLayout = !config.rows;\n var cells = config.rows || config.cols || config.views;\n\n for (var i = 0; i < cells.length; i++) {\n var cell = cells[i];\n cell.mode = this._xLayout ? \"x\" : \"y\";\n var $content = this.$factory.initUI(cell, this);\n\n if (!$content) {\n cells.splice(i, 1);\n i--;\n } else {\n $content.$parent = this;\n this.$cells.push($content);\n }\n }\n };\n\n Layout.prototype.getCells = function () {\n return this.$cells;\n };\n\n Layout.prototype.render = function () {\n var view = domHelpers.insertNode(this.$container, this.$toHTML());\n this.$fill(view, null);\n this.callEvent(\"onReady\", []);\n this.resize(); // do simple repaint after the first call\n\n this.render = this.resize;\n };\n\n Layout.prototype.$fill = function (node, parent) {\n this.$view = node;\n this.$parent = parent;\n var cells = domHelpers.getChildNodes(node, \"gantt_layout_cell\");\n\n for (var i = cells.length - 1; i >= 0; i--) {\n var sub = this.$cells[i];\n sub.$fill(cells[i], this); // initially hidden cell\n\n if (sub.$config.hidden) {\n sub.$view.parentNode.removeChild(sub.$view);\n }\n }\n };\n\n Layout.prototype.$toHTML = function () {\n var mode = this._xLayout ? \"x\" : \"y\";\n var html = [];\n\n for (var i = 0; i < this.$cells.length; i++) {\n html.push(this.$cells[i].$toHTML());\n }\n\n return _super.prototype.$toHTML.call(this, html.join(\"\"), (this.$root ? \"gantt_layout_root \" : \"\") + \"gantt_layout gantt_layout_\" + mode);\n };\n\n Layout.prototype.getContentSize = function (mode) {\n var contentWidth = 0,\n contentHeight = 0;\n var cellSize, cell, borders;\n\n for (var i = 0; i < this.$cells.length; i++) {\n cell = this.$cells[i];\n if (cell.$config.hidden) continue;\n cellSize = cell.getContentSize(mode);\n\n if (cell.$config.view === \"scrollbar\" && mode[cell.$config.scroll]) {\n cellSize.height = 0;\n cellSize.width = 0;\n }\n\n if (cell.$config.resizer) {\n if (this._xLayout) {\n cellSize.height = 0;\n } else {\n cellSize.width = 0;\n }\n }\n\n borders = cell._getBorderSizes();\n\n if (this._xLayout) {\n contentWidth += cellSize.width + borders.horizontal;\n contentHeight = Math.max(contentHeight, cellSize.height + borders.vertical);\n } else {\n contentWidth = Math.max(contentWidth, cellSize.width + borders.horizontal);\n contentHeight += cellSize.height + borders.vertical;\n }\n }\n\n borders = this._getBorderSizes();\n contentWidth += borders.horizontal;\n contentHeight += borders.vertical; // GS-149 & GS-150: By default this code only increases the container sizes, because of that, the cell sizes\n // are also increased. Keep this code here in the case if something goes wrong\n\n /*\r\n if(this.$root){\r\n \tcontentWidth += 1;\r\n \tcontentHeight += 1;\r\n }\r\n */\n\n return {\n width: contentWidth,\n height: contentHeight\n };\n };\n\n Layout.prototype._cleanElSize = function (value) {\n return (value || \"\").toString().replace(\"px\", \"\") * 1 || 0;\n };\n\n Layout.prototype._getBoxStyles = function (div) {\n var computed = null;\n\n if (window.getComputedStyle) {\n computed = window.getComputedStyle(div, null);\n } else {\n //IE with elem.currentStyle does not calculate sizes from %, so will use the default approach\n computed = {\n \"width\": div.clientWidth,\n \"height\": div.clientHeight\n };\n }\n\n var properties = [\"width\", \"height\", \"paddingTop\", \"paddingBottom\", \"paddingLeft\", \"paddingRight\", \"borderLeftWidth\", \"borderRightWidth\", \"borderTopWidth\", \"borderBottomWidth\"];\n var styles = {\n boxSizing: computed.boxSizing == \"border-box\"\n };\n\n if (computed.MozBoxSizing) {\n styles.boxSizing = computed.MozBoxSizing == \"border-box\";\n }\n\n for (var i = 0; i < properties.length; i++) {\n styles[properties[i]] = computed[properties[i]] ? this._cleanElSize(computed[properties[i]]) : 0;\n }\n\n var box = {\n horPaddings: styles.paddingLeft + styles.paddingRight + styles.borderLeftWidth + styles.borderRightWidth,\n vertPaddings: styles.paddingTop + styles.paddingBottom + styles.borderTopWidth + styles.borderBottomWidth,\n borderBox: styles.boxSizing,\n innerWidth: styles.width,\n innerHeight: styles.height,\n outerWidth: styles.width,\n outerHeight: styles.height\n };\n\n if (box.borderBox) {\n box.innerWidth -= box.horPaddings;\n box.innerHeight -= box.vertPaddings;\n } else {\n box.outerWidth += box.horPaddings;\n box.outerHeight += box.vertPaddings;\n }\n\n return box;\n };\n\n Layout.prototype._getAutosizeMode = function (config) {\n var res = {\n x: false,\n y: false\n };\n\n if (config === \"xy\") {\n res.x = res.y = true;\n } else if (config === \"y\" || config === true) {\n res.y = true;\n } else if (config === \"x\") {\n res.x = true;\n }\n\n return res;\n };\n\n Layout.prototype.autosize = function (mode) {\n var res = this._getAutosizeMode(mode);\n\n var boxSizes = this._getBoxStyles(this.$container);\n\n var contentSizes = this.getContentSize(mode);\n var node = this.$container;\n\n if (res.x) {\n if (boxSizes.borderBox) {\n contentSizes.width += boxSizes.horPaddings;\n }\n\n node.style.width = contentSizes.width + \"px\";\n }\n\n if (res.y) {\n if (boxSizes.borderBox) {\n contentSizes.height += boxSizes.vertPaddings;\n }\n\n node.style.height = contentSizes.height + \"px\";\n }\n };\n\n Layout.prototype.getSize = function () {\n this._sizes = [];\n var width = 0;\n var minWidth = 0;\n var maxWidth = 100000000000;\n var height = 0;\n var maxHeight = 100000000000;\n var minHeight = 0;\n\n for (var i = 0; i < this.$cells.length; i++) {\n var size = this._sizes[i] = this.$cells[i].getSize();\n\n if (this.$cells[i].$config.hidden) {\n continue;\n }\n\n if (this._xLayout) {\n if (!size.width && size.minWidth) {\n width += size.minWidth;\n } else {\n width += size.width;\n }\n\n maxWidth += size.maxWidth;\n minWidth += size.minWidth;\n height = Math.max(height, size.height);\n maxHeight = Math.min(maxHeight, size.maxHeight); // min of maxHeight\n\n minHeight = Math.max(minHeight, size.minHeight); // max of minHeight\n } else {\n if (!size.height && size.minHeight) {\n height += size.minHeight;\n } else {\n height += size.height;\n }\n\n maxHeight += size.maxHeight;\n minHeight += size.minHeight;\n width = Math.max(width, size.width);\n maxWidth = Math.min(maxWidth, size.maxWidth); // min of maxWidth\n\n minWidth = Math.max(minWidth, size.minWidth); // max of minWidth\n }\n }\n\n var self = _super.prototype.getSize.call(this); // maxWidth\n\n\n if (self.maxWidth >= 100000) {\n self.maxWidth = maxWidth;\n } // maxHeight\n\n\n if (self.maxHeight >= 100000) {\n self.maxHeight = maxHeight;\n } // minWidth\n\n\n self.minWidth = self.minWidth !== self.minWidth ? 0 : self.minWidth; // || self.width || Math.max(minWidth, width);\n // minHeight\n\n self.minHeight = self.minHeight !== self.minHeight ? 0 : self.minHeight; //self.minHeight || self.height || Math.max(minHeight, height);\n // sizes with paddings and margins\n\n if (this._xLayout) {\n self.minWidth += this.$config.margin * this.$cells.length || 0;\n self.minWidth += this.$config.padding * 2 || 0;\n self.minHeight += this.$config.padding * 2 || 0;\n } else {\n self.minHeight += this.$config.margin * this.$cells.length || 0;\n self.minHeight += this.$config.padding * 2 || 0;\n }\n\n return self;\n }; // calc total gravity and free space\n\n\n Layout.prototype._calcFreeSpace = function (s, cell, xLayout) {\n var min = xLayout ? cell.minWidth : cell.minHeight;\n var max = xLayout ? cell.maxWidth : cell.maxWidth;\n var side = s;\n\n if (!side) {\n side = Math.floor(this._free / this._gravity * cell.gravity);\n\n if (side > max) {\n side = max;\n this._free -= side;\n this._gravity -= cell.gravity;\n }\n\n if (side < min) {\n side = min;\n this._free -= side;\n this._gravity -= cell.gravity;\n }\n } else {\n if (side > max) {\n side = max;\n }\n\n if (side < min) {\n side = min;\n }\n\n this._free -= side;\n }\n\n return side;\n };\n\n Layout.prototype._calcSize = function (s, size, xLayout) {\n var side = s;\n var min = xLayout ? size.minWidth : size.minHeight;\n var max = xLayout ? size.maxWidth : size.maxHeight;\n\n if (!side) {\n side = Math.floor(this._free / this._gravity * size.gravity);\n }\n\n if (side > max) {\n side = max;\n }\n\n if (side < min) {\n side = min;\n }\n\n return side;\n };\n\n Layout.prototype._configureBorders = function () {\n if (this.$root) {\n this._setBorders([this._borders.left, this._borders.top, this._borders.right, this._borders.bottom], this);\n }\n\n var borderClass = this._xLayout ? this._borders.right : this._borders.bottom;\n var cells = this.$cells;\n var lastVisibleIndex = cells.length - 1;\n\n for (var i = lastVisibleIndex; i >= 0; i--) {\n if (!cells[i].$config.hidden) {\n lastVisibleIndex = i;\n break;\n }\n }\n\n for (var i = 0; i < cells.length; i++) {\n if (cells[i].$config.hidden) {\n continue;\n }\n\n var lastCell = i >= lastVisibleIndex;\n var borderColorClass = \"\";\n\n if (!lastCell && cells[i + 1]) {\n if (cells[i + 1].$config.view == \"scrollbar\") {\n if (this._xLayout) {\n lastCell = true;\n } else {\n borderColorClass = \"gantt_layout_cell_border_transparent\";\n }\n }\n }\n\n this._setBorders(lastCell ? [] : [borderClass, borderColorClass], cells[i]);\n }\n };\n\n Layout.prototype._updateCellVisibility = function () {\n var oldVisibleCells = this._visibleCells || {};\n var firstCall = !this._visibleCells;\n var visibleCells = {};\n var cell = null;\n var parentVisibility = [];\n\n for (var i = 0; i < this._sizes.length; i++) {\n cell = this.$cells[i];\n\n if (cell.$config.hide_empty) {\n parentVisibility.push(cell);\n }\n\n if (!firstCall && cell.$config.hidden && oldVisibleCells[cell.$id]) {\n cell._hide(true);\n } else if (!cell.$config.hidden && !oldVisibleCells[cell.$id]) {\n cell._hide(false);\n }\n\n if (!cell.$config.hidden) {\n visibleCells[cell.$id] = true;\n }\n }\n\n this._visibleCells = visibleCells; // GS-27. A way to hide the whole cell if all its children are hidden\n\n for (var i = 0; i < parentVisibility.length; i++) {\n var cell = parentVisibility[i];\n var children = cell.$cells;\n var hideCell = true;\n children.forEach(function (child) {\n if (!child.$config.hidden && !child.$config.resizer) {\n hideCell = false;\n }\n });\n cell.$config.hidden = hideCell;\n }\n };\n\n Layout.prototype.setSize = function (x, y) {\n this._configureBorders();\n\n _super.prototype.setSize.call(this, x, y);\n\n y = this.$lastSize.contentY;\n x = this.$lastSize.contentX;\n var padding = this.$config.padding || 0;\n this.$view.style.padding = padding + \"px\";\n this._gravity = 0;\n this._free = this._xLayout ? x : y;\n this._free -= padding * 2; // calc all gravity\n\n var cell, size;\n\n this._updateCellVisibility();\n\n for (var i = 0; i < this._sizes.length; i++) {\n cell = this.$cells[i];\n\n if (cell.$config.hidden) {\n continue;\n }\n\n var margin = this.$config.margin || 0;\n\n if (cell.$name == \"resizer\" && !margin) {\n margin = -1;\n } // set margins to child cell\n\n\n var cellView = cell.$view;\n var marginSide = this._xLayout ? \"marginRight\" : \"marginBottom\";\n\n if (i !== this.$cells.length - 1) {\n cellView.style[marginSide] = margin + \"px\";\n this._free -= margin; // calc free space without margin\n }\n\n size = this._sizes[i];\n\n if (this._xLayout) {\n if (!size.width) {\n this._gravity += size.gravity;\n }\n } else {\n if (!size.height) {\n this._gravity += size.gravity;\n }\n }\n }\n\n for (var i = 0; i < this._sizes.length; i++) {\n cell = this.$cells[i];\n\n if (cell.$config.hidden) {\n continue;\n }\n\n size = this._sizes[i];\n var width = size.width;\n var height = size.height;\n\n if (this._xLayout) {\n this._calcFreeSpace(width, size, true);\n } else {\n this._calcFreeSpace(height, size, false);\n }\n }\n\n for (var i = 0; i < this.$cells.length; i++) {\n cell = this.$cells[i];\n\n if (cell.$config.hidden) {\n continue;\n }\n\n size = this._sizes[i];\n var dx = void 0;\n var dy = void 0;\n\n if (this._xLayout) {\n dx = this._calcSize(size.width, size, true);\n dy = y - padding * 2; // layout height without paddings\n } else {\n dx = x - padding * 2; // layout width without paddings\n\n dy = this._calcSize(size.height, size, false);\n }\n\n cell.setSize(dx, dy);\n }\n };\n\n return Layout;\n}(Cell);\n\nmodule.exports = Layout;","// optimized checker for links smart rendering\n// first check the vertical position since it's easier to calculate\nmodule.exports = function isLinkInViewPort(item, viewport, view, config, gantt) {\n var source = view.$gantt.getTask(item.source);\n var target = view.$gantt.getTask(item.target); // check vertical visibility first since it's a lighter check\n\n var sourceTop = view.getItemTop(source.id);\n var sourceHeight = view.getItemHeight(source.id);\n var targetTop = view.getItemTop(target.id);\n var targetHeight = view.getItemHeight(target.id);\n\n if (viewport.y > sourceTop + sourceHeight && viewport.y > targetTop + targetHeight) {\n return false;\n }\n\n if (viewport.y_end < targetTop && viewport.y_end < sourceTop) {\n return false;\n }\n\n var padding = 100;\n var sourceLeft = view.posFromDate(source.start_date);\n var sourceRight = view.posFromDate(source.end_date);\n var targetLeft = view.posFromDate(target.start_date);\n var targetRight = view.posFromDate(target.end_date);\n\n if (sourceLeft > sourceRight) {\n // rtl\n var tmp = sourceRight;\n sourceRight = sourceLeft;\n sourceLeft = tmp;\n }\n\n if (targetLeft > targetRight) {\n // rtl\n var tmp = targetRight;\n targetRight = targetLeft;\n targetLeft = tmp;\n }\n\n sourceLeft += -padding; // add buffer for custom elements\n\n sourceRight += padding;\n targetLeft += -padding; // add buffer for custom elements\n\n targetRight += padding;\n\n if (viewport.x > sourceRight && viewport.x > targetRight) {\n return false;\n }\n\n if (viewport.x_end < sourceLeft && viewport.x_end < targetLeft) {\n return false;\n }\n\n return true;\n};","var getLinkRectangle = require(\"./get_link_rectangle\");\n\nmodule.exports = function () {\n var coordinates = [];\n var calculated = false;\n\n function clearCache() {\n coordinates = [];\n calculated = false;\n }\n\n function buildCache(datastore, view, gantt) {\n var config = view.$getConfig();\n var visibleItems = datastore.getVisibleItems(); //datastore.eachItem(function(link){\n\n visibleItems.forEach(function (link) {\n var rec = getLinkRectangle(link, view, config, gantt);\n\n if (!rec) {\n return;\n }\n\n coordinates.push({\n id: link.id,\n rec: rec\n });\n });\n coordinates.sort(function (a, b) {\n if (a.rec.right < b.rec.right) {\n return -1;\n } else {\n return 1;\n }\n });\n calculated = true;\n }\n\n var initialized = false;\n\n function init(datastore) {\n if (initialized) {\n return;\n }\n\n initialized = true;\n datastore.attachEvent(\"onPreFilter\", clearCache);\n datastore.attachEvent(\"onStoreUpdated\", clearCache);\n datastore.attachEvent(\"onClearAll\", clearCache);\n datastore.attachEvent(\"onBeforeStoreUpdate\", clearCache);\n }\n\n return function getVisibleLinksRange(gantt, view, config, datastore, viewport) {\n init(datastore);\n\n if (!calculated) {\n buildCache(datastore, view, gantt);\n }\n\n var visibleBoxes = [];\n\n for (var i = 0; i < coordinates.length; i++) {\n var item = coordinates[i];\n var box = item.rec;\n\n if (box.right < viewport.x) {\n continue;\n }\n\n if (box.left < viewport.x_end && box.right > viewport.x && box.top < viewport.y_end && box.bottom > viewport.y) {\n visibleBoxes.push(item.id);\n }\n }\n\n return {\n ids: visibleBoxes\n };\n };\n};","import { IWorkUnitCache } from \"./workunit_cache_interface\";\r\nimport { WorkUnitsMapCache } from \"./workunit_map_cache\";\r\nimport { WorkUnitsObjectCache } from \"./workunit_object_cache\";\r\nexport { LargerUnitsCache } from \"./larger_units_helper\";\r\n\r\nexport function createCacheObject(): IWorkUnitCache {\r\n\r\n\t// worktime hash is on the hot path,\r\n\t// Map seems to work faster than plain array, use it whenever possible\r\n\tif (typeof Map !== \"undefined\") {\r\n\t\treturn new WorkUnitsMapCache();\r\n\t} else {\r\n\t\treturn new WorkUnitsObjectCache();\r\n\t}\r\n}\r\n","var utils = require(\"../../utils/utils\");\n\nvar helpers = require(\"../../utils/helpers\");\n\nfunction IsWorkTimeArgument(date, unit, task, id, calendar) {\n this.date = date;\n this.unit = unit;\n this.task = task;\n this.id = id;\n this.calendar = calendar;\n return this;\n}\n\nfunction ClosestWorkTimeArgument(date, dir, unit, task, id, calendar) {\n this.date = date;\n this.dir = dir;\n this.unit = unit;\n this.task = task;\n this.id = id;\n this.calendar = calendar;\n return this;\n}\n\nfunction CalculateEndDateArgument(start_date, duration, unit, step, task, id, calendar) {\n this.start_date = start_date;\n this.duration = duration;\n this.unit = unit;\n this.step = step;\n this.task = task;\n this.id = id;\n this.calendar = calendar;\n return this;\n}\n\nfunction GetDurationArgument(start, end, task, calendar) {\n this.start_date = start;\n this.end_date = end;\n this.task = task;\n this.calendar = calendar;\n this.unit = null;\n this.step = null;\n return this;\n}\n\nvar calendarArgumentsHelper = function calendarArgumentsHelper(gantt) {\n return {\n getWorkHoursArguments: function getWorkHoursArguments() {\n var config = arguments[0];\n\n if (helpers.isDate(config)) {\n config = {\n date: config\n };\n } else {\n config = utils.mixin({}, config);\n }\n\n if (!helpers.isValidDate(config.date)) {\n gantt.assert(false, \"Invalid date argument for getWorkHours method\");\n throw new Error(\"Invalid date argument for getWorkHours method\");\n }\n\n return config;\n },\n setWorkTimeArguments: function setWorkTimeArguments() {\n return arguments[0];\n },\n unsetWorkTimeArguments: function unsetWorkTimeArguments() {\n return arguments[0];\n },\n isWorkTimeArguments: function isWorkTimeArguments() {\n var config = arguments[0];\n\n if (config instanceof IsWorkTimeArgument) {\n return config;\n }\n\n var processedConfig;\n\n if (!config.date) {\n //IsWorkTimeArgument(date, unit, task, id, calendar)\n processedConfig = new IsWorkTimeArgument(arguments[0], arguments[1], arguments[2], null, arguments[3]);\n } else {\n processedConfig = new IsWorkTimeArgument(config.date, config.unit, config.task, null, config.calendar);\n }\n\n processedConfig.unit = processedConfig.unit || gantt.config.duration_unit;\n\n if (!helpers.isValidDate(processedConfig.date)) {\n gantt.assert(false, \"Invalid date argument for isWorkTime method\");\n throw new Error(\"Invalid date argument for isWorkTime method\");\n }\n\n return processedConfig;\n },\n getClosestWorkTimeArguments: function getClosestWorkTimeArguments(arg) {\n var config = arguments[0];\n if (config instanceof ClosestWorkTimeArgument) return config;\n var processedConfig;\n\n if (helpers.isDate(config)) {\n processedConfig = new ClosestWorkTimeArgument(config);\n } else {\n processedConfig = new ClosestWorkTimeArgument(config.date, config.dir, config.unit, config.task, null, //config.id,\n config.calendar);\n }\n\n if (config.id) {\n processedConfig.task = config;\n }\n\n processedConfig.dir = config.dir || 'any';\n processedConfig.unit = config.unit || gantt.config.duration_unit;\n\n if (!helpers.isValidDate(processedConfig.date)) {\n gantt.assert(false, \"Invalid date argument for getClosestWorkTime method\");\n throw new Error(\"Invalid date argument for getClosestWorkTime method\");\n }\n\n return processedConfig;\n },\n _getStartEndConfig: function _getStartEndConfig(param) {\n var argumentType = GetDurationArgument;\n var config;\n if (param instanceof argumentType) return param;\n\n if (helpers.isDate(param)) {\n config = new argumentType(arguments[0], arguments[1], arguments[2], arguments[3]);\n } else {\n config = new argumentType(param.start_date, param.end_date, param.task);\n\n if (param.id !== null && param.id !== undefined) {\n config.task = param;\n }\n }\n\n config.unit = config.unit || gantt.config.duration_unit;\n config.step = config.step || gantt.config.duration_step;\n config.start_date = config.start_date || config.start || config.date;\n\n if (!helpers.isValidDate(config.start_date)) {\n gantt.assert(false, \"Invalid start_date argument for getDuration method\");\n throw new Error(\"Invalid start_date argument for getDuration method\");\n }\n\n if (!helpers.isValidDate(config.end_date)) {\n gantt.assert(false, \"Invalid end_date argument for getDuration method\");\n throw new Error(\"Invalid end_date argument for getDuration method\");\n }\n\n return config;\n },\n getDurationArguments: function getDurationArguments(start, end, unit, step) {\n return this._getStartEndConfig.apply(this, arguments);\n },\n hasDurationArguments: function hasDurationArguments(start, end, unit, step) {\n return this._getStartEndConfig.apply(this, arguments);\n },\n calculateEndDateArguments: function calculateEndDateArguments(start, duration, unit, step) {\n var config = arguments[0];\n if (config instanceof CalculateEndDateArgument) return config;\n var processedConfig; //CalculateEndDateArgument(start_date, duration, unit, step, task, id, calendar)\n\n if (helpers.isDate(config)) {\n processedConfig = new CalculateEndDateArgument(arguments[0], arguments[1], arguments[2], undefined, arguments[3], undefined, arguments[4]);\n } else {\n processedConfig = new CalculateEndDateArgument(config.start_date, config.duration, config.unit, config.step, config.task, null, //config.id,\n config.calendar);\n }\n\n if (config.id !== null && config.id !== undefined) {\n processedConfig.task = config; // received a task object as an argument\n // ignore 'unit' and 'step' properties in this case, since it's likely a part of data model of a task\n\n processedConfig.unit = null;\n processedConfig.step = null;\n }\n\n processedConfig.unit = processedConfig.unit || gantt.config.duration_unit;\n processedConfig.step = processedConfig.step || gantt.config.duration_step;\n\n if (!helpers.isValidDate(processedConfig.start_date)) {\n gantt.assert(false, \"Invalid start_date argument for calculateEndDate method\");\n throw new Error(\"Invalid start_date argument for calculateEndDate method\");\n }\n\n return processedConfig;\n }\n };\n};\n\nmodule.exports = calendarArgumentsHelper;","var quickPositionHelperFactory = require(\"./row_position_fixed_height\");\n\nfunction createMixin(view) {\n var getItemTopCache = {};\n var getRowTopCache = {};\n var getItemHeightCache = null;\n var totalHeightCache = -1;\n var getItemHeightCacheState = null;\n var quickPosition = quickPositionHelperFactory(view);\n return {\n _resetTopPositionHeight: function _resetTopPositionHeight() {\n getItemTopCache = {};\n getRowTopCache = {};\n quickPosition.resetCache();\n },\n _resetHeight: function _resetHeight() {\n var store = this.$config.rowStore;\n var newState = this.getCacheStateTotalHeight(store);\n\n if (!getItemHeightCacheState) {\n getItemHeightCacheState = newState;\n } else if (this.shouldClearHeightCache(getItemHeightCacheState, newState)) {\n getItemHeightCacheState = newState;\n getItemHeightCache = null;\n }\n\n totalHeightCache = -1;\n quickPosition.resetCache();\n },\n\n /**\r\n * Get top coordinate by row index (order)\r\n * @param {number} index\r\n */\n getRowTop: function getRowTop(index) {\n if (quickPosition.canUseSimpleCalculation()) {\n return quickPosition.getRowTop(index);\n }\n\n var store = this.$config.rowStore;\n\n if (!store) {\n return 0;\n }\n\n if (getRowTopCache[index] !== undefined) {\n return getRowTopCache[index];\n } else {\n var all = store.getIndexRange();\n var top = 0;\n var result = 0;\n\n for (var i = 0; i < all.length; i++) {\n getRowTopCache[i] = top;\n top += this.getItemHeight(all[i].id);\n\n if (i < index) {\n result = top;\n }\n }\n\n return result;\n }\n },\n\n /**\r\n * Get top coordinate by item id\r\n * @param {*} task_id\r\n */\n getItemTop: function getItemTop(taskId) {\n if (this.$config.rowStore) {\n if (getItemTopCache[taskId] !== undefined) {\n return getItemTopCache[taskId];\n }\n\n var store = this.$config.rowStore;\n if (!store) return 0;\n var itemIndex = store.getIndexById(taskId);\n\n if (itemIndex === -1 && store.getParent && store.exists(taskId)) {\n var parentId = store.getParent(taskId);\n\n if (store.exists(parentId)) {\n // if task is not found in list - maybe it's parent is a split task and we should use parents index instead\n var parent = store.getItem(parentId);\n\n if (this.$gantt.isSplitTask(parent)) {\n return this.getItemTop(parentId);\n }\n }\n }\n\n getItemTopCache[taskId] = this.getRowTop(itemIndex);\n return getItemTopCache[taskId];\n } else {\n return 0;\n }\n },\n\n /**\r\n * Get height of the item by item id\r\n * @param {*} itemId\r\n */\n getItemHeight: function getItemHeight(itemId) {\n if (quickPosition.canUseSimpleCalculation()) {\n return quickPosition.getItemHeight(itemId);\n }\n\n if (!getItemHeightCache && this.$config.rowStore) {\n this._fillHeightCache(this.$config.rowStore);\n }\n\n if (getItemHeightCache[itemId] !== undefined) {\n return getItemHeightCache[itemId];\n }\n\n var defaultHeight = this.$getConfig().row_height;\n\n if (this.$config.rowStore) {\n var store = this.$config.rowStore;\n if (!store) return defaultHeight;\n var item = store.getItem(itemId);\n return getItemHeightCache[itemId] = item && item.row_height || defaultHeight;\n } else {\n return defaultHeight;\n }\n },\n _fillHeightCache: function _fillHeightCache(store) {\n if (!store) {\n return;\n }\n\n getItemHeightCache = {};\n var defaultHeight = this.$getConfig().row_height;\n store.eachItem(function (item) {\n return getItemHeightCache[item.id] = item && item.row_height || defaultHeight;\n });\n },\n getCacheStateTotalHeight: function getCacheStateTotalHeight(store) {\n var globalHeight = this.$getConfig().row_height;\n var itemHeightCache = {};\n var items = [];\n var sumHeight = 0;\n\n if (store) {\n store.eachItem(function (item) {\n items.push(item);\n itemHeightCache[item.id] = item.row_height;\n sumHeight += item.row_height || globalHeight;\n });\n }\n\n return {\n globalHeight: globalHeight,\n items: items,\n count: items.length,\n sumHeight: sumHeight\n };\n },\n shouldClearHeightCache: function shouldClearHeightCache(oldState, newState) {\n if (oldState.count != newState.count) {\n return true;\n }\n\n if (oldState.globalHeight != newState.globalHeight) {\n return true;\n }\n\n if (oldState.sumHeight != newState.sumHeight) {\n return true;\n }\n\n for (var i in oldState.items) {\n var newValue = newState.items[i];\n\n if (newValue !== undefined && newValue != oldState.items[i]) {\n return true;\n }\n }\n\n return false;\n },\n\n /**\r\n * Get total height of items\r\n */\n getTotalHeight: function getTotalHeight() {\n if (quickPosition.canUseSimpleCalculation()) {\n return quickPosition.getTotalHeight();\n }\n\n if (totalHeightCache != -1) {\n return totalHeightCache;\n }\n\n if (this.$config.rowStore) {\n var store = this.$config.rowStore;\n\n this._fillHeightCache(store);\n\n var getHeight = this.getItemHeight.bind(this);\n var visibleItems = store.getVisibleItems();\n var totalHeight = 0;\n visibleItems.forEach(function (item) {\n totalHeight += getHeight(item.id);\n });\n totalHeightCache = totalHeight;\n return totalHeight;\n } else {\n return 0;\n }\n },\n\n /**\r\n * Get item by top position\r\n * @param {*} top\r\n */\n getItemIndexByTopPosition: function getItemIndexByTopPosition(top) {\n if (this.$config.rowStore) {\n if (quickPosition.canUseSimpleCalculation()) {\n return quickPosition.getItemIndexByTopPosition(top);\n }\n\n var store = this.$config.rowStore;\n\n for (var i = 0; i < store.countVisible(); i++) {\n var current = this.getRowTop(i);\n var next = this.getRowTop(i + 1);\n\n if (!next) {\n var taskId = store.getIdByIndex(i);\n next = current + this.getItemHeight(taskId);\n }\n\n if (top >= current && top < next) {\n return i;\n }\n } // GS-1723: If we iterated all tasks and didn't find the position, the target is below all other tasks\n\n\n return store.countVisible() + 2;\n } else {\n return 0;\n }\n }\n };\n}\n\nmodule.exports = createMixin;","export default class DurationFormatterNumeric implements IDurationFormatter {\r\n\tstatic create = (settings: IDurationFormatterConfig = null): IDurationFormatter => {\r\n\t\treturn new DurationFormatterNumeric();\r\n\t}\r\n\tcanParse = (value: string) : boolean => {\r\n\t\treturn !isNaN(this.parse(value));\r\n\t}\r\n\tformat = (value: number) : string => {\r\n\t\treturn String(value);\r\n\t}\r\n\tparse = (value: string) : number => {\r\n\t\treturn parseInt(value, 10);\r\n\t}\r\n}","function copyLinkIdsArray(gantt, linkIds, targetHash) {\n for (var i = 0; i < linkIds.length; i++) {\n if (gantt.isLinkExists(linkIds[i])) {\n targetHash[linkIds[i]] = gantt.getLink(linkIds[i]);\n }\n }\n}\n\nfunction copyLinkIds(gantt, task, targetHash) {\n copyLinkIdsArray(gantt, task.$source, targetHash);\n copyLinkIdsArray(gantt, task.$target, targetHash);\n}\n\nfunction getSubtreeLinks(gantt, rootId) {\n var res = {};\n\n if (gantt.isTaskExists(rootId)) {\n copyLinkIds(gantt, gantt.getTask(rootId), res);\n }\n\n gantt.eachTask(function (child) {\n copyLinkIds(gantt, child, res);\n }, rootId);\n return res;\n}\n\nfunction getSubtreeTasks(gantt, rootId) {\n var res = {};\n gantt.eachTask(function (child) {\n res[child.id] = child;\n }, rootId);\n return res;\n}\n\nmodule.exports = {\n getSubtreeLinks: getSubtreeLinks,\n getSubtreeTasks: getSubtreeTasks\n};","var ScaleHelper = require(\"./ui/timeline/scales_ignore\");\n\nvar PrimaryScaleHelper = require(\"./ui/timeline/scales\");\n\nfunction resolveConfigRange(unit, gantt) {\n var range = {\n start_date: null,\n end_date: null\n };\n\n if (gantt.config.start_date && gantt.config.end_date) {\n range.start_date = gantt.date[unit + \"_start\"](new Date(gantt.config.start_date));\n var end = new Date(gantt.config.end_date);\n var start_interval = gantt.date[unit + \"_start\"](new Date(end));\n\n if (+end != +start_interval) {\n end = gantt.date.add(start_interval, 1, unit);\n } else {\n end = start_interval;\n }\n\n range.end_date = end;\n }\n\n return range;\n}\n\nfunction _scale_range_unit(gantt) {\n var primaryScale = new PrimaryScaleHelper(gantt).primaryScale();\n var unit = primaryScale.unit;\n var step = primaryScale.step;\n\n if (gantt.config.scale_offset_minimal) {\n var helper = new ScaleHelper(gantt);\n var scales = [helper.primaryScale()].concat(helper.getSubScales());\n helper.sortScales(scales);\n unit = scales[scales.length - 1].unit;\n step = scales[scales.length - 1].step || 1;\n }\n\n return {\n unit: unit,\n step: step\n };\n}\n\nfunction _init_tasks_range(gantt) {\n var cfg = _scale_range_unit(gantt);\n\n var unit = cfg.unit,\n step = cfg.step;\n var range = resolveConfigRange(unit, gantt); // GS-1544: Show correct date range if we have tasks or only projects\n\n if (!(range.start_date && range.end_date)) {\n var onlyProjectTasks = true;\n var tasks = gantt.getTaskByTime();\n\n for (var i = 0; i < tasks.length; i++) {\n var task = tasks[i];\n\n if (task.type !== gantt.config.types.project) {\n onlyProjectTasks = false;\n break;\n }\n }\n\n if (tasks.length && onlyProjectTasks) {\n var start_date = tasks[0].start_date;\n var end_date = gantt.date.add(start_date, 1, gantt.config.duration_unit);\n range = {\n start_date: new Date(start_date),\n end_date: new Date(end_date)\n };\n } else {\n range = gantt.getSubtaskDates();\n }\n\n if (!range.start_date || !range.end_date) {\n range = {\n start_date: new Date(),\n end_date: new Date()\n };\n }\n\n range.start_date = gantt.date[unit + \"_start\"](range.start_date);\n range.start_date = gantt.calculateEndDate({\n start_date: gantt.date[unit + \"_start\"](range.start_date),\n duration: -1,\n unit: unit,\n step: step\n }); //one free column before first task\n\n range.end_date = gantt.date[unit + \"_start\"](range.end_date);\n range.end_date = gantt.calculateEndDate({\n start_date: range.end_date,\n duration: 2,\n unit: unit,\n step: step\n }); //one free column after last task\n }\n\n gantt._min_date = range.start_date;\n gantt._max_date = range.end_date;\n}\n\nfunction _adjust_scales(gantt) {\n if (gantt.config.fit_tasks) {\n var old_min = +gantt._min_date,\n old_max = +gantt._max_date; //this._init_tasks_range();\n\n if (+gantt._min_date != old_min || +gantt._max_date != old_max) {\n gantt.render();\n gantt.callEvent(\"onScaleAdjusted\", []);\n return true;\n }\n }\n\n return false;\n}\n\nmodule.exports = function updateTasksRange(gantt) {\n _init_tasks_range(gantt);\n\n _adjust_scales(gantt);\n};","var powerArray = require(\"./power_array\");\n\nvar utils = require(\"../../utils/utils\");\n\nvar helpers = require(\"../../utils/helpers\");\n\nvar DataStore = require(\"./datastore\");\n\nvar isPlaceholderTask = require(\"../../utils/placeholder_task\");\n\nvar _require = require(\"../../utils/helpers\"),\n replaceValidZeroId = _require.replaceValidZeroId; // TODO: remove workaround for mixup with es5 and ts imports\n\n\nif (DataStore[\"default\"]) {\n DataStore = DataStore[\"default\"];\n}\n\nvar TreeDataStore = function TreeDataStore(config) {\n DataStore.apply(this, [config]);\n this._branches = {};\n this.pull = {}; //GS-761 Update existing item instead of adding it to the new position\n\n this.$initItem = function (item) {\n var loadedItem = item;\n\n if (config.initItem) {\n loadedItem = config.initItem(loadedItem);\n }\n\n var existingItem = this.getItem(item.id);\n\n if (existingItem && existingItem.parent != loadedItem.parent) {\n this.move(loadedItem.id, loadedItem.$index || -1, loadedItem.parent || this._ganttConfig.root_id);\n }\n\n return loadedItem;\n };\n\n this.$parentProperty = config.parentProperty || \"parent\";\n\n if (typeof config.rootId !== \"function\") {\n this.$getRootId = function (val) {\n return function () {\n return val;\n };\n }(config.rootId || 0);\n } else {\n this.$getRootId = config.rootId;\n } // TODO: replace with live reference to gantt config\n\n\n this.$openInitially = config.openInitially;\n this.visibleOrder = powerArray.$create();\n this.fullOrder = powerArray.$create();\n this._searchVisibleOrder = {};\n this._indexRangeCache = {};\n this._eachItemMainRangeCache = null;\n this._getItemsCache = null;\n this._skip_refresh = false;\n this._ganttConfig = null;\n\n if (config.getConfig) {\n this._ganttConfig = config.getConfig();\n }\n\n var splitParents = {};\n var splitItems = {};\n var taskOpenState = {};\n var taskVisibility = {};\n var haveSplitItems = false;\n\n this._attachDataChange(function () {\n this._indexRangeCache = {};\n this._eachItemMainRangeCache = null;\n this._getItemsCache = null;\n return true;\n });\n\n this.attachEvent(\"onPreFilter\", function () {\n this._indexRangeCache = {};\n this._eachItemMainRangeCache = null;\n splitParents = {};\n splitItems = {};\n taskOpenState = {};\n taskVisibility = {};\n haveSplitItems = false;\n this.eachItem(function (item) {\n var parent = this.getParent(item.id);\n\n if (item.$open && taskOpenState[parent] !== false) {\n taskOpenState[item.id] = true;\n } else {\n taskOpenState[item.id] = false;\n }\n\n if (this._isSplitItem(item)) {\n haveSplitItems = true;\n splitParents[item.id] = true;\n splitItems[item.id] = true;\n }\n\n if (haveSplitItems && splitItems[parent]) {\n splitItems[item.id] = true;\n }\n\n if (taskOpenState[parent] || taskOpenState[parent] === undefined) {\n taskVisibility[item.id] = true;\n } else {\n taskVisibility[item.id] = false;\n }\n });\n });\n this.attachEvent(\"onFilterItem\", function (id, item) {\n var canOpenSplitTasks = false;\n\n if (this._ganttConfig) {\n var canOpenSplitTasks = this._ganttConfig.open_split_tasks;\n }\n\n var open = taskVisibility[item.id];\n\n if (haveSplitItems) {\n if (open && splitItems[item.id] && !splitParents[item.id]) {\n open = !!canOpenSplitTasks;\n }\n\n if (splitItems[item.id] && !splitParents[item.id]) {\n item.$split_subtask = true;\n }\n }\n\n item.$expanded_branch = !!taskVisibility[item.id];\n return !!open;\n });\n this.attachEvent(\"onFilter\", function () {\n splitParents = {};\n splitItems = {};\n taskOpenState = {};\n taskVisibility = {};\n });\n return this;\n};\n\nTreeDataStore.prototype = utils.mixin({\n _buildTree: function _buildTree(data) {\n var item = null;\n var rootId = this.$getRootId();\n\n for (var i = 0, len = data.length; i < len; i++) {\n item = data[i];\n this.setParent(item, replaceValidZeroId(this.getParent(item), rootId) || rootId);\n } // calculating $level for each item\n\n\n for (var i = 0, len = data.length; i < len; i++) {\n item = data[i];\n\n this._add_branch(item);\n\n item.$level = this.calculateItemLevel(item);\n item.$local_index = this.getBranchIndex(item.id);\n\n if (!utils.defined(item.$open)) {\n item.$open = utils.defined(item.open) ? item.open : this.$openInitially();\n }\n }\n\n this._updateOrder();\n },\n _isSplitItem: function _isSplitItem(item) {\n return item.render == \"split\" && this.hasChild(item.id);\n },\n parse: function parse(data) {\n if (!this._skip_refresh) {\n this.callEvent(\"onBeforeParse\", [data]);\n }\n\n var loaded = this._parseInner(data);\n\n this._buildTree(loaded);\n\n this.filter();\n\n if (!this._skip_refresh) {\n this.callEvent(\"onParse\", [loaded]);\n }\n },\n _addItemInner: function _addItemInner(item, index) {\n var parent = this.getParent(item);\n\n if (!utils.defined(parent)) {\n parent = this.$getRootId();\n this.setParent(item, parent);\n }\n\n var parentIndex = this.getIndexById(parent);\n var targetIndex = parentIndex + Math.min(Math.max(index, 0), this.visibleOrder.length);\n\n if (targetIndex * 1 !== targetIndex) {\n targetIndex = undefined;\n }\n\n DataStore.prototype._addItemInner.call(this, item, targetIndex);\n\n this.setParent(item, parent);\n\n if (item.hasOwnProperty(\"$rendered_parent\")) {\n this._move_branch(item, item.$rendered_parent);\n }\n\n this._add_branch(item, index);\n },\n _changeIdInner: function _changeIdInner(oldId, newId) {\n var children = this.getChildren(oldId);\n var visibleOrder = this._searchVisibleOrder[oldId];\n\n DataStore.prototype._changeIdInner.call(this, oldId, newId);\n\n var parent = this.getParent(newId);\n\n this._replace_branch_child(parent, oldId, newId);\n\n if (this._branches[oldId]) {\n this._branches[newId] = this._branches[oldId];\n }\n\n for (var i = 0; i < children.length; i++) {\n var child = this.getItem(children[i]);\n child[this.$parentProperty] = newId;\n child.$rendered_parent = newId;\n }\n\n this._searchVisibleOrder[newId] = visibleOrder;\n delete this._branches[oldId];\n },\n _traverseBranches: function _traverseBranches(code, parent) {\n if (!utils.defined(parent)) {\n parent = this.$getRootId();\n }\n\n var branch = this._branches[parent];\n\n if (branch) {\n for (var i = 0; i < branch.length; i++) {\n var itemId = branch[i];\n code.call(this, itemId);\n if (this._branches[itemId]) this._traverseBranches(code, itemId);\n }\n }\n },\n _updateOrder: function _updateOrder(code) {\n this.fullOrder = powerArray.$create();\n\n this._traverseBranches(function (taskId) {\n this.fullOrder.push(taskId);\n });\n\n if (code) DataStore.prototype._updateOrder.call(this, code);\n },\n _removeItemInner: function _removeItemInner(id) {\n var items = [];\n this.eachItem(function (child) {\n items.push(child);\n }, id);\n items.push(this.getItem(id));\n\n for (var i = 0; i < items.length; i++) {\n this._move_branch(items[i], this.getParent(items[i]), null);\n\n DataStore.prototype._removeItemInner.call(this, items[i].id);\n\n this._move_branch(items[i], this.getParent(items[i]), null);\n }\n },\n move: function move(sid, tindex, parent) {\n //target id as 4th parameter\n var id = arguments[3];\n var config = this._ganttConfig || {};\n var root_id = config.root_id || 0;\n id = replaceValidZeroId(id, root_id);\n\n if (id) {\n if (id === sid) return;\n parent = this.getParent(id);\n tindex = this.getBranchIndex(id);\n }\n\n if (sid == parent) {\n return;\n }\n\n if (!utils.defined(parent)) {\n parent = this.$getRootId();\n }\n\n var source = this.getItem(sid);\n var source_pid = this.getParent(source.id);\n var tbranch = this.getChildren(parent);\n if (tindex == -1) tindex = tbranch.length + 1;\n\n if (source_pid == parent) {\n var sindex = this.getBranchIndex(sid);\n if (sindex == tindex) return;\n }\n\n if (this.callEvent(\"onBeforeItemMove\", [sid, parent, tindex]) === false) return false;\n var placeholderIds = [];\n\n for (var i = 0; i < tbranch.length; i++) {\n if (isPlaceholderTask(tbranch[i], null, this, this._ganttConfig)) {\n placeholderIds.push(tbranch[i]);\n tbranch.splice(i, 1);\n i--;\n }\n }\n\n this._replace_branch_child(source_pid, sid);\n\n tbranch = this.getChildren(parent);\n var tid = tbranch[tindex];\n tid = replaceValidZeroId(tid, root_id);\n if (!tid) //adding as last element\n tbranch.push(sid);else tbranch = tbranch.slice(0, tindex).concat([sid]).concat(tbranch.slice(tindex));\n\n if (placeholderIds.length) {\n tbranch = tbranch.concat(placeholderIds);\n }\n\n this.setParent(source, parent);\n this._branches[parent] = tbranch;\n var diff = this.calculateItemLevel(source) - source.$level;\n source.$level += diff;\n this.eachItem(function (item) {\n item.$level += diff;\n }, source.id, this);\n\n this._moveInner(this.getIndexById(sid), this.getIndexById(parent) + tindex);\n\n this.callEvent(\"onAfterItemMove\", [sid, parent, tindex]);\n this.refresh();\n },\n getBranchIndex: function getBranchIndex(id) {\n var branch = this.getChildren(this.getParent(id));\n\n for (var i = 0; i < branch.length; i++) {\n if (branch[i] == id) return i;\n }\n\n return -1;\n },\n hasChild: function hasChild(id) {\n var branch = this._branches[id];\n return branch && branch.length;\n },\n getChildren: function getChildren(id) {\n var branch = this._branches[id];\n return branch ? branch : powerArray.$create();\n },\n isChildOf: function isChildOf(childId, parentId) {\n if (!this.exists(childId)) return false;\n if (parentId === this.$getRootId()) return true;\n if (!this.hasChild(parentId)) return false;\n var item = this.getItem(childId);\n var pid = this.getParent(childId);\n var parent = this.getItem(parentId);\n\n if (parent.$level >= item.$level) {\n return false;\n }\n\n while (item && this.exists(pid)) {\n item = this.getItem(pid);\n if (item && item.id == parentId) return true;\n pid = this.getParent(item);\n }\n\n return false;\n },\n getSiblings: function getSiblings(id) {\n if (!this.exists(id)) {\n return powerArray.$create();\n }\n\n var parent = this.getParent(id);\n return this.getChildren(parent);\n },\n getNextSibling: function getNextSibling(id) {\n var siblings = this.getSiblings(id);\n\n for (var i = 0, len = siblings.length; i < len; i++) {\n if (siblings[i] == id) {\n var nextSibling = siblings[i + 1];\n\n if (nextSibling === 0 && i > 0) {\n nextSibling = \"0\";\n }\n\n return nextSibling || null;\n }\n }\n\n return null;\n },\n getPrevSibling: function getPrevSibling(id) {\n var siblings = this.getSiblings(id);\n\n for (var i = 0, len = siblings.length; i < len; i++) {\n if (siblings[i] == id) {\n var previousSibling = siblings[i - 1];\n\n if (previousSibling === 0 && i > 0) {\n previousSibling = \"0\";\n }\n\n return previousSibling || null;\n }\n }\n\n return null;\n },\n getParent: function getParent(id) {\n var item = null;\n\n if (id.id !== undefined) {\n item = id;\n } else {\n item = this.getItem(id);\n }\n\n var parent;\n\n if (item) {\n parent = item[this.$parentProperty];\n } else {\n parent = this.$getRootId();\n }\n\n return parent;\n },\n clearAll: function clearAll() {\n this._branches = {};\n DataStore.prototype.clearAll.call(this);\n },\n calculateItemLevel: function calculateItemLevel(item) {\n var level = 0;\n this.eachParent(function () {\n level++;\n }, item);\n return level;\n },\n _setParentInner: function _setParentInner(item, new_pid, silent) {\n if (!silent) {\n if (item.hasOwnProperty(\"$rendered_parent\")) {\n this._move_branch(item, item.$rendered_parent, new_pid);\n } else {\n this._move_branch(item, item[this.$parentProperty], new_pid);\n }\n }\n },\n setParent: function setParent(item, new_pid, silent) {\n this._setParentInner(item, new_pid, silent);\n\n item[this.$parentProperty] = new_pid;\n },\n _eachItemCached: function _eachItemCached(code, cache) {\n for (var i = 0, len = cache.length; i < len; i++) {\n code.call(this, cache[i]);\n }\n },\n _eachItemIterate: function _eachItemIterate(code, startId, cache) {\n var itemsStack = this.getChildren(startId);\n\n if (itemsStack.length) {\n itemsStack = itemsStack.slice().reverse();\n }\n\n while (itemsStack.length) {\n var itemId = itemsStack.pop();\n var item = this.getItem(itemId);\n code.call(this, item);\n\n if (cache) {\n cache.push(item);\n }\n\n if (this.hasChild(item.id)) {\n var children = this.getChildren(item.id);\n var len = children.length;\n\n for (var i = len - 1; i >= 0; i--) {\n itemsStack.push(children[i]);\n }\n }\n }\n },\n eachItem: function eachItem(code, parent) {\n var rootId = this.$getRootId();\n\n if (!utils.defined(parent)) {\n parent = rootId;\n }\n\n var startId = replaceValidZeroId(parent, rootId) || rootId;\n var useCache = false;\n var buildCache = false;\n var cache = null;\n\n if (startId === rootId) {\n if (this._eachItemMainRangeCache) {\n useCache = true;\n cache = this._eachItemMainRangeCache;\n } else {\n buildCache = true;\n cache = this._eachItemMainRangeCache = [];\n }\n }\n\n if (useCache) {\n this._eachItemCached(code, cache);\n } else {\n this._eachItemIterate(code, startId, buildCache ? cache : null);\n }\n },\n eachParent: function eachParent(code, startItem) {\n var parentsHash = {};\n var item = startItem;\n var parent = this.getParent(item);\n\n while (this.exists(parent)) {\n if (parentsHash[parent]) {\n throw new Error(\"Invalid tasks tree. Cyclic reference has been detected on task \" + parent);\n }\n\n parentsHash[parent] = true;\n item = this.getItem(parent);\n code.call(this, item);\n parent = this.getParent(item);\n }\n },\n _add_branch: function _add_branch(item, index, parent) {\n var pid = parent === undefined ? this.getParent(item) : parent;\n if (!this.hasChild(pid)) this._branches[pid] = powerArray.$create();\n var branch = this.getChildren(pid);\n var added_already = false;\n\n for (var i = 0, length = branch.length; i < length; i++) {\n if (branch[i] == item.id) {\n added_already = true;\n break;\n }\n }\n\n if (!added_already) {\n if (index * 1 == index) {\n branch.splice(index, 0, item.id);\n } else {\n branch.push(item.id);\n }\n\n item.$rendered_parent = pid;\n }\n },\n _move_branch: function _move_branch(item, old_parent, new_parent) {\n this._eachItemMainRangeCache = null; //this.setParent(item, new_parent);\n //this._sync_parent(task);\n\n this._replace_branch_child(old_parent, item.id);\n\n if (this.exists(new_parent) || new_parent == this.$getRootId()) {\n this._add_branch(item, undefined, new_parent);\n } else {\n delete this._branches[item.id];\n }\n\n item.$level = this.calculateItemLevel(item);\n this.eachItem(function (child) {\n child.$level = this.calculateItemLevel(child);\n }, item.id);\n },\n _replace_branch_child: function _replace_branch_child(node, old_id, new_id) {\n var branch = this.getChildren(node);\n\n if (branch && node !== undefined) {\n var newbranch = powerArray.$create();\n\n for (var i = 0; i < branch.length; i++) {\n if (branch[i] != old_id) newbranch.push(branch[i]);else if (new_id) newbranch.push(new_id);\n }\n\n this._branches[node] = newbranch;\n }\n },\n sort: function sort(field, desc, parent) {\n if (!this.exists(parent)) {\n parent = this.$getRootId();\n }\n\n if (!field) field = \"order\";\n var criteria = typeof field == \"string\" ? function (a, b) {\n if (a[field] == b[field] || helpers.isDate(a[field]) && helpers.isDate(b[field]) && a[field].valueOf() == b[field].valueOf()) {\n return 0;\n }\n\n var result = a[field] > b[field];\n return result ? 1 : -1;\n } : field;\n\n if (desc) {\n var original_criteria = criteria;\n\n criteria = function criteria(a, b) {\n return original_criteria(b, a);\n };\n }\n\n var els = this.getChildren(parent);\n\n if (els) {\n var temp = [];\n\n for (var i = els.length - 1; i >= 0; i--) {\n temp[i] = this.getItem(els[i]);\n }\n\n temp.sort(criteria);\n\n for (var i = 0; i < temp.length; i++) {\n els[i] = temp[i].id;\n this.sort(field, desc, els[i]);\n }\n }\n },\n filter: function filter(rule) {\n for (var i in this.pull) {\n if (this.pull[i].$rendered_parent !== this.getParent(this.pull[i])) {\n this._move_branch(this.pull[i], this.pull[i].$rendered_parent, this.getParent(this.pull[i]));\n }\n }\n\n return DataStore.prototype.filter.apply(this, arguments);\n },\n open: function open(id) {\n if (this.exists(id)) {\n this.getItem(id).$open = true;\n this.callEvent(\"onItemOpen\", [id]);\n }\n },\n close: function close(id) {\n if (this.exists(id)) {\n this.getItem(id).$open = false;\n this.callEvent(\"onItemClose\", [id]);\n }\n },\n destructor: function destructor() {\n DataStore.prototype.destructor.call(this);\n this._branches = null;\n this._indexRangeCache = {};\n this._eachItemMainRangeCache = null;\n }\n}, DataStore.prototype);\nmodule.exports = TreeDataStore;","var utils = require(\"../../utils/utils\");\n\nvar $powerArray = {\n $create: function $create(array) {\n return utils.mixin(array || [], this);\n },\n //remove element at specified position\n $removeAt: function $removeAt(pos, len) {\n if (pos >= 0) this.splice(pos, len || 1);\n },\n //find element in collection and remove it\n $remove: function $remove(value) {\n this.$removeAt(this.$find(value));\n },\n //add element to collection at specific position\n $insertAt: function $insertAt(data, pos) {\n if (!pos && pos !== 0) //add to the end by default\n this.push(data);else {\n var b = this.splice(pos, this.length - pos);\n this[pos] = data;\n this.push.apply(this, b); //reconstruct array without loosing this pointer\n }\n },\n //return index of element, -1 if it doesn't exists\n $find: function $find(data) {\n for (var i = 0; i < this.length; i++) {\n if (data == this[i]) return i;\n }\n\n return -1;\n },\n //execute some method for each element of array\n $each: function $each(functor, master) {\n for (var i = 0; i < this.length; i++) {\n functor.call(master || this, this[i]);\n }\n },\n //create new array from source, by using results of functor\n $map: function $map(functor, master) {\n for (var i = 0; i < this.length; i++) {\n this[i] = functor.call(master || this, this[i]);\n }\n\n return this;\n },\n $filter: function $filter(functor, master) {\n for (var i = 0; i < this.length; i++) {\n if (!functor.call(master || this, this[i])) {\n this.splice(i, 1);\n i--;\n }\n }\n\n return this;\n }\n};\nmodule.exports = $powerArray;","var powerArray = require(\"./power_array\");\n\nvar utils = require(\"../../utils/utils\");\n\nvar eventable = require(\"../../utils/eventable\");\n\nvar isPlaceholderTask = require(\"../../utils/placeholder_task\");\n\nvar DataStore = function DataStore(config) {\n this.pull = {};\n this.$initItem = config.initItem;\n this.visibleOrder = powerArray.$create();\n this.fullOrder = powerArray.$create();\n this._skip_refresh = false;\n this._filterRule = null;\n this._searchVisibleOrder = {};\n this._indexRangeCache = {};\n this._getItemsCache = null;\n this.$config = config;\n eventable(this);\n\n this._attachDataChange(function () {\n this._indexRangeCache = {};\n this._getItemsCache = null;\n return true;\n });\n\n return this;\n};\n\nDataStore.prototype = {\n _attachDataChange: function _attachDataChange(callback) {\n this.attachEvent(\"onClearAll\", callback);\n this.attachEvent(\"onBeforeParse\", callback);\n this.attachEvent(\"onBeforeUpdate\", callback);\n this.attachEvent(\"onBeforeDelete\", callback);\n this.attachEvent(\"onBeforeAdd\", callback);\n this.attachEvent(\"onParse\", callback);\n this.attachEvent(\"onBeforeFilter\", callback);\n },\n _parseInner: function _parseInner(data) {\n var item = null,\n loaded = [];\n\n for (var i = 0, len = data.length; i < len; i++) {\n item = data[i];\n\n if (this.$initItem) {\n if (this.$config.copyOnParse()) {\n item = utils.copy(item);\n }\n\n item = this.$initItem(item);\n }\n\n if (this.callEvent(\"onItemLoading\", [item])) {\n if (!this.pull.hasOwnProperty(item.id)) {\n this.fullOrder.push(item.id);\n }\n\n loaded.push(item);\n this.pull[item.id] = item;\n }\n }\n\n return loaded;\n },\n parse: function parse(data) {\n if (!this.isSilent()) {\n this.callEvent(\"onBeforeParse\", [data]);\n }\n\n var loaded = this._parseInner(data);\n\n if (!this.isSilent()) {\n this.refresh();\n this.callEvent(\"onParse\", [loaded]);\n }\n },\n getItem: function getItem(id) {\n return this.pull[id];\n },\n _updateOrder: function _updateOrder(code) {\n code.call(this.visibleOrder);\n code.call(this.fullOrder);\n },\n updateItem: function updateItem(id, item) {\n if (!utils.defined(item)) item = this.getItem(id);\n\n if (!this.isSilent()) {\n if (this.callEvent(\"onBeforeUpdate\", [item.id, item]) === false) return false;\n } // This is how it worked before updating the properties:\n // this.pull[id]=item;\n\n\n utils.mixin(this.pull[id], item, true);\n\n if (!this.isSilent()) {\n this.callEvent(\"onAfterUpdate\", [item.id, item]);\n this.callEvent(\"onStoreUpdated\", [item.id, item, \"update\"]);\n }\n },\n _removeItemInner: function _removeItemInner(id) {\n //clear from collections\n //this.visibleOrder.$remove(id);\n this._updateOrder(function () {\n this.$remove(id);\n });\n\n delete this.pull[id];\n },\n removeItem: function removeItem(id) {\n //utils.assert(this.exists(id), \"Not existing ID in remove command\"+id);\n var obj = this.getItem(id); //save for later event\n\n if (!this.isSilent()) {\n if (this.callEvent(\"onBeforeDelete\", [obj.id, obj]) === false) return false;\n }\n\n this.callEvent(\"onAfterDeleteConfirmed\", [obj.id, obj]);\n\n this._removeItemInner(id);\n\n if (!this.isSilent()) {\n this.filter();\n this.callEvent(\"onAfterDelete\", [obj.id, obj]); //repaint signal\n\n this.callEvent(\"onStoreUpdated\", [obj.id, obj, \"delete\"]);\n }\n },\n _addItemInner: function _addItemInner(item, index) {\n //in case of treetable order is sent as 3rd parameter\n //var order = index;\n if (this.exists(item.id)) {\n this.silent(function () {\n this.updateItem(item.id, item);\n });\n } else {\n var order = this.visibleOrder; //by default item is added to the end of the list\n\n var data_size = order.length;\n if (!utils.defined(index) || index < 0) index = data_size; //check to prevent too big indexes\n\n if (index > data_size) {\n //dhx.log(\"Warning\",\"DataStore:add\",\"Index of out of bounds\");\n index = Math.min(order.length, index);\n }\n } //gantt.assert(!this.exists(id), \"Not unique ID\");\n\n\n this.pull[item.id] = item;\n\n if (!this.isSilent()) {\n this._updateOrder(function () {\n if (this.$find(item.id) === -1) this.$insertAt(item.id, index);\n });\n }\n\n this.filter(); //order.$insertAt(item.id,index);\n },\n isVisible: function isVisible(id) {\n return this.visibleOrder.$find(id) > -1;\n },\n getVisibleItems: function getVisibleItems() {\n return this.getIndexRange();\n },\n addItem: function addItem(item, index) {\n if (!utils.defined(item.id)) item.id = utils.uid();\n\n if (this.$initItem) {\n item = this.$initItem(item);\n }\n\n if (!this.isSilent()) {\n if (this.callEvent(\"onBeforeAdd\", [item.id, item]) === false) return false;\n }\n\n this._addItemInner(item, index);\n\n if (!this.isSilent()) {\n this.callEvent(\"onAfterAdd\", [item.id, item]); //repaint signal\n\n this.callEvent(\"onStoreUpdated\", [item.id, item, \"add\"]);\n }\n\n return item.id;\n },\n _changeIdInner: function _changeIdInner(oldId, newId) {\n if (this.pull[oldId]) this.pull[newId] = this.pull[oldId];\n var visibleOrder = this._searchVisibleOrder[oldId];\n this.pull[newId].id = newId;\n\n this._updateOrder(function () {\n this[this.$find(oldId)] = newId;\n });\n\n this._searchVisibleOrder[newId] = visibleOrder;\n delete this._searchVisibleOrder[oldId]; //this.visibleOrder[this.visibleOrder.$find(oldId)]=newId;\n\n delete this.pull[oldId];\n },\n changeId: function changeId(oldId, newId) {\n this._changeIdInner(oldId, newId);\n\n this.callEvent(\"onIdChange\", [oldId, newId]);\n },\n exists: function exists(id) {\n return !!this.pull[id];\n },\n _moveInner: function _moveInner(sindex, tindex) {\n var id = this.getIdByIndex(sindex);\n\n this._updateOrder(function () {\n this.$removeAt(sindex);\n this.$insertAt(id, Math.min(this.length, tindex));\n }); //this.visibleOrder.$removeAt(sindex);\t//remove at old position\n //if (sindex=0 && tindex>=0, \"DataStore::move\",\"Incorrect indexes\");\n var id = this.getIdByIndex(sindex);\n var obj = this.getItem(id);\n\n this._moveInner(sindex, tindex);\n\n if (!this.isSilent()) {\n //repaint signal\n this.callEvent(\"onStoreUpdated\", [obj.id, obj, \"move\"]);\n }\n },\n clearAll: function clearAll() {\n if (this.$destroyed) {\n return;\n } // GS-956 We need to unselect the resource as its ID is cached\n\n\n this.silent(function () {\n this.unselect();\n });\n this.pull = {};\n this.visibleOrder = powerArray.$create();\n this.fullOrder = powerArray.$create();\n if (this.isSilent()) return;\n this.callEvent(\"onClearAll\", []);\n this.refresh();\n },\n silent: function silent(code, master) {\n var alreadySilent = false;\n\n if (this.isSilent()) {\n alreadySilent = true;\n }\n\n this._skip_refresh = true;\n code.call(master || this);\n\n if (!alreadySilent) {\n this._skip_refresh = false;\n }\n },\n isSilent: function isSilent() {\n return !!this._skip_refresh;\n },\n arraysEqual: function arraysEqual(arr1, arr2) {\n if (arr1.length !== arr2.length) return false;\n\n for (var i = 0; i < arr1.length; i++) {\n if (arr1[i] !== arr2[i]) return false;\n }\n\n return true;\n },\n refresh: function refresh(id, quick) {\n if (this.isSilent()) return;\n var item;\n\n if (id) {\n item = this.getItem(id);\n }\n\n var args;\n\n if (id) {\n args = [id, item, \"paint\"];\n } else {\n args = [null, null, null];\n }\n\n if (this.callEvent(\"onBeforeStoreUpdate\", args) === false) {\n return;\n }\n\n var skipFilter = this._quick_refresh && !this._mark_recompute;\n this._mark_recompute = false;\n\n if (id) {\n // if item changes visible order (e.g. expand-collapse branch) - do a complete repaint\n if (!quick && !skipFilter) {\n var oldOrder = this.visibleOrder;\n this.filter();\n\n if (!this.arraysEqual(oldOrder, this.visibleOrder)) {\n id = undefined;\n }\n }\n } else if (!skipFilter) {\n this.filter();\n }\n\n if (id) {\n args = [id, item, \"paint\"];\n } else {\n args = [null, null, null];\n }\n\n this.callEvent(\"onStoreUpdated\", args);\n },\n count: function count() {\n return this.fullOrder.length;\n },\n countVisible: function countVisible() {\n return this.visibleOrder.length;\n },\n sort: function sort(_sort) {},\n serialize: function serialize() {},\n eachItem: function eachItem(code) {\n for (var i = 0; i < this.fullOrder.length; i++) {\n var item = this.getItem(this.fullOrder[i]);\n code.call(this, item);\n }\n },\n find: function find(filter) {\n var result = [];\n this.eachItem(function (item) {\n if (filter(item)) {\n result.push(item);\n }\n });\n return result;\n },\n filter: function filter(rule) {\n if (!this.isSilent()) {\n this.callEvent(\"onBeforeFilter\", []);\n }\n\n this.callEvent(\"onPreFilter\", []);\n var filteredOrder = powerArray.$create();\n var placeholderIds = [];\n this.eachItem(function (item) {\n if (this.callEvent(\"onFilterItem\", [item.id, item])) {\n if (isPlaceholderTask(item.id, null, this, this._ganttConfig)) {\n placeholderIds.push(item.id);\n } else {\n filteredOrder.push(item.id);\n }\n }\n });\n\n for (var i = 0; i < placeholderIds.length; i++) {\n filteredOrder.push(placeholderIds[i]);\n }\n\n this.visibleOrder = filteredOrder;\n this._searchVisibleOrder = {};\n\n for (var i = 0; i < this.visibleOrder.length; i++) {\n this._searchVisibleOrder[this.visibleOrder[i]] = i;\n }\n\n if (!this.isSilent()) {\n this.callEvent(\"onFilter\", []);\n }\n },\n getIndexRange: function getIndexRange(from, to) {\n var max = Math.min(to || Infinity, this.countVisible() - 1);\n var min = from || 0;\n var cacheKey = min + '-' + max;\n\n if (this._indexRangeCache[cacheKey]) {\n return this._indexRangeCache[cacheKey].slice();\n }\n\n var ret = [];\n\n for (var i = min; i <= max; i++) {\n ret.push(this.getItem(this.visibleOrder[i]));\n }\n\n this._indexRangeCache[cacheKey] = ret.slice();\n return ret;\n },\n getItems: function getItems() {\n if (this._getItemsCache) {\n return this._getItemsCache.slice();\n }\n\n var res = [];\n\n for (var i in this.pull) {\n res.push(this.pull[i]);\n }\n\n this._getItemsCache = res.slice();\n return res;\n },\n getIdByIndex: function getIdByIndex(index) {\n return this.visibleOrder[index];\n },\n getIndexById: function getIndexById(id) {\n var res = this._searchVisibleOrder[id];\n\n if (res === undefined) {\n res = -1;\n }\n\n return res;\n },\n _getNullIfUndefined: function _getNullIfUndefined(value) {\n if (value === undefined) {\n return null;\n } else {\n return value;\n }\n },\n getFirst: function getFirst() {\n return this._getNullIfUndefined(this.visibleOrder[0]);\n },\n getLast: function getLast() {\n return this._getNullIfUndefined(this.visibleOrder[this.visibleOrder.length - 1]);\n },\n getNext: function getNext(id) {\n return this._getNullIfUndefined(this.visibleOrder[this.getIndexById(id) + 1]);\n },\n getPrev: function getPrev(id) {\n return this._getNullIfUndefined(this.visibleOrder[this.getIndexById(id) - 1]);\n },\n destructor: function destructor() {\n this.callEvent(\"onDestroy\", []);\n this.detachAllEvents();\n this.$destroyed = true;\n this.pull = null;\n this.$initItem = null;\n this.visibleOrder = null;\n this.fullOrder = null;\n this._skip_refresh = null;\n this._filterRule = null;\n this._searchVisibleOrder = null;\n this._indexRangeCache = {};\n }\n};\nmodule.exports = DataStore;","// shim for using process in browser\nvar process = module.exports = {}; // cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\n\nfunction defaultClearTimeout() {\n throw new Error('clearTimeout has not been defined');\n}\n\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n})();\n\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n } // if setTimeout wasn't available but was latter defined\n\n\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch (e) {\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch (e) {\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n}\n\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n } // if clearTimeout wasn't available but was latter defined\n\n\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e) {\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e) {\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n}\n\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n\n draining = false;\n\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n var len = queue.length;\n\n while (len) {\n currentQueue = queue;\n queue = [];\n\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n\n queueIndex = -1;\n len = queue.length;\n }\n\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n\n queue.push(new Item(fun, args));\n\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n}; // v8 likes predictible objects\n\n\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\n\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\n\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\n\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) {\n return [];\n};\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () {\n return '/';\n};\n\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\n\nprocess.umask = function () {\n return 0;\n};","function checkTimeout(host, updPerSecond) {\n if (!updPerSecond) return true;\n if (host._on_timeout) return false;\n var timeout = Math.ceil(1000 / updPerSecond);\n if (timeout < 2) return true;\n setTimeout(function () {\n delete host._on_timeout;\n }, timeout);\n host._on_timeout = true;\n return true;\n}\n\nmodule.exports = checkTimeout;","var utils = require(\"../../../utils/utils\");\n\nfunction createScope(addEvent, removeEvent) {\n addEvent = addEvent || utils.event;\n removeEvent = removeEvent || utils.eventRemove;\n var handlers = [];\n var eventScope = {\n attach: function attach(el, event, callback, capture) {\n handlers.push({\n element: el,\n event: event,\n callback: callback,\n capture: capture\n });\n addEvent(el, event, callback, capture);\n },\n detach: function detach(el, event, callback, capture) {\n removeEvent(el, event, callback, capture);\n\n for (var i = 0; i < handlers.length; i++) {\n var handler = handlers[i];\n\n if (handler.element === el && handler.event === event && handler.callback === callback && handler.capture === capture) {\n handlers.splice(i, 1);\n i--;\n }\n }\n },\n detachAll: function detachAll() {\n var staticArray = handlers.slice(); // original handlers array can be spliced on every iteration\n\n for (var i = 0; i < staticArray.length; i++) {\n var handler = staticArray[i];\n eventScope.detach(handler.element, handler.event, handler.callback, handler.capture);\n eventScope.detach(handler.element, handler.event, handler.callback, undefined);\n eventScope.detach(handler.element, handler.event, handler.callback, false);\n eventScope.detach(handler.element, handler.event, handler.callback, true);\n }\n\n handlers.splice(0, handlers.length);\n },\n extend: function extend() {\n return createScope(this.event, this.eventRemove);\n }\n };\n return eventScope;\n}\n\nmodule.exports = createScope;","module.exports = function (gantt) {\n // TODO: why eslint fails on regexp?\n // eslint-disable-next-line no-control-regex\n var htmlTags = new RegExp(\"<(?:.|\\n)*?>\", \"gm\");\n var extraSpaces = new RegExp(\" +\", \"gm\");\n\n function stripHTMLLite(htmlText) {\n return (htmlText + \"\").replace(htmlTags, \" \").replace(extraSpaces, \" \");\n }\n\n var singleQuotes = new RegExp(\"'\", \"gm\");\n\n function escapeQuotes(text) {\n return (text + \"\").replace(singleQuotes, \"'\");\n }\n\n gantt._waiAria = {\n getAttributeString: function getAttributeString(attr) {\n var attributes = [\" \"];\n\n for (var i in attr) {\n var text = escapeQuotes(stripHTMLLite(attr[i]));\n attributes.push(i + \"='\" + text + \"'\");\n }\n\n attributes.push(\" \");\n return attributes.join(\" \");\n },\n getTimelineCellAttr: function getTimelineCellAttr(dateString) {\n return gantt._waiAria.getAttributeString({\n \"aria-label\": dateString\n });\n },\n _taskCommonAttr: function _taskCommonAttr(task, div) {\n if (!(task.start_date && task.end_date)) return;\n div.setAttribute(\"aria-label\", stripHTMLLite(gantt.templates.tooltip_text(task.start_date, task.end_date, task)));\n\n if (task.$dataprocessor_class) {\n div.setAttribute(\"aria-busy\", true);\n }\n\n div.setAttribute(\"aria-selected\", gantt.isSelectedTask(task.id) ? \"true\" : \"false\");\n },\n setTaskBarAttr: function setTaskBarAttr(task, div) {\n this._taskCommonAttr(task, div);\n\n if (!gantt.isReadonly(task) && gantt.config.drag_move) {\n if (task.id != gantt.getState(\"tasksDnd\").drag_id) {\n div.setAttribute(\"aria-grabbed\", false);\n } else {\n div.setAttribute(\"aria-grabbed\", true);\n }\n }\n },\n taskRowAttr: function taskRowAttr(task, div) {\n this._taskCommonAttr(task, div);\n\n if (!gantt.isReadonly(task) && gantt.config.order_branch) {\n div.setAttribute(\"aria-grabbed\", false);\n }\n\n div.setAttribute(\"role\", \"row\");\n div.setAttribute(\"aria-level\", task.$level);\n\n if (gantt.hasChild(task.id)) {\n div.setAttribute(\"aria-expanded\", task.$open ? \"true\" : \"false\");\n }\n },\n linkAttr: function linkAttr(link, div) {\n var linkTypes = gantt.config.links;\n var toStart = link.type == linkTypes.finish_to_start || link.type == linkTypes.start_to_start;\n var fromStart = link.type == linkTypes.start_to_start || link.type == linkTypes.start_to_finish;\n var content = gantt.locale.labels.link + \" \" + gantt.templates.drag_link(link.source, fromStart, link.target, toStart);\n div.setAttribute(\"aria-label\", stripHTMLLite(content));\n\n if (gantt.isReadonly(link)) {\n div.setAttribute(\"aria-readonly\", true);\n }\n },\n gridSeparatorAttr: function gridSeparatorAttr(div) {\n div.setAttribute(\"role\", \"separator\");\n },\n lightboxHiddenAttr: function lightboxHiddenAttr(div) {\n div.setAttribute(\"aria-hidden\", \"true\");\n },\n lightboxVisibleAttr: function lightboxVisibleAttr(div) {\n div.setAttribute(\"aria-hidden\", \"false\");\n },\n lightboxAttr: function lightboxAttr(div) {\n div.setAttribute(\"role\", \"dialog\");\n div.setAttribute(\"aria-hidden\", \"true\");\n div.firstChild.setAttribute(\"role\", \"heading\");\n },\n lightboxButtonAttrString: function lightboxButtonAttrString(buttonName) {\n return this.getAttributeString({\n \"role\": \"button\",\n \"aria-label\": gantt.locale.labels[buttonName],\n \"tabindex\": \"0\"\n });\n },\n lightboxHeader: function lightboxHeader(div, headerText) {\n div.setAttribute(\"aria-label\", headerText);\n },\n lightboxSelectAttrString: function lightboxSelectAttrString(time_option) {\n var label = \"\";\n\n switch (time_option) {\n case \"%Y\":\n label = gantt.locale.labels.years;\n break;\n\n case \"%m\":\n label = gantt.locale.labels.months;\n break;\n\n case \"%d\":\n label = gantt.locale.labels.days;\n break;\n\n case \"%H:%i\":\n label = gantt.locale.labels.hours + gantt.locale.labels.minutes;\n break;\n\n default:\n break;\n }\n\n return gantt._waiAria.getAttributeString({\n \"aria-label\": label\n });\n },\n lightboxDurationInputAttrString: function lightboxDurationInputAttrString(section) {\n return this.getAttributeString({\n \"aria-label\": gantt.locale.labels.column_duration,\n \"aria-valuemin\": \"0\"\n });\n },\n gridAttrString: function gridAttrString() {\n return [\" role='treegrid'\", gantt.config.multiselect ? \"aria-multiselectable='true'\" : \"aria-multiselectable='false'\", \" \"].join(\" \");\n },\n gridScaleRowAttrString: function gridScaleRowAttrString() {\n return \"role='row'\";\n },\n gridScaleCellAttrString: function gridScaleCellAttrString(column, label) {\n var attrs = \"\";\n\n if (column.name == \"add\") {\n attrs = this.getAttributeString({\n \"role\": \"button\",\n \"aria-label\": gantt.locale.labels.new_task\n });\n } else {\n var attributes = {\n \"role\": \"columnheader\",\n \"aria-label\": label\n };\n\n if (gantt._sort && gantt._sort.name == column.name) {\n if (gantt._sort.direction == \"asc\") {\n attributes[\"aria-sort\"] = \"ascending\";\n } else {\n attributes[\"aria-sort\"] = \"descending\";\n }\n }\n\n attrs = this.getAttributeString(attributes);\n }\n\n return attrs;\n },\n gridDataAttrString: function gridDataAttrString() {\n return \"role='rowgroup'\";\n },\n gridCellAttrString: function gridCellAttrString(column, textValue, task) {\n var attributes = {\n \"role\": \"gridcell\",\n \"aria-label\": textValue\n };\n\n if (!column.editor || gantt.isReadonly(task)) {\n attributes[\"aria-readonly\"] = true;\n }\n\n return this.getAttributeString(attributes);\n },\n gridAddButtonAttrString: function gridAddButtonAttrString(column) {\n return this.getAttributeString({\n \"role\": \"button\",\n \"aria-label\": gantt.locale.labels.new_task\n });\n },\n messageButtonAttrString: function messageButtonAttrString(buttonLabel) {\n return \"tabindex='0' role='button' aria-label='\" + buttonLabel + \"'\";\n },\n messageInfoAttr: function messageInfoAttr(div) {\n div.setAttribute(\"role\", \"alert\"); //div.setAttribute(\"tabindex\", \"-1\");\n },\n messageModalAttr: function messageModalAttr(div, uid) {\n div.setAttribute(\"role\", \"dialog\");\n\n if (uid) {\n div.setAttribute(\"aria-labelledby\", uid);\n } //\tdiv.setAttribute(\"tabindex\", \"-1\");\n\n },\n quickInfoAttr: function quickInfoAttr(div) {\n div.setAttribute(\"role\", \"dialog\");\n },\n quickInfoHeaderAttrString: function quickInfoHeaderAttrString() {\n return \" role='heading' \";\n },\n quickInfoHeader: function quickInfoHeader(div, header) {\n div.setAttribute(\"aria-label\", header);\n },\n quickInfoButtonAttrString: function quickInfoButtonAttrString(label) {\n return gantt._waiAria.getAttributeString({\n \"role\": \"button\",\n \"aria-label\": label,\n \"tabindex\": \"0\"\n });\n },\n tooltipAttr: function tooltipAttr(div) {\n div.setAttribute(\"role\", \"tooltip\");\n },\n tooltipVisibleAttr: function tooltipVisibleAttr(div) {\n div.setAttribute(\"aria-hidden\", \"false\");\n },\n tooltipHiddenAttr: function tooltipHiddenAttr(div) {\n div.setAttribute(\"aria-hidden\", \"true\");\n }\n };\n\n function isDisabled() {\n return !gantt.config.wai_aria_attributes;\n }\n\n for (var i in gantt._waiAria) {\n gantt._waiAria[i] = function (payload) {\n return function () {\n if (isDisabled()) {\n return \"\";\n }\n\n return payload.apply(this, arguments);\n };\n }(gantt._waiAria[i]);\n }\n};","module.exports = function (gantt) {\n gantt._extend_to_optional = function (lightbox_block) {\n var duration = lightbox_block;\n var optional_time = {\n render: duration.render,\n focus: duration.focus,\n set_value: function set_value(node, value, task, section) {\n var mapping = gantt._resolve_default_mapping(section);\n\n if (!task[mapping.start_date] || mapping.start_date == \"start_date\" && this._isAllowedUnscheduledTask(task)) {\n optional_time.disable(node, section);\n var val = {};\n\n for (var i in mapping) {\n //take default values from the time control from task start/end dates\n val[mapping[i]] = task[i];\n }\n\n return duration.set_value.call(gantt, node, value, val, section); //set default value\n } else {\n optional_time.enable(node, section);\n return duration.set_value.call(gantt, node, value, task, section);\n }\n },\n get_value: function get_value(node, task, section) {\n if (section.disabled) {\n return {\n start_date: null\n };\n } else {\n return duration.get_value.call(gantt, node, task, section);\n }\n },\n update_block: function update_block(node, section) {\n gantt.callEvent(\"onSectionToggle\", [gantt._lightbox_id, section]);\n node.style.display = section.disabled ? \"none\" : \"block\";\n\n if (section.button) {\n var button = node.previousSibling.querySelector(\".gantt_custom_button_label\"),\n labels = gantt.locale.labels;\n var button_text = section.disabled ? labels[section.name + \"_enable_button\"] : labels[section.name + \"_disable_button\"];\n button.innerHTML = button_text;\n }\n\n gantt.resizeLightbox();\n },\n disable: function disable(node, section) {\n section.disabled = true;\n optional_time.update_block(node, section);\n },\n enable: function enable(node, section) {\n section.disabled = false;\n optional_time.update_block(node, section);\n },\n button_click: function button_click(index, el, section, container) {\n if (gantt.callEvent(\"onSectionButton\", [gantt._lightbox_id, section]) === false) {\n return;\n }\n\n var config = gantt._get_typed_lightbox_config()[index];\n\n if (config.disabled) {\n optional_time.enable(container, config);\n } else {\n optional_time.disable(container, config);\n }\n }\n };\n return optional_time;\n };\n\n gantt.form_blocks.duration_optional = gantt._extend_to_optional(gantt.form_blocks.duration);\n gantt.form_blocks.time_optional = gantt._extend_to_optional(gantt.form_blocks.time);\n};","var __extends = require(\"../../../../utils/extends\");\n\nmodule.exports = function (gantt) {\n var _super = require(\"./select_control\")(gantt);\n\n function TypeselectControl() {\n var self = _super.apply(this, arguments) || this;\n return self;\n }\n\n __extends(TypeselectControl, _super);\n\n TypeselectControl.prototype.render = function (sns) {\n var types = gantt.config.types,\n locale = gantt.locale.labels,\n options = [];\n\n var filter = sns.filter || function (typeKey, typeValue) {\n if (!types.placeholder || typeValue !== types.placeholder) {\n return true;\n }\n\n return false;\n };\n\n for (var i in types) {\n if (!filter(i, types[i]) === false) {\n options.push({\n key: types[i],\n label: locale[\"type_\" + i]\n });\n }\n }\n\n sns.options = options;\n var oldOnChange = sns.onchange;\n\n sns.onchange = function () {\n gantt.changeLightboxType(this.value);\n\n if (this.value === gantt.config.types.task) {\n gantt._lightbox_new_type = \"task\";\n }\n\n if (typeof oldOnChange == 'function') {\n oldOnChange.apply(this, arguments);\n }\n };\n\n return _super.prototype.render.apply(this, arguments);\n };\n\n return TypeselectControl;\n};","var __extends = require(\"../../../../utils/extends\");\n\nvar htmlHelpers = require(\"../../utils/html_helpers\");\n\nmodule.exports = function (gantt) {\n var _super = require(\"./base_control\")(gantt);\n\n function ConstraintControl() {\n var self = _super.apply(this, arguments) || this;\n return self;\n }\n\n __extends(ConstraintControl, _super);\n\n function isNonTimedConstraint(value) {\n if (!value || value === gantt.config.constraint_types.ASAP || value === gantt.config.constraint_types.ALAP) {\n return true;\n } else {\n return false;\n }\n }\n\n function toggleTimeSelect(timeSelects, typeValue) {\n var isNonTimed = isNonTimedConstraint(typeValue);\n\n for (var i = 0; i < timeSelects.length; i++) {\n timeSelects[i].disabled = isNonTimed;\n }\n }\n\n ConstraintControl.prototype.render = function (sns) {\n var height = (sns.height || 30) + \"px\";\n var html = \"
\";\n var options = [];\n\n for (var i in gantt.config.constraint_types) {\n options.push({\n key: gantt.config.constraint_types[i],\n label: gantt.locale.labels[gantt.config.constraint_types[i]]\n });\n }\n\n sns.options = sns.options || options;\n html += \"\" + htmlHelpers.getHtmlSelect(sns.options, [{\n key: \"data-type\",\n value: \"constraint-type\"\n }]) + \"\";\n var timeLabel = gantt.locale.labels[\"constraint_date\"] || \"Constraint date\";\n html += \"\";\n html += \"
\";\n return html;\n };\n\n ConstraintControl.prototype.set_value = function (node, value, task, config) {\n var typeSelect = node.querySelector(\"[data-constraint-type-select] select\");\n var timeSelects = node.querySelectorAll(\"[data-constraint-time-select] select\");\n var map = config._time_format_order;\n\n var mapping = gantt._resolve_default_mapping(config);\n\n if (!typeSelect._eventsInitialized) {\n typeSelect.addEventListener(\"change\", function (e) {\n toggleTimeSelect(timeSelects, e.target.value);\n });\n typeSelect._eventsInitialized = true;\n }\n\n var constraintDate = task[mapping.constraint_date] || new Date();\n\n gantt.form_blocks._fill_lightbox_select(timeSelects, 0, constraintDate, map, config);\n\n var constraintType = task[mapping.constraint_type] || gantt.getConstraintType(task);\n typeSelect.value = constraintType;\n toggleTimeSelect(timeSelects, constraintType);\n };\n\n ConstraintControl.prototype.get_value = function (node, task, config) {\n var typeSelect = node.querySelector(\"[data-constraint-type-select] select\");\n var timeSelects = node.querySelectorAll(\"[data-constraint-time-select] select\");\n var constraintType = typeSelect.value;\n var constraintDate = null;\n\n if (!isNonTimedConstraint(constraintType)) {\n constraintDate = gantt.form_blocks.getTimePickerValue(timeSelects, config);\n }\n\n return {\n constraint_type: constraintType,\n constraint_date: constraintDate\n };\n };\n\n ConstraintControl.prototype.focus = function (node) {\n gantt._focus(node.querySelector(\"select\"));\n };\n\n return ConstraintControl;\n};","var __extends = require(\"../../../../utils/extends\");\n\nmodule.exports = function (gantt) {\n var _super = require(\"./select_control\")(gantt);\n\n function ParentControl() {\n var self = _super.apply(this, arguments) || this;\n return self;\n }\n\n __extends(ParentControl, _super);\n\n ParentControl.prototype.render = function (sns) {\n return _display(sns, false);\n };\n\n ParentControl.prototype.set_value = function (node, value, ev, config) {\n // GS-1051. If the value is `0`, the set_value function in the select control won't select \n // the first child because (0 || '') = '';\n if (value === 0) value = \"0\";\n var tmpDom = document.createElement(\"div\");\n tmpDom.innerHTML = _display(config, ev.id);\n var newOptions = tmpDom.removeChild(tmpDom.firstChild);\n node.onselect = null;\n node.parentNode.replaceChild(newOptions, node);\n return gantt.form_blocks.select.set_value.apply(gantt, [newOptions, value, ev, config]);\n };\n\n function _display(config, item_id) {\n var tasks = [],\n options = [];\n\n if (item_id) {\n tasks = gantt.getTaskByTime();\n\n if (config.allow_root) {\n tasks.unshift({\n id: gantt.config.root_id,\n text: config.root_label || \"\"\n });\n }\n\n tasks = _filter(tasks, config, item_id);\n\n if (config.sort) {\n tasks.sort(config.sort);\n }\n }\n\n var text = config.template || gantt.templates.task_text;\n\n for (var i = 0; i < tasks.length; i++) {\n var label = text.apply(gantt, [tasks[i].start_date, tasks[i].end_date, tasks[i]]);\n\n if (label === undefined) {\n label = \"\";\n }\n\n options.push({\n key: tasks[i].id,\n label: label\n });\n }\n\n config.options = options;\n config.map_to = config.map_to || \"parent\";\n return gantt.form_blocks.select.render.apply(this, arguments);\n }\n\n function _filter(options, config, item_id) {\n var filter = config.filter || function () {\n return true;\n };\n\n options = options.slice(0);\n\n for (var i = 0; i < options.length; i++) {\n var task = options[i];\n\n if (task.id == item_id || gantt.isChildOf(task.id, item_id) || filter(task.id, task) === false) {\n options.splice(i, 1);\n i--;\n }\n }\n\n return options;\n }\n\n return ParentControl;\n};","var __extends = require(\"../../../../utils/extends\");\n\nvar DurationFormatterNumeric = require(\"../../../common/duration_formatter_numeric\")[\"default\"];\n\nmodule.exports = function (gantt) {\n var _super = require(\"./base_control\")(gantt);\n\n function DurationControl() {\n var self = _super.apply(this, arguments) || this;\n return self;\n }\n\n function getFormatter(config) {\n return config.formatter || new DurationFormatterNumeric();\n }\n\n __extends(DurationControl, _super);\n\n DurationControl.prototype.render = function (sns) {\n var time = \"
\" + gantt.form_blocks.getTimePicker.call(this, sns) + \"
\";\n var label = \" \" + gantt.locale.labels[gantt.config.duration_unit + \"s\"] + \" \";\n var singleDate = sns.single_date ? \" style='display:none'\" : \"\";\n var readonly = sns.readonly ? \" disabled='disabled'\" : \"\";\n\n var ariaAttr = gantt._waiAria.lightboxDurationInputAttrString(sns);\n\n var durationInputClass = \"gantt_duration_value\";\n\n if (sns.formatter) {\n label = \"\";\n durationInputClass += \" gantt_duration_value_formatted\";\n }\n\n var duration = \"
\" + \"\" + \"\" + \"\" + label + \"\" + \"
\";\n var html = \"
\" + time + \" \" + duration + \"
\";\n return html;\n };\n\n DurationControl.prototype.set_value = function (node, value, ev, config) {\n var s = node.getElementsByTagName(\"select\");\n var inps = node.getElementsByTagName(\"input\");\n var duration = inps[1];\n var btns = [inps[0], inps[2]];\n var endspan = node.getElementsByTagName(\"span\")[0];\n var map = config._time_format_order;\n var mapping;\n var start_date;\n var end_date;\n var duration_val;\n\n function _calc_date() {\n var start_date = _getStartDate.call(gantt, node, config);\n\n var duration = _getDuration.call(gantt, node, config);\n\n var end_date = gantt.calculateEndDate({\n start_date: start_date,\n duration: duration,\n task: ev\n });\n var template = gantt.templates.task_end_date || gantt.templates.task_date;\n endspan.innerHTML = template(end_date);\n }\n\n function _change_duration(step) {\n var value = duration.value;\n value = getFormatter(config).parse(value);\n if (window.isNaN(value)) value = 0;\n value += step;\n if (value < 1) value = 1;\n duration.value = getFormatter(config).format(value);\n\n _calc_date();\n }\n\n btns[0].onclick = gantt.bind(function () {\n _change_duration(-1 * gantt.config.duration_step);\n }, this);\n btns[1].onclick = gantt.bind(function () {\n _change_duration(1 * gantt.config.duration_step);\n }, this);\n s[0].onchange = _calc_date;\n s[1].onchange = _calc_date;\n s[2].onchange = _calc_date;\n if (s[3]) s[3].onchange = _calc_date;\n duration.onkeydown = gantt.bind(function (e) {\n var code;\n e = e || window.event;\n code = e.charCode || e.keyCode || e.which;\n\n if (code == gantt.constants.KEY_CODES.DOWN) {\n _change_duration(-1 * gantt.config.duration_step);\n\n return false;\n }\n\n if (code == gantt.constants.KEY_CODES.UP) {\n _change_duration(1 * gantt.config.duration_step);\n\n return false;\n }\n\n window.setTimeout(_calc_date, 1);\n }, this);\n duration.onchange = gantt.bind(_calc_date, this);\n mapping = gantt._resolve_default_mapping(config);\n if (typeof mapping === \"string\") mapping = {\n start_date: mapping\n };\n start_date = ev[mapping.start_date] || new Date();\n end_date = ev[mapping.end_date] || gantt.calculateEndDate({\n start_date: start_date,\n duration: 1,\n task: ev\n });\n duration_val = Math.round(ev[mapping.duration]) || gantt.calculateDuration({\n start_date: start_date,\n end_date: end_date,\n task: ev\n });\n duration_val = getFormatter(config).format(duration_val);\n\n gantt.form_blocks._fill_lightbox_select(s, 0, start_date, map, config);\n\n duration.value = duration_val;\n\n _calc_date();\n };\n\n DurationControl.prototype.get_value = function (node, ev, config) {\n var startDate = _getStartDate(node, config);\n\n var duration = _getDuration(node, config);\n\n var endDate = gantt.calculateEndDate({\n start_date: startDate,\n duration: duration,\n task: ev\n });\n\n if (typeof gantt._resolve_default_mapping(config) == \"string\") {\n return startDate;\n }\n\n return {\n start_date: startDate,\n end_date: endDate,\n duration: duration\n };\n };\n\n DurationControl.prototype.focus = function (node) {\n gantt._focus(node.getElementsByTagName(\"select\")[0]);\n };\n\n function _getStartDate(node, config) {\n var s = node.getElementsByTagName(\"select\");\n var map = config._time_format_order;\n var hours = 0;\n var minutes = 0;\n\n if (gantt.defined(map[3])) {\n var input = s[map[3]];\n var time = parseInt(input.value, 10);\n\n if (isNaN(time) && input.hasAttribute(\"data-value\")) {\n time = parseInt(input.getAttribute(\"data-value\"), 10);\n }\n\n hours = Math.floor(time / 60);\n minutes = time % 60;\n }\n\n return new Date(s[map[2]].value, s[map[1]].value, s[map[0]].value, hours, minutes);\n }\n\n function _getDuration(node, config) {\n var duration = node.getElementsByTagName(\"input\")[1];\n duration = getFormatter(config).parse(duration.value);\n if (!duration || window.isNaN(duration)) duration = 1;\n if (duration < 0) duration *= -1;\n return duration;\n }\n\n return DurationControl;\n};","var __extends = require(\"../../../../utils/extends\");\n\nmodule.exports = function (gantt) {\n var _super = require(\"./base_control\")(gantt);\n\n function RadioControl() {\n var self = _super.apply(this, arguments) || this;\n return self;\n }\n\n __extends(RadioControl, _super);\n\n RadioControl.prototype.render = function (sns) {\n var height = (sns.height || \"23\") + \"px\";\n var html = \"
\";\n\n if (sns.options && sns.options.length) {\n for (var i = 0; i < sns.options.length; i++) {\n html += \"\";\n }\n }\n\n html += \"
\";\n return html;\n };\n\n RadioControl.prototype.set_value = function (node, value, ev, sns) {\n var radio;\n if (!sns.options || !sns.options.length) return;\n radio = node.querySelector(\"input[type=radio][value='\" + value + \"']\") || node.querySelector(\"input[type=radio][value='\" + sns.default_value + \"']\");\n if (!radio) return;\n\n if (!node._dhx_onchange && sns.onchange) {\n node.onchange = sns.onchange;\n node._dhx_onchange = true;\n }\n\n radio.checked = true;\n };\n\n RadioControl.prototype.get_value = function (node, ev) {\n var result = node.querySelector(\"input[type=radio]:checked\");\n return result ? result.value : \"\";\n };\n\n RadioControl.prototype.focus = function (node) {\n gantt._focus(node.querySelector(\"input[type=radio]\"));\n };\n\n return RadioControl;\n};","var helpers = require(\"../../../../utils/helpers\");\n\nvar __extends = require(\"../../../../utils/extends\");\n\nmodule.exports = function (gantt) {\n var _super = require(\"./base_control\")(gantt);\n\n function CheckboxControl() {\n var self = _super.apply(this, arguments) || this;\n return self;\n }\n\n __extends(CheckboxControl, _super);\n\n CheckboxControl.prototype.render = function (sns) {\n var height = (sns.height || \"23\") + \"px\";\n var html = \"
\";\n\n if (sns.options && sns.options.length) {\n for (var i = 0; i < sns.options.length; i++) {\n html += \"\";\n }\n } else {\n sns.single_value = true;\n html += \"\";\n }\n\n html += \"
\";\n return html;\n };\n\n CheckboxControl.prototype.set_value = function (node, value, ev, sns) {\n var checkboxes = Array.prototype.slice.call(node.querySelectorAll(\"input[type=checkbox]\"));\n\n if (!node._dhx_onchange && sns.onchange) {\n node.onchange = sns.onchange;\n node._dhx_onchange = true;\n }\n\n if (sns.single_value) {\n var box = checkboxes[0];\n box.checked = !!value;\n } else {\n helpers.forEach(checkboxes, function (entry) {\n entry.checked = value ? value.indexOf(entry.value) >= 0 : false;\n });\n }\n };\n\n CheckboxControl.prototype.get_value = function (node, task, sns) {\n if (sns.single_value) {\n var box = node.querySelector(\"input[type=checkbox]\");\n return box.checked;\n } else {\n return helpers.arrayMap(Array.prototype.slice.call(node.querySelectorAll(\"input[type=checkbox]:checked\")), function (entry) {\n return entry.value;\n });\n }\n };\n\n CheckboxControl.prototype.focus = function (node) {\n gantt._focus(node.querySelector(\"input[type=checkbox]\"));\n };\n\n return CheckboxControl;\n};","var __extends = require(\"../../../../utils/extends\");\n\nmodule.exports = function (gantt) {\n var _super = require(\"./base_control\")(gantt);\n\n function TimeControl() {\n var self = _super.apply(this, arguments) || this;\n return self;\n }\n\n __extends(TimeControl, _super);\n\n TimeControl.prototype.render = function (sns) {\n var time = gantt.form_blocks.getTimePicker.call(this, sns);\n var html = \"
\";\n html += time;\n\n if (sns.single_date) {\n time = gantt.form_blocks.getTimePicker.call(this, sns, true);\n html += \"\";\n } else {\n html += \"  –  \";\n }\n\n html += time;\n html += \"
\";\n return html;\n };\n\n TimeControl.prototype.set_value = function (node, value, ev, config) {\n var cfg = config;\n var s = node.getElementsByTagName(\"select\");\n var map = config._time_format_order;\n\n if (cfg.auto_end_date) {\n var _update_lightbox_select = function _update_lightbox_select() {\n start_date = new Date(s[map[2]].value, s[map[1]].value, s[map[0]].value, 0, 0);\n end_date = gantt.calculateEndDate({\n start_date: start_date,\n duration: 1,\n task: ev\n });\n\n gantt.form_blocks._fill_lightbox_select(s, map.size, end_date, map, cfg);\n };\n\n for (var i = 0; i < 4; i++) {\n s[i].onchange = _update_lightbox_select;\n }\n }\n\n var mapping = gantt._resolve_default_mapping(config);\n\n if (typeof mapping === \"string\") mapping = {\n start_date: mapping\n };\n var start_date = ev[mapping.start_date] || new Date();\n var end_date = ev[mapping.end_date] || gantt.calculateEndDate({\n start_date: start_date,\n duration: 1,\n task: ev\n });\n\n gantt.form_blocks._fill_lightbox_select(s, 0, start_date, map, cfg);\n\n gantt.form_blocks._fill_lightbox_select(s, map.size, end_date, map, cfg);\n };\n\n TimeControl.prototype.get_value = function (node, ev, config) {\n var selects = node.getElementsByTagName(\"select\");\n var startDate;\n var map = config._time_format_order;\n\n function _getEndDate(selects, map, startDate) {\n var endDate = gantt.form_blocks.getTimePickerValue(selects, config, map.size); // GS-1010: We need to add a way to obtain exact end_date for validation\n\n if (endDate <= startDate) {\n // when end date seems wrong\n if (config.autofix_end !== false || config.single_date) {\n // auto correct it in two cases - when the auto correction is not disabled, or when we have 'single date' control and the user don't have the UI to specify the end date\n return gantt.date.add(startDate, gantt._get_timepicker_step(), \"minute\");\n }\n }\n\n return endDate;\n }\n\n startDate = gantt.form_blocks.getTimePickerValue(selects, config);\n\n if (typeof gantt._resolve_default_mapping(config) === \"string\") {\n return startDate;\n }\n\n return {\n start_date: startDate,\n end_date: _getEndDate(selects, map, startDate)\n };\n };\n\n TimeControl.prototype.focus = function (node) {\n gantt._focus(node.getElementsByTagName(\"select\")[0]);\n };\n\n return TimeControl;\n};","var __extends = require(\"../../../../utils/extends\");\n\nmodule.exports = function (gantt) {\n var _super = require(\"./base_control\")(gantt);\n\n function TextareaControl() {\n var self = _super.apply(this, arguments) || this;\n return self;\n }\n\n __extends(TextareaControl, _super);\n\n TextareaControl.prototype.render = function (sns) {\n var height = (sns.height || \"130\") + \"px\";\n return \"
\";\n };\n\n TextareaControl.prototype.set_value = function (node, value) {\n gantt.form_blocks.textarea._get_input(node).value = value || \"\";\n };\n\n TextareaControl.prototype.get_value = function (node) {\n return gantt.form_blocks.textarea._get_input(node).value;\n };\n\n TextareaControl.prototype.focus = function (node) {\n var a = gantt.form_blocks.textarea._get_input(node);\n\n gantt._focus(a, true);\n };\n\n TextareaControl.prototype._get_input = function (node) {\n return node.querySelector(\"textarea\");\n };\n\n return TextareaControl;\n};","var __extends = require(\"../../../../utils/extends\");\n\nmodule.exports = function (gantt) {\n var _super = require(\"./base_control\")(gantt);\n\n function TemplateControl() {\n var self = _super.apply(this, arguments) || this;\n return self;\n }\n\n __extends(TemplateControl, _super);\n\n TemplateControl.prototype.render = function (sns) {\n var height = (sns.height || \"30\") + \"px\";\n return \"
\";\n };\n\n TemplateControl.prototype.set_value = function (node, value) {\n node.innerHTML = value || \"\";\n };\n\n TemplateControl.prototype.get_value = function (node) {\n return node.innerHTML || \"\";\n };\n\n TemplateControl.prototype.focus = function () {};\n\n return TemplateControl;\n};","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nmodule.exports = function (gantt) {\n var domHelpers = require(\"../utils/dom_helpers\");\n\n var helpers = require(\"../../../utils/helpers\");\n\n var TemplateControl = require(\"./controls/template_control\")(gantt);\n\n var TextareaControl = require(\"./controls/textarea_control\")(gantt);\n\n var TimeControl = require(\"./controls/time_control\")(gantt);\n\n var SelectControl = require(\"./controls/select_control\")(gantt);\n\n var CheckboxControl = require(\"./controls/checkbox_control\")(gantt);\n\n var RadioControl = require(\"./controls/radio_control\")(gantt);\n\n var DurationControl = require(\"./controls/duration_control\")(gantt);\n\n var ParentControl = require(\"./controls/parent_control\")(gantt);\n\n var ResourcesControl = require(\"./controls/resources_control\")(gantt);\n\n var ConstraintControl = require(\"./controls/constraint_control\")(gantt);\n\n var TypeselectControl = require(\"./controls/typeselect_control\")(gantt);\n\n gantt._lightbox_methods = {};\n gantt._lightbox_template = \"
 
\"; // GS-1952. Attaching the lightbox to the BODY element is not considered secure.\n // Attach it to Gantt container for Salesforce and other secure environments\n\n gantt._lightbox_root = gantt.$root;\n\n function setParentNode() {\n var cspEnvironment = gantt.config.csp === true;\n var salesforceEnvironment = !!window[\"Sfdc\"] || !!window[\"$A\"] || window[\"Aura\"] || '$shadowResolver$' in document.body;\n\n if (cspEnvironment || salesforceEnvironment) {\n gantt._lightbox_root = gantt.$root;\n } else {\n gantt._lightbox_root = document.body;\n }\n } //TODO: gantt._lightbox_id is changed from data.js and accessed from autoscheduling, check if it can be removed from gantt object\n\n\n var state = gantt.$services.getService(\"state\");\n state.registerProvider(\"lightbox\", function () {\n return {\n lightbox: gantt._lightbox_id\n };\n });\n\n gantt.showLightbox = function (id) {\n if (!this.callEvent(\"onBeforeLightbox\", [id])) return;\n var task = this.getTask(id);\n var box = this.getLightbox(this.getTaskType(task.type));\n\n this._center_lightbox(box);\n\n this.showCover();\n\n this._fill_lightbox(id, box);\n\n this._waiAria.lightboxVisibleAttr(box);\n\n this.callEvent(\"onLightbox\", [id]);\n };\n\n function _is_chart_visible(gantt) {\n var timeline = gantt.$ui.getView(\"timeline\");\n\n if (timeline && timeline.isVisible()) {\n return true;\n } else {\n return false;\n }\n }\n\n gantt._get_timepicker_step = function () {\n if (this.config.round_dnd_dates) {\n var step;\n\n if (_is_chart_visible(this)) {\n var scale = gantt.getScale();\n step = helpers.getSecondsInUnit(scale.unit) * scale.step / 60; //timepicker step is measured in minutes\n }\n\n if (!step || step >= 60 * 24) {\n step = this.config.time_step;\n }\n\n return step;\n }\n\n return this.config.time_step;\n };\n\n gantt.getLabel = function (property, key) {\n var sections = this._get_typed_lightbox_config();\n\n for (var i = 0; i < sections.length; i++) {\n if (sections[i].map_to == property) {\n var options = sections[i].options;\n\n for (var j = 0; j < options.length; j++) {\n if (options[j].key == key) {\n return options[j].label;\n }\n }\n }\n }\n\n return \"\";\n };\n\n gantt.updateCollection = function (list_name, collection) {\n collection = collection.slice(0);\n var list = gantt.serverList(list_name);\n if (!list) return false;\n list.splice(0, list.length);\n list.push.apply(list, collection || []);\n gantt.resetLightbox();\n };\n\n gantt.getLightboxType = function () {\n return this.getTaskType(this._lightbox_type);\n };\n\n gantt.getLightbox = function (type) {\n var lightboxDiv;\n var fullWidth;\n var html;\n var sns;\n var ds;\n var classNames = \"\";\n setParentNode();\n if (type === undefined) type = this.getLightboxType();\n\n if (!this._lightbox || this.getLightboxType() != this.getTaskType(type)) {\n this._lightbox_type = this.getTaskType(type);\n lightboxDiv = document.createElement(\"div\");\n classNames = \"gantt_cal_light\";\n fullWidth = this._is_lightbox_timepicker();\n if (gantt.config.wide_form || fullWidth) classNames += \" gantt_cal_light_wide\";\n\n if (fullWidth) {\n gantt.config.wide_form = true;\n classNames += \" gantt_cal_light_full\";\n }\n\n lightboxDiv.className = classNames;\n lightboxDiv.style.visibility = \"hidden\";\n html = this._lightbox_template;\n html += getHtmlButtons(this.config.buttons_left);\n html += getHtmlButtons(this.config.buttons_right, true);\n lightboxDiv.innerHTML = html;\n\n gantt._waiAria.lightboxAttr(lightboxDiv);\n\n if (gantt.config.drag_lightbox) {\n lightboxDiv.firstChild.onmousedown = gantt._ready_to_dnd;\n\n lightboxDiv.firstChild.onselectstart = function () {\n return false;\n };\n\n lightboxDiv.firstChild.style.cursor = \"pointer\";\n\n gantt._init_dnd_events();\n } // GS-1428: If there is lightbox node, we need to remove it from the DOM\n\n\n if (this._lightbox) {\n this.resetLightbox();\n }\n\n gantt._lightbox_root.insertBefore(lightboxDiv, gantt._lightbox_root.firstChild);\n\n this._lightbox = lightboxDiv;\n sns = this._get_typed_lightbox_config(type);\n html = this._render_sections(sns);\n ds = lightboxDiv.querySelector(\"div.gantt_cal_larea\"); //GS-1131. If gantt_cal_larea is displayed, Firefox renders buttons incorrectly;\n\n var backup_overflow = ds.style.overflow;\n ds.style.overflow = 'hidden';\n ds.innerHTML = html;\n bindLabelsToInputs(sns); //sizes\n\n this.resizeLightbox();\n ds.style.overflow = backup_overflow;\n\n this._init_lightbox_events(this);\n\n lightboxDiv.style.display = \"none\";\n lightboxDiv.style.visibility = \"visible\";\n }\n\n return this._lightbox;\n };\n\n gantt._render_sections = function (sns) {\n var html = \"\";\n\n for (var i = 0; i < sns.length; i++) {\n var block = this.form_blocks[sns[i].type];\n if (!block) continue; //ignore incorrect blocks\n\n sns[i].id = \"area_\" + this.uid();\n var display = sns[i].hidden ? \" style='display:none'\" : \"\";\n var button = \"\";\n\n if (sns[i].button) {\n button = \"
\" + this.locale.labels[\"button_\" + sns[i].button] + \"
\";\n }\n\n if (this.config.wide_form) {\n html += \"
\";\n }\n\n html += \"
\" + block.render.call(this, sns[i]);\n html += \"
\";\n }\n\n return html;\n };\n\n gantt.resizeLightbox = function () {\n if (!this._lightbox) return;\n\n var con = this._lightbox.querySelector(\".gantt_cal_larea\");\n\n con.style.height = \"0px\";\n con.style.height = con.scrollHeight + \"px\";\n this._lightbox.style.height = con.scrollHeight + this.config.lightbox_additional_height + \"px\";\n con.style.height = con.scrollHeight + \"px\"; //it is incredible , how ugly IE can be\n };\n\n gantt._center_lightbox = function (box) {\n if (box) {\n box.style.display = \"block\";\n var scroll_top = window.pageYOffset || gantt._lightbox_root.scrollTop || document.documentElement.scrollTop;\n var scroll_left = window.pageXOffset || gantt._lightbox_root.scrollLeft || document.documentElement.scrollLeft;\n var view_height = window.innerHeight || document.documentElement.clientHeight;\n if (scroll_top) // if vertical scroll on window\n box.style.top = Math.round(scroll_top + Math.max((view_height - box.offsetHeight) / 2, 0)) + \"px\";else // vertical scroll on body\n box.style.top = Math.round(Math.max((view_height - box.offsetHeight) / 2, 0) + 9) + \"px\"; // +9 for compatibility with auto tests\n // not quite accurate but used for compatibility reasons\n\n if (document.documentElement.scrollWidth > gantt._lightbox_root.offsetWidth) // if horizontal scroll on the window\n box.style.left = Math.round(scroll_left + (gantt._lightbox_root.offsetWidth - box.offsetWidth) / 2) + \"px\";else // horizontal scroll on the body\n box.style.left = Math.round((gantt._lightbox_root.offsetWidth - box.offsetWidth) / 2) + \"px\";\n }\n };\n\n gantt.showCover = function () {\n if (this._cover) return;\n this._cover = document.createElement(\"DIV\");\n this._cover.className = \"gantt_cal_cover\";\n\n gantt._lightbox_root.appendChild(this._cover);\n };\n\n gantt.event(window, \"deviceorientation\", function () {\n if (gantt.getState().lightbox) {\n gantt._center_lightbox(gantt.getLightbox());\n }\n });\n\n gantt._init_lightbox_events = function () {\n gantt.lightbox_events = {};\n\n gantt.lightbox_events.gantt_save_btn = function () {\n gantt._save_lightbox();\n };\n\n gantt.lightbox_events.gantt_delete_btn = function () {\n gantt._lightbox_new_type = null;\n if (!gantt.callEvent(\"onLightboxDelete\", [gantt._lightbox_id])) return;\n\n if (gantt.isTaskExists(gantt._lightbox_id)) {\n gantt.$click.buttons[\"delete\"](gantt._lightbox_id);\n } else {\n gantt.hideLightbox();\n }\n };\n\n gantt.lightbox_events.gantt_cancel_btn = function () {\n gantt._cancel_lightbox();\n };\n\n gantt.lightbox_events[\"default\"] = function (e, src) {\n if (src.getAttribute(\"data-dhx-button\")) {\n gantt.callEvent(\"onLightboxButton\", [src.className, src, e]);\n } else {\n var index, block, sec;\n var className = domHelpers.getClassName(src);\n\n if (className.indexOf(\"gantt_custom_button\") != -1) {\n if (className.indexOf(\"gantt_custom_button_\") != -1) {\n index = src.parentNode.getAttribute(\"data-index\");\n sec = src;\n\n while (sec && domHelpers.getClassName(sec).indexOf(\"gantt_cal_lsection\") == -1) {\n sec = sec.parentNode;\n }\n } else {\n index = src.getAttribute(\"data-index\");\n sec = src.parentNode;\n src = src.firstChild;\n }\n }\n\n var sections = gantt._get_typed_lightbox_config();\n\n if (index) {\n index = index * 1;\n block = gantt.form_blocks[sections[index * 1].type];\n block.button_click(index, src, sec, sec.nextSibling);\n }\n }\n };\n\n this.event(gantt.getLightbox(), \"click\", function (e) {\n e = e || window.event;\n var src = domHelpers.getTargetNode(e);\n var className = domHelpers.getClassName(src);\n\n if (!className) {\n src = src.previousSibling;\n className = domHelpers.getClassName(src);\n }\n\n if (src && className && className.indexOf(\"gantt_btn_set\") === 0) {\n src = src.firstChild;\n className = domHelpers.getClassName(src);\n }\n\n if (src && className) {\n var func = gantt.defined(gantt.lightbox_events[src.className]) ? gantt.lightbox_events[src.className] : gantt.lightbox_events[\"default\"];\n return func(e, src);\n }\n\n return false;\n });\n\n gantt.getLightbox().onkeydown = function (e) {\n var event = e || window.event;\n var target = e.target || e.srcElement;\n var buttonTarget = domHelpers.getClassName(target).indexOf(\"gantt_btn_set\") > -1;\n\n switch ((e || event).keyCode) {\n case gantt.constants.KEY_CODES.SPACE:\n {\n if ((e || event).shiftKey) return;\n\n if (buttonTarget && target.click) {\n target.click();\n }\n\n break;\n }\n\n case gantt.keys.edit_save:\n if ((e || event).shiftKey) return;\n\n if (buttonTarget && target.click) {\n target.click();\n } else {\n gantt._save_lightbox();\n }\n\n break;\n\n case gantt.keys.edit_cancel:\n gantt._cancel_lightbox();\n\n break;\n\n default:\n break;\n }\n };\n };\n\n gantt._cancel_lightbox = function () {\n var task = this.getLightboxValues();\n this.callEvent(\"onLightboxCancel\", [this._lightbox_id, task.$new]);\n\n if (gantt.isTaskExists(task.id) && task.$new) {\n this.silent(function () {\n gantt.$data.tasksStore.removeItem(task.id);\n\n gantt._update_flags(task.id, null);\n });\n }\n\n this.refreshData();\n this.hideLightbox();\n };\n\n gantt._save_lightbox = function () {\n var task = this.getLightboxValues();\n if (!this.callEvent(\"onLightboxSave\", [this._lightbox_id, task, !!task.$new])) return;\n\n if (task.$new) {\n delete task.$new;\n this.addTask(task, task.parent, this.getTaskIndex(task.id));\n } else if (this.isTaskExists(task.id)) {\n this.mixin(this.getTask(task.id), task, true);\n this.refreshTask(task.id);\n this.updateTask(task.id);\n }\n\n this.refreshData(); // TODO: do we need any blockable events here to prevent closing lightbox?\n\n this.hideLightbox();\n };\n\n gantt._resolve_default_mapping = function (section) {\n var mapping = section.map_to;\n var time_controls = {\n \"time\": true,\n \"time_optional\": true,\n \"duration\": true,\n \"duration_optional\": true\n };\n\n if (time_controls[section.type]) {\n if (section.map_to == \"auto\") {\n mapping = {\n start_date: \"start_date\",\n end_date: \"end_date\",\n duration: \"duration\"\n };\n } else if (typeof section.map_to === \"string\") {\n mapping = {\n start_date: section.map_to\n };\n }\n } else if (section.type === \"constraint\") {\n if (!section.map_to || typeof section.map_to === \"string\") {\n mapping = {\n constraint_type: \"constraint_type\",\n constraint_date: \"constraint_date\"\n };\n }\n }\n\n return mapping;\n };\n\n gantt.getLightboxValues = function () {\n var task = {};\n\n if (gantt.isTaskExists(this._lightbox_id)) {\n task = this.mixin({}, this.getTask(this._lightbox_id));\n }\n\n var sns = this._get_typed_lightbox_config();\n\n for (var i = 0; i < sns.length; i++) {\n var node = gantt._lightbox_root.querySelector(\"#\" + sns[i].id);\n\n node = node ? node.nextSibling : node;\n var block = this.form_blocks[sns[i].type];\n if (!block) continue;\n var res = block.get_value.call(this, node, task, sns[i]);\n\n var map_to = gantt._resolve_default_mapping(sns[i]);\n\n if (typeof map_to == \"string\" && map_to != \"auto\") {\n task[map_to] = res;\n } else if (_typeof(map_to) == \"object\") {\n for (var property in map_to) {\n if (map_to[property]) task[map_to[property]] = res[property];\n }\n }\n } // GS-1282 We need to preserve the task type even if the lightbox doesn't have the typeselect section\n\n\n if (gantt._lightbox_new_type == \"task\") {\n task.type = gantt.config.types.task;\n gantt._lightbox_new_type = null;\n }\n\n return task;\n };\n\n gantt.hideLightbox = function () {\n var box = this.getLightbox();\n if (box) box.style.display = \"none\";\n\n this._waiAria.lightboxHiddenAttr(box);\n\n this._lightbox_id = null;\n this.hideCover();\n this.callEvent(\"onAfterLightbox\", []);\n };\n\n gantt.hideCover = function () {\n if (this._cover) this._cover.parentNode.removeChild(this._cover);\n this._cover = null;\n };\n\n gantt.resetLightbox = function () {\n if (gantt._lightbox && !gantt._custom_lightbox) gantt._lightbox.parentNode.removeChild(gantt._lightbox);\n gantt._lightbox = null;\n gantt.hideCover();\n };\n\n gantt._set_lightbox_values = function (data, box) {\n var task = data;\n var s = box.getElementsByTagName(\"span\");\n var lightboxHeader = [];\n\n if (gantt.templates.lightbox_header) {\n lightboxHeader.push(\"\");\n lightboxHeader.push(gantt.templates.lightbox_header(task.start_date, task.end_date, task));\n s[1].innerHTML = \"\";\n s[2].innerHTML = gantt.templates.lightbox_header(task.start_date, task.end_date, task);\n } else {\n lightboxHeader.push(this.templates.task_time(task.start_date, task.end_date, task));\n lightboxHeader.push(String(this.templates.task_text(task.start_date, task.end_date, task) || \"\").substr(0, 70)); //IE6 fix\n\n s[1].innerHTML = this.templates.task_time(task.start_date, task.end_date, task);\n s[2].innerHTML = String(this.templates.task_text(task.start_date, task.end_date, task) || \"\").substr(0, 70); //IE6 fix\n }\n\n s[1].innerHTML = lightboxHeader[0];\n s[2].innerHTML = lightboxHeader[1];\n\n gantt._waiAria.lightboxHeader(box, lightboxHeader.join(\" \"));\n\n var sns = this._get_typed_lightbox_config(this.getLightboxType());\n\n for (var i = 0; i < sns.length; i++) {\n var section = sns[i];\n\n if (!this.form_blocks[section.type]) {\n continue; //skip incorrect sections, same check is done during rendering\n }\n\n var node = gantt._lightbox_root.querySelector(\"#\" + section.id).nextSibling;\n\n var block = this.form_blocks[section.type];\n\n var map_to = gantt._resolve_default_mapping(sns[i]);\n\n var value = this.defined(task[map_to]) ? task[map_to] : section.default_value;\n block.set_value.call(gantt, node, value, task, section);\n if (section.focus) block.focus.call(gantt, node);\n }\n\n if (gantt.isTaskExists(data.id)) {\n gantt._lightbox_id = data.id;\n }\n };\n\n gantt._fill_lightbox = function (id, box) {\n var task = this.getTask(id);\n\n this._set_lightbox_values(task, box);\n };\n\n gantt.getLightboxSection = function (name) {\n var config = this._get_typed_lightbox_config();\n\n var i = 0;\n\n for (i; i < config.length; i++) {\n if (config[i].name == name) break;\n }\n\n var section = config[i];\n if (!section) return null;\n if (!this._lightbox) this.getLightbox();\n\n var header = gantt._lightbox_root.querySelector(\"#\" + section.id);\n\n var node = header.nextSibling;\n var result = {\n section: section,\n header: header,\n node: node,\n getValue: function getValue(ev) {\n return gantt.form_blocks[section.type].get_value.call(gantt, node, ev || {}, section);\n },\n setValue: function setValue(value, ev) {\n return gantt.form_blocks[section.type].set_value.call(gantt, node, value, ev || {}, section);\n }\n };\n var handler = this._lightbox_methods[\"get_\" + section.type + \"_control\"];\n return handler ? handler(result) : result;\n };\n\n gantt._lightbox_methods.get_template_control = function (result) {\n result.control = result.node;\n return result;\n };\n\n gantt._lightbox_methods.get_select_control = function (result) {\n result.control = result.node.getElementsByTagName(\"select\")[0];\n return result;\n };\n\n gantt._lightbox_methods.get_textarea_control = function (result) {\n result.control = result.node.getElementsByTagName(\"textarea\")[0];\n return result;\n };\n\n gantt._lightbox_methods.get_time_control = function (result) {\n result.control = result.node.getElementsByTagName(\"select\"); // array\n\n return result;\n };\n\n gantt._init_dnd_events = function () {\n var eventElement = gantt._lightbox_root;\n this.event(eventElement, \"mousemove\", gantt._move_while_dnd);\n this.event(eventElement, \"mouseup\", gantt._finish_dnd); // GS-1952: In Salesforce environment, the lightbox is attached to the Gantt container. \n // So when Gantt is reinitialized, the events are no longer attached to the Gantt container.\n // gantt._init_dnd_events = function () {\n // };\n };\n\n gantt._move_while_dnd = function (event) {\n if (gantt._dnd_start_lb) {\n if (!document.gantt_unselectable) {\n gantt._lightbox_root.className += \" gantt_unselectable\";\n document.gantt_unselectable = true;\n }\n\n var lb = gantt.getLightbox();\n var now = [event.pageX, event.pageY];\n lb.style.top = gantt._lb_start[1] + now[1] - gantt._dnd_start_lb[1] + \"px\";\n lb.style.left = gantt._lb_start[0] + now[0] - gantt._dnd_start_lb[0] + \"px\";\n }\n };\n\n gantt._ready_to_dnd = function (event) {\n var lb = gantt.getLightbox();\n gantt._lb_start = [parseInt(lb.style.left, 10), parseInt(lb.style.top, 10)];\n gantt._dnd_start_lb = [event.pageX, event.pageY];\n };\n\n gantt._finish_dnd = function () {\n if (gantt._lb_start) {\n gantt._lb_start = gantt._dnd_start_lb = false;\n gantt._lightbox_root.className = gantt._lightbox_root.className.replace(\" gantt_unselectable\", \"\");\n document.gantt_unselectable = false;\n }\n };\n\n gantt._focus = function (node, select) {\n if (node && node.focus) {\n if (gantt.config.touch) {//do not focus editor, to prevent auto-zoom\n } else {\n try {\n if (select && node.select) node.select();\n node.focus();\n } catch (e) {// silent errors\n }\n }\n }\n };\n\n gantt.form_blocks = {\n getTimePicker: function getTimePicker(sns, hidden) {\n var html = \"\";\n var cfg = this.config;\n var i;\n var options;\n var ariaAttrs;\n var readonly;\n var display;\n var settings = {\n first: 0,\n last: 24 * 60,\n date: this.date.date_part(new Date(gantt._min_date.valueOf())),\n timeFormat: getTimeFormat(sns)\n }; // map: default order => real one\n\n sns._time_format_order = {\n size: 0\n };\n\n if (gantt.config.limit_time_select) {\n settings.first = 60 * cfg.first_hour;\n settings.last = 60 * cfg.last_hour + 1;\n settings.date.setHours(cfg.first_hour);\n }\n\n for (i = 0; i < settings.timeFormat.length; i++) {\n // adding spaces between selects\n if (i > 0) {\n html += \" \";\n }\n\n options = getHtmlTimePickerOptions(sns, i, settings);\n\n if (options) {\n ariaAttrs = gantt._waiAria.lightboxSelectAttrString(settings.timeFormat[i]);\n readonly = sns.readonly ? \"disabled='disabled'\" : \"\";\n display = hidden ? \" style='display:none' \" : \"\";\n html += \"\";\n }\n }\n\n return html;\n },\n getTimePickerValue: function getTimePickerValue(selects, config, offset) {\n var map = config._time_format_order;\n var needSetTime = gantt.defined(map[3]);\n var time;\n var hours = 0;\n var minutes = 0;\n var mapOffset = offset || 0;\n\n if (needSetTime) {\n time = parseInt(selects[map[3] + mapOffset].value, 10);\n hours = Math.floor(time / 60);\n minutes = time % 60;\n }\n\n return new Date(selects[map[2] + mapOffset].value, selects[map[1] + mapOffset].value, selects[map[0] + mapOffset].value, hours, minutes);\n },\n _fill_lightbox_select: function _fill_lightbox_select(s, i, d, map) {\n s[i + map[0]].value = d.getDate();\n s[i + map[1]].value = d.getMonth();\n s[i + map[2]].value = d.getFullYear();\n\n if (gantt.defined(map[3])) {\n var v = d.getHours() * 60 + d.getMinutes();\n v = Math.round(v / gantt._get_timepicker_step()) * gantt._get_timepicker_step();\n var input = s[i + map[3]];\n input.value = v; //in case option not shown\n\n input.setAttribute(\"data-value\", v);\n }\n },\n template: new TemplateControl(),\n textarea: new TextareaControl(),\n select: new SelectControl(),\n time: new TimeControl(),\n duration: new DurationControl(),\n parent: new ParentControl(),\n radio: new RadioControl(),\n checkbox: new CheckboxControl(),\n resources: new ResourcesControl(),\n constraint: new ConstraintControl(),\n typeselect: new TypeselectControl()\n };\n\n gantt._is_lightbox_timepicker = function () {\n var s = this._get_typed_lightbox_config();\n\n for (var i = 0; i < s.length; i++) {\n if (s[i].name == \"time\" && s[i].type == \"time\") return true;\n }\n\n return false;\n };\n\n gantt._simple_confirm = function (message, title, callback, ok) {\n if (!message) return callback();\n var opts = {\n text: message\n };\n if (title) opts.title = title;\n\n if (ok) {\n opts.ok = ok;\n }\n\n if (callback) {\n opts.callback = function (result) {\n if (result) callback();\n };\n }\n\n gantt.confirm(opts);\n };\n\n function _get_type_name(type_value) {\n for (var i in this.config.types) {\n if (this.config.types[i] == type_value) {\n return i;\n }\n }\n\n return \"task\";\n }\n\n gantt._get_typed_lightbox_config = function (type) {\n if (type === undefined) {\n type = this.getLightboxType();\n }\n\n var field = _get_type_name.call(this, type);\n\n if (gantt.config.lightbox[field + \"_sections\"]) {\n return gantt.config.lightbox[field + \"_sections\"];\n } else {\n return gantt.config.lightbox.sections;\n }\n };\n\n gantt._silent_redraw_lightbox = function (type) {\n var oldType = this.getLightboxType();\n\n if (this.getState().lightbox) {\n var taskId = this.getState().lightbox;\n var formData = this.getLightboxValues(),\n task = this.copy(this.getTask(taskId));\n this.resetLightbox();\n var updTask = this.mixin(task, formData, true);\n var box = this.getLightbox(type ? type : undefined);\n\n this._center_lightbox(this.getLightbox());\n\n this._set_lightbox_values(updTask, box);\n\n this.showCover();\n } else {\n this.resetLightbox();\n this.getLightbox(type ? type : undefined);\n }\n\n this.callEvent(\"onLightboxChange\", [oldType, this.getLightboxType()]);\n };\n\n function bindLabelsToInputs(sns) {\n var section;\n var label;\n var labelBlock;\n var inputBlock;\n var input;\n var i;\n\n for (i = 0; i < sns.length; i++) {\n section = sns[i];\n labelBlock = gantt._lightbox_root.querySelector(\"#\" + section.id);\n if (!section.id || !labelBlock) continue;\n label = labelBlock.querySelector(\"label\");\n inputBlock = labelBlock.nextSibling;\n if (!inputBlock) continue;\n input = inputBlock.querySelector(\"input, select, textarea\");\n\n if (input) {\n input.id = input.id || \"input_\" + gantt.uid();\n section.inputId = input.id;\n label.setAttribute(\"for\", section.inputId);\n }\n }\n }\n\n function getHtmlButtons(buttons, floatRight) {\n var button;\n var ariaAttr;\n var html = \"\";\n var i;\n\n for (i = 0; i < buttons.length; i++) {\n // needed to migrate from 'dhx_something' to 'gantt_something' naming in a lightbox\n button = gantt.config._migrate_buttons[buttons[i]] ? gantt.config._migrate_buttons[buttons[i]] : buttons[i];\n ariaAttr = gantt._waiAria.lightboxButtonAttrString(button);\n html += \"
\" + gantt.locale.labels[button] + \"
\";\n }\n\n return html;\n }\n\n function getTimeFormat(sns) {\n var scale;\n var unit;\n var result;\n if (sns.time_format) return sns.time_format; // default order\n\n result = [\"%d\", \"%m\", \"%Y\"];\n scale = gantt.getScale();\n unit = scale ? scale.unit : gantt.config.duration_unit;\n\n if (helpers.getSecondsInUnit(unit) < helpers.getSecondsInUnit(\"day\")) {\n result.push(\"%H:%i\");\n }\n\n return result;\n }\n\n function getHtmlTimePickerOptions(sns, index, settings) {\n var range;\n var offset;\n var start_year;\n var end_year;\n var i;\n var time;\n var diff;\n var tdate;\n var html = \"\";\n\n switch (settings.timeFormat[index]) {\n case \"%Y\":\n sns._time_format_order[2] = index;\n sns._time_format_order.size++; //year\n\n if (sns.year_range) {\n if (!isNaN(sns.year_range)) {\n range = sns.year_range;\n } else if (sns.year_range.push) {\n // if\n start_year = sns.year_range[0];\n end_year = sns.year_range[1];\n }\n }\n\n range = range || 10;\n offset = offset || Math.floor(range / 2);\n start_year = start_year || settings.date.getFullYear() - offset;\n end_year = end_year || gantt.getState().max_date.getFullYear() + offset;\n\n for (i = start_year; i < end_year; i++) {\n html += \"\";\n }\n\n break;\n\n case \"%m\":\n sns._time_format_order[1] = index;\n sns._time_format_order.size++; //month\n\n for (i = 0; i < 12; i++) {\n html += \"\";\n }\n\n break;\n\n case \"%d\":\n sns._time_format_order[0] = index;\n sns._time_format_order.size++; //days\n\n for (i = 1; i < 32; i++) {\n html += \"\";\n }\n\n break;\n\n case \"%H:%i\":\n // var last = 24*60, first = 0;\n sns._time_format_order[3] = index;\n sns._time_format_order.size++; //hours\n\n i = settings.first;\n tdate = settings.date.getDate();\n sns._time_values = [];\n\n while (i < settings.last) {\n time = gantt.templates.time_picker(settings.date);\n html += \"\";\n\n sns._time_values.push(i);\n\n settings.date.setTime(settings.date.valueOf() + gantt._get_timepicker_step() * 60 * 1000);\n diff = settings.date.getDate() != tdate ? 1 : 0; // moved or not to the next day\n\n i = diff * 24 * 60 + settings.date.getHours() * 60 + settings.date.getMinutes();\n }\n\n break;\n\n default:\n break;\n }\n\n return html;\n }\n};","module.exports = function (gantt) {\n gantt.config.touch_drag = 500; //nearly immediate dnd\n\n gantt.config.touch = true;\n gantt.config.touch_feedback = true;\n gantt.config.touch_feedback_duration = 1;\n gantt._prevent_touch_scroll = false;\n\n gantt._touch_feedback = function () {\n if (gantt.config.touch_feedback) {\n if (navigator.vibrate) navigator.vibrate(gantt.config.touch_feedback_duration);\n }\n };\n\n gantt.attachEvent(\"onGanttReady\", gantt.bind(function () {\n if (this.config.touch != \"force\") this.config.touch = this.config.touch && (navigator.userAgent.indexOf(\"Mobile\") != -1 || navigator.userAgent.indexOf(\"iPad\") != -1 || navigator.userAgent.indexOf(\"Android\") != -1 || navigator.userAgent.indexOf(\"Touch\") != -1) || navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1;\n\n if (this.config.touch) {\n var touchEventsSupported = true;\n\n try {\n document.createEvent(\"TouchEvent\");\n } catch (e) {\n touchEventsSupported = false;\n }\n\n if (touchEventsSupported) {\n this._touch_events([\"touchmove\", \"touchstart\", \"touchend\"], function (ev) {\n if (ev.touches && ev.touches.length > 1) return null;\n if (ev.touches[0]) return {\n target: ev.target,\n pageX: ev.touches[0].pageX,\n pageY: ev.touches[0].pageY,\n clientX: ev.touches[0].clientX,\n clientY: ev.touches[0].clientY\n };else return ev;\n }, function () {\n return false;\n });\n } else if (window.navigator.pointerEnabled) {\n this._touch_events([\"pointermove\", \"pointerdown\", \"pointerup\"], function (ev) {\n if (ev.pointerType == \"mouse\") return null;\n return ev;\n }, function (ev) {\n return !ev || ev.pointerType == \"mouse\";\n });\n } else if (window.navigator.msPointerEnabled) {\n this._touch_events([\"MSPointerMove\", \"MSPointerDown\", \"MSPointerUp\"], function (ev) {\n if (ev.pointerType == ev.MSPOINTER_TYPE_MOUSE) return null;\n return ev;\n }, function (ev) {\n return !ev || ev.pointerType == ev.MSPOINTER_TYPE_MOUSE;\n });\n }\n }\n }, gantt));\n\n function findTargetView(event) {\n var allViews = gantt.$layout.getCellsByType(\"viewCell\");\n\n for (var i = 0; i < allViews.length; i++) {\n var box = allViews[i].$view.getBoundingClientRect();\n\n if (event.clientX >= box.left && event.clientX <= box.right && event.clientY <= box.bottom && event.clientY >= box.top) {\n return allViews[i];\n }\n }\n }\n\n function getScrollState(view) {\n var scrollX = view.$config.scrollX ? gantt.$ui.getView(view.$config.scrollX) : null;\n var scrollY = view.$config.scrollY ? gantt.$ui.getView(view.$config.scrollY) : null;\n var scrollState = {\n x: null,\n y: null\n };\n\n if (scrollX) {\n var state = scrollX.getScrollState();\n\n if (state.visible) {\n scrollState.x = scrollX.$view.scrollLeft;\n }\n }\n\n if (scrollY) {\n var state = scrollY.getScrollState();\n\n if (state.visible) {\n scrollState.y = scrollY.$view.scrollTop;\n }\n }\n\n return scrollState;\n }\n\n function scrollView(view, left, top) {\n var scrollX = view.$config.scrollX ? gantt.$ui.getView(view.$config.scrollX) : null;\n var scrollY = view.$config.scrollY ? gantt.$ui.getView(view.$config.scrollY) : null;\n\n if (scrollX) {\n scrollX.scrollTo(left, null);\n }\n\n if (scrollY) {\n scrollY.scrollTo(null, top);\n }\n }\n\n function getTaskDND() {\n var tasksDnD;\n\n if (gantt.$ui.getView(\"timeline\")) {\n tasksDnD = gantt.$ui.getView(\"timeline\")._tasks_dnd;\n }\n\n return tasksDnD;\n }\n\n var touchHandlers = []; //we can't use native scrolling, as we need to sync momentum between different parts\n //so we will block native scroll and use the custom one\n //in future we can add custom momentum\n\n gantt._touch_events = function (names, accessor, ignore) {\n //webkit on android need to be handled separately\n var dblclicktime = 0;\n var actionMode = false;\n var scrollMode = false;\n var actionStart = null;\n var scrollState;\n var longTapTimer = null;\n var currentDndId = null;\n var dndNodes = [];\n var targetView = null;\n\n for (var i = 0; i < touchHandlers.length; i++) {\n gantt.eventRemove(touchHandlers[i][0], touchHandlers[i][1], touchHandlers[i][2]);\n }\n\n touchHandlers = []; //touch move\n\n touchHandlers.push([gantt.$container, names[0], function (e) {\n var tasksDnD = getTaskDND();\n if (ignore(e)) return; //ignore common and scrolling moves\n\n if (!actionMode) return;\n if (longTapTimer) clearTimeout(longTapTimer);\n var source = accessor(e);\n\n if (tasksDnD && (tasksDnD.drag.id || tasksDnD.drag.start_drag)) {\n tasksDnD.on_mouse_move(source);\n if (e.preventDefault) e.preventDefault();\n e.cancelBubble = true;\n return false;\n }\n\n if (!gantt._prevent_touch_scroll) {\n if (source && actionStart) {\n var dx = actionStart.pageX - source.pageX;\n var dy = actionStart.pageY - source.pageY;\n\n if (!scrollMode && (Math.abs(dx) > 5 || Math.abs(dy) > 5)) {\n scrollMode = true; //gantt._touch_scroll_active = scroll_mode = true;\n\n dblclicktime = 0;\n\n if (targetView) {\n scrollState = getScrollState(targetView);\n } else {\n scrollState = gantt.getScrollState();\n }\n }\n\n if (scrollMode) {\n var newScrollState;\n var scrollX = scrollState.x + dx;\n var scrollY = scrollState.y + dy;\n\n if (targetView) {\n scrollView(targetView, scrollX, scrollY);\n newScrollState = getScrollState(targetView);\n } else {\n gantt.scrollTo(scrollX, scrollY);\n newScrollState = gantt.getScrollState();\n }\n\n if (scrollState.x != newScrollState.x && dy > 2 * dx || scrollState.y != newScrollState.y && dx > 2 * dy) {\n return block_action(e);\n }\n }\n }\n\n return block_action(e);\n }\n\n return true;\n }]); //block touch context menu in IE10\n\n touchHandlers.push([this.$container, \"contextmenu\", function (e) {\n if (actionMode) return block_action(e);\n }]); //touch start\n\n touchHandlers.push([this.$container, names[1], function (e) {\n // block pull-to-refresh\n if (document && document.body) {\n document.body.classList.add(\"gantt_touch_active\");\n }\n\n if (ignore(e)) return;\n\n if (e.touches && e.touches.length > 1) {\n actionMode = false;\n return;\n }\n\n actionStart = accessor(e);\n targetView = findTargetView(actionStart);\n\n if (!gantt._locate_css(actionStart, \"gantt_hor_scroll\") && !gantt._locate_css(actionStart, \"gantt_ver_scroll\")) {\n actionMode = true;\n }\n\n var tasksDnD = getTaskDND(); //long tap\n\n longTapTimer = setTimeout(function () {\n var taskId = gantt.locate(actionStart);\n\n if (tasksDnD && taskId && !gantt._locate_css(actionStart, \"gantt_link_control\") && !gantt._locate_css(actionStart, \"gantt_grid_data\")) {\n tasksDnD.on_mouse_down(actionStart);\n\n if (tasksDnD.drag && tasksDnD.drag.start_drag) {\n cloneTaskRendered(taskId);\n\n tasksDnD._start_dnd(actionStart);\n\n gantt._touch_drag = true;\n gantt.refreshTask(taskId);\n\n gantt._touch_feedback();\n }\n }\n\n longTapTimer = null;\n }, gantt.config.touch_drag);\n }]); //touch end\n\n touchHandlers.push([this.$container, names[2], function (e) {\n if (document && document.body) {\n document.body.classList.remove(\"gantt_touch_active\");\n }\n\n if (ignore(e)) return;\n if (longTapTimer) clearTimeout(longTapTimer);\n gantt._touch_drag = false;\n actionMode = false;\n var source = accessor(e);\n var tasksDnD = getTaskDND();\n if (tasksDnD) tasksDnD.on_mouse_up(source);\n\n if (currentDndId && gantt.isTaskExists(currentDndId)) {\n gantt.refreshTask(currentDndId);\n\n if (dndNodes.length) {\n dndNodes.forEach(function (node) {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n });\n\n gantt._touch_feedback();\n }\n } //gantt._touch_scroll_active = action_mode = scroll_mode = false;\n\n\n actionMode = scrollMode = false;\n dndNodes = [];\n currentDndId = null; //dbl-tap handling\n\n if (actionStart && dblclicktime) {\n var now = new Date();\n\n if (now - dblclicktime < 500) {\n var mouseEvents = gantt.$services.getService(\"mouseEvents\");\n mouseEvents.onDoubleClick(actionStart);\n block_action(e);\n } else dblclicktime = now;\n } else {\n dblclicktime = new Date();\n }\n }]);\n\n for (var i = 0; i < touchHandlers.length; i++) {\n gantt.event(touchHandlers[i][0], touchHandlers[i][1], touchHandlers[i][2]);\n } //common helper, prevents event\n\n\n function block_action(e) {\n if (e && e.preventDefault) {\n e.preventDefault();\n }\n\n e.cancelBubble = true;\n return false;\n }\n\n function cloneTaskRendered(taskId) {\n var renders = gantt._getTaskLayers();\n\n var task = gantt.getTask(taskId);\n\n if (task && gantt.isTaskVisible(taskId)) {\n currentDndId = taskId;\n\n for (var i = 0; i < renders.length; i++) {\n task = renders[i].rendered[taskId];\n\n if (task && task.getAttribute(gantt.config.task_attribute) && task.getAttribute(gantt.config.task_attribute) == taskId) {\n var copy = task.cloneNode(true);\n dndNodes.push(task);\n renders[i].rendered[taskId] = copy;\n task.style.display = \"none\";\n copy.className += \" gantt_drag_move \";\n task.parentNode.appendChild(copy); //return copy;\n }\n }\n }\n }\n };\n};","import * as env from \"../../../utils/env\";\r\nimport * as eventable from \"../../../utils/eventable\";\r\nimport { IScale, TModifierKeys } from \"../../common/config\";\r\n\r\ninterface ITimelineZoomConfig {\r\n\thandler?: (e: Event) => {};\r\n\tstartDate?: Date;\r\n\tendDate?: Date;\r\n\tlevels: IZoomLevel[];\r\n\tactiveLevelIndex?: number;\r\n\twidthStep?: number;\r\n\tminColumnWidth?: number;\r\n\tmaxColumnWidth?: number;\r\n\tuseKey?: \"ctrlKey\" | \"altKey\" | \"shiftKey\";\r\n\ttrigger?: \"wheel\" | null | undefined;\r\n\telement?: Element | (() => Element);\r\n}\r\n\r\nconst USE_KEY = [\"ctrlKey\", \"altKey\", \"shiftKey\", \"metaKey\"];\r\n\r\ninterface IZoomLevel {\r\n\tname?: string;\r\n\tscale_height?: number;\r\n\tmin_column_width: number;\r\n\tscales: IScale[];\r\n}\r\n\r\nconst _defaultScales = [\r\n\t[\r\n\t\t{\r\n\t\t\tunit: \"month\",\r\n\t\t\tdate: \"%M\",\r\n\t\t\tstep: 1\r\n\t\t},\r\n\t\t{\r\n\t\t\tunit: \"day\",\r\n\t\t\tdate: \"%d\",\r\n\t\t\tstep: 1\r\n\t\t}\r\n\t],\r\n\t[\r\n\t\t{\r\n\t\t\tunit: \"day\",\r\n\t\t\tdate: \"%d %M\",\r\n\t\t\tstep: 1\r\n\t\t}\r\n\t],\r\n\t[\r\n\t\t{\r\n\t\t\tunit: \"day\",\r\n\t\t\tdate: \"%d %M\",\r\n\t\t\tstep: 1\r\n\t\t},\r\n\t\t{\r\n\t\t\tunit: \"hour\",\r\n\t\t\tdate: \"%H:00\",\r\n\t\t\tstep: 8\r\n\t\t},\r\n\t],\r\n\t[\r\n\t\t{\r\n\t\t\tunit: \"day\",\r\n\t\t\tdate: \"%d %M\",\r\n\t\t\tstep: 1\r\n\t\t},\r\n\t\t{\r\n\t\t\tunit: \"hour\",\r\n\t\t\tdate: \"%H:00\",\r\n\t\t\tstep: 1\r\n\t\t},\r\n\t],\r\n];\r\n\r\nexport default class TimelineZoom {\r\n\tpublic attachEvent: (eventName: string, handler: () => void) => string;\r\n\tpublic callEvent: (eventName: string, args: any[]) => any;\r\n\tpublic detachEvent: (eventName: string) => any;\r\n\tprotected _initialStartDate: Date;\r\n\tprotected _initialEndDate: Date;\r\n\tprotected _activeLevelIndex: number;\r\n\tprotected _levels: IZoomLevel[];\r\n\tprotected _handler: (e: any) => void;\r\n\tprotected $gantt;\r\n\tprotected _widthStep: number;\r\n\tprotected _minColumnWidth: number;\r\n\tprotected _maxColumnWidth: number;\r\n\tprotected _useKey: TModifierKeys;\r\n\tprotected _visibleDate: Date;\r\n\tprotected _initialized: boolean;\r\n\tprotected _domEvents: any;\r\n\r\n\tconstructor(gantt) {\r\n\t\tthis.$gantt = gantt;\r\n\t\tthis._domEvents = this.$gantt._createDomEventScope();\r\n\t}\r\n\r\n\tpublic init(config: ITimelineZoomConfig) {\r\n\t\t// GS-1354 and GS-1318. If we check the headless mode using the function,\r\n\t\t// it will return false when Gantt is not initialized, but we may want to do it later\r\n\t\tif(this.$gantt.env.isNode){\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tthis._initialStartDate = config.startDate;\r\n\t\tthis._initialEndDate = config.endDate;\r\n\t\tthis._activeLevelIndex = config.activeLevelIndex ? config.activeLevelIndex : 0;\r\n\t\tthis._levels = this._mapScales(config.levels || _defaultScales);\r\n\t\tthis._handler = config.handler || this._defaultHandler;\r\n\t\tthis._minColumnWidth = config.minColumnWidth || 60;\r\n\t\tthis._maxColumnWidth = config.maxColumnWidth || 240;\r\n\t\tthis._widthStep = config.widthStep || 3/8 * config.minColumnWidth;\r\n\t\tthis._useKey = config.useKey;\r\n\r\n\t\tif(!this._initialized){\r\n\t\t\teventable(this);\r\n\t\t\tthis.$gantt.attachEvent(\"onGanttScroll\", () => {\r\n\t\t\t\tthis._getVisibleDate();\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tthis._domEvents.detachAll();\r\n\r\n\t\tif(config.trigger === \"wheel\"){\r\n\t\t\tif(this.$gantt.$root){\r\n\t\t\t\tthis._attachWheelEvent(config);\r\n\t\t\t}else{\r\n\t\t\t\tthis.$gantt.attachEvent(\"onGanttReady\", () => {\r\n\t\t\t\t\tthis._attachWheelEvent(config);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthis._initialized = true;\r\n\t\tthis.setLevel(this._activeLevelIndex);\r\n\t}\r\n\r\n\tpublic zoomIn = () => {\r\n\t\tconst index = this.getCurrentLevel() - 1;\r\n\t\tif(index < 0){\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tthis.setLevel(index);\r\n\t}\r\n\r\n\tpublic zoomOut = () => {\r\n\t\tconst index = this.getCurrentLevel() + 1;\r\n\t\tif(index > this._levels.length - 1){\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tthis.setLevel(index);\r\n\t}\r\n\r\n\tpublic getCurrentLevel = () => {\r\n\t\treturn this._activeLevelIndex;\r\n\t}\r\n\r\n\tpublic getLevels = () => {\r\n\t\treturn this._levels;\r\n\t}\r\n\r\n\tpublic setLevel = (level: number|string) => {\r\n\t\tconst zoomLevel = this._getZoomIndexByName(level);\r\n\r\n\t\tif(zoomLevel === -1){\r\n\t\t\tthis.$gantt.assert(zoomLevel !== -1, \"Invalid zoom level for gantt.ext.zoom.setLevel. \" + level + \" is not an expected value.\");\r\n\t\t}\r\n\t\tthis._setLevel(zoomLevel, 0);\r\n\t}\r\n\r\n\tprotected _getZoomIndexByName = (levelName: number|string) => {\r\n\t\tlet zoomLevel:number = -1;\r\n\t\tif(typeof levelName === \"string\"){\r\n\t\t\tif(!isNaN(Number(levelName)) && this._levels[Number(levelName)]){\r\n\t\t\t\tzoomLevel = Number(levelName);\r\n\t\t\t}else{\r\n\t\t\t\tfor(let i = 0; i < this._levels.length; i++){\r\n\t\t\t\t\tif(this._levels[i].name === levelName){\r\n\t\t\t\t\t\tzoomLevel = i;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\tzoomLevel = levelName;\r\n\t\t}\r\n\t\treturn zoomLevel;\r\n\t}\r\n\r\n\tprotected _mapScales(levels: IScale[][] | any): IZoomLevel[]{\r\n\t\treturn levels.map((l) => {\r\n\t\t\tif(Array.isArray(l)){\r\n\t\t\t\treturn {\r\n\t\t\t\t\tscales: l\r\n\t\t\t\t};\r\n\t\t\t}else{\r\n\t\t\t\treturn l;\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tprotected _getVisibleDate = () => {\r\n\t\t// GS-1450. Don't try to get the visible date if there is no timeline\r\n\t\tif (!this.$gantt.$task){\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\tconst scrollPos = this.$gantt.getScrollState().x;\r\n\t\tconst viewPort = this.$gantt.$task.offsetWidth;\r\n\t\tthis._visibleDate = this.$gantt.dateFromPos(scrollPos + viewPort/2);\r\n\t}\r\n\r\n\tprotected _setLevel = (level: number, cursorOffset: number) => {\r\n\t\tthis._activeLevelIndex = level;\r\n\r\n\t\tconst gantt = this.$gantt;\r\n\t\tconst nextConfig = gantt.copy(this._levels[this._activeLevelIndex]);\r\n\t\tconst chartConfig = gantt.copy(nextConfig);\r\n\t\tdelete chartConfig.name;\r\n\r\n\t\tgantt.mixin(gantt.config, chartConfig, true);\r\n\r\n\t\tconst isRendered = !!gantt.$root && !!gantt.$task;\r\n\r\n\t\tif(isRendered){\r\n\t\t\tif(cursorOffset){\r\n\t\t\t\tconst cursorDate = this.$gantt.dateFromPos(cursorOffset + this.$gantt.getScrollState().x);\r\n\t\t\t\tthis.$gantt.render();\r\n\t\t\t\tconst newPosition = this.$gantt.posFromDate(cursorDate);\r\n\t\t\t\tthis.$gantt.scrollTo(newPosition - cursorOffset);\r\n\t\t\t}else{\r\n\t\t\t\tconst viewPort = this.$gantt.$task.offsetWidth;\r\n\t\t\t\tif(!this._visibleDate){\r\n\t\t\t\t\tthis._getVisibleDate();\r\n\t\t\t\t}\r\n\t\t\t\tconst middleDate = this._visibleDate;\r\n\t\t\t\tthis.$gantt.render();\r\n\t\t\t\tconst newPosition = this.$gantt.posFromDate(middleDate);\r\n\t\t\t\tthis.$gantt.scrollTo(newPosition - viewPort/2);\r\n\t\t\t}\r\n\r\n\t\t\tthis.callEvent(\"onAfterZoom\", [this._activeLevelIndex, nextConfig]);\r\n\t\t}\r\n\t}\r\n\r\n\tprivate _attachWheelEvent = (config) => {\r\n\t\tconst event = env.isFF ? \"wheel\" : \"mousewheel\";\r\n\t\tlet el: Element;\r\n\t\tif(typeof config.element === \"function\"){\r\n\t\t\tel = config.element();\r\n\t\t}else{\r\n\t\t\tel = config.element as Element;\r\n\t\t}\r\n\t\tif (!el){\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tthis._domEvents.attach(el, event, this.$gantt.bind(function(e) {\r\n\t\t\tif (this._useKey) {\r\n\t\t\t\tif (USE_KEY.indexOf(this._useKey) < 0) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t\tif (!e[this._useKey]) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (typeof this._handler === \"function\") {\r\n\t\t\t\tthis._handler.apply(this, [e]);\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}, this), {passive: false});\r\n\t}\r\n\r\n\tprivate _defaultHandler = (e: any):void => {\r\n\t\tconst timelineOffset = this.$gantt.$task.getBoundingClientRect().x;\r\n\t\tconst cursorOffset = e.clientX - timelineOffset;\r\n\t\tconst wheelY = this.$gantt.env.isFF ? (e.deltaY*-40) : e.wheelDelta;\r\n\t\tlet wheelUp = false;\r\n\t\tif (wheelY > 0) {\r\n\t\t\twheelUp = true;\r\n\t\t}\r\n\t\te.preventDefault();\r\n\t\te.stopPropagation();\r\n\t\tthis._setScaleSettings(wheelUp, cursorOffset);\r\n\t}\r\n\r\n\tprivate _setScaleSettings(wheelUp: boolean, cursorOffset: number) {\r\n\t\tif (wheelUp) {\r\n\t\t\tthis._stepUp(cursorOffset);\r\n\t\t} else {\r\n\t\t\tthis._stepDown(cursorOffset);\r\n\t\t}\r\n\t}\r\n\r\n\tprivate _setScaleDates = () => {\r\n\t\tif(this._initialStartDate && this._initialEndDate){\r\n\t\t\tthis.$gantt.config.start_date = this._initialStartDate;\r\n\t\t\tthis.$gantt.config.end_date = this._initialEndDate;\r\n\t\t}\r\n\t}\r\n\r\n\tprivate _stepUp(cursorOffset) {\r\n\t\tif (this._activeLevelIndex >= this._levels.length - 1) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet nextLevel = this._activeLevelIndex;\r\n\t\tthis._setScaleDates();\r\n\r\n\t\tif(this._widthStep){\r\n\t\t\tlet newColumnWidth = this.$gantt.config.min_column_width + this._widthStep;\r\n\t\t\tif (newColumnWidth > this._maxColumnWidth) {\r\n\t\t\t\tnewColumnWidth = this._minColumnWidth;\r\n\t\t\t\tnextLevel++;\r\n\t\t\t}\r\n\r\n\t\t\tthis.$gantt.config.min_column_width = newColumnWidth;\r\n\t\t}else{\r\n\t\t\tnextLevel++;\r\n\t\t}\r\n\t\tthis._setLevel(nextLevel, cursorOffset);\r\n\t}\r\n\tprivate _stepDown(cursorOffset) {\r\n\t\tif (this._activeLevelIndex < 1) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet nextLevel = this._activeLevelIndex;\r\n\t\tthis._setScaleDates();\r\n\r\n\t\tif(this._widthStep){\r\n\t\t\tlet newColumnWidth = this.$gantt.config.min_column_width - this._widthStep;\r\n\t\t\tif (newColumnWidth < this._minColumnWidth) {\r\n\t\t\t\tnewColumnWidth = this._maxColumnWidth;\r\n\t\t\t\tnextLevel--;\r\n\t\t\t}\r\n\t\t\tthis.$gantt.config.min_column_width = newColumnWidth;\r\n\t\t}else{\r\n\t\t\tnextLevel--;\r\n\t\t}\r\n\t\tthis._setLevel(nextLevel, cursorOffset);\r\n\t}\r\n}","if (window.dhtmlx) {\n if (!window.dhtmlx.attaches) window.dhtmlx.attaches = {};\n\n window.dhtmlx.attaches.attachGantt = function (start, end, gantt) {\n var obj = document.createElement(\"DIV\");\n gantt = gantt || window.gantt;\n obj.id = \"gantt_\" + gantt.uid();\n obj.style.width = \"100%\";\n obj.style.height = \"100%\";\n obj.cmp = \"grid\";\n document.body.appendChild(obj);\n this.attachObject(obj.id);\n this.dataType = \"gantt\";\n this.dataObj = gantt;\n var that = this.vs[this.av];\n that.grid = gantt;\n gantt.init(obj.id, start, end);\n obj.firstChild.style.border = \"none\";\n that.gridId = obj.id;\n that.gridObj = obj;\n var method_name = \"_viewRestore\";\n return this.vs[this[method_name]()].grid;\n };\n}\n\nif (typeof window.dhtmlXCellObject != \"undefined\") {\n window.dhtmlXCellObject.prototype.attachGantt = function (start, end, gantt) {\n gantt = gantt || window.gantt;\n var obj = document.createElement(\"DIV\");\n obj.id = \"gantt_\" + gantt.uid();\n obj.style.width = \"100%\";\n obj.style.height = \"100%\";\n obj.cmp = \"grid\";\n document.body.appendChild(obj);\n this.attachObject(obj.id);\n this.dataType = \"gantt\";\n this.dataObj = gantt;\n gantt.init(obj.id, start, end);\n obj.firstChild.style.border = \"none\";\n obj = null;\n this.callEvent(\"_onContentAttach\", []);\n return this.dataObj;\n };\n}\n\nmodule.exports = null;","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nif (window.jQuery) {\n (function ($) {\n var methods = [];\n\n $.fn.dhx_gantt = function (config) {\n config = config || {};\n\n if (typeof config === 'string') {\n if (methods[config]) {\n return methods[config].apply(this, []);\n } else {\n $.error('Method ' + config + ' does not exist on jQuery.dhx_gantt');\n }\n } else {\n var views = [];\n this.each(function () {\n if (this && this.getAttribute) {\n if (!this.gantt && !(window.gantt.$root == this)) {\n var newgantt = window.gantt.$container && window.Gantt ? window.Gantt.getGanttInstance() : window.gantt;\n\n for (var key in config) {\n if (key != \"data\") newgantt.config[key] = config[key];\n }\n\n newgantt.init(this);\n if (config.data) newgantt.parse(config.data);\n views.push(newgantt);\n } else views.push(_typeof(this.gantt) == \"object\" ? this.gantt : window.gantt);\n }\n });\n if (views.length === 1) return views[0];\n return views;\n }\n };\n })(window.jQuery);\n}\n\nmodule.exports = null;","var domHelpers = require(\"../utils/dom_helpers\");\n\nvar isHeadless = require(\"../../../utils/is_headless\");\n\nmodule.exports = function (gantt) {\n var scrollRange = 50,\n scrollStep = 30,\n scrollDelay = 10,\n scrollSpeed = 50;\n var interval = null,\n isMove = false,\n delayTimeout = null,\n startPos = {\n started: false\n },\n eventPos = {};\n\n function isDisplayed(element) {\n return element && domHelpers.isChildOf(element, gantt.$root) && element.offsetHeight;\n }\n\n function getAutoscrollContainer() {\n var element;\n\n if (isDisplayed(gantt.$task)) {\n element = gantt.$task;\n } else if (isDisplayed(gantt.$grid)) {\n element = gantt.$grid;\n } else {\n element = gantt.$root;\n }\n\n return element;\n }\n\n function isScrollState() {\n var dragMarker = !!document.querySelector(\".gantt_drag_marker\");\n var isResize = !!document.querySelector(\".gantt_drag_marker.gantt_grid_resize_area\") || !!document.querySelector(\".gantt_drag_marker.gantt_row_grid_resize_area\");\n var isLink = !!document.querySelector(\".gantt_link_direction\");\n var state = gantt.getState();\n var isClickDrag = state.autoscroll;\n isMove = dragMarker && !isResize && !isLink;\n return !(!state.drag_mode && !dragMarker || isResize) || isClickDrag;\n }\n\n function defineDelayTimeout(state) {\n if (delayTimeout) {\n clearTimeout(delayTimeout);\n delayTimeout = null;\n }\n\n if (state) {\n var speed = gantt.config.autoscroll_speed;\n if (speed && speed < 10) // limit speed value to 10\n speed = 10;\n delayTimeout = setTimeout(function () {\n interval = setInterval(tick, speed || scrollSpeed);\n }, gantt.config.autoscroll_delay || scrollDelay);\n }\n }\n\n function defineScrollInterval(state) {\n if (state) {\n defineDelayTimeout(true);\n\n if (!startPos.started) {\n startPos.x = eventPos.x;\n startPos.y = eventPos.y;\n startPos.started = true;\n }\n } else {\n if (interval) {\n clearInterval(interval);\n interval = null;\n }\n\n defineDelayTimeout(false);\n startPos.started = false;\n }\n }\n\n function autoscrollInterval(event) {\n var isScroll = isScrollState();\n\n if ((interval || delayTimeout) && !isScroll) {\n defineScrollInterval(false);\n }\n\n if (!gantt.config.autoscroll || !isScroll) {\n return false;\n }\n\n eventPos = {\n x: event.clientX,\n y: event.clientY\n }; // if it is a mobile device, we need to detect the touch event coords\n\n if (event.type == \"touchmove\") {\n eventPos.x = event.targetTouches[0].clientX;\n eventPos.y = event.targetTouches[0].clientY;\n }\n\n if (!interval && isScroll) {\n defineScrollInterval(true);\n }\n }\n\n function tick() {\n if (!isScrollState()) {\n defineScrollInterval(false);\n return false;\n }\n\n var container = getAutoscrollContainer();\n\n if (!container) {\n return;\n } // GS-1150: if we reorder or resize something in the grid, we should obtain the grid container\n\n\n var gridDrag = false;\n var gridMarkers = [\".gantt_drag_marker.gantt_grid_resize_area\", \".gantt_drag_marker .gantt_row.gantt_row_task\", \".gantt_drag_marker.gantt_grid_dnd_marker\"];\n gridMarkers.forEach(function (selector) {\n gridDrag = gridDrag || !!document.querySelector(selector);\n });\n\n if (gridDrag) {\n container = gantt.$grid;\n }\n\n var box = domHelpers.getNodePosition(container);\n var posX = eventPos.x - box.x;\n var posY = eventPos.y - box.y + window.scrollY; // GS-1315: window.scrollY here and below for the elements above Gantt\n\n var scrollLeft = isMove ? 0 : need_scroll(posX, box.width, startPos.x - box.x);\n var scrollTop = need_scroll(posY, box.height, startPos.y - box.y + window.scrollY);\n var scrollState = gantt.getScrollState();\n var currentScrollTop = scrollState.y,\n scrollOuterHeight = scrollState.inner_height,\n scrollInnerHeight = scrollState.height,\n currentScrollLeft = scrollState.x,\n scrollOuterWidth = scrollState.inner_width,\n scrollInnerWidth = scrollState.width; // do scrolling only if we have scrollable area to do so\n\n if (scrollTop && !scrollOuterHeight) {\n scrollTop = 0;\n } else if (scrollTop < 0 && !currentScrollTop) {\n scrollTop = 0;\n } else if (scrollTop > 0 && currentScrollTop + scrollOuterHeight >= scrollInnerHeight + 2) {\n scrollTop = 0;\n }\n\n if (scrollLeft && !scrollOuterWidth) {\n scrollLeft = 0;\n } else if (scrollLeft < 0 && !currentScrollLeft) {\n scrollLeft = 0;\n } else if (scrollLeft > 0 && currentScrollLeft + scrollOuterWidth >= scrollInnerWidth) {\n scrollLeft = 0;\n }\n\n var step = gantt.config.autoscroll_step;\n if (step && step < 2) // limit step value to 2\n step = 2;\n scrollLeft = scrollLeft * (step || scrollStep);\n scrollTop = scrollTop * (step || scrollStep);\n\n if (scrollLeft || scrollTop) {\n scroll(scrollLeft, scrollTop);\n }\n }\n\n function need_scroll(pos, boxSize, startCoord) {\n if (pos - scrollRange < 0 && pos < startCoord) return -1;else if (pos > boxSize - scrollRange && pos > startCoord) return 1;\n return 0;\n }\n\n function scroll(left, top) {\n var scrollState = gantt.getScrollState();\n var scrollLeft = null,\n scrollTop = null;\n\n if (left) {\n scrollLeft = scrollState.x + left;\n scrollLeft = Math.min(scrollState.width, scrollLeft);\n scrollLeft = Math.max(0, scrollLeft);\n }\n\n if (top) {\n scrollTop = scrollState.y + top;\n scrollTop = Math.min(scrollState.height, scrollTop);\n scrollTop = Math.max(0, scrollTop);\n }\n\n gantt.scrollTo(scrollLeft, scrollTop);\n }\n\n gantt.attachEvent(\"onGanttReady\", function () {\n if (!isHeadless(gantt)) {\n var eventElement = domHelpers.getRootNode(gantt.$root) || document.body;\n gantt.eventRemove(eventElement, \"mousemove\", autoscrollInterval);\n gantt.event(eventElement, \"mousemove\", autoscrollInterval);\n gantt.eventRemove(eventElement, \"touchmove\", autoscrollInterval);\n gantt.event(eventElement, \"touchmove\", autoscrollInterval);\n gantt.eventRemove(eventElement, \"pointermove\", autoscrollInterval);\n gantt.event(eventElement, \"pointermove\", autoscrollInterval);\n }\n });\n gantt.attachEvent(\"onDestroy\", function () {\n defineScrollInterval(false);\n });\n};","module.exports = function (gantt) {\n if (!gantt.ext) {\n gantt.ext = {};\n }\n\n var modules = [require(\"./autoscroll\"), require(\"./jquery_hooks\"), require(\"./dhtmlx_hooks\")];\n\n for (var i = 0; i < modules.length; i++) {\n if (modules[i]) modules[i](gantt);\n }\n\n var TimelineZoom = require(\"./timeline_zoom\")[\"default\"];\n\n gantt.ext.zoom = new TimelineZoom(gantt);\n};","module.exports = function (gantt) {\n gantt.skins[\"contrast_white\"] = {\n config: {\n grid_width: 360,\n row_height: 35,\n scale_height: 35,\n link_line_width: 2,\n link_arrow_size: 6,\n lightbox_additional_height: 75\n },\n _second_column_width: 100,\n _third_column_width: 80\n };\n};","module.exports = function (gantt) {\n gantt.skins[\"contrast_black\"] = {\n config: {\n grid_width: 360,\n row_height: 35,\n scale_height: 35,\n link_line_width: 2,\n link_arrow_size: 6,\n lightbox_additional_height: 75\n },\n _second_column_width: 100,\n _third_column_width: 80\n };\n};","module.exports = function (gantt) {\n gantt.skins.material = {\n config: {\n grid_width: 411,\n row_height: 34,\n task_height_offset: 6,\n scale_height: 36,\n link_line_width: 2,\n link_arrow_size: 6,\n lightbox_additional_height: 80\n },\n _second_column_width: 110,\n _third_column_width: 75,\n _redefine_lightbox_buttons: {\n \"buttons_left\": [\"dhx_delete_btn\"],\n \"buttons_right\": [\"dhx_save_btn\", \"dhx_cancel_btn\"]\n }\n };\n gantt.attachEvent(\"onAfterTaskDrag\", function (id) {\n var t = gantt.getTaskNode(id);\n\n if (t) {\n t.className += \" gantt_drag_animation\";\n setTimeout(function () {\n var indx = t.className.indexOf(\" gantt_drag_animation\");\n\n if (indx > -1) {\n t.className = t.className.slice(0, indx);\n }\n }, 200);\n }\n });\n};","module.exports = function (gantt) {\n gantt.skins.broadway = {\n config: {\n grid_width: 360,\n row_height: 35,\n scale_height: 35,\n link_line_width: 1,\n link_arrow_size: 7,\n lightbox_additional_height: 86\n },\n _second_column_width: 90,\n _third_column_width: 80,\n _lightbox_template: \"
 
\",\n _config_buttons_left: {},\n _config_buttons_right: {\n \"gantt_delete_btn\": \"icon_delete\",\n \"gantt_save_btn\": \"icon_save\"\n }\n };\n};","module.exports = function (gantt) {\n gantt.skins.terrace = {\n config: {\n grid_width: 360,\n row_height: 35,\n scale_height: 35,\n link_line_width: 2,\n link_arrow_size: 6,\n lightbox_additional_height: 75\n },\n _second_column_width: 90,\n _third_column_width: 70\n };\n};","module.exports = function (gantt) {\n gantt.skins.meadow = {\n config: {\n grid_width: 350,\n row_height: 27,\n scale_height: 30,\n link_line_width: 2,\n link_arrow_size: 6,\n lightbox_additional_height: 72\n },\n _second_column_width: 95,\n _third_column_width: 80\n };\n};","module.exports = function (gantt) {\n gantt.skins.skyblue = {\n config: {\n grid_width: 350,\n row_height: 27,\n scale_height: 27,\n link_line_width: 1,\n link_arrow_size: 8,\n lightbox_additional_height: 75\n },\n _second_column_width: 95,\n _third_column_width: 80\n };\n};","function _configure(col, data, force) {\n for (var key in data) {\n if (typeof col[key] == \"undefined\" || force) col[key] = data[key];\n }\n}\n\nfunction _get_skin(force, gantt) {\n var skin = gantt.skin;\n\n if (!skin || force) {\n var links = document.getElementsByTagName(\"link\");\n\n for (var i = 0; i < links.length; i++) {\n var res = links[i].href.match(\"dhtmlxgantt_([a-z_]+).css\");\n\n if (res) {\n if (gantt.skins[res[1]] || !skin) {\n skin = res[1];\n break;\n }\n }\n }\n }\n\n gantt.skin = skin || \"terrace\";\n var skinset = gantt.skins[gantt.skin] || gantt.skins[\"terrace\"]; //apply skin related settings\n\n _configure(gantt.config, skinset.config, force);\n\n var config = gantt.getGridColumns();\n if (config[1] && !gantt.defined(config[1].width)) config[1].width = skinset._second_column_width;\n if (config[2] && !gantt.defined(config[2].width)) config[2].width = skinset._third_column_width;\n\n for (var i = 0; i < config.length; i++) {\n var column = config[i];\n\n if (column.name == \"add\") {\n if (!column.width) {\n column.width = 44;\n }\n\n if (!(gantt.defined(column.min_width) && gantt.defined(column.max_width))) {\n column.min_width = column.min_width || column.width;\n column.max_width = column.max_width || column.width;\n }\n\n if (column.min_width) column.min_width = +column.min_width;\n if (column.max_width) column.max_width = +column.max_width;\n\n if (column.width) {\n column.width = +column.width;\n column.width = column.min_width && column.min_width > column.width ? column.min_width : column.width;\n column.width = column.max_width && column.max_width < column.width ? column.max_width : column.width;\n }\n }\n }\n\n if (skinset.config.task_height) {\n gantt.config.task_height = skinset.config.task_height || \"full\";\n }\n\n if (skinset.config.bar_height) {\n gantt.config.bar_height = skinset.config.bar_height || \"full\";\n }\n\n if (skinset._lightbox_template) gantt._lightbox_template = skinset._lightbox_template;\n\n if (skinset._redefine_lightbox_buttons) {\n gantt.config.buttons_right = skinset._redefine_lightbox_buttons[\"buttons_right\"];\n gantt.config.buttons_left = skinset._redefine_lightbox_buttons[\"buttons_left\"];\n }\n\n gantt.resetLightbox();\n}\n\nmodule.exports = function (gantt) {\n if (!gantt.resetSkin) {\n gantt.resetSkin = function () {\n this.skin = \"\";\n\n _get_skin(true, this);\n };\n\n gantt.skins = {};\n gantt.attachEvent(\"onGanttLayoutReady\", function () {\n _get_skin(false, this);\n });\n }\n};","function createLayoutFacade() {\n function getTimeline(gantt) {\n return gantt.$ui.getView(\"timeline\");\n }\n\n function getGrid(gantt) {\n return gantt.$ui.getView(\"grid\");\n }\n\n function getBaseCell(gantt) {\n var timeline = getTimeline(gantt);\n\n if (timeline && !timeline.$config.hidden) {\n return timeline;\n } else {\n var grid = getGrid(gantt);\n\n if (grid && !grid.$config.hidden) {\n return grid;\n } else {\n return null;\n }\n }\n }\n\n function getVerticalScrollbar(gantt) {\n var baseCell = null; // GS-1150: if we reorder or resize something in the grid, we should obtain the grid container\n\n var gridDrag = false;\n var gridMarkers = [\".gantt_drag_marker.gantt_grid_resize_area\", \".gantt_drag_marker .gantt_row.gantt_row_task\", \".gantt_drag_marker.gantt_grid_dnd_marker\"];\n gridMarkers.forEach(function (selector) {\n gridDrag = gridDrag || !!document.querySelector(selector);\n });\n\n if (gridDrag) {\n baseCell = getGrid(gantt);\n } else {\n baseCell = getBaseCell(gantt);\n } // GS-1827. If there is no grid and timeline, there is no scrollbar for them\n\n\n if (!baseCell) {\n return null;\n }\n\n var verticalScrollbar = getAttachedScrollbar(gantt, baseCell, \"scrollY\");\n return verticalScrollbar;\n }\n\n function getHorizontalScrollbar(gantt) {\n var baseCell = getBaseCell(gantt);\n\n if (!baseCell || baseCell.id == \"grid\") {\n return null; // if the timeline is not displayed, do not return the scrollbar\n }\n\n var horizontalScrollbar = getAttachedScrollbar(gantt, baseCell, \"scrollX\");\n return horizontalScrollbar;\n }\n\n function getAttachedScrollbar(gantt, cell, type) {\n var attachedScrollbar = cell.$config[type];\n var scrollbarView = gantt.$ui.getView(attachedScrollbar);\n return scrollbarView;\n }\n\n var DEFAULT_VALUE = \"DEFAULT_VALUE\";\n\n function tryCall(getView, method, args, fallback) {\n var view = getView(this);\n\n if (!(view && view.isVisible())) {\n if (fallback) {\n return fallback();\n } else {\n return DEFAULT_VALUE;\n }\n } else {\n return view[method].apply(view, args);\n }\n }\n\n return {\n getColumnIndex: function getColumnIndex(name) {\n var res = tryCall.call(this, getGrid, \"getColumnIndex\", [name]);\n\n if (res === DEFAULT_VALUE) {\n return 0;\n } else {\n return res;\n }\n },\n dateFromPos: function dateFromPos(x) {\n var res = tryCall.call(this, getTimeline, \"dateFromPos\", Array.prototype.slice.call(arguments));\n\n if (res === DEFAULT_VALUE) {\n return this.getState().min_date;\n } else {\n return res;\n }\n },\n posFromDate: function posFromDate(date) {\n var res = tryCall.call(this, getTimeline, \"posFromDate\", [date]);\n\n if (res === DEFAULT_VALUE) {\n return 0;\n } else {\n return res;\n }\n },\n getRowTop: function getRowTop(index) {\n var self = this;\n var res = tryCall.call(self, getTimeline, \"getRowTop\", [index], function () {\n return tryCall.call(self, getGrid, \"getRowTop\", [index]);\n });\n\n if (res === DEFAULT_VALUE) {\n return 0;\n } else {\n return res;\n }\n },\n getTaskTop: function getTaskTop(id) {\n var self = this;\n var res = tryCall.call(self, getTimeline, \"getItemTop\", [id], function () {\n return tryCall.call(self, getGrid, \"getItemTop\", [id]);\n });\n\n if (res === DEFAULT_VALUE) {\n return 0;\n } else {\n return res;\n }\n },\n getTaskPosition: function getTaskPosition(task, start_date, end_date) {\n var res = tryCall.call(this, getTimeline, \"getItemPosition\", [task, start_date, end_date]);\n\n if (res === DEFAULT_VALUE) {\n var top = this.getTaskTop(task.id);\n var height = this.getTaskBarHeight(task.id);\n return {\n left: 0,\n top: top,\n height: height,\n width: 0\n };\n } else {\n return res;\n }\n },\n getTaskBarHeight: function getTaskBarHeight(taskId, isMilestoneRender) {\n var self = this;\n var res = tryCall.call(self, getTimeline, \"getBarHeight\", [taskId, isMilestoneRender], function () {\n return tryCall.call(self, getGrid, \"getItemHeight\", [taskId]);\n });\n\n if (res === DEFAULT_VALUE) {\n return 0;\n } else {\n return res;\n }\n },\n getTaskHeight: function getTaskHeight(taskId) {\n var self = this;\n var res = tryCall.call(self, getTimeline, \"getItemHeight\", [taskId], function () {\n return tryCall.call(self, getGrid, \"getItemHeight\", [taskId]);\n });\n\n if (res === DEFAULT_VALUE) {\n return 0;\n } else {\n return res;\n }\n },\n columnIndexByDate: function columnIndexByDate(date) {\n var res = tryCall.call(this, getTimeline, \"columnIndexByDate\", [date]);\n\n if (res === DEFAULT_VALUE) {\n return 0;\n } else {\n return res;\n }\n },\n roundTaskDates: function roundTaskDates() {\n tryCall.call(this, getTimeline, \"roundTaskDates\", []);\n },\n getScale: function getScale() {\n var res = tryCall.call(this, getTimeline, \"getScale\", []);\n\n if (res === DEFAULT_VALUE) {\n return null;\n } else {\n return res;\n }\n },\n getTaskNode: function getTaskNode(id) {\n var timeline = getTimeline(this);\n\n if (!timeline || !timeline.isVisible()) {\n return null;\n } else {\n var node = timeline._taskRenderer.rendered[id];\n\n if (!node) {\n var domAttr = timeline.$config.item_attribute;\n node = timeline.$task_bars.querySelector(\"[\" + domAttr + \"='\" + id + \"']\");\n }\n\n return node || null;\n }\n },\n getLinkNode: function getLinkNode(id) {\n var timeline = getTimeline(this);\n\n if (!timeline.isVisible()) {\n return null;\n } else {\n return timeline._linkRenderer.rendered[id];\n }\n },\n scrollTo: function scrollTo(left, top) {\n var vertical = getVerticalScrollbar(this);\n var horizontal = getHorizontalScrollbar(this);\n var oldH = {\n position: 0\n },\n oldV = {\n position: 0\n };\n\n if (vertical) {\n oldV = vertical.getScrollState();\n }\n\n if (horizontal) {\n oldH = horizontal.getScrollState();\n }\n\n var scrollHorizontal = horizontal && left * 1 == left;\n var scrollVertical = vertical && top * 1 == top;\n var scrollBoth = scrollHorizontal && scrollVertical;\n\n if (scrollBoth) {\n // some views will be scrolled both horizontally and vertically and smart rendering can be called twice\n // set flag in order not to invoke smart rendering at the horizontal scroll stage\n // so it will repaint only once when the scroll is completed\n var verticalViews = vertical._getLinkedViews();\n\n var horizontalViews = horizontal._getLinkedViews();\n\n var commonViews = [];\n\n for (var i = 0; i < verticalViews.length; i++) {\n for (var j = 0; j < horizontalViews.length; j++) {\n if (verticalViews[i].$config.id && horizontalViews[j].$config.id && verticalViews[i].$config.id === horizontalViews[j].$config.id) {\n commonViews.push(verticalViews[i].$config.id);\n }\n }\n }\n }\n\n if (scrollHorizontal) {\n if (commonViews) {\n commonViews.forEach(function (viewId) {\n this.$ui.getView(viewId).$config.$skipSmartRenderOnScroll = true;\n }.bind(this));\n }\n\n horizontal.scroll(left);\n\n if (commonViews) {\n commonViews.forEach(function (viewId) {\n this.$ui.getView(viewId).$config.$skipSmartRenderOnScroll = false;\n }.bind(this));\n }\n }\n\n if (scrollVertical) {\n vertical.scroll(top);\n }\n\n var newV = {\n position: 0\n },\n newH = {\n position: 0\n };\n\n if (vertical) {\n newV = vertical.getScrollState();\n }\n\n if (horizontal) {\n newH = horizontal.getScrollState();\n }\n\n this.callEvent(\"onGanttScroll\", [oldH.position, oldV.position, newH.position, newV.position]);\n },\n showDate: function showDate(date) {\n var date_x = this.posFromDate(date);\n var scroll_to = Math.max(date_x - this.config.task_scroll_offset, 0);\n this.scrollTo(scroll_to);\n },\n showTask: function showTask(id) {\n var pos = this.getTaskPosition(this.getTask(id)); // GS-1261: we need to show the start_date even in the RTL mode\n\n var leftPos = pos.left;\n if (this.config.rtl) leftPos = pos.left + pos.width;\n var left = Math.max(leftPos - this.config.task_scroll_offset, 0);\n\n var dataHeight = this._scroll_state().y;\n\n var top;\n\n if (!dataHeight) {\n top = pos.top;\n } else {\n top = pos.top - (dataHeight - this.getTaskBarHeight(id)) / 2;\n }\n\n this.scrollTo(left, top); // GS-1150: if the grid and timeline have different scrollbars, we need to scroll thegrid to show the task\n\n var gridCell = getGrid(this);\n var timelineCell = getTimeline(this);\n\n if (gridCell && timelineCell && gridCell.$config.scrollY != timelineCell.$config.scrollY) {\n var gridScrollbar = getAttachedScrollbar(this, gridCell, \"scrollY\");\n gridScrollbar.scrollTo(null, top);\n }\n },\n _scroll_state: function _scroll_state() {\n var result = {\n x: false,\n y: false,\n x_pos: 0,\n y_pos: 0,\n scroll_size: this.config.scroll_size + 1,\n //1px for inner content\n x_inner: 0,\n y_inner: 0\n };\n var scrollVer = getVerticalScrollbar(this),\n scrollHor = getHorizontalScrollbar(this);\n\n if (scrollHor) {\n var horState = scrollHor.getScrollState();\n\n if (horState.visible) {\n result.x = horState.size;\n result.x_inner = horState.scrollSize;\n }\n\n result.x_pos = horState.position || 0;\n }\n\n if (scrollVer) {\n var verState = scrollVer.getScrollState();\n\n if (verState.visible) {\n result.y = verState.size;\n result.y_inner = verState.scrollSize;\n }\n\n result.y_pos = verState.position || 0;\n }\n\n return result;\n },\n getScrollState: function getScrollState() {\n var state = this._scroll_state();\n\n return {\n x: state.x_pos,\n y: state.y_pos,\n inner_width: state.x,\n inner_height: state.y,\n width: state.x_inner,\n height: state.y_inner\n };\n },\n getLayoutView: function getLayoutView(cellName) {\n return this.$ui.getView(cellName);\n },\n scrollLayoutCell: function scrollLayoutCell(cellName, left, top) {\n var cell = this.$ui.getView(cellName);\n\n if (!cell) {\n return false;\n }\n\n if (left !== null) {\n var horizontalScroll = this.$ui.getView(cell.$config.scrollX);\n\n if (horizontalScroll) {\n horizontalScroll.scrollTo(left, null);\n }\n }\n\n if (top !== null) {\n var verticalScroll = this.$ui.getView(cell.$config.scrollY);\n\n if (verticalScroll) {\n verticalScroll.scrollTo(null, top);\n }\n }\n }\n };\n}\n\nmodule.exports = createLayoutFacade;","module.exports = function (gantt) {\n delete gantt.addTaskLayer;\n delete gantt.addLinkLayer;\n};","var domHelpers = require(\"./utils/dom_helpers\");\n\nvar initializer = function () {\n return function (gantt) {\n return {\n getVerticalScrollbar: function getVerticalScrollbar() {\n return gantt.$ui.getView(\"scrollVer\");\n },\n getHorizontalScrollbar: function getHorizontalScrollbar() {\n return gantt.$ui.getView(\"scrollHor\");\n },\n _legacyGridResizerClass: function _legacyGridResizerClass(layout) {\n var resizers = layout.getCellsByType(\"resizer\");\n\n for (var i = 0; i < resizers.length; i++) {\n var r = resizers[i];\n var gridResizer = false;\n var prev = r.$parent.getPrevSibling(r.$id);\n\n if (prev && prev.$config && prev.$config.id === \"grid\") {\n gridResizer = true;\n } else {\n var next = r.$parent.getNextSibling(r.$id);\n\n if (next && next.$config && next.$config.id === \"grid\") {\n gridResizer = true;\n }\n }\n\n if (gridResizer) {\n r.$config.css = (r.$config.css ? r.$config.css + \" \" : \"\") + \"gantt_grid_resize_wrap\";\n }\n }\n },\n onCreated: function onCreated(layout) {\n var first = true;\n\n this._legacyGridResizerClass(layout);\n\n layout.attachEvent(\"onBeforeResize\", function () {\n var mainTimeline = gantt.$ui.getView(\"timeline\");\n if (mainTimeline) mainTimeline.$config.hidden = mainTimeline.$parent.$config.hidden = !gantt.config.show_chart;\n var mainGrid = gantt.$ui.getView(\"grid\");\n if (!mainGrid) return;\n\n var colsWidth = mainGrid._getColsTotalWidth();\n\n var hideGrid = !gantt.config.show_grid || !gantt.config.grid_width || colsWidth === 0;\n\n if (first && !hideGrid && colsWidth !== false) {\n gantt.config.grid_width = colsWidth;\n }\n\n mainGrid.$config.hidden = mainGrid.$parent.$config.hidden = hideGrid;\n\n if (!mainGrid.$config.hidden) {\n /* restrict grid width due to min_width, max_width, min_grid_column_width */\n var grid_limits = mainGrid._getGridWidthLimits();\n\n if (grid_limits[0] && gantt.config.grid_width < grid_limits[0]) gantt.config.grid_width = grid_limits[0];\n if (grid_limits[1] && gantt.config.grid_width > grid_limits[1]) gantt.config.grid_width = grid_limits[1];\n\n if (mainTimeline && gantt.config.show_chart) {\n mainGrid.$config.width = gantt.config.grid_width - 1; // GS-1314: Don't let the non-scrollable grid to be larger than the container with the correct width\n\n if (!mainGrid.$config.scrollable && mainGrid.$config.scrollY && gantt.$root.offsetWidth) {\n var ganttContainerWidth = mainGrid.$gantt.$layout.$container.offsetWidth;\n var verticalScrollbar = gantt.$ui.getView(mainGrid.$config.scrollY);\n var verticalScrollbarWidth = verticalScrollbar.$config.width;\n var gridOverflow = ganttContainerWidth - (mainGrid.$config.width + verticalScrollbarWidth);\n\n if (gridOverflow < 0) {\n mainGrid.$config.width += gridOverflow;\n gantt.config.grid_width += gridOverflow;\n }\n }\n\n if (!first) {\n if (mainTimeline && !domHelpers.isChildOf(mainTimeline.$task, layout.$view)) {\n // timeline is being displayed after being not visible, reset grid with from full screen\n if (!mainGrid.$config.original_grid_width) {\n var skinSettings = gantt.skins[gantt.skin];\n\n if (skinSettings && skinSettings.config && skinSettings.config.grid_width) {\n mainGrid.$config.original_grid_width = skinSettings.config.grid_width;\n } else {\n mainGrid.$config.original_grid_width = 0;\n }\n }\n\n gantt.config.grid_width = mainGrid.$config.original_grid_width;\n mainGrid.$parent.$config.width = gantt.config.grid_width;\n } else {\n mainGrid.$parent._setContentSize(mainGrid.$config.width, null);\n\n gantt.$layout._syncCellSizes(mainGrid.$parent.$config.group, {\n value: gantt.config.grid_width,\n isGravity: false\n });\n }\n } else {\n mainGrid.$parent.$config.width = gantt.config.grid_width;\n\n if (mainGrid.$parent.$config.group) {\n gantt.$layout._syncCellSizes(mainGrid.$parent.$config.group, {\n value: mainGrid.$parent.$config.width,\n isGravity: false\n });\n }\n }\n } else {\n if (mainTimeline && domHelpers.isChildOf(mainTimeline.$task, layout.$view)) {\n // hiding timeline, remember grid with to restore it when timeline is displayed again\n mainGrid.$config.original_grid_width = gantt.config.grid_width;\n }\n\n if (!first) {\n mainGrid.$parent.$config.width = 0;\n }\n }\n }\n\n first = false;\n });\n\n this._initScrollStateEvents(layout);\n },\n _initScrollStateEvents: function _initScrollStateEvents(layout) {\n gantt._getVerticalScrollbar = this.getVerticalScrollbar;\n gantt._getHorizontalScrollbar = this.getHorizontalScrollbar;\n var vertical = this.getVerticalScrollbar();\n var horizontal = this.getHorizontalScrollbar();\n\n if (vertical) {\n vertical.attachEvent(\"onScroll\", function (oldPos, newPos, dir) {\n var scrollState = gantt.getScrollState();\n gantt.callEvent(\"onGanttScroll\", [scrollState.x, oldPos, scrollState.x, newPos]);\n });\n }\n\n if (horizontal) {\n horizontal.attachEvent(\"onScroll\", function (oldPos, newPos, dir) {\n var scrollState = gantt.getScrollState();\n gantt.callEvent(\"onGanttScroll\", [oldPos, scrollState.y, newPos, scrollState.y]); // if the grid doesn't fit the width, scroll the row container\n\n var grid = gantt.$ui.getView(\"grid\");\n\n if (grid && grid.$grid_data && !grid.$config.scrollable) {\n grid.$grid_data.style.left = grid.$grid.scrollLeft + \"px\";\n grid.$grid_data.scrollLeft = grid.$grid.scrollLeft;\n }\n });\n }\n\n layout.attachEvent(\"onResize\", function () {\n if (vertical && !gantt.$scroll_ver) {\n gantt.$scroll_ver = vertical.$scroll_ver;\n }\n\n if (horizontal && !gantt.$scroll_hor) {\n gantt.$scroll_hor = horizontal.$scroll_hor;\n }\n });\n },\n _findGridResizer: function _findGridResizer(layout, grid) {\n var resizers = layout.getCellsByType(\"resizer\");\n var gridFirst = true;\n var gridResizer;\n\n for (var i = 0; i < resizers.length; i++) {\n var res = resizers[i];\n\n res._getSiblings();\n\n var prev = res._behind;\n var next = res._front;\n\n if (prev && prev.$content === grid || prev.isChild && prev.isChild(grid)) {\n gridResizer = res;\n gridFirst = true;\n break;\n } else if (next && next.$content === grid || next.isChild && next.isChild(grid)) {\n gridResizer = res;\n gridFirst = false;\n break;\n }\n }\n\n return {\n resizer: gridResizer,\n gridFirst: gridFirst\n };\n },\n onInitialized: function onInitialized(layout) {\n var grid = gantt.$ui.getView(\"grid\");\n\n var resizeInfo = this._findGridResizer(layout, grid); // expose grid resize events\n\n\n if (resizeInfo.resizer) {\n var gridFirst = resizeInfo.gridFirst,\n next = resizeInfo.resizer;\n\n if (next.$config.mode !== \"x\") {\n return; // track only horizontal resize\n }\n\n var initialWidth;\n next.attachEvent(\"onResizeStart\", function (prevCellWidth, nextCellWidth) {\n var grid = gantt.$ui.getView(\"grid\");\n var viewCell = grid ? grid.$parent : null;\n\n if (viewCell) {\n var limits = grid._getGridWidthLimits(); // min grid width is defined by min widths of its columns, unless grid has horizontal scroll\n\n\n if (!grid.$config.scrollable) viewCell.$config.minWidth = limits[0];\n viewCell.$config.maxWidth = limits[1];\n }\n\n initialWidth = gridFirst ? prevCellWidth : nextCellWidth;\n return gantt.callEvent(\"onGridResizeStart\", [initialWidth]);\n });\n next.attachEvent(\"onResize\", function (newBehindSize, newFrontSize) {\n var newSize = gridFirst ? newBehindSize : newFrontSize;\n return gantt.callEvent(\"onGridResize\", [initialWidth, newSize]);\n });\n next.attachEvent(\"onResizeEnd\", function (oldBackSize, oldFrontSize, newBackSize, newFrontSize) {\n var oldSize = gridFirst ? oldBackSize : oldFrontSize;\n var newSize = gridFirst ? newBackSize : newFrontSize;\n var grid = gantt.$ui.getView(\"grid\");\n var viewCell = grid ? grid.$parent : null;\n\n if (viewCell) {\n viewCell.$config.minWidth = undefined;\n }\n\n var res = gantt.callEvent(\"onGridResizeEnd\", [oldSize, newSize]);\n\n if (res && newSize !== 0) {\n // new size may be numeric zero when cell size is defined by 'gravity', actual size will be calculated by layout later\n gantt.config.grid_width = newSize;\n }\n\n return res;\n });\n }\n },\n onDestroyed: function onDestroyed(timeline) {}\n };\n };\n}();\n\nmodule.exports = initializer;","var domHelpers = require(\"../utils/dom_helpers\");\n\nvar initLinksDND = function initLinksDND(timeline, gantt) {\n var _link_landing,\n _link_target_task,\n _link_target_task_start,\n _link_source_task,\n _link_source_task_start,\n markerDefaultOffset = 10,\n scrollDefaultSize = 18;\n\n function getVisibleMilestoneWidth(taskId) {\n var origWidth = timeline.getBarHeight(taskId, true); //m-s have square shape\n\n return Math.round(Math.sqrt(2 * origWidth * origWidth)) - 2;\n }\n\n function isMilestone(task) {\n return gantt.getTaskType(task.type) == gantt.config.types.milestone;\n }\n\n function getDndState() {\n return {\n link_source_id: _link_source_task,\n link_target_id: _link_target_task,\n link_from_start: _link_source_task_start,\n link_to_start: _link_target_task_start,\n link_landing_area: _link_landing\n };\n }\n\n var services = gantt.$services;\n var state = services.getService(\"state\");\n var DnD = services.getService(\"dnd\");\n state.registerProvider(\"linksDnD\", getDndState);\n var start_marker = \"task_start_date\",\n end_marker = \"task_end_date\",\n link_edge_marker = \"gantt_link_point\",\n link_landing_hover_area = \"gantt_link_control\";\n var dnd = new DnD(timeline.$task_bars, {\n sensitivity: 0,\n updates_per_second: 60,\n mousemoveContainer: gantt.$root,\n selector: \".\" + link_edge_marker,\n preventDefault: true\n });\n dnd.attachEvent(\"onBeforeDragStart\", gantt.bind(function (obj, e) {\n var target = e.target || e.srcElement;\n resetDndState();\n if (gantt.getState(\"tasksDnd\").drag_id) return false;\n\n if (domHelpers.locateClassName(target, link_edge_marker)) {\n if (domHelpers.locateClassName(target, start_marker)) _link_source_task_start = true;\n var sid = gantt.locate(e);\n _link_source_task = sid;\n var t = gantt.getTask(sid);\n\n if (gantt.isReadonly(t)) {\n resetDndState();\n return false;\n }\n\n var shift = 0;\n this._dir_start = getLinePos(t, !!_link_source_task_start, shift, timeline.$getConfig(), true);\n return true;\n } else {\n return false;\n }\n }, this));\n dnd.attachEvent(\"onAfterDragStart\", gantt.bind(function (obj, e) {\n if (gantt.config.touch) {\n gantt.refreshData();\n }\n\n updateMarkedHtml(dnd.config.marker);\n }, this));\n\n function getLinePos(task, to_start, shift, cfg, isStart) {\n var taskPos = getMilestonePosition(task, function (task) {\n return gantt.getTaskPosition(task);\n }, cfg);\n var pos = {\n x: taskPos.x,\n y: taskPos.y\n };\n\n if (!to_start) {\n pos.x = taskPos.xEnd;\n } //var pos = gantt._get_task_pos(task, !!to_start);\n\n\n pos.y += gantt.getTaskHeight(task.id) / 2;\n var offset = isMilestone(task) && isStart ? 2 : 0;\n shift = shift || 0;\n if (cfg.rtl) shift = shift * -1;\n pos.x += (to_start ? -1 : 1) * shift - offset;\n return pos;\n }\n\n function getMilestonePosition(task, getTaskPosition, cfg) {\n var pos = getTaskPosition(task);\n var res = {\n x: pos.left,\n y: pos.top,\n width: pos.width,\n height: pos.height\n };\n\n if (cfg.rtl) {\n res.xEnd = res.x;\n res.x = res.xEnd + res.width;\n } else {\n res.xEnd = res.x + res.width;\n }\n\n res.yEnd = res.y + res.height;\n\n if (gantt.getTaskType(task.type) == gantt.config.types.milestone) {\n var milestoneWidth = getVisibleMilestoneWidth(task.id);\n res.x += (!cfg.rtl ? -1 : 1) * (milestoneWidth / 2);\n res.xEnd += (!cfg.rtl ? 1 : -1) * (milestoneWidth / 2); //pos.x -= milestoneWidth / 2;\n //pos.xEnd += milestoneWidth / 2;\n\n res.width = pos.xEnd - pos.x;\n }\n\n return res;\n }\n\n function getVieportSize() {\n var root = gantt.$root;\n return {\n right: root.offsetWidth,\n bottom: root.offsetHeight\n };\n }\n\n function getMarkerSize(marker) {\n var width = 0,\n height = 0;\n\n if (marker) {\n width = marker.offsetWidth || 0;\n height = marker.offsetHeight || 0;\n }\n\n return {\n width: width,\n height: height\n };\n }\n\n function getPosition(e, marker) {\n var oldPos = dnd.getPosition(e);\n var markerSize = getMarkerSize(marker);\n var viewportSize = getVieportSize();\n var offsetX = gantt.config.tooltip_offset_x || markerDefaultOffset;\n var offsetY = gantt.config.tooltip_offset_y || markerDefaultOffset;\n var scrollSize = gantt.config.scroll_size || scrollDefaultSize; // GS-1315: Add offset if there are elements above Gantt\n\n var ganttOffsetY = gantt.$container.getBoundingClientRect().y + window.scrollY;\n var position = {\n y: oldPos.y + offsetY,\n x: oldPos.x + offsetX,\n bottom: oldPos.y + markerSize.height + offsetY + scrollSize,\n right: oldPos.x + markerSize.width + offsetX + scrollSize\n };\n\n if (position.bottom > viewportSize.bottom + ganttOffsetY) {\n position.y = viewportSize.bottom + ganttOffsetY - markerSize.height - offsetY;\n }\n\n if (position.right > viewportSize.right) {\n position.x = viewportSize.right - markerSize.width - offsetX;\n }\n\n return position;\n }\n\n dnd.attachEvent(\"onDragMove\", gantt.bind(function (obj, e) {\n var dd = dnd.config;\n var pos = getPosition(e, dd.marker);\n advanceMarker(dd.marker, pos);\n var landing = !!domHelpers.locateClassName(e, link_landing_hover_area);\n var prevTarget = _link_target_task;\n var prevLanding = _link_landing;\n var prevToStart = _link_target_task_start;\n var targ = gantt.locate(e),\n to_start = true; // can drag and drop link to another gantt on the page, such links are not supported\n\n var eventTarget = domHelpers.getTargetNode(e);\n var sameGantt = domHelpers.isChildOf(eventTarget, gantt.$root);\n\n if (!sameGantt) {\n landing = false;\n targ = null;\n }\n\n if (landing) {\n //refreshTask\n to_start = !domHelpers.locateClassName(e, end_marker);\n landing = !!targ;\n }\n\n _link_target_task = targ;\n _link_landing = landing;\n _link_target_task_start = to_start;\n\n if (landing) {\n var t = gantt.getTask(targ);\n var config = timeline.$getConfig();\n var node = domHelpers.locateClassName(e, link_landing_hover_area);\n var shift = 0;\n\n if (node) {\n shift = Math.floor(node.offsetWidth / 2);\n }\n\n this._dir_end = getLinePos(t, !!_link_target_task_start, shift, config);\n } else {\n this._dir_end = domHelpers.getRelativeEventPosition(e, timeline.$task_data);\n\n if (gantt.env.isEdge) {\n // to fix margin collapsing\n this._dir_end.y += window.scrollY;\n }\n }\n\n var targetChanged = !(prevLanding == landing && prevTarget == targ && prevToStart == to_start);\n\n if (targetChanged) {\n if (prevTarget) gantt.refreshTask(prevTarget, false);\n if (targ) gantt.refreshTask(targ, false);\n }\n\n if (targetChanged) {\n updateMarkedHtml(dd.marker);\n }\n\n showDirectingLine(this._dir_start.x, this._dir_start.y, this._dir_end.x, this._dir_end.y);\n return true;\n }, this));\n dnd.attachEvent(\"onDragEnd\", gantt.bind(function () {\n var drag = getDndState();\n\n if (drag.link_source_id && drag.link_target_id && drag.link_source_id != drag.link_target_id) {\n var type = gantt._get_link_type(drag.link_from_start, drag.link_to_start);\n\n var link = {\n source: drag.link_source_id,\n target: drag.link_target_id,\n type: type\n };\n\n if (link.type && gantt.isLinkAllowed(link)) {\n if (gantt.callEvent(\"onLinkCreated\", [link])) {\n gantt.addLink(link);\n }\n }\n }\n\n resetDndState();\n\n if (gantt.config.touch) {\n gantt.refreshData();\n } else {\n if (drag.link_source_id) gantt.refreshTask(drag.link_source_id, false);\n if (drag.link_target_id) gantt.refreshTask(drag.link_target_id, false);\n }\n\n removeDirectionLine();\n }, this));\n\n function updateMarkedHtml(marker) {\n var link = getDndState();\n var css = [\"gantt_link_tooltip\"];\n\n if (link.link_source_id && link.link_target_id) {\n if (gantt.isLinkAllowed(link.link_source_id, link.link_target_id, link.link_from_start, link.link_to_start)) {\n css.push(\"gantt_allowed_link\");\n } else {\n css.push(\"gantt_invalid_link\");\n }\n }\n\n var className = gantt.templates.drag_link_class(link.link_source_id, link.link_from_start, link.link_target_id, link.link_to_start);\n if (className) css.push(className);\n var html = \"
\" + gantt.templates.drag_link(link.link_source_id, link.link_from_start, link.link_target_id, link.link_to_start) + \"
\";\n marker.innerHTML = html;\n }\n\n function advanceMarker(marker, pos) {\n marker.style.left = pos.x + \"px\";\n marker.style.top = pos.y + \"px\";\n }\n\n function resetDndState() {\n _link_source_task = _link_source_task_start = _link_target_task = null;\n _link_target_task_start = true;\n }\n\n function showDirectingLine(s_x, s_y, e_x, e_y) {\n var div = getDirectionLine();\n var link = getDndState();\n var css = [\"gantt_link_direction\"];\n\n if (gantt.templates.link_direction_class) {\n css.push(gantt.templates.link_direction_class(link.link_source_id, link.link_from_start, link.link_target_id, link.link_to_start));\n }\n\n var dist = Math.sqrt(Math.pow(e_x - s_x, 2) + Math.pow(e_y - s_y, 2));\n dist = Math.max(0, dist - 3);\n if (!dist) return;\n div.className = css.join(\" \");\n var tan = (e_y - s_y) / (e_x - s_x),\n angle = Math.atan(tan);\n\n if (coordinateCircleQuarter(s_x, e_x, s_y, e_y) == 2) {\n angle += Math.PI;\n } else if (coordinateCircleQuarter(s_x, e_x, s_y, e_y) == 3) {\n angle -= Math.PI;\n }\n\n var sin = Math.sin(angle),\n cos = Math.cos(angle),\n top = Math.round(s_y),\n left = Math.round(s_x);\n var style = [\"-webkit-transform: rotate(\" + angle + \"rad)\", \"-moz-transform: rotate(\" + angle + \"rad)\", \"-ms-transform: rotate(\" + angle + \"rad)\", \"-o-transform: rotate(\" + angle + \"rad)\", \"transform: rotate(\" + angle + \"rad)\", \"width:\" + Math.round(dist) + \"px\"];\n\n if (window.navigator.userAgent.indexOf(\"MSIE 8.0\") != -1) {\n //ms-filter breaks styles in ie9, so add it only for 8th\n style.push(\"-ms-filter: \\\"\" + ieTransform(sin, cos) + \"\\\"\");\n var shiftLeft = Math.abs(Math.round(s_x - e_x)),\n shiftTop = Math.abs(Math.round(e_y - s_y)); //fix rotation axis\n\n switch (coordinateCircleQuarter(s_x, e_x, s_y, e_y)) {\n case 1:\n top -= shiftTop;\n break;\n\n case 2:\n left -= shiftLeft;\n top -= shiftTop;\n break;\n\n case 3:\n left -= shiftLeft;\n break;\n\n default:\n break;\n }\n }\n\n style.push(\"top:\" + top + \"px\");\n style.push(\"left:\" + left + \"px\");\n div.style.cssText = style.join(\";\");\n }\n\n function ieTransform(sin, cos) {\n return \"progid:DXImageTransform.Microsoft.Matrix(\" + \"M11 = \" + cos + \",\" + \"M12 = -\" + sin + \",\" + \"M21 = \" + sin + \",\" + \"M22 = \" + cos + \",\" + \"SizingMethod = 'auto expand'\" + \")\";\n }\n\n function coordinateCircleQuarter(sX, eX, sY, eY) {\n if (eX >= sX) {\n if (eY <= sY) {\n return 1;\n } else {\n return 4;\n }\n } else {\n if (eY <= sY) {\n return 2;\n } else {\n return 3;\n }\n }\n }\n\n function getDirectionLine() {\n if (!dnd._direction || !dnd._direction.parentNode) {\n dnd._direction = document.createElement(\"div\");\n timeline.$task_links.appendChild(dnd._direction);\n }\n\n return dnd._direction;\n }\n\n function removeDirectionLine() {\n if (dnd._direction) {\n if (dnd._direction.parentNode) //the event line can be detached because of data refresh\n dnd._direction.parentNode.removeChild(dnd._direction);\n dnd._direction = null;\n }\n }\n\n gantt.attachEvent(\"onGanttRender\", gantt.bind(function () {\n if (dnd._direction) {\n showDirectingLine(this._dir_start.x, this._dir_start.y, this._dir_end.x, this._dir_end.y);\n }\n }, this));\n};\n\nmodule.exports = {\n createLinkDND: function createLinkDND() {\n return {\n init: initLinksDND\n };\n }\n};","var domHelpers = require(\"../utils/dom_helpers\");\n\nvar utils = require(\"../../../utils/utils\");\n\nvar timeout = require(\"../../../utils/timeout\");\n\nvar helpers = require(\"../../../utils/helpers\");\n\nfunction createTaskDND(timeline, gantt) {\n var services = gantt.$services;\n return {\n drag: null,\n dragMultiple: {},\n _events: {\n before_start: {},\n before_finish: {},\n after_finish: {}\n },\n _handlers: {},\n init: function init() {\n this._domEvents = gantt._createDomEventScope();\n this.clear_drag_state();\n var drag = gantt.config.drag_mode;\n this.set_actions();\n var stateService = services.getService(\"state\");\n stateService.registerProvider(\"tasksDnd\", utils.bind(function () {\n return {\n drag_id: this.drag ? this.drag.id : undefined,\n drag_mode: this.drag ? this.drag.mode : undefined,\n drag_from_start: this.drag ? this.drag.left : undefined\n };\n }, this));\n var evs = {\n \"before_start\": \"onBeforeTaskDrag\",\n \"before_finish\": \"onBeforeTaskChanged\",\n \"after_finish\": \"onAfterTaskDrag\"\n }; //for now, all drag operations will trigger the same events\n\n for (var stage in this._events) {\n for (var mode in drag) {\n this._events[stage][mode] = evs[stage];\n }\n }\n\n this._handlers[drag.move] = this._move;\n this._handlers[drag.resize] = this._resize;\n this._handlers[drag.progress] = this._resize_progress;\n },\n set_actions: function set_actions() {\n var data = timeline.$task_data;\n\n this._domEvents.attach(data, \"mousemove\", gantt.bind(function (e) {\n this.on_mouse_move(e);\n }, this));\n\n this._domEvents.attach(data, \"mousedown\", gantt.bind(function (e) {\n this.on_mouse_down(e);\n }, this));\n\n this._domEvents.attach(document.body, \"mouseup\", gantt.bind(function (e) {\n this.on_mouse_up(e);\n }, this));\n },\n clear_drag_state: function clear_drag_state() {\n this.drag = {\n id: null,\n mode: null,\n pos: null,\n start_x: null,\n start_y: null,\n obj: null,\n left: null\n };\n this.dragMultiple = {};\n },\n _resize: function _resize(task, shift, drag) {\n var cfg = timeline.$getConfig();\n\n var coords_x = this._drag_task_coords(task, drag);\n\n if (drag.left) {\n task.start_date = gantt.dateFromPos(coords_x.start + shift);\n\n if (!task.start_date) {\n task.start_date = new Date(gantt.getState().min_date);\n }\n } else {\n task.end_date = gantt.dateFromPos(coords_x.end + shift);\n\n if (!task.end_date) {\n task.end_date = new Date(gantt.getState().max_date);\n }\n }\n\n var minDurationInUnits = this._calculateMinDuration(cfg.min_duration, cfg.duration_unit);\n\n if (task.end_date - task.start_date < cfg.min_duration) {\n if (drag.left) task.start_date = gantt.calculateEndDate(task.end_date, -minDurationInUnits, cfg.duration_unit, task);else task.end_date = gantt.calculateEndDate(task.start_date, minDurationInUnits, cfg.duration_unit, task);\n }\n\n gantt._init_task_timing(task);\n },\n _calculateMinDuration: function _calculateMinDuration(duration, unit) {\n var inMs = {\n \"minute\": 60000,\n \"hour\": 3600000,\n \"day\": 86400000,\n \"week\": 604800000,\n \"month\": 2419200000,\n \"year\": 31356000000\n };\n return Math.ceil(duration / inMs[unit]);\n },\n _resize_progress: function _resize_progress(task, shift, drag) {\n var coords_x = this._drag_task_coords(task, drag);\n\n var config = timeline.$getConfig();\n var diffValue = !config.rtl ? drag.pos.x - coords_x.start : coords_x.start - drag.pos.x;\n var diff = Math.max(0, diffValue);\n task.progress = Math.min(1, diff / Math.abs(coords_x.end - coords_x.start));\n },\n _find_max_shift: function _find_max_shift(dragItems, shift) {\n var correctShift;\n\n for (var i in dragItems) {\n var drag = dragItems[i];\n var task = gantt.getTask(drag.id);\n\n var coords_x = this._drag_task_coords(task, drag);\n\n var minX = gantt.posFromDate(new Date(gantt.getState().min_date));\n var maxX = gantt.posFromDate(new Date(gantt.getState().max_date));\n\n if (coords_x.end + shift > maxX) {\n var maxShift = maxX - coords_x.end;\n\n if (maxShift < correctShift || correctShift === undefined) {\n correctShift = maxShift;\n }\n } else if (coords_x.start + shift < minX) {\n var minShift = minX - coords_x.start;\n\n if (minShift > correctShift || correctShift === undefined) {\n correctShift = minShift;\n }\n }\n }\n\n return correctShift;\n },\n _move: function _move(task, shift, drag, multipleDragShift) {\n var coords_x = this._drag_task_coords(task, drag);\n\n var new_start = null,\n new_end = null; // GS-454: If we drag multiple tasks, rely on the dates instead of timeline coordinates\n\n if (multipleDragShift) {\n new_start = new Date(+drag.obj.start_date + multipleDragShift), new_end = new Date(+drag.obj.end_date + multipleDragShift);\n } else {\n new_start = gantt.dateFromPos(coords_x.start + shift), new_end = gantt.dateFromPos(coords_x.end + shift);\n }\n\n if (!new_start) {\n task.start_date = new Date(gantt.getState().min_date);\n task.end_date = gantt.dateFromPos(gantt.posFromDate(task.start_date) + (coords_x.end - coords_x.start));\n } else if (!new_end) {\n task.end_date = new Date(gantt.getState().max_date);\n task.start_date = gantt.dateFromPos(gantt.posFromDate(task.end_date) - (coords_x.end - coords_x.start));\n } else {\n task.start_date = new_start;\n task.end_date = new_end;\n }\n },\n _drag_task_coords: function _drag_task_coords(t, drag) {\n var start = drag.obj_s_x = drag.obj_s_x || gantt.posFromDate(t.start_date);\n var end = drag.obj_e_x = drag.obj_e_x || gantt.posFromDate(t.end_date);\n return {\n start: start,\n end: end\n };\n },\n _mouse_position_change: function _mouse_position_change(oldPos, newPos) {\n var dx = oldPos.x - newPos.x,\n dy = oldPos.y - newPos.y;\n return Math.sqrt(dx * dx + dy * dy);\n },\n _is_number: function _is_number(n) {\n return !isNaN(parseFloat(n)) && isFinite(n);\n },\n on_mouse_move: function on_mouse_move(e) {\n if (this.drag.start_drag) {\n var pos = domHelpers.getRelativeEventPosition(e, gantt.$task_data);\n var sX = this.drag.start_drag.start_x,\n sY = this.drag.start_drag.start_y;\n\n if (Date.now() - this.drag.timestamp > 50 || this._is_number(sX) && this._is_number(sY) && this._mouse_position_change({\n x: sX,\n y: sY\n }, pos) > 20) {\n this._start_dnd(e);\n }\n }\n\n var drag = this.drag;\n\n if (drag.mode) {\n if (!timeout(this, 40)) //limit update frequency\n return;\n\n this._update_on_move(e);\n }\n },\n _update_item_on_move: function _update_item_on_move(shift, id, mode, drag, e, multipleDragShift) {\n var task = gantt.getTask(id);\n var original = gantt.mixin({}, task);\n var copy = gantt.mixin({}, task);\n\n this._handlers[mode].apply(this, [copy, shift, drag, multipleDragShift]);\n\n gantt.mixin(task, copy, true); //gantt._update_parents(drag.id, true);\n\n gantt.callEvent(\"onTaskDrag\", [task.id, mode, copy, original, e]);\n gantt.mixin(task, copy, true);\n gantt.refreshTask(id);\n },\n _update_on_move: function _update_on_move(e) {\n var drag = this.drag;\n var config = timeline.$getConfig();\n\n if (drag.mode) {\n var pos = domHelpers.getRelativeEventPosition(e, timeline.$task_data);\n if (drag.pos && drag.pos.x == pos.x) return;\n drag.pos = pos;\n var curr_date = gantt.dateFromPos(pos.x);\n if (!curr_date || isNaN(curr_date.getTime())) return;\n var shift = pos.x - drag.start_x;\n var task = gantt.getTask(drag.id);\n\n if (this._handlers[drag.mode]) {\n if (drag.mode === config.drag_mode.move) {\n var dragHash = {};\n\n if (this._isMultiselect()) {\n var selectedTasksIds = gantt.getSelectedTasks();\n\n if (selectedTasksIds.indexOf(drag.id) >= 0) {\n dragHash = this.dragMultiple;\n }\n }\n\n var dragProject = false;\n\n if (gantt.isSummaryTask(task) && gantt.config.drag_project) {\n var initialDrag = {};\n initialDrag[drag.id] = utils.copy(drag);\n dragProject = true;\n dragHash = utils.mixin(initialDrag, this.dragMultiple);\n }\n\n var maxShift = this._find_max_shift(dragHash, shift);\n\n if (maxShift !== undefined) {\n shift = maxShift;\n }\n\n this._update_item_on_move(shift, drag.id, drag.mode, drag, e);\n\n for (var i in dragHash) {\n var childDrag = dragHash[i];\n\n if (dragProject && childDrag.id != drag.id) {\n gantt._bulk_dnd = true;\n } // GS-454: Calculate the date shift in milliseconds instead of pixels\n\n\n if (maxShift === undefined && (dragProject || Object.keys(dragHash).length > 1)) {\n var shiftDate = gantt.dateFromPos(drag.start_x);\n var multipleDragShift = curr_date - shiftDate;\n }\n\n this._update_item_on_move(shift, childDrag.id, childDrag.mode, childDrag, e, multipleDragShift);\n }\n\n gantt._bulk_dnd = false;\n } else {\n // for resize and progress\n this._update_item_on_move(shift, drag.id, drag.mode, drag, e);\n }\n\n gantt._update_parents(drag.id);\n }\n }\n },\n on_mouse_down: function on_mouse_down(e, src) {\n // on Mac we do not get onmouseup event when clicking right mouse button leaving us in dnd state\n // let's ignore right mouse button then\n if (e.button == 2 && e.button !== undefined) return;\n var config = timeline.$getConfig();\n var id = gantt.locate(e);\n var task = null;\n\n if (gantt.isTaskExists(id)) {\n task = gantt.getTask(id);\n }\n\n if (gantt.isReadonly(task) || this.drag.mode) return;\n this.clear_drag_state();\n src = src || e.target || e.srcElement;\n var className = domHelpers.getClassName(src);\n\n var drag = this._get_drag_mode(className, src);\n\n if (!className || !drag) {\n if (src.parentNode) return this.on_mouse_down(e, src.parentNode);else return;\n }\n\n if (!drag) {\n if (gantt.checkEvent(\"onMouseDown\") && gantt.callEvent(\"onMouseDown\", [className.split(\" \")[0]])) {\n if (src.parentNode) return this.on_mouse_down(e, src.parentNode);\n }\n } else {\n if (drag.mode && drag.mode != config.drag_mode.ignore && config[\"drag_\" + drag.mode]) {\n id = gantt.locate(src);\n task = gantt.copy(gantt.getTask(id) || {});\n\n if (gantt.isReadonly(task)) {\n this.clear_drag_state();\n return false;\n }\n\n if (gantt.isSummaryTask(task) && !config.drag_project && drag.mode != config.drag_mode.progress) {\n //only progress drag is allowed for tasks with flexible duration\n this.clear_drag_state();\n return;\n }\n\n drag.id = id;\n var pos = domHelpers.getRelativeEventPosition(e, gantt.$task_data);\n drag.start_x = pos.x;\n drag.start_y = pos.y;\n drag.obj = task;\n this.drag.start_drag = drag;\n this.drag.timestamp = Date.now();\n } else this.clear_drag_state();\n }\n },\n _fix_dnd_scale_time: function _fix_dnd_scale_time(task, drag) {\n var config = timeline.$getConfig();\n var unit = gantt.getScale().unit,\n step = gantt.getScale().step;\n\n if (!config.round_dnd_dates) {\n unit = 'minute';\n step = config.time_step;\n }\n\n function fixStart(task) {\n if (!gantt.config.correct_work_time) return;\n var config = timeline.$getConfig();\n if (!gantt.isWorkTime(task.start_date, undefined, task)) task.start_date = gantt.calculateEndDate({\n start_date: task.start_date,\n duration: -1,\n unit: config.duration_unit,\n task: task\n });\n }\n\n function fixEnd(task) {\n if (!gantt.config.correct_work_time) return;\n var config = timeline.$getConfig();\n if (!gantt.isWorkTime(new Date(task.end_date - 1), undefined, task)) task.end_date = gantt.calculateEndDate({\n start_date: task.end_date,\n duration: 1,\n unit: config.duration_unit,\n task: task\n });\n }\n\n if (drag.mode == config.drag_mode.resize) {\n if (drag.left) {\n task.start_date = gantt.roundDate({\n date: task.start_date,\n unit: unit,\n step: step\n });\n fixStart(task);\n } else {\n task.end_date = gantt.roundDate({\n date: task.end_date,\n unit: unit,\n step: step\n });\n fixEnd(task);\n }\n } else if (drag.mode == config.drag_mode.move) {\n task.start_date = gantt.roundDate({\n date: task.start_date,\n unit: unit,\n step: step\n });\n fixStart(task);\n task.end_date = gantt.calculateEndDate(task);\n }\n },\n _fix_working_times: function _fix_working_times(task, drag) {\n var config = timeline.$getConfig();\n var drag = drag || {\n mode: config.drag_mode.move\n };\n\n if (drag.mode == config.drag_mode.resize) {\n if (drag.left) {\n task.start_date = gantt.getClosestWorkTime({\n date: task.start_date,\n dir: 'future',\n task: task\n });\n } else {\n task.end_date = gantt.getClosestWorkTime({\n date: task.end_date,\n dir: 'past',\n task: task\n });\n }\n } else if (drag.mode == config.drag_mode.move) {\n gantt.correctTaskWorkTime(task);\n }\n },\n _finalize_mouse_up: function _finalize_mouse_up(taskId, config, drag, e) {\n var task = gantt.getTask(taskId);\n\n if (config.work_time && config.correct_work_time) {\n this._fix_working_times(task, drag);\n }\n\n this._fix_dnd_scale_time(task, drag);\n\n if (!this._fireEvent(\"before_finish\", drag.mode, [taskId, drag.mode, gantt.copy(drag.obj), e])) {\n //drag.obj._dhx_changed = false;\n this.clear_drag_state();\n\n if (taskId == drag.id) {\n drag.obj._dhx_changed = false;\n gantt.mixin(task, drag.obj, true);\n }\n\n gantt.refreshTask(task.id);\n } else {\n var drag_id = taskId;\n\n gantt._init_task_timing(task);\n\n this.clear_drag_state();\n gantt.updateTask(task.id);\n\n this._fireEvent(\"after_finish\", drag.mode, [drag_id, drag.mode, e]);\n }\n },\n on_mouse_up: function on_mouse_up(e) {\n var drag = this.drag;\n\n if (drag.mode && drag.id) {\n var config = timeline.$getConfig(); //drop\n\n var task = gantt.getTask(drag.id);\n var dragMultiple = this.dragMultiple;\n var finalizingBulkMove = false;\n var moveCount = 0;\n\n if (drag.mode === config.drag_mode.move) {\n if (gantt.isSummaryTask(task) && config.drag_project || this._isMultiselect()) {\n finalizingBulkMove = true;\n moveCount = Object.keys(dragMultiple).length;\n }\n }\n\n var doFinalize = function doFinalize() {\n if (finalizingBulkMove) {\n for (var i in dragMultiple) {\n this._finalize_mouse_up(dragMultiple[i].id, config, dragMultiple[i], e);\n }\n }\n\n this._finalize_mouse_up(drag.id, config, drag, e);\n };\n\n if (finalizingBulkMove && moveCount > 10) {\n // 10 - arbitrary threshold for bulk dnd at which we start doing complete repaint to refresh\n gantt.batchUpdate(function () {\n doFinalize.call(this);\n }.bind(this));\n } else {\n doFinalize.call(this);\n }\n }\n\n this.clear_drag_state();\n },\n _get_drag_mode: function _get_drag_mode(className, el) {\n var config = timeline.$getConfig();\n var modes = config.drag_mode;\n var classes = (className || \"\").split(\" \");\n var classname = classes[0];\n var drag = {\n mode: null,\n left: null\n };\n\n switch (classname) {\n case \"gantt_task_line\":\n case \"gantt_task_content\":\n drag.mode = modes.move;\n break;\n\n case \"gantt_task_drag\":\n drag.mode = modes.resize;\n var dragProperty = el.getAttribute(\"data-bind-property\");\n\n if (dragProperty == \"start_date\") {\n drag.left = true;\n } else {\n drag.left = false;\n }\n\n break;\n\n case \"gantt_task_progress_drag\":\n drag.mode = modes.progress;\n break;\n\n case \"gantt_link_control\":\n case \"gantt_link_point\":\n drag.mode = modes.ignore;\n break;\n\n default:\n drag = null;\n break;\n }\n\n return drag;\n },\n _start_dnd: function _start_dnd(e) {\n var drag = this.drag = this.drag.start_drag;\n delete drag.start_drag;\n var cfg = timeline.$getConfig();\n var id = drag.id;\n\n if (!cfg[\"drag_\" + drag.mode] || !gantt.callEvent(\"onBeforeDrag\", [id, drag.mode, e]) || !this._fireEvent(\"before_start\", drag.mode, [id, drag.mode, e])) {\n this.clear_drag_state();\n } else {\n delete drag.start_drag;\n var task = gantt.getTask(id);\n\n if (gantt.isReadonly(task)) {\n this.clear_drag_state();\n return;\n }\n\n if (this._isMultiselect()) {\n // for don't move selected tasks when drag unselected task\n var selectedTasksIds = gantt.getSelectedTasks();\n\n if (selectedTasksIds.indexOf(drag.id) >= 0) {\n helpers.forEach(selectedTasksIds, gantt.bind(function (taskId) {\n var selectedTask = gantt.getTask(taskId);\n\n if (gantt.isSummaryTask(selectedTask) && gantt.config.drag_project && drag.mode == cfg.drag_mode.move) {\n this._addSubtasksToDragMultiple(selectedTask.id);\n }\n\n this.dragMultiple[taskId] = gantt.mixin({\n id: selectedTask.id,\n obj: gantt.copy(selectedTask)\n }, this.drag);\n }, this));\n }\n } // for move unselected summary\n\n\n if (gantt.isSummaryTask(task) && gantt.config.drag_project && drag.mode == cfg.drag_mode.move) {\n this._addSubtasksToDragMultiple(task.id);\n }\n\n gantt.callEvent(\"onTaskDragStart\", []);\n }\n },\n _fireEvent: function _fireEvent(stage, mode, params) {\n gantt.assert(this._events[stage], \"Invalid stage:{\" + stage + \"}\");\n var trigger = this._events[stage][mode];\n gantt.assert(trigger, \"Unknown after drop mode:{\" + mode + \"}\");\n gantt.assert(params, \"Invalid event arguments\");\n if (!gantt.checkEvent(trigger)) return true;\n return gantt.callEvent(trigger, params);\n },\n round_task_dates: function round_task_dates(task) {\n var drag_state = this.drag;\n var config = timeline.$getConfig();\n\n if (!drag_state) {\n drag_state = {\n mode: config.drag_mode.move\n };\n }\n\n this._fix_dnd_scale_time(task, drag_state);\n },\n destructor: function destructor() {\n this._domEvents.detachAll();\n },\n _isMultiselect: function _isMultiselect() {\n return gantt.config.drag_multiple && !!(gantt.getSelectedTasks && gantt.getSelectedTasks().length > 0);\n },\n _addSubtasksToDragMultiple: function _addSubtasksToDragMultiple(summaryId) {\n gantt.eachTask(function (child) {\n this.dragMultiple[child.id] = gantt.mixin({\n id: child.id,\n obj: gantt.copy(child)\n }, this.drag);\n }, summaryId, this);\n }\n };\n}\n\nfunction initTaskDND() {\n var _tasks_dnd;\n\n return {\n extend: function extend(timeline) {\n timeline.roundTaskDates = function (task) {\n _tasks_dnd.round_task_dates(task);\n };\n },\n init: function init(timeline, gantt) {\n _tasks_dnd = createTaskDND(timeline, gantt); // TODO: entry point for touch handlers, move touch to timeline\n\n timeline._tasks_dnd = _tasks_dnd;\n return _tasks_dnd.init(gantt);\n },\n destructor: function destructor() {\n if (_tasks_dnd) {\n _tasks_dnd.destructor();\n\n _tasks_dnd = null;\n }\n }\n };\n}\n\nmodule.exports = {\n createTaskDND: initTaskDND\n};","var utils = require(\"../../../utils/utils\"),\n taskDnD = require(\"./tasks_dnd\"),\n linkDnD = require(\"./links_dnd\"),\n domHelpers = require(\"../utils/dom_helpers\");\n\nvar initializer = function () {\n return function (gantt) {\n var services = gantt.$services;\n return {\n onCreated: function onCreated(timeline) {\n var config = timeline.$config;\n config.bind = utils.defined(config.bind) ? config.bind : \"task\";\n config.bindLinks = utils.defined(config.bindLinks) ? config.bindLinks : \"link\";\n timeline._linksDnD = linkDnD.createLinkDND();\n timeline._tasksDnD = taskDnD.createTaskDND();\n\n timeline._tasksDnD.extend(timeline);\n\n this._mouseDelegates = require(\"../mouse_event_container\")(gantt);\n },\n onInitialized: function onInitialized(timeline) {\n this._attachDomEvents(gantt);\n\n this._attachStateProvider(gantt, timeline);\n\n timeline._tasksDnD.init(timeline, gantt);\n\n timeline._linksDnD.init(timeline, gantt);\n\n if (timeline.$config.id == \"timeline\") {\n this.extendDom(timeline);\n }\n },\n onDestroyed: function onDestroyed(timeline) {\n this._clearDomEvents(gantt);\n\n this._clearStateProvider(gantt);\n\n if (timeline._tasksDnD) {\n timeline._tasksDnD.destructor();\n }\n },\n extendDom: function extendDom(timeline) {\n gantt.$task = timeline.$task;\n gantt.$task_scale = timeline.$task_scale;\n gantt.$task_data = timeline.$task_data;\n gantt.$task_bg = timeline.$task_bg;\n gantt.$task_links = timeline.$task_links;\n gantt.$task_bars = timeline.$task_bars;\n },\n _clearDomEvents: function _clearDomEvents() {\n this._mouseDelegates.destructor();\n\n this._mouseDelegates = null;\n },\n _attachDomEvents: function _attachDomEvents(gantt) {\n function _delete_link_handler(id, e) {\n if (id && this.callEvent(\"onLinkDblClick\", [id, e])) {\n var link = this.getLink(id);\n if (this.isReadonly(link)) return;\n var title = \"\";\n var question = this.locale.labels.link + \" \" + this.templates.link_description(this.getLink(id)) + \" \" + this.locale.labels.confirm_link_deleting;\n window.setTimeout(function () {\n gantt._simple_confirm(question, title, function () {\n gantt.deleteLink(id);\n });\n }, this.config.touch ? 300 : 1);\n }\n }\n\n this._mouseDelegates.delegate(\"click\", \"gantt_task_link\", gantt.bind(function (e, trg) {\n var id = this.locate(e, this.config.link_attribute);\n\n if (id) {\n this.callEvent(\"onLinkClick\", [id, e]);\n }\n }, gantt), this.$task);\n\n this._mouseDelegates.delegate(\"click\", \"gantt_scale_cell\", gantt.bind(function (e, trg) {\n var pos = domHelpers.getRelativeEventPosition(e, gantt.$task_data);\n var date = gantt.dateFromPos(pos.x);\n var coll = Math.floor(gantt.columnIndexByDate(date));\n var coll_date = gantt.getScale().trace_x[coll];\n gantt.callEvent(\"onScaleClick\", [e, coll_date]);\n }, gantt), this.$task);\n\n this._mouseDelegates.delegate(\"doubleclick\", \"gantt_task_link\", gantt.bind(function (e, id, trg) {\n var id = this.locate(e, gantt.config.link_attribute);\n\n _delete_link_handler.call(this, id, e);\n }, gantt), this.$task);\n\n this._mouseDelegates.delegate(\"doubleclick\", \"gantt_link_point\", gantt.bind(function (e, id, trg) {\n var id = this.locate(e),\n task = this.getTask(id);\n var link = null;\n\n if (trg.parentNode && domHelpers.getClassName(trg.parentNode)) {\n if (domHelpers.getClassName(trg.parentNode).indexOf(\"_left\") > -1) {\n link = task.$target[0];\n } else {\n link = task.$source[0];\n }\n }\n\n if (link) _delete_link_handler.call(this, link, e);\n return false;\n }, gantt), this.$task);\n },\n _attachStateProvider: function _attachStateProvider(gantt, timeline) {\n var self = timeline;\n var state = services.getService(\"state\");\n state.registerProvider(\"tasksTimeline\", function () {\n return {\n scale_unit: self._tasks ? self._tasks.unit : undefined,\n scale_step: self._tasks ? self._tasks.step : undefined\n };\n });\n },\n _clearStateProvider: function _clearStateProvider() {\n var state = services.getService(\"state\");\n state.unregisterProvider(\"tasksTimeline\");\n }\n };\n };\n}();\n\nmodule.exports = initializer;","var domHelpers = require(\"../../utils/dom_helpers\");\n/**\r\n * methods for highlighting current drag and drop position\r\n */\n\n\nfunction highlightPosition(target, root, grid) {\n var markerPos = getTaskMarkerPosition(target, grid); // setting position of row\n\n root.marker.style.left = markerPos.x + 9 + \"px\";\n root.marker.style.width = markerPos.width + \"px\";\n root.marker.style.overflow = \"hidden\";\n var markerLine = root.markerLine;\n\n if (!markerLine) {\n markerLine = document.createElement(\"div\");\n markerLine.className = \"gantt_drag_marker gantt_grid_dnd_marker\";\n markerLine.innerHTML = \"
\";\n markerLine.style.pointerEvents = \"none\";\n }\n\n if (target.child) {\n highlightFolder(target, markerLine, grid);\n } else {\n highlightRow(target, markerLine, grid);\n }\n\n if (!root.markerLine) {\n document.body.appendChild(markerLine);\n root.markerLine = markerLine;\n }\n}\n\nfunction removeLineHighlight(root) {\n if (root.markerLine && root.markerLine.parentNode) {\n root.markerLine.parentNode.removeChild(root.markerLine);\n }\n\n root.markerLine = null;\n}\n\nfunction highlightRow(target, markerLine, grid) {\n var linePos = getLineMarkerPosition(target, grid);\n var maxBottom = grid.$grid_data.getBoundingClientRect().bottom + window.scrollY;\n markerLine.innerHTML = \"
\";\n markerLine.style.left = linePos.x + \"px\";\n markerLine.style.height = \"4px\";\n var markerLineTop = linePos.y - 2;\n markerLine.style.top = markerLineTop + \"px\";\n markerLine.style.width = linePos.width + \"px\";\n\n if (markerLineTop > maxBottom) {\n markerLine.style.top = maxBottom + 'px';\n }\n\n return markerLine;\n}\n\nfunction highlightFolder(target, markerFolder, grid) {\n var id = target.targetParent;\n var pos = gridToPageCoordinates({\n x: 0,\n y: grid.getItemTop(id)\n }, grid);\n var maxBottom = grid.$grid_data.getBoundingClientRect().bottom + window.scrollY;\n var folderHighlightWidth = setWidthWithinContainer(grid.$gantt, grid.$grid_data.offsetWidth);\n markerFolder.innerHTML = \"
\";\n markerFolder.style.width = folderHighlightWidth + \"px\";\n markerFolder.style.top = pos.y + \"px\";\n markerFolder.style.left = pos.x + \"px\";\n markerFolder.style.height = grid.getItemHeight(id) + \"px\";\n\n if (pos.y > maxBottom) {\n markerFolder.style.top = maxBottom + 'px';\n }\n\n return markerFolder;\n}\n\nfunction getLineMarkerPosition(target, grid) {\n var store = grid.$config.rowStore;\n var pos = {\n x: 0,\n y: 0\n };\n var indentNode = grid.$grid_data.querySelector(\".gantt_tree_indent\");\n var indent = 15;\n var level = 0;\n\n if (indentNode) {\n indent = indentNode.offsetWidth;\n }\n\n var iconWidth = 40;\n\n if (target.targetId !== store.$getRootId()) {\n var itemTop = grid.getItemTop(target.targetId);\n var itemHeight = grid.getItemHeight(target.targetId);\n level = store.exists(target.targetId) ? store.calculateItemLevel(store.getItem(target.targetId)) : 0;\n\n if (target.prevSibling) {\n pos.y = itemTop;\n } else if (target.nextSibling) {\n var childCount = 0;\n store.eachItem(function (child) {\n if (store.getIndexById(child.id) !== -1) childCount++;\n }, target.targetId);\n pos.y = itemTop + itemHeight + childCount * itemHeight;\n } else {\n pos.y = itemTop + itemHeight;\n level += 1;\n }\n }\n\n pos.x = iconWidth + level * indent;\n pos.width = setWidthWithinContainer(grid.$gantt, Math.max(grid.$grid_data.offsetWidth - pos.x, 0), pos.x);\n return gridToPageCoordinates(pos, grid);\n}\n\nfunction gridToPageCoordinates(pos, grid) {\n var gridPos = domHelpers.getNodePosition(grid.$grid_data);\n pos.x += gridPos.x + grid.$grid.scrollLeft;\n pos.y += gridPos.y - grid.$grid_data.scrollTop;\n return pos;\n}\n\nfunction getTaskMarkerPosition(e, grid) {\n var pos = domHelpers.getNodePosition(grid.$grid_data);\n var ePos = domHelpers.getRelativeEventPosition(e, grid.$grid_data); // row offset\n\n var x = pos.x + grid.$grid.scrollLeft;\n var y = ePos.y - 10;\n var rowHeight = grid.getItemHeight(e.targetId); // prevent moving row out of grid_data container\n\n if (y < pos.y) y = pos.y;\n var gridHeight = grid.getTotalHeight();\n if (y > pos.y + gridHeight - rowHeight) y = pos.y + gridHeight - rowHeight;\n pos.x = x;\n pos.y = y;\n pos.width = setWidthWithinContainer(grid.$gantt, pos.width, 9);\n return pos;\n}\n\nfunction setWidthWithinContainer(gantt, width) {\n var offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n var containerSize = domHelpers.getNodePosition(gantt.$root);\n\n if (width > containerSize.width) {\n width = containerSize.width - offset - 2;\n }\n\n return width;\n}\n\nmodule.exports = {\n removeLineHighlight: removeLineHighlight,\n highlightPosition: highlightPosition\n};","/**\r\n * resolve dnd position of the task when gantt.config.order_branch_free = true\r\n */\nvar dropTarget = require(\"./drop_target\");\n\nmodule.exports = function getMultiLevelDropPosition(dndTaskId, targetTaskId, relTargetPos, eventTop, store) {\n var result;\n\n if (targetTaskId !== store.$getRootId()) {\n if (relTargetPos < 0.25) {\n result = dropTarget.prevSiblingTarget(dndTaskId, targetTaskId, store);\n } else if (relTargetPos > 0.60 && !(store.hasChild(targetTaskId) && store.getItem(targetTaskId).$open)) {\n result = dropTarget.nextSiblingTarget(dndTaskId, targetTaskId, store);\n } else {\n result = dropTarget.firstChildTarget(dndTaskId, targetTaskId, store);\n }\n } else {\n var rootId = store.$getRootId();\n\n if (store.hasChild(rootId) && eventTop >= 0) {\n result = dropTarget.lastChildTarget(dndTaskId, rootId, store);\n } else {\n result = dropTarget.firstChildTarget(dndTaskId, rootId, store);\n }\n }\n\n return result;\n};","/**\r\n * resolve dnd position of the task when gantt.config.order_branch_free = false\r\n */\nvar dropTarget = require(\"./drop_target\");\n\nfunction getLast(store) {\n var current = store.getNext();\n\n while (store.exists(current)) {\n var next = store.getNext(current);\n\n if (!store.exists(next)) {\n return current;\n } else {\n current = next;\n }\n }\n\n return null;\n}\n\nfunction findClosesTarget(dndTaskId, taskId, allowedLevel, store, up) {\n var prev = taskId;\n\n while (store.exists(prev)) {\n var targetLevel = store.calculateItemLevel(store.getItem(prev));\n\n if ((targetLevel === allowedLevel || targetLevel === allowedLevel - 1) && store.getBranchIndex(prev) > -1) {\n break;\n } else {\n prev = up ? store.getPrev(prev) : store.getNext(prev);\n }\n }\n\n if (store.exists(prev)) {\n if (store.calculateItemLevel(store.getItem(prev)) === allowedLevel) {\n return up ? dropTarget.nextSiblingTarget(dndTaskId, prev, store) : dropTarget.prevSiblingTarget(dndTaskId, prev, store);\n } else {\n return dropTarget.firstChildTarget(dndTaskId, prev, store);\n }\n }\n\n return null;\n}\n\nfunction findTargetAbove(dndTaskId, taskId, allowedLevel, store) {\n return findClosesTarget(dndTaskId, taskId, allowedLevel, store, true);\n}\n\nfunction findTargetBelow(dndTaskId, taskId, allowedLevel, store) {\n return findClosesTarget(dndTaskId, taskId, allowedLevel, store, false);\n}\n\nmodule.exports = function getSameLevelDropPosition(dndTaskId, targetTaskId, relTargetPos, eventTop, store, level) {\n var result;\n\n if (targetTaskId !== store.$getRootId()) {\n var targetTask = store.getItem(targetTaskId);\n var targetLevel = store.calculateItemLevel(targetTask);\n\n if (targetLevel === level) {\n var prevSibling = store.getPrevSibling(targetTaskId);\n\n if (relTargetPos < 0.5 && !prevSibling) {\n result = dropTarget.prevSiblingTarget(dndTaskId, targetTaskId, store);\n } else {\n if (relTargetPos < 0.5) {\n targetTaskId = prevSibling;\n }\n\n result = dropTarget.nextSiblingTarget(dndTaskId, targetTaskId, store);\n }\n } else if (targetLevel > level) {\n store.eachParent(function (parent) {\n if (store.calculateItemLevel(parent) === level) {\n targetTaskId = parent.id;\n }\n }, targetTask);\n result = findTargetAbove(dndTaskId, targetTaskId, level, store);\n } else {\n var targetAbove = findTargetAbove(dndTaskId, targetTaskId, level, store);\n var targetBelow = findTargetBelow(dndTaskId, targetTaskId, level, store);\n result = relTargetPos < 0.5 ? targetAbove : targetBelow;\n }\n } else {\n var rootId = store.$getRootId();\n var rootLevel = store.getChildren(rootId);\n result = dropTarget.createDropTargetObject();\n\n if (rootLevel.length && eventTop >= 0) {\n result = findTargetAbove(dndTaskId, getLast(store), level, store);\n } else {\n result = findTargetBelow(dndTaskId, rootId, level, store);\n }\n }\n\n return result;\n};","var domHelpers = require(\"../utils/dom_helpers\");\n\nvar dropTarget = require(\"./tasks_grid_dnd_marker_helpers/drop_target\");\n\nvar getLockedLevelTarget = require(\"./tasks_grid_dnd_marker_helpers/locked_level\");\n\nvar getMultiLevelTarget = require(\"./tasks_grid_dnd_marker_helpers/multi_level\");\n\nvar higlighter = require(\"./tasks_grid_dnd_marker_helpers/highlight\");\n\nvar isPlaceholderTask = require(\"../../../utils/placeholder_task\");\n\nfunction _init_dnd(gantt, grid) {\n var DnD = gantt.$services.getService(\"dnd\");\n\n if (!grid.$config.bind || !gantt.getDatastore(grid.$config.bind)) {\n return;\n }\n\n function locate(e) {\n return domHelpers.locateAttribute(e, grid.$config.item_attribute);\n }\n\n function getStore() {\n return gantt.getDatastore(grid.$config.bind);\n }\n\n function checkPlaceholderTask(id) {\n return isPlaceholderTask(id, gantt, getStore());\n }\n\n var dnd = new DnD(grid.$grid_data, {\n updates_per_second: 60\n });\n if (gantt.defined(grid.$getConfig().dnd_sensitivity)) dnd.config.sensitivity = grid.$getConfig().dnd_sensitivity;\n dnd.attachEvent(\"onBeforeDragStart\", gantt.bind(function (obj, e) {\n var el = locate(e);\n if (!el) return false;\n if (gantt.hideQuickInfo) gantt._hideQuickInfo();\n\n if (domHelpers.closest(e.target, \".gantt_grid_editor_placeholder\")) {\n return false;\n }\n\n var id = el.getAttribute(grid.$config.item_attribute);\n var datastore = grid.$config.rowStore;\n var task = datastore.getItem(id);\n if (gantt.isReadonly(task) || checkPlaceholderTask(id)) return false;\n dnd.config.initial_open_state = task.$open;\n\n if (!gantt.callEvent(\"onRowDragStart\", [id, e.target || e.srcElement, e])) {\n return false;\n }\n }, gantt));\n dnd.attachEvent(\"onAfterDragStart\", gantt.bind(function (obj, e) {\n var el = locate(e);\n dnd.config.marker.innerHTML = el.outerHTML;\n var element = dnd.config.marker.firstChild;\n\n if (element) {\n dnd.config.marker.style.opacity = 0.4;\n element.style.position = \"static\";\n element.style.pointerEvents = \"none\";\n }\n\n dnd.config.id = el.getAttribute(grid.$config.item_attribute);\n var store = grid.$config.rowStore;\n var task = store.getItem(dnd.config.id);\n dnd.config.level = store.calculateItemLevel(task);\n dnd.config.drop_target = dropTarget.createDropTargetObject({\n targetParent: store.getParent(task.id),\n targetIndex: store.getBranchIndex(task.id),\n targetId: task.id,\n nextSibling: true\n });\n task.$open = false;\n task.$transparent = true;\n this.refreshData();\n }, gantt));\n\n function getTargetTaskId(e) {\n var y = domHelpers.getRelativeEventPosition(e, grid.$grid_data).y;\n var store = grid.$config.rowStore;\n\n if (!document.doctype) {\n y += window.scrollY;\n }\n\n y = y || 0; // limits for the marker according to the layout layer\n\n var scrollPos = grid.$state.scrollTop || 0;\n var maxBottom = gantt.$grid_data.getBoundingClientRect().height + scrollPos + window.scrollY;\n var minTop = scrollPos;\n var firstVisibleTaskIndex = grid.getItemIndexByTopPosition(grid.$state.scrollTop);\n\n if (!store.exists(firstVisibleTaskIndex)) {\n firstVisibleTaskIndex = store.countVisible() - 1;\n }\n\n if (firstVisibleTaskIndex < 0) {\n return store.$getRootId();\n }\n\n var firstVisibleTaskId = store.getIdByIndex(firstVisibleTaskIndex);\n var firstVisibleTaskPos = grid.$state.scrollTop / grid.getItemHeight(firstVisibleTaskId);\n var hiddenTaskPart = firstVisibleTaskPos - Math.floor(firstVisibleTaskPos);\n\n if (hiddenTaskPart > 0.1 && hiddenTaskPart < 0.9) {\n maxBottom = maxBottom - grid.getItemHeight(firstVisibleTaskId) * hiddenTaskPart;\n minTop = minTop + grid.getItemHeight(firstVisibleTaskId) * (1 - hiddenTaskPart);\n } // GS-715. The placeholder task row shouldn't be draggable below the Gantt container\n\n\n var gridPosition = domHelpers.getNodePosition(grid.$grid_data);\n var gridBottom = gridPosition.y + gridPosition.height;\n var placeholderRowHeight = dnd.config.marker.offsetHeight;\n\n if (y + placeholderRowHeight + window.scrollY >= maxBottom) {\n dnd.config.marker.style.top = gridBottom - placeholderRowHeight + \"px\";\n }\n\n if (y >= maxBottom) {\n y = maxBottom;\n } else if (y <= minTop) {\n y = minTop;\n dnd.config.marker.style.top = gridPosition.y + \"px\";\n }\n\n var index = grid.getItemIndexByTopPosition(y);\n\n if (index > store.countVisible() - 1 || index < 0) {\n return store.$getRootId();\n }\n\n var targetId = store.getIdByIndex(index);\n\n if (checkPlaceholderTask(targetId)) {\n return store.getPrevSibling(targetId);\n }\n\n return store.getIdByIndex(index);\n }\n\n function getDropPosition(e) {\n var targetTaskId = getTargetTaskId(e);\n var relTargetPos = null;\n var store = grid.$config.rowStore;\n var config = grid.$getConfig();\n var lockLevel = !config.order_branch_free;\n var eventTop = domHelpers.getRelativeEventPosition(e, grid.$grid_data).y;\n\n if (!document.doctype) {\n eventTop += window.scrollY;\n }\n\n if (targetTaskId !== store.$getRootId()) {\n var rowTop = grid.getItemTop(targetTaskId);\n var rowHeight = grid.getItemHeight(targetTaskId);\n relTargetPos = (eventTop - rowTop) / rowHeight;\n }\n\n var result;\n\n if (!lockLevel) {\n result = getMultiLevelTarget(dnd.config.id, targetTaskId, relTargetPos, eventTop, store);\n } else {\n result = getLockedLevelTarget(dnd.config.id, targetTaskId, relTargetPos, eventTop, store, dnd.config.level);\n\n if (result && result.targetParent && checkPlaceholderTask(result.targetParent)) {\n targetTaskId = store.getPrevSibling(result.targetParent);\n result = getLockedLevelTarget(dnd.config.id, targetTaskId, relTargetPos, eventTop, store, dnd.config.level);\n }\n }\n\n return result;\n }\n\n dnd.attachEvent(\"onDragMove\", gantt.bind(function (obj, e) {\n var target = getDropPosition(e);\n\n if (!target || gantt.callEvent(\"onBeforeRowDragMove\", [dnd.config.id, target.targetParent, target.targetIndex]) === false) {\n target = dropTarget.createDropTargetObject(dnd.config.drop_target);\n }\n\n higlighter.highlightPosition(target, dnd.config, grid);\n dnd.config.drop_target = target;\n this.callEvent(\"onRowDragMove\", [dnd.config.id, target.targetParent, target.targetIndex]);\n return true;\n }, gantt));\n dnd.attachEvent(\"onDragEnd\", gantt.bind(function () {\n var store = grid.$config.rowStore;\n var task = store.getItem(dnd.config.id);\n higlighter.removeLineHighlight(dnd.config);\n task.$transparent = false;\n task.$open = dnd.config.initial_open_state;\n var target = dnd.config.drop_target;\n\n if (this.callEvent(\"onBeforeRowDragEnd\", [dnd.config.id, target.targetParent, target.targetIndex]) === false) {\n task.$drop_target = null;\n } else {\n store.move(dnd.config.id, target.targetIndex, target.targetParent);\n gantt.render();\n this.callEvent(\"onRowDragEnd\", [dnd.config.id, target.targetParent, target.targetIndex]);\n }\n\n store.refresh(task.id);\n }, gantt));\n}\n\nmodule.exports = {\n init: _init_dnd\n};","var domHelpers = require(\"../utils/dom_helpers\");\n\nvar isPlaceholderTask = require(\"../../../utils/placeholder_task\");\n\nfunction _init_dnd(gantt, grid) {\n var DnD = gantt.$services.getService(\"dnd\");\n\n if (!grid.$config.bind || !gantt.getDatastore(grid.$config.bind)) {\n return;\n }\n\n function locate(e) {\n return domHelpers.locateAttribute(e, grid.$config.item_attribute);\n }\n\n function getStore() {\n return gantt.getDatastore(grid.$config.bind);\n }\n\n function checkPlaceholderTask(id) {\n return isPlaceholderTask(id, gantt, getStore());\n }\n\n var dnd = new DnD(grid.$grid_data, {\n updates_per_second: 60\n });\n if (gantt.defined(grid.$getConfig().dnd_sensitivity)) dnd.config.sensitivity = grid.$getConfig().dnd_sensitivity;\n dnd.attachEvent(\"onBeforeDragStart\", gantt.bind(function (obj, e) {\n var el = locate(e);\n if (!el) return false;\n if (gantt.hideQuickInfo) gantt._hideQuickInfo();\n\n if (domHelpers.closest(e.target, \".gantt_grid_editor_placeholder\")) {\n return false;\n }\n\n var id = el.getAttribute(grid.$config.item_attribute);\n if (checkPlaceholderTask(id)) return false;\n var datastore = getStore();\n var task = datastore.getItem(id);\n if (gantt.isReadonly(task)) return false;\n dnd.config.initial_open_state = task.$open;\n\n if (!gantt.callEvent(\"onRowDragStart\", [id, e.target || e.srcElement, e])) {\n return false;\n }\n }, gantt));\n dnd.attachEvent(\"onAfterDragStart\", gantt.bind(function (obj, e) {\n var el = locate(e);\n dnd.config.marker.innerHTML = el.outerHTML;\n var element = dnd.config.marker.firstChild;\n\n if (element) {\n element.style.position = \"static\";\n }\n\n dnd.config.id = el.getAttribute(grid.$config.item_attribute);\n var store = getStore();\n var task = store.getItem(dnd.config.id);\n dnd.config.index = store.getBranchIndex(dnd.config.id);\n dnd.config.parent = task.parent;\n task.$open = false;\n task.$transparent = true;\n this.refreshData();\n }, gantt));\n\n dnd.lastTaskOfLevel = function (level) {\n var last_item = null;\n var store = getStore();\n var tasks = store.getItems();\n\n for (var i = 0, len = tasks.length; i < len; i++) {\n if (tasks[i].$level == level) {\n last_item = tasks[i];\n }\n }\n\n return last_item ? last_item.id : null;\n };\n\n dnd._getGridPos = gantt.bind(function (e) {\n var pos = domHelpers.getNodePosition(grid.$grid_data); // row offset\n\n var x = pos.x + grid.$grid.scrollLeft;\n var y = e.pos.y - 10;\n var rowHeight = grid.getItemHeight(dnd.config.id); // prevent moving row out of grid_data container\n\n if (y < pos.y) y = pos.y;\n var gridHeight = grid.getTotalHeight();\n if (y > pos.y + gridHeight - rowHeight) y = pos.y + gridHeight - rowHeight;\n var maxBottom = pos.y + pos.height;\n\n if (y > maxBottom - rowHeight) {\n y = maxBottom - rowHeight;\n }\n\n pos.x = x;\n pos.y = y;\n return pos;\n }, gantt);\n dnd._getTargetY = gantt.bind(function (e) {\n var pos = domHelpers.getNodePosition(grid.$grid_data);\n var scrollPos = grid.$state.scrollTop || 0;\n var maxBottom = gantt.$grid_data.getBoundingClientRect().height + scrollPos;\n var y = e.pageY - pos.y + scrollPos;\n\n if (y > maxBottom) {\n y = maxBottom;\n } else if (y < scrollPos) {\n y = scrollPos;\n }\n\n return y;\n }, gantt);\n dnd._getTaskByY = gantt.bind(function (y, dropIndex) {\n var store = getStore();\n y = y || 0;\n var index = grid.getItemIndexByTopPosition(y);\n index = dropIndex < index ? index - 1 : index;\n if (index > store.countVisible() - 1) return null;\n return store.getIdByIndex(index);\n }, gantt);\n dnd.attachEvent(\"onDragMove\", gantt.bind(function (obj, e) {\n var gridDataSizes = gantt.$grid_data.getBoundingClientRect();\n var maxBottom = gridDataSizes.height + gridDataSizes.y + (grid.$state.scrollTop || 0) + window.scrollY;\n var dd = dnd.config;\n\n var pos = dnd._getGridPos(e);\n\n var config = grid.$getConfig(),\n store = getStore(); // setting position of row\n\n if (pos.y < maxBottom) {\n dd.marker.style.top = pos.y + \"px\";\n } else {\n dd.marker.style.top = maxBottom + \"px\";\n }\n\n dd.marker.style.left = pos.x + 10 + \"px\";\n var containerSize = domHelpers.getNodePosition(gantt.$root);\n\n if (pos.width > containerSize.width) {\n dd.marker.style.width = containerSize.width - 10 - 2 + \"px\";\n dd.marker.style.overflow = \"hidden\";\n } // highlight row when mouseover\n\n\n var item = store.getItem(dnd.config.id);\n\n var targetY = dnd._getTargetY(e);\n\n var el = dnd._getTaskByY(targetY, store.getIndexById(item.id));\n\n if (!store.exists(el)) {\n el = dnd.lastTaskOfLevel(config.order_branch_free ? item.$level : 0);\n\n if (el == dnd.config.id) {\n el = null;\n }\n }\n\n function allowedLevel(next, item) {\n return !store.isChildOf(over.id, item.id) && (next.$level == item.$level || config.order_branch_free);\n }\n\n if (store.exists(el)) {\n var over = store.getItem(el);\n var itemTop = grid.getItemTop(over.id);\n var itemHeight = grid.getItemHeight(over.id);\n\n if (itemTop + itemHeight / 2 < targetY) {\n //hovering over bottom part of item, check can be drop to bottom\n var index = store.getIndexById(over.id);\n var nextId = store.getNext(over.id); //adds +1 when hovering over placeholder\n\n var next = store.getItem(nextId);\n\n if (checkPlaceholderTask(nextId)) {\n var prevId = store.getPrev(next.id);\n next = store.getItem(prevId);\n }\n\n if (next) {\n if (next.id != item.id) {\n over = next; //there is a valid target\n } else {\n if (config.order_branch_free) {\n if (!(store.isChildOf(item.id, over.id) && store.getChildren(over.id).length == 1)) return;else {\n store.move(item.id, store.getBranchIndex(over.id) + 1, store.getParent(over.id));\n return;\n }\n } else {\n return;\n }\n }\n } else {\n //we at end of the list, check and drop at the end of list\n nextId = store.getIdByIndex(index);\n next = store.getItem(nextId);\n\n if (checkPlaceholderTask(nextId)) {\n var prevId = store.getPrev(next.id);\n next = store.getItem(prevId);\n }\n\n if (allowedLevel(next, item) && next.id != item.id) {\n store.move(item.id, -1, store.getParent(next.id));\n return;\n }\n }\n } else if (config.order_branch_free) {\n if (over.id != item.id && allowedLevel(over, item) && !checkPlaceholderTask(over.id)) {\n if (!store.hasChild(over.id)) {\n over.$open = true;\n store.move(item.id, -1, over.id);\n return;\n }\n\n if (store.getIndexById(over.id) || itemHeight / 3 < targetY) return;\n }\n } //if item is on different level, check the one before it\n\n\n var index = store.getIndexById(over.id),\n prevId = store.getIdByIndex(index - 1);\n var prev = store.getItem(prevId);\n var shift = 1;\n\n while ((!prev || prev.id == over.id) && index - shift >= 0) {\n prevId = store.getIdByIndex(index - shift);\n prev = store.getItem(prevId);\n shift++;\n }\n\n if (item.id == over.id || checkPlaceholderTask(over.id)) return; //replacing item under cursor\n\n if (allowedLevel(over, item) && item.id != over.id) {\n store.move(item.id, 0, 0, over.id);\n } else if (over.$level == item.$level - 1 && !store.getChildren(over.id).length) {\n store.move(item.id, 0, over.id);\n } else if (prev && allowedLevel(prev, item) && item.id != prev.id) {\n store.move(item.id, -1, store.getParent(prev.id));\n }\n }\n\n return true;\n }, gantt));\n dnd.attachEvent(\"onDragEnd\", gantt.bind(function () {\n var store = getStore();\n var task = store.getItem(dnd.config.id);\n task.$transparent = false;\n task.$open = dnd.config.initial_open_state;\n\n if (this.callEvent(\"onBeforeRowDragEnd\", [dnd.config.id, dnd.config.parent, dnd.config.index]) === false) {\n store.move(dnd.config.id, dnd.config.index, dnd.config.parent);\n task.$drop_target = null;\n } else {\n this.callEvent(\"onRowDragEnd\", [dnd.config.id, task.$drop_target]);\n }\n\n gantt.render();\n this.refreshData();\n }, gantt));\n}\n\nmodule.exports = {\n init: _init_dnd\n};","var utils = require(\"../../../utils/utils\");\n\nvar rowDnd = require(\"./tasks_grid_dnd\");\n\nvar rowDndMarker = require(\"./tasks_grid_dnd_marker\");\n\nvar initializer = function () {\n return function (gantt) {\n return {\n onCreated: function onCreated(grid) {\n grid.$config = utils.mixin(grid.$config, {\n bind: \"task\"\n });\n\n if (grid.$config.id == \"grid\") {\n this.extendGantt(grid);\n gantt.ext.inlineEditors = gantt.ext._inlineEditors.createEditors(grid);\n gantt.ext.inlineEditors.init();\n }\n\n this._mouseDelegates = require(\"../mouse_event_container\")(gantt);\n },\n onInitialized: function onInitialized(grid) {\n var config = grid.$getConfig();\n\n if (config.order_branch) {\n if (config.order_branch == \"marker\") {\n rowDndMarker.init(grid.$gantt, grid);\n } else {\n rowDnd.init(grid.$gantt, grid);\n }\n }\n\n this.initEvents(grid, gantt);\n\n if (grid.$config.id == \"grid\") {\n this.extendDom(grid);\n }\n },\n onDestroyed: function onDestroyed(grid) {\n if (grid.$config.id == \"grid\") {\n gantt.ext.inlineEditors.destructor();\n }\n\n this.clearEvents(grid, gantt);\n },\n initEvents: function initEvents(grid, gantt) {\n this._mouseDelegates.delegate(\"click\", \"gantt_row\", gantt.bind(function (e, id, trg) {\n var config = grid.$getConfig();\n\n if (id !== null) {\n var task = this.getTask(id);\n if (config.scroll_on_click && !gantt._is_icon_open_click(e)) this.showDate(task.start_date);\n gantt.callEvent(\"onTaskRowClick\", [id, trg]);\n }\n }, gantt), grid.$grid);\n\n this._mouseDelegates.delegate(\"click\", \"gantt_grid_head_cell\", gantt.bind(function (e, id, trg) {\n var column = trg.getAttribute(\"data-column-id\");\n if (!gantt.callEvent(\"onGridHeaderClick\", [column, e])) return;\n var config = grid.$getConfig();\n\n if (column == \"add\") {\n var mouseEvents = gantt.$services.getService(\"mouseEvents\");\n mouseEvents.callHandler(\"click\", \"gantt_add\", grid.$grid, [e, config.root_id]);\n return;\n }\n\n if (config.sort && column) {\n // GS-929: if there is no column name, we cannot sort the column\n var sorting_method = column,\n conf;\n\n for (var i = 0; i < config.columns.length; i++) {\n if (config.columns[i].name == column) {\n conf = config.columns[i];\n break;\n }\n }\n\n if (conf && conf.sort !== undefined && conf.sort !== true) {\n sorting_method = conf.sort;\n\n if (!sorting_method) {\n // column sort property 'false', no sorting\n return;\n }\n }\n\n var sort = this._sort && this._sort.direction && this._sort.name == column ? this._sort.direction : \"desc\"; // invert sort direction\n\n sort = sort == \"desc\" ? \"asc\" : \"desc\";\n this._sort = {\n name: column,\n direction: sort\n };\n this.sort(sorting_method, sort == \"desc\");\n }\n }, gantt), grid.$grid);\n\n this._mouseDelegates.delegate(\"click\", \"gantt_add\", gantt.bind(function (e, id, trg) {\n var config = grid.$getConfig();\n if (config.readonly) return;\n var item = {};\n this.createTask(item, id ? id : gantt.config.root_id);\n return false;\n }, gantt), grid.$grid);\n },\n clearEvents: function clearEvents(grid, gantt) {\n this._mouseDelegates.destructor();\n\n this._mouseDelegates = null;\n },\n extendDom: function extendDom(grid) {\n gantt.$grid = grid.$grid;\n gantt.$grid_scale = grid.$grid_scale;\n gantt.$grid_data = grid.$grid_data;\n },\n extendGantt: function extendGantt(grid) {\n gantt.getGridColumns = gantt.bind(grid.getGridColumns, grid);\n grid.attachEvent(\"onColumnResizeStart\", function () {\n return gantt.callEvent(\"onColumnResizeStart\", arguments);\n });\n grid.attachEvent(\"onColumnResize\", function () {\n return gantt.callEvent(\"onColumnResize\", arguments);\n });\n grid.attachEvent(\"onColumnResizeEnd\", function () {\n return gantt.callEvent(\"onColumnResizeEnd\", arguments);\n });\n grid.attachEvent(\"onColumnResizeComplete\", function (columns, totalWidth) {\n gantt.config.grid_width = totalWidth;\n });\n grid.attachEvent(\"onBeforeRowResize\", function () {\n return gantt.callEvent(\"onBeforeRowResize\", arguments);\n });\n grid.attachEvent(\"onRowResize\", function () {\n return gantt.callEvent(\"onRowResize\", arguments);\n });\n grid.attachEvent(\"onBeforeRowResizeEnd\", function () {\n return gantt.callEvent(\"onBeforeRowResizeEnd\", arguments);\n });\n grid.attachEvent(\"onAfterRowResize\", function () {\n return gantt.callEvent(\"onAfterRowResize\", arguments);\n });\n }\n };\n };\n}();\n\nmodule.exports = initializer;","var getRowRectangle = require(\"./viewport/get_grid_row_rectangle\");\n\nvar getVisibleRange = require(\"./viewport/get_visible_bars_range\");\n\nfunction createGridTaskRowResizerRender(gantt) {\n function _render_grid_item(item, view, viewport) {\n var config = view.$getConfig();\n var resize_el = document.createElement(\"div\");\n resize_el.className = \"gantt_task_grid_row_resize_wrap\";\n resize_el.style.top = view.getItemTop(item.id) + view.getItemHeight(item.id) + \"px\";\n resize_el.innerHTML = \"
\";\n resize_el.setAttribute(config.task_grid_row_resizer_attribute, item.id);\n\n gantt._waiAria.gridSeparatorAttr(resize_el);\n\n return resize_el;\n }\n\n return {\n render: _render_grid_item,\n update: null,\n getRectangle: getRowRectangle,\n getVisibleRange: getVisibleRange\n };\n}\n\nmodule.exports = createGridTaskRowResizerRender;","var getRectangle = require(\"./viewport/get_bg_row_rectangle\");\n\nvar getVisibleRange = require(\"./viewport/get_visible_bars_range\");\n\nvar getVisibleCellsRange = require(\"./viewport/get_visible_cells_range\");\n\nvar isColumnVisible = require(\"./viewport/is_column_visible\");\n\nvar resourceTimetable = require(\"../../resource_timetable_builder\");\n\nfunction renderBar(level, start, end, timeline) {\n var top = (1 - (level * 1 || 0)) * 100;\n var left = timeline.posFromDate(start);\n var right = timeline.posFromDate(end);\n var element = document.createElement(\"div\");\n element.className = \"gantt_histogram_hor_bar\";\n element.style.top = top + '%';\n element.style.left = left + \"px\";\n element.style.width = right - left + 1 + \"px\";\n return element;\n}\n\nfunction renderConnection(prevLevel, nextLevel, left) {\n if (prevLevel === nextLevel) {\n return null;\n }\n\n var top = 1 - Math.max(prevLevel, nextLevel);\n var height = Math.abs(prevLevel - nextLevel);\n var element = document.createElement(\"div\");\n element.className = \"gantt_histogram_vert_bar\";\n element.style.top = top * 100 + \"%\";\n element.style.height = height * 100 + \"%\";\n element.style.left = left + \"px\";\n return element;\n}\n\nfunction generateRenderResourceHistogram(gantt) {\n var getResourceLoad = resourceTimetable(gantt);\n var renderedHistogramCells = {};\n var renderedHistogramRows = {};\n var renderedHistogramCapacity = {};\n\n function detachRenderedHistogramCell(id, index) {\n var renderedRow = renderedHistogramCells[id];\n\n if (renderedRow && renderedRow[index] && renderedRow[index].parentNode) {\n renderedRow[index].parentNode.removeChild(renderedRow[index]);\n }\n }\n\n function renderHistogramLine(capacity, timeline, maxCapacity, viewport) {\n var scale = timeline.getScale();\n var el = document.createElement(\"div\");\n var range = getVisibleCellsRange(scale, viewport);\n\n for (var i = range.start; i <= range.end; i++) {\n var colStart = scale.trace_x[i];\n var colEnd = scale.trace_x[i + 1] || gantt.date.add(colStart, scale.step, scale.unit);\n var col = scale.trace_x[i].valueOf();\n var level = Math.min(capacity[col] / maxCapacity, 1) || 0; // do not render histogram for lines with below zero capacity, as it's reserved for folders\n\n if (level < 0) {\n return null;\n }\n\n var nextLevel = Math.min(capacity[colEnd.valueOf()] / maxCapacity, 1) || 0;\n var bar = renderBar(level, colStart, colEnd, timeline);\n\n if (bar) {\n el.appendChild(bar);\n }\n\n var connection = renderConnection(level, nextLevel, timeline.posFromDate(colEnd));\n\n if (connection) {\n el.appendChild(connection);\n }\n }\n\n return el;\n }\n\n function renderCapacityElement(resource, sizes, capacityMatrix, config, timeline, maxCapacity, viewport) {\n var renderedElement = renderedHistogramCapacity[resource.id];\n\n if (renderedElement && renderedElement.parentNode) {\n renderedElement.parentNode.removeChild(renderedElement);\n }\n\n var capacityElement = renderHistogramLine(capacityMatrix, timeline, maxCapacity, viewport);\n\n if (capacityElement && sizes) {\n capacityElement.setAttribute(\"data-resource-id\", resource.id);\n capacityElement.setAttribute(timeline.$config.item_attribute, resource.id);\n capacityElement.style.position = \"absolute\";\n capacityElement.style.top = sizes.top + 1 + \"px\";\n capacityElement.style.height = timeline.getItemHeight(resource.id) - 1 + \"px\";\n capacityElement.style.left = 0;\n }\n\n return capacityElement;\n }\n\n function renderHistogramCell(resource, sizes, maxCapacity, config, templates, day, timeline) {\n var css = templates.histogram_cell_class(day.start_date, day.end_date, resource, day.tasks, day.assignments);\n var content = templates.histogram_cell_label(day.start_date, day.end_date, resource, day.tasks, day.assignments);\n var fill = templates.histogram_cell_allocated(day.start_date, day.end_date, resource, day.tasks, day.assignments);\n var height = timeline.getItemHeight(resource.id) - 1;\n\n if (css || content) {\n var el = document.createElement('div');\n el.className = [\"gantt_histogram_cell\", css].join(\" \");\n el.setAttribute(timeline.$config.item_attribute, resource.id);\n el.style.cssText = ['left:' + sizes.left + 'px', 'width:' + sizes.width + 'px', 'height:' + height + 'px', 'line-height:' + height + 'px', 'top:' + (sizes.top + 1) + 'px'].join(\";\");\n\n if (content) {\n content = \"
\" + content + \"
\";\n }\n\n if (fill) {\n content = \"
\" + content;\n }\n\n if (content) {\n el.innerHTML = content;\n }\n\n return el;\n }\n\n return null;\n }\n\n function renderResourceHistogram(resource, timeline, config, viewport) {\n var templates = timeline.$getTemplates();\n var scale = timeline.getScale();\n var timetable = getResourceLoad(resource, config.resource_property, scale, timeline);\n var cells = [];\n var capacityMatrix = {};\n var maxCapacity = resource.capacity || timeline.$config.capacity || 24;\n renderedHistogramCells[resource.id] = {};\n renderedHistogramRows[resource.id] = null;\n renderedHistogramCapacity[resource.id] = null;\n var smartRendering = !!viewport; //no viewport means smart rendering is disabled\n\n var range = getVisibleCellsRange(scale, viewport);\n\n for (var columnIndex = range.start; columnIndex <= range.end; columnIndex++) {\n var day = timetable[columnIndex];\n\n if (!day) {\n continue;\n }\n\n if (smartRendering && !isColumnVisible(columnIndex, scale, viewport, gantt)) {\n continue;\n }\n\n var capacity = templates.histogram_cell_capacity(day.start_date, day.end_date, resource, day.tasks, day.assignments);\n capacityMatrix[day.start_date.valueOf()] = capacity || 0;\n var sizes = timeline.getItemPosition(resource, day.start_date, day.end_date);\n var el = renderHistogramCell(resource, sizes, maxCapacity, config, templates, day, timeline);\n\n if (el) {\n cells.push(el);\n renderedHistogramCells[resource.id][columnIndex] = el;\n }\n }\n\n var row = null;\n\n if (cells.length) {\n row = document.createElement(\"div\");\n\n for (var i = 0; i < cells.length; i++) {\n row.appendChild(cells[i]);\n }\n\n var capacityElement = renderCapacityElement(resource, sizes, capacityMatrix, config, timeline, maxCapacity, viewport);\n\n if (capacityElement) {\n row.appendChild(capacityElement);\n renderedHistogramCapacity[resource.id] = capacityElement;\n }\n\n renderedHistogramRows[resource.id] = row;\n }\n\n return row;\n }\n\n function updateResourceHistogram(resource, node, timeline, config, viewport) {\n var templates = timeline.$getTemplates();\n var scale = timeline.getScale();\n var timetable = getResourceLoad(resource, config.resource_property, scale, timeline);\n var maxCapacity = resource.capacity || timeline.$config.capacity || 24;\n var capacityMatrix = {};\n var smartRendering = !!viewport; //no viewport means smart rendering is disabled\n\n var range = getVisibleCellsRange(scale, viewport);\n var checkedColumns = {};\n\n if (renderedHistogramCells && renderedHistogramCells[resource.id]) {\n for (var i in renderedHistogramCells[resource.id]) {\n checkedColumns[i] = i;\n }\n }\n\n for (var columnIndex = range.start; columnIndex <= range.end; columnIndex++) {\n var day = timetable[columnIndex];\n checkedColumns[columnIndex] = false;\n\n if (!day) {\n continue;\n }\n\n var capacity = templates.histogram_cell_capacity(day.start_date, day.end_date, resource, day.tasks, day.assignments);\n capacityMatrix[day.start_date.valueOf()] = capacity || 0;\n var sizes = timeline.getItemPosition(resource, day.start_date, day.end_date);\n\n if (smartRendering && !isColumnVisible(columnIndex, scale, viewport, gantt)) {\n detachRenderedHistogramCell(resource.id, columnIndex);\n continue;\n }\n\n var renderedCell = renderedHistogramCells[resource.id];\n\n if (!renderedCell || !renderedCell[columnIndex]) {\n var el = renderHistogramCell(resource, sizes, maxCapacity, config, templates, day, timeline);\n\n if (el) {\n node.appendChild(el);\n renderedHistogramCells[resource.id][columnIndex] = el;\n }\n } else if (renderedCell && renderedCell[columnIndex] && !renderedCell[columnIndex].parentNode) {\n node.appendChild(renderedCell[columnIndex]);\n }\n }\n\n for (var i in checkedColumns) {\n if (checkedColumns[i] !== false) {\n detachRenderedHistogramCell(resource.id, i);\n }\n }\n\n var capacityElement = renderCapacityElement(resource, sizes, capacityMatrix, config, timeline, maxCapacity, viewport);\n\n if (capacityElement) {\n node.appendChild(capacityElement);\n renderedHistogramCapacity[resource.id] = capacityElement;\n }\n }\n\n return {\n render: renderResourceHistogram,\n update: updateResourceHistogram,\n getRectangle: getRectangle,\n getVisibleRange: getVisibleRange\n };\n}\n\nmodule.exports = generateRenderResourceHistogram;","var getRectangle = require(\"./viewport/get_bg_row_rectangle\");\n\nvar getVisibleRange = require(\"./viewport/get_visible_bars_range\");\n\nvar getVisibleCellsRange = require(\"./viewport/get_visible_cells_range\");\n\nvar isColumnVisible = require(\"./viewport/is_column_visible\");\n\nvar resourceTimetable = require(\"../../resource_timetable_builder\");\n\nfunction generateRenderResourceLine(gantt) {\n var getResourceLoad = resourceTimetable(gantt);\n var renderedResourceLines = {};\n\n function renderResourceLineCell(resource, day, templates, config, timeline) {\n var css = templates.resource_cell_class(day.start_date, day.end_date, resource, day.tasks, day.assignments);\n var content = templates.resource_cell_value(day.start_date, day.end_date, resource, day.tasks, day.assignments);\n var height = timeline.getItemHeight(resource.id) - 1;\n\n if (css || content) {\n var sizes = timeline.getItemPosition(resource, day.start_date, day.end_date);\n var el = document.createElement('div');\n el.setAttribute(timeline.$config.item_attribute, resource.id);\n el.className = [\"gantt_resource_marker\", css].join(\" \");\n el.style.cssText = ['left:' + sizes.left + 'px', 'width:' + sizes.width + 'px', 'height:' + height + 'px', 'line-height:' + height + 'px', 'top:' + sizes.top + 'px'].join(\";\");\n if (content) el.innerHTML = content;\n return el;\n }\n\n return null;\n }\n\n function detachRenderedResourceLine(id, index) {\n if (renderedResourceLines[id] && renderedResourceLines[id][index] && renderedResourceLines[id][index].parentNode) {\n renderedResourceLines[id][index].parentNode.removeChild(renderedResourceLines[id][index]);\n }\n }\n\n function renderResourceLine(resource, timeline, config, viewport) {\n var templates = timeline.$getTemplates();\n var scale = timeline.getScale();\n var timetable = getResourceLoad(resource, config.resource_property, timeline.getScale(), timeline);\n var smartRendering = !!viewport; //no viewport means smart rendering is disabled\n\n var cells = [];\n renderedResourceLines[resource.id] = {};\n var range = getVisibleCellsRange(scale, viewport);\n\n for (var columnIndex = range.start; columnIndex <= range.end; columnIndex++) {\n var day = timetable[columnIndex];\n\n if (!day) {\n continue;\n }\n\n if (smartRendering && !isColumnVisible(columnIndex, scale, viewport, gantt)) {\n continue;\n }\n\n var cell = renderResourceLineCell(resource, day, templates, config, timeline);\n\n if (cell) {\n cells.push(cell);\n renderedResourceLines[resource.id][columnIndex] = cell;\n }\n }\n\n var row = null;\n\n if (cells.length) {\n row = document.createElement(\"div\");\n\n for (var i = 0; i < cells.length; i++) {\n row.appendChild(cells[i]);\n }\n }\n\n return row;\n }\n\n function updateResourceLine(resource, node, timeline, config, viewport) {\n var templates = timeline.$getTemplates();\n var scale = timeline.getScale();\n var timetable = getResourceLoad(resource, config.resource_property, timeline.getScale(), timeline);\n var range = getVisibleCellsRange(scale, viewport);\n var checkedColumns = {};\n\n if (renderedResourceLines && renderedResourceLines[resource.id]) {\n for (var i in renderedResourceLines[resource.id]) {\n checkedColumns[i] = i;\n }\n }\n\n for (var columnIndex = range.start; columnIndex <= range.end; columnIndex++) {\n var day = timetable[columnIndex];\n checkedColumns[columnIndex] = false;\n\n if (!day) {\n continue;\n }\n\n if (!isColumnVisible(columnIndex, scale, viewport, gantt)) {\n detachRenderedResourceLine(resource.id, columnIndex);\n continue;\n }\n\n if (!renderedResourceLines[resource.id] || !renderedResourceLines[resource.id][columnIndex]) {\n var cell = renderResourceLineCell(resource, day, templates, config, timeline);\n\n if (cell) {\n node.appendChild(cell);\n renderedResourceLines[resource.id][columnIndex] = cell;\n }\n } else if (renderedResourceLines[resource.id] && renderedResourceLines[resource.id][columnIndex] && !renderedResourceLines[resource.id][columnIndex].parentNode) {\n node.appendChild(renderedResourceLines[resource.id][columnIndex]);\n }\n }\n\n for (var i in checkedColumns) {\n if (checkedColumns[i] !== false) {\n detachRenderedResourceLine(resource.id, i);\n }\n }\n }\n\n return {\n render: renderResourceLine,\n update: updateResourceLine,\n getRectangle: getRectangle,\n getVisibleRange: getVisibleRange\n };\n}\n\nmodule.exports = generateRenderResourceLine;","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar helpers = require(\"../../../utils/helpers\");\n\nvar getRowRectangle = require(\"./viewport/get_grid_row_rectangle\");\n\nvar getVisibleRange = require(\"./viewport/get_visible_bars_range\");\n\nfunction createGridLineRender(gantt) {\n function _render_grid_item(item, view, config, viewport) {\n var columns = view.getGridColumns();\n var templates = view.$getTemplates();\n var store = view.$config.rowStore;\n var cells = [];\n var has_child;\n\n for (var i = 0; i < columns.length; i++) {\n var last = i == columns.length - 1;\n var col = columns[i];\n var cell;\n var value;\n var textValue;\n\n if (col.name == \"add\") {\n var aria = gantt._waiAria.gridAddButtonAttrString(col);\n\n value = \"
\";\n textValue = \"\";\n } else {\n if (col.template) value = col.template(item);else value = item[col.name];\n\n if (helpers.isDate(value)) {\n value = templates.date_grid(value, item, col.name);\n }\n\n if (value === null || value === undefined) {\n value = \"\";\n }\n\n textValue = value;\n value = \"
\" + value + \"
\";\n }\n\n var css = \"gantt_cell\" + (last ? \" gantt_last_cell\" : \"\");\n var tree = [];\n\n if (col.tree) {\n css += \" gantt_cell_tree\";\n\n for (var j = 0; j < item.$level; j++) {\n tree.push(templates.grid_indent(item));\n }\n\n has_child = store.hasChild(item.id) && !(gantt.isSplitTask(item) && !gantt.config.open_split_tasks);\n\n if (has_child) {\n tree.push(templates.grid_open(item));\n tree.push(templates.grid_folder(item));\n } else {\n tree.push(templates.grid_blank(item));\n tree.push(templates.grid_file(item));\n }\n }\n\n var style = \"width:\" + (col.width - (last ? 1 : 0)) + \"px;\";\n\n if (this.defined(col.align)) {\n var flexAlign = {\n right: \"flex-end\",\n left: \"flex-start\",\n center: \"center\"\n };\n var justifyContent = flexAlign[col.align];\n style += \"text-align:\" + col.align + \";justify-content:\" + justifyContent + \";\";\n }\n\n var aria = gantt._waiAria.gridCellAttrString(col, textValue, item);\n\n tree.push(value);\n cell = \"
\" + tree.join(\"\") + \"
\";\n cells.push(cell);\n } // GS-291. The odd class should be assigned correctly\n\n\n css = \"\";\n var storeName = store.$config.name;\n\n switch (storeName) {\n case \"task\":\n css = gantt.getGlobalTaskIndex(item.id) % 2 === 0 ? \"\" : \" odd\";\n break;\n\n case \"resource\":\n css = store.visibleOrder.indexOf(item.id) % 2 === 0 ? \"\" : \" odd\";\n break;\n }\n\n css += item.$transparent ? \" gantt_transparent\" : \"\";\n css += item.$dataprocessor_class ? \" \" + item.$dataprocessor_class : \"\";\n\n if (templates.grid_row_class) {\n var css_template = templates.grid_row_class.call(gantt, item.start_date, item.end_date, item);\n if (css_template) css += \" \" + css_template;\n }\n\n if (store.isSelected(item.id)) {\n css += \" gantt_selected\";\n }\n\n var el = document.createElement(\"div\");\n el.className = \"gantt_row\" + css + \" gantt_row_\" + gantt.getTaskType(item.type);\n var height = view.getItemHeight(item.id);\n el.style.height = height + \"px\";\n el.style.lineHeight = height + \"px\";\n\n if (config.smart_rendering) {\n el.style.position = \"absolute\";\n el.style.left = \"0px\";\n el.style.top = view.getItemTop(item.id) + \"px\";\n }\n\n if (view.$config.item_attribute) {\n el.setAttribute(view.$config.item_attribute, item.id);\n el.setAttribute(view.$config.bind + \"_id\", item.id); // 'task_id'/'resource_id' for backward compatibility\n }\n\n gantt._waiAria.taskRowAttr(item, el);\n\n el.innerHTML = cells.join(\"\");\n return el;\n }\n\n function onrender(item, rowNode, view) {\n var columns = view.getGridColumns();\n\n for (var i = 0; i < columns.length; i++) {\n var column = columns[i];\n\n if (column.onrender) {\n // find cell node for current column\n var cellNode = rowNode.querySelector(\"[data-column-name=\" + column.name + \"]\");\n\n if (cellNode) {\n var content = column.onrender(item, cellNode);\n\n if (content && typeof content === \"string\") {\n cellNode.innerHTML = content;\n } else if (content && _typeof(content) === \"object\") {\n // render object to node using additional functionality\n if (gantt.config.external_render) {\n var adapter = gantt.config.external_render;\n\n if (adapter.isElement(content)) {\n adapter.renderElement(content, cellNode);\n }\n }\n }\n }\n }\n }\n }\n\n return {\n render: _render_grid_item,\n update: null,\n getRectangle: getRowRectangle,\n getVisibleRange: getVisibleRange,\n onrender: onrender\n };\n}\n\nmodule.exports = createGridLineRender;","var isInViewPort = require(\"./viewport/is_link_in_viewport\");\n\nvar getVisibleRange = require(\"./viewport/get_visible_link_range\");\n\nfunction createLinkRender(gantt) {\n function _render_link_element(link, view, config) {\n var source = gantt.getTask(link.source);\n\n if (source.hide_bar) {\n return;\n }\n\n var target = gantt.getTask(link.target);\n\n if (target.hide_bar) {\n return;\n }\n\n var pt = path_builder.get_endpoint(link, view, source, target);\n var dy = pt.e_y - pt.y;\n var dx = pt.e_x - pt.x;\n\n if (!dx && !dy) {\n return null;\n }\n\n var dots = path_builder.get_points(link, view, source, target);\n var lines = drawer.get_lines(dots, view);\n var div = document.createElement(\"div\");\n var css = \"gantt_task_link\";\n\n if (link.color) {\n css += \" gantt_link_inline_color\";\n }\n\n var cssTemplate = gantt.templates.link_class ? gantt.templates.link_class(link) : \"\";\n\n if (cssTemplate) {\n css += \" \" + cssTemplate;\n }\n\n if (config.highlight_critical_path && gantt.isCriticalLink) {\n if (gantt.isCriticalLink(link)) css += \" gantt_critical_link\";\n }\n\n div.className = css;\n\n if (view.$config.link_attribute) {\n div.setAttribute(view.$config.link_attribute, link.id);\n div.setAttribute(\"link_id\", link.id);\n }\n\n for (var i = 0; i < lines.length; i++) {\n if (i == lines.length - 1) {\n lines[i].size -= config.link_arrow_size;\n }\n\n var el = drawer.render_line(lines[i], lines[i + 1], view, link.source);\n\n if (link.color) {\n el.firstChild.style.backgroundColor = link.color;\n }\n\n div.appendChild(el);\n }\n\n var direction = lines[lines.length - 1].direction;\n\n var endpoint = _render_link_arrow(dots[dots.length - 1], direction, view, link.source);\n\n if (link.color) {\n endpoint.style.borderColor = link.color;\n }\n\n div.appendChild(endpoint);\n\n gantt._waiAria.linkAttr(link, div);\n\n return div;\n }\n\n function _render_link_arrow(point, direction, view, targetId) {\n var config = view.$getConfig();\n var div = document.createElement(\"div\");\n var top = point.y;\n var left = point.x;\n var size = config.link_arrow_size;\n var className = \"gantt_link_arrow gantt_link_arrow_\" + direction;\n\n switch (direction) {\n case drawer.dirs.right:\n top -= size / 2;\n left -= size;\n break;\n\n case drawer.dirs.left:\n top -= size / 2;\n break;\n\n case drawer.dirs.up:\n left -= size;\n break;\n\n case drawer.dirs.down:\n top += size * 2;\n left -= size;\n break;\n\n default:\n break;\n }\n\n div.style.cssText = [\"top:\" + top + \"px\", \"left:\" + left + 'px'].join(';');\n div.className = className;\n return div;\n }\n\n var drawer = {\n current_pos: null,\n dirs: {\n \"left\": 'left',\n \"right\": 'right',\n \"up\": 'up',\n \"down\": 'down'\n },\n path: [],\n clear: function clear() {\n this.current_pos = null;\n this.path = [];\n },\n point: function point(pos) {\n this.current_pos = gantt.copy(pos);\n },\n get_lines: function get_lines(dots) {\n this.clear();\n this.point(dots[0]);\n\n for (var i = 1; i < dots.length; i++) {\n this.line_to(dots[i]);\n }\n\n return this.get_path();\n },\n line_to: function line_to(pos) {\n var next = gantt.copy(pos);\n var prev = this.current_pos;\n\n var line = this._get_line(prev, next);\n\n this.path.push(line);\n this.current_pos = next;\n },\n get_path: function get_path() {\n return this.path;\n },\n get_wrapper_sizes: function get_wrapper_sizes(v, view, itemId) {\n var config = view.$getConfig();\n var res,\n wrapper_size = config.link_wrapper_width,\n y = v.y - wrapper_size / 2;\n\n switch (v.direction) {\n case this.dirs.left:\n res = {\n top: y,\n height: wrapper_size,\n lineHeight: wrapper_size,\n left: v.x - v.size - wrapper_size / 2,\n width: v.size + wrapper_size\n };\n break;\n\n case this.dirs.right:\n res = {\n top: y,\n lineHeight: wrapper_size,\n height: wrapper_size,\n left: v.x - wrapper_size / 2,\n width: v.size + wrapper_size\n };\n break;\n\n case this.dirs.up:\n res = {\n top: y - v.size,\n lineHeight: v.size + wrapper_size,\n height: v.size + wrapper_size,\n left: v.x - wrapper_size / 2,\n width: wrapper_size\n };\n break;\n\n case this.dirs.down:\n res = {\n top: y\n /*- wrapper_size/2*/\n ,\n lineHeight: v.size + wrapper_size,\n height: v.size + wrapper_size,\n left: v.x - wrapper_size / 2,\n width: wrapper_size\n };\n break;\n\n default:\n break;\n }\n\n return res;\n },\n get_line_sizes: function get_line_sizes(v, view) {\n var config = view.$getConfig();\n var res,\n line_size = config.link_line_width,\n wrapper_size = config.link_wrapper_width,\n size = v.size + line_size;\n\n switch (v.direction) {\n case this.dirs.left:\n case this.dirs.right:\n res = {\n height: line_size,\n width: size,\n marginTop: (wrapper_size - line_size) / 2,\n marginLeft: (wrapper_size - line_size) / 2\n };\n break;\n\n case this.dirs.up:\n case this.dirs.down:\n res = {\n height: size,\n width: line_size,\n marginTop: (wrapper_size - line_size) / 2,\n marginLeft: (wrapper_size - line_size) / 2\n };\n break;\n\n default:\n break;\n }\n\n return res;\n },\n render_line: function render_line(v, end, view, itemId) {\n var pos = this.get_wrapper_sizes(v, view, itemId);\n var wrapper = document.createElement(\"div\");\n wrapper.style.cssText = [\"top:\" + pos.top + \"px\", \"left:\" + pos.left + \"px\", \"height:\" + pos.height + \"px\", \"width:\" + pos.width + \"px\"].join(';');\n wrapper.className = \"gantt_line_wrapper\";\n var innerPos = this.get_line_sizes(v, view);\n var inner = document.createElement(\"div\");\n inner.style.cssText = [\"height:\" + innerPos.height + \"px\", \"width:\" + innerPos.width + \"px\", \"margin-top:\" + innerPos.marginTop + \"px\", \"margin-left:\" + innerPos.marginLeft + \"px\"].join(\";\");\n inner.className = \"gantt_link_line_\" + v.direction;\n wrapper.appendChild(inner);\n return wrapper;\n },\n _get_line: function _get_line(from, to) {\n var direction = this.get_direction(from, to);\n var vect = {\n x: from.x,\n y: from.y,\n direction: this.get_direction(from, to)\n };\n\n if (direction == this.dirs.left || direction == this.dirs.right) {\n vect.size = Math.abs(from.x - to.x);\n } else {\n vect.size = Math.abs(from.y - to.y);\n }\n\n return vect;\n },\n get_direction: function get_direction(from, to) {\n var direction = 0;\n\n if (to.x < from.x) {\n direction = this.dirs.left;\n } else if (to.x > from.x) {\n direction = this.dirs.right;\n } else if (to.y > from.y) {\n direction = this.dirs.down;\n } else {\n direction = this.dirs.up;\n }\n\n return direction;\n }\n };\n var path_builder = {\n path: [],\n clear: function clear() {\n this.path = [];\n },\n current: function current() {\n return this.path[this.path.length - 1];\n },\n point: function point(next) {\n if (!next) return this.current();\n this.path.push(gantt.copy(next));\n return next;\n },\n point_to: function point_to(direction, diff, point) {\n if (!point) point = gantt.copy(this.point());else point = {\n x: point.x,\n y: point.y\n };\n var dir = drawer.dirs;\n\n switch (direction) {\n case dir.left:\n point.x -= diff;\n break;\n\n case dir.right:\n point.x += diff;\n break;\n\n case dir.up:\n point.y -= diff;\n break;\n\n case dir.down:\n point.y += diff;\n break;\n\n default:\n break;\n }\n\n return this.point(point);\n },\n get_points: function get_points(link, view, source, target) {\n var pt = this.get_endpoint(link, view, source, target);\n var xy = gantt.config;\n var dy = pt.e_y - pt.y;\n var dx = pt.e_x - pt.x;\n var dir = drawer.dirs;\n var rowHeight = view.getItemHeight(link.source);\n this.clear();\n this.point({\n x: pt.x,\n y: pt.y\n });\n var shiftX = 2 * xy.link_arrow_size; //just random size for first line\n\n var lineType = this.get_line_type(link, view.$getConfig());\n var forward = pt.e_x > pt.x;\n\n if (lineType.from_start && lineType.to_start) {\n this.point_to(dir.left, shiftX);\n\n if (forward) {\n this.point_to(dir.down, dy);\n this.point_to(dir.right, dx);\n } else {\n this.point_to(dir.right, dx);\n this.point_to(dir.down, dy);\n }\n\n this.point_to(dir.right, shiftX);\n } else if (!lineType.from_start && lineType.to_start) {\n forward = pt.e_x > pt.x + 2 * shiftX;\n this.point_to(dir.right, shiftX);\n\n if (forward) {\n dx -= shiftX;\n this.point_to(dir.down, dy);\n this.point_to(dir.right, dx);\n } else {\n dx -= 2 * shiftX;\n var sign = dy > 0 ? 1 : -1;\n this.point_to(dir.down, sign * (rowHeight / 2));\n this.point_to(dir.right, dx);\n this.point_to(dir.down, sign * (Math.abs(dy) - rowHeight / 2));\n this.point_to(dir.right, shiftX);\n }\n } else if (!lineType.from_start && !lineType.to_start) {\n this.point_to(dir.right, shiftX);\n\n if (forward) {\n this.point_to(dir.right, dx);\n this.point_to(dir.down, dy);\n } else {\n this.point_to(dir.down, dy);\n this.point_to(dir.right, dx);\n }\n\n this.point_to(dir.left, shiftX);\n } else if (lineType.from_start && !lineType.to_start) {\n forward = pt.e_x > pt.x - 2 * shiftX;\n this.point_to(dir.left, shiftX);\n\n if (!forward) {\n dx += shiftX;\n this.point_to(dir.down, dy);\n this.point_to(dir.right, dx);\n } else {\n dx += 2 * shiftX;\n var sign = dy > 0 ? 1 : -1;\n this.point_to(dir.down, sign * (rowHeight / 2));\n this.point_to(dir.right, dx);\n this.point_to(dir.down, sign * (Math.abs(dy) - rowHeight / 2));\n this.point_to(dir.left, shiftX);\n }\n }\n\n return this.path;\n },\n get_line_type: function get_line_type(link, config) {\n var types = config.links;\n var from_start = false,\n to_start = false;\n\n if (link.type == types.start_to_start) {\n from_start = to_start = true;\n } else if (link.type == types.finish_to_finish) {\n from_start = to_start = false;\n } else if (link.type == types.finish_to_start) {\n from_start = false;\n to_start = true;\n } else if (link.type == types.start_to_finish) {\n from_start = true;\n to_start = false;\n } else {\n gantt.assert(false, \"Invalid link type\");\n }\n\n if (config.rtl) {\n from_start = !from_start;\n to_start = !to_start;\n }\n\n return {\n from_start: from_start,\n to_start: to_start\n };\n },\n get_endpoint: function get_endpoint(link, view, source, target) {\n var config = view.$getConfig();\n var lineType = this.get_line_type(link, config);\n var from_start = lineType.from_start,\n to_start = lineType.to_start;\n var from = getMilestonePosition(source, view, config),\n to = getMilestonePosition(target, view, config);\n return {\n x: from_start ? from.left : from.left + from.width,\n e_x: to_start ? to.left : to.left + to.width,\n y: from.top + from.rowHeight / 2 - 1,\n e_y: to.top + to.rowHeight / 2 - 1\n };\n }\n };\n\n function getMilestonePosition(task, view, config) {\n var pos = view.getItemPosition(task);\n\n if (gantt.getTaskType(task.type) == config.types.milestone) {\n var milestoneHeight = view.getBarHeight(task.id, true);\n var milestoneWidth = Math.sqrt(2 * milestoneHeight * milestoneHeight);\n pos.left -= milestoneWidth / 2;\n pos.width = milestoneWidth;\n }\n\n return pos;\n }\n\n return {\n render: _render_link_element,\n update: null,\n //getRectangle: getLinkRectangle\n isInViewPort: isInViewPort,\n getVisibleRange: getVisibleRange()\n };\n}\n\nmodule.exports = createLinkRender;","module.exports = function (items, gantt) {\n var placeholderConfig = gantt.config.timeline_placeholder;\n items = items || [];\n\n if (placeholderConfig && items.filter(function (e) {\n return e.id === 'timeline_placeholder_task';\n }).length === 0) {\n var state = gantt.getState();\n var lastTaskId = null;\n var start_date = state.min_date;\n var end_date = state.max_date;\n\n if (items.length) {\n lastTaskId = items[items.length - 1].id;\n }\n\n var placeholderTask = {\n start_date: start_date,\n end_date: end_date,\n row_height: placeholderConfig.height || 0,\n id: \"timeline_placeholder_task\",\n unscheduled: true,\n lastTaskId: lastTaskId,\n calendar_id: placeholderConfig.calendar || \"global\",\n $source: [],\n $target: []\n };\n items.push(placeholderTask);\n }\n};","var getRowRectangle = require(\"./viewport/get_bg_row_rectangle\");\n\nvar isLegacyRender = require(\"./is_legacy_smart_render\");\n\nvar getVisibleRange = require(\"./viewport/get_visible_bars_range\");\n\nvar getVisibleCellsRange = require(\"./viewport/get_visible_cells_range\");\n\nvar isColumnVisible = require(\"./viewport/is_column_visible\");\n\nvar bgPlaceholder = require(\"./prerender/task_bg_placeholder\");\n\nfunction createTaskBgRender(gantt) {\n var renderedCells = {};\n var visibleCells = {};\n\n function isRendered(item, columnIndex) {\n if (renderedCells[item.id][columnIndex] && renderedCells[item.id][columnIndex].parentNode) {\n return true;\n } else {\n return false;\n }\n }\n\n function detachRenderedCell(itemId, columnIndex) {\n if (renderedCells[itemId] && renderedCells[itemId][columnIndex] && renderedCells[itemId][columnIndex].parentNode) {\n renderedCells[itemId][columnIndex].parentNode.removeChild(renderedCells[itemId][columnIndex]);\n }\n }\n\n function getCellClassTemplate(view) {\n var templates = view.$getTemplates();\n var cssTemplate;\n\n if (typeof templates.task_cell_class !== \"undefined\") {\n cssTemplate = templates.task_cell_class; // eslint-disable-next-line no-console\n\n var log = console.warn || console.log;\n log('gantt.templates.task_cell_class template is deprecated and will be removed soon. Please use gantt.templates.timeline_cell_class instead.');\n } else {\n cssTemplate = templates.timeline_cell_class;\n }\n\n return cssTemplate;\n }\n\n function getCellContentTemplate(view) {\n var templates = view.$getTemplates();\n var contentTemplate = templates.timeline_cell_content;\n return contentTemplate;\n }\n\n function renderCells(item, node, view, config, viewPort) {\n var cfg = view.getScale();\n var count = cfg.count;\n var cssTemplate = getCellClassTemplate(view);\n var contentTemplate = getCellContentTemplate(view);\n\n if (config.show_task_cells) {\n if (!renderedCells[item.id]) {\n renderedCells[item.id] = {};\n }\n\n if (!visibleCells[item.id]) {\n visibleCells[item.id] = {};\n }\n\n var range = getVisibleCellsRange(cfg, viewPort);\n\n for (var i in visibleCells[item.id]) {\n var index = visibleCells[item.id][i];\n\n if (Number(index) < range.start || Number(index) > range.end) {\n detachRenderedCell(item.id, index);\n }\n }\n\n visibleCells[item.id] = {}; // TODO: do not iterate all cell, only ones in the viewport and once that are already rendered\n\n for (var columnIndex = range.start; columnIndex <= range.end; columnIndex++) {\n var cell = renderOneCell(cfg, columnIndex, item, viewPort, count, cssTemplate, contentTemplate, config);\n\n if (!cell && isRendered(item, columnIndex)) {\n detachRenderedCell(item.id, columnIndex);\n } else if (cell && !cell.parentNode) {\n node.appendChild(cell);\n }\n }\n }\n }\n\n function renderOneCell(scale, columnIndex, item, viewPort, count, cssTemplate, contentTemplate, config) {\n var width = scale.width[columnIndex],\n cssclass = \"\";\n\n if (isColumnVisible(columnIndex, scale, viewPort, gantt)) {\n //do not render skipped columns\n var cssTemplateContent = cssTemplate(item, scale.trace_x[columnIndex]);\n var htmlTemplateContent = \"\";\n\n if (contentTemplate) {\n // for backward compatibility, contentTemplate was added in 7.2.0+, will be undefined if someone used copy of old config/template object\n htmlTemplateContent = contentTemplate(item, scale.trace_x[columnIndex]);\n }\n\n if (config.static_background) {\n // if cell render in static background is not allowed, or if it's a blank cell\n var customCell = !!(cssTemplateContent || htmlTemplateContent);\n\n if (!(config.static_background_cells && customCell)) {\n return null;\n }\n }\n\n if (renderedCells[item.id][columnIndex]) {\n visibleCells[item.id][columnIndex] = columnIndex;\n return renderedCells[item.id][columnIndex];\n }\n\n var cell = document.createElement(\"div\");\n cell.style.width = width + \"px\";\n cssclass = \"gantt_task_cell\" + (columnIndex == count - 1 ? \" gantt_last_cell\" : \"\");\n\n if (cssTemplateContent) {\n cssclass += \" \" + cssTemplateContent;\n }\n\n cell.className = cssclass;\n\n if (htmlTemplateContent) {\n cell.innerHTML = htmlTemplateContent;\n }\n\n cell.style.position = \"absolute\";\n cell.style.left = scale.left[columnIndex] + \"px\";\n renderedCells[item.id][columnIndex] = cell;\n visibleCells[item.id][columnIndex] = columnIndex;\n return cell;\n }\n\n return null;\n }\n\n function _render_bg_line(item, view, config, viewPort) {\n var templates = view.$getTemplates();\n var cfg = view.getScale();\n var count = cfg.count;\n\n if (config.static_background && !config.static_background_cells) {\n return null;\n }\n\n var row = document.createElement(\"div\");\n var cellCssTemplate = getCellClassTemplate(view);\n var cellHtmlTemplate = getCellContentTemplate(view);\n var range;\n\n if (!viewPort || !config.smart_rendering || isLegacyRender(gantt)) {\n range = {\n start: 0,\n end: count - 1\n };\n } else {\n range = getVisibleCellsRange(cfg, viewPort.x);\n }\n\n if (config.show_task_cells) {\n renderedCells[item.id] = {};\n visibleCells[item.id] = {};\n\n for (var columnIndex = range.start; columnIndex <= range.end; columnIndex++) {\n var cell = renderOneCell(cfg, columnIndex, item, viewPort, count, cellCssTemplate, cellHtmlTemplate, config);\n\n if (cell) {\n row.appendChild(cell);\n }\n }\n } // GS-291. The odd class should be assigned correctly\n\n\n var store = view.$config.rowStore;\n var odd = store.getIndexById(item.id) % 2 !== 0;\n var cssTemplate = templates.task_row_class(item.start_date, item.end_date, item);\n var css = \"gantt_task_row\" + (odd ? \" odd\" : \"\") + (cssTemplate ? ' ' + cssTemplate : '');\n\n if (store.isSelected(item.id)) {\n css += \" gantt_selected\";\n }\n\n row.className = css;\n\n if (config.smart_rendering) {\n row.style.position = \"absolute\";\n row.style.top = view.getItemTop(item.id) + \"px\";\n row.style.width = \"100%\";\n } else {\n row.style.position = \"relative\";\n }\n\n row.style.height = view.getItemHeight(item.id) + \"px\";\n\n if (item.id == \"timeline_placeholder_task\") {\n var placeholderTop = 0;\n\n if (item.lastTaskId) {\n var lastTaskTop = view.getItemTop(item.lastTaskId);\n var lastTaskHeight = view.getItemHeight(item.lastTaskId);\n placeholderTop = lastTaskTop + lastTaskHeight;\n }\n\n var maxHeight = item.row_height || view.$task_data.offsetHeight;\n var placeholderHeight = maxHeight - placeholderTop; // So that it won't exceed the placeholder timeline height\n\n if (placeholderHeight < 0) {\n placeholderHeight = 0;\n }\n\n if (config.smart_rendering) {\n row.style.top = placeholderTop + \"px\";\n }\n\n row.style.height = placeholderHeight + \"px\";\n }\n\n if (view.$config.item_attribute) {\n row.setAttribute(view.$config.item_attribute, item.id);\n row.setAttribute(view.$config.bind + \"_id\", item.id); // 'task_id'/'resource_id' for backward compatibility\n }\n\n return row;\n }\n\n return {\n render: _render_bg_line,\n update: renderCells,\n getRectangle: getRowRectangle,\n getVisibleRange: getVisibleRange,\n prepareData: bgPlaceholder\n };\n}\n\nmodule.exports = createTaskBgRender;","var createBaseBarRender = require(\"./task_bar_render\");\n\nvar isInViewPort = require(\"./viewport/is_bar_in_viewport\");\n\nvar getVisibleRange = require(\"./viewport/get_visible_bars_range\");\n\nfunction createTaskRenderer(gantt) {\n var defaultRender = createBaseBarRender(gantt);\n\n function renderSplitTask(task, timeline) {\n if (task.rollup !== false && task.$rollup && task.$rollup.length) {\n var el = document.createElement('div'),\n sizes = gantt.getTaskPosition(task);\n task.$rollup.forEach(function (itemId) {\n var child = gantt.copy(gantt.getTask(itemId));\n child.$rendered_at = task.id;\n var displayRollup = gantt.callEvent(\"onBeforeRollupTaskDisplay\", [child.id, child, task.id]);\n\n if (displayRollup === false) {\n return;\n }\n\n var element = defaultRender(child, timeline);\n if (!element) return;\n var height = timeline.getBarHeight(task.id, child.type == gantt.config.types.milestone);\n var padding = Math.floor((timeline.getItemHeight(task.id) - height) / 2);\n element.style.top = sizes.top + padding + \"px\";\n element.classList.add(\"gantt_rollup_child\");\n element.setAttribute(\"data-rollup-parent-id\", task.id);\n el.appendChild(element);\n });\n return el;\n }\n\n return false;\n }\n\n return {\n render: renderSplitTask,\n update: null,\n //getRectangle: getBarRectangle\n isInViewPort: isInViewPort,\n getVisibleRange: getVisibleRange\n };\n}\n\nmodule.exports = createTaskRenderer;","var isBarInViewport = require(\"./is_bar_in_viewport\");\n\nmodule.exports = function isSplitTaskInViewport(item, viewport, view, config, gantt) {\n if (!gantt.isSplitTask(item)) {\n return false;\n }\n\n var range = gantt.getSubtaskDates(item.id);\n return isBarInViewport({\n id: item.id,\n start_date: range.start_date,\n end_date: range.end_date,\n parent: item.parent\n }, viewport, view, gantt);\n};","var createBaseBarRender = require(\"./task_bar_render\"); //const isInViewPort = require(\"./viewport/is_split_task_in_viewport\");\n\n\nvar getVisibleRange = require(\"./viewport/get_visible_bars_range\");\n\nvar isInViewPortParent = require(\"./viewport/is_split_task_in_viewport\");\n\nvar isInViewPortChild = require(\"./viewport/is_bar_in_viewport\");\n\nfunction createTaskRenderer(gantt) {\n var defaultRender = createBaseBarRender(gantt);\n var renderedNodes = {};\n\n function checkVisibility(child, viewPort, timeline, config, gantt) {\n var isVisible = !child.hide_bar; // GS-1195. Don't render split tasks that are outside the viewport\n\n if (config.smart_rendering && isVisible) {\n isVisible = isInViewPortChild(child, viewPort, timeline, config, gantt);\n }\n\n return isVisible;\n }\n\n function generateChildElement(task, child, timeline, sizes) {\n var isProject = gantt.isSummaryTask(child);\n\n if (isProject) {\n gantt.resetProjectDates(child);\n }\n\n var element = defaultRender(child, timeline);\n if (!element) return;\n var height = timeline.getBarHeight(task.id, child.type == gantt.config.types.milestone);\n var padding = Math.floor((timeline.getItemHeight(task.id) - height) / 2);\n element.style.top = sizes.top + padding + \"px\";\n element.classList.add(\"gantt_split_child\");\n\n if (isProject) {\n element.classList.add(\"gantt_split_subproject\");\n }\n\n return element;\n }\n\n function renderSplitTask(task, timeline, config, viewPort) {\n if (gantt.isSplitTask(task) && (gantt.config.open_split_tasks && !task.$open || !gantt.config.open_split_tasks)) {\n var el = document.createElement('div'),\n sizes = gantt.getTaskPosition(task);\n\n if (gantt.hasChild(task.id)) {\n gantt.eachTask(function (realChild) {\n var isVisible = checkVisibility(realChild, viewPort, timeline, config, gantt);\n\n if (!isVisible) {\n return;\n }\n\n if (realChild.hide_bar) {\n return;\n }\n\n var childCopy = gantt.copy(gantt.getTask(realChild.id));\n childCopy.$rendered_at = task.id; // a way to filter split tasks:\n\n var showSplitTask = gantt.callEvent(\"onBeforeSplitTaskDisplay\", [childCopy.id, childCopy, task.id]);\n\n if (showSplitTask === false) {\n return;\n }\n\n var element = generateChildElement(task, realChild, timeline, sizes);\n renderedNodes[realChild.id] = element;\n el.appendChild(element);\n }, task.id);\n }\n\n return el;\n }\n\n return false;\n }\n\n function repaintSplitTask(task, itemNode, timeline, config, viewPort) {\n if (gantt.hasChild(task.id)) {\n var el = document.createElement(\"div\"),\n sizes = gantt.getTaskPosition(task);\n gantt.eachTask(function (child) {\n var isVisible = checkVisibility(child, viewPort, timeline, config, gantt);\n\n if (isVisible !== !!renderedNodes[child.id]) {\n if (isVisible) {\n var element = generateChildElement(task, child, timeline, sizes);\n renderedNodes[child.id] = element;\n } else {\n renderedNodes[child.id] = false;\n }\n }\n\n if (!!renderedNodes[child.id]) {\n el.appendChild(renderedNodes[child.id]);\n }\n\n itemNode.innerHTML = el.innerHTML;\n }, task.id);\n }\n }\n\n return {\n render: renderSplitTask,\n update: repaintSplitTask,\n isInViewPort: isInViewPortParent,\n getVisibleRange: getVisibleRange\n };\n}\n\nmodule.exports = createTaskRenderer;","var isInViewPort = require(\"./viewport/is_bar_in_viewport\");\n\nvar getVisibleRange = require(\"./viewport/get_visible_bars_range\");\n\nvar createBaseBarRender = require(\"./task_bar_render\");\n\nmodule.exports = function createTaskRenderer(gantt) {\n var defaultRender = createBaseBarRender(gantt);\n return {\n render: defaultRender,\n update: null,\n //getRectangle: getBarRectangle\n isInViewPort: isInViewPort,\n getVisibleRange: getVisibleRange\n };\n};","module.exports = function (gantt) {\n return function processTaskDateProperties(item, mapTo, mode) {\n if (mode == \"keepDates\") {\n keepDatesOnEdit(item, mapTo);\n } else if (mode == \"keepDuration\") {\n keepDurationOnEdit(item, mapTo);\n } else {\n defaultActionOnEdit(item, mapTo);\n }\n }; // resize task\n // resize task when start/end/duration changes\n\n function keepDatesOnEdit(item, mapTo) {\n if (mapTo == \"duration\") {\n item.end_date = gantt.calculateEndDate(item);\n } else if (mapTo == \"end_date\" || mapTo == \"start_date\") {\n item.duration = gantt.calculateDuration(item);\n }\n } // move task(before 6.2)\n // move task when start/end dates changes\n // resize task when duration changes\n\n\n function keepDurationOnEdit(item, mapTo) {\n if (mapTo == \"end_date\") {\n item.start_date = decreaseStartDate(item);\n } else if (mapTo == \"start_date\" || mapTo == \"duration\") {\n item.end_date = gantt.calculateEndDate(item);\n }\n } // default behavior\n // move task when start date changes\n // resize task when end date/duration changes\n\n\n function defaultActionOnEdit(item, mapTo) {\n if (gantt.config.schedule_from_end) {\n if (mapTo == \"end_date\" || mapTo == \"duration\") {\n item.start_date = decreaseStartDate(item);\n } else if (mapTo == \"start_date\") {\n item.duration = gantt.calculateDuration(item);\n }\n } else {\n if (mapTo == \"start_date\" || mapTo == \"duration\") {\n item.end_date = gantt.calculateEndDate(item);\n } else if (mapTo == \"end_date\") {\n item.duration = gantt.calculateDuration(item);\n }\n }\n }\n\n function decreaseStartDate(item) {\n return gantt.calculateEndDate({\n start_date: item.end_date,\n duration: -item.duration,\n task: item\n });\n }\n};","module.exports = function (gantt) {\n var BaseEditor = require(\"./base\")(gantt),\n utils = require(\"../../../../../utils/utils\");\n\n var __extends = require(\"../../../../../utils/extends\");\n\n function TextEditor() {\n var self = BaseEditor.apply(this, arguments) || this;\n return self;\n }\n\n __extends(TextEditor, BaseEditor);\n\n function getFormatter(config) {\n return config.formatter || gantt.ext.formatters.durationFormatter();\n }\n\n utils.mixin(TextEditor.prototype, {\n show: function show(id, column, config, placeholder) {\n var html = \"
\";\n placeholder.innerHTML = html;\n },\n set_value: function set_value(value, id, column, node) {\n this.get_input(node).value = getFormatter(column.editor).format(value);\n },\n get_value: function get_value(id, column, node) {\n return getFormatter(column.editor).parse(this.get_input(node).value || \"\");\n }\n }, true);\n return TextEditor;\n};","module.exports = function (gantt) {\n var BaseEditor = require(\"./base\")(gantt),\n utils = require(\"../../../../../utils/utils\");\n\n var __extends = require(\"../../../../../utils/extends\");\n\n function PredecessorEditor() {\n var self = BaseEditor.apply(this, arguments) || this;\n return self;\n }\n\n __extends(PredecessorEditor, BaseEditor);\n\n function getFormatter(config) {\n return config.formatter || gantt.ext.formatters.linkFormatter();\n }\n\n function parseInputString(value, config) {\n var predecessors = (value || \"\").split(config.delimiter || \",\");\n\n for (var i = 0; i < predecessors.length; i++) {\n var val = predecessors[i].trim();\n\n if (val) {\n predecessors[i] = val;\n } else {\n predecessors.splice(i, 1);\n i--;\n }\n }\n\n predecessors.sort();\n return predecessors;\n }\n\n function formatPredecessors(task, config, gantt) {\n var links = task.$target;\n var labels = [];\n\n for (var i = 0; i < links.length; i++) {\n var link = gantt.getLink(links[i]);\n labels.push(getFormatter(config).format(link));\n }\n\n return labels.join((config.delimiter || \",\") + \" \");\n }\n\n function getSelectedLinks(taskId, predecessorCodes, config) {\n var links = [];\n predecessorCodes.forEach(function (code) {\n var link = getFormatter(config).parse(code);\n\n if (link) {\n link.target = taskId; // GS-1290 A way to preserve the link. Otherwise validation will return false\n // because the existing link ID is not passed there\n\n link.id = \"predecessor_generated\";\n\n if (gantt.isLinkAllowed(link)) {\n link.id = undefined;\n links.push(link);\n }\n }\n });\n return links;\n }\n\n function formatLinkKey(link) {\n return link.source + \"_\" + link.target + \"_\" + link.type + \"_\" + (link.lag || 0);\n }\n\n function getLinksDiff(task, predecessorCodes, config) {\n var selectedLinks = getSelectedLinks(task.id, predecessorCodes, config);\n var existingLinksSearch = {};\n task.$target.forEach(function (linkId) {\n var link = gantt.getLink(linkId);\n existingLinksSearch[formatLinkKey(link)] = link.id;\n });\n var linksToAdd = [];\n selectedLinks.forEach(function (link) {\n var linkKey = formatLinkKey(link);\n\n if (!existingLinksSearch[linkKey]) {\n linksToAdd.push(link);\n } else {\n delete existingLinksSearch[linkKey];\n }\n });\n var linksToDelete = [];\n\n for (var i in existingLinksSearch) {\n linksToDelete.push(existingLinksSearch[i]);\n }\n\n return {\n add: linksToAdd,\n remove: linksToDelete\n };\n }\n\n utils.mixin(PredecessorEditor.prototype, {\n show: function show(id, column, config, placeholder) {\n var html = \"
\";\n placeholder.innerHTML = html;\n },\n hide: function hide() {},\n set_value: function set_value(value, id, column, node) {\n this.get_input(node).value = formatPredecessors(value, column.editor, gantt);\n },\n get_value: function get_value(id, column, node) {\n return parseInputString(this.get_input(node).value || \"\", column.editor);\n },\n save: function save(id, column, node) {\n var task = gantt.getTask(id);\n var linksDiff = getLinksDiff(task, this.get_value(id, column, node), column.editor);\n\n if (linksDiff.add.length || linksDiff.remove.length) {\n gantt.batchUpdate(function () {\n linksDiff.add.forEach(function (link) {\n gantt.addLink(link);\n });\n linksDiff.remove.forEach(function (linkId) {\n gantt.deleteLink(linkId);\n });\n if (gantt.autoSchedule) gantt.autoSchedule();\n });\n }\n },\n is_changed: function is_changed(value, id, column, node) {\n var inputPredecessors = this.get_value(id, column, node);\n var taskPredecessors = parseInputString(formatPredecessors(value, column.editor, gantt), column.editor);\n return inputPredecessors.join() !== taskPredecessors.join();\n }\n }, true);\n return PredecessorEditor;\n};","module.exports = function (gantt) {\n var BaseEditor = require(\"./base\")(gantt),\n utils = require(\"../../../../../utils/utils\");\n\n var __extends = require(\"../../../../../utils/extends\");\n\n var html5DateFormat = \"%Y-%m-%d\";\n var dateToStr = null;\n var strToDate = null;\n\n function init() {\n if (!dateToStr) {\n dateToStr = gantt.date.date_to_str(html5DateFormat);\n }\n\n if (!strToDate) {\n strToDate = gantt.date.str_to_date(html5DateFormat);\n }\n }\n\n function DateEditor() {\n var self = BaseEditor.apply(this, arguments) || this;\n return self;\n }\n\n __extends(DateEditor, BaseEditor);\n\n utils.mixin(DateEditor.prototype, {\n show: function show(id, column, config, placeholder) {\n init();\n var minValue = null;\n var maxValue = null;\n\n if (typeof config.min === \"function\") {\n minValue = config.min(id, column);\n } else {\n minValue = config.min;\n }\n\n if (typeof config.max === \"function\") {\n maxValue = config.max(id, column);\n } else {\n maxValue = config.max;\n }\n\n var minAttr = minValue ? \" min='\" + dateToStr(minValue) + \"' \" : \"\";\n var maxAttr = maxValue ? \" max='\" + dateToStr(maxValue) + \"' \" : \"\";\n var html = \"
\";\n placeholder.innerHTML = html;\n },\n set_value: function set_value(value, id, column, node) {\n if (value && value.getFullYear) {\n this.get_input(node).value = dateToStr(value);\n } else {\n this.get_input(node).value = value;\n }\n },\n is_valid: function is_valid(value, id, column, node) {\n if (!value || isNaN(value.getTime())) return false;\n return true;\n },\n get_value: function get_value(id, column, node) {\n var parsed;\n\n try {\n parsed = strToDate(this.get_input(node).value || \"\");\n } catch (e) {\n parsed = null; // return null will cancel changes\n }\n\n return parsed;\n }\n }, true);\n return DateEditor;\n};","module.exports = function (gantt) {\n var BaseEditor = require(\"./base\")(gantt),\n utils = require(\"../../../../../utils/utils\");\n\n var __extends = require(\"../../../../../utils/extends\");\n\n function SelectEditor() {\n var self = BaseEditor.apply(this, arguments) || this;\n return self;\n }\n\n __extends(SelectEditor, BaseEditor);\n\n utils.mixin(SelectEditor.prototype, {\n show: function show(id, column, config, placeholder) {\n var html = \"
\";\n placeholder.innerHTML = html;\n },\n get_input: function get_input(node) {\n return node.querySelector(\"select\");\n }\n }, true);\n return SelectEditor;\n};","module.exports = function (gantt) {\n var BaseEditor = require(\"./base\")(gantt),\n utils = require(\"../../../../../utils/utils\");\n\n var __extends = require(\"../../../../../utils/extends\");\n\n function NumberEditor() {\n var self = BaseEditor.apply(this, arguments) || this;\n return self;\n }\n\n __extends(NumberEditor, BaseEditor);\n\n utils.mixin(NumberEditor.prototype, {\n show: function show(id, column, config, placeholder) {\n var min = config.min || 0,\n max = config.max || 100;\n var html = \"
\";\n placeholder.innerHTML = html;\n },\n get_value: function get_value(id, column, node) {\n return this.get_input(node).value || \"\";\n },\n is_valid: function is_valid(value, id, column, node) {\n return !isNaN(parseInt(value, 10));\n }\n }, true);\n return NumberEditor;\n};","module.exports = function (gantt) {\n var BaseEditor = require(\"./base\")(gantt),\n utils = require(\"../../../../../utils/utils\");\n\n var __extends = require(\"../../../../../utils/extends\");\n\n function TextEditor() {\n var self = BaseEditor.apply(this, arguments) || this;\n return self;\n }\n\n __extends(TextEditor, BaseEditor);\n\n utils.mixin(TextEditor.prototype, {\n show: function show(id, column, config, placeholder) {\n var html = \"
\";\n placeholder.innerHTML = html;\n }\n }, true);\n return TextEditor;\n};","module.exports = {\n init: function init(controller, grid) {\n var self = controller;\n var gantt = grid.$gantt;\n var onBlurDelay = null;\n var keyNav = gantt.ext.keyboardNavigation;\n keyNav.attachEvent(\"onBeforeFocus\", function (node) {\n var activeCell = controller.locateCell(node);\n clearTimeout(onBlurDelay);\n\n if (activeCell) {\n var columnName = activeCell.columnName;\n var id = activeCell.id;\n var editorState = self.getState();\n\n if (self.isVisible()) {\n if (editorState.id == id && editorState.columnName === columnName) {\n return false;\n }\n }\n }\n\n return true;\n });\n keyNav.attachEvent(\"onFocus\", function (node) {\n var activeCell = controller.locateCell(node);\n var state = controller.getState();\n clearTimeout(onBlurDelay);\n\n if (activeCell && !(activeCell.id == state.id && activeCell.columnName == state.columnName)) {\n if (self.isVisible()) {\n self.save();\n }\n }\n\n return true;\n });\n controller.attachEvent(\"onHide\", function () {\n clearTimeout(onBlurDelay);\n });\n keyNav.attachEvent(\"onBlur\", function () {\n onBlurDelay = setTimeout(function () {\n self.save();\n });\n return true;\n });\n gantt.attachEvent(\"onTaskDblClick\", function (id, e) {\n // block lightbox on double click inside editor\n var state = controller.getState();\n var cell = controller.locateCell(e.target);\n\n if (cell && controller.isVisible() && cell.columnName == state.columnName) {\n return false;\n }\n\n return true;\n });\n gantt.attachEvent(\"onTaskClick\", function (id, e) {\n if (gantt._is_icon_open_click(e)) return true;\n var state = controller.getState();\n var cell = controller.locateCell(e.target);\n\n if (cell && controller.getEditorConfig(cell.columnName)) {\n if (controller.isVisible() && state.id == cell.id && state.columnName == cell.columnName) {// do nothing if editor is already active in this cell\n } else {\n controller.startEdit(cell.id, cell.columnName);\n }\n\n return false;\n }\n\n return true;\n });\n gantt.attachEvent(\"onEmptyClick\", function () {\n self.save();\n return true;\n });\n keyNav.attachEvent(\"onKeyDown\", function (command, e) {\n var activeCell = controller.locateCell(e.target);\n var hasEditor = activeCell ? controller.getEditorConfig(activeCell.columnName) : false;\n var state = controller.getState();\n var keyboard = gantt.constants.KEY_CODES;\n var keyCode = e.keyCode;\n var preventKeyNav = false;\n\n switch (keyCode) {\n case keyboard.ENTER:\n if (controller.isVisible()) {\n controller.save();\n e.preventDefault();\n preventKeyNav = true;\n } else if (hasEditor && !(e.ctrlKey || e.metaKey || e.shiftKey)) {\n self.startEdit(activeCell.id, activeCell.columnName);\n e.preventDefault();\n preventKeyNav = true;\n }\n\n break;\n\n case keyboard.ESC:\n if (controller.isVisible()) {\n controller.hide();\n e.preventDefault();\n preventKeyNav = true;\n }\n\n break;\n\n case keyboard.UP:\n case keyboard.DOWN:\n break;\n\n case keyboard.LEFT:\n case keyboard.RIGHT:\n if (hasEditor && controller.isVisible() || state.editorType === \"date\") {\n preventKeyNav = true;\n }\n\n break;\n\n case keyboard.SPACE:\n if (controller.isVisible()) {\n preventKeyNav = true;\n }\n\n if (hasEditor && !controller.isVisible()) {\n self.startEdit(activeCell.id, activeCell.columnName);\n e.preventDefault();\n preventKeyNav = true;\n }\n\n break;\n\n case keyboard.DELETE:\n if (hasEditor && !controller.isVisible()) {\n self.startEdit(activeCell.id, activeCell.columnName);\n preventKeyNav = true;\n } else if (hasEditor && controller.isVisible()) {\n preventKeyNav = true;\n }\n\n break;\n\n case keyboard.TAB:\n if (controller.isVisible()) {\n if (e.shiftKey) {\n controller.editPrevCell(true);\n } else {\n controller.editNextCell(true);\n }\n\n var newState = controller.getState();\n\n if (newState.id) {\n keyNav.focus({\n type: \"taskCell\",\n id: newState.id,\n column: newState.columnName\n });\n }\n\n e.preventDefault();\n preventKeyNav = true;\n }\n\n break;\n\n default:\n if (controller.isVisible()) preventKeyNav = true;else {\n // start editing on character key\n if (keyCode >= 48 && keyCode <= 57 || // [0-9]\n keyCode > 95 && keyCode < 112 || // numpad\n keyCode >= 64 && keyCode <= 91 || // [a-z]\n keyCode > 185 && keyCode < 193 || //;=-,etc\n keyCode > 218 && keyCode < 223) {\n var modifiers = command.modifiers;\n var anyModifier = modifiers.alt || modifiers.ctrl || modifiers.meta || modifiers.shift;\n\n if (modifiers.alt) {// don't start editing on alt+key\n } else if (anyModifier && keyNav.getCommandHandler(command, \"taskCell\")) {// don't start editing if command already have a keyboard shortcut\n } else if (hasEditor && !controller.isVisible()) {\n self.startEdit(activeCell.id, activeCell.columnName);\n preventKeyNav = true;\n }\n }\n }\n break;\n }\n\n if (preventKeyNav) {\n return false;\n } else {\n return true;\n }\n });\n },\n onShow: function onShow(controller, placeholder, grid) {},\n onHide: function onHide(controller, placeholder, grid) {\n var gantt = grid.$gantt;\n gantt.focus();\n },\n destroy: function destroy() {}\n};","module.exports = {\n init: function init(controller, grid) {\n var gantt = grid.$gantt;\n gantt.attachEvent(\"onTaskClick\", function (id, e) {\n if (gantt._is_icon_open_click(e)) return true;\n var state = controller.getState();\n var cell = controller.locateCell(e.target);\n\n if (cell && controller.getEditorConfig(cell.columnName)) {\n if (controller.isVisible() && state.id == cell.id && state.columnName == cell.columnName) {// do nothing if editor is already active in this cell\n } else {\n controller.startEdit(cell.id, cell.columnName);\n }\n\n return false;\n }\n\n return true;\n });\n gantt.attachEvent(\"onEmptyClick\", function () {\n if (controller.isVisible() && controller.isChanged()) {\n controller.save();\n } else {\n controller.hide();\n }\n\n return true;\n });\n gantt.attachEvent(\"onTaskDblClick\", function (id, e) {\n var state = controller.getState();\n var cell = controller.locateCell(e.target);\n\n if (cell && controller.isVisible() && cell.columnName == state.columnName) {\n //GS-933 probably, we don't need to hide the inline editor because the lightbox cannot be opened if you double-click on an inline editor\n //remove this code later if people don't complain\n //controller.hide();\n return false;\n }\n\n return true;\n });\n },\n onShow: function onShow(controller, placeholder, grid) {\n var gantt = grid.$gantt;\n\n if (gantt.ext && gantt.ext.keyboardNavigation) {\n var keyNav = gantt.ext.keyboardNavigation;\n keyNav.attachEvent(\"onKeyDown\", function (command, e) {\n var keyboard = gantt.constants.KEY_CODES;\n var keyCode = e.keyCode;\n var preventKeyNav = false;\n\n switch (keyCode) {\n case keyboard.SPACE:\n if (controller.isVisible()) {\n preventKeyNav = true;\n }\n\n break;\n }\n\n if (preventKeyNav) {\n return false;\n } else {\n return true;\n }\n });\n }\n\n placeholder.onkeydown = function (e) {\n e = e || window.event;\n var keyboard = gantt.constants.KEY_CODES;\n\n if (e.defaultPrevented || e.shiftKey && e.keyCode != keyboard.TAB) {\n return;\n }\n\n var shouldPrevent = true;\n\n switch (e.keyCode) {\n case gantt.keys.edit_save:\n controller.save();\n break;\n\n case gantt.keys.edit_cancel:\n controller.hide();\n break;\n\n case keyboard.UP:\n case keyboard.DOWN:\n if (controller.isVisible()) {\n controller.hide();\n shouldPrevent = false;\n }\n\n break;\n\n case keyboard.TAB:\n if (e.shiftKey) {\n controller.editPrevCell(true);\n } else {\n controller.editNextCell(true);\n }\n\n break;\n\n default:\n shouldPrevent = false;\n break;\n }\n\n if (shouldPrevent) {\n e.preventDefault();\n }\n };\n },\n onHide: function onHide() {},\n destroy: function destroy() {}\n};","var defaultMapping = require(\"./keyboard_mappings/default\");\n\nvar keyNavMappings = require(\"./keyboard_mappings/keyboard_navigation\");\n\nmodule.exports = function (gantt) {\n var mapping = null;\n return {\n setMapping: function setMapping(map) {\n mapping = map;\n },\n getMapping: function getMapping() {\n if (mapping) {\n return mapping;\n } else if (gantt.config.keyboard_navigation_cells && gantt.ext.keyboardNavigation) {\n return keyNavMappings;\n } else {\n return defaultMapping;\n }\n }\n };\n};","var getKeyboardMapping = require(\"./keyboard_mappings\");\n\nvar textEditorFactory = require(\"./editors/text\"),\n numberEditorFactory = require(\"./editors/number\"),\n selectEditorFactory = require(\"./editors/select\"),\n dateEditorFactory = require(\"./editors/date\"),\n predecessorEditorFactory = require(\"./editors/predecessor\"),\n durationEditorFactory = require(\"./editors/duration\");\n\nvar utils = require(\"../../../../utils/utils\");\n\nvar domHelpers = require(\"../../utils/dom_helpers\");\n\nvar eventable = require(\"../../../../utils/eventable\");\n\nvar linkedPropertiesProcessor = require(\"./linked_properties\");\n\nfunction initConfigs(gantt) {\n gantt.config.editor_types = {\n text: new (textEditorFactory(gantt))(),\n number: new (numberEditorFactory(gantt))(),\n select: new (selectEditorFactory(gantt))(),\n date: new (dateEditorFactory(gantt))(),\n predecessor: new (predecessorEditorFactory(gantt))(),\n duration: new (durationEditorFactory(gantt))()\n };\n}\n\nfunction create(gantt) {\n var keyboardMapping = getKeyboardMapping(gantt);\n var eventBus = {};\n eventable(eventBus);\n\n function createGridEditors(grid) {\n function _getGridCellFromNode(node) {\n if (!domHelpers.isChildOf(node, grid.$grid)) {\n return null;\n }\n\n var row = domHelpers.locateAttribute(node, grid.$config.item_attribute);\n var cell = domHelpers.locateAttribute(node, \"data-column-name\");\n\n if (row && cell) {\n var columnName = cell.getAttribute(\"data-column-name\");\n var id = row.getAttribute(grid.$config.item_attribute);\n return {\n id: id,\n columnName: columnName\n };\n }\n\n return null;\n }\n\n function _getEditorPosition(itemId, columnName) {\n var config = grid.$getConfig();\n var top = grid.getItemTop(itemId);\n var height = grid.getItemHeight(itemId);\n var cols = grid.getGridColumns();\n var left = 0,\n right = 0,\n width = 0;\n\n for (var i = 0; i < cols.length; i++) {\n if (cols[i].name == columnName) {\n width = cols[i].width;\n break;\n }\n\n if (config.rtl) {\n right += cols[i].width;\n } else {\n left += cols[i].width;\n }\n }\n\n if (config.rtl) {\n return {\n top: top,\n right: right,\n height: height,\n width: width\n };\n } else {\n return {\n top: top,\n left: left,\n height: height,\n width: width\n };\n }\n }\n\n function findVisibleIndex(grid, columnName) {\n var columns = grid.getGridColumns();\n\n for (var i = 0; i < columns.length; i++) {\n if (columns[i].name == columnName) {\n return i;\n }\n }\n\n return 0;\n }\n\n function _createPlaceholder(itemId, columnName) {\n var config = grid.$getConfig();\n\n var pos = _getEditorPosition(itemId, columnName);\n\n var el = document.createElement(\"div\");\n el.className = \"gantt_grid_editor_placeholder\";\n el.setAttribute(grid.$config.item_attribute, itemId);\n el.setAttribute(grid.$config.bind + \"_id\", itemId); // for backward compatibility\n\n el.setAttribute(\"data-column-name\", columnName);\n var visibleIndex = findVisibleIndex(grid, columnName);\n el.setAttribute(\"data-column-index\", visibleIndex);\n\n if (config.rtl) {\n el.style.cssText = [\"top:\" + pos.top + \"px\", \"right:\" + pos.right + \"px\", \"width:\" + pos.width + \"px\", \"height:\" + pos.height + \"px\"].join(\";\");\n } else {\n el.style.cssText = [\"top:\" + pos.top + \"px\", \"left:\" + pos.left + \"px\", \"width:\" + pos.width + \"px\", \"height:\" + pos.height + \"px\"].join(\";\");\n }\n\n return el;\n }\n\n var updateTaskDateProperties = linkedPropertiesProcessor(gantt);\n var handlers = [];\n var ganttHandlers = [];\n var store = null;\n var controller = {\n _itemId: null,\n _columnName: null,\n _editor: null,\n _editorType: null,\n _placeholder: null,\n locateCell: _getGridCellFromNode,\n getEditorConfig: function getEditorConfig(columnName) {\n var column = grid.getColumn(columnName);\n return column.editor;\n },\n init: function init() {\n var mapping = keyboardMapping.getMapping();\n\n if (mapping.init) {\n mapping.init(this, grid);\n }\n\n store = grid.$gantt.getDatastore(grid.$config.bind);\n var self = this;\n handlers.push(store.attachEvent(\"onIdChange\", function (oldId, newId) {\n if (self._itemId == oldId) {\n self._itemId = newId;\n }\n }));\n handlers.push(store.attachEvent(\"onStoreUpdated\", function () {\n if (grid.$gantt.getState(\"batchUpdate\").batch_update) {\n return;\n }\n\n if (self.isVisible() && !store.isVisible(self._itemId)) {\n self.hide();\n }\n }));\n ganttHandlers.push(gantt.attachEvent(\"onDataRender\", function () {\n if (self._editor && self._placeholder && !domHelpers.isChildOf(self._placeholder, gantt.$root)) {\n grid.$grid_data.appendChild(self._placeholder);\n }\n }));\n\n this.init = function () {};\n },\n getState: function getState() {\n return {\n editor: this._editor,\n editorType: this._editorType,\n placeholder: this._placeholder,\n id: this._itemId,\n columnName: this._columnName\n };\n },\n startEdit: function startEdit(itemId, columnName) {\n if (this.isVisible()) {\n this.save();\n }\n\n if (!store.exists(itemId)) {\n return;\n }\n\n var editorState = {\n id: itemId,\n columnName: columnName\n };\n\n if (gantt.isReadonly(store.getItem(itemId))) {\n this.callEvent(\"onEditPrevent\", [editorState]);\n return;\n }\n\n if (this.callEvent(\"onBeforeEditStart\", [editorState]) === false) {\n this.callEvent(\"onEditPrevent\", [editorState]);\n return;\n }\n\n this.show(editorState.id, editorState.columnName);\n this.setValue();\n this.callEvent(\"onEditStart\", [editorState]);\n },\n isVisible: function isVisible() {\n return !!(this._editor && domHelpers.isChildOf(this._placeholder, gantt.$root));\n },\n show: function show(itemId, columnName) {\n if (this.isVisible()) {\n this.save();\n }\n\n var editorState = {\n id: itemId,\n columnName: columnName\n };\n var column = grid.getColumn(editorState.columnName);\n var editorConfig = this.getEditorConfig(column.name);\n if (!editorConfig) return;\n var editor = grid.$getConfig().editor_types[editorConfig.type];\n\n var placeholder = _createPlaceholder(editorState.id, editorState.columnName);\n\n grid.$grid_data.appendChild(placeholder);\n editor.show(editorState.id, column, editorConfig, placeholder);\n this._editor = editor;\n this._placeholder = placeholder;\n this._itemId = editorState.id;\n this._columnName = editorState.columnName;\n this._editorType = editorConfig.type;\n var mapping = keyboardMapping.getMapping();\n\n if (mapping.onShow) {\n mapping.onShow(this, placeholder, grid);\n }\n },\n setValue: function setValue() {\n var state = this.getState();\n var itemId = state.id,\n columnName = state.columnName;\n var column = grid.getColumn(columnName);\n var item = store.getItem(itemId);\n var editorConfig = this.getEditorConfig(columnName);\n if (!editorConfig) return;\n var value = item[editorConfig.map_to];\n\n if (editorConfig.map_to == \"auto\") {\n value = store.getItem(itemId);\n }\n\n this._editor.set_value(value, itemId, column, this._placeholder);\n\n this.focus();\n },\n focus: function focus() {\n this._editor.focus(this._placeholder);\n },\n getValue: function getValue() {\n var column = grid.getColumn(this._columnName);\n return this._editor.get_value(this._itemId, column, this._placeholder);\n },\n _getItemValue: function _getItemValue() {\n var editorConfig = this.getEditorConfig(this._columnName);\n if (!editorConfig) return;\n var item = gantt.getTask(this._itemId);\n var value = item[editorConfig.map_to];\n\n if (editorConfig.map_to == \"auto\") {\n value = store.getItem(this._itemId);\n }\n\n return value;\n },\n isChanged: function isChanged() {\n var column = grid.getColumn(this._columnName);\n\n var value = this._getItemValue();\n\n return this._editor.is_changed(value, this._itemId, column, this._placeholder);\n },\n hide: function hide() {\n if (!this._itemId) return;\n var itemId = this._itemId,\n columnName = this._columnName;\n var mapping = keyboardMapping.getMapping();\n\n if (mapping.onHide) {\n mapping.onHide(this, this._placeholder, grid);\n }\n\n this._itemId = null;\n this._columnName = null;\n this._editorType = null;\n if (!this._placeholder) return;\n\n if (this._editor && this._editor.hide) {\n this._editor.hide(this._placeholder);\n }\n\n this._editor = null;\n\n if (this._placeholder.parentNode) {\n this._placeholder.parentNode.removeChild(this._placeholder);\n }\n\n this._placeholder = null;\n this.callEvent(\"onEditEnd\", [{\n id: itemId,\n columnName: columnName\n }]);\n },\n save: function save() {\n if (!(this.isVisible() && store.exists(this._itemId) && this.isChanged())) {\n this.hide();\n return;\n }\n\n var itemId = this._itemId,\n columnName = this._columnName;\n\n if (!store.exists(itemId)) {\n return;\n }\n\n var item = store.getItem(itemId);\n var editorConfig = this.getEditorConfig(columnName);\n var editorState = {\n id: itemId,\n columnName: columnName,\n newValue: this.getValue(),\n oldValue: this._getItemValue()\n };\n\n if (this.callEvent(\"onBeforeSave\", [editorState]) !== false) {\n if (!this._editor.is_valid || this._editor.is_valid(editorState.newValue, editorState.id, grid.getColumn(columnName), this._placeholder)) {\n var mapTo = editorConfig.map_to;\n var value = editorState.newValue;\n\n if (mapTo != \"auto\") {\n item[mapTo] = value;\n updateTaskDateProperties(item, mapTo, gantt.config.inline_editors_date_processing);\n store.updateItem(itemId);\n } else {\n this._editor.save(itemId, grid.getColumn(columnName), this._placeholder);\n }\n\n this.callEvent(\"onSave\", [editorState]);\n }\n }\n\n this.hide();\n },\n _findEditableCell: function findEditableCell(start, direction) {\n var nextIndex = start;\n var columns = grid.getGridColumns();\n var nextColumn = columns[nextIndex];\n var columnName = nextColumn ? nextColumn.name : null;\n\n if (columnName) {\n while (columnName && !this.getEditorConfig(columnName)) {\n columnName = this._findEditableCell(start + direction, direction);\n }\n\n return columnName;\n }\n\n return null;\n },\n getNextCell: function moveCell(dir) {\n // GS-1257. true means to exclude hidden columns\n return this._findEditableCell(grid.getColumnIndex(this._columnName, true) + dir, dir);\n },\n getFirstCell: function getFirstCell() {\n return this._findEditableCell(0, 1);\n },\n getLastCell: function getLastCell() {\n return this._findEditableCell(grid.getGridColumns().length - 1, -1);\n },\n editNextCell: function nextCell(canChangeRow) {\n var cell = this.getNextCell(1);\n\n if (cell) {\n var nextColumn = this.getNextCell(1);\n\n if (nextColumn && this.getEditorConfig(nextColumn)) {\n this.startEdit(this._itemId, nextColumn);\n }\n } else if (canChangeRow && this.moveRow(1)) {\n var task = this.moveRow(1);\n cell = this.getFirstCell();\n\n if (cell && this.getEditorConfig(cell)) {\n this.startEdit(task, cell);\n }\n }\n },\n editPrevCell: function prevCell(canChangeRow) {\n var cell = this.getNextCell(-1);\n\n if (cell) {\n var nextColumn = this.getNextCell(-1);\n\n if (nextColumn && this.getEditorConfig(nextColumn)) {\n this.startEdit(this._itemId, nextColumn);\n }\n } else if (canChangeRow && this.moveRow(-1)) {\n var task = this.moveRow(-1);\n cell = this.getLastCell();\n\n if (cell && this.getEditorConfig(cell)) {\n this.startEdit(task, cell);\n }\n }\n },\n moveRow: function moveRow(dir) {\n var moveTask = dir > 0 ? gantt.getNext : gantt.getPrev;\n moveTask = gantt.bind(moveTask, gantt);\n var nextItem = moveTask(this._itemId); // skip readonly rows\n\n while (gantt.isTaskExists(nextItem) && gantt.isReadonly(gantt.getTask(nextItem))) {\n nextItem = moveTask(nextItem);\n }\n\n return nextItem;\n },\n editNextRow: function nextRow(skipReadonly) {\n var id = this.getState().id;\n if (!gantt.isTaskExists(id)) return;\n var next = null;\n\n if (skipReadonly) {\n next = this.moveRow(1);\n } else {\n next = gantt.getNext(id);\n }\n\n if (gantt.isTaskExists(next)) {\n this.startEdit(next, this._columnName);\n }\n },\n editPrevRow: function prevRow(skipReadonly) {\n var id = this.getState().id;\n if (!gantt.isTaskExists(id)) return;\n var prev = null;\n\n if (skipReadonly) {\n prev = this.moveRow(-1);\n } else {\n prev = gantt.getPrev(id);\n }\n\n if (gantt.isTaskExists(prev)) {\n this.startEdit(prev, this._columnName);\n }\n },\n destructor: function destructor() {\n handlers.forEach(function (handlerId) {\n store.detachEvent(handlerId);\n });\n ganttHandlers.forEach(function (handlerId) {\n gantt.detachEvent(handlerId);\n });\n handlers = [];\n ganttHandlers = [];\n store = null;\n this.hide();\n this.detachAllEvents();\n }\n };\n utils.mixin(controller, keyboardMapping);\n utils.mixin(controller, eventBus);\n return controller;\n }\n\n var inlineEditController = {\n init: initConfigs,\n createEditors: createGridEditors\n };\n utils.mixin(inlineEditController, keyboardMapping);\n utils.mixin(inlineEditController, eventBus);\n return inlineEditController;\n}\n\nmodule.exports = create;","var createStaticBgHelper = function createStaticBgHelper() {\n return {\n render: function render() {},\n destroy: function destroy() {}\n };\n};\n\nmodule.exports = {\n create: function create() {\n return createStaticBgHelper();\n }\n};","var __extends = require(\"../../../utils/extends\"),\n domHelpers = require(\"../utils/dom_helpers\"),\n utils = require(\"../../../utils/utils\"),\n env = require(\"../../../utils/env\"),\n Cell = require(\"./cell\");\n\nvar ScrollbarCell = function (_super) {\n \"use strict\";\n\n var SCROLL_MODIFIER_KEYS = [\"altKey\", \"shiftKey\", \"metaKey\"]; // it's no way to disable ctrl+wheel\n\n __extends(ScrollbarCell, _super);\n\n function ScrollbarCell(parent, config, factory, gantt) {\n var _this = _super.apply(this, arguments) || this;\n\n this.$config = utils.mixin(config, {\n scroll: \"x\"\n });\n _this._scrollHorizontalHandler = utils.bind(_this._scrollHorizontalHandler, _this);\n _this._scrollVerticalHandler = utils.bind(_this._scrollVerticalHandler, _this);\n _this._outerScrollVerticalHandler = utils.bind(_this._outerScrollVerticalHandler, _this);\n _this._outerScrollHorizontalHandler = utils.bind(_this._outerScrollHorizontalHandler, _this);\n _this._mouseWheelHandler = utils.bind(_this._mouseWheelHandler, _this);\n this.$config.hidden = true;\n var size = gantt.config.scroll_size;\n\n if (gantt.env.isIE) {\n // full element height/width must be bigger than just a browser scrollbar,\n // otherwise the scrollbar element won't be scrolled on click\n size += 1;\n }\n\n if (this._isHorizontal()) {\n _this.$config.height = size;\n _this.$parent.$config.height = size;\n } else {\n _this.$config.width = size;\n _this.$parent.$config.width = size;\n }\n\n this.$config.scrollPosition = 0;\n _this.$name = \"scroller\";\n return _this;\n }\n\n ScrollbarCell.prototype.init = function (container) {\n container.innerHTML = this.$toHTML();\n this.$view = container.firstChild;\n\n if (!this.$view) {\n this.init();\n }\n\n if (this._isVertical()) {\n this._initVertical();\n } else {\n this._initHorizontal();\n }\n\n this._initMouseWheel();\n\n this._initLinkedViews();\n };\n\n ScrollbarCell.prototype.$toHTML = function () {\n var className = this._isHorizontal() ? \"gantt_hor_scroll\" : \"gantt_ver_scroll\";\n return \"
\";\n };\n\n ScrollbarCell.prototype._getRootParent = function () {\n var parent = this.$parent;\n\n while (parent && parent.$parent) {\n parent = parent.$parent;\n }\n\n if (parent) {\n return parent;\n }\n };\n\n function eachCell(root, res) {\n res.push(root);\n\n if (root.$cells) {\n for (var i = 0; i < root.$cells.length; i++) {\n eachCell(root.$cells[i], res);\n }\n }\n }\n\n ScrollbarCell.prototype._eachView = function () {\n var res = [];\n eachCell(this._getRootParent(), res);\n return res;\n };\n\n ScrollbarCell.prototype._getLinkedViews = function () {\n var views = this._eachView();\n\n var res = [];\n\n for (var i = 0; i < views.length; i++) {\n if (views[i].$config && (this._isVertical() && views[i].$config.scrollY == this.$id || this._isHorizontal() && views[i].$config.scrollX == this.$id)) {\n res.push(views[i]);\n }\n }\n\n return res;\n };\n\n ScrollbarCell.prototype._initHorizontal = function () {\n this.$scroll_hor = this.$view;\n this.$domEvents.attach(this.$view, \"scroll\", this._scrollHorizontalHandler);\n };\n\n ScrollbarCell.prototype._initLinkedViews = function () {\n var views = this._getLinkedViews();\n\n var css = this._isVertical() ? \"gantt_layout_outer_scroll gantt_layout_outer_scroll_vertical\" : \"gantt_layout_outer_scroll gantt_layout_outer_scroll_horizontal\";\n\n for (var i = 0; i < views.length; i++) {\n //views[i].$config.css = [views[i].$config.css || \"\", css].join(\" \");\n domHelpers.addClassName(views[i].$view || views[i].getNode(), css);\n }\n };\n\n ScrollbarCell.prototype._initVertical = function () {\n this.$scroll_ver = this.$view;\n this.$domEvents.attach(this.$view, \"scroll\", this._scrollVerticalHandler);\n };\n\n ScrollbarCell.prototype._updateLinkedViews = function () {};\n\n ScrollbarCell.prototype._initMouseWheel = function () {\n var ff = env.isFF;\n if (ff) this.$domEvents.attach(this._getRootParent().$view, \"wheel\", this._mouseWheelHandler, {\n passive: false\n });else this.$domEvents.attach(this._getRootParent().$view, \"mousewheel\", this._mouseWheelHandler, {\n passive: false\n });\n };\n\n ScrollbarCell.prototype.scrollHorizontally = function (left) {\n if (this._scrolling) return;\n this._scrolling = true;\n this.$scroll_hor.scrollLeft = left;\n this.$config.codeScrollLeft = left;\n left = this.$scroll_hor.scrollLeft;\n\n var views = this._getLinkedViews();\n\n for (var i = 0; i < views.length; i++) {\n if (views[i].scrollTo) {\n views[i].scrollTo(left, undefined);\n }\n }\n\n var oldSize = this.$config.scrollPosition;\n this.$config.scrollPosition = left;\n this.callEvent(\"onScroll\", [oldSize, left, this.$config.scroll]);\n this._scrolling = false;\n };\n\n ScrollbarCell.prototype.scrollVertically = function (top) {\n if (this._scrolling) return;\n this._scrolling = true;\n this.$scroll_ver.scrollTop = top;\n top = this.$scroll_ver.scrollTop;\n\n var views = this._getLinkedViews();\n\n for (var i = 0; i < views.length; i++) {\n if (views[i].scrollTo) {\n views[i].scrollTo(undefined, top);\n }\n }\n\n var oldSize = this.$config.scrollPosition;\n this.$config.scrollPosition = top;\n this.callEvent(\"onScroll\", [oldSize, top, this.$config.scroll]);\n this._scrolling = false;\n };\n\n ScrollbarCell.prototype._isVertical = function () {\n return this.$config.scroll == \"y\";\n };\n\n ScrollbarCell.prototype._isHorizontal = function () {\n return this.$config.scroll == \"x\";\n };\n\n ScrollbarCell.prototype._scrollHorizontalHandler = function (e) {\n if (this._isVertical() || this._scrolling) {\n return;\n } //in safari we can catch previous onscroll after setting new value from mouse-wheel event\n //set delay to prevent value drifiting\n\n\n if (new Date() - (this._wheel_time || 0) < 100) return true; //if (this.$gantt._touch_scroll_active) return;\n\n var left = this.$scroll_hor.scrollLeft;\n this.scrollHorizontally(left);\n this._oldLeft = this.$scroll_hor.scrollLeft;\n };\n\n ScrollbarCell.prototype._outerScrollHorizontalHandler = function (e) {\n if (this._isVertical()) {\n return;\n }\n };\n\n ScrollbarCell.prototype.show = function () {\n this.$parent.show();\n };\n\n ScrollbarCell.prototype.hide = function () {\n this.$parent.hide();\n };\n\n ScrollbarCell.prototype._getScrollSize = function () {\n var scrollSize = 0;\n var outerSize = 0;\n\n var isHorizontal = this._isHorizontal();\n\n var linked = this._getLinkedViews();\n\n var view;\n var scrollProperty = isHorizontal ? \"scrollWidth\" : \"scrollHeight\",\n innerSizeProperty = isHorizontal ? \"contentX\" : \"contentY\";\n var outerProperty = isHorizontal ? \"x\" : \"y\";\n\n var offset = this._getScrollOffset();\n\n for (var i = 0; i < linked.length; i++) {\n view = linked[i];\n if (!(view && view.$content && view.$content.getSize && !view.$config.hidden)) continue;\n var sizes = view.$content.getSize();\n var cellScrollSize;\n\n if (sizes.hasOwnProperty(scrollProperty)) {\n cellScrollSize = sizes[scrollProperty];\n } else {\n cellScrollSize = sizes[innerSizeProperty];\n }\n\n if (offset) {\n // precalculated vertical/horizontal offsets of scrollbar to emulate 4.x look\n if (sizes[innerSizeProperty] > sizes[outerProperty] && sizes[innerSizeProperty] > scrollSize && cellScrollSize > sizes[outerProperty] - offset + 2) {\n scrollSize = cellScrollSize + (isHorizontal ? 0 : 2);\n outerSize = sizes[outerProperty];\n }\n } else {\n var nonScrollableSize = Math.max(sizes[innerSizeProperty] - cellScrollSize, 0);\n var scrollableViewPortSize = Math.max(sizes[outerProperty] - nonScrollableSize, 0);\n cellScrollSize = cellScrollSize + nonScrollableSize;\n\n if (cellScrollSize > scrollableViewPortSize && cellScrollSize > scrollSize) {\n //|| (cellScrollSize === scrollSize && sizes[outerProperty] < outerSize) // same scroll width but smaller scrollable view port\n scrollSize = cellScrollSize;\n outerSize = sizes[outerProperty];\n }\n }\n }\n\n return {\n outerScroll: outerSize,\n innerScroll: scrollSize\n };\n };\n\n ScrollbarCell.prototype.scroll = function (position) {\n if (this._isHorizontal()) {\n this.scrollHorizontally(position);\n } else {\n this.scrollVertically(position);\n }\n };\n\n ScrollbarCell.prototype.getScrollState = function () {\n return {\n visible: this.isVisible(),\n direction: this.$config.scroll,\n size: this.$config.outerSize,\n scrollSize: this.$config.scrollSize || 0,\n position: this.$config.scrollPosition || 0\n };\n };\n\n ScrollbarCell.prototype.setSize = function (width, height) {\n _super.prototype.setSize.apply(this, arguments);\n\n var scrollSizes = this._getScrollSize();\n\n var ownSize = (this._isVertical() ? height : width) - this._getScrollOffset() + (this._isHorizontal() ? 1 : 0);\n\n if (scrollSizes.innerScroll && ownSize > scrollSizes.outerScroll) {\n scrollSizes.innerScroll += ownSize - scrollSizes.outerScroll;\n }\n\n this.$config.scrollSize = scrollSizes.innerScroll;\n this.$config.width = width;\n this.$config.height = height;\n\n this._setScrollSize(scrollSizes.innerScroll);\n };\n\n ScrollbarCell.prototype.isVisible = function () {\n return !!(this.$parent && this.$parent.$view.parentNode);\n };\n\n ScrollbarCell.prototype.shouldShow = function () {\n var scrollSizes = this._getScrollSize();\n\n if (!scrollSizes.innerScroll && this.$parent && this.$parent.$view.parentNode) {\n return false;\n } else if (scrollSizes.innerScroll && !(this.$parent && this.$parent.$view.parentNode)) {\n return true;\n } else {\n return false;\n }\n };\n\n ScrollbarCell.prototype.shouldHide = function () {\n var scrollSizes = this._getScrollSize();\n\n if (!scrollSizes.innerScroll && this.$parent && this.$parent.$view.parentNode) {\n return true;\n } else {\n return false;\n }\n };\n\n ScrollbarCell.prototype.toggleVisibility = function () {\n if (this.shouldHide()) {\n this.hide();\n } else if (this.shouldShow()) {\n this.show();\n }\n };\n\n ScrollbarCell.prototype._getScaleOffset = function (view) {\n var offset = 0;\n\n if (view && (view.$config.view == \"timeline\" || view.$config.view == \"grid\")) {\n offset = view.$content.$getConfig().scale_height;\n }\n\n return offset;\n };\n\n ScrollbarCell.prototype._getScrollOffset = function () {\n var offset = 0;\n\n if (this._isVertical()) {\n var parentLayout = this.$parent.$parent;\n offset = Math.max(this._getScaleOffset(parentLayout.getPrevSibling(this.$parent.$id)), this._getScaleOffset(parentLayout.getNextSibling(this.$parent.$id)));\n } else {\n var linked = this._getLinkedViews();\n\n for (var i = 0; i < linked.length; i++) {\n var view = linked[i],\n vparent = view.$parent;\n var cells = vparent.$cells;\n var last = cells[cells.length - 1];\n\n if (last && last.$config.view == \"scrollbar\" && last.$config.hidden === false) {\n offset = last.$config.width;\n break;\n }\n }\n }\n\n return offset || 0;\n };\n\n ScrollbarCell.prototype._setScrollSize = function (size) {\n var property = this._isHorizontal() ? \"width\" : \"height\";\n var scrollbar = this._isHorizontal() ? this.$scroll_hor : this.$scroll_ver;\n\n var offset = this._getScrollOffset();\n\n var node = scrollbar.firstChild;\n\n if (offset) {\n if (this._isVertical()) {\n this.$config.outerSize = this.$config.height - offset + 3;\n scrollbar.style.height = this.$config.outerSize + \"px\";\n scrollbar.style.top = offset - 1 + \"px\";\n domHelpers.addClassName(scrollbar, this.$parent._borders.top);\n domHelpers.addClassName(scrollbar.parentNode, \"gantt_task_vscroll\");\n } else {\n this.$config.outerSize = this.$config.width - offset + 1;\n scrollbar.style.width = this.$config.outerSize + \"px\"; //domHelpers.addClassName(scrollbar, this.$parent._borders.right);\n }\n } else {\n scrollbar.style.top = \"auto\";\n domHelpers.removeClassName(scrollbar, this.$parent._borders.top);\n domHelpers.removeClassName(scrollbar.parentNode, \"gantt_task_vscroll\");\n this.$config.outerSize = this.$config.height;\n }\n\n node.style[property] = size + \"px\";\n };\n\n ScrollbarCell.prototype._scrollVerticalHandler = function (e) {\n if (this._scrollHorizontalHandler() || this._scrolling) {\n return;\n } //if (this.$gantt._touch_scroll_active) return;\n\n\n var top = this.$scroll_ver.scrollTop;\n var prev = this._oldTop;\n if (top == prev) return;\n this.scrollVertically(top);\n this._oldTop = this.$scroll_ver.scrollTop;\n };\n\n ScrollbarCell.prototype._outerScrollVerticalHandler = function (e) {\n if (this._scrollHorizontalHandler()) {\n return;\n }\n };\n\n ScrollbarCell.prototype._checkWheelTarget = function (targetNode) {\n var connectedViews = this._getLinkedViews().concat(this);\n\n for (var i = 0; i < connectedViews.length; i++) {\n var node = connectedViews[i].$view;\n\n if (domHelpers.isChildOf(targetNode, node)) {\n return true;\n }\n }\n\n return false;\n };\n\n ScrollbarCell.prototype._mouseWheelHandler = function (e) {\n var target = e.target || e.srcElement;\n if (!this._checkWheelTarget(target)) return;\n this._wheel_time = new Date();\n var res = {};\n var wheelSpeed = {\n x: 1,\n y: 1\n };\n var wheelSpeedConfig = this.$gantt.config.wheel_scroll_sensitivity;\n\n if (typeof wheelSpeedConfig == \"number\" && !!wheelSpeedConfig) {\n wheelSpeed = {\n x: wheelSpeedConfig,\n y: wheelSpeedConfig\n };\n } else if ({}.toString.apply(wheelSpeedConfig) == \"[object Object]\") {\n wheelSpeed = {\n x: wheelSpeedConfig.x,\n y: wheelSpeedConfig.y\n };\n }\n\n var ff = env.isFF;\n var deltaX = ff ? e.deltaX : e.wheelDeltaX;\n var deltaY = ff ? e.deltaY : e.wheelDelta;\n var multiplier = -20;\n\n if (ff) {\n if (e.deltaMode !== 0) {\n multiplier = -40;\n } else {\n multiplier = -10;\n }\n }\n\n var wx = ff ? deltaX * multiplier * wheelSpeed.x : deltaX * 2 * wheelSpeed.x;\n var wy = ff ? deltaY * multiplier * wheelSpeed.y : deltaY * wheelSpeed.y;\n var horizontalScrollModifier = this.$gantt.config.horizontal_scroll_key;\n\n if (horizontalScrollModifier !== false) {\n if (SCROLL_MODIFIER_KEYS.indexOf(horizontalScrollModifier) >= 0) {\n if (e[horizontalScrollModifier] && !(e.deltaX || e.wheelDeltaX)) {\n // shift+mousewheel for horizontal scroll\n wx = wy * 2;\n wy = 0;\n }\n }\n }\n\n if (wx && Math.abs(wx) > Math.abs(wy)) {\n if (this._isVertical()) {\n return;\n }\n\n if (res.x) return true; //no horisontal scroll, must not block scrolling\n\n if (!this.$scroll_hor || !this.$scroll_hor.offsetWidth) return true;\n var dir = wx / -40;\n var oldLeft = this._oldLeft;\n var left = oldLeft + dir * 30;\n this.scrollHorizontally(left);\n this.$scroll_hor.scrollLeft = left; // not block scroll if position hasn't changed\n\n if (oldLeft == this.$scroll_hor.scrollLeft) {\n return true;\n }\n\n this._oldLeft = this.$scroll_hor.scrollLeft;\n } else {\n if (this._isHorizontal()) {\n return;\n }\n\n if (res.y) return true; //no vertical scroll, must not block scrolling\n\n if (!this.$scroll_ver || !this.$scroll_ver.offsetHeight) return true;\n var dir = wy / -40;\n if (typeof wy == \"undefined\") dir = e.detail;\n var oldTop = this._oldTop;\n var top = this.$scroll_ver.scrollTop + dir * 30; //if(!this.$gantt.config.prevent_default_scroll &&\n //\t(this.$gantt._cached_scroll_pos && ((this.$gantt._cached_scroll_pos.y == top) || (this.$gantt._cached_scroll_pos.y <= 0 && top <= 0)))) return true;\n\n this.scrollVertically(top);\n this.$scroll_ver.scrollTop = top; // not block scroll if position hasn't changed\n\n if (oldTop == this.$scroll_ver.scrollTop) {\n return true;\n }\n\n this._oldTop = this.$scroll_ver.scrollTop;\n }\n\n if (e.preventDefault) e.preventDefault();\n e.cancelBubble = true;\n return false;\n };\n\n return ScrollbarCell;\n}(Cell);\n\nmodule.exports = ScrollbarCell;","module.exports = null;","var __extends = require(\"../../../utils/extends\"),\n utils = require(\"../../../utils/utils\"),\n Cell = require(\"./cell\");\n\nvar ViewCell = function (_super) {\n \"use strict\";\n\n __extends(ViewCell, _super);\n\n function ViewCell(parent, config, factory) {\n var _this = _super.apply(this, arguments) || this;\n\n if (config.view) {\n if (config.id) {\n // pass id to the nested view\n this.$id = utils.uid();\n }\n\n var childConfig = utils.copy(config);\n delete childConfig.config;\n delete childConfig.templates;\n this.$content = this.$factory.createView(config.view, this, childConfig, this);\n if (!this.$content) return false;\n }\n\n _this.$name = \"viewCell\";\n return _this;\n }\n\n ViewCell.prototype.destructor = function () {\n this.clear();\n\n _super.prototype.destructor.call(this);\n };\n\n ViewCell.prototype.clear = function () {\n this.$initialized = false; // call destructor\n\n if (this.$content) {\n var method = this.$content.unload || this.$content.destructor;\n\n if (method) {\n method.call(this.$content);\n }\n }\n\n _super.prototype.clear.call(this);\n };\n\n ViewCell.prototype.scrollTo = function (left, top) {\n if (this.$content && this.$content.scrollTo) {\n this.$content.scrollTo(left, top);\n } else {\n _super.prototype.scrollTo.call(this, left, top);\n }\n };\n\n ViewCell.prototype._setContentSize = function (x, y) {\n var borders = this._getBorderSizes();\n\n if (typeof x === \"number\") {\n var outerX = x + borders.horizontal;\n this.$config.width = outerX;\n }\n\n if (typeof y === \"number\") {\n var outerY = y + borders.vertical;\n this.$config.height = outerY;\n }\n };\n\n ViewCell.prototype.setSize = function (x, y) {\n _super.prototype.setSize.call(this, x, y);\n\n if (!this.$preResize && this.$content) {\n if (!this.$initialized) {\n this.$initialized = true;\n var header = this.$view.childNodes[0];\n var content = this.$view.childNodes[1];\n if (!content) content = header;\n /*if(this.$content.$config){\r\n \tthis.$content.$config.width = this.$lastSize.contentX;\r\n \tthis.$content.$config.height = this.$lastSize.contentY;\r\n }*/\n\n this.$content.init(content);\n }\n }\n };\n\n ViewCell.prototype.setContentSize = function () {\n if (!this.$preResize && this.$content) {\n if (this.$initialized) {\n this.$content.setSize(this.$lastSize.contentX, this.$lastSize.contentY);\n }\n }\n };\n\n ViewCell.prototype.getContentSize = function () {\n var size = _super.prototype.getContentSize.call(this);\n\n if (this.$content && this.$initialized) {\n var childSize = this.$content.getSize();\n size.width = childSize.contentX === undefined ? childSize.width : childSize.contentX;\n size.height = childSize.contentY === undefined ? childSize.height : childSize.contentY;\n }\n\n var borders = this._getBorderSizes();\n\n size.width += borders.horizontal;\n size.height += borders.vertical;\n return size;\n };\n\n return ViewCell;\n}(Cell);\n\nmodule.exports = ViewCell;","var __extends = require(\"../../../utils/extends\"),\n Layout = require(\"./layout\"),\n Cell = require(\"./cell\");\n\nvar ViewLayout = function (_super) {\n \"use strict\";\n\n __extends(ViewLayout, _super);\n\n function ViewLayout(parent, config, factory) {\n var _this = _super.apply(this, arguments) || this;\n\n for (var i = 0; i < _this.$cells.length; i++) {\n _this.$cells[i].$config.hidden = i !== 0;\n }\n\n _this.$cell = _this.$cells[0];\n _this.$name = \"viewLayout\";\n return _this;\n }\n\n ViewLayout.prototype.cell = function (id) {\n var cell = _super.prototype.cell.call(this, id);\n\n if (!cell.$view) {\n this.$fill(null, this);\n }\n\n return cell;\n };\n\n ViewLayout.prototype.moveView = function (view) {\n var body = this.$view;\n\n if (this.$cell) {\n this.$cell.$config.hidden = true;\n body.removeChild(this.$cell.$view);\n }\n\n this.$cell = view;\n body.appendChild(view.$view);\n };\n\n ViewLayout.prototype.setSize = function (x, y) {\n Cell.prototype.setSize.call(this, x, y);\n };\n\n ViewLayout.prototype.setContentSize = function () {\n var size = this.$lastSize;\n this.$cell.setSize(size.contentX, size.contentY);\n };\n\n ViewLayout.prototype.getSize = function () {\n var sizes = _super.prototype.getSize.call(this);\n\n if (this.$cell) {\n var cellSize = this.$cell.getSize();\n\n if (this.$config.byMaxSize) {\n for (var i = 0; i < this.$cells.length; i++) {\n var otherCell = this.$cells[i].getSize();\n\n for (var cell in cellSize) {\n cellSize[cell] = Math.max(cellSize[cell], otherCell[cell]);\n }\n }\n }\n\n for (var size in sizes) {\n sizes[size] = sizes[size] || cellSize[size];\n }\n\n sizes.gravity = Math.max(sizes.gravity, cellSize.gravity);\n }\n\n return sizes;\n };\n\n return ViewLayout;\n}(Layout);\n\nmodule.exports = ViewLayout;","module.exports = function (item, view, config) {\n if (!item.start_date || !item.end_date) {\n return null;\n }\n\n var padding = 200;\n var startCoord = view.posFromDate(item.start_date);\n var endCoord = view.posFromDate(item.end_date);\n var left = Math.min(startCoord, endCoord) - padding;\n var right = Math.max(startCoord, endCoord) + padding;\n return {\n top: view.getItemTop(item.id),\n height: view.getItemHeight(item.id),\n left: left,\n width: right - left\n };\n};","var barRectangle = require(\"./get_bar_rectangle\");\n\nmodule.exports = function getLinkBox(item, view, config, gantt) {\n if (!gantt.isTaskExists(item.source)) {\n return null;\n }\n\n if (!gantt.isTaskExists(item.target)) {\n return null;\n }\n\n var sourceBox = barRectangle(gantt.getTask(item.source), view, gantt);\n var targetBox = barRectangle(gantt.getTask(item.target), view, gantt);\n\n if (!sourceBox || !targetBox) {\n return null;\n }\n\n var padding = 100;\n var left = Math.min(sourceBox.left, targetBox.left) - padding;\n var right = Math.max(sourceBox.left + sourceBox.width, targetBox.left + targetBox.width) + padding;\n var top = Math.min(sourceBox.top, targetBox.top) - padding;\n var bottom = Math.max(sourceBox.top + sourceBox.height, targetBox.top + targetBox.height) + padding;\n return {\n top: top,\n height: bottom - top,\n bottom: bottom,\n left: left,\n width: right - left,\n right: right\n };\n};","module.exports = function (viewport, box) {\n if (!box) {\n return false;\n }\n\n if (box.left > viewport.x_end || box.left + box.width < viewport.x) {\n return false;\n }\n\n if (box.top > viewport.y_end || box.top + box.height < viewport.y) {\n return false;\n }\n\n return true;\n};","var genericViewPortChecker = require(\"./viewport/is_in_viewport\");\n\nvar isLegacyRender = require(\"./is_legacy_smart_render\");\n\nvar basicGetRectangle = require(\"./viewport/get_grid_row_rectangle\");\n\nvar basicGetRange = require(\"./viewport/get_visible_bars_range\");\n\nvar rendererFactory = function rendererFactory(gantt) {\n //hash of dom elements is needed to redraw single bar/link\n var task_area_pulls = {},\n task_area_renderers = {};\n\n function getView(layer) {\n var view = null;\n\n if (typeof layer.view === \"string\") {\n view = gantt.$ui.getView(layer.view);\n } else if (layer.view) {\n view = layer.view;\n }\n\n return view;\n }\n\n function getRenderer(id, layer, node) {\n if (task_area_renderers[id]) return task_area_renderers[id];\n if (!layer.renderer) gantt.assert(false, \"Invalid renderer call\");\n var renderMethod = null;\n var updateMethod = null;\n var getRectangle = null;\n var renderCallbackMethod = null;\n var specializedViewPortChecker = null;\n\n if (typeof layer.renderer === \"function\") {\n renderMethod = layer.renderer;\n getRectangle = basicGetRectangle;\n } else {\n renderMethod = layer.renderer.render;\n updateMethod = layer.renderer.update;\n renderCallbackMethod = layer.renderer.onrender;\n\n if (layer.renderer.isInViewPort) {\n specializedViewPortChecker = layer.renderer.isInViewPort;\n } else {\n getRectangle = layer.renderer.getRectangle;\n }\n\n if (!getRectangle && getRectangle !== null) {\n getRectangle = basicGetRectangle;\n }\n }\n\n var filter = layer.filter;\n if (node) node.setAttribute(gantt.config.layer_attribute, true);\n task_area_renderers[id] = {\n render_item: function render_item(item, container, viewPort, layerView, viewConfig) {\n container = container || node;\n\n if (filter) {\n if (!filter(item)) {\n this.remove_item(item.id);\n return;\n }\n }\n\n var view = layerView || getView(layer);\n var config = viewConfig || (view ? view.$getConfig() : null);\n var rendererViewPort = viewPort;\n\n if (!rendererViewPort && config && config.smart_rendering) {\n rendererViewPort = view.getViewPort();\n }\n\n var dom = null;\n\n if (!isLegacyRender(gantt) && (getRectangle || specializedViewPortChecker) && rendererViewPort) {\n var isVisible = false;\n\n if (specializedViewPortChecker) {\n isVisible = specializedViewPortChecker(item, rendererViewPort, view, config, gantt);\n } else {\n isVisible = genericViewPortChecker(rendererViewPort, getRectangle(item, view, config, gantt));\n }\n\n if (isVisible) {\n dom = renderMethod.call(gantt, item, view, config, rendererViewPort);\n }\n } else {\n dom = renderMethod.call(gantt, item, view, config, rendererViewPort);\n }\n\n this.append(item, dom, container);\n var useBuffer = container.nodeType == 11; //DocumentFragment\n\n if (renderCallbackMethod && !useBuffer && dom) {\n renderCallbackMethod.call(gantt, item, dom, view);\n }\n },\n clear: function clear(container) {\n this.rendered = task_area_pulls[id] = {};\n if (!layer.append) this.clear_container(container);\n },\n clear_container: function clear_container(container) {\n container = container || node;\n\n if (container) {\n container.innerHTML = \"\";\n }\n },\n get_visible_range: function get_visible_range(datastore) {\n var view = getView(layer);\n var viewport;\n var viewConfig = view ? view.$getConfig() : null;\n\n if (viewConfig && viewConfig.smart_rendering) {\n viewport = view.getViewPort();\n }\n\n var range;\n\n if (view && viewport) {\n if (typeof layer.renderer === \"function\") {\n range = basicGetRange(gantt, view, viewConfig, datastore, viewport);\n } else if (layer.renderer && layer.renderer.getVisibleRange) {\n range = layer.renderer.getVisibleRange(gantt, view, viewConfig, datastore, viewport);\n }\n }\n\n if (!range) {\n range = {\n start: 0,\n end: datastore.count()\n };\n }\n\n return range;\n },\n prepare_data: function prepare_data(items) {\n if (layer.renderer && layer.renderer.prepareData) {\n return layer.renderer.prepareData(items, gantt, layer);\n }\n },\n render_items: function render_items(items, container) {\n container = container || node;\n var buffer = document.createDocumentFragment();\n this.clear(container);\n var viewPort = null;\n var view = getView(layer);\n var viewConfig = view ? view.$getConfig() : null;\n\n if (viewConfig && viewConfig.smart_rendering) {\n viewPort = view.getViewPort();\n }\n\n for (var i = 0, vis = items.length; i < vis; i++) {\n this.render_item(items[i], buffer, viewPort, view, viewConfig);\n }\n\n container.appendChild(buffer, container);\n var itemsSearch = {};\n items.forEach(function (item) {\n itemsSearch[item.id] = item;\n });\n var renderedItems = {};\n\n if (renderCallbackMethod) {\n var newElements = {};\n\n for (var i in this.rendered) {\n if (!renderedItems[i]) {\n newElements[i] = this.rendered[i];\n renderCallbackMethod.call(gantt, itemsSearch[i], this.rendered[i], view);\n }\n }\n }\n },\n update_items: function update_items(items, container) {\n var view = getView(layer);\n var viewConfig = view ? view.$getConfig() : null;\n\n if (!view || !view.$getConfig().smart_rendering || isLegacyRender(gantt)) {\n return;\n }\n\n if (!this.rendered) {\n return;\n }\n\n if (!(getRectangle || specializedViewPortChecker)) {\n return;\n }\n\n container = container || node;\n var buffer = document.createDocumentFragment();\n var viewPort = null;\n\n if (view) {\n viewPort = view.getViewPort();\n }\n\n var itemsSearch = {};\n items.forEach(function (item) {\n itemsSearch[item.id] = item;\n });\n var renderedItems = {};\n var nodesToRemove = {};\n\n for (var i in this.rendered) {\n nodesToRemove[i] = true;\n renderedItems[i] = true;\n }\n\n var renderCalledFor = {};\n\n for (var i = 0, vis = items.length; i < vis; i++) {\n var item = items[i];\n var itemNode = this.rendered[item.id];\n nodesToRemove[item.id] = false;\n\n if (itemNode && itemNode.parentNode) {\n var isVisible = false;\n\n if (specializedViewPortChecker) {\n isVisible = specializedViewPortChecker(item, viewPort, view, viewConfig, gantt);\n } else {\n isVisible = genericViewPortChecker(viewPort, getRectangle(item, view, viewConfig, gantt));\n }\n\n if (!isVisible) {\n nodesToRemove[item.id] = true;\n } else {\n if (updateMethod) {\n updateMethod.call(gantt, item, itemNode, view, viewConfig, viewPort);\n }\n\n this.restore(item, buffer);\n }\n } else {\n renderCalledFor[items[i].id] = true;\n this.render_item(items[i], buffer, viewPort, view, viewConfig);\n }\n }\n\n for (var i in nodesToRemove) {\n if (nodesToRemove[i]) {\n this.hide(i);\n }\n }\n\n if (buffer.childNodes.length) {\n container.appendChild(buffer, container);\n }\n\n if (renderCallbackMethod) {\n var newElements = {};\n\n for (var i in this.rendered) {\n if (!renderedItems[i] || renderCalledFor[i]) {\n newElements[i] = this.rendered[i];\n renderCallbackMethod.call(gantt, itemsSearch[i], this.rendered[i], view);\n }\n }\n }\n },\n append: function append(item, node, container) {\n if (!this.rendered) {\n return;\n }\n\n if (!node) {\n if (this.rendered[item.id]) {\n this.remove_item(item.id);\n }\n\n return;\n }\n\n if (this.rendered[item.id] && this.rendered[item.id].parentNode) {\n this.replace_item(item.id, node);\n } else {\n container.appendChild(node);\n }\n\n this.rendered[item.id] = node;\n },\n replace_item: function replace_item(item_id, newNode) {\n var item = this.rendered[item_id];\n\n if (item && item.parentNode) {\n item.parentNode.replaceChild(newNode, item);\n }\n\n this.rendered[item_id] = newNode;\n },\n remove_item: function remove_item(item_id) {\n this.hide(item_id);\n delete this.rendered[item_id];\n },\n hide: function hide(item_id) {\n var item = this.rendered[item_id];\n\n if (item && item.parentNode) {\n item.parentNode.removeChild(item);\n }\n },\n restore: function restore(item, container) {\n var dom = this.rendered[item.id];\n\n if (dom) {\n if (!dom.parentNode) {\n this.append(item, dom, container || node);\n }\n } else {\n this.render_item(item, container || node);\n }\n },\n change_id: function change_id(oldid, newid) {\n this.rendered[newid] = this.rendered[oldid];\n delete this.rendered[oldid];\n },\n rendered: task_area_pulls[id],\n node: node,\n destructor: function destructor() {\n this.clear();\n delete task_area_renderers[id];\n delete task_area_pulls[id];\n }\n };\n return task_area_renderers[id];\n }\n\n function clearRenderers() {\n for (var i in task_area_renderers) {\n getRenderer(i).destructor();\n }\n }\n\n return {\n getRenderer: getRenderer,\n clearRenderers: clearRenderers\n };\n};\n\nmodule.exports = rendererFactory;","var renderFactoryProvider = require(\"./render_factory\");\n\nvar utils = require(\"../../../utils/utils\"),\n domHelpers = require(\"../utils/dom_helpers\"),\n isLegacyRender = require(\"./is_legacy_smart_render\");\n\nvar layerFactory = function layerFactory(gantt) {\n var renderFactory = renderFactoryProvider(gantt);\n return {\n createGroup: function createGroup(getContainer, relativeRoot, defaultFilters, initLayer) {\n var renderGroup = {\n tempCollection: [],\n renderers: {},\n container: getContainer,\n filters: [],\n getLayers: function getLayers() {\n this._add(); // add pending layers\n\n\n var res = [];\n\n for (var i in this.renderers) {\n res.push(this.renderers[i]);\n }\n\n return res;\n },\n getLayer: function getLayer(id) {\n return this.renderers[id];\n },\n _add: function _add(layer) {\n if (layer) {\n layer.id = layer.id || utils.uid();\n this.tempCollection.push(layer);\n }\n\n var container = this.container();\n var pending = this.tempCollection;\n\n for (var i = 0; i < pending.length; i++) {\n layer = pending[i];\n if (!this.container() && !(layer && layer.container && domHelpers.isChildOf(layer.container, document.body))) continue;\n var node = layer.container,\n id = layer.id,\n topmost = layer.topmost;\n\n if (!node.parentNode) {\n //insert on top or below the tasks\n if (topmost) {\n container.appendChild(node);\n } else {\n var rel = relativeRoot ? relativeRoot() : container.firstChild; // GS-1274: if we don't add the second check, Gantt stops working if\n // we add the task layer without the timeline and switch to a layout with the timeline\n\n if (rel && rel.parentNode == container) container.insertBefore(node, rel);else container.appendChild(node);\n }\n }\n\n this.renderers[id] = renderFactory.getRenderer(id, layer, node);\n\n if (initLayer) {\n initLayer(layer, gantt);\n }\n\n this.tempCollection.splice(i, 1);\n i--;\n }\n },\n addLayer: function addLayer(config) {\n if (config) {\n if (typeof config == \"function\") {\n config = {\n renderer: config\n };\n }\n\n if (config.filter === undefined) {\n config.filter = mergeFilters(defaultFilters || []);\n } else if (config.filter instanceof Array) {\n config.filter.push(defaultFilters);\n config.filter = mergeFilters(config.filter);\n }\n\n if (!config.container) {\n config.container = document.createElement(\"div\");\n }\n\n var self = this;\n\n config.requestUpdate = function () {\n if (gantt.config.smart_rendering && !isLegacyRender(gantt)) {\n if (self.renderers[config.id]) {\n self.onUpdateRequest(self.renderers[config.id]);\n }\n }\n };\n }\n\n this._add(config);\n\n return config ? config.id : undefined;\n },\n onUpdateRequest: function onUpdateRequest(layer) {},\n eachLayer: function eachLayer(code) {\n for (var i in this.renderers) {\n code(this.renderers[i]);\n }\n },\n removeLayer: function removeLayer(id) {\n if (!this.renderers[id]) return;\n this.renderers[id].destructor();\n delete this.renderers[id];\n },\n clear: function clear() {\n for (var i in this.renderers) {\n this.renderers[i].destructor();\n }\n\n this.renderers = {};\n } //,\n //prepareConfig: prepareConfig\n\n };\n gantt.attachEvent(\"onDestroy\", function () {\n renderGroup.clear();\n renderGroup = null;\n });\n return renderGroup;\n }\n };\n};\n\nfunction mergeFilters(filter_methods) {\n if (!(filter_methods instanceof Array)) {\n filter_methods = Array.prototype.slice.call(arguments, 0);\n }\n\n return function (obj) {\n var res = true;\n\n for (var i = 0, len = filter_methods.length; i < len; i++) {\n var filter_method = filter_methods[i];\n\n if (filter_method) {\n res = res && filter_method(obj.id, obj) !== false;\n }\n }\n\n return res;\n };\n}\n\nmodule.exports = layerFactory;","var createLayerFactory = require(\"./render/layer_engine\");\n\nvar getVisibleTaskRange = require(\"./render/viewport/get_visible_bars_range\");\n\nvar getVisibleLinksRange = require(\"./render/viewport/get_visible_link_range\");\n\nvar isLinkInViewport = require(\"./render/viewport/is_link_in_viewport\");\n\nfunction initLayer(layer, gantt) {\n if (!layer.view) {\n return;\n }\n\n var view = layer.view;\n\n if (typeof view === \"string\") {\n view = gantt.$ui.getView(view);\n }\n\n if (view && view.attachEvent) {\n view.attachEvent(\"onScroll\", function () {\n var state = gantt.$services.getService(\"state\"); // don't repaint if we're inside batchUpdate, a complete repaint will be called afterwards\n\n if (!state.getState(\"batchUpdate\").batch_update && !view.$config.$skipSmartRenderOnScroll) {\n if (layer.requestUpdate) {\n layer.requestUpdate();\n }\n }\n });\n }\n}\n\nvar createLayerEngine = function createLayerEngine(gantt) {\n var factory = createLayerFactory(gantt);\n return {\n getDataRender: function getDataRender(name) {\n return gantt.$services.getService(\"layer:\" + name) || null;\n },\n createDataRender: function createDataRender(config) {\n var name = config.name,\n defaultContainer = config.defaultContainer,\n previusSiblingContainer = config.defaultContainerSibling;\n var layers = factory.createGroup(defaultContainer, previusSiblingContainer, function (itemId, item) {\n if (layers.filters) {\n for (var i = 0; i < layers.filters.length; i++) {\n if (layers.filters[i](itemId, item) === false) {\n return false;\n }\n }\n } else {\n return true;\n }\n }, initLayer);\n gantt.$services.setService(\"layer:\" + name, function () {\n return layers;\n });\n gantt.attachEvent(\"onGanttReady\", function () {\n layers.addLayer(); // init layers on start\n });\n return layers;\n },\n init: function init() {\n var taskLayers = this.createDataRender({\n name: \"task\",\n defaultContainer: function defaultContainer() {\n if (gantt.$task_data) {\n return gantt.$task_data;\n } else if (gantt.$ui.getView(\"timeline\")) {\n return gantt.$ui.getView(\"timeline\").$task_data;\n }\n },\n defaultContainerSibling: function defaultContainerSibling() {\n if (gantt.$task_links) {\n return gantt.$task_links;\n } else if (gantt.$ui.getView(\"timeline\")) {\n return gantt.$ui.getView(\"timeline\").$task_links;\n }\n },\n filter: function filter(item) {}\n }, gantt);\n var linkLayers = this.createDataRender({\n name: \"link\",\n defaultContainer: function defaultContainer() {\n if (gantt.$task_data) {\n return gantt.$task_data;\n } else if (gantt.$ui.getView(\"timeline\")) {\n return gantt.$ui.getView(\"timeline\").$task_data;\n }\n }\n }, gantt);\n return {\n addTaskLayer: function addTaskLayer(config) {\n if (typeof config === \"function\") {\n config = {\n renderer: {\n render: config,\n getVisibleRange: getVisibleTaskRange\n }\n };\n } else {\n if (config.renderer && !config.renderer.getVisibleRange) {\n config.renderer.getVisibleRange = getVisibleTaskRange;\n }\n }\n\n config.view = \"timeline\";\n return taskLayers.addLayer(config);\n },\n _getTaskLayers: function _getTaskLayers() {\n return taskLayers.getLayers();\n },\n removeTaskLayer: function removeTaskLayer(id) {\n taskLayers.removeLayer(id);\n },\n _clearTaskLayers: function _clearTaskLayers() {\n taskLayers.clear();\n },\n addLinkLayer: function addLinkLayer(config) {\n if (typeof config === \"function\") {\n config = {\n renderer: {\n render: config,\n getVisibleRange: getVisibleLinksRange\n }\n };\n } else {\n if (config.renderer && !config.renderer.getVisibleRange) {\n config.renderer.getVisibleRange = getVisibleLinksRange;\n }\n }\n\n config.view = \"timeline\";\n\n if (config && config.renderer) {\n if (!config.renderer.getRectangle && !config.renderer.isInViewPort) {\n config.renderer.isInViewPort = isLinkInViewport;\n }\n }\n\n return linkLayers.addLayer(config);\n },\n _getLinkLayers: function _getLinkLayers() {\n return linkLayers.getLayers();\n },\n removeLinkLayer: function removeLinkLayer(id) {\n linkLayers.removeLayer(id);\n },\n _clearLinkLayers: function _clearLinkLayers() {\n linkLayers.clear();\n }\n };\n }\n };\n};\n\nmodule.exports = createLayerEngine;","var domHelpers = require(\"./utils/dom_helpers\");\n\nvar createMouseHandler = function (domHelpers) {\n return function (gantt) {\n var eventHandlers = {\n \"click\": {},\n \"doubleclick\": {},\n \"contextMenu\": {}\n };\n\n function addEventTarget(event, className, handler, root) {\n if (!eventHandlers[event][className]) {\n eventHandlers[event][className] = [];\n }\n\n eventHandlers[event][className].push({\n handler: handler,\n root: root\n });\n }\n\n function callHandler(eventName, className, root, args) {\n var handlers = eventHandlers[eventName][className];\n\n if (handlers) {\n for (var i = 0; i < handlers.length; i++) {\n if (!(root || handlers[i].root) || handlers[i].root === root) {\n handlers[i].handler.apply(this, args);\n }\n }\n }\n }\n\n function onClick(e) {\n e = e || window.event;\n var id = gantt.locate(e);\n var handlers = findEventHandlers(e, eventHandlers.click);\n var res = true;\n\n if (id !== null) {\n res = !gantt.checkEvent(\"onTaskClick\") || gantt.callEvent(\"onTaskClick\", [id, e]);\n } else {\n gantt.callEvent(\"onEmptyClick\", [e]);\n }\n\n if (res) {\n var default_action = callEventHandlers(handlers, e, id);\n if (!default_action) return; // GS-1025: if we don't do that, the dropdown or date select will be closed for unselected tasks\n // GS-1078: or for the built-in select inline editor\n\n switch (e.target.nodeName) {\n case \"SELECT\":\n case 'INPUT':\n return;\n } //allow task selection when the multiselect plugin is not enabled\n\n\n if (id && gantt.getTask(id) && !gantt._multiselect && gantt.config.select_task) {\n gantt.selectTask(id);\n }\n }\n }\n\n function onContextMenu(e) {\n e = e || window.event;\n var src = e.target || e.srcElement,\n taskId = gantt.locate(src),\n linkId = gantt.locate(src, gantt.config.link_attribute);\n var res = !gantt.checkEvent(\"onContextMenu\") || gantt.callEvent(\"onContextMenu\", [taskId, linkId, e]);\n\n if (!res) {\n if (e.preventDefault) e.preventDefault();else e.returnValue = false;\n }\n\n return res;\n }\n\n function findEventHandlers(e, hash) {\n var trg = e.target || e.srcElement;\n var handlers = [];\n\n while (trg) {\n var css = domHelpers.getClassName(trg);\n\n if (css) {\n css = css.split(\" \");\n\n for (var i = 0; i < css.length; i++) {\n if (!css[i]) continue;\n\n if (hash[css[i]]) {\n var delegateHandlers = hash[css[i]];\n\n for (var h = 0; h < delegateHandlers.length; h++) {\n if (delegateHandlers[h].root) {\n if (!domHelpers.isChildOf(trg, delegateHandlers[h].root)) {\n continue;\n }\n }\n\n handlers.push(delegateHandlers[h].handler);\n }\n }\n }\n }\n\n trg = trg.parentNode;\n }\n\n return handlers;\n }\n\n function callEventHandlers(handlers, e, id) {\n var res = true;\n\n for (var i = 0; i < handlers.length; i++) {\n var handlerResult = handlers[i].call(gantt, e, id, e.target || e.srcElement);\n res = res && !(typeof handlerResult != \"undefined\" && handlerResult !== true);\n }\n\n return res;\n }\n\n function onDoubleClick(e) {\n e = e || window.event;\n var id = gantt.locate(e);\n var handlers = findEventHandlers(e, eventHandlers.doubleclick); // when doubleclick fired not on task, id === null\n\n var res = !gantt.checkEvent(\"onTaskDblClick\") || id === null || gantt.callEvent(\"onTaskDblClick\", [id, e]);\n\n if (res) {\n var default_action = callEventHandlers(handlers, e, id);\n if (!default_action) return;\n\n if (id !== null && gantt.getTask(id)) {\n if (res && gantt.config.details_on_dblclick && !gantt.isReadonly(id)) {\n gantt.showLightbox(id);\n }\n }\n }\n }\n\n function onMouseMove(e) {\n if (gantt.checkEvent(\"onMouseMove\")) {\n var id = gantt.locate(e);\n gantt._last_move_event = e;\n gantt.callEvent(\"onMouseMove\", [id, e]);\n }\n }\n\n function detach(eventName, className, handler, root) {\n if (eventHandlers[eventName] && eventHandlers[eventName][className]) {\n var handlers = eventHandlers[eventName];\n var elementHandlers = handlers[className];\n\n for (var i = 0; i < elementHandlers.length; i++) {\n if (elementHandlers[i].root == root) {\n elementHandlers.splice(i, 1);\n i--;\n }\n }\n\n if (!elementHandlers.length) {\n delete handlers[className];\n }\n }\n }\n\n var domEvents = gantt._createDomEventScope();\n\n function reset(node) {\n domEvents.detachAll();\n\n if (node) {\n domEvents.attach(node, \"click\", onClick);\n domEvents.attach(node, \"dblclick\", onDoubleClick);\n domEvents.attach(node, \"mousemove\", onMouseMove);\n domEvents.attach(node, \"contextmenu\", onContextMenu);\n }\n }\n\n return {\n reset: reset,\n global: function global(event, classname, handler) {\n addEventTarget(event, classname, handler, null);\n },\n delegate: addEventTarget,\n detach: detach,\n callHandler: callHandler,\n onDoubleClick: onDoubleClick,\n onMouseMove: onMouseMove,\n onContextMenu: onContextMenu,\n onClick: onClick,\n destructor: function destructor() {\n reset();\n eventHandlers = null;\n domEvents = null;\n }\n };\n };\n}(domHelpers);\n\nmodule.exports = {\n init: createMouseHandler\n};","var utils = require(\"../../utils/utils\");\n\nfunction extendSettings(store, parentSettings) {\n var own = this.$config[store];\n\n if (own) {\n if (!own.$extendedConfig) {\n own.$extendedConfig = true;\n Object.setPrototypeOf(own, parentSettings);\n }\n\n return own;\n } else {\n return parentSettings;\n }\n}\n\nvar configurable = function configurable(parentView) {\n var parentConfig, parentTemplates;\n return {\n $getConfig: function $getConfig() {\n if (!parentConfig) {\n parentConfig = parentView ? parentView.$getConfig() : this.$gantt.config;\n }\n\n if (!this.$config.config) {\n return parentConfig;\n } else {\n return extendSettings.call(this, \"config\", parentConfig);\n }\n },\n $getTemplates: function $getTemplates() {\n if (!parentTemplates) {\n parentTemplates = parentView ? parentView.$getTemplates() : this.$gantt.templates;\n }\n\n if (!this.$config.templates) {\n return parentTemplates;\n } else {\n return extendSettings.call(this, \"templates\", parentTemplates);\n }\n }\n };\n};\n\nmodule.exports = function (obj, parent) {\n utils.mixin(obj, configurable(parent));\n};","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar utils = require(\"../../utils/utils\"),\n configurable = require(\"./configurable\");\n\nvar uiFactory = function createFactory(gantt) {\n var views = {};\n\n function ui(cell, parentView) {\n var content;\n var view = \"cell\";\n\n if (cell.view) {\n view = \"viewcell\";\n } else if (cell.resizer) {\n view = \"resizer\";\n } else if (cell.rows || cell.cols) {\n view = \"layout\";\n } else if (cell.views) {\n view = \"multiview\";\n }\n\n content = createView.call(this, view, null, cell, parentView);\n return content;\n }\n\n var createdViews = {};\n\n function createView(name, parent, config, parentView) {\n var creator = views[name];\n if (!creator || !creator.create) return false;\n\n if (name == \"resizer\" && !config.mode) {\n if (parentView.$config.cols) {\n config.mode = \"x\";\n } else {\n config.mode = \"y\";\n }\n }\n\n if (name == \"viewcell\" && config.view == \"scrollbar\" && !config.scroll) {\n if (parentView.$config.cols) {\n config.scroll = \"y\";\n } else {\n config.scroll = \"x\";\n }\n }\n\n var config = utils.copy(config);\n\n if (!config.id && !createdViews[config.view]) {\n config.id = config.view;\n }\n\n if (config.id && !config.css) {\n config.css = config.id + \"_cell\";\n }\n\n var view = new creator.create(parent, config, this, gantt);\n\n if (creator.configure) {\n creator.configure(view);\n }\n\n configurable(view, parentView);\n\n if (!view.$id) {\n view.$id = config.id || gantt.uid();\n }\n\n if (!view.$parent && _typeof(parent) == \"object\") {\n view.$parent = parent;\n }\n\n if (!view.$config) {\n view.$config = config;\n }\n\n if (createdViews[view.$id]) {\n view.$id = gantt.uid();\n }\n\n createdViews[view.$id] = view;\n return view;\n }\n\n function reset() {\n createdViews = {};\n }\n\n function register(name, viewConstructor, configure) {\n views[name] = {\n create: viewConstructor,\n configure: configure\n };\n }\n\n function getView(id) {\n return createdViews[id];\n }\n\n var factory = {\n initUI: ui,\n reset: reset,\n registerView: register,\n createView: createView,\n getView: getView\n };\n return factory;\n};\n\nmodule.exports = {\n createFactory: uiFactory\n};","var uiFactory = require(\"./ui_factory\"),\n mouseEvents = require(\"./mouse\"),\n createLayers = require(\"./gantt_layers\"),\n Cell = require(\"./layout/cell\"),\n Layout = require(\"./layout/layout\"),\n ViewLayout = require(\"./layout/view_layout\"),\n ViewCell = require(\"./layout/view_cell\"),\n Resizer = require(\"./layout/resizer_cell\"),\n Scrollbar = require(\"./layout/scrollbar_cell\"),\n Timeline = require(\"./timeline/timeline\"),\n Grid = require(\"./grid/grid\"),\n ResourceGrid = require(\"./grid/resource_grid\"),\n ResourceTimeline = require(\"./timeline/resource_timeline\"),\n ResourceHistogram = require(\"./timeline/resource_histogram\");\n\nvar gridEditorsFactory = require(\"./grid/editors/controller\");\n\nvar renderTaskBar = require(\"./render/task_bar_smart_render\"),\n renderSplitTaskBar = require(\"./render/task_split_render\"),\n renderRollupTaskBar = require(\"./render/task_rollup_render\"),\n renderTaskBg = require(\"./render/task_bg_render\"),\n renderLink = require(\"./render/link_render\"),\n gridRenderer = require(\"./render/task_grid_line_render\"),\n resourceMatrixRenderer = require(\"./render/resource_matrix_render\"),\n resourceHistogramRenderer = require(\"./render/resource_histogram_render\"),\n gridTaskRowResizerRenderer = require(\"./render/task_grid_row_resize_render\");\n\nvar mainGridInitializer = require(\"./grid/main_grid_initializer\");\n\nvar mainTimelineInitializer = require(\"./timeline/main_timeline_initializer\");\n\nvar mainLayoutInitializer = require(\"./main_layout_initializer\");\n\nfunction initUI(gantt) {\n function attachInitializer(view, initializer) {\n var ext = initializer(gantt);\n if (ext.onCreated) ext.onCreated(view);\n view.attachEvent(\"onReady\", function () {\n if (ext.onInitialized) ext.onInitialized(view);\n });\n view.attachEvent(\"onDestroy\", function () {\n if (ext.onDestroyed) ext.onDestroyed(view);\n });\n }\n\n var factory = uiFactory.createFactory(gantt);\n factory.registerView(\"cell\", Cell);\n factory.registerView(\"resizer\", Resizer);\n factory.registerView(\"scrollbar\", Scrollbar);\n factory.registerView(\"layout\", Layout, function (view) {\n var id = view.$config ? view.$config.id : null;\n\n if (id === \"main\") {\n attachInitializer(view, mainLayoutInitializer);\n }\n });\n factory.registerView(\"viewcell\", ViewCell);\n factory.registerView(\"multiview\", ViewLayout);\n factory.registerView(\"timeline\", Timeline, function (view) {\n var id = view.$config ? view.$config.id : null;\n\n if (id === \"timeline\" || view.$config.bind == \"task\") {\n attachInitializer(view, mainTimelineInitializer);\n }\n });\n factory.registerView(\"grid\", Grid, function (view) {\n var id = view.$config ? view.$config.id : null;\n\n if (id === \"grid\" || view.$config.bind == \"task\") {\n attachInitializer(view, mainGridInitializer);\n }\n });\n factory.registerView(\"resourceGrid\", ResourceGrid);\n factory.registerView(\"resourceTimeline\", ResourceTimeline);\n factory.registerView(\"resourceHistogram\", ResourceHistogram);\n var layersEngine = createLayers(gantt);\n var inlineEditors = gridEditorsFactory(gantt);\n gantt.ext.inlineEditors = inlineEditors;\n gantt.ext._inlineEditors = inlineEditors;\n inlineEditors.init(gantt);\n return {\n factory: factory,\n mouseEvents: mouseEvents.init(gantt),\n layersApi: layersEngine.init(),\n render: {\n gridLine: function gridLine() {\n return gridRenderer(gantt);\n },\n taskBg: function taskBg() {\n return renderTaskBg(gantt);\n },\n taskBar: function taskBar() {\n return renderTaskBar(gantt);\n },\n taskRollupBar: function taskRollupBar() {\n return renderRollupTaskBar(gantt);\n },\n taskSplitBar: function taskSplitBar() {\n return renderSplitTaskBar(gantt);\n },\n link: function link() {\n return renderLink(gantt);\n },\n resourceRow: function resourceRow() {\n return resourceMatrixRenderer(gantt);\n },\n resourceHistogram: function resourceHistogram() {\n return resourceHistogramRenderer(gantt);\n },\n gridTaskRowResizer: function gridTaskRowResizer() {\n return gridTaskRowResizerRenderer(gantt);\n }\n },\n layersService: {\n getDataRender: function getDataRender(name) {\n return layersEngine.getDataRender(name, gantt);\n },\n createDataRender: function createDataRender(config) {\n return layersEngine.createDataRender(config, gantt);\n }\n }\n };\n}\n\nmodule.exports = {\n init: initUI\n};","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar utils = require(\"../../utils/utils\");\n\nvar domHelpers = require(\"./utils/dom_helpers\");\n\nmodule.exports = function (gantt) {\n var boxAttribute = \"data-dhxbox\";\n var _dhx_msg_cfg = null;\n\n function callback(config, result) {\n var usercall = config.callback;\n modalBox.hide(config.box);\n _dhx_msg_cfg = config.box = null;\n if (usercall) usercall(result);\n }\n\n function modal_key(event) {\n if (_dhx_msg_cfg) {\n var code = event.which || event.keyCode;\n var preventDefault = false;\n\n if (messageBox.keyboard) {\n if (code == 13 || code == 32) {\n // default behavior is to confirm/submit popup on space/enter\n // if browser focus is set on button element - do button click instead of default behavior\n var target = event.target || event.srcElement;\n\n if (domHelpers.getClassName(target).indexOf(\"gantt_popup_button\") > -1 && target.click) {\n target.click();\n } else {\n callback(_dhx_msg_cfg, true);\n preventDefault = true;\n }\n }\n\n if (code == 27) {\n callback(_dhx_msg_cfg, false);\n preventDefault = true;\n }\n }\n\n if (preventDefault) {\n if (event.preventDefault) {\n event.preventDefault();\n }\n\n return !(event.cancelBubble = true);\n }\n\n return;\n }\n }\n\n var eventElement = domHelpers.getRootNode(gantt.$root) || document;\n gantt.event(eventElement, \"keydown\", modal_key, true);\n\n function modality(mode) {\n if (!modality.cover) {\n modality.cover = document.createElement(\"div\"); //necessary for IE only\n\n modality.cover.onkeydown = modal_key;\n modality.cover.className = \"dhx_modal_cover\";\n document.body.appendChild(modality.cover);\n }\n\n modality.cover.style.display = mode ? \"inline-block\" : \"none\";\n }\n\n function button(text, className, result) {\n var buttonAriaAttrs = gantt._waiAria.messageButtonAttrString(text);\n\n var name = className.toLowerCase().replace(/ /g, \"_\");\n var button_css = \"gantt_\" + name + \"_button\";\n return \"
\" + text + \"
\";\n }\n\n function info(text) {\n if (!messageBox.area) {\n messageBox.area = document.createElement(\"div\");\n messageBox.area.className = \"gantt_message_area\";\n messageBox.area.style[messageBox.position] = \"5px\";\n document.body.appendChild(messageBox.area);\n }\n\n messageBox.hide(text.id);\n var message = document.createElement(\"div\");\n message.innerHTML = \"
\" + text.text + \"
\";\n message.className = \"gantt-info gantt-\" + text.type;\n\n message.onclick = function () {\n messageBox.hide(text.id);\n text = null;\n };\n\n gantt._waiAria.messageInfoAttr(message);\n\n if (messageBox.position == \"bottom\" && messageBox.area.firstChild) messageBox.area.insertBefore(message, messageBox.area.firstChild);else messageBox.area.appendChild(message);\n if (text.expire > 0) messageBox.timers[text.id] = window.setTimeout(function () {\n // GS-1213: We need that when Gantt is destroyed\n if (messageBox) messageBox.hide(text.id);\n }, text.expire);\n messageBox.pull[text.id] = message;\n message = null;\n return text.id;\n }\n\n function getFirstDefined() {\n var values = [].slice.apply(arguments, [0]);\n\n for (var i = 0; i < values.length; i++) {\n if (values[i]) {\n return values[i];\n }\n }\n }\n\n function _boxStructure(config, ok, cancel) {\n var box = document.createElement(\"div\");\n var contentId = utils.uid();\n\n gantt._waiAria.messageModalAttr(box, contentId);\n\n box.className = \" gantt_modal_box gantt-\" + config.type;\n box.setAttribute(boxAttribute, 1);\n var inner = '';\n if (config.width) box.style.width = config.width;\n if (config.height) box.style.height = config.height;\n if (config.title) inner += '
' + config.title + '
';\n inner += '
' + (config.content ? '' : config.text) + '
';\n if (ok) inner += button(getFirstDefined(config.ok, gantt.locale.labels.message_ok, \"OK\"), \"ok\", true);\n if (cancel) inner += button(getFirstDefined(config.cancel, gantt.locale.labels.message_cancel, \"Cancel\"), \"cancel\", false);\n\n if (config.buttons) {\n for (var i = 0; i < config.buttons.length; i++) {\n var btn = config.buttons[i];\n\n if (_typeof(btn) == \"object\") {\n // Support { label:\"Save\", css:\"main_button\", value:\"save\" }\n var label = btn.label;\n var css = btn.css || \"gantt_\" + btn.label.toLowerCase() + \"_button\";\n var value = btn.value || i;\n inner += button(label, css, value);\n } else {\n inner += button(btn, btn, i);\n }\n }\n }\n\n inner += '
';\n box.innerHTML = inner;\n\n if (config.content) {\n var node = config.content;\n if (typeof node == \"string\") node = document.getElementById(node);\n if (node.style.display == 'none') node.style.display = \"\";\n box.childNodes[config.title ? 1 : 0].appendChild(node);\n }\n\n box.onclick = function (event) {\n var source = event.target || event.srcElement;\n if (!source.className) source = source.parentNode;\n\n if (domHelpers.closest(source, \".gantt_popup_button\")) {\n var result = source.getAttribute(\"data-result\");\n result = result == \"true\" || (result == \"false\" ? false : result);\n callback(config, result);\n }\n };\n\n config.box = box;\n if (ok || cancel) _dhx_msg_cfg = config;\n return box;\n }\n\n function _createBox(config, ok, cancel) {\n var box = config.tagName ? config : _boxStructure(config, ok, cancel);\n if (!config.hidden) modality(true);\n document.body.appendChild(box);\n var x = Math.abs(Math.floor(((window.innerWidth || document.documentElement.offsetWidth) - box.offsetWidth) / 2));\n var y = Math.abs(Math.floor(((window.innerHeight || document.documentElement.offsetHeight) - box.offsetHeight) / 2));\n if (config.position == \"top\") box.style.top = \"-3px\";else box.style.top = y + 'px';\n box.style.left = x + 'px'; //necessary for IE only\n\n box.onkeydown = modal_key;\n modalBox.focus(box);\n if (config.hidden) modalBox.hide(box);\n gantt.callEvent(\"onMessagePopup\", [box]);\n return box;\n }\n\n function alertPopup(config) {\n return _createBox(config, true, false);\n }\n\n function confirmPopup(config) {\n return _createBox(config, true, true);\n }\n\n function boxPopup(config) {\n return _createBox(config);\n }\n\n function box_params(text, type, callback) {\n if (_typeof(text) != \"object\") {\n if (typeof type == \"function\") {\n callback = type;\n type = \"\";\n }\n\n text = {\n text: text,\n type: type,\n callback: callback\n };\n }\n\n return text;\n }\n\n function params(text, type, expire, id) {\n if (_typeof(text) != \"object\") text = {\n text: text,\n type: type,\n expire: expire,\n id: id\n };\n text.id = text.id || utils.uid();\n text.expire = text.expire || messageBox.expire;\n return text;\n }\n\n var alertBox = function alertBox() {\n var text = box_params.apply(this, arguments);\n text.type = text.type || \"confirm\";\n return alertPopup(text);\n };\n\n var confirmBox = function confirmBox() {\n var text = box_params.apply(this, arguments);\n text.type = text.type || \"alert\";\n return confirmPopup(text);\n };\n\n var modalBox = function modalBox() {\n var text = box_params.apply(this, arguments);\n text.type = text.type || \"alert\";\n return boxPopup(text);\n };\n\n modalBox.hide = function (node) {\n while (node && node.getAttribute && !node.getAttribute(boxAttribute)) {\n node = node.parentNode;\n }\n\n if (node) {\n node.parentNode.removeChild(node);\n modality(false);\n gantt.callEvent(\"onAfterMessagePopup\", [node]);\n }\n };\n\n modalBox.focus = function (node) {\n setTimeout(function () {\n var focusable = domHelpers.getFocusableNodes(node);\n\n if (focusable.length) {\n if (focusable[0].focus) focusable[0].focus();\n }\n }, 1);\n };\n\n var messageBox = function messageBox(text, type, expire, id) {\n text = params.apply(this, arguments);\n text.type = text.type || \"info\";\n var subtype = text.type.split(\"-\")[0];\n\n switch (subtype) {\n case \"alert\":\n return alertPopup(text);\n\n case \"confirm\":\n return confirmPopup(text);\n\n case \"modalbox\":\n return boxPopup(text);\n\n default:\n return info(text);\n }\n };\n\n messageBox.seed = new Date().valueOf();\n messageBox.uid = utils.uid;\n messageBox.expire = 4000;\n messageBox.keyboard = true;\n messageBox.position = \"top\";\n messageBox.pull = {};\n messageBox.timers = {};\n\n messageBox.hideAll = function () {\n for (var key in messageBox.pull) {\n messageBox.hide(key);\n }\n };\n\n messageBox.hide = function (id) {\n var obj = messageBox.pull[id];\n\n if (obj && obj.parentNode) {\n window.setTimeout(function () {\n obj.parentNode.removeChild(obj);\n obj = null;\n }, 2000);\n obj.className += \" hidden\";\n if (messageBox.timers[id]) window.clearTimeout(messageBox.timers[id]);\n delete messageBox.pull[id];\n }\n };\n\n var popups = [];\n gantt.attachEvent(\"onMessagePopup\", function (box) {\n popups.push(box);\n });\n gantt.attachEvent(\"onAfterMessagePopup\", function (box) {\n for (var i = 0; i < popups.length; i++) {\n if (popups[i] === box) {\n popups.splice(i, 1);\n i--;\n }\n }\n });\n gantt.attachEvent(\"onDestroy\", function () {\n if (modality.cover && modality.cover.parentNode) {\n modality.cover.parentNode.removeChild(modality.cover);\n }\n\n for (var i = 0; i < popups.length; i++) {\n if (popups[i].parentNode) {\n popups[i].parentNode.removeChild(popups[i]);\n }\n }\n\n popups = null;\n\n if (messageBox.area && messageBox.area.parentNode) {\n messageBox.area.parentNode.removeChild(messageBox.area);\n }\n\n messageBox = null;\n });\n return {\n alert: alertBox,\n confirm: confirmBox,\n message: messageBox,\n modalbox: modalBox\n };\n};","module.exports = function (gantt) {\n var utils = require(\"../utils/utils\");\n\n var env = require(\"../utils/env\");\n\n var isHeadless = require(\"../utils/is_headless\");\n\n if (!env.isNode) {\n var domHelpers = require(\"./ui/utils/dom_helpers\");\n\n var codeHelpers = require(\"../utils/helpers\");\n\n gantt.utils = {\n arrayFind: codeHelpers.arrayFind,\n dom: domHelpers\n };\n\n var domEvents = require(\"./ui/utils/dom_event_scope\")();\n\n gantt.event = domEvents.attach;\n gantt.eventRemove = domEvents.detach;\n gantt._eventRemoveAll = domEvents.detachAll;\n gantt._createDomEventScope = domEvents.extend;\n utils.mixin(gantt, require(\"./ui/message\")(gantt));\n\n var uiApi = require(\"./ui/index\").init(gantt);\n\n gantt.$ui = uiApi.factory;\n gantt.$ui.layers = uiApi.render;\n gantt.$mouseEvents = uiApi.mouseEvents;\n gantt.$services.setService(\"mouseEvents\", function () {\n return gantt.$mouseEvents;\n });\n gantt.mixin(gantt, uiApi.layersApi);\n\n require(\"./data_task_layers\")(gantt);\n\n gantt.$services.setService(\"layers\", function () {\n return uiApi.layersService;\n });\n\n var createLayoutFacade = require(\"./facades/layout\");\n\n gantt.mixin(gantt, createLayoutFacade());\n\n require(\"./ui/skin\")(gantt);\n\n require(\"../css/skins/skyblue\")(gantt);\n\n require(\"../css/skins/meadow\")(gantt);\n\n require(\"../css/skins/terrace\")(gantt);\n\n require(\"../css/skins/broadway\")(gantt);\n\n require(\"../css/skins/material\")(gantt);\n\n require(\"../css/skins/contrast_black\")(gantt);\n\n require(\"../css/skins/contrast_white\")(gantt);\n\n require(\"./ui/plugins\")(gantt);\n\n require(\"./ui/touch\")(gantt);\n\n require(\"./ui/lightbox\")(gantt);\n\n require(\"./ui/lightbox/lightbox_optional_time\")(gantt);\n\n require(\"./ui/wai_aria\")(gantt);\n\n gantt.locate = function (e) {\n var trg = domHelpers.getTargetNode(e); // ignore empty rows/cells of the timeline\n\n if (domHelpers.closest(trg, \".gantt_task_row\")) {\n return null;\n }\n\n var targetAttribute = arguments[1] || this.config.task_attribute;\n var node = domHelpers.locateAttribute(trg, targetAttribute);\n\n if (node) {\n return node.getAttribute(targetAttribute);\n } else {\n return null;\n }\n };\n\n gantt._locate_css = function (e, classname, strict) {\n return domHelpers.locateClassName(e, classname, strict);\n };\n\n gantt._locateHTML = function (e, attribute) {\n return domHelpers.locateAttribute(e, attribute || this.config.task_attribute);\n };\n }\n\n gantt.attachEvent(\"onParse\", function () {\n if (!isHeadless(gantt)) {\n gantt.attachEvent(\"onGanttRender\", function () {\n if (gantt.config.initial_scroll) {\n var firstTask = gantt.getTaskByIndex(0);\n var id = firstTask ? firstTask.id : gantt.config.root_id; // GS-1450. Don't scroll to the task if there is no timeline\n\n if (gantt.isTaskExists(id) && gantt.$task && gantt.utils.dom.isChildOf(gantt.$task, gantt.$container)) {\n gantt.showTask(id);\n }\n }\n }, {\n once: true\n });\n }\n });\n gantt.attachEvent(\"onBeforeGanttReady\", function () {\n if (!this.config.scroll_size) this.config.scroll_size = domHelpers.getScrollSize() || 1;\n\n if (!isHeadless(gantt)) {\n // detach listeners before clearing old DOM, possible IE errors when accessing detached nodes\n this._eventRemoveAll();\n\n this.$mouseEvents.reset();\n this.resetLightbox();\n }\n }); // GS-1261: scroll the views to the right side when RTL is enabled\n\n gantt.attachEvent(\"onGanttReady\", function () {\n if (!isHeadless(gantt) && gantt.config.rtl) {\n gantt.$layout.getCellsByType(\"viewCell\").forEach(function (cell) {\n var attachedScrollbar = cell.$config.scrollX;\n if (!attachedScrollbar) return;\n var scrollbar = gantt.$ui.getView(attachedScrollbar);\n if (scrollbar) scrollbar.scrollTo(scrollbar.$config.scrollSize, 0);\n });\n }\n }); // GS-1649: check if extensions are connected via files\n\n gantt.attachEvent(\"onGanttReady\", function () {\n if (!isHeadless(gantt)) {\n var activePlugins = gantt.plugins();\n var availablePlugins = {\n auto_scheduling: gantt.autoSchedule,\n click_drag: gantt.ext.clickDrag,\n critical_path: gantt.isCriticalTask,\n drag_timeline: gantt.ext.dragTimeline,\n export_api: gantt.exportToPDF,\n fullscreen: gantt.ext.fullscreen,\n grouping: gantt.groupBy,\n keyboard_navigation: gantt.ext.keyboardNavigation,\n marker: gantt.addMarker,\n multiselect: gantt.eachSelectedTask,\n overlay: gantt.ext.overlay,\n quick_info: gantt.templates.quick_info_content,\n tooltip: gantt.ext.tooltips,\n undo: gantt.undo\n };\n\n for (var plugin in availablePlugins) {\n if (availablePlugins[plugin] && !activePlugins[plugin]) {\n // eslint-disable-next-line no-console\n console.warn(\"You connected the '\".concat(plugin, \"' extension via an obsolete file. \\nTo fix it, you need to remove the obsolete file and connect the extension via the plugins method: https://docs.dhtmlx.com/gantt/api__gantt_plugins.html\"));\n }\n }\n }\n });\n};","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Січень\", \"Лютий\", \"Березень\", \"Квітень\", \"Травень\", \"Червень\", \"Липень\", \"Серпень\", \"Вересень\", \"Жовтень\", \"Листопад\", \"Грудень\"],\r\n\t\tmonth_short: [\"Січ\", \"Лют\", \"Бер\", \"Кві\", \"Тра\", \"Чер\", \"Лип\", \"Сер\", \"Вер\", \"Жов\", \"Лис\", \"Гру\"],\r\n\t\tday_full: [\"Неділя\", \"Понеділок\", \"Вівторок\", \"Середа\", \"Четвер\", \"П'ятниця\", \"Субота\"],\r\n\t\tday_short: [\"Нед\", \"Пон\", \"Вів\", \"Сер\", \"Чет\", \"Птн\", \"Суб\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Нове завдання\",\r\n\t\ticon_save: \"Зберегти\",\r\n\t\ticon_cancel: \"Відміна\",\r\n\t\ticon_details: \"Деталі\",\r\n\t\ticon_edit: \"Редагувати\",\r\n\t\ticon_delete: \"Вилучити\",\r\n\t\tconfirm_closing: \"\", // Ваші зміни втратяться. Ви впевнені ?\r\n\t\tconfirm_deleting: \"Подія вилучиться назавжди. Ви впевнені?\",\r\n\t\tsection_description: \"Опис\",\r\n\t\tsection_time: \"Часовий проміжок\",\r\n\t\tsection_type: \"Тип\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Відміна\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","/*\r\n * updated by @levkar at https://github.com/DHTMLX/gantt/pull/10\r\n */\r\nconst locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Ocak\", \"Şubat\", \"Mart\", \"Nisan\", \"Mayıs\", \"Haziran\", \"Temmuz\", \"Ağustos\", \"Eylül\", \"Ekim\", \"Kasım\", \"Aralık\"],\r\n\t\tmonth_short: [\"Oca\", \"Şub\", \"Mar\", \"Nis\", \"May\", \"Haz\", \"Tem\", \"Ağu\", \"Eyl\", \"Eki\", \"Kas\", \"Ara\"],\r\n\t\tday_full: [\"Pazar\", \"Pazartesi\", \"Salı\", \"Çarşamba\", \"Perşembe\", \"Cuma\", \"Cumartesi\"],\r\n\t\tday_short: [\"Paz\", \"Pzt\", \"Sal\", \"Çar\", \"Per\", \"Cum\", \"Cmt\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Yeni görev\",\r\n\t\ticon_save: \"Kaydet\",\r\n\t\ticon_cancel: \"İptal\",\r\n\t\ticon_details: \"Detaylar\",\r\n\t\ticon_edit: \"Düzenle\",\r\n\t\ticon_delete: \"Sil\",\r\n\t\tconfirm_closing: \"\", // Your changes will be lost, are your sure ?\r\n\t\tconfirm_deleting: \"Görev silinecek, emin misiniz?\",\r\n\t\tsection_description: \"Açıklama\",\r\n\t\tsection_time: \"Zaman Aralığı\",\r\n\t\tsection_type: \"Tip\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Görev Adı\",\r\n\t\tcolumn_start_date: \"Başlangıç\",\r\n\t\tcolumn_duration: \"Süre\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Bağlantı\",\r\n\t\tconfirm_link_deleting: \"silinecek\",\r\n\t\tlink_start: \" (başlangıç)\",\r\n\t\tlink_end: \" (bitiş)\",\r\n\r\n\t\ttype_task: \"Görev\",\r\n\t\ttype_project: \"Proje\",\r\n\t\ttype_milestone: \"Kilometretaşı\",\r\n\r\n\r\n\t\tminutes: \"Dakika\",\r\n\t\thours: \"Saat\",\r\n\t\tdays: \"Gün\",\r\n\t\tweeks: \"Hafta\",\r\n\t\tmonths: \"Ay\",\r\n\t\tyears: \"Yıl\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Ýptal\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","/*\r\n\tTranslation by Peter Eriksson\r\n */\r\nconst locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Januari\", \"Februari\", \"Mars\", \"April\", \"Maj\", \"Juni\", \"Juli\", \"Augusti\", \"September\", \"Oktober\", \"November\", \"December\"],\r\n\t\tmonth_short: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"Maj\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Okt\", \"Nov\", \"Dec\"],\r\n\t\tday_full: [\"Söndag\", \"Måndag\", \"Tisdag\", \"Onsdag\", \"Torsdag\", \"Fredag\", \"Lördag\"],\r\n\t\tday_short: [\"Sön\", \"Mån\", \"Tis\", \"Ons\", \"Tor\", \"Fre\", \"Lör\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Ny uppgift\",\r\n\t\ticon_save: \"Spara\",\r\n\t\ticon_cancel: \"Avbryt\",\r\n\t\ticon_details: \"Detajer\",\r\n\t\ticon_edit: \"Ändra\",\r\n\t\ticon_delete: \"Ta bort\",\r\n\t\tconfirm_closing: \"\",\r\n\t\tconfirm_deleting: \"Är du säker på att du vill ta bort händelsen permanent?\",\r\n\t\tsection_description: \"Beskrivning\",\r\n\t\tsection_time: \"Tid\",\r\n\t\tsection_type: \"Typ\",\r\n\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Uppgiftsnamn\",\r\n\t\tcolumn_start_date: \"Starttid\",\r\n\t\tcolumn_duration: \"Varaktighet\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\r\n\t\tlink: \"Länk\",\r\n\t\tconfirm_link_deleting: \"kommer tas bort\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (slut)\",\r\n\t\ttype_task: \"Uppgift\",\r\n\t\ttype_project: \"Projekt\",\r\n\t\ttype_milestone: \"Milstolpe\",\r\n\r\n\t\tminutes: \"Minuter\",\r\n\t\thours: \"Timmar\",\r\n\t\tdays: \"Dagar\",\r\n\t\tweeks: \"Veckor\",\r\n\t\tmonths: \"Månader\",\r\n\t\tyears: \"År\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Avbryt\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Január\", \"Február\", \"Marec\", \"Apríl\", \"Máj\", \"Jún\", \"Júl\", \"August\", \"September\", \"Október\", \"November\", \"December\"],\r\n\t\tmonth_short: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"Máj\", \"Jún\", \"Júl\", \"Aug\", \"Sept\", \"Okt\", \"Nov\", \"Dec\"],\r\n\t\tday_full: [\"Nedeľa\", \"Pondelok\", \"Utorok\", \"Streda\", \"Štvrtok\", \"Piatok\", \"Sobota\"],\r\n\t\tday_short: [\"Ne\", \"Po\", \"Ut\", \"St\", \"Št\", \"Pi\", \"So\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Nová úloha\",\r\n\t\ticon_save: \"Uložiť\",\r\n\t\ticon_cancel: \"Späť\",\r\n\t\ticon_details: \"Detail\",\r\n\t\ticon_edit: \"Edituj\",\r\n\t\ticon_delete: \"Zmazať\",\r\n\t\tconfirm_closing: \"Vaše zmeny nebudú uložené. Skutočne?\", // Vaše změny budou ztraceny, opravdu ?\r\n\t\tconfirm_deleting: \"Udalosť bude natrvalo vymazaná. Skutočne?\",\r\n\t\tsection_description: \"Poznámky\",\r\n\t\tsection_time: \"Doba platnosti\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Späť\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Januar\", \"Februar\", \"Marec\", \"April\", \"Maj\", \"Junij\", \"Julij\", \"Avgust\", \"September\", \"Oktober\", \"November\", \"December\"],\r\n\t\tmonth_short: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"Maj\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Okt\", \"Nov\", \"Dec\"],\r\n\t\tday_full: [\"Nedelja\", \"Ponedeljek\", \"Torek\", \"Sreda\", \"Četrtek\", \"Petek\", \"Sobota\"],\r\n\t\tday_short: [\"Ned\", \"Pon\", \"Tor\", \"Sre\", \"Čet\", \"Pet\", \"Sob\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Nova naloga\",\r\n\t\ticon_save: \"Shrani\",\r\n\t\ticon_cancel: \"Prekliči\",\r\n\t\ticon_details: \"Podrobnosti\",\r\n\t\ticon_edit: \"Uredi\",\r\n\t\ticon_delete: \"Izbriši\",\r\n\t\tconfirm_closing: \"\", // Spremembe ne bodo shranjene. Želite nadaljevati ?\r\n\t\tconfirm_deleting: \"Dogodek bo izbrisan. Želite nadaljevati?\",\r\n\t\tsection_description: \"Opis\",\r\n\t\tsection_time: \"Časovni okvir\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Prekliči\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Январь\", \"Февраль\", \"Март\", \"Апрель\", \"Maй\", \"Июнь\", \"Июль\", \"Август\", \"Сентябрь\", \"Oктябрь\", \"Ноябрь\", \"Декабрь\"],\r\n\t\tmonth_short: [\"Янв\", \"Фев\", \"Maр\", \"Aпр\", \"Maй\", \"Июн\", \"Июл\", \"Aвг\", \"Сен\", \"Окт\", \"Ноя\", \"Дек\"],\r\n\t\tday_full: [\"Воскресенье\", \"Понедельник\", \"Вторник\", \"Среда\", \"Четверг\", \"Пятница\", \"Суббота\"],\r\n\t\tday_short: [\"Вс\", \"Пн\", \"Вт\", \"Ср\", \"Чт\", \"Пт\", \"Сб\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Новое задание\",\r\n\t\ticon_save: \"Сохранить\",\r\n\t\ticon_cancel: \"Отменить\",\r\n\t\ticon_details: \"Детали\",\r\n\t\ticon_edit: \"Изменить\",\r\n\t\ticon_delete: \"Удалить\",\r\n\t\tconfirm_closing: \"\", // Ваши изменения будут потеряны, продолжить?\r\n\t\tconfirm_deleting: \"Событие будет удалено безвозвратно, продолжить?\",\r\n\t\tsection_description: \"Описание\",\r\n\t\tsection_time: \"Период времени\",\r\n\t\tsection_type: \"Тип\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"ИСР\",\r\n\t\tcolumn_text: \"Задача\",\r\n\t\tcolumn_start_date: \"Начало\",\r\n\t\tcolumn_duration: \"Длительность\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Связь\",\r\n\t\tconfirm_link_deleting: \"будет удалена\",\r\n\t\tlink_start: \" (начало)\",\r\n\t\tlink_end: \" (конец)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Минута\",\r\n\t\thours: \"Час\",\r\n\t\tdays: \"День\",\r\n\t\tweeks: \"Неделя\",\r\n\t\tmonths: \"Месяц\",\r\n\t\tyears: \"Год\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Отменить\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"начните вводить слово для фильтрации\",\r\n\t\tresources_filter_label: \"спрятать не установленные\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","/*\r\n\tTraducere de Ovidiu Lixandru: http://www.madball.ro\r\n */\r\n\r\nconst locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Ianuarie\", \"Februarie\", \"Martie\", \"Aprilie\", \"Mai\", \"Iunie\", \"Iulie\", \"August\", \"Septembrie\", \"Octombrie\", \"November\", \"December\"],\r\n\t\tmonth_short: [\"Ian\", \"Feb\", \"Mar\", \"Apr\", \"Mai\", \"Iun\", \"Iul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"],\r\n\t\tday_full: [\"Duminica\", \"Luni\", \"Marti\", \"Miercuri\", \"Joi\", \"Vineri\", \"Sambata\"],\r\n\t\tday_short: [\"Du\", \"Lu\", \"Ma\", \"Mi\", \"Jo\", \"Vi\", \"Sa\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Sarcina noua\",\r\n\t\ticon_save: \"Salveaza\",\r\n\t\ticon_cancel: \"Anuleaza\",\r\n\t\ticon_details: \"Detalii\",\r\n\t\ticon_edit: \"Editeaza\",\r\n\t\ticon_delete: \"Sterge\",\r\n\t\tconfirm_closing: \"Schimbarile nu vor fi salvate, esti sigur?\",// Your changes will be lost, are your sure ?\r\n\t\tconfirm_deleting: \"Evenimentul va fi sters permanent, esti sigur?\",\r\n\t\tsection_description: \"Descriere\",\r\n\t\tsection_time: \"Interval\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Anuleaza\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","/*\r\n\r\n TRANSLATION BY MATTHEUS PIROVANI RORIZ GONЗALVES\r\n\r\n mattheusroriz@hotmail.com / mattheus.pirovani@gmail.com /\r\n\r\n www.atrixian.com.br\r\n\r\n\r\n Updated by Jorge Albernaz Martins\r\n\r\n jorgefox@hotmail.com\r\n\r\n www.redfox.inf.br\r\n\r\n JorgeFox\r\n\r\n*/\r\n\r\nconst locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Janeiro\", \"Fevereiro\", \"Março\", \"Abril\", \"Maio\", \"Junho\", \"Julho\", \"Agosto\", \"Setembro\", \"Outubro\", \"Novembro\", \"Dezembro\"],\r\n\t\tmonth_short: [\"Jan\", \"Fev\", \"Mar\", \"Abr\", \"Mai\", \"Jun\", \"Jul\", \"Ago\", \"Set\", \"Out\", \"Nov\", \"Dez\"],\r\n\t\tday_full: [\"Domingo\", \"Segunda\", \"Terça\", \"Quarta\", \"Quinta\", \"Sexta\", \"Sábado\"],\r\n\t\tday_short: [\"Dom\", \"Seg\", \"Ter\", \"Qua\", \"Qui\", \"Sex\", \"Sab\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Nova tarefa\",\r\n\t\ticon_save: \"Salvar\",\r\n\t\ticon_cancel: \"Cancelar\",\r\n\t\ticon_details: \"Detalhes\",\r\n\t\ticon_edit: \"Editar\",\r\n\t\ticon_delete: \"Excluir\",\r\n\t\tconfirm_closing: \"\",// Suas alterações serão perdidas, confirme?\r\n\t\tconfirm_deleting: \"As tarefas serão excluidas permanentemente, confirme?\",\r\n\t\tsection_description: \"Descrição\",\r\n\t\tsection_time: \"Período\",\r\n\t\tsection_type: \"Tipo\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"EAP\",\r\n\t\tcolumn_text: \"Nome tarefa\",\r\n\t\tcolumn_start_date: \"Data início\",\r\n\t\tcolumn_duration: \"Duração\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"Será excluído!\",\r\n\t\tlink_start: \" (início)\",\r\n\t\tlink_end: \" (fim)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Projeto\",\r\n\t\ttype_milestone: \"Marco\",\r\n\r\n\r\n\t\tminutes: \"Minutos\",\r\n\t\thours: \"Horas\",\r\n\t\tdays: \"Dias\",\r\n\t\tweeks: \"Semanas\",\r\n\t\tmonths: \"Meses\",\r\n\t\tyears: \"Anos\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Cancelar\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Restrição\",\r\n\t\tconstraint_type: \"Tipo Restrição\",\r\n\t\tconstraint_date: \"Data restrição\",\r\n\t\tasap: \"Mais breve possível\",\r\n\t\talap: \"Mais tarde possível\",\r\n\t\tsnet: \"Não começar antes de\",\r\n\t\tsnlt: \"Não começar depois de\",\r\n\t\tfnet: \"Não terminar antes de\",\r\n\t\tfnlt: \"Não terminar depois de\",\r\n\t\tmso: \"Precisa começar em\",\r\n\t\tmfo: \"Precisa terminar em\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"Tipo de filtros\",\r\n\t\tresources_filter_label: \"Ocultar vazios\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Styczeń\", \"Luty\", \"Marzec\", \"Kwiecień\", \"Maj\", \"Czerwiec\", \"Lipiec\", \"Sierpień\", \"Wrzesień\", \"Październik\", \"Listopad\", \"Grudzień\"],\r\n\t\tmonth_short: [\"Sty\", \"Lut\", \"Mar\", \"Kwi\", \"Maj\", \"Cze\", \"Lip\", \"Sie\", \"Wrz\", \"Paź\", \"Lis\", \"Gru\"],\r\n\t\tday_full: [\"Niedziela\", \"Poniedziałek\", \"Wtorek\", \"Środa\", \"Czwartek\", \"Piątek\", \"Sobota\"],\r\n\t\tday_short: [\"Nie\", \"Pon\", \"Wto\", \"Śro\", \"Czw\", \"Pią\", \"Sob\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Nowe zadanie\",\r\n\t\ticon_save: \"Zapisz\",\r\n\t\ticon_cancel: \"Anuluj\",\r\n\t\ticon_details: \"Szczegóły\",\r\n\t\ticon_edit: \"Edytuj\",\r\n\t\ticon_delete: \"Usuń\",\r\n\t\tconfirm_closing: \"\", // Zmiany zostaną usunięte, jesteś pewien?\r\n\t\tconfirm_deleting: \"Zdarzenie zostanie usunięte na zawsze, kontynuować?\",\r\n\t\tsection_description: \"Opis\",\r\n\t\tsection_time: \"Okres czasu\",\r\n\t\tsection_type: \"Typ\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Nazwa zadania\",\r\n\t\tcolumn_start_date: \"Początek\",\r\n\t\tcolumn_duration: \"Czas trwania\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"zostanie usunięty\",\r\n\t\tlink_start: \" (początek)\",\r\n\t\tlink_end: \" (koniec)\",\r\n\r\n\t\ttype_task: \"Zadanie\",\r\n\t\ttype_project: \"Projekt\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minuty\",\r\n\t\thours: \"Godziny\",\r\n\t\tdays: \"Dni\",\r\n\t\tweeks: \"Tydzień\",\r\n\t\tmonths: \"Miesiące\",\r\n\t\tyears: \"Lata\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Anuluj\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Januar\", \"Februar\", \"Mars\", \"April\", \"Mai\", \"Juni\", \"Juli\", \"August\", \"September\", \"Oktober\", \"November\", \"Desember\"],\r\n\t\tmonth_short: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"Mai\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Okt\", \"Nov\", \"Des\"],\r\n\t\tday_full: [\"Søndag\", \"Mandag\", \"Tirsdag\", \"Onsdag\", \"Torsdag\", \"Fredag\", \"Lørdag\"],\r\n\t\tday_short: [\"Søn\", \"Man\", \"Tir\", \"Ons\", \"Tor\", \"Fre\", \"Lør\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Ny oppgave\",\r\n\t\ticon_save: \"Lagre\",\r\n\t\ticon_cancel: \"Avbryt\",\r\n\t\ticon_details: \"Detaljer\",\r\n\t\ticon_edit: \"Endre\",\r\n\t\ticon_delete: \"Slett\",\r\n\t\tconfirm_closing: \"Endringer blir ikke lagret, er du sikker?\", // Endringer blir ikke lagret, er du sikker?\r\n\t\tconfirm_deleting: \"Oppføringen vil bli slettet, er du sikker?\",\r\n\t\tsection_description: \"Beskrivelse\",\r\n\t\tsection_time: \"Tidsperiode\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Avbryt\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Januari\", \"Februari\", \"Maart\", \"April\", \"Mei\", \"Juni\", \"Juli\", \"Augustus\", \"September\", \"Oktober\", \"November\", \"December\"],\r\n\t\tmonth_short: [\"Jan\", \"Feb\", \"mrt\", \"Apr\", \"Mei\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Okt\", \"Nov\", \"Dec\"],\r\n\t\tday_full: [\"Zondag\", \"Maandag\", \"Dinsdag\", \"Woensdag\", \"Donderdag\", \"Vrijdag\", \"Zaterdag\"],\r\n\t\tday_short: [\"Zo\", \"Ma\", \"Di\", \"Wo\", \"Do\", \"Vr\", \"Za\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Nieuwe taak\",\r\n\t\ticon_save: \"Opslaan\",\r\n\t\ticon_cancel: \"Annuleren\",\r\n\t\ticon_details: \"Details\",\r\n\t\ticon_edit: \"Bewerken\",\r\n\t\ticon_delete: \"Verwijderen\",\r\n\t\tconfirm_closing: \"\", // Your changes will be lost, are your sure ?\r\n\t\tconfirm_deleting: \"Item zal permanent worden verwijderd, doorgaan?\",\r\n\t\tsection_description: \"Beschrijving\",\r\n\t\tsection_time: \"Tijd periode\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Taak omschrijving\",\r\n\t\tcolumn_start_date: \"Startdatum\",\r\n\t\tcolumn_duration: \"Duur\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Koppeling\",\r\n\t\tconfirm_link_deleting: \"zal worden verwijderd\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (eind)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"minuten\",\r\n\t\thours: \"uren\",\r\n\t\tdays: \"dagen\",\r\n\t\tweeks: \"weken\",\r\n\t\tmonths: \"maanden\",\r\n\t\tyears: \"jaren\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Annuleren\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Januar\", \"Februar\", \"Mars\", \"April\", \"Mai\", \"Juni\", \"Juli\", \"August\", \"September\", \"Oktober\", \"November\", \"Desember\"],\r\n\t\tmonth_short: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"Mai\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Okt\", \"Nov\", \"Des\"],\r\n\t\tday_full: [\"Søndag\", \"Mandag\", \"Tirsdag\", \"Onsdag\", \"Torsdag\", \"Fredag\", \"Lørdag\"],\r\n\t\tday_short: [\"Søn\", \"Mon\", \"Tir\", \"Ons\", \"Tor\", \"Fre\", \"Lør\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Ny oppgave\",\r\n\t\ticon_save: \"Lagre\",\r\n\t\ticon_cancel: \"Avbryt\",\r\n\t\ticon_details: \"Detaljer\",\r\n\t\ticon_edit: \"Rediger\",\r\n\t\ticon_delete: \"Slett\",\r\n\t\tconfirm_closing: \"\", // Your changes will be lost, are your sure ?\r\n\t\tconfirm_deleting: \"Hendelsen vil bli slettet permanent. Er du sikker?\",\r\n\t\tsection_description: \"Beskrivelse\",\r\n\t\tsection_time: \"Tidsperiode\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Avbryt\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","export default class LocaleManager{\r\n\tprivate _locales:{[key:string]: IGanttLocale };\r\n\r\n\tconstructor(config: {[key:string]: IGanttLocale }){\r\n\t\tthis._locales = {};\r\n\t\tfor(const i in config){\r\n\t\t\tthis._locales[i] = config[i];\r\n\t\t}\r\n\t}\r\n\r\n\taddLocale = (name: string, locale: IGanttLocale) => {\r\n\t\tthis._locales[name] = locale;\r\n\t}\r\n\r\n\tgetLocale = (name: string): IGanttLocale => {\r\n\t\treturn this._locales[name];\r\n\t}\r\n}","/*\r\n\tTranslated by cjkim@dbvalley.com\r\n*/\r\n\r\nconst locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"1월\", \"2월\", \"3월\", \"4월\", \"5월\", \"6월\", \"7월\", \"8월\", \"9월\", \"10월\", \"11월\", \"12월\"],\r\n\t\tmonth_short: [\"1월\", \"2월\", \"3월\", \"4월\", \"5월\", \"6월\", \"7월\", \"8월\", \"9월\", \"10월\", \"11월\", \"12월\"],\r\n\t\tday_full: [\"일요일\", \"월요일\", \"화요일\", \"수요일\", \"목요일\", \"금요일\", \"토요일\"],\r\n\t\tday_short: [\"일\", \"월\", \"화\", \"수\", \"목\", \"금\", \"토\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"이름없는 작업\",\r\n\t\ticon_save: \"저장\",\r\n\t\ticon_cancel: \"취소\",\r\n\t\ticon_details: \"세부 사항\",\r\n\t\ticon_edit: \"수정\",\r\n\t\ticon_delete: \"삭제\",\r\n\t\tconfirm_closing: \"\",\r\n\t\tconfirm_deleting: \"작업을 삭제하시겠습니까?\",\r\n\t\tsection_description: \"설명\",\r\n\t\tsection_time: \"기간\",\r\n\t\tsection_type: \"Type\",\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"작업명\",\r\n\t\tcolumn_start_date: \"시작일\",\r\n\t\tcolumn_duration: \"기간\",\r\n\t\tcolumn_add: \"\",\r\n\t\tlink: \"전제\",\r\n\t\tconfirm_link_deleting: \"삭제 하시겠습니까?\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\t\ttype_task: \"작업\",\r\n\t\ttype_project: \"프로젝트\",\r\n\t\ttype_milestone: \"마일스톤\",\r\n\t\tminutes: \"분\",\r\n\t\thours: \"시간\",\r\n\t\tdays: \"일\",\r\n\t\tweeks: \"주\",\r\n\t\tmonths: \"달\",\r\n\t\tyears: \"년\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"취소\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","/*\r\n Translation by Genexus Japan Inc.\r\n */\r\n\r\nconst locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"1月\", \"2月\", \"3月\", \"4月\", \"5月\", \"6月\", \"7月\", \"8月\", \"9月\", \"10月\", \"11月\", \"12月\"],\r\n\t\tmonth_short: [\"1月\", \"2月\", \"3月\", \"4月\", \"5月\", \"6月\", \"7月\", \"8月\", \"9月\", \"10月\", \"11月\", \"12月\"],\r\n\t\tday_full: [\"日曜日\", \"月曜日\", \"火曜日\", \"水曜日\", \"木曜日\", \"金曜日\", \"土曜日\"],\r\n\t\tday_short: [\"日\", \"月\", \"火\", \"水\", \"木\", \"金\", \"土\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"新しい仕事\",\r\n\t\ticon_save: \"保存\",\r\n\t\ticon_cancel: \"キャンセル\",\r\n\t\ticon_details: \"詳細\",\r\n\t\ticon_edit: \"編集\",\r\n\t\ticon_delete: \"削除\",\r\n\t\tconfirm_closing: \"\", // 変更が取り消されます、宜しいですか?\r\n\t\tconfirm_deleting: \"イベント完全に削除されます、宜しいですか?\",\r\n\t\tsection_description: \"デスクリプション\",\r\n\t\tsection_time: \"期間\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"キャンセル\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","/*\r\n Update 29/12/2015:\r\n New labels translation by ARCANGELI CLAUDIO\r\n\r\n */\r\n\r\nconst locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Gennaio\", \"Febbraio\", \"Marzo\", \"Aprile\", \"Maggio\", \"Giugno\", \"Luglio\", \"Agosto\", \"Settembre\", \"Ottobre\", \"Novembre\", \"Dicembre\"],\r\n\t\tmonth_short: [\"Gen\", \"Feb\", \"Mar\", \"Apr\", \"Mag\", \"Giu\", \"Lug\", \"Ago\", \"Set\", \"Ott\", \"Nov\", \"Dic\"],\r\n\t\tday_full: [\"Domenica\", \"Lunedì\", \"Martedì\", \"Mercoledì\", \"Giovedì\", \"Venerdì\", \"Sabato\"],\r\n\t\tday_short: [\"Dom\", \"Lun\", \"Mar\", \"Mer\", \"Gio\", \"Ven\", \"Sab\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Nuovo compito\",\r\n\t\ticon_save: \"Salva\",\r\n\t\ticon_cancel: \"Chiudi\",\r\n\t\ticon_details: \"Dettagli\",\r\n\t\ticon_edit: \"Modifica\",\r\n\t\ticon_delete: \"Elimina\",\r\n\t\tconfirm_closing: \"\",// \"Sei sicuro di confermare la chiusura?\",\r\n\t\tconfirm_deleting: \"Sei sicuro di confermare l'eliminazione?\",\r\n\t\tsection_description: \"Descrizione\",\r\n\t\tsection_time: \"Periodo di tempo\",\r\n\t\tsection_type: \"Tipo\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Nome Attività\",\r\n\t\tcolumn_start_date: \"Inizio\",\r\n\t\tcolumn_duration: \"Durata\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"sarà eliminato\",\r\n\t\tlink_start: \" (inizio)\",\r\n\t\tlink_end: \" (fine)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minuti\",\r\n\t\thours: \"Ore\",\r\n\t\tdays: \"Giorni\",\r\n\t\tweeks: \"Settimane\",\r\n\t\tmonths: \"Mesi\",\r\n\t\tyears: \"Anni\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Chiudi\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Januari\", \"Februari\", \"Maret\", \"April\", \"Mei\", \"Juni\", \"Juli\", \"Agustus\", \"September\", \"Oktober\", \"November\", \"Desember\"],\r\n\t\tmonth_short: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"Mei\", \"Jun\", \"Jul\", \"Ags\", \"Sep\", \"Okt\", \"Nov\", \"Des\"],\r\n\t\tday_full: [\"Minggu\", \"Senin\", \"Selasa\", \"Rabu\", \"Kamis\", \"Jumat\", \"Sabtu\"],\r\n\t\tday_short: [\"Ming\", \"Sen\", \"Sel\", \"Rab\", \"Kam\", \"Jum\", \"Sab\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Tugas baru\",\r\n\t\ticon_save: \"Simpan\",\r\n\t\ticon_cancel: \"Batal\",\r\n\t\ticon_details: \"Detail\",\r\n\t\ticon_edit: \"Edit\",\r\n\t\ticon_delete: \"Hapus\",\r\n\t\tconfirm_closing: \"\", /* Perubahan tidak akan disimpan ? */\r\n\t\tconfirm_deleting: \"Acara akan dihapus\",\r\n\t\tsection_description: \"Keterangan\",\r\n\t\tsection_time: \"Periode\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Batal\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Január\", \"Február\", \"Március\", \"Április\", \"Május\", \"Június\", \"Július\", \"Augusztus\", \"Szeptember\", \"Október\", \"November\", \"December\"],\r\n\t\tmonth_short: [\"Jan\", \"Feb\", \"Már\", \"Ápr\", \"Máj\", \"Jún\", \"Júl\", \"Aug\", \"Sep\", \"Okt\", \"Nov\", \"Dec\"],\r\n\t\tday_full: [\"Vasárnap\", \"Hétfõ\", \"Kedd\", \"Szerda\", \"Csütörtök\", \"Péntek\", \"szombat\"],\r\n\t\tday_short: [\"Va\", \"Hé\", \"Ke\", \"Sze\", \"Csü\", \"Pé\", \"Szo\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Új feladat\",\r\n\t\ticon_save: \"Mentés\",\r\n\t\ticon_cancel: \"Mégse\",\r\n\t\ticon_details: \"Részletek\",\r\n\t\ticon_edit: \"Szerkesztés\",\r\n\t\ticon_delete: \"Törlés\",\r\n\t\tconfirm_closing: \"\", // A változások elvesznek, biztosan folytatja? \"\r\n\t\tconfirm_deleting: \"Az esemény törölve lesz, biztosan folytatja?\",\r\n\t\tsection_description: \"Leírás\",\r\n\t\tsection_time: \"Idõszak\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Mégse\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","/*\r\n Translation by Davor\r\n http://docs.dhtmlx.com/gantt/desktop__localization.html#comment-2569116291\r\n */\r\n\r\nconst locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Siječanj\", \"Veljača\", \"Ožujak\", \"Travanj\", \"Svibanj\", \"Lipanj\", \"Srpanj\", \"Kolovoz\", \"Rujan\", \"Listopad\", \"Studeni\", \"Prosinac\"],\r\n\t\tmonth_short: [\"Sij\", \"Velj\", \"Ožu\", \"Tra\", \"Svi\", \"Lip\", \"Srp\", \"Kol\", \"Ruj\", \"Lis\", \"Stu\", \"Pro\"],\r\n\t\tday_full: [\"Nedjelja\", \"Ponedjeljak\", \"Utorak\", \"Srijeda\", \"Četvrtak\", \"Petak\", \"Subota\"],\r\n\t\tday_short: [\"Ned\", \"Pon\", \"Uto\", \"Sri\", \"Čet\", \"Pet\", \"Sub\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Novi Zadatak\",\r\n\t\ticon_save: \"Spremi\",\r\n\t\ticon_cancel: \"Odustani\",\r\n\t\ticon_details: \"Detalji\",\r\n\t\ticon_edit: \"Izmjeni\",\r\n\t\ticon_delete: \"Obriši\",\r\n\t\tconfirm_closing: \"\",\r\n\t\tconfirm_deleting: \"Zadatak će biti trajno izbrisan, jeste li sigurni?\",\r\n\t\tsection_description: \"Opis\",\r\n\t\tsection_time: \"Vremenski Period\",\r\n\t\tsection_type: \"Tip\",\r\n\r\n\t\t/* grid columns */\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Naziv Zadatka\",\r\n\t\tcolumn_start_date: \"Početno Vrijeme\",\r\n\t\tcolumn_duration: \"Trajanje\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Poveznica\",\r\n\t\tconfirm_link_deleting: \"će biti izbrisan\",\r\n\t\tlink_start: \" (početak)\",\r\n\t\tlink_end: \" (kraj)\",\r\n\r\n\t\ttype_task: \"Zadatak\",\r\n\t\ttype_project: \"Projekt\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\t\tminutes: \"Minute\",\r\n\t\thours: \"Sati\",\r\n\t\tdays: \"Dani\",\r\n\t\tweeks: \"Tjedni\",\r\n\t\tmonths: \"Mjeseci\",\r\n\t\tyears: \"Godine\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Odustani\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"ינואר\", \"פברואר\", \"מרץ\", \"אפריל\", \"מאי\", \"יוני\", \"יולי\", \"אוגוסט\", \"ספטמבר\", \"אוקטובר\", \"נובמבר\", \"דצמבר\"],\r\n\t\tmonth_short: [\"ינו\", \"פבר\", \"מרץ\", \"אפר\", \"מאי\", \"יונ\", \"יול\", \"אוג\", \"ספט\", \"אוק\", \"נוב\", \"דצמ\"],\r\n\t\tday_full: [\"ראשון\", \"שני\", \"שלישי\", \"רביעי\", \"חמישי\", \"שישי\", \"שבת\"],\r\n\t\tday_short: [\"א\", \"ב\", \"ג\", \"ד\", \"ה\", \"ו\", \"ש\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"משימה חדש\",\r\n\t\ticon_save: \"שמור\",\r\n\t\ticon_cancel: \"בטל\",\r\n\t\ticon_details: \"פרטים\",\r\n\t\ticon_edit: \"ערוך\",\r\n\t\ticon_delete: \"מחק\",\r\n\t\tconfirm_closing: \"\", // Your changes will be lost, are your sure ?\r\n\t\tconfirm_deleting: \"ארוע ימחק סופית.להמשיך?\",\r\n\t\tsection_description: \"הסבר\",\r\n\t\tsection_time: \"תקופה\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"בטל\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Janvier\", \"Février\", \"Mars\", \"Avril\", \"Mai\", \"Juin\", \"Juillet\", \"Août\", \"Septembre\", \"Octobre\", \"Novembre\", \"Décembre\"],\r\n\t\tmonth_short: [\"Jan\", \"Fév\", \"Mar\", \"Avr\", \"Mai\", \"Juin\", \"Juil\", \"Aoû\", \"Sep\", \"Oct\", \"Nov\", \"Déc\"],\r\n\t\tday_full: [\"Dimanche\", \"Lundi\", \"Mardi\", \"Mercredi\", \"Jeudi\", \"Vendredi\", \"Samedi\"],\r\n\t\tday_short: [\"Dim\", \"Lun\", \"Mar\", \"Mer\", \"Jeu\", \"Ven\", \"Sam\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Nouvelle tâche\",\r\n\t\ticon_save: \"Enregistrer\",\r\n\t\ticon_cancel: \"Annuler\",\r\n\t\ticon_details: \"Détails\",\r\n\t\ticon_edit: \"Modifier\",\r\n\t\ticon_delete: \"Effacer\",\r\n\t\tconfirm_closing: \"\",// Vos modifications seront perdus, êtes-vous sûr ?\r\n\t\tconfirm_deleting: \"L'événement sera effacé sans appel, êtes-vous sûr ?\",\r\n\r\n\t\tsection_description: \"Description\",\r\n\t\tsection_time: \"Période\",\r\n\t\tsection_type: \"Type\",\r\n\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"OTP\",\r\n\t\tcolumn_text: \"Nom de la tâche\",\r\n\t\tcolumn_start_date: \"Date initiale\",\r\n\t\tcolumn_duration: \"Durée\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Le lien\",\r\n\t\tconfirm_link_deleting: \"sera supprimé\",\r\n\t\tlink_start: \"(début)\",\r\n\t\tlink_end: \"(fin)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Heures\",\r\n\t\tdays: \"Jours\",\r\n\t\tweeks: \"Semaines\",\r\n\t\tmonths: \"Mois\",\r\n\t\tyears: \"Années\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Annuler\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Tammikuu\", \"Helmikuu\", \"Maaliskuu\", \"Huhtikuu\", \"Toukokuu\", \"Kesäkuu\", \"Heinäkuu\", \"Elokuu\", \"Syyskuu\", \"Lokakuu\", \"Marraskuu\", \"Joulukuu\"],\r\n\t\tmonth_short: [\"Tam\", \"Hel\", \"Maa\", \"Huh\", \"Tou\", \"Kes\", \"Hei\", \"Elo\", \"Syy\", \"Lok\", \"Mar\", \"Jou\"],\r\n\t\tday_full: [\"Sunnuntai\", \"Maanantai\", \"Tiistai\", \"Keskiviikko\", \"Torstai\", \"Perjantai\", \"Lauantai\"],\r\n\t\tday_short: [\"Su\", \"Ma\", \"Ti\", \"Ke\", \"To\", \"Pe\", \"La\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Uusi tehtävä\",\r\n\t\ticon_save: \"Tallenna\",\r\n\t\ticon_cancel: \"Peru\",\r\n\t\ticon_details: \"Tiedot\",\r\n\t\ticon_edit: \"Muokkaa\",\r\n\t\ticon_delete: \"Poista\",\r\n\t\tconfirm_closing: \"\", // Your changes will be lost, are your sure ?\r\n\t\tconfirm_deleting: \"Haluatko varmasti poistaa tapahtuman?\",\r\n\t\tsection_description: \"Kuvaus\",\r\n\t\tsection_time: \"Aikajakso\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Peru\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","/*\r\n dhtmlxGantt Persian (Farsi, fa_IR) locale by Mohammad Shokri http://slashsbin.com/\r\n */\r\n\r\nconst locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\r\n\t\t\t\"ژانویه\",\r\n\t\t\t\"فوریه\",\r\n\t\t\t\"مارس\",\r\n\t\t\t\"آوریل\",\r\n\t\t\t\"مه\",\r\n\t\t\t\"ژوئن\",\r\n\t\t\t\"ژوئیه\",\r\n\t\t\t\"اوت\",\r\n\t\t\t\"سپتامبر\",\r\n\t\t\t\"اکتبر\",\r\n\t\t\t\"نوامبر\",\r\n\t\t\t\"دسامبر\"\r\n\t\t],\r\n\t\tmonth_short: [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"11\", \"12\"],\r\n\t\tday_full: [\r\n\t\t\t\"يکشنبه\",\r\n\t\t\t\"دوشنبه\",\r\n\t\t\t\"سه‌شنبه\",\r\n\t\t\t\"چهارشنبه\",\r\n\t\t\t\"پنجشنبه\",\r\n\t\t\t\"جمعه\",\r\n\t\t\t\"شنبه\"\r\n\t\t],\r\n\t\tday_short: [\r\n\t\t\t\"ی\",\r\n\t\t\t\"د\",\r\n\t\t\t\"س\",\r\n\t\t\t\"چ\",\r\n\t\t\t\"پ\",\r\n\t\t\t\"ج\",\r\n\t\t\t\"ش\"\r\n\t\t]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"وظیفه جدید\",\r\n\t\ticon_save: \"ذخیره\",\r\n\t\ticon_cancel: \"لغو\",\r\n\t\ticon_details: \"جزییات\",\r\n\t\ticon_edit: \"ویرایش\",\r\n\t\ticon_delete: \"حذف\",\r\n\t\tconfirm_closing: \"تغییرات شما ازدست خواهد رفت، آیا مطمئن هستید؟\",\r\n\t\tconfirm_deleting: \"این مورد برای همیشه حذف خواهد شد، آیا مطمئن هستید؟\",\r\n\t\tsection_description: \"توضیحات\",\r\n\t\tsection_time: \"مدت زمان\",\r\n\t\tsection_type: \"نوع\",\r\n\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"عنوان\",\r\n\t\tcolumn_start_date: \"زمان شروع\",\r\n\t\tcolumn_duration: \"مدت\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"ارتباط\",\r\n\t\tconfirm_link_deleting: \"حذف خواهد شد\",\r\n\t\tlink_start: \" (آغاز)\",\r\n\t\tlink_end: \" (پایان)\",\r\n\r\n\t\ttype_task: \"وظیفه\",\r\n\t\ttype_project: \"پروژه\",\r\n\t\ttype_milestone: \"نگارش\",\r\n\r\n\t\tminutes: \"دقایق\",\r\n\t\thours: \"ساعات\",\r\n\t\tdays: \"روزها\",\r\n\t\tweeks: \"هفته\",\r\n\t\tmonths: \"ماه‌ها\",\r\n\t\tyears: \"سال‌ها\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"تایید\",\r\n\t\tmessage_cancel: \"لغو\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","/*\r\n @Autor Manuel Fernandez Panzuela - www.mfernandez.es\r\n\r\n Update 30/10/2015:\r\n Translation of new labels by Jorge Macias\r\n https://disqus.com/by/disqus_bTuZk1voC7/\r\n */\r\n\r\nconst locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Enero\", \"Febrero\", \"Marzo\", \"Abril\", \"Mayo\", \"Junio\", \"Julio\", \"Agosto\", \"Septiembre\", \"Octubre\", \"Noviembre\", \"Diciembre\"],\r\n\t\tmonth_short: [\"Ene\", \"Feb\", \"Mar\", \"Abr\", \"May\", \"Jun\", \"Jul\", \"Ago\", \"Sep\", \"Oct\", \"Nov\", \"Dic\"],\r\n\t\tday_full: [\"Domingo\", \"Lunes\", \"Martes\", \"Miércoles\", \"Jueves\", \"Viernes\", \"Sábado\"],\r\n\t\tday_short: [\"Dom\", \"Lun\", \"Mar\", \"Mié\", \"Jue\", \"Vie\", \"Sáb\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Nueva tarea\",\r\n\t\ticon_save: \"Guardar\",\r\n\t\ticon_cancel: \"Cancelar\",\r\n\t\ticon_details: \"Detalles\",\r\n\t\ticon_edit: \"Editar\",\r\n\t\ticon_delete: \"Eliminar\",\r\n\t\tconfirm_closing: \"\", // \"Sus cambios se perderán, continuar ?\"\r\n\t\tconfirm_deleting: \"El evento se borrará definitivamente, ¿continuar?\",\r\n\t\tsection_description: \"Descripción\",\r\n\t\tsection_time: \"Período\",\r\n\t\tsection_type: \"Tipo\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"EDT\",\r\n\t\tcolumn_text: \"Tarea\",\r\n\t\tcolumn_start_date: \"Inicio\",\r\n\t\tcolumn_duration: \"Duración\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Enlace\",\r\n\t\tconfirm_link_deleting: \"será borrada\",\r\n\t\tlink_start: \" (inicio)\",\r\n\t\tlink_end: \" (fin)\",\r\n\r\n\t\ttype_task: \"Tarea\",\r\n\t\ttype_project: \"Proyecto\",\r\n\t\ttype_milestone: \"Hito\",\r\n\r\n\r\n\t\tminutes: \"Minutos\",\r\n\t\thours: \"Horas\",\r\n\t\tdays: \"Días\",\r\n\t\tweeks: \"Semanas\",\r\n\t\tmonths: \"Meses\",\r\n\t\tyears: \"Años\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Cancelar\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\r\n\t\tmonth_short: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"],\r\n\t\tday_full: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\r\n\t\tday_short: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"New task\",\r\n\t\ticon_save: \"Save\",\r\n\t\ticon_cancel: \"Cancel\",\r\n\t\ticon_details: \"Details\",\r\n\t\ticon_edit: \"Edit\",\r\n\t\ticon_delete: \"Delete\",\r\n\t\tconfirm_closing: \"\",// Your changes will be lost, are you sure?\r\n\t\tconfirm_deleting: \"Task will be deleted permanently, are you sure?\",\r\n\t\tsection_description: \"Description\",\r\n\t\tsection_time: \"Time period\",\r\n\t\tsection_type: \"Type\",\r\n\r\n\t\t/* grid columns */\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Cancel\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Ιανουάριος\", \"Φεβρουάριος\", \"Μάρτιος\", \"Απρίλιος\", \"Μάϊος\", \"Ιούνιος\", \"Ιούλιος\", \"Αύγουστος\", \"Σεπτέμβριος\", \"Οκτώβριος\", \"Νοέμβριος\", \"Δεκέμβριος\"],\r\n\t\tmonth_short: [\"ΙΑΝ\", \"ΦΕΒ\", \"ΜΑΡ\", \"ΑΠΡ\", \"ΜΑΙ\", \"ΙΟΥΝ\", \"ΙΟΥΛ\", \"ΑΥΓ\", \"ΣΕΠ\", \"ΟΚΤ\", \"ΝΟΕ\", \"ΔΕΚ\"],\r\n\t\tday_full: [\"Κυριακή\", \"Δευτέρα\", \"Τρίτη\", \"Τετάρτη\", \"Πέμπτη\", \"Παρασκευή\", \"Κυριακή\"],\r\n\t\tday_short: [\"ΚΥ\", \"ΔΕ\", \"ΤΡ\", \"ΤΕ\", \"ΠΕ\", \"ΠΑ\", \"ΣΑ\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Νέα εργασία\",\r\n\t\ticon_save: \"Αποθήκευση\",\r\n\t\ticon_cancel: \"Άκυρο\",\r\n\t\ticon_details: \"Λεπτομέρειες\",\r\n\t\ticon_edit: \"Επεξεργασία\",\r\n\t\ticon_delete: \"Διαγραφή\",\r\n\t\tconfirm_closing: \"\", // Your changes will be lost, are your sure ?\r\n\t\tconfirm_deleting: \"Το έργο θα διαγραφεί οριστικά. Θέλετε να συνεχίσετε;\",\r\n\t\tsection_description: \"Περιγραφή\",\r\n\t\tsection_time: \"Χρονική περίοδος\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Άκυρο\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\" Januar\", \" Februar\", \" März \", \" April\", \" Mai\", \" Juni\", \" Juli\", \" August\", \" September \", \" Oktober\", \" November \", \" Dezember\"],\r\n\t\tmonth_short: [\"Jan\", \"Feb\", \"Mär\", \"Apr\", \"Mai\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Okt\", \"Nov\", \"Dez\"],\r\n\t\tday_full: [\"Sonntag\", \"Montag\", \"Dienstag\", \" Mittwoch\", \" Donnerstag\", \"Freitag\", \"Samstag\"],\r\n\t\tday_short: [\"So\", \"Mo\", \"Di\", \"Mi\", \"Do\", \"Fr\", \"Sa\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Neue Aufgabe\",\r\n\t\ticon_save: \"Speichern\",\r\n\t\ticon_cancel: \"Abbrechen\",\r\n\t\ticon_details: \"Details\",\r\n\t\ticon_edit: \"Ändern\",\r\n\t\ticon_delete: \"Löschen\",\r\n\t\tconfirm_closing: \"\", // \"Ihre Veränderungen werden verloren sein, wollen Sie ergänzen? \"\r\n\t\tconfirm_deleting: \"Der Eintrag wird gelöscht\",\r\n\t\tsection_description: \"Beschreibung\",\r\n\t\tsection_time: \"Zeitspanne\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"PSP\",\r\n\t\tcolumn_text: \"Task-Namen\",\r\n\t\tcolumn_start_date: \"Startzeit\",\r\n\t\tcolumn_duration: \"Dauer\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"werden gelöscht\",\r\n\t\tlink_start: \"(starten)\",\r\n\t\tlink_end: \"(ende)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minuten\",\r\n\t\thours: \"Stunden\",\r\n\t\tdays: \"Tage\",\r\n\t\tweeks: \"Wochen\",\r\n\t\tmonths: \"Monate\",\r\n\t\tyears: \"Jahre\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Abbrechen\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Regel\",\r\n\t\tconstraint_type: \"Regel\",\r\n\t\tconstraint_date: \"Regel - Datum\",\r\n\t\tasap: \"So bald wie möglich\",\r\n\t\talap: \"So spät wie möglich\",\r\n\t\tsnet: \"Beginn nicht vor\",\r\n\t\tsnlt: \"Beginn nicht später als\",\r\n\t\tfnet: \"Fertigstellung nicht vor\",\r\n\t\tfnlt: \"Fertigstellung nicht später als\",\r\n\t\tmso: \"Muss beginnen am\",\r\n\t\tmfo: \"Muss fertig sein am\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Januar\", \"Februar\", \"Marts\", \"April\", \"Maj\", \"Juni\", \"Juli\", \"August\", \"September\", \"Oktober\", \"November\", \"December\"],\r\n\t\tmonth_short: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"Maj\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Okt\", \"Nov\", \"Dec\"],\r\n\t\tday_full: [\"Søndag\", \"Mandag\", \"Tirsdag\", \"Onsdag\", \"Torsdag\", \"Fredag\", \"Lørdag\"],\r\n\t\tday_short: [\"Søn\", \"Man\", \"Tir\", \"Ons\", \"Tor\", \"Fre\", \"Lør\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Ny opgave\",\r\n\t\ticon_save: \"Gem\",\r\n\t\ticon_cancel: \"Fortryd\",\r\n\t\ticon_details: \"Detaljer\",\r\n\t\ticon_edit: \"Tilret\",\r\n\t\ticon_delete: \"Slet\",\r\n\t\tconfirm_closing: \"Dine rettelser vil gå tabt.. Er dy sikker?\", // Your changes will be lost, are your sure ?\r\n\t\tconfirm_deleting: \"Bigivenheden vil blive slettet permanent. Er du sikker?\",\r\n\t\tsection_description: \"Beskrivelse\",\r\n\t\tsection_time: \"Tidsperiode\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Fortryd\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Leden\", \"Únor\", \"Březen\", \"Duben\", \"Květen\", \"Červen\", \"Červenec\", \"Srpen\", \"Září\", \"Říjen\", \"Listopad\", \"Prosinec\"],\r\n\t\tmonth_short: [\"Led\", \"Ún\", \"Bře\", \"Dub\", \"Kvě\", \"Čer\", \"Čec\", \"Srp\", \"Září\", \"Říj\", \"List\", \"Pro\"],\r\n\t\tday_full: [\"Neděle\", \"Pondělí\", \"Úterý\", \"Středa\", \"Čtvrtek\", \"Pátek\", \"Sobota\"],\r\n\t\tday_short: [\"Ne\", \"Po\", \"Út\", \"St\", \"Čt\", \"Pá\", \"So\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Nová práce\",\r\n\t\ticon_save: \"Uložit\",\r\n\t\ticon_cancel: \"Zpět\",\r\n\t\ticon_details: \"Detail\",\r\n\t\ticon_edit: \"Edituj\",\r\n\t\ticon_delete: \"Smazat\",\r\n\t\tconfirm_closing: \"\", // Vaše změny budou ztraceny, opravdu ?\r\n\t\tconfirm_deleting: \"Událost bude trvale smazána, opravdu?\",\r\n\t\tsection_description: \"Poznámky\",\r\n\t\tsection_time: \"Doba platnosti\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Zpět\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","/*\r\nTranslation by FreezeSoul\r\n\r\nUpdate 26/10/2015:\r\nTranslation of new labels by zwh8800\r\n https://github.com/DHTMLX/gantt/pull/7\r\n\r\n*/\r\n\r\nconst locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"一月\", \"二月\", \"三月\", \"四月\", \"五月\", \"六月\", \"七月\", \"八月\", \"九月\", \"十月\", \"十一月\", \"十二月\"],\r\n\t\tmonth_short: [\"1月\", \"2月\", \"3月\", \"4月\", \"5月\", \"6月\", \"7月\", \"8月\", \"9月\", \"10月\", \"11月\", \"12月\"],\r\n\t\tday_full: [\"星期日\", \"星期一\", \"星期二\", \"星期三\", \"星期四\", \"星期五\", \"星期六\"],\r\n\t\tday_short: [\"日\", \"一\", \"二\", \"三\", \"四\", \"五\", \"六\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"新任務\",\r\n\t\ticon_save: \"保存\",\r\n\t\ticon_cancel: \"关闭\",\r\n\t\ticon_details: \"详细\",\r\n\t\ticon_edit: \"编辑\",\r\n\t\ticon_delete: \"删除\",\r\n\t\tconfirm_closing: \"请确认是否撤销修改!\", // Your changes will be lost, are your sure?\r\n\t\tconfirm_deleting: \"是否删除日程?\",\r\n\t\tsection_description: \"描述\",\r\n\t\tsection_time: \"时间范围\",\r\n\t\tsection_type: \"类型\",\r\n\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"工作分解结构\",\r\n\t\tcolumn_text: \"任务名\",\r\n\t\tcolumn_start_date: \"开始时间\",\r\n\t\tcolumn_duration: \"持续时间\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\r\n\t\tlink: \"关联\",\r\n\t\tconfirm_link_deleting: \"将被删除\",\r\n\t\tlink_start: \" (开始)\",\r\n\t\tlink_end: \" (结束)\",\r\n\r\n\t\ttype_task: \"任务\",\r\n\t\ttype_project: \"项目\",\r\n\t\ttype_milestone: \"里程碑\",\r\n\r\n\t\tminutes: \"分钟\",\r\n\t\thours: \"小时\",\r\n\t\tdays: \"天\",\r\n\t\tweeks: \"周\",\r\n\t\tmonths: \"月\",\r\n\t\tyears: \"年\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"关闭\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","/*\r\n @Traducido por Vicente Adria Bohigues - vicenteadria@hotmail.com\r\n */\r\n\r\nconst locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Gener\", \"Febrer\", \"Març\", \"Abril\", \"Maig\", \"Juny\", \"Juliol\", \"Agost\", \"Setembre\", \"Octubre\", \"Novembre\", \"Desembre\"],\r\n\t\tmonth_short: [\"Gen\", \"Feb\", \"Mar\", \"Abr\", \"Mai\", \"Jun\", \"Jul\", \"Ago\", \"Set\", \"Oct\", \"Nov\", \"Des\"],\r\n\t\tday_full: [\"Diumenge\", \"Dilluns\", \"Dimarts\", \"Dimecres\", \"Dijous\", \"Divendres\", \"Dissabte\"],\r\n\t\tday_short: [\"Dg\", \"Dl\", \"Dm\", \"Dc\", \"Dj\", \"Dv\", \"Ds\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Nova tasca\",\r\n\t\ticon_save: \"Guardar\",\r\n\t\ticon_cancel: \"Cancel·lar\",\r\n\t\ticon_details: \"Detalls\",\r\n\t\ticon_edit: \"Editar\",\r\n\t\ticon_delete: \"Esborrar\",\r\n\t\tconfirm_closing: \"\", // \"Els seus canvis es perdràn, continuar ?\"\r\n\t\tconfirm_deleting: \"L'esdeveniment s'esborrarà definitivament, continuar ?\",\r\n\t\tsection_description: \"Descripció\",\r\n\t\tsection_time: \"Periode de temps\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Cancel·lar\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Студзень\", \"Люты\", \"Сакавік\", \"Красавік\", \"Maй\", \"Чэрвень\", \"Ліпень\", \"Жнівень\", \"Верасень\", \"Кастрычнік\", \"Лістапад\", \"Снежань\"],\r\n\t\tmonth_short: [\"Студз\", \"Лют\", \"Сак\", \"Крас\", \"Maй\", \"Чэр\", \"Ліп\", \"Жнів\", \"Вер\", \"Каст\", \"Ліст\", \"Снеж\"],\r\n\t\tday_full: [\"Нядзеля\", \"Панядзелак\", \"Аўторак\", \"Серада\", \"Чацвер\", \"Пятніца\", \"Субота\"],\r\n\t\tday_short: [\"Нд\", \"Пн\", \"Аўт\", \"Ср\", \"Чцв\", \"Пт\", \"Сб\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Новае заданне\",\r\n\t\ticon_save: \"Захаваць\",\r\n\t\ticon_cancel: \"Адмяніць\",\r\n\t\ticon_details: \"Дэталі\",\r\n\t\ticon_edit: \"Змяніць\",\r\n\t\ticon_delete: \"Выдаліць\",\r\n\t\tconfirm_closing: \"\", // Унесеныя змены будуць страчаны, працягнуць?\r\n\t\tconfirm_deleting: \"Падзея будзе выдалена незваротна, працягнуць?\",\r\n\t\tsection_description: \"Апісанне\",\r\n\t\tsection_time: \"Перыяд часу\",\r\n\t\tsection_type: \"Тып\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"ІСР\",\r\n\t\tcolumn_text: \"Задача\",\r\n\t\tcolumn_start_date: \"Пачатак\",\r\n\t\tcolumn_duration: \"Працяг\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Сувязь\",\r\n\t\tconfirm_link_deleting: \"будзе выдалена\",\r\n\t\tlink_start: \"(пачатак)\",\r\n\t\tlink_end: \"(канец)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Хвiлiна\",\r\n\t\thours: \"Гадзiна\",\r\n\t\tdays: \"Дзень\",\r\n\t\tweeks: \"Тыдзень\",\r\n\t\tmonths: \"Месяц\",\r\n\t\tyears: \"Год\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Адмяніць\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"كانون الثاني\", \"شباط\", \"آذار\", \"نيسان\", \"أيار\", \"حزيران\", \"تموز\", \"آب\", \"أيلول\", \"تشرين الأول\", \"تشرين الثاني\", \"كانون الأول\"],\r\n\t\tmonth_short: [\"يناير\", \"فبراير\", \"مارس\", \"أبريل\", \"مايو\", \"يونيو\", \"يوليو\", \"أغسطس\", \"سبتمبر\", \"أكتوبر\", \"نوفمبر\", \"ديسمبر\"],\r\n\t\tday_full: [\"الأحد\", \"الأثنين\", \"ألثلاثاء\", \"الأربعاء\", \"ألحميس\", \"ألجمعة\", \"السبت\"],\r\n\t\tday_short: [\"احد\", \"اثنين\", \"ثلاثاء\", \"اربعاء\", \"خميس\", \"جمعة\", \"سبت\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"مهمة جديد\",\r\n\t\ticon_save: \"اخزن\",\r\n\t\ticon_cancel: \"الغاء\",\r\n\t\ticon_details: \"تفاصيل\",\r\n\t\ticon_edit: \"تحرير\",\r\n\t\ticon_delete: \"حذف\",\r\n\t\tconfirm_closing: \"التغييرات سوف تضيع, هل انت متأكد؟\", // Your changes will be lost, are your sure ?\r\n\t\tconfirm_deleting: \"الحدث سيتم حذفها نهائيا ، هل أنت متأكد؟\",\r\n\t\tsection_description: \"الوصف\",\r\n\t\tsection_time: \"الفترة الزمنية\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"الغاء\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\",\r\n\r\n\t\t/* empty state screen */\r\n\t\tempty_state_text_link: \"Click here\",\r\n\t\tempty_state_text_description: \"to create your first task\"\r\n\t}\r\n};\r\n\r\nexport default locale;\r\n","import ar from \"./locale_ar\";\r\nimport be from \"./locale_be\";\r\nimport ca from \"./locale_ca\";\r\nimport cn from \"./locale_cn\";\r\nimport cs from \"./locale_cs\";\r\nimport da from \"./locale_da\";\r\nimport de from \"./locale_de\";\r\nimport el from \"./locale_el\";\r\nimport en from \"./locale_en\";\r\nimport es from \"./locale_es\";\r\nimport fa from \"./locale_fa\";\r\nimport fi from \"./locale_fi\";\r\nimport fr from \"./locale_fr\";\r\nimport he from \"./locale_he\";\r\nimport hr from \"./locale_hr\";\r\nimport hu from \"./locale_hu\";\r\nimport id from \"./locale_id\";\r\nimport it from \"./locale_it\";\r\nimport jp from \"./locale_jp\";\r\nimport kr from \"./locale_kr\";\r\n\r\nimport LocaleManager from \"./locale_manager\";\r\n\r\nimport nb from \"./locale_nb\";\r\nimport nl from \"./locale_nl\";\r\nimport no from \"./locale_no\";\r\nimport pl from \"./locale_pl\";\r\nimport pt from \"./locale_pt\";\r\nimport ro from \"./locale_ro\";\r\nimport ru from \"./locale_ru\";\r\nimport si from \"./locale_si\";\r\nimport sk from \"./locale_sk\";\r\nimport sv from \"./locale_sv\";\r\nimport tr from \"./locale_tr\";\r\nimport ua from \"./locale_ua\";\r\n\r\nexport default function(){\r\n\treturn new LocaleManager({\r\n\t\ten,\r\n\t\tar,\r\n\t\tbe,\r\n\t\tca,\r\n\t\tcn,\r\n\t\tcs,\r\n\t\tda,\r\n\t\tde,\r\n\t\tel,\r\n\t\tes,\r\n\t\tfa,\r\n\t\tfi,\r\n\t\tfr,\r\n\t\the,\r\n\t\thr,\r\n\t\thu,\r\n\t\tid,\r\n\t\tit,\r\n\t\tjp,\r\n\t\tkr,\r\n\t\tnb,\r\n\t\tnl,\r\n\t\tno,\r\n\t\tpl,\r\n\t\tpt,\r\n\t\tro,\r\n\t\tru,\r\n\t\tsi,\r\n\t\tsk,\r\n\t\tsv,\r\n\t\ttr,\r\n\t\tua\r\n\t});\r\n}","// all builds except for evaluation version get this mockup\r\n// the evaluation build gets actual codes\r\nexport default () => {};","function extend(gantt) {\n gantt.destructor = function () {\n this.clearAll();\n this.callEvent(\"onDestroy\", []);\n\n if (this.$root) {\n delete this.$root.gantt;\n }\n\n if (this._eventRemoveAll) {\n this._eventRemoveAll();\n }\n\n if (this.$layout) {\n this.$layout.destructor();\n }\n\n if (this.resetLightbox) {\n this.resetLightbox();\n }\n\n if (this._dp && this._dp.destructor) {\n this._dp.destructor();\n }\n\n this.$services.destructor(); // detachAllEvents should be called last, because in components may be attached events\n\n this.detachAllEvents();\n\n for (var i in this) {\n if (i.indexOf(\"$\") === 0) {\n delete this[i];\n }\n }\n\n this.$destroyed = true;\n };\n}\n\nmodule.exports = extend;","/*\r\n \tasserts will be removed in final code, so you can place them anythere\r\n\twithout caring about performance impacts\r\n*/\nmodule.exports = function (gantt) {\n return function assert(check, message) {\n if (!check) {\n if (gantt.config.show_errors && gantt.callEvent(\"onError\", [message]) !== false) {\n if (gantt.message) {\n gantt.message({\n type: \"error\",\n text: message,\n expire: -1\n });\n } else {\n // eslint-disable-next-line\n console.log(message);\n } // eslint-disable-next-line no-debugger\n\n\n debugger;\n }\n }\n };\n};","function addResizeListener(gantt) {\n var containerStyles = window.getComputedStyle(gantt.$root);\n\n if (containerStyles.getPropertyValue(\"position\") == \"static\") {\n gantt.$root.style.position = \"relative\";\n }\n\n var resizeWatcher = document.createElement('iframe');\n resizeWatcher.className = \"gantt_container_resize_watcher\";\n resizeWatcher.tabIndex = -1;\n\n if (gantt.config.wai_aria_attributes) {\n resizeWatcher.setAttribute(\"role\", \"none\");\n resizeWatcher.setAttribute(\"aria-hidden\", true);\n }\n\n var salesforce_environment = !!window[\"Sfdc\"] || !!window[\"$A\"] || window[\"Aura\"];\n\n if (salesforce_environment) {\n gantt.config.container_resize_method = \"timeout\";\n } // in some environments (namely, in SalesForce) iframe.contentWindow is not available\n\n\n gantt.$root.appendChild(resizeWatcher);\n\n if (resizeWatcher.contentWindow) {\n listenWindowResize(gantt, resizeWatcher.contentWindow);\n } else {\n // if so - ditch the iframe and fallback to listening the main window resize\n gantt.$root.removeChild(resizeWatcher);\n listenWindowResize(gantt, window);\n }\n}\n\nfunction listenWindowResize(gantt, window) {\n var resizeTimeout = gantt.config.container_resize_timeout || 20;\n var resizeDelay;\n\n if (gantt.config.container_resize_method == \"timeout\") {\n lowlevelResizeWatcher();\n } else {\n try {\n gantt.event(window, \"resize\", function () {\n if (gantt.$scrollbarRepaint) {\n gantt.$scrollbarRepaint = null;\n } else {\n repaintGantt();\n }\n });\n } catch (e) {\n lowlevelResizeWatcher();\n }\n }\n\n function repaintGantt() {\n clearTimeout(resizeDelay);\n resizeDelay = setTimeout(function () {\n if (!gantt.$destroyed) {\n gantt.render();\n }\n }, resizeTimeout);\n }\n\n var previousHeight = gantt.$root.offsetHeight;\n var previousWidth = gantt.$root.offsetWidth;\n\n function lowlevelResizeWatcher() {\n if (gantt.$root.offsetHeight != previousHeight || gantt.$root.offsetWidth != previousWidth) {\n repaintGantt();\n }\n\n previousHeight = gantt.$root.offsetHeight;\n previousWidth = gantt.$root.offsetWidth;\n setTimeout(lowlevelResizeWatcher, resizeTimeout);\n }\n}\n\nmodule.exports = addResizeListener;","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar domHelpers = require(\"./ui/utils/dom_helpers\"),\n helpers = require(\"../utils/helpers\");\n\nvar isHeadless = require(\"../utils/is_headless\");\n\nvar addResizeListener = require(\"./ui/resize_listener\");\n\nmodule.exports = function (gantt) {\n var calculateScaleRange = require(\"./gantt_data_range\");\n\n gantt.assert = require(\"./common/assert\")(gantt);\n\n function isHTMLElement(node) {\n try {\n node.cloneNode(false);\n } catch (e) {\n return false;\n }\n\n return true;\n }\n\n var invalidContainerMessage = \"Invalid value of the first argument of `gantt.init`. Supported values: HTMLElement, String (element id).\" + \"This error means that either invalid object is passed into `gantt.init` or that the element with the specified ID doesn't exist on the page when `gantt.init` is called.\";\n\n function validateNode(node) {\n if (!node || typeof node == 'string' && document.getElementById(node)) return true;\n if (isHTMLElement(node)) return true;\n gantt.assert(false, invalidContainerMessage);\n throw new Error(invalidContainerMessage);\n } //initial initialization\n\n\n gantt.init = function (node, from, to) {\n if (gantt.env.isNode) {\n node = null; // for the nodejs version\n } else {\n validateNode(node); // for the web version\n }\n\n if (from && to) {\n this.config.start_date = this._min_date = new Date(from);\n this.config.end_date = this._max_date = new Date(to);\n }\n\n this.date.init(); //can be called only once\n\n this.init = function (node) {\n if (gantt.env.isNode) {\n node = null; // for the nodejs version\n } else {\n validateNode(node); // for the web version\n }\n\n if (this.$container && this.$container.parentNode) {\n this.$container.parentNode.removeChild(this.$container);\n this.$container = null;\n }\n\n if (this.$layout) {\n this.$layout.clear();\n }\n\n this._reinit(node);\n };\n\n this._reinit(node);\n };\n\n gantt._quickRefresh = function (code) {\n var stores = this._getDatastores.call(this);\n\n for (var i = 0; i < stores.length; i++) {\n stores[i]._quick_refresh = true;\n }\n\n code();\n\n for (var i = 0; i < stores.length; i++) {\n stores[i]._quick_refresh = false;\n }\n };\n\n var dropLayout = function dropLayout() {\n if (this._clearTaskLayers) {\n this._clearTaskLayers();\n }\n\n if (this._clearLinkLayers) {\n this._clearLinkLayers();\n }\n\n if (this.$layout) {\n this.$layout.destructor();\n this.$layout = null;\n this.$ui.reset();\n }\n }.bind(gantt);\n\n var rebuildLayout = function rebuildLayout() {\n if (isHeadless(gantt)) {\n return;\n }\n\n this.$root.innerHTML = \"\";\n this.$root.gantt = this;\n calculateScaleRange(this);\n this.config.layout.id = \"main\";\n this.$layout = this.$ui.createView(\"layout\", this.$root, this.config.layout);\n this.$layout.attachEvent(\"onBeforeResize\", function () {\n var storeNames = gantt.$services.getService(\"datastores\");\n\n for (var i = 0; i < storeNames.length; i++) {\n gantt.getDatastore(storeNames[i]).filter();\n gantt.getDatastore(storeNames[i]).callEvent(\"onBeforeRefreshAll\", []);\n }\n });\n this.$layout.attachEvent(\"onResize\", function () {\n gantt._quickRefresh(function () {\n gantt.refreshData();\n });\n });\n this.callEvent(\"onGanttLayoutReady\", []);\n this.$layout.render();\n this.$container = this.$layout.$container.firstChild;\n addResizeListener(this);\n }.bind(gantt);\n\n gantt.resetLayout = function () {\n dropLayout();\n rebuildLayout();\n this.render();\n };\n\n gantt._reinit = function (node) {\n this.callEvent(\"onBeforeGanttReady\", []);\n\n this._update_flags();\n\n var config = this.$services.getService(\"templateLoader\");\n config.initTemplates(this);\n dropLayout();\n this.$root = null;\n\n if (node) {\n this.$root = domHelpers.toNode(node);\n rebuildLayout();\n this.$mouseEvents.reset(this.$root);\n }\n\n this.callEvent(\"onTemplatesReady\", []);\n this.callEvent(\"onGanttReady\", []);\n this.render();\n };\n\n gantt.$click = {\n buttons: {\n \"edit\": function edit(id) {\n if (gantt.isReadonly(gantt.getTask(id))) {\n return;\n }\n\n gantt.showLightbox(id);\n },\n \"delete\": function _delete(id) {\n var task = gantt.getTask(id);\n\n if (gantt.isReadonly(task)) {\n return;\n }\n\n var question = gantt.locale.labels.confirm_deleting;\n var title = gantt.locale.labels.confirm_deleting_title;\n\n gantt._simple_confirm(question, title, function () {\n if (!gantt.isTaskExists(id)) {\n gantt.hideLightbox();\n return;\n }\n\n if (task.$new) {\n gantt.silent(function () {\n gantt.deleteTask(id, true);\n });\n gantt.refreshData();\n } else {\n gantt.deleteTask(id);\n }\n\n gantt.hideLightbox();\n });\n }\n }\n }; //renders self\n\n gantt.render = function () {\n this.callEvent(\"onBeforeGanttRender\", []);\n var visibleDate;\n\n if (!isHeadless(gantt)) {\n if (!this.config.sort && this._sort) {\n this._sort = undefined;\n }\n\n if (this.$root) {\n if (this.config.rtl) {\n this.$root.classList.add(\"gantt_rtl\");\n this.$root.firstChild.classList.add(\"gantt_rtl\"); // GS-1499\n } else {\n this.$root.classList.remove(\"gantt_rtl\");\n this.$root.firstChild.classList.remove(\"gantt_rtl\"); // GS-1499\n }\n }\n\n var pos = this.getScrollState();\n var posX = pos ? pos.x : 0;\n\n if (this._getHorizontalScrollbar()) {\n var scrollbar = this._getHorizontalScrollbar();\n\n posX = scrollbar.$config.codeScrollLeft || posX || 0;\n }\n\n visibleDate = null;\n\n if (posX) {\n visibleDate = gantt.dateFromPos(posX + this.config.task_scroll_offset);\n }\n }\n\n calculateScaleRange(this);\n\n if (!isHeadless(gantt)) {\n this.$layout.$config.autosize = this.config.autosize;\n var preserveScroll = this.config.preserve_scroll;\n this.config.preserve_scroll = false; // prevent scrolling from layout resize, scroll will be called here later on\n\n this.$layout.resize();\n this.config.preserve_scroll = preserveScroll;\n\n if (this.config.preserve_scroll && pos) {\n // GS-1640: We need pos.y, otherwise part of the timeline won't be rendered if the scrollbar disappeared\n if (posX || pos.y) {\n var new_pos = gantt.getScrollState();\n var new_date = gantt.dateFromPos(new_pos.x);\n\n if (!(+visibleDate == +new_date && new_pos.y == pos.y)) {\n var posX = null;\n var posY = null;\n\n if (visibleDate) {\n var posX = Math.max(gantt.posFromDate(visibleDate) - gantt.config.task_scroll_offset, 0);\n }\n\n if (pos.y) {\n posY = pos.y;\n }\n\n gantt.scrollTo(posX, posY);\n }\n } // GS-1640: We need to reset the scroll position for the grid if the scrollbar disappeared and\n // the grid and timeline have different scrollbars\n\n\n var gridCell = gantt.$ui.getView(\"grid\");\n\n if (gridCell) {\n var attachedScrollbar = gridCell.$config.scrollY;\n var verticalScrollbar = gantt.$ui.getView(attachedScrollbar);\n\n if (verticalScrollbar) {\n var scrollbarNodeVisible = gantt.utils.dom.isChildOf(verticalScrollbar.$view, gantt.$container);\n\n if (!scrollbarNodeVisible) {\n gridCell.scrollTo(undefined, 0);\n }\n }\n }\n }\n } else {\n gantt.refreshData();\n }\n\n this.callEvent(\"onGanttRender\", []);\n }; //TODO: add layout.resize method that wouldn't trigger data repaint\n\n\n gantt.setSizes = gantt.render;\n\n gantt.getTaskRowNode = function (id) {\n var els = this.$grid_data.childNodes;\n var attribute = this.config.task_attribute;\n\n for (var i = 0; i < els.length; i++) {\n if (els[i].getAttribute) {\n var value = els[i].getAttribute(attribute);\n if (value == id) return els[i];\n }\n }\n\n return null;\n };\n\n gantt.changeLightboxType = function (type) {\n if (this.getLightboxType() == type) return true;\n\n gantt._silent_redraw_lightbox(type);\n };\n\n gantt._get_link_type = function (from_start, to_start) {\n var type = null;\n\n if (from_start && to_start) {\n type = gantt.config.links.start_to_start;\n } else if (!from_start && to_start) {\n type = gantt.config.links.finish_to_start;\n } else if (!from_start && !to_start) {\n type = gantt.config.links.finish_to_finish;\n } else if (from_start && !to_start) {\n type = gantt.config.links.start_to_finish;\n }\n\n return type;\n };\n\n gantt.isLinkAllowed = function (from, to, from_start, to_start) {\n var link = null;\n\n if (_typeof(from) == \"object\") {\n link = from;\n } else {\n link = {\n source: from,\n target: to,\n type: this._get_link_type(from_start, to_start)\n };\n }\n\n if (!link) return false;\n if (!(link.source && link.target && link.type)) return false;\n if (link.source == link.target) return false;\n var res = true; //any custom rules\n\n if (this.checkEvent(\"onLinkValidation\")) res = this.callEvent(\"onLinkValidation\", [link]);\n return res;\n };\n\n gantt._correct_dst_change = function (date, prevOffset, step, unit) {\n var time_unit = helpers.getSecondsInUnit(unit) * step;\n\n if (time_unit > 60 * 60 && time_unit < 60 * 60 * 24) {\n //correct dst change only if current unit is more than one hour and less than day (days have own checking), e.g. 12h\n var offsetChanged = date.getTimezoneOffset() - prevOffset;\n\n if (offsetChanged) {\n date = gantt.date.add(date, offsetChanged, \"minute\");\n }\n }\n\n return date;\n };\n\n gantt.isSplitTask = function (task) {\n gantt.assert(task && task instanceof Object, \"Invalid argument task=\" + task + \" of gantt.isSplitTask. Task object was expected\");\n return this.$data.tasksStore._isSplitItem(task);\n };\n\n gantt._is_icon_open_click = function (e) {\n if (!e) return false;\n var target = e.target || e.srcElement;\n if (!(target && target.className)) return false;\n var className = domHelpers.getClassName(target);\n if (className.indexOf(\"gantt_tree_icon\") !== -1 && (className.indexOf(\"gantt_close\") !== -1 || className.indexOf(\"gantt_open\") !== -1)) return true;\n return false;\n };\n};","/*\r\n reuse results of functions that can be recalculated during rendering\r\n greatly increases the rendering speed when critical path enabled\r\n Sample - 94_dev/critical_path.html\r\n\r\n */\nmodule.exports = function (gantt) {\n gantt._cached_functions = {\n cache: {},\n mode: false,\n critical_path_mode: false,\n wrap_methods: function wrap_methods(methods, object) {\n if (object._prefetch_originals) {\n for (var i in object._prefetch_originals) {\n object[i] = object._prefetch_originals[i];\n }\n }\n\n object._prefetch_originals = {};\n\n for (var i = 0; i < methods.length; i++) {\n this.prefetch(methods[i], object);\n }\n },\n prefetch: function prefetch(methodname, host) {\n var original = host[methodname];\n\n if (original) {\n var optimizer = this;\n host._prefetch_originals[methodname] = original;\n\n host[methodname] = function get_prefetched_value() {\n var argumentsArray = new Array(arguments.length);\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n argumentsArray[i] = arguments[i];\n }\n\n if (optimizer.active) {\n var args = optimizer.get_arguments_hash(Array.prototype.slice.call(argumentsArray));\n\n if (!optimizer.cache[methodname]) {\n optimizer.cache[methodname] = {};\n }\n\n var cached_values = optimizer.cache[methodname];\n\n if (optimizer.has_cached_value(cached_values, args)) {\n return optimizer.get_cached_value(cached_values, args);\n } else {\n var value = original.apply(this, argumentsArray);\n optimizer.cache_value(cached_values, args, value);\n return value;\n }\n }\n\n return original.apply(this, argumentsArray);\n };\n }\n\n return original;\n },\n cache_value: function cache_value(cache, arguments_hash, value) {\n if (this.is_date(value)) value = new Date(value);\n cache[arguments_hash] = value;\n },\n has_cached_value: function has_cached_value(cache, arguments_hash) {\n return cache.hasOwnProperty(arguments_hash);\n },\n get_cached_value: function get_cached_value(cache, arguments_hash) {\n var data = cache[arguments_hash]; //for cached dates - return copy\n\n if (this.is_date(data)) {\n data = new Date(data);\n }\n\n return data;\n },\n is_date: function is_date(value) {\n return value && value.getUTCDate;\n },\n get_arguments_hash: function get_arguments_hash(args) {\n var values = [];\n\n for (var i = 0; i < args.length; i++) {\n values.push(this.stringify_argument(args[i]));\n }\n\n return \"(\" + values.join(\";\") + \")\";\n },\n stringify_argument: function stringify_argument(value) {\n //expecting task or link, or any other data entries, dates and primitive values\n var ret = \"\";\n\n if (value.id) {\n ret = value.id;\n } else if (this.is_date(value)) {\n ret = value.valueOf();\n } else {\n ret = value;\n }\n\n return ret + \"\";\n },\n activate: function activate() {\n this.clear();\n this.active = true;\n },\n deactivate: function deactivate() {\n this.clear();\n this.active = false;\n },\n clear: function clear() {\n this.cache = {};\n },\n setup: function setup(gantt) {\n var override_gantt = [];\n var gantt_methods = ['_isProjectEnd', '_getProjectEnd', '_getSlack'];\n\n if (this.mode == 'auto') {\n if (gantt.config.highlight_critical_path) {\n override_gantt = gantt_methods;\n }\n } else if (this.mode === true) {\n override_gantt = gantt_methods;\n }\n\n this.wrap_methods(override_gantt, gantt);\n },\n update_if_changed: function update_if_changed(gantt) {\n var changed = this.critical_path_mode != gantt.config.highlight_critical_path || this.mode !== gantt.config.optimize_render;\n\n if (changed) {\n this.critical_path_mode = gantt.config.highlight_critical_path;\n this.mode = gantt.config.optimize_render;\n this.setup(gantt);\n }\n }\n };\n\n function activate() {\n gantt._cached_functions.update_if_changed(gantt);\n\n if (!gantt._cached_functions.active) {\n gantt._cached_functions.activate();\n }\n\n return true;\n }\n\n gantt.attachEvent(\"onBeforeGanttRender\", activate);\n gantt.attachEvent(\"onBeforeDataRender\", activate);\n gantt.attachEvent(\"onBeforeSmartRender\", function () {\n activate();\n });\n gantt.attachEvent(\"onBeforeParse\", activate);\n gantt.attachEvent(\"onDataRender\", function () {\n gantt._cached_functions.deactivate();\n });\n var deactivTimeout = null;\n gantt.attachEvent(\"onSmartRender\", function () {\n if (deactivTimeout) clearTimeout(deactivTimeout);\n deactivTimeout = setTimeout(function () {\n gantt._cached_functions.deactivate();\n }, 1000);\n });\n gantt.attachEvent(\"onBeforeGanttReady\", function () {\n gantt._cached_functions.update_if_changed(gantt);\n\n return true;\n });\n};","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nmodule.exports = function (gantt) {\n gantt.getTaskType = function (type) {\n var checkType = type;\n\n if (type && _typeof(type) == \"object\") {\n checkType = type.type;\n }\n\n for (var i in this.config.types) {\n if (this.config.types[i] == checkType) {\n return checkType;\n }\n }\n\n return gantt.config.types.task;\n };\n};","// all builds except for evaluation version get this mockup\r\n// the evaluation build gets actual codes\r\nexport default () => {};","var helpers = require(\"../utils/helpers\");\n\nmodule.exports = function (gantt) {\n gantt.isUnscheduledTask = function (task) {\n gantt.assert(task && task instanceof Object, \"Invalid argument task=\" + task + \" of gantt.isUnscheduledTask. Task object was expected\");\n return !!task.unscheduled || !task.start_date;\n };\n\n gantt._isAllowedUnscheduledTask = function (task) {\n return !!(task.unscheduled && gantt.config.show_unscheduled);\n };\n\n gantt._isTaskInTimelineLimits = function (task) {\n var taskStart = task.start_date ? task.start_date.valueOf() : null;\n var taskEnd = task.end_date ? task.end_date.valueOf() : null;\n return !!(taskStart && taskEnd && taskStart <= this._max_date.valueOf() && taskEnd >= this._min_date.valueOf());\n };\n\n gantt.isTaskVisible = function (id) {\n if (!this.isTaskExists(id)) {\n return false;\n }\n\n var task = this.getTask(id);\n\n if (!(this._isAllowedUnscheduledTask(task) || this._isTaskInTimelineLimits(task))) {\n return false;\n }\n\n return !!(this.getGlobalTaskIndex(id) >= 0);\n };\n\n gantt._getProjectEnd = function () {\n if (gantt.config.project_end) {\n return gantt.config.project_end;\n } else {\n var tasks = gantt.getTaskByTime();\n tasks = tasks.sort(function (a, b) {\n return +a.end_date > +b.end_date ? 1 : -1;\n });\n return tasks.length ? tasks[tasks.length - 1].end_date : null;\n }\n };\n\n gantt._getProjectStart = function () {\n if (gantt.config.project_start) {\n return gantt.config.project_start;\n } // use timeline start if project start is not specified\n\n\n if (gantt.config.start_date) {\n return gantt.config.start_date;\n }\n\n if (gantt.getState().min_date) {\n return gantt.getState().min_date;\n } // earliest task start if neither project start nor timeline are specified\n\n\n var tasks = gantt.getTaskByTime();\n tasks = tasks.sort(function (a, b) {\n return +a.start_date > +b.start_date ? 1 : -1;\n });\n return tasks.length ? tasks[0].start_date : null;\n };\n\n var getDefaultTaskDate = function getDefaultTaskDate(item, parent_id) {\n var parentExists = parent_id && parent_id != gantt.config.root_id && gantt.isTaskExists(parent_id);\n var parent = parentExists ? gantt.getTask(parent_id) : false,\n startDate = null;\n\n if (parent) {\n if (gantt.config.schedule_from_end) {\n startDate = gantt.calculateEndDate({\n start_date: parent.end_date,\n duration: -gantt.config.duration_step,\n task: item\n });\n } else {\n startDate = parent.start_date;\n }\n } else if (gantt.config.schedule_from_end) {\n startDate = gantt.calculateEndDate({\n start_date: gantt._getProjectEnd(),\n duration: -gantt.config.duration_step,\n task: item\n });\n } else {\n var first = gantt.getTaskByIndex(0);\n startDate = first ? first.start_date ? first.start_date : first.end_date ? gantt.calculateEndDate({\n start_date: first.end_date,\n duration: -gantt.config.duration_step,\n task: item\n }) : null : gantt.config.start_date || gantt.getState().min_date;\n }\n\n gantt.assert(startDate, \"Invalid dates\");\n return new Date(startDate);\n };\n\n gantt._set_default_task_timing = function (task) {\n task.start_date = task.start_date || getDefaultTaskDate(task, gantt.getParent(task));\n task.duration = task.duration || gantt.config.duration_step;\n task.end_date = task.end_date || gantt.calculateEndDate(task);\n };\n\n gantt.createTask = function (item, parent, index) {\n item = item || {};\n if (!gantt.defined(item.id)) item.id = gantt.uid();\n\n if (!item.start_date) {\n item.start_date = getDefaultTaskDate(item, parent);\n }\n\n if (item.text === undefined) {\n item.text = gantt.locale.labels.new_task;\n }\n\n if (item.duration === undefined) {\n item.duration = 1;\n }\n\n if (this.isTaskExists(parent)) {\n this.setParent(item, parent, true);\n var parentObj = this.getTask(parent);\n parentObj.$open = true;\n }\n\n if (!this.callEvent(\"onTaskCreated\", [item])) {\n return null;\n }\n\n if (this.config.details_on_create) {\n //GS-761: assert unique ID\n if (gantt.isTaskExists(item.id)) {\n var task = gantt.getTask(item.id);\n\n if (task.$index != item.$index) {\n // Someone may try to mistakenly add a task with the same ID, and most likely\n // use the string format for the dates. Gantt shouldn't break in this scenario\n if (item.start_date && typeof item.start_date === \"string\") {\n item.start_date = this.date.parseDate(item.start_date, \"parse_date\");\n }\n\n if (item.end_date && typeof item.end_date === \"string\") {\n item.end_date = this.date.parseDate(item.end_date, \"parse_date\");\n }\n\n this.$data.tasksStore.updateItem(item.id, item);\n }\n } else {\n item.$new = true;\n this.silent(function () {\n gantt.$data.tasksStore.addItem(item, index);\n });\n }\n\n this.selectTask(item.id);\n this.refreshData();\n this.showLightbox(item.id);\n } else {\n if (this.addTask(item, parent, index)) {\n this.showTask(item.id);\n this.selectTask(item.id);\n }\n }\n\n return item.id;\n };\n\n gantt._update_flags = function (oldid, newid) {\n // TODO: need a proper way to update all possible flags\n var store = gantt.$data.tasksStore;\n\n if (oldid === undefined) {\n this._lightbox_id = null;\n store.silent(function () {\n store.unselect();\n }); // GS-1522. If we have multiselect, unselect all previously selected tasks\n\n if (this.getSelectedTasks) {\n this._multiselect.reset();\n }\n\n if (this._tasks_dnd && this._tasks_dnd.drag) {\n this._tasks_dnd.drag.id = null;\n }\n } else {\n if (this._lightbox_id == oldid) this._lightbox_id = newid; // TODO: probably can be removed\n\n if (store.getSelectedId() == oldid) {\n store.silent(function () {\n store.unselect(oldid);\n store.select(newid);\n });\n }\n\n if (this._tasks_dnd && this._tasks_dnd.drag && this._tasks_dnd.drag.id == oldid) {\n this._tasks_dnd.drag.id = newid;\n }\n }\n };\n\n var getTaskTimingMode = function getTaskTimingMode(task, force) {\n var task_type = gantt.getTaskType(task.type);\n var state = {\n type: task_type,\n $no_start: false,\n $no_end: false\n };\n\n if (!force && task_type == task.$rendered_type) {\n state.$no_start = task.$no_start;\n state.$no_end = task.$no_end;\n return state;\n }\n\n if (task_type == gantt.config.types.project) {\n //project duration is always defined by children duration\n state.$no_end = state.$no_start = true;\n } else if (task_type != gantt.config.types.milestone) {\n //tasks can have fixed duration, children duration(as projects), or one date fixed, and other defined by nested items\n state.$no_end = !(task.end_date || task.duration);\n state.$no_start = !task.start_date;\n\n if (gantt._isAllowedUnscheduledTask(task)) {\n state.$no_end = state.$no_start = false;\n }\n }\n\n return state;\n };\n\n gantt._init_task_timing = function (task) {\n var task_mode = getTaskTimingMode(task, true);\n var dirty = task.$rendered_type != task_mode.type;\n var task_type = task_mode.type;\n\n if (dirty) {\n task.$no_start = task_mode.$no_start;\n task.$no_end = task_mode.$no_end;\n task.$rendered_type = task_mode.type;\n }\n\n if (dirty && task_type != this.config.types.milestone) {\n if (task_type == this.config.types.project) {\n //project duration is always defined by children duration\n this._set_default_task_timing(task);\n\n task.$calculate_duration = false; // do not recalculate duration below\n }\n }\n\n if (task_type == this.config.types.milestone) {\n task.end_date = task.start_date;\n }\n\n if (task.start_date && task.end_date && task.$calculate_duration !== false) {\n task.duration = this.calculateDuration(task);\n }\n\n if (!task.$calculate_duration) {\n task.$calculate_duration = true;\n }\n\n if (!task.end_date) {\n task.end_date = task.start_date;\n }\n\n task.duration = task.duration || 0; // GS-1145. We should let tasks to have 0 duration if user wants it\n\n if (this.config.min_duration === 0 && task.duration === 0) {\n task.$no_end = false;\n } // work calendar of task has changed\n\n\n var effectiveCalendar = this.getTaskCalendar(task);\n\n if (task.$effective_calendar && task.$effective_calendar !== effectiveCalendar.id) {\n updateTaskTiming(task);\n\n if (this.config.inherit_calendar && this.isSummaryTask(task)) {\n this.eachTask(function (child) {\n updateTaskTiming(child);\n }, task.id);\n }\n }\n\n task.$effective_calendar = effectiveCalendar.id;\n };\n\n function updateTaskTiming(task) {\n task.$effective_calendar = gantt.getTaskCalendar(task).id;\n task.start_date = gantt.getClosestWorkTime({\n dir: \"future\",\n date: task.start_date,\n unit: gantt.config.duration_unit,\n task: task\n });\n task.end_date = gantt.calculateEndDate(task);\n }\n\n gantt.isSummaryTask = function (task) {\n gantt.assert(task && task instanceof Object, \"Invalid argument task=\" + task + \" of gantt.isSummaryTask. Task object was expected\");\n var mode = getTaskTimingMode(task);\n return !!(mode.$no_end || mode.$no_start);\n }; // downward calculation of project duration\n\n\n gantt.resetProjectDates = function (task) {\n var taskMode = getTaskTimingMode(task);\n\n if (taskMode.$no_end || taskMode.$no_start) {\n var info = getSubtaskInfo(task.id);\n assignProjectDates.call(this, task, taskMode, info.start_date, info.end_date);\n task.$rollup = info.rollup;\n }\n };\n\n function assignProjectDates(task, taskTiming, from, to) {\n if (taskTiming.$no_start) {\n if (from) {\n task.start_date = new Date(from);\n } else {\n task.start_date = getDefaultTaskDate(task, this.getParent(task));\n }\n }\n\n if (taskTiming.$no_end) {\n if (to) {\n task.end_date = new Date(to);\n } else {\n task.end_date = this.calculateEndDate({\n start_date: task.start_date,\n duration: this.config.duration_step,\n task: task\n });\n }\n }\n\n if (taskTiming.$no_start || taskTiming.$no_end) {\n this._init_task_timing(task);\n }\n }\n\n gantt.getSubtaskDuration = function (taskId) {\n var res = 0,\n root = taskId !== undefined ? taskId : gantt.config.root_id;\n this.eachTask(function (child) {\n if (this.getTaskType(child.type) == gantt.config.types.project || this.isUnscheduledTask(child)) return;\n res += child.duration;\n }, root);\n return res;\n };\n\n function getSubtaskInfo(taskId) {\n var min = null,\n max = null,\n root = taskId !== undefined ? taskId : gantt.config.root_id,\n rollup = [];\n gantt.eachTask(function (child) {\n if (gantt.getTaskType(child.type) == gantt.config.types.project || gantt.isUnscheduledTask(child)) return;\n\n if (child.rollup) {\n rollup.push(child.id);\n }\n\n if (child.start_date && !child.$no_start && (!min || min > child.start_date.valueOf())) min = child.start_date.valueOf();\n if (child.end_date && !child.$no_end && (!max || max < child.end_date.valueOf())) max = child.end_date.valueOf();\n }, root);\n return {\n start_date: min ? new Date(min) : null,\n end_date: max ? new Date(max) : null,\n rollup: rollup\n };\n }\n\n gantt.getSubtaskDates = function (task_id) {\n var info = getSubtaskInfo(task_id);\n return {\n start_date: info.start_date,\n end_date: info.end_date\n };\n }; // upward calculation of project duration\n\n\n gantt._update_parents = function (taskId, silent, updateAll) {\n if (!taskId) return;\n var task = this.getTask(taskId);\n\n if (task.rollup) {\n updateAll = true;\n }\n\n var pid = this.getParent(task);\n var taskTiming = getTaskTimingMode(task);\n var has_changed = true; // GS-761 the dates check is necessary for adding empty tasks: gantt.addTask({id:\"2\"})\n\n if (updateAll || task.start_date && task.end_date && (taskTiming.$no_start || taskTiming.$no_end)) {\n var oldStart = task.start_date.valueOf(),\n oldEnd = task.end_date.valueOf();\n gantt.resetProjectDates(task); // not refresh parent projects if dates hasn't changed\n\n if (!updateAll && oldStart == task.start_date.valueOf() && oldEnd == task.end_date.valueOf()) {\n has_changed = false;\n }\n\n if (has_changed && !silent) {\n this.refreshTask(task.id, true);\n }\n }\n\n if (has_changed && pid && this.isTaskExists(pid)) {\n this._update_parents(pid, silent, updateAll);\n }\n };\n\n gantt.roundDate = function (config) {\n var scale = gantt.getScale();\n\n if (helpers.isDate(config)) {\n config = {\n date: config,\n unit: scale ? scale.unit : gantt.config.duration_unit,\n step: scale ? scale.step : gantt.config.duration_step\n };\n }\n\n var date = config.date,\n steps = config.step,\n unit = config.unit;\n\n if (!scale) {\n return date;\n }\n\n var upper, lower, colIndex;\n\n if (unit == scale.unit && steps == scale.step && +date >= +scale.min_date && +date <= +scale.max_date) {\n //find date in time scale config\n colIndex = Math.floor(gantt.columnIndexByDate(date));\n\n if (!scale.trace_x[colIndex]) {\n colIndex -= 1; // end of time scale\n\n if (scale.rtl) {\n colIndex = 0;\n }\n }\n\n lower = new Date(scale.trace_x[colIndex]);\n upper = gantt.date.add(lower, steps, unit);\n } else {\n colIndex = Math.floor(gantt.columnIndexByDate(date));\n upper = gantt.date[unit + \"_start\"](new Date(scale.min_date));\n\n if (scale.trace_x[colIndex]) {\n upper = gantt.date[unit + \"_start\"](scale.trace_x[colIndex]); // end of time scale\n }\n\n while (+upper < +date) {\n upper = gantt.date[unit + \"_start\"](gantt.date.add(upper, steps, unit));\n var tzOffset = upper.getTimezoneOffset();\n upper = gantt._correct_dst_change(upper, tzOffset, upper, unit);\n if (gantt.date[unit + '_start']) upper = gantt.date[unit + '_start'](upper);\n }\n\n lower = gantt.date.add(upper, -1 * steps, unit);\n }\n\n if (config.dir && config.dir == 'future') return upper;\n if (config.dir && config.dir == 'past') return lower;\n\n if (Math.abs(date - lower) < Math.abs(upper - date)) {\n return lower;\n } else {\n return upper;\n }\n };\n\n gantt.correctTaskWorkTime = function (task) {\n if (gantt.config.work_time && gantt.config.correct_work_time) {\n if (!this.isWorkTime(task.start_date, undefined, task)) {\n task.start_date = this.getClosestWorkTime({\n date: task.start_date,\n dir: 'future',\n task: task\n });\n task.end_date = this.calculateEndDate(task);\n } else if (!this.isWorkTime(new Date(+task.end_date - 1), undefined, task)) {\n task.end_date = this.calculateEndDate(task);\n }\n }\n };\n\n gantt.attachEvent(\"onBeforeTaskUpdate\", function (id, task) {\n gantt._init_task_timing(task);\n\n return true;\n });\n gantt.attachEvent(\"onBeforeTaskAdd\", function (id, task) {\n gantt._init_task_timing(task);\n\n return true;\n });\n gantt.attachEvent(\"onAfterTaskMove\", function (id, parent, tindex) {\n gantt._init_task_timing(gantt.getTask(id));\n\n return true;\n });\n};","// TODO: rework public api for date methods\nvar utils = require(\"../../utils/utils\");\n\nvar createWorkTimeFacade = function createWorkTimeFacade(calendarManager, timeCalculator) {\n return {\n getWorkHours: function getWorkHours(date) {\n return timeCalculator.getWorkHours(date);\n },\n setWorkTime: function setWorkTime(config) {\n return timeCalculator.setWorkTime(config);\n },\n unsetWorkTime: function unsetWorkTime(config) {\n timeCalculator.unsetWorkTime(config);\n },\n isWorkTime: function isWorkTime(date, unit, task) {\n return timeCalculator.isWorkTime(date, unit, task);\n },\n getClosestWorkTime: function getClosestWorkTime(config) {\n return timeCalculator.getClosestWorkTime(config);\n },\n calculateDuration: function calculateDuration(start_date, end_date, task) {\n return timeCalculator.calculateDuration(start_date, end_date, task);\n },\n _hasDuration: function _hasDuration(start_date, end_date, task) {\n return timeCalculator.hasDuration(start_date, end_date, task);\n },\n calculateEndDate: function calculateEndDate(start, duration, unit, task) {\n return timeCalculator.calculateEndDate(start, duration, unit, task);\n },\n mergeCalendars: utils.bind(calendarManager.mergeCalendars, calendarManager),\n createCalendar: utils.bind(calendarManager.createCalendar, calendarManager),\n addCalendar: utils.bind(calendarManager.addCalendar, calendarManager),\n getCalendar: utils.bind(calendarManager.getCalendar, calendarManager),\n getCalendars: utils.bind(calendarManager.getCalendars, calendarManager),\n getResourceCalendar: utils.bind(calendarManager.getResourceCalendar, calendarManager),\n getTaskCalendar: utils.bind(calendarManager.getTaskCalendar, calendarManager),\n deleteCalendar: utils.bind(calendarManager.deleteCalendar, calendarManager)\n };\n};\n\nmodule.exports = {\n create: createWorkTimeFacade\n};","function CalendarDisabledTimeStrategy(gantt, argumentsHelper) {\n this.argumentsHelper = argumentsHelper;\n this.$gantt = gantt;\n}\n\nCalendarDisabledTimeStrategy.prototype = {\n getWorkHours: function getWorkHours() {\n return [0, 24];\n },\n setWorkTime: function setWorkTime() {\n return true;\n },\n unsetWorkTime: function unsetWorkTime() {\n return true;\n },\n isWorkTime: function isWorkTime() {\n return true;\n },\n getClosestWorkTime: function getClosestWorkTime(config) {\n var config = this.argumentsHelper.getClosestWorkTimeArguments.apply(this.argumentsHelper, arguments);\n return config.date;\n },\n calculateDuration: function calculateDuration() {\n var config = this.argumentsHelper.getDurationArguments.apply(this.argumentsHelper, arguments);\n var from = config.start_date,\n to = config.end_date,\n unit = config.unit,\n step = config.step;\n return this._calculateDuration(from, to, unit, step);\n },\n _calculateDuration: function _calculateDuration(start, end, unit, step) {\n var dateHelper = this.$gantt.date;\n var fixedUnits = {\n \"week\": 1000 * 60 * 60 * 24 * 7,\n \"day\": 1000 * 60 * 60 * 24,\n \"hour\": 1000 * 60 * 60,\n \"minute\": 1000 * 60\n };\n var res = 0;\n\n if (fixedUnits[unit]) {\n res = Math.round((end - start) / (step * fixedUnits[unit]));\n } else {\n var from = new Date(start),\n to = new Date(end);\n\n while (from.valueOf() < to.valueOf()) {\n res += 1;\n from = dateHelper.add(from, step, unit);\n }\n\n if (from.valueOf() != end.valueOf()) {\n res += (to - from) / (dateHelper.add(from, step, unit) - from);\n }\n }\n\n return Math.round(res);\n },\n hasDuration: function hasDuration() {\n var config = this.argumentsHelper.getDurationArguments.apply(this.argumentsHelper, arguments);\n var from = config.start_date,\n to = config.end_date,\n unit = config.unit;\n\n if (!unit) {\n return false;\n }\n\n from = new Date(from);\n to = new Date(to);\n return from.valueOf() < to.valueOf();\n },\n hasWorkTime: function hasWorkTime() {\n return true;\n },\n equals: function equals(calendar) {\n if (!(calendar instanceof CalendarDisabledTimeStrategy)) {\n return false;\n }\n\n return true;\n },\n calculateEndDate: function calculateEndDate() {\n var config = this.argumentsHelper.calculateEndDateArguments.apply(this.argumentsHelper, arguments);\n var start = config.start_date,\n duration = config.duration,\n unit = config.unit,\n step = config.step;\n return this.$gantt.date.add(start, step * duration, unit);\n }\n};\nmodule.exports = CalendarDisabledTimeStrategy;","var createArgumentsHelper = require(\"./calendar_arguments_helper\"),\n NoWorkTimeCalendar = require(\"./strategy/no_work_time\");\n\nfunction TimeCalculator(calendarManager) {\n this.$gantt = calendarManager.$gantt;\n this.argumentsHelper = createArgumentsHelper(this.$gantt);\n this.calendarManager = calendarManager;\n this.$disabledCalendar = new NoWorkTimeCalendar(this.$gantt, this.argumentsHelper);\n}\n\nTimeCalculator.prototype = {\n _getCalendar: function _getCalendar(config) {\n var calendar;\n\n if (!this.$gantt.config.work_time) {\n calendar = this.$disabledCalendar;\n } else {\n var manager = this.calendarManager;\n\n if (config.task) {\n calendar = manager.getTaskCalendar(config.task);\n } else if (config.id) {\n calendar = manager.getTaskCalendar(config);\n } else if (config.calendar) {\n calendar = config.calendar;\n }\n\n if (!calendar) {\n calendar = manager.getTaskCalendar();\n }\n }\n\n return calendar;\n },\n getWorkHours: function getWorkHours(config) {\n config = this.argumentsHelper.getWorkHoursArguments.apply(this.argumentsHelper, arguments);\n\n var calendar = this._getCalendar(config);\n\n return calendar.getWorkHours(config.date);\n },\n setWorkTime: function setWorkTime(config, calendar) {\n config = this.argumentsHelper.setWorkTimeArguments.apply(this.argumentsHelper, arguments);\n if (!calendar) calendar = this.calendarManager.getCalendar(); // Global\n\n return calendar.setWorkTime(config);\n },\n unsetWorkTime: function unsetWorkTime(config, calendar) {\n config = this.argumentsHelper.unsetWorkTimeArguments.apply(this.argumentsHelper, arguments);\n if (!calendar) calendar = this.calendarManager.getCalendar(); // Global\n\n return calendar.unsetWorkTime(config);\n },\n isWorkTime: function isWorkTime(date, unit, task, calendar) {\n var config = this.argumentsHelper.isWorkTimeArguments.apply(this.argumentsHelper, arguments);\n calendar = this._getCalendar(config);\n return calendar.isWorkTime(config);\n },\n getClosestWorkTime: function getClosestWorkTime(config) {\n config = this.argumentsHelper.getClosestWorkTimeArguments.apply(this.argumentsHelper, arguments);\n\n var calendar = this._getCalendar(config);\n\n return calendar.getClosestWorkTime(config);\n },\n calculateDuration: function calculateDuration() {\n // start_date_date, end_date, task\n var config = this.argumentsHelper.getDurationArguments.apply(this.argumentsHelper, arguments);\n\n var calendar = this._getCalendar(config);\n\n return calendar.calculateDuration(config);\n },\n hasDuration: function hasDuration() {\n var config = this.argumentsHelper.hasDurationArguments.apply(this.argumentsHelper, arguments);\n\n var calendar = this._getCalendar(config);\n\n return calendar.hasDuration(config);\n },\n calculateEndDate: function calculateEndDate(config) {\n // start_date, duration, unit, task\n var config = this.argumentsHelper.calculateEndDateArguments.apply(this.argumentsHelper, arguments);\n\n var calendar = this._getCalendar(config);\n\n return calendar.calculateEndDate(config);\n }\n};\nmodule.exports = TimeCalculator;","module.exports = function () {\n function getResourcesCalendarKey(resourceAssignments) {\n return resourceAssignments.map(function (res) {\n if (res && res.resource_id) {\n return res.resource_id;\n } else {\n return res;\n }\n }).sort().join(\"-\");\n }\n\n var dynamicCalendars = {};\n\n function mergeResourceCalendars(resourceAssignments, manager) {\n return manager.mergeCalendars(resourceAssignments.map(function (assignment) {\n var resourceId = assignment && assignment.resource_id ? assignment.resource_id : assignment;\n return manager.getResourceCalendar(resourceId);\n }));\n }\n\n function getCalendarIdFromMultipleResources(resourceAssignments, manager) {\n var key = getResourcesCalendarKey(resourceAssignments);\n\n if (!resourceAssignments.length) {\n return null;\n } else if (resourceAssignments.length === 1) {\n return manager.getResourceCalendar(key).id;\n } else if (dynamicCalendars[key]) {\n return dynamicCalendars[key].id;\n } else {\n var tempCalendar = mergeResourceCalendars(resourceAssignments, manager);\n dynamicCalendars[key] = tempCalendar;\n return manager.addCalendar(tempCalendar);\n }\n }\n\n return {\n getCalendarIdFromMultipleResources: getCalendarIdFromMultipleResources\n };\n};","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nmodule.exports = {\n isLegacyResourceCalendarFormat: function isLegacyResourceCalendarFormat(resourceCalendarsProperty) {\n // modern format:\n //gantt.config.resource_calendars = {\n //\tresourceId: calendarId,\n //\tresourceId: calendarId,\n //\tresourceId: calendarId\n //\t};\n // legacy format:\n // gantt.config.resource_calendars = {\n //\t\"resourceProperty\": {\n //\t\tresourceId: calendarId,\n //\t\tresourceId: calendarId,\n //\t\tresourceId: calendarId\n //\t\t}\n //\t};\n if (!resourceCalendarsProperty) {\n return false;\n }\n\n for (var i in resourceCalendarsProperty) {\n if (resourceCalendarsProperty[i] && _typeof(resourceCalendarsProperty[i]) === \"object\") {\n return true;\n }\n }\n\n return false;\n },\n getResourceProperty: function getResourceProperty(config) {\n var resourceCalendarsConfig = config.resource_calendars;\n var propertyName = config.resource_property;\n\n if (this.isLegacyResourceCalendarFormat(resourceCalendarsConfig)) {\n for (var i in config) {\n propertyName = i;\n break;\n }\n }\n\n return propertyName;\n },\n getCalendarIdFromLegacyConfig: function getCalendarIdFromLegacyConfig(task, config) {\n if (config) {\n for (var field in config) {\n var resource = config[field];\n\n if (task[field]) {\n var calendarId = resource[task[field]];\n\n if (calendarId) {\n return calendarId;\n }\n }\n }\n }\n\n return null;\n }\n};","export class DateDurationCache {\r\n\tprivate _cache: any;\r\n\tconstructor() {\r\n\t\tthis.clear();\r\n\t}\r\n\r\n\t_getCacheObject(startDate: Date, unit: string, step:number){\r\n\t\tconst cache = this._cache;\r\n\t\tif (!cache[unit]) {\r\n\t\t\tcache[unit] = [];\r\n\t\t}\r\n\t\tlet unitCache = cache[unit];\r\n\t\tif(!unitCache) {\r\n\t\t\tunitCache = cache[unit] = {};\r\n\t\t}\r\n\r\n\t\tlet stepCache = unitCache[step];\r\n\t\tif(!stepCache) {\r\n\t\t\tstepCache = unitCache[step] = {};\r\n\t\t}\r\n\r\n\t\tconst year = startDate.getFullYear();\r\n\t\tlet yearCache = stepCache[year];\r\n\t\tif(!yearCache){\r\n\t\t\tyearCache = stepCache[year] = {durations: {}, endDates: {}};\r\n\t\t}\r\n\r\n\t\treturn yearCache;\r\n\t}\r\n\t_endDateCacheKey(startDate: number, duration: number){\r\n\t\treturn String(startDate) + \"-\" + String(duration);\r\n\t}\r\n\t_durationCacheKey(startDate: number, endDate: number){\r\n\t\treturn String(startDate) + \"-\" + String(endDate);\r\n\t}\r\n\tgetEndDate(startDate: Date, duration: number, unit: string, step: number, compute: () => Date): number|null{\r\n\t\tconst cache = this._getCacheObject(startDate, unit, step);\r\n\r\n\t\tconst startDateTimestamp = startDate.valueOf();\r\n\t\tconst key = this._endDateCacheKey(startDateTimestamp, duration);\r\n\t\tlet endDate;\r\n\t\tif(cache.endDates[key] === undefined){\r\n\t\t\tconst result = compute();\r\n\t\t\tconst resultTimestamp = result.valueOf();\r\n\t\t\tcache.endDates[key] = resultTimestamp;\r\n\t\t\tcache.durations[this._durationCacheKey(startDateTimestamp, resultTimestamp)] = duration;\r\n\t\t\tendDate = result;\r\n\t\t}else{\r\n\t\t\tendDate = new Date(cache.endDates[key]);\r\n\t\t}\r\n\r\n\t\treturn endDate;\r\n\t}\r\n\r\n\tgetDuration(startDate: Date, endDate: Date, unit: string, step: number, compute: () => number): number|null{\r\n\t\tconst cache = this._getCacheObject(startDate, unit, step);\r\n\r\n\t\tconst startDateTimestamp = startDate.valueOf();\r\n\t\tconst endDateTimestamp = endDate.valueOf();\r\n\t\tconst key = this._durationCacheKey(startDateTimestamp, endDateTimestamp);\r\n\t\tlet duration;\r\n\t\tif(cache.durations[key] === undefined){\r\n\t\t\tconst result = compute();\r\n\t\t\tcache.durations[key] = result.valueOf();\r\n\r\n\t\t\t// can't populate end date due to logic of end date calculation, current unit tests capture it\r\n\t\t\t// cache.endDates[this._endDateCacheKey(startDateTimestamp, result)] = endDateTimestamp;\r\n\t\t\tduration = result;\r\n\t\t}else{\r\n\t\t\tduration = cache.durations[key];\r\n\t\t}\r\n\r\n\t\treturn duration;\r\n\t}\r\n\r\n\tclear(): void{\r\n\t\tthis._cache = {};\r\n\t}\r\n}","\r\n\r\nexport class LargerUnitsCache {\r\n\tprivate _weekCache: Map;\r\n\tprivate _monthCache: Map;\r\n\tprivate _calendar: any;\r\n\tconstructor(calendar) {\r\n\t\tthis.clear();\r\n\t\tthis._calendar = calendar;\r\n\t}\r\n\r\n\tgetMinutesPerWeek = (weekStart: Date) => {\r\n\t\tconst key = weekStart.valueOf();\r\n\r\n\t\tif(this._weekCache.has(key)){\r\n\t\t\treturn this._weekCache.get(key);\r\n\t\t}\r\n\r\n\t\tconst calendar = this._calendar;\r\n\t\tconst gantt = this._calendar.$gantt;\r\n\r\n\t\tlet minutesPerWeek = 0;\r\n\t\tlet start = gantt.date.week_start(new Date(weekStart));\r\n\t\tfor(let i = 0; i < 7; i++){\r\n\t\t\tminutesPerWeek += calendar.getHoursPerDay(start) * 60;\r\n\t\t\tstart = gantt.date.add(start, 1, \"day\");\r\n\t\t}\r\n\r\n\t\tthis._weekCache.set(key, minutesPerWeek);\r\n\t\treturn minutesPerWeek;\r\n\t}\r\n\r\n\tgetMinutesPerMonth = (monthStart: Date) => {\r\n\t\tconst key = monthStart.valueOf();\r\n\r\n\t\tif(this._monthCache.has(key)){\r\n\t\t\treturn this._monthCache.get(key);\r\n\t\t}\r\n\r\n\t\tconst calendar = this._calendar;\r\n\t\tconst gantt = this._calendar.$gantt;\r\n\r\n\t\tlet minutesPerMonth = 0;\r\n\t\tlet start = gantt.date.week_start(new Date(monthStart));\r\n\t\tconst nextMonth = gantt.date.add(start, 1, \"month\").valueOf();\r\n\t\twhile(start.valueOf() < nextMonth){\r\n\t\t\tminutesPerMonth += calendar.getHoursPerDay(start) * 60;\r\n\t\t\tstart = gantt.date.add(start, 1, \"day\");\r\n\t\t}\r\n\r\n\t\tthis._monthCache.set(key, minutesPerMonth);\r\n\t\treturn minutesPerMonth;\r\n\t}\r\n\r\n\tclear = (): void => {\r\n\t\tthis._weekCache = new Map();\r\n\t\tthis._monthCache = new Map();\r\n\t}\r\n}","import { IWorkUnitCache } from \"./workunit_cache_interface\";\r\n\r\nexport class WorkUnitsObjectCache implements IWorkUnitCache {\r\n\tprivate _cache: any;\r\n\tconstructor() {\r\n\t\tthis.clear();\r\n\t}\r\n\r\n\tgetItem(unit: string, timestamp: string, value: Date): number|boolean {\r\n\t\tconst cache = this._cache;\r\n\t\tif (cache && cache[unit]) {\r\n\t\t\tconst units = cache[unit];\r\n\t\t\tif(units === undefined){\r\n\t\t\t\treturn -1;\r\n\t\t\t}\r\n\t\t\tconst subCache = units[value.getFullYear()];\r\n\t\t\tif (subCache && subCache[timestamp] !== undefined) {\r\n\t\t\t\treturn subCache[timestamp];\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn -1;\r\n\t}\r\n\tsetItem(unit: string, timestamp: string, value: boolean, rawValue: Date): void {\r\n\t\tif (!unit || !timestamp) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst cache = this._cache;\r\n\r\n\t\tif (!cache) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (!cache[unit]) {\r\n\t\t\tcache[unit] = [];\r\n\t\t}\r\n\t\tconst unitCache = cache[unit];\r\n\r\n\t\tconst year = rawValue.getFullYear();\r\n\t\tlet yearCache = unitCache[year];\r\n\t\tif(!yearCache){\r\n\t\t\tyearCache = unitCache[year] = {};\r\n\t\t}\r\n\t\tyearCache[timestamp] = value;\r\n\t}\r\n\tclear(): void{\r\n\t\tthis._cache = {};\r\n\t}\r\n}","\r\n\r\nimport { IWorkUnitCache } from \"./workunit_cache_interface\";\r\n\r\nexport class WorkUnitsMapCache implements IWorkUnitCache {\r\n\tprivate _cache: Map>>;\r\n\tconstructor() {\r\n\t\tthis.clear();\r\n\t}\r\n\r\n\tgetItem(unit: string, timestamp: string, value: Date): number|boolean {\r\n\t\tif (this._cache.has(unit)) {\r\n\t\t\tconst unitCache = this._cache.get(unit);\r\n\r\n\t\t\tconst subCache = unitCache[value.getFullYear()];\r\n\t\t\tif (subCache && subCache.has(timestamp)) {\r\n\t\t\t\treturn subCache.get(timestamp);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn -1;\r\n\t}\r\n\tsetItem(unit: string, timestamp: string, value: boolean, rawValue: Date): void {\r\n\t\tif (!unit || !timestamp) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst cache = this._cache;\r\n\t\tconst year = rawValue.getFullYear();\r\n\r\n\t\tlet unitCache;\r\n\t\tif (!cache.has(unit)) {\r\n\t\t\tunitCache = [];\r\n\t\t\tcache.set(unit, unitCache);\r\n\t\t} else {\r\n\t\t\tunitCache = cache.get(unit);\r\n\t\t}\r\n\r\n\t\tlet yearCache = unitCache[year];\r\n\t\tif(!yearCache){\r\n\t\t\tyearCache = unitCache[year] = new Map();\r\n\t\t}\r\n\r\n\r\n\t\tyearCache.set(timestamp, value);\r\n\t}\r\n\tclear(): void{\r\n\t\tthis._cache = new Map>>();\r\n\t}\r\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar createCacheObject = require(\"./work_unit_cache\").createCacheObject;\n\nvar LargerUnitsCache = require(\"./work_unit_cache\").LargerUnitsCache;\n\nvar utils = require(\"../../../utils/utils\");\n\nvar DateDurationCache = require(\"./work_unit_cache/date_duration_cache\").DateDurationCache;\n\nfunction CalendarWorkTimeStrategy(gantt, argumentsHelper) {\n this.argumentsHelper = argumentsHelper;\n this.$gantt = gantt;\n this._workingUnitsCache = createCacheObject();\n this._largeUnitsCache = new LargerUnitsCache(this);\n this._dateDurationCache = new DateDurationCache();\n this._worktime = null;\n this._cached_timestamps = {};\n this._cached_timestamps_count = 0;\n}\n\nCalendarWorkTimeStrategy.prototype = {\n units: [\"year\", \"month\", \"week\", \"day\", \"hour\", \"minute\"],\n _clearCaches: function _clearCaches() {\n this._workingUnitsCache.clear();\n\n this._largeUnitsCache.clear();\n\n this._dateDurationCache.clear();\n },\n // cache previously calculated worktime\n _getUnitOrder: function _getUnitOrder(unit) {\n for (var i = 0, len = this.units.length; i < len; i++) {\n if (this.units[i] == unit) return i;\n }\n },\n _resetTimestampCache: function _resetTimestampCache() {\n this._cached_timestamps = {};\n this._cached_timestamps_count = 0;\n },\n _timestamp: function _timestamp(settings) {\n // minor optimization, store calculated timestamps to reduce computations\n // reset cache when number of keys exceeds large number where key lookup may became more expensive than the recalculation\n if (this._cached_timestamps_count > 1000000) {\n this._resetTimestampCache();\n }\n\n var timestamp = null;\n\n if (settings.day || settings.day === 0) {\n timestamp = settings.day;\n } else if (settings.date) {\n var value = String(settings.date.valueOf());\n\n if (this._cached_timestamps[value]) {\n timestamp = this._cached_timestamps[value];\n } else {\n // store worktime datestamp in utc so it could be recognized in different timezones (e.g. opened locally and sent to the export service in different timezone)\n timestamp = Date.UTC(settings.date.getFullYear(), settings.date.getMonth(), settings.date.getDate());\n this._cached_timestamps[value] = timestamp;\n this._cached_timestamps_count++;\n }\n }\n\n return timestamp;\n },\n _checkIfWorkingUnit: function _checkIfWorkingUnit(date, unit) {\n // GS-596: If unit is larger than day or has a custom logic\n if (!this[\"_is_work_\" + unit]) {\n var from = this.$gantt.date[\"\".concat(unit, \"_start\")](new Date(date));\n var to = this.$gantt.date.add(from, 1, unit);\n return this.hasDuration(from, to);\n }\n\n return this[\"_is_work_\" + unit](date);\n },\n //checkings for particular time units\n //methods for month-year-week can be defined, otherwise always return 'true'\n _is_work_day: function _is_work_day(date) {\n var val = this._getWorkHours(date);\n\n if (Array.isArray(val)) {\n return val.length > 0;\n }\n\n return false;\n },\n _is_work_hour: function _is_work_hour(date) {\n var hours = this._getWorkHours(date); // [{start: 8*60*60, end: 12*60*60}, {start: 13*60*60, end: 17*60*60}]\n\n\n var value = date.getHours();\n\n for (var i = 0; i < hours.length; i++) {\n if (value >= hours[i].startHour && value < hours[i].endHour) {\n return true;\n }\n }\n\n return false;\n },\n _getTimeOfDayStamp: function _getTimeOfDayStamp(date, dayEnd) {\n var hours = date.getHours();\n\n if (!date.getHours() && !date.getMinutes() && dayEnd) {\n hours = 24;\n }\n\n return hours * 60 * 60 + date.getMinutes() * 60;\n },\n _is_work_minute: function _is_work_minute(date) {\n var hours = this._getWorkHours(date); // [{start: 8*60*60, end: 12*60*60}, {start: 13*60*60, end: 17*60*60}]\n\n\n var checkTime = this._getTimeOfDayStamp(date);\n\n for (var i = 0; i < hours.length; i++) {\n if (checkTime >= hours[i].start && checkTime < hours[i].end) {\n return true;\n }\n }\n\n return false;\n },\n _nextDate: function _nextDate(start, unit, step) {\n return this.$gantt.date.add(start, step, unit);\n },\n _getWorkUnitsBetweenGeneric: function _getWorkUnitsBetweenGeneric(from, to, unit, step) {\n var dateHelper = this.$gantt.date;\n var start = new Date(from),\n end = new Date(to);\n step = step || 1;\n var units = 0;\n var next = null;\n var stepStart, stepEnd; // calculating decimal durations, i.e. 2016-09-20 00:05:00 - 2016-09-20 01:00:00 ~ 0.95 instead of 1\n // and also 2016-09-20 00:00:00 - 2016-09-20 00:05:00 ~ 0.05 instead of 1\n // durations must be rounded later\n\n var checkFirst = false;\n stepStart = dateHelper[unit + \"_start\"](new Date(start));\n\n if (stepStart.valueOf() != start.valueOf()) {\n checkFirst = true;\n }\n\n var checkLast = false;\n stepEnd = dateHelper[unit + \"_start\"](new Date(to));\n\n if (stepEnd.valueOf() != to.valueOf()) {\n checkLast = true;\n }\n\n var isLastStep = false;\n\n while (start.valueOf() < end.valueOf()) {\n next = this._nextDate(start, unit, step);\n isLastStep = next.valueOf() > end.valueOf();\n\n if (this._isWorkTime(start, unit)) {\n if (checkFirst || checkLast && isLastStep) {\n stepStart = dateHelper[unit + \"_start\"](new Date(start));\n stepEnd = dateHelper.add(stepStart, step, unit);\n }\n\n if (checkFirst) {\n checkFirst = false;\n next = this._nextDate(stepStart, unit, step);\n units += (stepEnd.valueOf() - start.valueOf()) / (stepEnd.valueOf() - stepStart.valueOf());\n } else if (checkLast && isLastStep) {\n checkLast = false;\n units += (end.valueOf() - start.valueOf()) / (stepEnd.valueOf() - stepStart.valueOf());\n } else {\n units++;\n }\n } else {\n var unitOrder = this._getUnitOrder(unit);\n\n var biggerTimeUnit = this.units[unitOrder - 1];\n\n if (biggerTimeUnit && !this._isWorkTime(start, biggerTimeUnit)) {\n next = this._getClosestWorkTimeFuture(start, biggerTimeUnit);\n }\n }\n\n start = next;\n }\n\n return units;\n },\n _getMinutesPerHour: function _getMinutesPerHour(date) {\n var hourStart = this._getTimeOfDayStamp(date);\n\n var hourEnd = this._getTimeOfDayStamp(this._nextDate(date, \"hour\", 1));\n\n if (hourEnd === 0) {\n hourEnd = 24 * 60 * 60;\n }\n\n var worktimes = this._getWorkHours(date);\n\n for (var i = 0; i < worktimes.length; i++) {\n var interval = worktimes[i];\n\n if (hourStart >= interval.start && hourEnd <= interval.end) {\n return 60; // hour inside a working interval, all hour is a work hour\n } else if (hourStart < interval.end && hourEnd > interval.start) {\n // hour is partially work time\n var duration = Math.min(hourEnd, interval.end) - Math.max(hourStart, interval.start);\n return duration / 60;\n }\n }\n\n return 0;\n },\n _getMinutesPerDay: function _getMinutesPerDay(date) {\n var hours = this._getWorkHours(date);\n\n var res = 0;\n hours.forEach(function (interval) {\n res += interval.durationMinutes;\n });\n return res;\n },\n getHoursPerDay: function getHoursPerDay(date) {\n var hours = this._getWorkHours(date);\n\n var res = 0;\n hours.forEach(function (interval) {\n res += interval.durationHours;\n });\n return res;\n },\n _getWorkUnitsForRange: function _getWorkUnitsForRange(from, to, unit, step) {\n var total = 0;\n var start = new Date(from),\n end = new Date(to);\n var getUnitsPerDay;\n\n if (unit == \"minute\") {\n getUnitsPerDay = utils.bind(this._getMinutesPerDay, this);\n } else {\n getUnitsPerDay = utils.bind(this.getHoursPerDay, this);\n }\n\n while (start.valueOf() < end.valueOf()) {\n if (end - start > 1000 * 60 * 60 * 24 * 32 && start.getDate() === 0) {\n var units = this._largeUnitsCache.getMinutesPerMonth(start);\n\n if (unit == \"hour\") {\n units = units / 60;\n }\n\n total += units;\n start = this.$gantt.date.add(start, 1, \"month\");\n continue;\n } else if (end - start > 1000 * 60 * 60 * 24 * 16) {\n var weekStart = this.$gantt.date.week_start(new Date(start));\n\n if (start.valueOf() === weekStart.valueOf()) {\n var units = this._largeUnitsCache.getMinutesPerWeek(start);\n\n if (unit == \"hour\") {\n units = units / 60;\n }\n\n total += units;\n start = this.$gantt.date.add(start, 7, \"day\");\n continue;\n }\n } //\tif (this._isWorkTime(start, \"day\")) {\n\n\n total += getUnitsPerDay(start); //\t}\n\n start = this._nextDate(start, \"day\", 1);\n }\n\n return total / step;\n },\n _getMinutesBetweenSingleDay: function _getMinutesBetweenSingleDay(from, to) {\n var range = this._getIntervalTimestamp(from, to);\n\n var worktimes = this._getWorkHours(from);\n\n var result = 0;\n\n for (var i = 0; i < worktimes.length; i++) {\n var interval = worktimes[i];\n\n if (range.end >= interval.start && range.start <= interval.end) {\n var minuteFrom = Math.max(interval.start, range.start);\n var minuteTo = Math.min(interval.end, range.end);\n result += (minuteTo - minuteFrom) / 60;\n range.start = minuteTo;\n }\n }\n\n return Math.floor(result);\n },\n _getMinutesBetween: function _getMinutesBetween(from, to, unit, step) {\n var start = new Date(from),\n end = new Date(to);\n step = step || 1;\n var firstDayStart = new Date(start);\n var firstDayEnd = this.$gantt.date.add(this.$gantt.date.day_start(new Date(start)), 1, \"day\");\n\n if (end.valueOf() <= firstDayEnd.valueOf()) {\n return this._getMinutesBetweenSingleDay(from, to);\n } else {\n var lastDayStart = this.$gantt.date.day_start(new Date(end));\n var lastDayEnd = end;\n\n var startPart = this._getMinutesBetweenSingleDay(firstDayStart, firstDayEnd);\n\n var endPart = this._getMinutesBetweenSingleDay(lastDayStart, lastDayEnd);\n\n var rangePart = this._getWorkUnitsForRange(firstDayEnd, lastDayStart, unit, step);\n\n var total = startPart + rangePart + endPart;\n return total;\n }\n },\n // optimized method for calculating work units duration of large time spans\n // implemented for hours and minutes units, bigger time units don't benefit from the optimization so much\n _getHoursBetween: function _getHoursBetween(from, to, unit, step) {\n var start = new Date(from),\n end = new Date(to);\n step = step || 1;\n var firstDayStart = new Date(start);\n var firstDayEnd = this.$gantt.date.add(this.$gantt.date.day_start(new Date(start)), 1, \"day\");\n\n if (end.valueOf() <= firstDayEnd.valueOf()) {\n return Math.round(this._getMinutesBetweenSingleDay(from, to) / 60);\n } else {\n var lastDayStart = this.$gantt.date.day_start(new Date(end));\n var lastDayEnd = end;\n var startPart = this._getMinutesBetweenSingleDay(firstDayStart, firstDayEnd, unit, step) / 60;\n var endPart = this._getMinutesBetweenSingleDay(lastDayStart, lastDayEnd, unit, step) / 60;\n\n var rangePart = this._getWorkUnitsForRange(firstDayEnd, lastDayStart, unit, step);\n\n var total = startPart + rangePart + endPart;\n return Math.round(total);\n }\n },\n getConfig: function getConfig() {\n return this._worktime;\n },\n _setConfig: function _setConfig(settings) {\n this._worktime = settings;\n\n this._parseSettings();\n\n this._clearCaches();\n },\n _parseSettings: function _parseSettings() {\n var settings = this.getConfig();\n settings.parsed = {\n dates: {},\n hours: null,\n haveCustomWeeks: false,\n customWeeks: {},\n customWeeksRangeStart: null,\n customWeeksRangeEnd: null,\n customWeeksBoundaries: []\n };\n settings.parsed.hours = this._parseHours(settings.hours);\n\n for (var i in settings.dates) {\n settings.parsed.dates[i] = this._parseHours(settings.dates[i]);\n }\n\n if (settings.customWeeks) {\n var minCustomRangeStart = null;\n var maxCustomRangeEnd = null;\n\n for (var i in settings.customWeeks) {\n var customTime = settings.customWeeks[i];\n\n if (customTime.from && customTime.to) {\n var rangeStart = customTime.from;\n var rangeEnd = customTime.to;\n\n if (!minCustomRangeStart || minCustomRangeStart > rangeStart.valueOf()) {\n minCustomRangeStart = rangeStart.valueOf();\n }\n\n if (!maxCustomRangeEnd || maxCustomRangeEnd < rangeEnd.valueOf()) {\n maxCustomRangeEnd = rangeEnd.valueOf();\n }\n\n settings.parsed.customWeeksBoundaries.push({\n from: rangeStart.valueOf(),\n fromReadable: new Date(rangeStart),\n to: rangeEnd.valueOf(),\n toReadable: new Date(rangeEnd),\n name: i\n });\n settings.parsed.haveCustomWeeks = true;\n var currentWeek = settings.parsed.customWeeks[i] = {\n from: customTime.from,\n to: customTime.to,\n hours: this._parseHours(customTime.hours),\n dates: {}\n };\n\n for (var d in customTime.dates) {\n currentWeek.dates[d] = this._parseHours(customTime.dates[d]);\n }\n }\n }\n\n settings.parsed.customWeeksRangeStart = minCustomRangeStart;\n settings.parsed.customWeeksRangeEnd = maxCustomRangeEnd;\n }\n },\n _tryChangeCalendarSettings: function _tryChangeCalendarSettings(payload) {\n var backup = JSON.stringify(this.getConfig());\n payload();\n\n if (!this.hasWorkTime()) {\n //\tthis.$gantt.assert(false, \"Invalid calendar settings, no worktime available\");\n this._setConfig(JSON.parse(backup));\n\n this._clearCaches();\n\n return false;\n }\n\n return true;\n },\n _arraysEqual: function _arraysEqual(a, b) {\n if (a === b) return true;\n if (!a || !b) return false;\n if (a.length != b.length) return false;\n\n for (var i = 0; i < a.length; ++i) {\n if (a[i] !== b[i]) return false;\n }\n\n return true;\n },\n _compareSettings: function _compareSettings(mySettings, thatSettings) {\n if (!this._arraysEqual(mySettings.hours, thatSettings.hours)) {\n return false;\n }\n\n var myDays = Object.keys(mySettings.dates);\n var otherDates = Object.keys(thatSettings.dates);\n myDays.sort();\n otherDates.sort();\n\n if (!this._arraysEqual(myDays, otherDates)) {\n return false;\n }\n\n for (var i = 0; i < myDays.length; i++) {\n var timestamp = myDays[i];\n var myHours = mySettings.dates[timestamp];\n var otherHours = mySettings.dates[timestamp]; // day settings not equal\n\n if (myHours !== otherHours && // but still can be two arrays with the equivalent hour settings\n !(Array.isArray(myHours) && Array.isArray(otherHours) && this._arraysEqual(myHours, otherHours))) {\n return false;\n }\n }\n\n return true;\n },\n equals: function equals(calendar) {\n if (!(calendar instanceof CalendarWorkTimeStrategy)) {\n return false;\n }\n\n var mySettings = this.getConfig();\n var thatSettings = calendar.getConfig();\n\n if (!this._compareSettings(mySettings, thatSettings)) {\n return false;\n }\n\n if (mySettings.parsed.haveCustomWeeks && thatSettings.parsed.haveCustomWeeks) {\n if (mySettings.parsed.customWeeksBoundaries.length != thatSettings.parsed.customWeeksBoundaries.length) {\n return false;\n }\n\n for (var i in mySettings.parsed.customWeeks) {\n var myWeek = mySettings.parsed.customWeeks[i];\n var thatWeek = thatSettings.parsed.customWeeks[i];\n\n if (!thatWeek) {\n return false;\n }\n\n if (!this._compareSettings(myWeek, thatWeek)) {\n return false;\n }\n }\n } else if (mySettings.parse.haveCustomWeeks !== thatSettings.parsed.haveCustomWeeks) {\n return false;\n }\n\n return true;\n },\n getWorkHours: function getWorkHours() {\n var config = this.argumentsHelper.getWorkHoursArguments.apply(this.argumentsHelper, arguments);\n return this._getWorkHours(config.date, false);\n },\n _getWorkHours: function _getWorkHours(date, parsed) {\n var calendar = this.getConfig();\n\n if (parsed !== false) {\n calendar = calendar.parsed;\n }\n\n if (!date) {\n return calendar.hours;\n }\n\n var dateValue = this._timestamp({\n date: date\n });\n\n if (calendar.haveCustomWeeks) {\n if (calendar.customWeeksRangeStart <= dateValue && calendar.customWeeksRangeEnd > dateValue) {\n for (var i = 0; i < calendar.customWeeksBoundaries.length; i++) {\n if (calendar.customWeeksBoundaries[i].from <= dateValue && calendar.customWeeksBoundaries[i].to > dateValue) {\n calendar = calendar.customWeeks[calendar.customWeeksBoundaries[i].name];\n break;\n }\n }\n }\n }\n\n var hours = true;\n\n if (calendar.dates[dateValue] !== undefined) {\n hours = calendar.dates[dateValue]; //custom day\n } else if (calendar.dates[date.getDay()] !== undefined) {\n hours = calendar.dates[date.getDay()]; //week day\n }\n\n if (hours === true) {\n return calendar.hours;\n } else if (hours) {\n return hours;\n }\n\n return [];\n },\n _getIntervalTimestamp: function _getIntervalTimestamp(from, to) {\n var res = {\n start: 0,\n end: 0\n };\n res.start = from.getHours() * 60 * 60 + from.getMinutes() * 60 + from.getSeconds();\n var endHours = to.getHours();\n\n if (!endHours && !to.getMinutes() && !to.getSeconds() && from.valueOf() < to.valueOf()) {\n endHours = 24;\n }\n\n res.end = endHours * 60 * 60 + to.getMinutes() * 60 + to.getSeconds();\n return res;\n },\n _parseHours: function _parseHours(hours) {\n if (Array.isArray(hours)) {\n var timestampRanges = []; // worktime as seconds range\n\n hours.forEach(function (hour) {\n if (typeof hour === \"number\") {\n timestampRanges.push(hour * 60 * 60);\n } else if (typeof hour === \"string\") {\n // \"12-13\", or \"12:00-13:00\", or \"12:00:00-13:00:00\"\n hour.split(\"-\").map(function (time) {\n return time.trim();\n }).forEach(function (part) {\n var parsed = part.split(\":\").map(function (time) {\n return time.trim();\n });\n var value = parseInt(parsed[0] * 60 * 60);\n\n if (parsed[1]) {\n value += parseInt(parsed[1] * 60);\n }\n\n if (parsed[2]) {\n value += parseInt(parsed[2]);\n }\n\n timestampRanges.push(value);\n });\n }\n });\n var timerangeConfig = [];\n\n for (var i = 0; i < timestampRanges.length; i += 2) {\n var start = timestampRanges[i];\n var end = timestampRanges[i + 1];\n var duration = end - start;\n timerangeConfig.push({\n start: start,\n end: end,\n startHour: Math.floor(start / (60 * 60)),\n startMinute: Math.floor(start / 60),\n endHour: Math.ceil(end / (60 * 60)),\n endMinute: Math.ceil(end / 60),\n durationSeconds: duration,\n durationMinutes: duration / 60,\n durationHours: duration / (60 * 60)\n });\n }\n\n return timerangeConfig;\n } else {\n return hours;\n }\n },\n setWorkTime: function setWorkTime(settings) {\n return this._tryChangeCalendarSettings(utils.bind(function () {\n var hours = settings.hours !== undefined ? settings.hours : true;\n\n var timestamp = this._timestamp(settings);\n\n var calendarConfig = this.getConfig();\n\n if (timestamp !== null) {\n calendarConfig.dates[timestamp] = hours;\n } else if (!settings.customWeeks) {\n calendarConfig.hours = hours;\n }\n\n if (settings.customWeeks) {\n if (!calendarConfig.customWeeks) {\n calendarConfig.customWeeks = {};\n } // GS-1867. allow setWorkTime to exclude dates in the customWeeks range\n\n\n if (typeof settings.customWeeks == \"string\") {\n if (timestamp !== null) {\n calendarConfig.customWeeks[settings.customWeeks].dates[timestamp] = hours;\n } else if (!settings.customWeeks) {\n calendarConfig.customWeeks[settings.customWeeks].hours = hours;\n }\n } else if (_typeof(settings.customWeeks) === \"object\" && Function.prototype.toString.call(settings.customWeeks.constructor) === \"function Object() { [native code] }\") {\n for (var i in settings.customWeeks) {\n calendarConfig.customWeeks[i] = settings.customWeeks[i];\n }\n }\n }\n\n this._parseSettings();\n\n this._clearCaches();\n }, this));\n },\n unsetWorkTime: function unsetWorkTime(settings) {\n return this._tryChangeCalendarSettings(utils.bind(function () {\n if (!settings) {\n this.reset_calendar();\n } else {\n var timestamp = this._timestamp(settings);\n\n if (timestamp !== null) {\n delete this.getConfig().dates[timestamp];\n }\n } // Load updated settings and clear work units cache\n\n\n this._parseSettings();\n\n this._clearCaches();\n }, this));\n },\n _isWorkTime: function _isWorkTime(date, unit) {\n // Check if this item has in the cache\n var useCache = true; //unit === \"day\"; // use cache only for days. In case of hours/minutes cache size grows too large and the overhead exceeds the gains\n\n var isWorkUnit = -1;\n var dateKey = null;\n\n if (useCache) {\n // use string keys\n dateKey = String(date.valueOf());\n isWorkUnit = this._workingUnitsCache.getItem(unit, dateKey, date);\n }\n\n if (isWorkUnit == -1) {\n // calculate if not cached\n isWorkUnit = this._checkIfWorkingUnit(date, unit);\n\n if (useCache) {\n this._workingUnitsCache.setItem(unit, dateKey, isWorkUnit, date);\n }\n }\n\n return isWorkUnit;\n },\n isWorkTime: function isWorkTime() {\n var config = this.argumentsHelper.isWorkTimeArguments.apply(this.argumentsHelper, arguments);\n return this._isWorkTime(config.date, config.unit);\n },\n calculateDuration: function calculateDuration() {\n var config = this.argumentsHelper.getDurationArguments.apply(this.argumentsHelper, arguments);\n\n if (!config.unit) {\n return false;\n } //return this._calculateDuration(config.start_date, config.end_date, config.unit, config.step);\n\n\n var self = this;\n return this._dateDurationCache.getDuration(config.start_date, config.end_date, config.unit, config.step, function () {\n return self._calculateDuration(config.start_date, config.end_date, config.unit, config.step);\n });\n },\n _calculateDuration: function _calculateDuration(from, to, unit, step) {\n var res = 0;\n var sign = 1;\n\n if (from.valueOf() > to.valueOf()) {\n var tmp = to;\n to = from;\n from = tmp;\n sign = -1;\n }\n\n if (unit == \"hour\" && step == 1) {\n res = this._getHoursBetween(from, to, unit, step);\n } else if (unit == \"minute\" && step == 1) {\n // quick calculation for minutes with 1 minute step\n res = this._getMinutesBetween(from, to, unit, step);\n } else {\n res = this._getWorkUnitsBetweenGeneric(from, to, unit, step);\n } // getWorkUnits.. returns decimal durations\n\n\n return sign * Math.round(res);\n },\n hasDuration: function hasDuration() {\n var config = this.argumentsHelper.getDurationArguments.apply(this.argumentsHelper, arguments);\n var from = config.start_date,\n to = config.end_date,\n unit = config.unit,\n step = config.step;\n\n if (!unit) {\n return false;\n }\n\n var start = new Date(from),\n end = new Date(to);\n step = step || 1;\n\n while (start.valueOf() < end.valueOf()) {\n if (this._isWorkTime(start, unit)) return true;\n start = this._nextDate(start, unit, step);\n }\n\n return false;\n },\n calculateEndDate: function calculateEndDate() {\n var config = this.argumentsHelper.calculateEndDateArguments.apply(this.argumentsHelper, arguments);\n var from = config.start_date,\n duration = config.duration,\n unit = config.unit,\n step = config.step;\n if (!unit) return false;\n var mult = config.duration >= 0 ? 1 : -1;\n duration = Math.abs(duration * 1); //\tvar endDate = this._calculateEndDate(from, duration, unit, step * mult);\n //\treturn endDate;\n\n var self = this;\n return this._dateDurationCache.getEndDate(from, duration, unit, step * mult, function () {\n return self._calculateEndDate(from, duration, unit, step * mult);\n });\n },\n _calculateEndDate: function _calculateEndDate(from, duration, unit, step) {\n if (!unit) return false;\n\n if (step == 1 && unit == \"minute\") {\n return this._calculateMinuteEndDate(from, duration, step);\n } else if (step == -1 && unit == \"minute\") {\n return this._subtractMinuteDate(from, duration, step);\n } else if (step == 1 && unit == \"hour\") {\n return this._calculateHourEndDate(from, duration, step);\n } else {\n var interval = this._addInterval(from, duration, unit, step, null);\n\n return interval.end;\n }\n },\n _addInterval: function _addInterval(start, duration, unit, step, stopAction) {\n var added = 0;\n var current = start;\n var dstShift = false;\n\n while (added < duration && !(stopAction && stopAction(current))) {\n var next = this._nextDate(current, unit, step); // GS-1501. Correct hours after DST change\n\n\n if (unit == \"day\") {\n dstShift = dstShift || !current.getHours() && next.getHours();\n\n if (dstShift) {\n next.setHours(0);\n\n if (next.getHours()) {// the day when the timezone is changed, try to correct hours next time\n } else {\n dstShift = false;\n }\n }\n }\n\n var dateValue = new Date(next.valueOf() + 1);\n\n if (step > 0) {\n dateValue = new Date(next.valueOf() - 1);\n }\n\n var workTimeCheck = this._isWorkTime(dateValue, unit);\n\n if (workTimeCheck && !dstShift) {\n added++;\n }\n\n current = next;\n }\n\n return {\n end: current,\n start: start,\n added: added\n };\n },\n _addHoursUntilDayEnd: function _addHoursUntilDayEnd(from, duration) {\n var dayEnd = this.$gantt.date.add(this.$gantt.date.day_start(new Date(from)), 1, \"day\");\n var added = 0;\n var left = duration;\n\n var range = this._getIntervalTimestamp(from, dayEnd);\n\n var worktimes = this._getWorkHours(from);\n\n for (var i = 0; i < worktimes.length && added < duration; i++) {\n var interval = worktimes[i];\n\n if (range.end >= interval.start && range.start <= interval.end) {\n var minuteFrom = Math.max(interval.start, range.start);\n var minuteTo = Math.min(interval.end, range.end);\n var rangeHours = (minuteTo - minuteFrom) / (60 * 60);\n\n if (rangeHours > left) {\n rangeHours = left;\n minuteTo = minuteFrom + left * 60 * 60;\n }\n\n var addHours = Math.round((minuteTo - minuteFrom) / (60 * 60));\n added += addHours;\n left -= addHours;\n range.start = minuteTo;\n }\n }\n\n var intervalEnd = dayEnd;\n\n if (added === duration) {\n intervalEnd = new Date(from.getFullYear(), from.getMonth(), from.getDate(), 0, 0, range.start);\n }\n\n return {\n added: added,\n end: intervalEnd\n };\n },\n _calculateHourEndDate: function _calculateHourEndDate(from, duration, step) {\n var start = new Date(from),\n added = 0;\n step = step || 1;\n duration = Math.abs(duration * 1);\n\n var interval = this._addHoursUntilDayEnd(start, duration);\n\n added = interval.added;\n start = interval.end;\n var durationLeft = duration - added;\n\n if (durationLeft) {\n var current = start;\n\n while (added < duration) {\n var next = this._nextDate(current, \"day\", step); // reset to day start in case DST switch happens in the process\n\n\n next.setHours(0);\n next.setMinutes(0);\n next.setSeconds(0);\n var hoursPerDay = 0;\n\n if (step > 0) {\n hoursPerDay = this.getHoursPerDay(new Date(next.valueOf() - 1));\n } else {\n hoursPerDay = this.getHoursPerDay(new Date(next.valueOf() + 1));\n }\n\n if (added + hoursPerDay >= duration) {\n break;\n } else {\n added += hoursPerDay;\n }\n\n current = next;\n }\n\n start = current;\n }\n\n if (added < duration) {\n var durationLeft = duration - added;\n interval = this._addHoursUntilDayEnd(start, durationLeft);\n start = interval.end;\n }\n\n return start;\n },\n _addMinutesUntilHourEnd: function _addMinutesUntilHourEnd(from, duration) {\n if (from.getMinutes() === 0) {\n // already at hour end\n return {\n added: 0,\n end: new Date(from)\n };\n }\n\n var hourEnd = this.$gantt.date.add(this.$gantt.date.hour_start(new Date(from)), 1, \"hour\");\n var added = 0;\n var left = duration;\n\n var range = this._getIntervalTimestamp(from, hourEnd);\n\n var worktimes = this._getWorkHours(from);\n\n for (var i = 0; i < worktimes.length && added < duration; i++) {\n var interval = worktimes[i];\n\n if (range.end >= interval.start && range.start <= interval.end) {\n var minuteFrom = Math.max(interval.start, range.start);\n var minuteTo = Math.min(interval.end, range.end);\n var rangeMinutes = (minuteTo - minuteFrom) / 60;\n\n if (rangeMinutes > left) {\n rangeMinutes = left;\n minuteTo = minuteFrom + left * 60;\n }\n\n var addMinutes = Math.round((minuteTo - minuteFrom) / 60);\n left -= addMinutes;\n added += addMinutes;\n range.start = minuteTo;\n }\n }\n\n var intervalEnd = hourEnd;\n\n if (added === duration) {\n intervalEnd = new Date(from.getFullYear(), from.getMonth(), from.getDate(), 0, 0, range.start);\n }\n\n return {\n added: added,\n end: intervalEnd\n };\n },\n _subtractMinutesUntilHourStart: function _subtractMinutesUntilHourStart(from, duration) {\n var hourStart = this.$gantt.date.hour_start(new Date(from));\n var added = 0;\n var left = duration;\n var hourStartTimestamp = hourStart.getHours() * 60 * 60 + hourStart.getMinutes() * 60 + hourStart.getSeconds();\n var initialDateTimestamp = from.getHours() * 60 * 60 + from.getMinutes() * 60 + from.getSeconds();\n\n var worktimes = this._getWorkHours(from);\n\n for (var i = worktimes.length - 1; i >= 0 && added < duration; i--) {\n var interval = worktimes[i];\n\n if (initialDateTimestamp > interval.start && hourStartTimestamp <= interval.end) {\n var minuteFrom = Math.min(initialDateTimestamp, interval.end);\n var minuteTo = Math.max(hourStartTimestamp, interval.start); //\tvar minuteFrom = Math.max(interval.start, currentHour.start);\n //\tvar minuteTo = Math.min(interval.end, currentHour.end);\n\n var rangeMinutes = (minuteFrom - minuteTo) / 60;\n\n if (rangeMinutes > left) {\n rangeMinutes = left;\n minuteTo = minuteFrom - left * 60;\n }\n\n var addMinutes = Math.abs(Math.round((minuteFrom - minuteTo) / 60));\n left -= addMinutes;\n added += addMinutes;\n initialDateTimestamp = minuteTo;\n }\n }\n\n var intervalEnd = hourStart;\n\n if (added === duration) {\n intervalEnd = new Date(from.getFullYear(), from.getMonth(), from.getDate(), 0, 0, initialDateTimestamp);\n }\n\n return {\n added: added,\n end: intervalEnd\n };\n },\n _subtractMinuteDate: function _subtractMinuteDate(from, duration, step) {\n var start = new Date(from),\n added = 0;\n step = step || -1;\n duration = Math.abs(duration * 1);\n duration = Math.round(duration);\n\n var addedInterval = this._subtractMinutesUntilHourStart(start, duration);\n\n added += addedInterval.added;\n start = addedInterval.end;\n var calculatedDay = 0;\n var daySchedule = [];\n var minutesInDay = 0;\n\n while (added < duration) {\n var dayStart = this.$gantt.date.day_start(new Date(start));\n var iterateFromDayEnd = false;\n\n if (start.valueOf() === dayStart.valueOf()) {\n dayStart = this.$gantt.date.add(dayStart, -1, \"day\");\n iterateFromDayEnd = true;\n } //var dayStartTimestamp = this.$gantt.date.day_start(new Date(start)).valueOf();\n\n\n var dayEnd = new Date(dayStart.getFullYear(), dayStart.getMonth(), dayStart.getDate(), 23, 59, 59, 999).valueOf();\n\n if (dayEnd !== calculatedDay) {\n daySchedule = this._getWorkHours(dayStart);\n minutesInDay = this._getMinutesPerDay(dayStart);\n calculatedDay = dayEnd;\n }\n\n var left = duration - added;\n\n var timestamp = this._getTimeOfDayStamp(start, iterateFromDayEnd);\n\n if (!daySchedule.length || !minutesInDay) {\n start = this.$gantt.date.add(start, -1, \"day\");\n continue;\n }\n\n if (daySchedule[daySchedule.length - 1].end <= timestamp) {\n if (left > minutesInDay) {\n added += minutesInDay;\n start = this.$gantt.date.add(start, -1, \"day\");\n continue;\n }\n }\n\n var isWorkHour = false;\n var workInterval = null;\n\n for (var i = daySchedule.length - 1; i >= 0; i--) {\n if (daySchedule[i].start < timestamp - 1 && daySchedule[i].end >= timestamp - 1) {\n isWorkHour = true;\n workInterval = daySchedule[i];\n break;\n }\n }\n\n if (isWorkHour) {\n if (timestamp === workInterval.end && left >= workInterval.durationMinutes) {\n added += workInterval.durationMinutes;\n start = this.$gantt.date.add(start, -workInterval.durationMinutes, \"minute\");\n } else if (left <= timestamp / 60 - workInterval.startMinute) {\n added += left;\n start = this.$gantt.date.add(start, -left, \"minute\");\n } else {\n var minutesInHour = this._getMinutesPerHour(start);\n\n if (minutesInHour <= left) {\n added += minutesInHour;\n start = this._nextDate(start, \"hour\", step);\n } else {\n addedInterval = this._subtractMinutesUntilHourStart(start, left);\n added += addedInterval.added;\n start = addedInterval.end;\n }\n }\n } else {\n if (start.getHours() === 0 && start.getMinutes() === 0 && start.getSeconds() === 0) {\n var prev = this._getClosestWorkTimePast(start, \"hour\");\n\n if (prev.valueOf() === start.valueOf()) {\n var prev = this.$gantt.date.add(start, -1, \"day\");\n\n var times = this._getWorkHours(prev);\n\n if (times.length) {\n var lastInterval = times[times.length - 1];\n prev.setSeconds(lastInterval.durationSeconds);\n }\n }\n\n start = prev;\n } else {\n start = this._getClosestWorkTimePast(new Date(start - 1), \"hour\");\n }\n }\n }\n\n if (added < duration) {\n var durationLeft = duration - added;\n addedInterval = this._subtractMinutesUntilHourStart(start, durationLeft);\n added += addedInterval.added;\n start = addedInterval.end;\n }\n\n return start;\n },\n _calculateMinuteEndDate: function _calculateMinuteEndDate(from, duration, step) {\n var start = new Date(from),\n added = 0;\n step = step || 1;\n duration = Math.abs(duration * 1);\n duration = Math.round(duration);\n\n var addedInterval = this._addMinutesUntilHourEnd(start, duration);\n\n added += addedInterval.added;\n start = addedInterval.end;\n var calculatedDay = 0;\n var daySchedule = [];\n var minutesInDay = 0;\n var minutePresision = undefined;\n\n while (added < duration) {\n var dayStart = this.$gantt.date.day_start(new Date(start)).valueOf();\n\n if (dayStart !== calculatedDay) {\n daySchedule = this._getWorkHours(start);\n minutesInDay = this._getMinutesPerDay(start);\n calculatedDay = dayStart; // when the working time settings are set in minutes\n\n if (minutePresision === undefined) {\n minutePresision = false;\n daySchedule.forEach(function (interval) {\n if (interval.startMinute % 60 || interval.endMinute % 60) {\n minutePresision = true;\n }\n });\n }\n }\n\n var left = duration - added;\n\n var timestamp = this._getTimeOfDayStamp(start);\n\n if (!daySchedule.length || !minutesInDay) {\n start = this.$gantt.date.add(this.$gantt.date.day_start(start), 1, \"day\");\n continue;\n }\n\n if (daySchedule[0].start >= timestamp) {\n if (left >= minutesInDay) {\n added += minutesInDay;\n\n if (left == minutesInDay) {\n start = new Date(start.getFullYear(), start.getMonth(), start.getDate(), 0, 0, daySchedule[daySchedule.length - 1].end);\n break;\n } else {\n start = this.$gantt.date.add(start, 1, \"day\");\n start = this.$gantt.date.day_start(start);\n }\n\n continue;\n }\n }\n\n var isWorkHour = false;\n var workInterval = null;\n\n for (var i = 0; i < daySchedule.length; i++) {\n if (daySchedule[i].start <= timestamp && daySchedule[i].end > timestamp) {\n isWorkHour = true;\n workInterval = daySchedule[i];\n break;\n }\n }\n\n if (isWorkHour) {\n if (timestamp === workInterval.start && left >= workInterval.durationMinutes) {\n added += workInterval.durationMinutes;\n start = this.$gantt.date.add(start, workInterval.durationMinutes, \"minute\");\n } else if (left <= workInterval.endMinute - timestamp / 60) {\n added += left;\n start = this.$gantt.date.add(start, left, \"minute\");\n } else {\n var minutesInHour = this._getMinutesPerHour(start);\n\n if (minutesInHour <= left) {\n added += minutesInHour;\n\n if (minutePresision) {\n start = this.$gantt.date.add(start, minutesInHour, \"minute\");\n } else {\n start = this._nextDate(start, \"hour\", step);\n }\n } else {\n addedInterval = this._addMinutesUntilHourEnd(start, left);\n added += addedInterval.added;\n start = addedInterval.end;\n }\n }\n } else {\n start = this._getClosestWorkTimeFuture(start, \"hour\");\n }\n }\n\n if (added < duration) {\n var durationLeft = duration - added;\n addedInterval = this._addMinutesUntilHourEnd(start, durationLeft);\n added += addedInterval.added;\n start = addedInterval.end;\n }\n\n return start;\n },\n getClosestWorkTime: function getClosestWorkTime() {\n var settings = this.argumentsHelper.getClosestWorkTimeArguments.apply(this.argumentsHelper, arguments);\n return this._getClosestWorkTime(settings.date, settings.unit, settings.dir);\n },\n _getClosestWorkTime: function _getClosestWorkTime(inputDate, unit, direction) {\n var result = new Date(inputDate);\n\n if (this._isWorkTime(result, unit)) {\n return result;\n }\n\n result = this.$gantt.date[unit + '_start'](result);\n\n if (direction == 'any' || !direction) {\n var closestFuture = this._getClosestWorkTimeFuture(result, unit);\n\n var closestPast = this._getClosestWorkTimePast(result, unit);\n\n if (Math.abs(closestFuture - inputDate) <= Math.abs(inputDate - closestPast)) {\n result = closestFuture;\n } else {\n result = closestPast;\n }\n } else if (direction == \"past\") {\n result = this._getClosestWorkTimePast(result, unit);\n } else {\n result = this._getClosestWorkTimeFuture(result, unit);\n }\n\n return result;\n },\n _getClosestWorkTimeFuture: function _getClosestWorkTimeFuture(date, unit) {\n return this._getClosestWorkTimeGeneric(date, unit, 1);\n },\n _getClosestWorkTimePast: function _getClosestWorkTimePast(date, unit) {\n var result = this._getClosestWorkTimeGeneric(date, unit, -1); // should return the end of the closest work interval\n\n\n return this.$gantt.date.add(result, 1, unit);\n },\n _findClosestTimeInDay: function _findClosestTimeInDay(date, direction, worktimes) {\n var start = new Date(date);\n var resultDate = null;\n var fromDayEnd = false;\n\n if (!this._getWorkHours(start).length) {\n start = this._getClosestWorkTime(start, \"day\", direction < 0 ? \"past\" : \"future\");\n\n if (direction < 0) {\n start = new Date(start.valueOf() - 1);\n fromDayEnd = true;\n }\n\n worktimes = this._getWorkHours(start);\n }\n\n var value = this._getTimeOfDayStamp(start);\n\n if (fromDayEnd) {\n value = this._getTimeOfDayStamp(new Date(start.valueOf() + 1), fromDayEnd);\n }\n\n if (direction > 0) {\n for (var i = 0; i < worktimes.length; i++) {\n if (worktimes[i].start >= value) {\n resultDate = new Date(start.getFullYear(), start.getMonth(), start.getDate(), 0, 0, worktimes[i].start);\n break;\n }\n }\n } else {\n for (var i = worktimes.length - 1; i >= 0; i--) {\n if (worktimes[i].end <= value) {\n resultDate = new Date(start.getFullYear(), start.getMonth(), start.getDate(), 0, 0, worktimes[i].end);\n break;\n } else if (worktimes[i].end > value && worktimes[i].start <= value) {\n resultDate = new Date(start.getFullYear(), start.getMonth(), start.getDate(), 0, 0, value);\n break;\n }\n }\n }\n\n return resultDate;\n },\n _getClosestWorkMinute: function _getClosestWorkMinute(date, unit, direction) {\n var start = new Date(date);\n\n var worktimes = this._getWorkHours(start);\n\n var resultDate = this._findClosestTimeInDay(start, direction, worktimes);\n\n if (!resultDate) {\n start = this.calculateEndDate(start, direction, \"day\");\n\n if (direction > 0) {\n start = this.$gantt.date.day_start(start);\n } else {\n start = this.$gantt.date.day_start(start);\n start = this.$gantt.date.add(start, 1, \"day\");\n start = new Date(start.valueOf() - 1);\n }\n\n worktimes = this._getWorkHours(start);\n resultDate = this._findClosestTimeInDay(start, direction, worktimes);\n }\n\n if (direction < 0) {\n // getClosestWorkTimePast adds one time unit to the result date after this\n resultDate = this.$gantt.date.add(resultDate, -1, unit);\n }\n\n return resultDate;\n },\n _getClosestWorkTimeGeneric: function _getClosestWorkTimeGeneric(date, unit, increment) {\n if (unit === \"hour\" || unit === \"minute\") {\n return this._getClosestWorkMinute(date, unit, increment);\n }\n\n var unitOrder = this._getUnitOrder(unit),\n biggerTimeUnit = this.units[unitOrder - 1];\n\n var result = date; // be extra sure we won't fall into infinite loop, 3k seems big enough\n\n var maximumLoop = 3000,\n count = 0;\n\n while (!this._isWorkTime(result, unit)) {\n if (biggerTimeUnit && !this._isWorkTime(result, biggerTimeUnit)) {\n // if we look for closest work hour and detect a week-end - first find the closest work day,\n // and continue iterations after that\n if (increment > 0) {\n result = this._getClosestWorkTimeFuture(result, biggerTimeUnit);\n } else {\n result = this._getClosestWorkTimePast(result, biggerTimeUnit);\n }\n\n if (this._isWorkTime(result, unit)) {\n break;\n }\n }\n\n count++;\n\n if (count > maximumLoop) {\n this.$gantt.assert(false, \"Invalid working time check\");\n return false;\n }\n\n var tzOffset = result.getTimezoneOffset();\n result = this.$gantt.date.add(result, increment, unit);\n result = this.$gantt._correct_dst_change(result, tzOffset, increment, unit);\n\n if (this.$gantt.date[unit + '_start']) {\n result = this.$gantt.date[unit + '_start'](result);\n }\n }\n\n return result;\n },\n\n /**\r\n * Check whether this calendar has working time. Calendar has working time only if there are regular working days of week\r\n *\r\n */\n hasWorkTime: function hasWorkTime() {\n var worktime = this.getConfig();\n var dates = worktime.dates;\n var daysOfWeek = [0, 1, 2, 3, 4, 5, 6];\n var exceptions = [];\n\n for (var i in worktime.dates) {\n if (Number(i) > 6) {\n exceptions.push(Number(i));\n }\n }\n\n var hasRegularHours = this._checkWorkHours(worktime.hours);\n\n var result = false;\n daysOfWeek.forEach(function (day) {\n if (result) {\n return;\n }\n\n var dayConfig = dates[day];\n\n if (dayConfig === true) {\n // workday uses global hours\n result = hasRegularHours;\n } else if (Array.isArray(dayConfig)) {\n // workday uses custom hours\n result = this._checkWorkHours(dayConfig);\n }\n }.bind(this));\n return result;\n },\n _checkWorkHours: function _checkWorkHours(hoursArray) {\n if (hoursArray.length === 0) {\n return false;\n }\n\n var result = false;\n\n for (var i = 0; i < hoursArray.length; i += 2) {\n if (hoursArray[i] !== hoursArray[i + 1]) {\n result = true;\n }\n }\n\n return result;\n }\n};\nmodule.exports = CalendarWorkTimeStrategy;","var utils = require(\"../../../utils/utils\");\n\nfunction WorkTimeCalendarMerger() {}\n\nWorkTimeCalendarMerger.prototype = {\n /**\r\n * convert hours array items into objects, e.g. [8, 12, 17, 18] -> [{start: 8, end: 12}, {start:17, end:18}]\r\n * @param {Array} hoursArray\r\n */\n _getIntervals: function _getIntervals(hoursArray) {\n var result = [];\n\n for (var i = 0; i < hoursArray.length; i += 2) {\n result.push({\n start: hoursArray[i],\n end: hoursArray[i + 1]\n });\n }\n\n return result;\n },\n\n /**\r\n * Convert ranges config into hours array\r\n * [{start: 8, end: 12}, {start:17, end:18}] --> [8, 12, 17, 18]\r\n * @param {*} intervalsArray\r\n */\n _toHoursArray: function _toHoursArray(intervalsArray) {\n var result = [];\n\n function toFixed(value) {\n var str = String(value);\n\n if (str.length < 2) {\n str = \"0\" + str;\n }\n\n return str;\n }\n\n function formatHHMM(secondsValue) {\n var hours = Math.floor(secondsValue / (60 * 60));\n var minutePart = secondsValue - hours * 60 * 60;\n var minutes = Math.floor(minutePart / 60);\n return hours + \":\" + toFixed(minutes);\n }\n\n for (var i = 0; i < intervalsArray.length; i++) {\n result.push(formatHHMM(intervalsArray[i].start) + \"-\" + formatHHMM(intervalsArray[i].end));\n }\n\n return result;\n },\n\n /**\r\n * Build intersection of hour intervals. e.g.\r\n * first: [{start: 8, end: 12}, {start:13, end:18}]\r\n * second: [{start: 10, end: 15}]\r\n * result: [{start: 10, end: 12}, {start: 13, end: 15}]\r\n * @param {Array} first\r\n * @param {Array} second\r\n */\n _intersectHourRanges: function _intersectHourRanges(first, second) {\n var result = [];\n var baseArray = first.length > second.length ? first : second;\n var overridesArray = first === baseArray ? second : first;\n baseArray = baseArray.slice();\n overridesArray = overridesArray.slice();\n var result = [];\n\n for (var i = 0; i < baseArray.length; i++) {\n var base = baseArray[i];\n\n for (var j = 0; j < overridesArray.length; j++) {\n var current = overridesArray[j];\n\n if (current.start < base.end && current.end > base.start) {\n result.push({\n start: Math.max(base.start, current.start),\n end: Math.min(base.end, current.end)\n });\n\n if (base.end > current.end) {\n overridesArray.splice(j, 1);\n j--;\n i--;\n }\n }\n }\n }\n\n return result;\n },\n\n /**\r\n * Reduce the number of ranges in config when possible,\r\n * joins ranges that can be merged\r\n * parts: [{start: 8, end: 12}, {start:12, end:13}, {start: 15, end: 17}]\r\n * result: [{start: 8, end: 13}, {start: 15, end: 17}]\r\n * @param {Array} parts\r\n */\n _mergeAdjacentIntervals: function _mergeAdjacentIntervals(parts) {\n var result = parts.slice();\n result.sort(function (a, b) {\n return a.start - b.start;\n });\n var base = result[0];\n\n for (var i = 1; i < result.length; i++) {\n var current = result[i];\n\n if (current.start <= base.end) {\n if (current.end > base.end) {\n base.end = current.end;\n }\n\n result.splice(i, 1);\n i--;\n } else {\n base = current;\n }\n }\n\n return result;\n },\n _mergeHoursConfig: function _mergeHoursConfig(firstHours, secondHours) {\n //var firstIntervals = this._getIntervals(firstHours);\n //var secondIntervals = this._getIntervals(secondHours);\n return this._mergeAdjacentIntervals(this._intersectHourRanges(firstHours, secondHours));\n },\n merge: function merge(first, second) {\n var firstConfig = utils.copy(first.getConfig().parsed);\n var secondConfig = utils.copy(second.getConfig().parsed);\n var mergedSettings = {\n hours: this._toHoursArray(this._mergeHoursConfig(firstConfig.hours, secondConfig.hours)),\n dates: {},\n customWeeks: {}\n };\n\n for (var i in firstConfig.dates) {\n var firstDate = firstConfig.dates[i];\n var secondDate = secondConfig.dates[i]; // if this key is a working date in both calendars\n\n if (firstDate && secondDate) {\n // if at least one of working date is set by hours config - build intersection\n if (Array.isArray(firstDate) || Array.isArray(secondDate)) {\n var firstHours = Array.isArray(firstDate) ? firstDate : firstConfig.hours;\n var secondHours = Array.isArray(secondDate) ? secondDate : secondConfig.hours;\n mergedSettings.dates[i] = this._toHoursArray(this._mergeHoursConfig(firstHours, secondHours));\n } else {\n // date will use global hours\n mergedSettings.dates[i] = true;\n }\n } else {\n mergedSettings.dates[i] = false;\n }\n } // transfer and overwrite custom week calendars\n\n\n if (firstConfig.customWeeks) {\n for (var i in firstConfig.customWeeks) {\n mergedSettings.customWeeks[i] = firstConfig.customWeeks[i];\n }\n }\n\n if (secondConfig.customWeeks) {\n for (var i in secondConfig.customWeeks) {\n mergedSettings.customWeeks[i] = secondConfig.customWeeks[i];\n }\n }\n\n return mergedSettings;\n }\n};\nmodule.exports = WorkTimeCalendarMerger;","var utils = require(\"../../utils/utils\");\n\nvar createArgumentsHelper = require(\"./calendar_arguments_helper\");\n\nvar CalendarMergeHelper = require(\"./strategy/work_calendar_merger\");\n\nvar CalendarWorkTimeStrategy = require(\"./strategy/calendar_strategy\");\n\nvar legacyResourceCalendarConfig = require(\"./legacy_resource_config\");\n\nvar dynamicResourceCalendars = require(\"./dynamic_resource_calendars\")();\n\nfunction CalendarManager(gantt) {\n this.$gantt = gantt;\n this._calendars = {};\n this._legacyConfig = undefined;\n this.$gantt.attachEvent(\"onGanttReady\", function () {\n if (this.$gantt.config.resource_calendars) {\n this._isLegacyConfig = legacyResourceCalendarConfig.isLegacyResourceCalendarFormat(this.$gantt.config.resource_calendars);\n }\n }.bind(this));\n this.$gantt.attachEvent(\"onBeforeGanttReady\", function () {\n this.createDefaultCalendars();\n }.bind(this));\n this.$gantt.attachEvent(\"onBeforeGanttRender\", function () {\n this.createDefaultCalendars();\n }.bind(this));\n}\n\nCalendarManager.prototype = {\n _calendars: {},\n _convertWorkTimeSettings: function _convertWorkTimeSettings(settings) {\n var days = settings.days;\n\n if (days && !settings.dates) {\n settings.dates = settings.dates || {};\n\n for (var i = 0; i < days.length; i++) {\n settings.dates[i] = days[i];\n\n if (!(days[i] instanceof Array)) {\n settings.dates[i] = !!days[i];\n }\n }\n }\n\n delete settings.days;\n return settings;\n },\n mergeCalendars: function mergeCalendars() {\n var calendars = [];\n var args = arguments;\n\n if (Array.isArray(args[0])) {\n calendars = args[0].slice();\n } else {\n for (var i = 0; i < arguments.length; i++) {\n calendars.push(arguments[i]);\n }\n }\n\n var mergeHelper = new CalendarMergeHelper();\n var result;\n calendars.forEach(function (calendar) {\n if (!result) {\n result = calendar;\n } else {\n result = this._createCalendarFromConfig(mergeHelper.merge(result, calendar));\n }\n }.bind(this));\n return this.createCalendar(result);\n },\n _createCalendarFromConfig: function _createCalendarFromConfig(config) {\n var apiCore = new CalendarWorkTimeStrategy(this.$gantt, createArgumentsHelper(this.$gantt));\n apiCore.id = String(utils.uid());\n\n var preparedConfig = this._convertWorkTimeSettings(config);\n\n if (preparedConfig.customWeeks) {\n for (var i in preparedConfig.customWeeks) {\n preparedConfig.customWeeks[i] = this._convertWorkTimeSettings(preparedConfig.customWeeks[i]);\n }\n }\n\n apiCore._setConfig(preparedConfig);\n\n return apiCore;\n },\n createCalendar: function createCalendar(parentCalendar) {\n var settings;\n\n if (!parentCalendar) {\n parentCalendar = {};\n }\n\n if (parentCalendar.getConfig) {\n settings = utils.copy(parentCalendar.getConfig());\n } else if (parentCalendar.worktime) {\n settings = utils.copy(parentCalendar.worktime);\n } else {\n settings = utils.copy(parentCalendar);\n }\n\n var defaults = utils.copy(this.defaults.fulltime.worktime);\n utils.mixin(settings, defaults);\n return this._createCalendarFromConfig(settings);\n },\n getCalendar: function getCalendar(id) {\n id = id || \"global\";\n var calendar = this._calendars[id];\n\n if (!calendar) {\n this.createDefaultCalendars();\n calendar = this._calendars[id];\n }\n\n return calendar;\n },\n getCalendars: function getCalendars() {\n var res = [];\n\n for (var i in this._calendars) {\n res.push(this.getCalendar(i));\n }\n\n return res;\n },\n _getOwnCalendar: function _getOwnCalendar(task) {\n var config = this.$gantt.config;\n\n if (task[config.calendar_property]) {\n return this.getCalendar(task[config.calendar_property]);\n }\n\n if (config.resource_calendars) {\n var calendar;\n var calendarId;\n var resourceProperty;\n\n if (this._legacyConfig === false) {\n resourceProperty = config.resource_property;\n } else {\n resourceProperty = legacyResourceCalendarConfig.getResourceProperty(config);\n }\n\n if (Array.isArray(task[resourceProperty])) {\n // if multiple resources are attached to the task - merge their calendars\n if (config.dynamic_resource_calendars) {\n calendarId = dynamicResourceCalendars.getCalendarIdFromMultipleResources(task[resourceProperty], this);\n }\n } else {\n if (this._legacyConfig === undefined) {\n this._legacyConfig = legacyResourceCalendarConfig.isLegacyResourceCalendarFormat(config.resource_calendars);\n }\n\n if (this._legacyConfig) {\n var calendarId = legacyResourceCalendarConfig.getCalendarIdFromLegacyConfig(task, config.resource_calendars);\n } else if (resourceProperty && task[resourceProperty] && config.resource_calendars[task[resourceProperty]]) {\n var calendar = this.getResourceCalendar(task[resourceProperty]);\n }\n }\n\n if (calendarId) {\n calendar = this.getCalendar(calendarId);\n }\n\n if (calendar) {\n return calendar;\n }\n }\n\n return null;\n },\n\n /**\r\n * Returns calendar assigned to the specified resource.\r\n * Returns the global calendar if no custom calendar is associated with the resource.\r\n * @param {(string|number|Object)} resource - resource object or resource id\r\n * @returns {object} Calendar object\r\n */\n getResourceCalendar: function getResourceCalendar(resource) {\n if (resource === null || resource === undefined) {\n return this.getCalendar();\n }\n\n var resourceId = null; // if task id is provided\n\n if (typeof resource === \"number\" || typeof resource === \"string\") {\n resourceId = resource;\n } else {\n resourceId = resource.id || resource.key;\n }\n\n var config = this.$gantt.config;\n var calendarsConfig = config.resource_calendars;\n var calendarId = null;\n\n if (calendarsConfig) {\n if (this._legacyConfig === undefined) {\n this._legacyConfig = legacyResourceCalendarConfig.isLegacyResourceCalendarFormat(config.resource_calendars);\n }\n\n if (this._legacyConfig) {\n for (var field in calendarsConfig) {\n if (calendarsConfig[field][resourceId]) {\n calendarId = calendarsConfig[field][resourceId];\n break;\n }\n }\n } else {\n var calendarId = calendarsConfig[resourceId];\n }\n\n if (calendarId) {\n return this.getCalendar(calendarId);\n }\n }\n\n return this.getCalendar();\n },\n\n /**\r\n * Returns the calendar assigned to a task.\r\n * - Returns a calendar assigned via task[gantt.config.calendar_property] if specified.\r\n * - Returns a calendar assigned to the task resource if specified.\r\n * - Returns the global calendar otherwise.\r\n * @param {(string|number|Object)} task - task object or task id\r\n * @returns {object} Calendar object\r\n */\n getTaskCalendar: function getTaskCalendar(task) {\n var gantt = this.$gantt;\n var taskObject;\n\n if (task === null || task === undefined) {\n return this.getCalendar();\n } // if task id is provided\n\n\n if ((typeof task === \"number\" || typeof task === \"string\") && gantt.isTaskExists(task)) {\n taskObject = gantt.getTask(task);\n } else {\n taskObject = task;\n }\n\n if (!taskObject) {\n return this.getCalendar();\n }\n\n var calendar = this._getOwnCalendar(taskObject);\n\n var groupMode = !!gantt.getState().group_mode;\n\n if (!calendar && gantt.config.inherit_calendar && gantt.isTaskExists(taskObject.parent)) {\n // GS-1579 group mode overrides tree hierarchy, iterate using `.parent` property, instead of using eachParent iterator\n var currentTask = taskObject;\n\n while (gantt.isTaskExists(currentTask.parent)) {\n currentTask = gantt.getTask(currentTask.parent);\n\n if (gantt.isSummaryTask(currentTask)) {\n calendar = this._getOwnCalendar(currentTask);\n\n if (calendar) {\n break;\n }\n }\n }\n\n if (groupMode && !calendar) {\n // if group mode and inherit_calendars is enabled - preserve previously applied parent calendar\n // we may need it when groupBy parses grouped data, old parent may be not loaded yet\n if (task.$effective_calendar) {\n calendar = this.getCalendar(task.$effective_calendar);\n }\n }\n }\n\n return calendar || this.getCalendar();\n },\n addCalendar: function addCalendar(calendar) {\n // puts new calendar to Global Storage - gantt.calendarManager._calendars {}\n if (!this.isCalendar(calendar)) {\n var id = calendar.id;\n calendar = this.createCalendar(calendar);\n calendar.id = id;\n } // validate/check if empty calendar\n\n\n if (!calendar._tryChangeCalendarSettings(function () {})) {\n this.$gantt.callEvent(\"onCalendarError\", [{\n message: \"Invalid calendar settings, no worktime available\"\n }, calendar]);\n return null;\n } else {\n var config = this.$gantt.config;\n calendar.id = calendar.id || utils.uid();\n this._calendars[calendar.id] = calendar;\n if (!config.worktimes) config.worktimes = {};\n config.worktimes[calendar.id] = calendar.getConfig();\n return calendar.id;\n }\n },\n deleteCalendar: function deleteCalendar(calendar) {\n var config = this.$gantt.config;\n if (!calendar) return false;\n\n if (this._calendars[calendar]) {\n delete this._calendars[calendar];\n if (config.worktimes && config.worktimes[calendar]) delete config.worktimes[calendar];\n return true;\n } else {\n return false;\n }\n },\n restoreConfigCalendars: function restoreConfigCalendars(configs) {\n for (var i in configs) {\n if (this._calendars[i]) continue;\n var settings = configs[i];\n var calendar = this.createCalendar(settings);\n calendar.id = i;\n this.addCalendar(calendar);\n }\n },\n defaults: {\n global: {\n id: \"global\",\n worktime: {\n hours: [8, 12, 13, 17],\n days: [0, 1, 1, 1, 1, 1, 0]\n }\n },\n fulltime: {\n id: \"fulltime\",\n worktime: {\n hours: [0, 24],\n days: [1, 1, 1, 1, 1, 1, 1]\n }\n }\n },\n createDefaultCalendars: function createDefaultCalendars() {\n var config = this.$gantt.config;\n this.restoreConfigCalendars(this.defaults);\n this.restoreConfigCalendars(config.worktimes);\n },\n isCalendar: function isCalendar(possibleCalendar) {\n // because we don't have any way to check without dependency to CalendarWorkTimeStrategy\n var props = [possibleCalendar.isWorkTime, possibleCalendar.setWorkTime, possibleCalendar.getWorkHours, possibleCalendar.unsetWorkTime, possibleCalendar.getClosestWorkTime, possibleCalendar.calculateDuration, possibleCalendar.hasDuration, possibleCalendar.calculateEndDate];\n return props.every(function (entry) {\n return entry instanceof Function;\n });\n }\n};\nmodule.exports = CalendarManager;","var CalendarManager = require(\"./calendar_manager\"),\n TimeCalculator = require(\"./time_calculator\"),\n worktimeFacadeFactory = require(\"../facades/worktime_calendars\"),\n utils = require(\"../../utils/utils\");\n\nmodule.exports = function (gantt) {\n var manager = new CalendarManager(gantt),\n timeCalculator = new TimeCalculator(manager);\n var facade = worktimeFacadeFactory.create(manager, timeCalculator);\n utils.mixin(gantt, facade);\n};","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar helpers = require(\"../utils/helpers\");\n\nmodule.exports = function (gantt) {\n gantt.load = function (url, type, callback) {\n this._load_url = url;\n this.assert(arguments.length, \"Invalid load arguments\");\n var tp = 'json',\n cl = null;\n\n if (arguments.length >= 3) {\n tp = type;\n cl = callback;\n } else {\n if (typeof arguments[1] == \"string\") tp = arguments[1];else if (typeof arguments[1] == \"function\") cl = arguments[1];\n }\n\n this._load_type = tp;\n this.callEvent(\"onLoadStart\", [url, tp]);\n return this.ajax.get(url, gantt.bind(function (l) {\n this.on_load(l, tp);\n this.callEvent(\"onLoadEnd\", [url, tp]);\n if (typeof cl == \"function\") cl.call(this);\n }, this));\n };\n\n gantt.parse = function (data, type) {\n this.on_load({\n xmlDoc: {\n responseText: data\n }\n }, type);\n };\n\n gantt.serialize = function (type) {\n type = type || \"json\";\n return this[type].serialize();\n };\n /*\r\n tasks and relations\r\n {\r\n data:[\r\n \t{\r\n \t\t\"id\":\"string\",\r\n \t\t\"text\":\"...\",\r\n \t\t\"start_date\":\"Date or string\",\r\n \t\t\"end_date\":\"Date or string\",\r\n \t\t\"duration\":\"number\",\r\n \t\t\"progress\":\"0..1\",\r\n \t\t\"parent_id\":\"string\",\r\n \t\t\"order\":\"number\"\r\n \t},...],\r\n links:[\r\n \t{\r\n \t\tid:\"string\",\r\n \t\tsource:\"string\",\r\n \t\ttarget:\"string\",\r\n \t\ttype:\"string\"\r\n \t},...],\r\n collections:{\r\n \t\tcollectionName:[\r\n \t\t\t{key:, label:, optional:...},...\r\n \t\t],...\r\n \t}\r\n }\r\n \n * */\n\n\n gantt.on_load = function (resp, type) {\n if (resp.xmlDoc && resp.xmlDoc.status === 404) {\n // work if we don't have a file at current url\n this.assert(false, \"Failed to load the data from \" + resp.xmlDoc.responseURL + \", server returns 404\");\n return;\n }\n\n if (gantt.$destroyed) {\n return;\n }\n\n this.callEvent(\"onBeforeParse\", []);\n if (!type) type = \"json\";\n this.assert(this[type], \"Invalid data type:'\" + type + \"'\");\n var raw = resp.xmlDoc.responseText;\n var data = this[type].parse(raw, resp);\n\n this._process_loading(data);\n };\n\n function attachAssignmentsToTasks(tasks, assignments) {\n var assignmentsByTasks = {};\n assignments.forEach(function (a) {\n if (!assignmentsByTasks[a.task_id]) {\n assignmentsByTasks[a.task_id] = [];\n }\n\n assignmentsByTasks[a.task_id].push(a);\n });\n tasks.forEach(function (t) {\n t[gantt.config.resource_property] = assignmentsByTasks[t.id] || [];\n });\n }\n\n gantt._process_loading = function (data) {\n if (data.collections) this._load_collections(data.collections);\n\n if (data.resources && this.$data.resourcesStore) {\n this.$data.resourcesStore.parse(data.resources);\n }\n\n var tasks = data.data || data.tasks;\n\n if (data.assignments) {\n attachAssignmentsToTasks(tasks, data.assignments);\n }\n\n this.$data.tasksStore.parse(tasks);\n var links = data.links || (data.collections ? data.collections.links : []);\n this.$data.linksStore.parse(links); //this._sync_links();\n\n this.callEvent(\"onParse\", []);\n this.render();\n };\n\n gantt._load_collections = function (collections) {\n var collections_loaded = false;\n\n for (var key in collections) {\n if (collections.hasOwnProperty(key)) {\n collections_loaded = true;\n var collection = collections[key]; // GS-1728. Create an empty serverList if it doesn't exist\n\n this.serverList[key] = this.serverList[key] || [];\n var arr = this.serverList[key];\n if (!arr) continue;\n arr.splice(0, arr.length); //clear old options\n\n for (var j = 0; j < collection.length; j++) {\n var option = collection[j];\n var obj = this.copy(option);\n obj.key = obj.value; // resulting option object\n\n for (var option_key in option) {\n if (option.hasOwnProperty(option_key)) {\n if (option_key == \"value\" || option_key == \"label\") continue;\n obj[option_key] = option[option_key]; // obj['value'] = option['value']\n }\n }\n\n arr.push(obj);\n }\n }\n }\n\n if (collections_loaded) this.callEvent(\"onOptionsLoad\", []);\n };\n\n gantt.attachEvent(\"onBeforeTaskDisplay\", function (id, task) {\n return !task.$ignore;\n });\n\n function jsonParseError(data) {\n gantt.assert(false, \"Can't parse data: incorrect value of gantt.parse or gantt.load method. \" + \"Actual argument value: \" + JSON.stringify(data));\n throw new Error(\"Invalid argument for gantt.parse or gantt.load. An object or a JSON string of format https://docs.dhtmlx.com/gantt/desktop__supported_data_formats.html#json is expected. Actual argument value: \" + JSON.stringify(data));\n }\n\n gantt.json = {\n parse: function parse(data) {\n if (!data) {\n jsonParseError(data);\n }\n\n if (typeof data == \"string\") {\n if ((typeof JSON === \"undefined\" ? \"undefined\" : _typeof(JSON)) != undefined) {\n try {\n data = JSON.parse(data);\n } catch (e) {\n jsonParseError(data);\n }\n } else {\n gantt.assert(false, \"JSON is not supported\");\n }\n }\n\n if (!data.data && !data.tasks) {\n jsonParseError(data);\n }\n\n if (data.dhx_security) gantt.security_key = data.dhx_security;\n return data;\n },\n serializeTask: function serializeTask(task) {\n return this._copyObject(task);\n },\n serializeLink: function serializeLink(link) {\n return this._copyLink(link);\n },\n _copyLink: function _copyLink(obj) {\n var copy = {};\n\n for (var key in obj) {\n copy[key] = obj[key];\n }\n\n return copy;\n },\n _copyObject: function _copyObject(obj) {\n var copy = {};\n\n for (var key in obj) {\n if (key.charAt(0) == \"$\") continue;\n copy[key] = obj[key];\n\n if (helpers.isDate(copy[key])) {\n copy[key] = gantt.defined(gantt.templates.xml_format) ? gantt.templates.xml_format(copy[key]) : gantt.templates.format_date(copy[key]);\n }\n }\n\n return copy;\n },\n serialize: function serialize() {\n var tasks = [];\n var links = [];\n gantt.eachTask(function (obj) {\n gantt.resetProjectDates(obj);\n tasks.push(this.serializeTask(obj));\n }, gantt.config.root_id, this);\n var rawLinks = gantt.getLinks();\n\n for (var i = 0; i < rawLinks.length; i++) {\n links.push(this.serializeLink(rawLinks[i]));\n }\n\n return {\n data: tasks,\n links: links\n };\n }\n };\n /*\r\n \r\n \t\r\n \t\tMy task 1\r\n \t\t16.08.2013\r\n \t\t22.08.2013\r\n \t\r\n \t\r\n \t\t\r\n \t\t\t\r\n \t\t\r\n \t\r\n \r\n */\n\n function xmlParseError(data) {\n gantt.assert(false, \"Can't parse data: incorrect value of gantt.parse or gantt.load method. \" + \"Actual argument value: \" + JSON.stringify(data));\n throw new Error(\"Invalid argument for gantt.parse or gantt.load. An XML of format https://docs.dhtmlx.com/gantt/desktop__supported_data_formats.html#xmldhtmlxgantt20 is expected. Actual argument value: \" + JSON.stringify(data));\n }\n\n gantt.xml = {\n _xmlNodeToJSON: function _xmlNodeToJSON(node, attrs_only) {\n var t = {};\n\n for (var i = 0; i < node.attributes.length; i++) {\n t[node.attributes[i].name] = node.attributes[i].value;\n }\n\n if (!attrs_only) {\n for (var i = 0; i < node.childNodes.length; i++) {\n var child = node.childNodes[i];\n if (child.nodeType == 1) t[child.tagName] = child.firstChild ? child.firstChild.nodeValue : \"\";\n }\n\n if (!t.text) t.text = node.firstChild ? node.firstChild.nodeValue : \"\";\n }\n\n return t;\n },\n _getCollections: function _getCollections(loader) {\n var collection = {};\n var opts = gantt.ajax.xpath(\"//coll_options\", loader);\n\n for (var i = 0; i < opts.length; i++) {\n var bind = opts[i].getAttribute(\"for\");\n var arr = collection[bind] = [];\n var itms = gantt.ajax.xpath(\".//item\", opts[i]);\n\n for (var j = 0; j < itms.length; j++) {\n var itm = itms[j];\n var attrs = itm.attributes;\n var obj = {\n key: itms[j].getAttribute(\"value\"),\n label: itms[j].getAttribute(\"label\")\n };\n\n for (var k = 0; k < attrs.length; k++) {\n var attr = attrs[k];\n if (attr.nodeName == \"value\" || attr.nodeName == \"label\") continue;\n obj[attr.nodeName] = attr.nodeValue;\n }\n\n arr.push(obj);\n }\n }\n\n return collection;\n },\n _getXML: function _getXML(text, loader, toptag) {\n toptag = toptag || \"data\";\n\n if (!loader.getXMLTopNode) {\n loader = gantt.ajax.parse(loader);\n }\n\n var xml = gantt.ajax.xmltop(toptag, loader.xmlDoc);\n\n if (!xml || xml.tagName != toptag) {\n xmlParseError(text);\n }\n\n var skey = xml.getAttribute(\"dhx_security\");\n if (skey) gantt.security_key = skey;\n return xml;\n },\n parse: function parse(text, loader) {\n loader = this._getXML(text, loader);\n var data = {};\n var evs = data.data = [];\n var xml = gantt.ajax.xpath(\"//task\", loader);\n\n for (var i = 0; i < xml.length; i++) {\n evs[i] = this._xmlNodeToJSON(xml[i]);\n }\n\n data.collections = this._getCollections(loader);\n return data;\n },\n _copyLink: function _copyLink(obj) {\n return \"\";\n },\n _copyObject: function _copyObject(obj) {\n return \"\";\n },\n serialize: function serialize() {\n var tasks = [];\n var links = [];\n var json = gantt.json.serialize();\n\n for (var i = 0, len = json.data.length; i < len; i++) {\n tasks.push(this._copyObject(json.data[i]));\n }\n\n for (var i = 0, len = json.links.length; i < len; i++) {\n links.push(this._copyLink(json.links[i]));\n }\n\n return \"\" + tasks.join(\"\") + \"\" + links.join(\"\") + \"\";\n }\n };\n gantt.oldxml = {\n parse: function parse(text, loader) {\n loader = gantt.xml._getXML(text, loader, \"projects\");\n var data = {\n collections: {\n links: []\n }\n };\n var evs = data.data = [];\n var xml = gantt.ajax.xpath(\"//task\", loader);\n\n for (var i = 0; i < xml.length; i++) {\n evs[i] = gantt.xml._xmlNodeToJSON(xml[i]);\n var parent = xml[i].parentNode;\n if (parent.tagName == \"project\") evs[i].parent = \"project-\" + parent.getAttribute(\"id\");else evs[i].parent = parent.parentNode.getAttribute(\"id\");\n }\n\n xml = gantt.ajax.xpath(\"//project\", loader);\n\n for (var i = 0; i < xml.length; i++) {\n var ev = gantt.xml._xmlNodeToJSON(xml[i], true);\n\n ev.id = \"project-\" + ev.id;\n evs.push(ev);\n }\n\n for (var i = 0; i < evs.length; i++) {\n var ev = evs[i];\n ev.start_date = ev.startdate || ev.est;\n ev.end_date = ev.enddate;\n ev.text = ev.name;\n ev.duration = ev.duration / 8;\n ev.open = 1;\n if (!ev.duration && !ev.end_date) ev.duration = 1;\n if (ev.predecessortasks) data.collections.links.push({\n target: ev.id,\n source: ev.predecessortasks,\n type: gantt.config.links.finish_to_start\n });\n }\n\n return data;\n },\n serialize: function serialize() {\n gantt.message(\"Serialization to 'old XML' is not implemented\");\n }\n };\n\n gantt.serverList = function (name, array) {\n if (array) {\n this.serverList[name] = array.slice(0);\n } else if (!this.serverList[name]) {\n this.serverList[name] = [];\n }\n\n return this.serverList[name];\n };\n};","module.exports = function (gantt) {\n gantt.isReadonly = function (item) {\n if ((typeof item == \"number\" || typeof item == \"string\") && gantt.isTaskExists(item)) {\n item = gantt.getTask(item);\n }\n\n if (item && item[this.config.editable_property]) {\n return false;\n } else {\n return item && item[this.config.readonly_property] || this.config.readonly;\n }\n };\n};","module.exports = function (gantt) {\n gantt.getGridColumn = function (name) {\n var columns = gantt.config.columns;\n\n for (var i = 0; i < columns.length; i++) {\n if (columns[i].name == name) return columns[i];\n }\n\n return null;\n };\n\n gantt.getGridColumns = function () {\n return gantt.config.columns.slice();\n };\n};","const SENSITIVITY = 20;\r\nconst TIMEOUT = 50;\r\nconst SCROLLSTEP = 10;\r\n\r\nexport default class ScrollableGrid {\r\n\tpublic getCurrentX;\r\n\tprivate $gantt;\r\n\tprivate $grid;\r\n\tprivate _dnd;\r\n\tprivate _scrollView;\r\n\tprivate _scrollOrder: 0 | 1 | -1 = 0;\r\n\r\n\tconstructor(params) {\r\n\t\tconst {gantt, grid, dnd, getCurrentX} = params;\r\n\t\tthis.$gantt = gantt;\r\n\t\tthis.$grid = grid;\r\n\t\tthis._dnd = dnd;\r\n\t\tthis.getCurrentX = getCurrentX;\r\n\t\tthis._scrollView = this.$gantt.$ui.getView(this.$grid.$config.scrollX);\r\n\t\tthis.attachEvents();\r\n\t}\r\n\tattachEvents() {\r\n\t\tif (this.isScrollable()) {\r\n\t\t\tthis._dnd.attachEvent(\"onDragMove\", (obj, e) => {\r\n\t\t\t\tconst gridBoundingRect = this.$grid.$grid.getBoundingClientRect();\r\n\t\t\t\tconst maxLeft = gridBoundingRect.right;\r\n\t\t\t\tconst minLeft = gridBoundingRect.left;\r\n\t\t\t\tconst currentX = this.getCurrentX(e.clientX);\r\n\r\n\t\t\t\tif (currentX >= maxLeft - SENSITIVITY) {\r\n\t\t\t\t\tthis.autoscrollRight();\r\n\t\t\t\t\tthis.autoscrollStart();\r\n\t\t\t\t}\r\n\t\t\t\tif (currentX <= minLeft + SENSITIVITY) {\r\n\t\t\t\t\tthis.autoscrollLeft();\r\n\t\t\t\t\tthis.autoscrollStart();\r\n\t\t\t\t}\r\n\t\t\t\tif (currentX < maxLeft - SENSITIVITY && currentX > minLeft + SENSITIVITY) {\r\n\t\t\t\t\tthis.autoscrollStop();\r\n\t\t\t\t}\r\n\t\t\t\treturn true;\r\n\t\t\t});\r\n\t\t\tthis._dnd.attachEvent(\"onDragEnd\", () => {\r\n\t\t\t\tthis.autoscrollStop();\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\tautoscrollStart() {\r\n\t\tif (this._scrollOrder === 0) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst scrollStep = SCROLLSTEP * this._scrollOrder;\r\n\t\tconst scrollState = this._scrollView.getScrollState();\r\n\t\tthis._scrollView.scrollTo(scrollState.position + scrollStep);\r\n\t\tsetTimeout(() => { this.autoscrollStart(); }, TIMEOUT);\r\n\t}\r\n\tautoscrollRight() {\r\n\t\tthis._scrollOrder = 1;\r\n\t}\r\n\tautoscrollLeft() {\r\n\t\tthis._scrollOrder = -1;\r\n\t}\r\n\tautoscrollStop() {\r\n\t\tthis._scrollOrder = 0;\r\n\t}\r\n\tgetCorrection() {\r\n\t\tif (!this.isScrollable()) {\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t\treturn this._scrollView.getScrollState().position;\r\n\t}\r\n\tisScrollable() {\r\n\t\treturn !!this.$grid.$config.scrollable;\r\n\t}\r\n}","import * as domHelpers from \"../../utils/dom_helpers\";\r\nimport ScrollableGrid from \"./scrollable_grid\";\r\n\r\nconst COLUMN_ID_ATTR_NAME = \"data-column-id\";\r\n\r\nexport class ColumnsGridDnd {\r\n\tprivate $gantt;\r\n\tprivate $grid;\r\n\tprivate _dragX;\r\n\tprivate _dnd;\r\n\tprivate _originAutoscroll;\r\n\tprivate _scrollableGrid: ScrollableGrid;\r\n\tprivate _draggedCell;\r\n\tprivate _targetMarker = null;\r\n\tprivate _gridConfig;\r\n\tconstructor(gantt, grid) {\r\n\t\tthis.$gantt = gantt;\r\n\t\tthis.$grid = grid;\r\n\t}\r\n\tinit() {\r\n\t\tconst DND = this.$gantt.$services.getService(\"dnd\");\r\n\t\tthis._dnd = new DND(this.$grid.$grid_scale, { updates_per_second: 60 });\r\n\t\tthis._scrollableGrid = new ScrollableGrid({\r\n\t\t\tgantt: this.$gantt,\r\n\t\t\tgrid: this.$grid,\r\n\t\t\tdnd: this._dnd,\r\n\t\t\tgetCurrentX: this.calculateCurrentPosition\r\n\t\t});\r\n\t\tthis.attachEvents();\r\n\t}\r\n\tattachEvents() {\r\n\t\tthis._dnd.attachEvent(\"onBeforeDragStart\", (obj, e) => {\r\n\t\t\tthis._draggedCell = this.$gantt.utils.dom.closest(e.target, \".gantt_grid_head_cell\");\r\n\t\t\tif(!this._draggedCell){\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tconst columns = this.$grid.$getConfig().columns;\r\n\t\t\tconst columnName = this._draggedCell.getAttribute(COLUMN_ID_ATTR_NAME);\r\n\t\t\tlet draggedColumn;\r\n\t\t\tlet draggedIndex;\r\n\t\t\tcolumns.map(function(column, index){\r\n\t\t\t\tif(column.name === columnName){\r\n\t\t\t\t\tdraggedColumn = column;\r\n\t\t\t\t\tdraggedIndex = index;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\tif (this.$grid.callEvent(\"onBeforeColumnDragStart\", [{ draggedColumn, draggedIndex}]) === false) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\tif (!this._draggedCell || !draggedColumn) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\tthis._gridConfig = this.$grid.$getConfig();\r\n\t\t\tthis._originAutoscroll = this.$gantt.config.autoscroll;\r\n\t\t\tthis.$gantt.config.autoscroll = false;\r\n\t\t\treturn true;\r\n\t\t});\r\n\r\n\t\tthis._dnd.attachEvent(\"onAfterDragStart\", (obj, e) => {\r\n\t\t\tif (!this._draggedCell) {\r\n\t\t\t\treturn; // GS-1333: don't try to reorder a column when we resize it\r\n\t\t\t}\r\n\t\t\tthis._dnd.config.column = this._draggedCell.getAttribute(COLUMN_ID_ATTR_NAME);\r\n\t\t\tthis._dnd.config.marker.innerHTML = this._draggedCell.outerHTML;\r\n\t\t\tthis._dnd.config.marker.classList.add(\"gantt_column_drag_marker\");\r\n\t\t\tthis._dnd.config.marker.style.height = this._gridConfig.scale_height + \"px\";\r\n\t\t\tthis._dnd.config.marker.style.lineHeight = this._gridConfig.scale_height + \"px\";\r\n\t\t\tthis._draggedCell.classList.add(\"gantt_grid_head_cell_dragged\");\r\n\t\t});\r\n\r\n\t\tthis._dnd.attachEvent(\"onDragMove\", (obj, e) => {\r\n\t\t\tif(!this._draggedCell){\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tthis._dragX = e.clientX;\r\n\t\t\tconst x = this.calculateCurrentPosition(e.clientX);\r\n\t\t\tconst columnIndexes = this.findColumnsIndexes();\r\n\t\t\tconst targetIndex = columnIndexes.targetIndex;\r\n\t\t\tconst draggedIndex = columnIndexes.draggedIndex;\r\n\t\t\tconst columns = this.$grid.$getConfig().columns;\r\n\r\n\t\t\tconst draggedColumn = columns[draggedIndex];\r\n\t\t\tconst targetColumn = columns[targetIndex];\r\n\t\t\tif (this.$grid.callEvent(\"onColumnDragMove\", [{ draggedColumn, targetColumn, draggedIndex, targetIndex }]) === false) {\r\n\t\t\t\tthis.cleanTargetMarker();\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\tthis.setMarkerPosition(x);\r\n\t\t\tthis.drawTargetMarker(columnIndexes);\r\n\t\t\treturn true;\r\n\t\t});\r\n\r\n\t\tthis._dnd.attachEvent(\"onDragEnd\", () => {\r\n\t\t\tif (!this._draggedCell) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tthis.$gantt.config.autoscroll = this._originAutoscroll;\r\n\t\t\tthis._draggedCell.classList.remove(\"gantt_grid_head_cell_dragged\");\r\n\t\t\tthis.cleanTargetMarker();\r\n\t\t\tthis.reorderColumns();\r\n\t\t});\r\n\r\n\t}\r\n\treorderColumns() {\r\n\t\tconst { targetIndex, draggedIndex } = this.findColumnsIndexes();\r\n\r\n\t\tconst columns = this.$grid.$getConfig().columns;\r\n\t\tconst draggedColumn = columns[draggedIndex];\r\n\t\tconst targetColumn = columns[targetIndex];\r\n\r\n\t\tif (this.$grid.callEvent(\"onBeforeColumnReorder\", [{ draggedColumn, targetColumn, draggedIndex, targetIndex }]) === false) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (targetIndex === draggedIndex) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tcolumns.splice(draggedIndex, 1);\r\n\t\tcolumns.splice(targetIndex, 0, draggedColumn);\r\n\t\tthis.$gantt.render();\r\n\t\tthis.$grid.callEvent(\"onAfterColumnReorder\", [{ draggedColumn, targetColumn, draggedIndex, targetIndex }]);\r\n\t}\r\n\tfindColumnsIndexes() {\r\n\t\tconst draggedId = this._dnd.config.column;\r\n\t\tconst columns = this.$grid.$getConfig().columns;\r\n\t\tlet targetIndex: number;\r\n\t\tlet draggedIndex: number;\r\n\t\tlet xBefore: number;\r\n\t\tlet xAfter: number;\r\n\t\tconst currentColumn = { startX: 0, endX: 0 };\r\n\r\n\t\tlet start = 0;\r\n\t\tlet end = columns.length - 1;\r\n\t\tlet compare = (a, b) => a <= b;\r\n\t\tlet next = (index) => ++index;\r\n\t\tif (this.$gantt.config.rtl) {\r\n\t\t\tstart = columns.length - 1;\r\n\t\t\tend = 0;\r\n\t\t\tcompare = (a, b) => a >= b;\r\n\t\t\tnext = (index) => --index;\r\n\t\t}\r\n\r\n\t\tlet columnRelativePos: number;\r\n\r\n\t\tconst relativeX = this._dragX - this.$grid.$grid.getBoundingClientRect().left + this._scrollableGrid.getCorrection();\r\n\t\tfor (let i = start; compare(i, end); i = next(i)) {\r\n\t\t\tif (targetIndex !== undefined && draggedIndex !== undefined) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tif(!columns[i].hide) {\r\n\t\t\t\tcurrentColumn.startX = currentColumn.endX;\r\n\t\t\t\tcurrentColumn.endX += columns[i].width;\r\n\r\n\t\t\t\t// if drop on a column or drop after the last column\r\n\t\t\t\tif (relativeX >= currentColumn.startX && (relativeX <= currentColumn.endX || !compare(next(i), end))) {\r\n\t\t\t\t\ttargetIndex = i;\r\n\t\t\t\t\txBefore = currentColumn.startX;\r\n\t\t\t\t\txAfter = currentColumn.endX;\r\n\t\t\t\t\tcolumnRelativePos = (relativeX - currentColumn.startX) / (currentColumn.endX - currentColumn.startX);\r\n\t\t\t\t}\r\n\t\t\t\tif (draggedId === columns[i].name) {\r\n\t\t\t\t\tdraggedIndex = i;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\ttargetIndex,\r\n\t\t\tdraggedIndex,\r\n\t\t\txBefore,\r\n\t\t\txAfter,\r\n\t\t\tcolumnRelativePos\r\n\t\t};\r\n\t}\r\n\tsetMarkerPosition(x: number, y: number = 10) {\r\n\t\tconst { marker } = this._dnd.config;\r\n\t\tconst gridOffset = this._dnd._obj.getBoundingClientRect();\r\n\t\tmarker.style.top = `${gridOffset.y + y}px`;\r\n\t\tmarker.style.left = `${x}px`;\r\n\t}\r\n\tcalculateCurrentPosition = (eventX: number) => {\r\n\t\tconst gridBoundingRect = this.$grid.$grid.getBoundingClientRect();\r\n\t\tconst maxLeft = gridBoundingRect.right;\r\n\t\tconst minLeft = gridBoundingRect.left;\r\n\t\tlet x = eventX;\r\n\t\tif (x > maxLeft) {\r\n\t\t\tx = maxLeft;\r\n\t\t}\r\n\t\tif (x < minLeft) {\r\n\t\t\tx = minLeft;\r\n\t\t}\r\n\t\treturn x;\r\n\t}\r\n\tdrawTargetMarker({ targetIndex, draggedIndex, xBefore, xAfter, columnRelativePos }) {\r\n\t\tif (!this._targetMarker) {\r\n\t\t\tthis._targetMarker = document.createElement(\"div\");\r\n\t\t\tdomHelpers.addClassName(this._targetMarker, \"gantt_grid_target_marker\");\r\n\t\t\tthis._targetMarker.style.display = \"none\";\r\n\t\t\tthis._targetMarker.style.height = `${this._gridConfig.scale_height}px`;\r\n\t\t}\r\n\r\n\t\t// marker can be detached after gantt.render\r\n\t\tif(!this._targetMarker.parentNode){\r\n\t\t\tthis.$grid.$grid_scale.appendChild(this._targetMarker);\r\n\t\t}\r\n\r\n\t\tlet nextPosition: number;\r\n\t\tif (targetIndex > draggedIndex) {\r\n\t\t\tnextPosition = xAfter;\r\n\t\t} else if (targetIndex < draggedIndex) {\r\n\t\t\tnextPosition = xBefore;\r\n\t\t} else {\r\n\t\t\tif(columnRelativePos > 0.5){\r\n\t\t\t\tnextPosition = xAfter;\r\n\t\t\t}else{\r\n\t\t\t\tnextPosition = xBefore;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthis._targetMarker.style.left = `${nextPosition}px`;\r\n\t\tthis._targetMarker.style.display = \"block\";\r\n\t}\r\n\tcleanTargetMarker() {\r\n\t\tif (this._targetMarker && this._targetMarker.parentNode) {\r\n\t\t\tthis.$grid.$grid_scale.removeChild(this._targetMarker);\r\n\t\t}\r\n\t\tthis._targetMarker = null;\r\n\t}\r\n}","import {ColumnsGridDnd} from \"./column_grid_dnd\";\r\nexport default ColumnsGridDnd;","var domHelpers = require(\"../utils/dom_helpers\");\n\nfunction createRowResizer(gantt, grid) {\n var _task_grid_row_resize = {\n row_before_start: gantt.bind(function (dnd, obj, e) {\n var config = grid.$getConfig();\n var store = grid.$config.rowStore;\n var el = domHelpers.locateAttribute(e, config.task_grid_row_resizer_attribute);\n if (!el) return false;\n var row_id = this.locate(e, config.task_grid_row_resizer_attribute),\n row = store.getItem(row_id);\n if (grid.callEvent(\"onBeforeRowResize\", [row]) === false) return false;\n }, gantt),\n row_after_start: gantt.bind(function (dnd, obj, e) {\n var config = grid.$getConfig();\n var row_id = this.locate(e, config.task_grid_row_resizer_attribute);\n dnd.config.marker.innerHTML = \"\";\n dnd.config.marker.className += \" gantt_row_grid_resize_area\";\n dnd.config.marker.style.width = grid.$grid.offsetWidth + \"px\";\n dnd.config.drag_id = row_id;\n }, gantt),\n row_drag_move: gantt.bind(function (dnd, obj, e) {\n var store = grid.$config.rowStore;\n var config = grid.$getConfig();\n var dd = dnd.config;\n var id = dd.drag_id,\n itemHeight = grid.getItemHeight(id),\n itemTop = grid.getItemTop(id);\n var pos = domHelpers.getNodePosition(grid.$grid_data),\n pointerPosition = parseInt(dd.marker.style.top, 10),\n markerStartPosition = itemTop + pos.y,\n marker_height = 0,\n minPointerPosition = config.min_task_grid_row_height;\n marker_height = pointerPosition - markerStartPosition;\n\n if (marker_height < minPointerPosition) {\n marker_height = minPointerPosition;\n }\n\n dd.marker.style.left = pos.x + \"px\";\n dd.marker.style.top = markerStartPosition - 1 + \"px\";\n dd.marker.style.height = Math.abs(marker_height) + 1 + \"px\";\n dd.marker_height = marker_height;\n grid.callEvent(\"onRowResize\", [id, store.getItem(id), marker_height + itemHeight]);\n return true;\n }, gantt),\n row_drag_end: gantt.bind(function (dnd, obj, e) {\n var store = grid.$config.rowStore;\n var dd = dnd.config;\n var id = dd.drag_id,\n item = store.getItem(id),\n oldItemHeight = grid.getItemHeight(id);\n var finalHeight = dd.marker_height;\n if (grid.callEvent(\"onBeforeRowResizeEnd\", [id, item, finalHeight]) === false) return;\n if (item.row_height == finalHeight) return;\n item.row_height = finalHeight;\n gantt.updateTask(id);\n grid.callEvent(\"onAfterRowResize\", [id, item, oldItemHeight, finalHeight]);\n this.render();\n }, gantt)\n }; // calls the initialization of the D'n'D events for resize elements\n\n var _init_resize = function _init_resize() {\n var DnD = gantt.$services.getService(\"dnd\");\n var config = grid.$getConfig();\n var dnd = new DnD(grid.$grid_data, {\n updates_per_second: 60\n });\n if (gantt.defined(config.dnd_sensitivity)) dnd.config.sensitivity = config.dnd_sensitivity;\n dnd.attachEvent(\"onBeforeDragStart\", function (obj, e) {\n return _task_grid_row_resize.row_before_start(dnd, obj, e);\n });\n dnd.attachEvent(\"onAfterDragStart\", function (obj, e) {\n return _task_grid_row_resize.row_after_start(dnd, obj, e);\n });\n dnd.attachEvent(\"onDragMove\", function (obj, e) {\n return _task_grid_row_resize.row_drag_move(dnd, obj, e);\n });\n dnd.attachEvent(\"onDragEnd\", function (obj, e) {\n return _task_grid_row_resize.row_drag_end(dnd, obj, e);\n });\n };\n\n return {\n init: _init_resize\n };\n}\n\nmodule.exports = createRowResizer;","function createHelper(view) {\n var cachedRowHeight = -1;\n var canUseSimpleCalc = -1;\n return {\n resetCache: function resetCache() {\n cachedRowHeight = -1;\n canUseSimpleCalc = -1;\n },\n _getRowHeight: function _getRowHeight() {\n if (cachedRowHeight === -1) {\n cachedRowHeight = view.$getConfig().row_height;\n }\n\n return cachedRowHeight;\n },\n _refreshState: function _refreshState() {\n this.resetCache();\n canUseSimpleCalc = true;\n var store = view.$config.rowStore;\n\n if (!store) {\n return;\n }\n\n var globalRowHeight = this._getRowHeight();\n\n for (var i = 0; i < store.fullOrder.length; i++) {\n var item = store.getItem(store.fullOrder[i]); // GS-1491: ignore the task when it is filtered:\n\n if (!item) {\n continue;\n }\n\n if (item.row_height && item.row_height !== globalRowHeight) {\n canUseSimpleCalc = false;\n break;\n }\n }\n },\n canUseSimpleCalculation: function canUseSimpleCalculation() {\n if (canUseSimpleCalc === -1) {\n this._refreshState();\n }\n\n return canUseSimpleCalc;\n },\n\n /**\r\n * Get top coordinate by row index (order)\r\n * @param {number} index\r\n */\n getRowTop: function getRowTop(index) {\n var store = view.$config.rowStore;\n\n if (!store) {\n return 0;\n }\n\n return index * this._getRowHeight();\n },\n\n /**\r\n * Get height of the item by item id\r\n * @param {*} itemId\r\n */\n getItemHeight: function getItemHeight(itemId) {\n return this._getRowHeight();\n },\n\n /**\r\n * Get total height of items\r\n */\n getTotalHeight: function getTotalHeight() {\n if (view.$config.rowStore) {\n var store = view.$config.rowStore;\n return store.countVisible() * this._getRowHeight();\n } else {\n return 0;\n }\n },\n\n /**\r\n * Get item by top position\r\n * @param {*} top\r\n */\n getItemIndexByTopPosition: function getItemIndexByTopPosition(top) {\n if (view.$config.rowStore) {\n return Math.floor(top / this._getRowHeight());\n } else {\n return 0;\n }\n }\n };\n}\n\nmodule.exports = createHelper;","function createResizer(gantt, grid) {\n return {\n init: function init() {},\n doOnRender: function doOnRender() {}\n };\n}\n\nmodule.exports = createResizer;","var Grid = require(\"./ui/grid/grid\");\n\nmodule.exports = function (gantt) {\n require(\"./grid_column_api.gpl\")(gantt);\n\n Grid.prototype.getGridColumns = function () {\n var config = this.$getConfig();\n var columns = config.columns,\n visibleColumns = [];\n\n for (var i = 0; i < columns.length; i++) {\n if (!columns[i].hide) visibleColumns.push(columns[i]);\n }\n\n return visibleColumns;\n };\n};","module.exports = function (gantt) {\n var TreeDataStore = require(\"./datastore/treedatastore\");\n\n var loadedBranches = {};\n gantt.attachEvent(\"onClearAll\", function () {\n loadedBranches = {};\n });\n var oldHasChildren = TreeDataStore.prototype.hasChild;\n\n gantt.$data.tasksStore.hasChild = function (id) {\n if (!gantt.config.branch_loading) {\n return oldHasChildren.call(this, id);\n } else {\n if (oldHasChildren.call(this, id)) return true;\n\n if (this.exists(id)) {\n return this.getItem(id)[gantt.config.branch_loading_property];\n }\n }\n\n return false;\n };\n\n function needLoading(id) {\n if (gantt.config.branch_loading && gantt._load_url) {\n var alreadyLoaded = !!loadedBranches[id]; // call ajax only if branch has children\n\n if (!alreadyLoaded && !gantt.getChildren(id).length && gantt.hasChild(id)) {\n return true;\n }\n }\n\n return false;\n }\n\n gantt.attachEvent(\"onTaskOpened\", function (id) {\n if (gantt.config.branch_loading && gantt._load_url) {\n // call ajax only if branch has children\n if (needLoading(id)) {\n var url = gantt._load_url;\n url = url.replace(/(\\?|&)?parent_id=.+&?/, \"\");\n var param = url.indexOf(\"?\") >= 0 ? \"&\" : \"?\";\n var y = gantt.getScrollState().y || 0;\n var requestData = {\n taskId: id,\n url: url + param + \"parent_id=\" + encodeURIComponent(id)\n };\n\n if (gantt.callEvent(\"onBeforeBranchLoading\", [requestData]) === false) {\n return;\n }\n\n gantt.load(requestData.url, this._load_type, function () {\n if (y) {\n gantt.scrollTo(null, y);\n }\n\n gantt.callEvent(\"onAfterBranchLoading\", [requestData]);\n });\n loadedBranches[id] = true;\n }\n }\n });\n};","export default function(gantt: any){\r\n\r\n\tgantt.ext = gantt.ext || {};\r\n\tgantt.config.show_empty_state = false;\r\n\r\n\tgantt.ext.emptyStateElement = gantt.ext.emptyStateElement || {\r\n\t\tisEnabled() {\r\n\t\t\treturn gantt.config.show_empty_state === true;\r\n\t\t},\r\n\t\tisGanttEmpty(){\r\n\t\t\treturn !gantt.getTaskByTime().length;\r\n\t\t},\r\n\t\trenderContent(container){\r\n\t\t\tconst placeholderTextElement = `
\r\n \r\n
${gantt.locale.labels.empty_state_text_description}
\r\n
`;\r\n\t\t\tconst placeholderImageElement = \"
\";\r\n\r\n\t\t\tconst placeholderContainer = `
${placeholderImageElement}${placeholderTextElement}
`;\r\n\t\t\tcontainer.innerHTML = placeholderContainer;\r\n\t\t},\r\n\r\n\t\tclickEvents: [],\r\n\t\tattachAddTaskEvent(){\r\n\t\t\tconst id = gantt.attachEvent(\"onEmptyClick\", function(e){\r\n\t\t\t\tconst domHelpers = gantt.utils.dom;\r\n\t\t\t\tconst gridPlaceholder = domHelpers.closest(e.target, \"[data-empty-state-create-task]\");\r\n\t\t\t\tif (gridPlaceholder){\r\n\t\t\t\t\tgantt.createTask({\r\n\t\t\t\t\t\tid: gantt.uid(),\r\n\t\t\t\t\t\ttext: \"New Task\"\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\tthis.clickEvents.push(id);\r\n\t\t},\r\n\t\tdetachAddTaskEvents(){\r\n\t\t\tthis.clickEvents.forEach(function(event){\r\n\t\t\t\tgantt.detachEvent(event);\r\n\t\t\t});\r\n\t\t\tthis.clickEvents = [];\r\n\t\t},\r\n\r\n\t\tgetContainer(){\r\n\t\t\tif (gantt.$container) {\r\n\t\t\t\tconst domHelpers = gantt.utils.dom;\r\n\t\t\t\tif (gantt.$container.contains(gantt.$grid_data)) {\r\n\t\t\t\t\treturn domHelpers.closest(gantt.$grid_data, \".gantt_layout_content\");\r\n\t\t\t\t}\r\n\t\t\t\tif (gantt.$container.contains(gantt.$task_data)){\r\n\t\t\t\t\treturn domHelpers.closest(gantt.$task_data, \".gantt_layout_content\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\treturn null;\r\n\t\t},\r\n\r\n\t\tgetNode(){\r\n\t\t\tconst container = this.getContainer();\r\n\t\t\tif (!container){\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\t\t\tconst emptyStateElementNode = container.querySelector(\".gantt_empty_state_wrapper\");\r\n\t\t\treturn emptyStateElementNode;\r\n\t\t},\r\n\r\n\t\tshow(){\r\n\t\t\tconst container = this.getContainer();\r\n\t\t\tif (!container && this.isGanttEmpty()){\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\r\n\t\t\tconst wrapper = document.createElement(\"div\");\r\n\t\t\twrapper.className = \"gantt_empty_state_wrapper\";\r\n\t\t\twrapper.style.marginTop = (gantt.config.scale_height - container.offsetHeight) + \"px\";\r\n\t\t\tconst oldNodes = gantt.$container.querySelectorAll(\".gantt_empty_state_wrapper\");\r\n\t\t\t// for IE11\r\n\t\t\tArray.prototype.forEach.call(oldNodes, function(node){\r\n\t\t\t\tnode.parentNode.removeChild(node);\r\n\t\t\t});\r\n\r\n\t\t\tthis.detachAddTaskEvents();\r\n\t\t\tthis.attachAddTaskEvent();\r\n\r\n\t\t\tcontainer.appendChild(wrapper);\r\n\t\t\tthis.renderContent(wrapper);\r\n\t\t},\r\n\t\thide(){\r\n\t\t\tconst emptyStateElementNode = this.getNode();\r\n\t\t\tif (emptyStateElementNode){\r\n\t\t\t\temptyStateElementNode.parentNode.removeChild(emptyStateElementNode);\r\n\t\t\t} else{\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t},\r\n\t\tinit(){ }\r\n\t};\r\n\r\n\tgantt.attachEvent(\"onDataRender\", function() {\r\n\t\tconst emptyStateElement = gantt.ext.emptyStateElement;\r\n\t\tif (emptyStateElement.isEnabled() && emptyStateElement.isGanttEmpty()) {\r\n\t\t\temptyStateElement.show();\r\n\t\t} else {\r\n\t\t\temptyStateElement.hide();\r\n\t\t}\r\n\t});\r\n\r\n\r\n\r\n\r\n}\r\n","export default class LinkFormatterSimple implements ILinkFormatter {\r\n\tstatic create = (settings: ILinkFormatterConfig = null, gantt: any): LinkFormatterSimple => {\r\n\t\treturn new LinkFormatterSimple(gantt);\r\n\t}\r\n\tprotected _linkReg: RegExp;\r\n\tprotected _gantt: any;\r\n\r\n\tconstructor(gantt: any) {\r\n\t\tthis._linkReg = /^[0-9\\.]+/;\r\n\t\tthis._gantt = gantt;\r\n\t}\r\n\r\n\tformat = (link: ILink) : string => {\r\n\t\tconst wbs = this._getWBSCode(link.source);\r\n\t\treturn wbs;\r\n\t}\r\n\r\n\tcanParse = (value: string) : boolean => {\r\n\t\treturn this._linkReg.test(value);\r\n\t}\r\n\tparse = (value: string) : ILink => {\r\n\t\tif(!this.canParse(value)){\r\n\t\t\treturn null;\r\n\t\t}\r\n\r\n\t\tconst linkPart = this._linkReg.exec(value)[0].trim();\r\n\r\n\t\tconst source = this._findSource(linkPart) || null;\r\n\r\n\t\treturn {\r\n\t\t\tid: undefined,\r\n\t\t\tsource,\r\n\t\t\ttarget: null,\r\n\t\t\ttype: this._gantt.config.links.finish_to_start,\r\n\t\t\tlag: 0\r\n\t\t};\r\n\t}\r\n\r\n\tprotected _getWBSCode = (source: number | string) => {\r\n\t\tconst pred = this._gantt.getTask(source);\r\n\t\treturn this._gantt.getWBSCode(pred);\r\n\t}\r\n\r\n\tprotected _findSource = (value: string) => {\r\n\t\tconst reqTemplate = new RegExp(\"^[0-9\\.]+\", \"i\");\r\n\t\tif(reqTemplate.exec(value)){\r\n\t\t\tconst wbs = reqTemplate.exec(value)[0];\r\n\t\t\tconst task = this._gantt.getTaskByWBSCode(wbs);\r\n\t\t\tif(task){\r\n\t\t\t\treturn task.id;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n}","var DurationFormatter = require(\"../common/duration_formatter\")[\"default\"];\n\nvar LinkFormatter = require(\"../common/link_formatter\")[\"default\"];\n\nmodule.exports = function (gantt) {\n gantt.ext.formatters = {\n durationFormatter: function durationFormatter(settings) {\n if (!settings) {\n settings = {};\n }\n\n if (!settings.store) {\n settings.store = gantt.config.duration_unit;\n }\n\n if (!settings.enter) {\n settings.enter = gantt.config.duration_unit;\n }\n\n return DurationFormatter.create(settings, gantt);\n },\n linkFormatter: function linkFormatter(settings) {\n return LinkFormatter.create(settings, gantt);\n }\n };\n};","module.exports = function (gantt) {\n function isEnabled() {\n return gantt.config.auto_types && // if enabled\n gantt.getTaskType(gantt.config.types.project) == gantt.config.types.project; // and supported\n }\n\n function callIfEnabled(callback) {\n return function () {\n if (!isEnabled()) {\n return true;\n }\n\n return callback.apply(this, arguments);\n };\n }\n\n function checkTaskType(id, changedTypes) {\n var task = gantt.getTask(id);\n var targetType = getTaskTypeToUpdate(task);\n\n if (targetType !== false && gantt.getTaskType(task) !== targetType) {\n changedTypes.$needsUpdate = true;\n changedTypes[task.id] = {\n task: task,\n type: targetType\n };\n }\n }\n\n function getUpdatedTypes(id, changedTypes) {\n changedTypes = changedTypes || {};\n checkTaskType(id, changedTypes);\n gantt.eachParent(function (parent) {\n checkTaskType(parent.id, changedTypes);\n }, id);\n return changedTypes;\n }\n\n function applyChanges(changedTypes) {\n for (var i in changedTypes) {\n if (changedTypes[i] && changedTypes[i].task) {\n var task = changedTypes[i].task;\n task.type = changedTypes[i].type;\n gantt.updateTask(task.id);\n }\n }\n }\n\n function updateParentTypes(startId) {\n if (gantt.getState().group_mode) {\n return;\n }\n\n var changedTypes = getUpdatedTypes(startId);\n\n if (changedTypes.$needsUpdate) {\n gantt.batchUpdate(function () {\n applyChanges(changedTypes);\n });\n }\n }\n\n var delTaskParent;\n\n function updateTaskType(task, targetType) {\n if (!gantt.getState().group_mode) {\n task.type = targetType;\n gantt.updateTask(task.id);\n }\n }\n\n function getTaskTypeToUpdate(task) {\n var allTypes = gantt.config.types;\n var hasChildren = gantt.hasChild(task.id);\n var taskType = gantt.getTaskType(task.type);\n\n if (hasChildren && taskType === allTypes.task) {\n return allTypes.project;\n }\n\n if (!hasChildren && taskType === allTypes.project) {\n return allTypes.task;\n }\n\n return false;\n }\n\n var isParsingDone = true;\n gantt.attachEvent(\"onParse\", callIfEnabled(function () {\n isParsingDone = false;\n\n if (gantt.getState().group_mode) {\n return;\n }\n\n gantt.batchUpdate(function () {\n gantt.eachTask(function (task) {\n var targetType = getTaskTypeToUpdate(task);\n\n if (targetType !== false) {\n updateTaskType(task, targetType);\n }\n });\n });\n isParsingDone = true;\n }));\n gantt.attachEvent(\"onAfterTaskAdd\", callIfEnabled(function (id) {\n if (isParsingDone) {\n updateParentTypes(id);\n }\n }));\n gantt.attachEvent(\"onAfterTaskUpdate\", callIfEnabled(function (id) {\n if (isParsingDone) {\n updateParentTypes(id);\n }\n }));\n\n function updateAfterRemoveChild(id) {\n if (id != gantt.config.root_id && gantt.isTaskExists(id)) {\n updateParentTypes(id);\n }\n }\n\n gantt.attachEvent(\"onBeforeTaskDelete\", callIfEnabled(function (id, task) {\n delTaskParent = gantt.getParent(id);\n return true;\n }));\n gantt.attachEvent(\"onAfterTaskDelete\", callIfEnabled(function (id, task) {\n updateAfterRemoveChild(delTaskParent);\n }));\n var originalRowDndParent;\n gantt.attachEvent(\"onRowDragStart\", callIfEnabled(function (id, target, e) {\n originalRowDndParent = gantt.getParent(id);\n return true;\n }));\n gantt.attachEvent(\"onRowDragEnd\", callIfEnabled(function (id, target) {\n updateAfterRemoveChild(originalRowDndParent);\n updateParentTypes(id);\n }));\n var originalMoveTaskParent;\n gantt.attachEvent(\"onBeforeTaskMove\", callIfEnabled(function (sid, parent, tindex) {\n originalMoveTaskParent = gantt.getParent(sid);\n return true;\n }));\n gantt.attachEvent(\"onAfterTaskMove\", callIfEnabled(function (id, parent, tindex) {\n if (document.querySelector(\".gantt_drag_marker\")) {\n // vertical dnd in progress\n return;\n }\n\n updateAfterRemoveChild(originalMoveTaskParent);\n updateParentTypes(id);\n }));\n};","module.exports = function addPlaceholder(gantt) {\n function isEnabled() {\n return gantt.config.placeholder_task;\n }\n\n function callIfEnabled(callback) {\n return function () {\n if (!isEnabled()) {\n return true;\n }\n\n return callback.apply(this, arguments);\n };\n }\n\n function silenceDataProcessor(dataProcessor) {\n if (dataProcessor && !dataProcessor._silencedPlaceholder) {\n dataProcessor._silencedPlaceholder = true;\n dataProcessor.attachEvent(\"onBeforeUpdate\", callIfEnabled(function (id, state, data) {\n if (data.type == gantt.config.types.placeholder) {\n dataProcessor.setUpdated(id, false);\n return false;\n }\n\n return true;\n }));\n }\n }\n\n function insertPlaceholder() {\n var placeholders = gantt.getTaskBy(\"type\", gantt.config.types.placeholder);\n\n if (!placeholders.length || !gantt.isTaskExists(placeholders[0].id)) {\n var placeholder = {\n unscheduled: true,\n type: gantt.config.types.placeholder,\n duration: 0,\n text: gantt.locale.labels.new_task\n };\n\n if (gantt.callEvent(\"onTaskCreated\", [placeholder]) === false) {\n return;\n }\n\n gantt.addTask(placeholder);\n }\n }\n\n function afterEdit(id) {\n var item = gantt.getTask(id);\n\n if (item.type == gantt.config.types.placeholder) {\n if (item.start_date && item.end_date && item.unscheduled) {\n item.unscheduled = false;\n }\n\n gantt.batchUpdate(function () {\n var newTask = gantt.copy(item);\n gantt.silent(function () {\n gantt.deleteTask(item.id);\n });\n delete newTask[\"!nativeeditor_status\"];\n newTask.type = gantt.config.types.task;\n newTask.id = gantt.uid();\n gantt.addTask(newTask); //insertPlaceholder();\n });\n }\n }\n\n gantt.config.types.placeholder = \"placeholder\";\n gantt.attachEvent(\"onDataProcessorReady\", callIfEnabled(silenceDataProcessor));\n var ready = false;\n gantt.attachEvent(\"onGanttReady\", function () {\n if (ready) {\n return;\n }\n\n ready = true;\n gantt.attachEvent(\"onAfterTaskUpdate\", callIfEnabled(afterEdit));\n gantt.attachEvent(\"onAfterTaskAdd\", callIfEnabled(function (id, task) {\n if (task.type != gantt.config.types.placeholder) {\n var placeholders = gantt.getTaskBy(\"type\", gantt.config.types.placeholder);\n placeholders.forEach(function (p) {\n gantt.silent(function () {\n if (gantt.isTaskExists(p.id)) gantt.deleteTask(p.id);\n });\n });\n insertPlaceholder();\n }\n }));\n gantt.attachEvent(\"onParse\", callIfEnabled(insertPlaceholder));\n });\n\n function isPlaceholderTask(taskId) {\n if (gantt.config.types.placeholder && gantt.isTaskExists(taskId)) {\n var task = gantt.getTask(taskId);\n\n if (task.type == gantt.config.types.placeholder) {\n return true;\n }\n }\n\n return false;\n }\n\n function isPlaceholderLink(link) {\n if (isPlaceholderTask(link.source) || isPlaceholderTask(link.target)) {\n return true;\n }\n\n return false;\n }\n\n gantt.attachEvent(\"onLinkValidation\", function (link) {\n if (isPlaceholderLink(link)) {\n return false;\n }\n\n return true;\n });\n gantt.attachEvent(\"onBeforeLinkAdd\", function (id, link) {\n if (isPlaceholderLink(link)) {\n return false;\n }\n\n return true;\n });\n gantt.attachEvent(\"onBeforeUndoStack\", function (action) {\n for (var i = 0; i < action.commands.length; i++) {\n var command = action.commands[i];\n\n if (command.entity === \"task\" && command.value.type === gantt.config.types.placeholder) {\n action.commands.splice(i, 1);\n i--;\n }\n }\n\n return true;\n });\n};","module.exports = function (gantt) {\n var resourceAssignmentsProperty = \"$resourceAssignments\";\n gantt.config.resource_assignment_store = \"resourceAssignments\";\n gantt.config.process_resource_assignments = true;\n var resourceAssignmentFormats = {\n auto: \"auto\",\n singleValue: \"singleValue\",\n valueArray: \"valueArray\",\n resourceValueArray: \"resourceValueArray\",\n assignmentsArray: \"assignmentsArray\"\n };\n var resourceAssignmentFormat = resourceAssignmentFormats.auto; //\"primitiveSingle\";//\"primitive\";//\"object\"|\"assignment\"\n\n var assignmentModes = {\n fixedDates: \"fixedDates\",\n fixedDuration: \"fixedDuration\",\n \"default\": \"default\"\n };\n\n function initAssignmentFields(item, task) {\n if (item.start_date) {\n item.start_date = gantt.date.parseDate(item.start_date, \"parse_date\");\n } else {\n item.start_date = null;\n }\n\n if (item.end_date) {\n item.end_date = gantt.date.parseDate(item.end_date, \"parse_date\");\n } else {\n item.end_date = null;\n }\n\n var delay = Number(item.delay);\n var initDelay = false;\n\n if (!isNaN(delay)) {\n item.delay = delay;\n } else {\n item.delay = 0;\n initDelay = true;\n }\n\n if (!gantt.defined(item.value)) {\n item.value = null;\n }\n\n if (!item.task_id || !item.resource_id) {\n return false;\n }\n\n item.mode = item.mode || assignmentModes[\"default\"];\n\n if (item.mode === assignmentModes.fixedDuration) {\n if (isNaN(Number(item.duration))) {\n task = task || gantt.getTask(item.task_id);\n item.duration = gantt.calculateDuration({\n start_date: item.start_date,\n end_date: item.end_date,\n id: task\n });\n }\n\n if (initDelay) {\n task = task || gantt.getTask(item.task_id);\n item.delay = gantt.calculateDuration({\n start_date: task.start_date,\n end_date: item.start_date,\n id: task\n });\n }\n }\n\n if (item.mode !== assignmentModes.fixedDates && (task || gantt.isTaskExists(item.task_id))) {\n task = task || gantt.getTask(item.task_id);\n\n var timing = _assignmentTimeFromTask(item, task);\n\n item.start_date = timing.start_date;\n item.end_date = timing.end_date;\n item.duration = timing.duration;\n }\n } // gantt init\n\n\n var resourceAssignmentsStore = gantt.createDatastore({\n name: gantt.config.resource_assignment_store,\n initItem: function initItem(item) {\n if (!item.id) {\n item.id = gantt.uid();\n }\n\n initAssignmentFields(item);\n return item;\n }\n });\n gantt.$data.assignmentsStore = resourceAssignmentsStore;\n\n function _assignmentTimeFromTask(assignment, task) {\n if (assignment.mode === assignmentModes.fixedDates) {\n return {\n start_date: assignment.start_date,\n end_date: assignment.end_date,\n duration: assignment.duration\n };\n } else {\n var start = assignment.delay ? gantt.calculateEndDate({\n start_date: task.start_date,\n duration: assignment.delay,\n task: task\n }) : new Date(task.start_date);\n var end;\n var duration;\n\n if (assignment.mode === assignmentModes.fixedDuration) {\n end = gantt.calculateEndDate({\n start_date: start,\n duration: assignment.duration,\n task: task\n });\n duration = assignment.duration;\n } else {\n end = new Date(task.end_date);\n duration = task.duration - assignment.delay;\n }\n }\n\n return {\n start_date: start,\n end_date: end,\n duration: duration\n };\n } // data loading\n\n\n function _makeAssignmentsFromTask(task) {\n var property = gantt.config.resource_property;\n var assignments = task[property];\n var resourceAssignments = [];\n var detectFormat = resourceAssignmentFormat === resourceAssignmentFormats.auto;\n\n if (gantt.defined(assignments) && assignments) {\n if (!Array.isArray(assignments)) {\n assignments = [assignments];\n\n if (detectFormat) {\n resourceAssignmentFormat = resourceAssignmentFormats.singleValue;\n detectFormat = false;\n }\n }\n\n var usedIds = {};\n assignments.forEach(function (res) {\n if (!res.resource_id) {\n // when resource is a string/number\n res = {\n resource_id: res\n };\n\n if (detectFormat) {\n resourceAssignmentFormat = resourceAssignmentFormats.valueArray;\n detectFormat = false;\n } //\tisSimpleArray = true;\n\n }\n\n if (detectFormat) {\n if (res.id && res.resource_id) {\n resourceAssignmentFormat = resourceAssignmentFormats.assignmentsArray;\n detectFormat = false;\n } else {\n resourceAssignmentFormat = resourceAssignmentFormats.resourceValueArray;\n detectFormat = false;\n }\n }\n\n var defaultMode = assignmentModes[\"default\"];\n\n if (!res.mode) {\n if (res.start_date && res.end_date || res.start_date && res.duration) {\n defaultMode = assignmentModes.fixedDuration;\n }\n }\n\n var id;\n\n if (!res.id && res.$id && !usedIds[res.$id]) {\n id = res.$id;\n } else if (res.id && !usedIds[res.id]) {\n id = res.id;\n } else {\n id = gantt.uid();\n }\n\n usedIds[id] = true;\n var assignment = {\n id: id,\n start_date: res.start_date,\n duration: res.duration,\n end_date: res.end_date,\n delay: res.delay,\n task_id: task.id,\n resource_id: res.resource_id,\n value: res.value,\n mode: res.mode || defaultMode\n };\n\n if (!(assignment.start_date && assignment.start_date.getMonth && assignment.end_date && assignment.end_date.getMonth && typeof assignment.duration === \"number\")) {\n initAssignmentFields(assignment, task);\n }\n\n resourceAssignments.push(assignment);\n });\n }\n\n return resourceAssignments;\n }\n\n function _updateTaskBack(taskId) {\n // GS-1493. In some cases, the resource assignment store has the tasks that no longer exist\n if (!gantt.isTaskExists(taskId)) {\n return;\n }\n\n var task = gantt.getTask(taskId);\n var assignments = gantt.getTaskAssignments(task.id);\n\n _assignAssignments(task, assignments);\n }\n\n function _assignAssignments(task, assignments) {\n assignments.sort(function (a, b) {\n if (a.start_date && b.start_date && a.start_date.valueOf() != b.start_date.valueOf()) {\n return a.start_date - b.start_date;\n } else {\n return 0;\n }\n });\n\n if (resourceAssignmentFormat == resourceAssignmentFormats.assignmentsArray) {\n task[gantt.config.resource_property] = assignments;\n } else if (resourceAssignmentFormat == resourceAssignmentFormats.resourceValueArray) {\n task[gantt.config.resource_property] = assignments.map(function (a) {\n return {\n $id: a.id,\n start_date: a.start_date,\n duration: a.duration,\n end_date: a.end_date,\n delay: a.delay,\n resource_id: a.resource_id,\n value: a.value,\n mode: a.mode\n };\n });\n }\n\n task[resourceAssignmentsProperty] = assignments;\n }\n\n function _loadAssignmentsFromTask(task) {\n var assignments = _makeAssignmentsFromTask(task);\n\n var taskAssignments = [];\n assignments.forEach(function (a) {\n a.id = a.id || gantt.uid(); //var newId = resourceAssignmentsStore.addItem(a);\n\n taskAssignments.push(a);\n });\n return assignments;\n }\n\n function diffAssignments(taskValues, assignmentsStoreValues) {\n var result = {\n inBoth: [],\n inTaskNotInStore: [],\n inStoreNotInTask: []\n };\n\n if (resourceAssignmentFormat == resourceAssignmentFormats.singleValue) {\n var taskOwner = taskValues[0];\n var ownerId = taskOwner ? taskOwner.resource_id : null;\n var foundOwnerAssignment = false;\n assignmentsStoreValues.forEach(function (a) {\n if (a.resource_id != ownerId) {\n result.inStoreNotInTask.push(a);\n } else if (a.resource_id == ownerId) {\n result.inBoth.push({\n store: a,\n task: taskOwner\n });\n foundOwnerAssignment = true;\n }\n });\n\n if (!foundOwnerAssignment && taskOwner) {\n result.inTaskNotInStore.push(taskOwner);\n }\n } else if (resourceAssignmentFormat == resourceAssignmentFormats.valueArray) {\n var taskSearch = {};\n var storeSearch = {};\n var processedIds = {};\n taskValues.forEach(function (a) {\n taskSearch[a.resource_id] = a;\n });\n assignmentsStoreValues.forEach(function (a) {\n storeSearch[a.resource_id] = a;\n });\n taskValues.concat(assignmentsStoreValues).forEach(function (a) {\n if (processedIds[a.resource_id]) {\n return;\n }\n\n processedIds[a.resource_id] = true;\n var inTask = taskSearch[a.resource_id];\n var inStore = storeSearch[a.resource_id];\n\n if (inTask && inStore) {\n result.inBoth.push({\n store: inStore,\n task: inTask\n });\n } else if (inTask && !inStore) {\n result.inTaskNotInStore.push(inTask);\n } else if (!inTask && inStore) {\n result.inStoreNotInTask.push(inStore);\n }\n });\n } else if (resourceAssignmentFormat == resourceAssignmentFormats.assignmentsArray || resourceAssignmentFormat == resourceAssignmentFormats.resourceValueArray) {\n var taskSearch = {};\n var storeSearch = {};\n var processedIds = {};\n taskValues.forEach(function (a) {\n taskSearch[a.id || a.$id] = a;\n });\n assignmentsStoreValues.forEach(function (a) {\n storeSearch[a.id] = a;\n });\n taskValues.concat(assignmentsStoreValues).forEach(function (a) {\n var id = a.id || a.$id;\n\n if (processedIds[id]) {\n return;\n }\n\n processedIds[id] = true;\n var inTask = taskSearch[id];\n var inStore = storeSearch[id];\n\n if (inTask && inStore) {\n result.inBoth.push({\n store: inStore,\n task: inTask\n });\n } else if (inTask && !inStore) {\n result.inTaskNotInStore.push(inTask);\n } else if (!inTask && inStore) {\n result.inStoreNotInTask.push(inStore);\n }\n });\n }\n\n return result;\n }\n\n function assignmentHasChanged(source, target) {\n var ignoreFields = {\n id: true\n };\n\n for (var i in source) {\n if (!ignoreFields[i]) {\n if (String(source[i]) !== String(target[i])) {\n return true;\n }\n }\n }\n\n return false;\n }\n\n function updateAssignment(source, target) {\n var ignoreFields = {\n id: true\n };\n\n for (var i in source) {\n if (!ignoreFields[i]) {\n target[i] = source[i];\n }\n }\n }\n\n function _syncAssignments(task, storeAssignments) {\n var tasksAssignments = _makeAssignmentsFromTask(task);\n\n var diff = diffAssignments(tasksAssignments, storeAssignments);\n diff.inStoreNotInTask.forEach(function (a) {\n resourceAssignmentsStore.removeItem(a.id);\n });\n diff.inTaskNotInStore.forEach(function (a) {\n resourceAssignmentsStore.addItem(a);\n });\n diff.inBoth.forEach(function (a) {\n if (assignmentHasChanged(a.task, a.store)) {\n updateAssignment(a.task, a.store);\n resourceAssignmentsStore.updateItem(a.store.id);\n } else {\n if (a.task.start_date && a.task.end_date && a.task.mode !== assignmentModes.fixedDates) {\n var timing = _assignmentTimeFromTask(a.store, task);\n\n if (a.store.start_date.valueOf() != timing.start_date.valueOf() || a.store.end_date.valueOf() != timing.end_date.valueOf()) {\n a.store.start_date = timing.start_date;\n a.store.end_date = timing.end_date;\n a.store.duration = timing.duration;\n resourceAssignmentsStore.updateItem(a.store.id);\n }\n }\n }\n });\n\n _updateTaskBack(task.id);\n }\n\n function _syncOnTaskUpdate(task) {\n var storeAssignments = task[resourceAssignmentsProperty] || resourceAssignmentsStore.find(function (a) {\n return a.task_id == task.id;\n });\n\n _syncAssignments(task, storeAssignments);\n }\n\n function _syncOnTaskDelete(ids) {\n var idsSearch = {};\n ids.forEach(function (id) {\n idsSearch[id] = true;\n });\n var taskResources = resourceAssignmentsStore.find(function (a) {\n return idsSearch[a.task_id];\n });\n taskResources.forEach(function (a) {\n resourceAssignmentsStore.removeItem(a.id);\n });\n }\n\n gantt.attachEvent(\"onGanttReady\", function () {\n if (gantt.config.process_resource_assignments) {\n gantt.attachEvent(\"onParse\", function () {\n gantt.silent(function () {\n resourceAssignmentsStore.clearAll();\n var totalAssignments = [];\n gantt.eachTask(function (task) {\n if (task.type === gantt.config.types.project) {\n return;\n }\n\n var assignments = _loadAssignmentsFromTask(task);\n\n _assignAssignments(task, assignments);\n\n assignments.forEach(function (a) {\n totalAssignments.push(a);\n });\n });\n resourceAssignmentsStore.parse(totalAssignments);\n });\n });\n var batchUpdate = false;\n var needUpdate = false;\n var needUpdateFor = {};\n gantt.attachEvent(\"onBeforeBatchUpdate\", function () {\n batchUpdate = true;\n });\n gantt.attachEvent(\"onAfterBatchUpdate\", function () {\n if (needUpdate) {\n var assignmentsHash = {};\n\n for (var i in needUpdateFor) {\n assignmentsHash[i] = gantt.getTaskAssignments(needUpdateFor[i].id);\n }\n\n for (var i in needUpdateFor) {\n _syncAssignments(needUpdateFor[i], assignmentsHash[i]);\n }\n }\n\n needUpdate = false;\n batchUpdate = false;\n needUpdateFor = {};\n });\n gantt.attachEvent(\"onTaskCreated\", function (item) {\n var assignments = _loadAssignmentsFromTask(item);\n\n resourceAssignmentsStore.parse(assignments);\n\n _assignAssignments(item, assignments);\n\n return true;\n });\n gantt.attachEvent(\"onAfterTaskUpdate\", function (id, item) {\n if (batchUpdate) {\n needUpdate = true;\n needUpdateFor[id] = item;\n } else {\n _syncOnTaskUpdate(item);\n }\n });\n gantt.attachEvent(\"onAfterTaskAdd\", function (id, item) {\n if (batchUpdate) {\n needUpdate = true;\n needUpdateFor[id] = item;\n } else {\n _syncOnTaskUpdate(item);\n }\n });\n /*\tgantt.attachEvent(\"onRowDragMove\", function (id) {\r\n \t\t_syncOnTaskUpdate(gantt.getTask(id));\r\n \t});*/\n\n gantt.attachEvent(\"onRowDragEnd\", function (id) {\n _syncOnTaskUpdate(gantt.getTask(id));\n });\n gantt.$data.tasksStore.attachEvent(\"onAfterDeleteConfirmed\", function (id, item) {\n var deleteIds = [id];\n gantt.eachTask(function (task) {\n deleteIds.push(task.id);\n }, id);\n\n _syncOnTaskDelete(deleteIds);\n });\n gantt.$data.tasksStore.attachEvent(\"onClearAll\", function () {\n resourceAssignmentsCache = null;\n resourceTaskAssignmentsCache = null;\n taskAssignmentsCache = null;\n resourceAssignmentsStore.clearAll();\n return true;\n });\n gantt.attachEvent(\"onTaskIdChange\", function (id, new_id) {\n var taskResources = resourceAssignmentsStore.find(function (a) {\n return a.task_id == id;\n });\n taskResources.forEach(function (a) {\n a.task_id = new_id;\n resourceAssignmentsStore.updateItem(a.id);\n });\n\n _updateTaskBack(new_id); //any custom logic here\n\n });\n var resourceAssignmentsCache = null;\n var resourceTaskAssignmentsCache = null;\n var taskAssignmentsCache = null;\n resourceAssignmentsStore.attachEvent(\"onStoreUpdated\", function resetCache() {\n if (batchUpdate) {\n return true;\n }\n\n resourceAssignmentsCache = null;\n resourceTaskAssignmentsCache = null;\n taskAssignmentsCache = null;\n return true;\n });\n\n gantt.getResourceAssignments = function (resourceId, taskId) {\n var searchTaskId = gantt.defined(taskId) && taskId !== null;\n\n if (resourceAssignmentsCache === null) {\n resourceAssignmentsCache = {};\n resourceTaskAssignmentsCache = {};\n resourceAssignmentsStore.eachItem(function (a) {\n if (!resourceAssignmentsCache[a.resource_id]) {\n resourceAssignmentsCache[a.resource_id] = [];\n }\n\n resourceAssignmentsCache[a.resource_id].push(a);\n var resourceTaskCacheKey = a.resource_id + \"-\" + a.task_id;\n\n if (!resourceTaskAssignmentsCache[resourceTaskCacheKey]) {\n resourceTaskAssignmentsCache[resourceTaskCacheKey] = [];\n }\n\n resourceTaskAssignmentsCache[resourceTaskCacheKey].push(a);\n });\n }\n\n if (searchTaskId) {\n return (resourceTaskAssignmentsCache[resourceId + \"-\" + taskId] || []).slice();\n } else {\n return (resourceAssignmentsCache[resourceId] || []).slice();\n }\n };\n\n gantt.getTaskAssignments = function (taskId) {\n if (taskAssignmentsCache === null) {\n var result = [];\n taskAssignmentsCache = {};\n resourceAssignmentsStore.eachItem(function (a) {\n if (!taskAssignmentsCache[a.task_id]) {\n taskAssignmentsCache[a.task_id] = [];\n }\n\n taskAssignmentsCache[a.task_id].push(a);\n\n if (a.task_id == taskId) {\n result.push(a);\n }\n });\n }\n\n return (taskAssignmentsCache[taskId] || []).slice();\n };\n\n gantt.getTaskResources = function (taskId) {\n var store = gantt.getDatastore(\"resource\");\n var assignments = gantt.getTaskAssignments(taskId);\n var uniqueResources = {};\n assignments.forEach(function (a) {\n if (!uniqueResources[a.resource_id]) {\n uniqueResources[a.resource_id] = a.resource_id;\n }\n });\n var resources = [];\n\n for (var i in uniqueResources) {\n var res = store.getItem(uniqueResources[i]);\n\n if (res) {\n resources.push(res);\n }\n }\n\n return resources;\n };\n\n gantt.updateTaskAssignments = _updateTaskBack;\n }\n }, {\n once: true\n });\n};","var helpers = require(\"../../utils/helpers\");\n\nfunction createResourceMethods(gantt) {\n var resourceTaskCache = {};\n var singleResourceCacheBuilt = false;\n gantt.$data.tasksStore.attachEvent(\"onStoreUpdated\", function () {\n resourceTaskCache = {};\n singleResourceCacheBuilt = false;\n });\n gantt.attachEvent(\"onBeforeGanttRender\", function () {\n resourceTaskCache = {};\n });\n\n function getTaskBy(propertyName, propertyValue, typeFilter) {\n if (typeof propertyName == \"function\") {\n return filterResourceTasks(propertyName);\n } else {\n if (helpers.isArray(propertyValue)) {\n return getResourceTasks(propertyName, propertyValue, typeFilter);\n } else {\n return getResourceTasks(propertyName, [propertyValue], typeFilter);\n }\n }\n }\n\n function filterResourceTasks(filter) {\n var res = [];\n gantt.eachTask(function (task) {\n if (filter(task)) {\n res.push(task);\n }\n });\n return res;\n }\n\n var falsyValuePrefix = String(Math.random());\n\n function resourceHashFunction(value) {\n if (value === null) {\n return falsyValuePrefix + String(value);\n }\n\n return String(value);\n }\n\n function getCacheKey(resourceIds, property, typeFilter) {\n if (Array.isArray(resourceIds)) {\n return resourceIds.map(function (value) {\n return resourceHashFunction(value);\n }).join(\"_\") + \"_\".concat(property, \"_\").concat(typeFilter);\n } else {\n return resourceHashFunction(resourceIds) + \"_\".concat(property, \"_\").concat(typeFilter);\n }\n }\n\n function getResourceTasks(property, resourceIds, typeFilter) {\n var res;\n var cacheKey = getCacheKey(resourceIds, property, JSON.stringify(typeFilter));\n var matchingResources = {};\n helpers.forEach(resourceIds, function (resourceId) {\n matchingResources[resourceHashFunction(resourceId)] = true;\n });\n\n if (!resourceTaskCache[cacheKey]) {\n res = resourceTaskCache[cacheKey] = [];\n gantt.eachTask(function (task) {\n if (typeFilter) {\n if (!typeFilter[gantt.getTaskType(task)]) {\n return;\n }\n } else if (task.type == gantt.config.types.project) {\n return;\n }\n\n if (property in task) {\n var resourceValue;\n\n if (!helpers.isArray(task[property])) {\n resourceValue = [task[property]];\n } else {\n resourceValue = task[property];\n }\n\n helpers.forEach(resourceValue, function (value) {\n var resourceValue = value && value.resource_id ? value.resource_id : value;\n\n if (matchingResources[resourceHashFunction(resourceValue)]) {\n res.push(task);\n } else if (!singleResourceCacheBuilt) {\n var key = getCacheKey(value, property);\n\n if (!resourceTaskCache[key]) {\n resourceTaskCache[key] = [];\n }\n\n resourceTaskCache[key].push(task);\n }\n });\n }\n });\n singleResourceCacheBuilt = true;\n } else {\n res = resourceTaskCache[cacheKey];\n }\n\n return res;\n }\n\n function selectAssignments(resourceId, taskId, result) {\n var property = gantt.config.resource_property;\n var owners = [];\n\n if (gantt.getDatastore(\"task\").exists(taskId)) {\n var task = gantt.getTask(taskId);\n owners = task[property] || [];\n }\n\n if (!Array.isArray(owners)) {\n owners = [owners];\n }\n\n for (var i = 0; i < owners.length; i++) {\n if (owners[i].resource_id == resourceId) {\n result.push({\n task_id: task.id,\n resource_id: owners[i].resource_id,\n value: owners[i].value\n });\n }\n }\n }\n\n function getResourceAssignments(resourceId, taskId) {\n // resource assignment as an independent module:\n // {taskId:, resourceId, value}\n // TODO: probably should add a separate datastore for these\n var assignments = [];\n var property = gantt.config.resource_property;\n\n if (taskId !== undefined) {\n selectAssignments(resourceId, taskId, assignments);\n } else {\n var tasks = gantt.getTaskBy(property, resourceId);\n tasks.forEach(function (task) {\n selectAssignments(resourceId, task.id, assignments);\n });\n }\n\n return assignments;\n }\n\n return {\n getTaskBy: getTaskBy,\n getResourceAssignments: getResourceAssignments\n };\n}\n\nfunction createHelper(gantt) {\n var resourcePlugin = {\n renderEditableLabel: function renderEditableLabel(start_date, end_date, resource, tasks, assignments) {\n var editable = gantt.config.readonly ? \"\" : \"contenteditable\";\n\n if (start_date < resource.end_date && end_date > resource.start_date) {\n for (var i = 0; i < assignments.length; i++) {\n var a = assignments[i];\n return \"
\" + a.value + \"
\";\n }\n\n return \"
-
\";\n }\n\n return \"\";\n },\n renderSummaryLabel: function renderSummaryLabel(start_date, end_date, resource, tasks, assignments) {\n var sum = assignments.reduce(function (total, assignment) {\n return total + Number(assignment.value);\n }, 0);\n\n if (sum % 1) {\n sum = Math.round(sum * 10) / 10;\n }\n\n if (sum) {\n return \"
\" + sum + \"
\";\n }\n\n return \"\";\n },\n editableResourceCellTemplate: function editableResourceCellTemplate(start_date, end_date, resource, tasks, assignments) {\n if (resource.$role === \"task\") {\n return resourcePlugin.renderEditableLabel(start_date, end_date, resource, tasks, assignments);\n } else {\n return resourcePlugin.renderSummaryLabel(start_date, end_date, resource, tasks, assignments);\n }\n },\n editableResourceCellClass: function editableResourceCellClass(start_date, end_date, resource, tasks, assignments) {\n var css = [];\n css.push(\"resource_marker\");\n\n if (resource.$role === \"task\") {\n css.push(\"task_cell\");\n } else {\n css.push(\"resource_cell\");\n }\n\n var sum = assignments.reduce(function (total, assignment) {\n return total + Number(assignment.value);\n }, 0);\n var capacity = Number(resource.capacity);\n\n if (isNaN(capacity)) {\n capacity = 8;\n }\n\n if (sum <= capacity) {\n css.push(\"workday_ok\");\n } else {\n css.push(\"workday_over\");\n }\n\n return css.join(\" \");\n },\n getSummaryResourceAssignments: function getResourceAssignments(resourceId) {\n var assignments;\n var store = gantt.getDatastore(gantt.config.resource_store);\n var resource = store.getItem(resourceId);\n\n if (resource.$role === \"task\") {\n assignments = gantt.getResourceAssignments(resource.$resource_id, resource.$task_id);\n } else {\n assignments = gantt.getResourceAssignments(resourceId);\n\n if (store.eachItem) {\n store.eachItem(function (childResource) {\n if (childResource.$role !== \"task\") {\n assignments = assignments.concat(gantt.getResourceAssignments(childResource.id));\n }\n }, resourceId);\n }\n }\n\n return assignments;\n },\n initEditableDiagram: function initEditableDiagram() {\n gantt.config.resource_render_empty_cells = true;\n\n (function () {\n /// salesforce locker workaround\n // SF removes 'contenteditable' attribute from cells\n // restore it on render\n var timeoutId = null;\n\n function makeEditable() {\n if (timeoutId) {\n cancelAnimationFrame(timeoutId);\n }\n\n timeoutId = requestAnimationFrame(function () {\n var cells = Array.prototype.slice.call(gantt.$container.querySelectorAll(\".resourceTimeline_cell [data-assignment-cell]\"));\n cells.forEach(function (cell) {\n cell.contentEditable = true;\n });\n });\n return true;\n }\n\n gantt.attachEvent(\"onGanttReady\", function () {\n gantt.getDatastore(gantt.config.resource_assignment_store).attachEvent(\"onStoreUpdated\", makeEditable);\n gantt.getDatastore(gantt.config.resource_store).attachEvent(\"onStoreUpdated\", makeEditable);\n }, {\n once: true\n });\n gantt.attachEvent(\"onGanttLayoutReady\", function () {\n var ganttViews = gantt.$layout.getCellsByType(\"viewCell\");\n ganttViews.forEach(function (view) {\n if (view.$config && view.$config.view === \"resourceTimeline\" && view.$content) {\n view.$content.attachEvent(\"onScroll\", makeEditable);\n }\n });\n });\n })();\n\n gantt.attachEvent(\"onGanttReady\", function () {\n var assignmentEditInProcess = false;\n gantt.event(gantt.$container, \"keypress\", function (e) {\n var target = e.target.closest(\".resourceTimeline_cell [data-assignment-cell]\");\n\n if (target) {\n if (e.keyCode === 13 || e.keyCode === 27) {\n target.blur();\n }\n }\n });\n gantt.event(gantt.$container, \"focusout\", function (e) {\n if (assignmentEditInProcess) {\n return;\n }\n\n assignmentEditInProcess = true;\n setTimeout(function () {\n assignmentEditInProcess = false;\n }, 300);\n var target = e.target.closest(\".resourceTimeline_cell [data-assignment-cell]\");\n\n if (target) {\n var strValue = (target.innerText || \"\").trim();\n\n if (strValue == \"-\") {\n strValue = \"0\";\n }\n\n var value = Number(strValue);\n var rowId = target.getAttribute(\"data-row-id\");\n var assignmentId = target.getAttribute(\"data-assignment-id\");\n var taskId = target.getAttribute(\"data-task\");\n var resourceId = target.getAttribute(\"data-resource-id\");\n var startDate = gantt.templates.parse_date(target.getAttribute(\"data-start-date\"));\n var endDate = gantt.templates.parse_date(target.getAttribute(\"data-end-date\"));\n var assignmentStore = gantt.getDatastore(gantt.config.resource_assignment_store);\n\n if (isNaN(value)) {\n gantt.getDatastore(gantt.config.resource_store).refresh(rowId);\n } else {\n var task = gantt.getTask(taskId);\n\n if (assignmentId) {\n var assignment = assignmentStore.getItem(assignmentId);\n\n if (value === assignment.value) {\n return;\n }\n\n if (assignment.start_date.valueOf() === startDate.valueOf() && assignment.end_date.valueOf() === endDate.valueOf()) {\n assignment.value = value;\n\n if (!value) {\n assignmentStore.removeItem(assignment.id);\n } else {\n assignmentStore.updateItem(assignment.id);\n }\n } else {\n if (assignment.end_date.valueOf() > endDate.valueOf()) {\n var nextChunk = gantt.copy(assignment);\n nextChunk.id = gantt.uid();\n nextChunk.start_date = endDate;\n nextChunk.duration = gantt.calculateDuration({\n start_date: nextChunk.start_date,\n end_date: nextChunk.end_date,\n task: task\n });\n nextChunk.delay = gantt.calculateDuration({\n start_date: task.start_date,\n end_date: nextChunk.start_date,\n task: task\n });\n nextChunk.mode = assignment.mode || \"default\";\n\n if (nextChunk.duration !== 0) {\n assignmentStore.addItem(nextChunk);\n }\n }\n\n if (assignment.start_date.valueOf() < startDate.valueOf()) {\n assignment.end_date = startDate;\n assignment.duration = gantt.calculateDuration({\n start_date: assignment.start_date,\n end_date: assignment.end_date,\n task: task\n });\n assignment.mode = \"fixedDuration\";\n\n if (assignment.duration === 0) {\n assignmentStore.removeItem(assignment.id);\n } else {\n assignmentStore.updateItem(assignment.id);\n }\n } else {\n assignmentStore.removeItem(assignment.id);\n }\n\n if (value) {\n assignmentStore.addItem({\n task_id: assignment.task_id,\n resource_id: assignment.resource_id,\n value: value,\n start_date: startDate,\n end_date: endDate,\n duration: gantt.calculateDuration({\n start_date: startDate,\n end_date: endDate,\n task: task\n }),\n delay: gantt.calculateDuration({\n start_date: task.start_date,\n end_date: startDate,\n task: task\n }),\n mode: \"fixedDuration\"\n });\n }\n }\n\n gantt.updateTaskAssignments(task.id);\n gantt.updateTask(task.id);\n } else if (value) {\n var assignment = {\n task_id: taskId,\n resource_id: resourceId,\n value: value,\n start_date: startDate,\n end_date: endDate,\n duration: gantt.calculateDuration({\n start_date: startDate,\n end_date: endDate,\n task: task\n }),\n delay: gantt.calculateDuration({\n start_date: task.start_date,\n end_date: startDate,\n task: task\n }),\n mode: \"fixedDuration\"\n };\n assignmentStore.addItem(assignment);\n gantt.updateTaskAssignments(task.id);\n gantt.updateTask(task.id);\n }\n }\n }\n });\n }, {\n once: true\n });\n }\n };\n return resourcePlugin;\n}\n\nmodule.exports = function (gantt) {\n var methods = createResourceMethods(gantt);\n gantt.ext.resources = createHelper(gantt);\n gantt.config.resources = {\n dataprocessor_assignments: false,\n dataprocessor_resources: false,\n editable_resource_diagram: false,\n resource_store: {\n type: \"treeDataStore\",\n fetchTasks: false,\n initItem: function initItem(item) {\n item.parent = item.parent || gantt.config.root_id;\n item[gantt.config.resource_property] = item.parent;\n item.open = true;\n return item;\n }\n },\n lightbox_resources: function selectResourceControlOptions(resources) {\n var lightboxOptions = [];\n var store = gantt.getDatastore(gantt.config.resource_store);\n resources.forEach(function (res) {\n if (!store.hasChild(res.id)) {\n var copy = gantt.copy(res);\n copy.key = res.id;\n copy.label = res.text;\n lightboxOptions.push(copy);\n }\n });\n return lightboxOptions;\n }\n };\n gantt.attachEvent(\"onBeforeGanttReady\", function () {\n if (gantt.getDatastore(gantt.config.resource_store)) {\n return;\n }\n\n var resourceStoreConfig = gantt.config.resources ? gantt.config.resources.resource_store : undefined;\n var fetchTasks = resourceStoreConfig ? resourceStoreConfig.fetchTasks : undefined;\n\n if (gantt.config.resources && gantt.config.resources.editable_resource_diagram) {\n fetchTasks = true;\n }\n\n var initItems = function initItems(item) {\n item.parent = item.parent || gantt.config.root_id;\n item[gantt.config.resource_property] = item.parent;\n item.open = true;\n return item;\n };\n\n if (resourceStoreConfig && resourceStoreConfig.initItem) {\n initItems = resourceStoreConfig.initItem;\n }\n\n var storeType = resourceStoreConfig && resourceStoreConfig.type ? resourceStoreConfig.type : \"treeDatastore\";\n gantt.$resourcesStore = gantt.createDatastore({\n name: gantt.config.resource_store,\n type: storeType,\n fetchTasks: fetchTasks !== undefined ? fetchTasks : false,\n initItem: initItems\n });\n gantt.$data.resourcesStore = gantt.$resourcesStore;\n gantt.$resourcesStore.attachEvent(\"onParse\", function () {\n function selectResourceControlOptions(resources) {\n var lightboxOptions = [];\n resources.forEach(function (res) {\n if (!gantt.$resourcesStore.hasChild(res.id)) {\n var copy = gantt.copy(res);\n copy.key = res.id;\n copy.label = res.text;\n lightboxOptions.push(copy);\n }\n });\n return lightboxOptions;\n }\n\n var lightboxOptionsFnc = selectResourceControlOptions;\n\n if (gantt.config.resources && gantt.config.resources.lightbox_resources) {\n lightboxOptionsFnc = gantt.config.resources.lightbox_resources;\n }\n\n var options = lightboxOptionsFnc(gantt.$resourcesStore.getItems());\n gantt.updateCollection(\"resourceOptions\", options);\n });\n });\n gantt.getTaskBy = methods.getTaskBy;\n gantt.getResourceAssignments = methods.getResourceAssignments;\n gantt.config.resource_property = \"owner_id\";\n gantt.config.resource_store = \"resource\";\n gantt.config.resource_render_empty_cells = false;\n /**\r\n * these are placeholder functions that should be redefined by the user\r\n */\n\n gantt.templates.histogram_cell_class = function (start_date, end_date, resource, tasks, assignments) {};\n\n gantt.templates.histogram_cell_label = function (start_date, end_date, resource, tasks, assignments) {\n return tasks.length + \"/3\";\n };\n\n gantt.templates.histogram_cell_allocated = function (start_date, end_date, resource, tasks, assignments) {\n return tasks.length / 3;\n };\n\n gantt.templates.histogram_cell_capacity = function (start_date, end_date, resource, tasks, assignments) {\n return 0;\n };\n\n var defaultResourceCellClass = function defaultResourceCellClass(start, end, resource, tasks, assignments) {\n var css = \"\";\n\n if (tasks.length <= 1) {\n css = \"gantt_resource_marker_ok\";\n } else {\n css = \"gantt_resource_marker_overtime\";\n }\n\n return css;\n };\n\n var defaultResourceCellTemplate = function defaultResourceCellTemplate(start, end, resource, tasks, assignments) {\n return tasks.length * 8;\n };\n\n gantt.templates.resource_cell_value = defaultResourceCellTemplate;\n gantt.templates.resource_cell_class = defaultResourceCellClass; //editable_resource_diagram\n\n gantt.attachEvent(\"onBeforeGanttReady\", function () {\n if (gantt.config.resources && gantt.config.resources.editable_resource_diagram) {\n gantt.config.resource_render_empty_cells = true;\n\n if (gantt.templates.resource_cell_value === defaultResourceCellTemplate) {\n gantt.templates.resource_cell_value = gantt.ext.resources.editableResourceCellTemplate;\n }\n\n if (gantt.templates.resource_cell_class === defaultResourceCellClass) {\n gantt.templates.resource_cell_class = gantt.ext.resources.editableResourceCellClass;\n }\n\n gantt.ext.resources.initEditableDiagram(gantt);\n }\n });\n};","var createWbs = function createWbs(gantt) {\n return {\n _needRecalc: true,\n reset: function reset() {\n this._needRecalc = true;\n },\n _isRecalcNeeded: function _isRecalcNeeded() {\n return !this._isGroupSort() && this._needRecalc;\n },\n _isGroupSort: function _isGroupSort() {\n return !!gantt.getState().group_mode;\n },\n _getWBSCode: function _getWBSCode(task) {\n if (!task) return \"\";\n\n if (this._isRecalcNeeded()) {\n this._calcWBS();\n }\n\n if (task.$virtual) return \"\";\n if (this._isGroupSort()) return task.$wbs || \"\";\n\n if (!task.$wbs) {\n this.reset();\n\n this._calcWBS();\n }\n\n return task.$wbs;\n },\n _setWBSCode: function _setWBSCode(task, value) {\n task.$wbs = value;\n },\n getWBSCode: function getWBSCode(task) {\n return this._getWBSCode(task);\n },\n getByWBSCode: function getByWBSCode(code) {\n var parts = code.split(\".\");\n var currentNode = gantt.config.root_id;\n\n for (var i = 0; i < parts.length; i++) {\n var children = gantt.getChildren(currentNode);\n var index = parts[i] * 1 - 1;\n\n if (gantt.isTaskExists(children[index])) {\n currentNode = children[index];\n } else {\n return null;\n }\n }\n\n if (gantt.isTaskExists(currentNode)) {\n return gantt.getTask(currentNode);\n } else {\n return null;\n }\n },\n _calcWBS: function _calcWBS() {\n if (!this._isRecalcNeeded()) return;\n var _isFirst = true;\n gantt.eachTask(function (ch) {\n if (_isFirst) {\n _isFirst = false;\n\n this._setWBSCode(ch, \"1\");\n\n return;\n }\n\n var _prevSibling = gantt.getPrevSibling(ch.id);\n\n if (_prevSibling !== null) {\n var _wbs = gantt.getTask(_prevSibling).$wbs;\n\n if (_wbs) {\n _wbs = _wbs.split(\".\");\n _wbs[_wbs.length - 1]++;\n\n this._setWBSCode(ch, _wbs.join(\".\"));\n }\n } else {\n var _parent = gantt.getParent(ch.id);\n\n this._setWBSCode(ch, gantt.getTask(_parent).$wbs + \".1\");\n }\n }, gantt.config.root_id, this);\n this._needRecalc = false;\n }\n };\n};\n\nmodule.exports = function (gantt) {\n var wbs = createWbs(gantt);\n\n gantt.getWBSCode = function getWBSCode(task) {\n return wbs.getWBSCode(task);\n };\n\n gantt.getTaskByWBSCode = function (code) {\n return wbs.getByWBSCode(code);\n };\n\n function resetCache() {\n wbs.reset();\n return true;\n }\n\n gantt.attachEvent(\"onAfterTaskMove\", resetCache);\n gantt.attachEvent(\"onBeforeParse\", resetCache);\n gantt.attachEvent(\"onAfterTaskDelete\", resetCache);\n gantt.attachEvent(\"onAfterTaskAdd\", resetCache);\n gantt.attachEvent(\"onAfterSort\", resetCache);\n};","var global = require(\"../../utils/global\");\n\nfunction createMethod(gantt) {\n var methods = {};\n var isActive = false;\n\n function disableMethod(methodName, dummyMethod) {\n dummyMethod = typeof dummyMethod == \"function\" ? dummyMethod : function () {};\n\n if (!methods[methodName]) {\n methods[methodName] = this[methodName];\n this[methodName] = dummyMethod;\n }\n }\n\n function restoreMethod(methodName) {\n if (methods[methodName]) {\n this[methodName] = methods[methodName];\n methods[methodName] = null;\n }\n }\n\n function disableMethods(methodsHash) {\n for (var i in methodsHash) {\n disableMethod.call(this, i, methodsHash[i]);\n }\n }\n\n function restoreMethods() {\n for (var i in methods) {\n restoreMethod.call(this, i);\n }\n }\n\n function batchUpdatePayload(callback) {\n try {\n callback();\n } catch (e) {\n global.console.error(e);\n }\n }\n\n var state = gantt.$services.getService(\"state\");\n state.registerProvider(\"batchUpdate\", function () {\n return {\n batch_update: isActive\n };\n }, false);\n return function batchUpdate(callback, noRedraw) {\n if (isActive) {\n // batch mode is already active\n batchUpdatePayload(callback);\n return;\n }\n\n var call_dp = this._dp && this._dp.updateMode != \"off\";\n var dp_mode;\n\n if (call_dp) {\n dp_mode = this._dp.updateMode;\n\n this._dp.setUpdateMode(\"off\");\n } // temporary disable some methods while updating multiple tasks\n\n\n var resetProjects = {};\n var methods = {\n \"render\": true,\n \"refreshData\": true,\n \"refreshTask\": true,\n \"refreshLink\": true,\n \"resetProjectDates\": function resetProjectDates(task) {\n resetProjects[task.id] = task;\n }\n };\n disableMethods.call(this, methods);\n isActive = true;\n this.callEvent(\"onBeforeBatchUpdate\", []);\n batchUpdatePayload(callback);\n this.callEvent(\"onAfterBatchUpdate\", []);\n restoreMethods.call(this); // do required updates after changes applied\n\n for (var i in resetProjects) {\n this.resetProjectDates(resetProjects[i]);\n }\n\n isActive = false;\n\n if (!noRedraw) {\n this.render();\n }\n\n if (call_dp) {\n this._dp.setUpdateMode(dp_mode);\n\n this._dp.setGanttMode(\"task\");\n\n this._dp.sendData();\n\n this._dp.setGanttMode(\"link\");\n\n this._dp.sendData();\n }\n };\n}\n\nmodule.exports = function (gantt) {\n gantt.batchUpdate = createMethod(gantt);\n};","module.exports = function (gantt) {\n if (!gantt.ext) {\n gantt.ext = {};\n }\n\n var modules = [require(\"./batch_update\"), require(\"./wbs\"), require(\"./resources\"), require(\"./resource_assignments\"), require(\"./new_task_placeholder\"), require(\"./auto_task_types\"), require(\"./formatters\"), require(\"./empty_state_screen\")[\"default\"]];\n\n for (var i = 0; i < modules.length; i++) {\n if (modules[i]) modules[i](gantt);\n }\n};","import * as utils from \"../../utils/utils\";\r\n\r\nexport default class SimpleStorage {\r\n\tpublic static create = () : SimpleStorage => {\r\n\t\treturn new SimpleStorage();\r\n\t}\r\n\r\n\tprotected _storage: { [id: string]: any; };\r\n\r\n\tprotected constructor() {\r\n\t\tthis._storage = {};\r\n\t}\r\n\r\n\tpublic clear = (): void => {\r\n\t\tthis._storage = {};\r\n\t}\r\n\r\n\tpublic storeItem = (item: any): void => {\r\n\t\tthis._storage[item.id] = utils.copy(item);\r\n\t}\r\n\r\n\tpublic getStoredItem = (id: string): any => {\r\n\t\treturn this._storage[id] || null;\r\n\t}\r\n}","\r\nexport default function extendGantt(gantt: any, dp: any) {\r\n\tgantt.getUserData = function(id, name, store) {\r\n\t\tif (!this.userdata) {\r\n\t\t\tthis.userdata = {};\r\n\t\t}\r\n\t\tthis.userdata[store] = this.userdata[store] || {};\r\n\t\tif (this.userdata[store][id] && this.userdata[store][id][name]) {\r\n\t\t\treturn this.userdata[store][id][name];\r\n\t\t}\r\n\t\treturn \"\";\r\n\t};\r\n\tgantt.setUserData = function(id, name, value, store) {\r\n\t\tif (!this.userdata) {\r\n\t\t\tthis.userdata = {};\r\n\t\t}\r\n\t\tthis.userdata[store] = this.userdata[store] || {};\r\n\t\tthis.userdata[store][id] = this.userdata[store][id] || {};\r\n\t\tthis.userdata[store][id][name] = value;\r\n\t};\r\n\r\n\tgantt._change_id = function(oldId, newId) {\r\n\t\tswitch (this._dp._ganttMode) {\r\n\t\t\tcase \"task\":\r\n\t\t\t\tthis.changeTaskId(oldId, newId);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"link\":\r\n\t\t\t\tthis.changeLinkId(oldId, newId);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"assignment\":\r\n\t\t\t\tthis.$data.assignmentsStore.changeId(oldId, newId);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"resource\":\r\n\t\t\t\tthis.$data.resourcesStore.changeId(oldId, newId);\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tthrow new Error(`Invalid mode of the dataProcessor after database id is received: ${this._dp._ganttMode}, new id: ${newId}`);\r\n\t\t}\r\n\t};\r\n\r\n\tgantt._row_style = function(rowId, classname){\r\n\t\tif (this._dp._ganttMode !== \"task\") {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (!gantt.isTaskExists(rowId)) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst task = gantt.getTask(rowId);\r\n\t\ttask.$dataprocessor_class = classname;\r\n\t\tgantt.refreshTask(rowId);\r\n\t};\r\n\r\n\t// fake method for dataprocessor\r\n\tgantt._delete_task = function(rowId, node) {}; // tslint:disable-line\r\n\r\n\tgantt._sendTaskOrder = function(id, item){\r\n\t\tif (item.$drop_target) {\r\n\t\t\tthis._dp.setGanttMode(\"task\");\r\n\t\t\tthis.getTask(id).target = item.$drop_target;\r\n\t\t\tthis._dp.setUpdated(id, true,\"order\");\r\n\t\t\tdelete this.getTask(id).$drop_target;\r\n\t\t}\r\n\t};\r\n\r\n\tgantt.setDp = function() {\r\n\t\tthis._dp = dp;\r\n\t};\r\n\r\n\tgantt.setDp();\r\n}","import * as helpers from \"../../utils/helpers\";\r\n\r\nexport default class DataProcessorEvents {\r\n\tprotected _dataProcessorHandlers: any[];\r\n\tprotected $gantt: any;\r\n\tprotected $dp: any;\r\n\r\n\tconstructor(gantt: any, dp: any) {\r\n\t\tthis.$gantt = gantt;\r\n\t\tthis.$dp = dp;\r\n\t\tthis._dataProcessorHandlers = [];\r\n\t}\r\n\r\n\tattach() {\r\n\t\tconst dp = this.$dp;\r\n\t\tconst gantt = this.$gantt;\r\n\t\tconst treeHelper = require(\"../../utils/task_tree_helpers\");\r\n\t\tconst cascadeDelete = {};\r\n\r\n\t\tconst clientSideDelete = (id) => {\r\n\t\t\treturn this.clientSideDelete(id, dp, gantt);\r\n\t\t};\r\n\r\n\t\tfunction getTaskLinks(task) {\r\n\t\t\tlet _links = [];\r\n\r\n\t\t\tif (task.$source) {\r\n\t\t\t\t_links = _links.concat(task.$source);\r\n\t\t\t}\r\n\t\t\tif (task.$target) {\r\n\t\t\t\t_links = _links.concat(task.$target);\r\n\t\t\t}\r\n\r\n\t\t\treturn _links;\r\n\t\t}\r\n\r\n\t\tthis._dataProcessorHandlers.push(gantt.attachEvent(\"onAfterTaskAdd\", function(id, item) { // tslint:disable-line\r\n\t\t\tif (gantt.isTaskExists(id)) {\r\n\t\t\t\tdp.setGanttMode(\"tasks\");\r\n\t\t\t\tdp.setUpdated(id, true, \"inserted\");\r\n\t\t\t}\r\n\t\t}));\r\n\r\n\t\tthis._dataProcessorHandlers.push(gantt.attachEvent(\"onAfterTaskUpdate\", function(id, item) { // tslint:disable-line\r\n\t\t\tif (gantt.isTaskExists(id)) {\r\n\t\t\t\tdp.setGanttMode(\"tasks\");\r\n\t\t\t\tdp.setUpdated(id, true);\r\n\r\n\t\t\t\t// gantt can be destroyed/reinitialized after dp.setUpdated\r\n\t\t\t\tif(gantt._sendTaskOrder){\r\n\t\t\t\t\tgantt._sendTaskOrder(id, item);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}));\r\n\r\n\t\tthis._dataProcessorHandlers.push(gantt.attachEvent(\"onBeforeTaskDelete\", function(id, item) { // tslint:disable-line\r\n\t\t\tif (gantt.config.cascade_delete) {\r\n\t\t\t\tcascadeDelete[id] = {\r\n\t\t\t\t\ttasks: treeHelper.getSubtreeTasks(gantt, id),\r\n\t\t\t\t\tlinks: treeHelper.getSubtreeLinks(gantt, id)\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\t// GS-631. Keep the deleted item in Gantt until we receive the successful response from the server\r\n\t\t\tif (dp.deleteAfterConfirmation) {\r\n\t\t\t\tdp.setGanttMode(\"tasks\");\r\n\t\t\t\tdp.setUpdated(id, true, \"deleted\");\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t}));\r\n\r\n\t\tthis._dataProcessorHandlers.push(gantt.attachEvent(\"onAfterTaskDelete\", function(id, item) { // tslint:disable-line\r\n\t\t\tdp.setGanttMode(\"tasks\");\r\n\r\n\t\t\t// not send delete request if item is not inserted into the db - just remove it from the client\r\n\t\t\tconst needDbDelete = !clientSideDelete(id);\r\n\t\t\tconst needCascadeDelete = gantt.config.cascade_delete && cascadeDelete[id];\r\n\t\t\tif (!needDbDelete && !needCascadeDelete) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tif (needCascadeDelete) {\r\n\t\t\t\tconst dpMode = dp.updateMode;\r\n\t\t\t\tdp.setUpdateMode(\"off\");\r\n\r\n\t\t\t\tconst cascade = cascadeDelete[id];\r\n\t\t\t\tfor (const i in cascade.tasks) {\r\n\t\t\t\t\tif (!clientSideDelete(i)) {\r\n\t\t\t\t\t\tdp.storeItem(cascade.tasks[i]);\r\n\t\t\t\t\t\tdp.setUpdated(i, true, \"deleted\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tdp.setGanttMode(\"links\");\r\n\t\t\t\tfor (const i in cascade.links) {\r\n\t\t\t\t\tif (!clientSideDelete(i)) {\r\n\t\t\t\t\t\tdp.storeItem(cascade.links[i]);\r\n\t\t\t\t\t\tdp.setUpdated(i, true, \"deleted\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tcascadeDelete[id] = null;\r\n\r\n\t\t\t\tif (dpMode !== \"off\") {\r\n\t\t\t\t\tdp.sendAllData();\r\n\t\t\t\t}\r\n\t\t\t\tdp.setGanttMode(\"tasks\");\r\n\t\t\t\tdp.setUpdateMode(dpMode);\r\n\t\t\t}\r\n\r\n\t\t\tif (needDbDelete){\r\n\t\t\t\tdp.storeItem(item);\r\n\t\t\t\tif (!dp.deleteAfterConfirmation){\r\n\t\t\t\t\tdp.setUpdated(id, true, \"deleted\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\r\n\t\t\tif (dp.updateMode !== \"off\" && !dp._tSend) {\r\n\t\t\t\tdp.sendAllData();\r\n\t\t\t}\r\n\t\t}));\r\n\r\n\t\tthis._dataProcessorHandlers.push(gantt.attachEvent(\"onAfterLinkUpdate\", function(id, item) { // tslint:disable-line\r\n\t\t\tif (gantt.isLinkExists(id)) {\r\n\t\t\t\tdp.setGanttMode(\"links\");\r\n\t\t\t\tdp.setUpdated(id, true);\r\n\t\t\t}\r\n\t\t}));\r\n\r\n\t\tthis._dataProcessorHandlers.push(gantt.attachEvent(\"onAfterLinkAdd\", function(id, item) { // tslint:disable-line\r\n\t\t\tif (gantt.isLinkExists(id)) {\r\n\t\t\t\tdp.setGanttMode(\"links\");\r\n\t\t\t\tdp.setUpdated(id, true,\"inserted\");\r\n\t\t\t}\r\n\t\t}));\r\n\r\n\t\tthis._dataProcessorHandlers.push(gantt.attachEvent(\"onAfterLinkDelete\", function(id, item) { // tslint:disable-line\r\n\t\t\tdp.setGanttMode(\"links\");\r\n\r\n\t\t\tconst needDbDelete = !clientSideDelete(id);\r\n\t\t\tif (!needDbDelete) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tdp.storeItem(item);\r\n\t\t\tdp.setUpdated(id, true,\"deleted\");\r\n\t\t}));\r\n\r\n\t\tthis._dataProcessorHandlers.push(gantt.attachEvent(\"onRowDragEnd\", function(id, target) { // tslint:disable-line\r\n\t\t\tgantt._sendTaskOrder(id, gantt.getTask(id));\r\n\t\t}));\r\n\r\n\t\tlet tasks = null;\r\n\t\tlet links = null;\r\n\r\n\t\tthis._dataProcessorHandlers.push(gantt.attachEvent(\"onTaskIdChange\", function(oldId, newId) { // tslint:disable-line\r\n\t\t\tif (!dp._waitMode) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tconst children = gantt.getChildren(newId);\r\n\t\t\tif (children.length) {\r\n\t\t\t\ttasks = tasks || {};\r\n\r\n\t\t\t\tfor (let i = 0; i < children.length; i++) {\r\n\t\t\t\t\tconst ch = this.getTask(children[i]);\r\n\t\t\t\t\ttasks[ch.id] = ch;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tconst item = this.getTask(newId);\r\n\t\t\tconst itemLinks = getTaskLinks(item);\r\n\r\n\t\t\tif (itemLinks.length) {\r\n\t\t\t\tlinks = links || {};\r\n\r\n\t\t\t\tfor (let i = 0; i < itemLinks.length; i++) {\r\n\t\t\t\t\tconst link = this.getLink(itemLinks[i]);\r\n\t\t\t\t\tlinks[link.id] = link;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}));\r\n\r\n\t\tdp.attachEvent(\"onAfterUpdateFinish\", function() {\r\n\t\t\tif (tasks || links) {\r\n\t\t\t\tgantt.batchUpdate(function() {\r\n\t\t\t\t\tfor (const id in tasks) {\r\n\t\t\t\t\t\tgantt.updateTask(tasks[id].id);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tfor (const id in links) {\r\n\t\t\t\t\t\tgantt.updateLink(links[id].id);\r\n\t\t\t\t\t}\r\n\t\t\t\t\ttasks = null;\r\n\t\t\t\t\tlinks = null;\r\n\t\t\t\t});\r\n\t\t\t\tif (tasks) {\r\n\t\t\t\t\tgantt._dp.setGanttMode(\"tasks\");\r\n\t\t\t\t} else {\r\n\t\t\t\t\tgantt._dp.setGanttMode(\"links\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tdp.attachEvent(\"onBeforeDataSending\", function() {\r\n\t\t\tif (this._tMode === \"CUSTOM\") {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\tlet url = this._serverProcessor;\r\n\t\t\tif (this._tMode === \"REST-JSON\" || this._tMode === \"REST\") {\r\n\t\t\t\tconst mode = this._ganttMode;\r\n\r\n\t\t\t\turl = url.substring(0, url.indexOf(\"?\") > -1 ? url.indexOf(\"?\") : url.length);\r\n\t\t\t\t// editing=true&\r\n\t\t\t\tthis.serverProcessor = url + (url.slice(-1) === \"/\" ? \"\" : \"/\") + mode;\r\n\t\t\t} else {\r\n\t\t\t\tconst pluralizedMode = this._ganttMode + \"s\";\r\n\t\t\t\tthis.serverProcessor = url + gantt.ajax.urlSeparator(url) + \"gantt_mode=\" + pluralizedMode;\r\n\t\t\t}\r\n\r\n\t\t\treturn true;\r\n\t\t});\r\n\r\n\t\tdp.attachEvent(\"insertCallback\", function insertCallback(upd, id, parent, mode) { // tslint:disable-line\r\n\t\t\tconst data = upd.data || gantt.xml._xmlNodeToJSON(upd.firstChild);\r\n\t\t\tconst methods = {\r\n\t\t\t\tadd: gantt.addTask,\r\n\t\t\t\tisExist: gantt.isTaskExists\r\n\t\t\t};\r\n\t\t\tif (mode === \"links\") {\r\n\t\t\t\tmethods.add = gantt.addLink;\r\n\t\t\t\tmethods.isExist = gantt.isLinkExists;\r\n\t\t\t}\r\n\t\t\tif (methods.isExist.call(gantt, id)) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tdata.id = id;\r\n\t\t\tmethods.add.call(gantt, data);\r\n\t\t});\r\n\r\n\t\tdp.attachEvent(\"updateCallback\", function updateCallback(upd, id) {\r\n\t\t\tconst data = upd.data || gantt.xml._xmlNodeToJSON(upd.firstChild);\r\n\t\t\tif (!gantt.isTaskExists(id)) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tconst objData = gantt.getTask(id);\r\n\t\t\tfor (const key in data) {\r\n\t\t\t\tlet property = data[key];\r\n\t\t\t\tswitch (key) {\r\n\t\t\t\t\tcase \"id\":\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\tcase \"start_date\":\r\n\t\t\t\t\tcase \"end_date\":\r\n\t\t\t\t\t\tproperty = gantt.defined(gantt.templates.xml_date) ? gantt.templates.xml_date(property) : gantt.templates.parse_date(property);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \"duration\":\r\n\t\t\t\t\t\tobjData.end_date = gantt.calculateEndDate({start_date: objData.start_date, duration: property, task:objData});\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tobjData[key] = property;\r\n\t\t\t}\r\n\t\t\tgantt.updateTask(id);\r\n\t\t\tgantt.refreshData();\r\n\t\t});\r\n\t\tdp.attachEvent(\"deleteCallback\", function deleteCallback(upd, id, parent, mode) { // tslint:disable-line\r\n\t\t\tconst methods = {\r\n\t\t\t\tdelete: gantt.deleteTask,\r\n\t\t\t\tisExist: gantt.isTaskExists\r\n\t\t\t};\r\n\t\t\tif (mode === \"links\") {\r\n\t\t\t\tmethods.delete = gantt.deleteLink;\r\n\t\t\t\tmethods.isExist = gantt.isLinkExists;\r\n\t\t\t} else if(mode === \"assignment\") {\r\n\t\t\t\tmethods.delete = function(val) {\r\n\t\t\t\t\tgantt.$data.assignmentsStore.remove(val);\r\n\t\t\t\t};\r\n\t\t\t\tmethods.isExist = function(val){\r\n\t\t\t\t\treturn gantt.$data.assignmentsStore.exists(val);\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\tif (methods.isExist.call(gantt, id)) {\r\n\t\t\t\tmethods.delete.call(gantt, id);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tthis.handleResourceAssignmentCRUD(dp, gantt);\r\n\t}\r\n\r\n\tclientSideDelete(id, dp, gantt){\r\n\t\tconst updated = dp.updatedRows.slice();\r\n\t\tlet clientOnly = false;\r\n\r\n\t\tif(gantt.getUserData(id, \"!nativeeditor_status\", dp._ganttMode) === \"true_deleted\"){\r\n\t\t\tclientOnly = true;\r\n\t\t\tdp.setUpdated(id,false);\r\n\t\t}\r\n\r\n\t\tfor (let i = 0; i < updated.length && !dp._in_progress[id]; i++) {\r\n\t\t\tif (updated[i] === id) {\r\n\t\t\t\tif (gantt.getUserData(id, \"!nativeeditor_status\", dp._ganttMode) === \"inserted\") {\r\n\t\t\t\t\tclientOnly = true;\r\n\t\t\t\t}\r\n\t\t\t\tdp.setUpdated(id,false);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn clientOnly;\r\n\t}\r\n\r\n\thandleResourceAssignmentCRUD(dp, gantt){\r\n\t\tif(!gantt.config.resources || gantt.config.resources.dataprocessor_assignments !== true){\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst assignmentsStore = gantt.getDatastore(gantt.config.resource_assignment_store);\r\n\t\tconst insertedTasks = {};\r\n\t\tconst pendingAssignments = {};\r\n\r\n\t\tgantt.attachEvent(\"onBeforeTaskAdd\", function(id, task){\r\n\t\t\tinsertedTasks[id] = true;\r\n\t\t\treturn true;\r\n\t\t});\r\n\r\n\t\tfunction putAssignmentToQueue(item){\r\n\t\t\tpendingAssignments[item.id] = item;\r\n\t\t\tinsertedTasks[item.task_id] = true;\r\n\t\t}\r\n\r\n\t\tfunction insertResourceAssignment(assignment){\r\n\t\t\tconst id = assignment.id;\r\n\t\t\tif (assignmentsStore.exists(id)) {\r\n\t\t\t\tdp.setGanttMode(\"assignment\");\r\n\t\t\t\tdp.setUpdated(id, true,\"inserted\");\r\n\t\t\t}\r\n\t\t\tdelete pendingAssignments[id];\r\n\t\t}\r\n\r\n\t\tgantt.attachEvent(\"onTaskIdChange\", function(id, newId){\r\n\t\t\tdelete insertedTasks[id];\r\n\t\t});\r\n\r\n\t\tassignmentsStore.attachEvent(\"onAfterAdd\", (id, item) => {\r\n\t\t\tif(insertedTasks[item.task_id]){\r\n\t\t\t\t// inserting assignment of new task\r\n\t\t\t\t// task is not saved yet, need to wait till it gets permanent id and save assigmnents after that\r\n\t\t\t\tputAssignmentToQueue(item);\r\n\t\t\t}else{\r\n\t\t\t\tinsertResourceAssignment(item);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tassignmentsStore.attachEvent(\"onAfterUpdate\", (id, item) => {\r\n\t\t\tif (assignmentsStore.exists(id)) {\r\n\t\t\t\tif(pendingAssignments[id]){\r\n\t\t\t\t\tinsertResourceAssignment(item);\r\n\t\t\t\t}else{\r\n\t\t\t\t\tdp.setGanttMode(\"assignment\");\r\n\t\t\t\t\tdp.setUpdated(id, true);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tassignmentsStore.attachEvent(\"onAfterDelete\", (id, item) => {\r\n\t\t\tdp.setGanttMode(\"assignment\");\r\n\r\n\t\t\tconst needDbDelete = !this.clientSideDelete(id, dp, gantt);\r\n\t\t\tif (!needDbDelete) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tdp.storeItem(item);\r\n\t\t\tdp.setUpdated(id, true,\"deleted\");\r\n\t\t});\r\n\r\n\t}\r\n\r\n\thandleResourceCRUD(dp, gantt){\r\n\t\tif(!gantt.config.resources || gantt.config.resources.dataprocessor_resources !== true){\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst resourcesStore = gantt.getDatastore(gantt.config.resource_store);\r\n\r\n\t\tfunction insertResource(resource){\r\n\t\t\tconst id = resource.id;\r\n\t\t\tif (resourcesStore.exists(id)) {\r\n\t\t\t\tdp.setGanttMode(\"resource\");\r\n\t\t\t\tdp.setUpdated(id, true,\"inserted\");\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tresourcesStore.attachEvent(\"onAfterAdd\", (id, item) => {\r\n\t\t\tinsertResource(item);\r\n\t\t});\r\n\r\n\t\tresourcesStore.attachEvent(\"onAfterUpdate\", (id, item) => {\r\n\t\t\tif (resourcesStore.exists(id)) {\r\n\t\t\t\tdp.setGanttMode(\"resource\");\r\n\t\t\t\tdp.setUpdated(id, true);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tresourcesStore.attachEvent(\"onAfterDelete\", (id, item) => {\r\n\t\t\tdp.setGanttMode(\"resource\");\r\n\r\n\t\t\tconst needDbDelete = !this.clientSideDelete(id, dp, gantt);\r\n\t\t\tif (!needDbDelete) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tdp.storeItem(item);\r\n\t\t\tdp.setUpdated(id, true,\"deleted\");\r\n\t\t});\r\n\r\n\t}\r\n\r\n\r\n\tdetach() {\r\n\t\thelpers.forEach(this._dataProcessorHandlers, (e) => {\r\n\t\t\tthis.$gantt.detachEvent(e);\r\n\t\t});\r\n\t\tthis._dataProcessorHandlers = [];\r\n\t}\r\n}\r\n","import * as eventable from \"../../utils/eventable\";\r\nimport * as helpers from \"../../utils/helpers\";\r\nimport * as utils from \"../../utils/utils\";\r\nimport DataProcessorEvents from \"./data_processor_events\";\r\nimport extendGantt from \"./extend_gantt\";\r\nimport SimpleStorage from \"./simple_storage\";\r\n\r\nexport interface DataProcessor { // tslint:disable-line\r\n\t$gantt: any;\r\n\tdetachAllEvents: any;\r\n\tattachEvent: any;\r\n\tcallEvent: any;\r\n\r\n\tserverProcessor: string;\r\n\taction_param: string;\r\n\tupdatedRows: any[];\r\n\tautoUpdate: boolean;\r\n\tupdateMode: string;\r\n\tmessages: any[];\r\n\tstyles: object;\r\n\tdnd: any;\r\n\tdeleteAfterConfirmation?: any;\r\n}\r\n\r\nexport function createDataProcessor(config: any) {\r\n\tlet router;\r\n\tlet tMode;\r\n\tif (config instanceof Function) {\r\n\t\trouter = config;\r\n\t} else if (config.hasOwnProperty(\"router\")) {\r\n\t\trouter = config.router;\r\n\t} else if (config.hasOwnProperty(\"assignment\") || config.hasOwnProperty(\"link\") || config.hasOwnProperty(\"task\")) {\r\n\t\trouter = config;\r\n\t}\r\n\tif (router) {\r\n\t\ttMode = \"CUSTOM\";\r\n\t} else {\r\n\t\ttMode = config.mode || \"REST-JSON\";\r\n\t}\r\n\tconst gantt = this; // tslint:disable-line\r\n\tconst dp = new DataProcessor(config.url);\r\n\r\n\r\n\tdp.init(gantt);\r\n\tdp.setTransactionMode({\r\n\t\tmode: tMode,\r\n\t\trouter\r\n\t}, config.batchUpdate);\r\n\tif(config.deleteAfterConfirmation){\r\n\t\tdp.deleteAfterConfirmation = config.deleteAfterConfirmation;\r\n\t}\r\n\treturn dp;\r\n}\r\n\r\nexport class DataProcessor {\r\n\tpublic modes: object;\r\n\tpublic serverProcessor: string;\r\n\tpublic action_param: string; // tslint:disable-line\r\n\tpublic updatedRows: any[];\r\n\tpublic autoUpdate: boolean;\r\n\tpublic updateMode: string;\r\n\tpublic messages: any[];\r\n\tpublic styles: object;\r\n\tpublic dnd: any;\r\n\r\n\tprotected _tMode: string;\r\n\tprotected _headers: any;\r\n\tprotected _payload: any;\r\n\tprotected _postDelim: string;\r\n\tprotected _waitMode: number;\r\n\tprotected _in_progress: object; // tslint:disable-line\r\n\tprotected _invalid: object;\r\n\tprotected _storage: SimpleStorage;\r\n\tprotected _tSend: boolean;\r\n\tprotected _serializeAsJson: boolean;\r\n\tprotected _router: any;\r\n\tprotected _utf: boolean;\r\n\tprotected _methods: any[];\r\n\tprotected _user: any;\r\n\tprotected _uActions: object;\r\n\tprotected _needUpdate: boolean;\r\n\tprotected _ganttMode: \"task\"|\"link\";\r\n\tprotected _routerParametersFormat: \"parameters\"|\"object\";\r\n\r\n\tprotected _silent_mode: any; // tslint:disable-line\r\n\tprotected _updateBusy: any;\r\n\tprotected _serverProcessor: any;\r\n\tprotected _initialized: boolean;\r\n\r\n\tconstructor(serverProcessorURL?) {\r\n\t\tthis.serverProcessor = serverProcessorURL;\r\n\t\tthis.action_param = \"!nativeeditor_status\";\r\n\r\n\t\tthis.updatedRows = []; // ids of updated rows\r\n\r\n\t\tthis.autoUpdate = true;\r\n\t\tthis.updateMode = \"cell\";\r\n\t\tthis._headers = null;\r\n\t\tthis._payload = null;\r\n\t\tthis._postDelim = \"_\";\r\n\t\tthis._routerParametersFormat = \"parameters\";\r\n\r\n\t\tthis._waitMode = 0;\r\n\t\tthis._in_progress = {}; // ?\r\n\t\tthis._storage = SimpleStorage.create();\r\n\t\tthis._invalid = {};\r\n\t\tthis.messages = [];\r\n\r\n\t\tthis.styles = {\r\n\t\t\tupdated: \"font-weight:bold;\",\r\n\t\t\tinserted: \"font-weight:bold;\",\r\n\t\t\tdeleted: \"text-decoration : line-through;\",\r\n\t\t\tinvalid: \"background-color:FFE0E0;\",\r\n\t\t\tinvalid_cell: \"border-bottom:2px solid red;\",\r\n\t\t\terror: \"color:red;\",\r\n\t\t\tclear: \"font-weight:normal;text-decoration:none;\"\r\n\t\t};\r\n\t\tthis.enableUTFencoding(true);\r\n\t\teventable(this);\r\n\t}\r\n\r\n\tsetTransactionMode(mode:any, total?:any) {\r\n\t\tif (typeof mode === \"object\") {\r\n\t\t\tthis._tMode = mode.mode || this._tMode;\r\n\r\n\t\t\tif (utils.defined(mode.headers)) {\r\n\t\t\t\tthis._headers = mode.headers;\r\n\t\t\t}\r\n\r\n\t\t\tif (utils.defined(mode.payload)) {\r\n\t\t\t\tthis._payload = mode.payload;\r\n\t\t\t}\r\n\t\t\tthis._tSend = !!total;\r\n\t\t} else {\r\n\t\t\tthis._tMode = mode;\r\n\t\t\tthis._tSend = total;\r\n\t\t}\r\n\r\n\t\tif (this._tMode === \"REST\") {\r\n\t\t\tthis._tSend = false;\r\n\t\t}\r\n\r\n\t\tif (this._tMode === \"JSON\" || this._tMode === \"REST-JSON\") {\r\n\t\t\tthis._tSend = false;\r\n\t\t\tthis._serializeAsJson = true;\r\n\t\t\tthis._headers = this._headers || {};\r\n\t\t\tthis._headers[\"Content-Type\"] = \"application/json\";\r\n\t\t}else{\r\n\t\t\tif(this._headers && !this._headers[\"Content-Type\"]){\r\n\t\t\t\tthis._headers[\"Content-Type\"] = \"application/x-www-form-urlencoded\";\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (this._tMode === \"CUSTOM\") {\r\n\t\t\tthis._tSend = false;\r\n\t\t\tthis._router = mode.router;\r\n\t\t}\r\n\t}\r\n\r\n\tescape(data:any) {\r\n\t\tif (this._utf) {\r\n\t\t\treturn encodeURIComponent(data);\r\n\t\t} else {\r\n\t\t\treturn escape(data);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @desc: allows to set escaping mode\r\n\t * @param: true - utf based escaping, simple - use current page encoding\r\n\t * @type: public\r\n\t */\r\n\tenableUTFencoding(mode:boolean) {\r\n\t\tthis._utf = !!mode;\r\n\t}\r\n\r\n\t/**\r\n\t * @desc: get state of updating\r\n\t * @returns: true - all in sync with server, false - some items not updated yet.\r\n\t * @type: public\r\n\t */\r\n\tgetSyncState() {\r\n\t\treturn !this.updatedRows.length;\r\n\t}\r\n\r\n\t/**\r\n\t * @desc: set if rows should be send to server automatically\r\n\t * @param: mode - \"row\" - based on row selection changed, \"cell\" - based on cell editing finished, \"off\" - manual data sending\r\n\t * @type: public\r\n\t */\r\n\tsetUpdateMode(mode: string, dnd: any) {\r\n\t\tthis.autoUpdate = (mode === \"cell\");\r\n\t\tthis.updateMode = mode;\r\n\t\tthis.dnd = dnd;\r\n\t}\r\n\r\n\tignore(code: any, master: any) {\r\n\t\tthis._silent_mode = true;\r\n\t\tcode.call(master || window);\r\n\t\tthis._silent_mode = false;\r\n\t}\r\n\r\n\t/**\r\n\t * @desc: mark row as updated/normal. check mandatory fields, initiate autoupdate (if turned on)\r\n\t * @param: rowId - id of row to set update-status for\r\n\t * @param: state - true for \"updated\", false for \"not updated\"\r\n\t * @param: mode - update mode name\r\n\t * @type: public\r\n\t */\r\n\tsetUpdated(rowId:number|string, state: boolean, mode?: string) {\r\n\t\tif (this._silent_mode) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst ind = this.findRow(rowId);\r\n\r\n\t\tmode = mode || \"updated\";\r\n\t\tconst existing = this.$gantt.getUserData(rowId, this.action_param, this._ganttMode);\r\n\t\tif (existing && mode === \"updated\") {\r\n\t\t\tmode = existing;\r\n\t\t}\r\n\t\tif (state) {\r\n\t\t\tthis.set_invalid(rowId, false); // clear previous error flag\r\n\t\t\tthis.updatedRows[ind] = rowId;\r\n\t\t\tthis.$gantt.setUserData(rowId, this.action_param, mode, this._ganttMode);\r\n\t\t\tif (this._in_progress[rowId]) {\r\n\t\t\t\tthis._in_progress[rowId] = \"wait\";\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (!this.is_invalid(rowId)) {\r\n\t\t\t\tthis.updatedRows.splice(ind, 1);\r\n\t\t\t\tthis.$gantt.setUserData(rowId, this.action_param, \"\", this._ganttMode);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthis.markRow(rowId, state, mode);\r\n\t\tif (state && this.autoUpdate) {\r\n\t\t\tthis.sendData(rowId);\r\n\t\t}\r\n\t}\r\n\r\n\tmarkRow(id: number | string, state: boolean, mode: string) {\r\n\t\tlet str = \"\";\r\n\t\tconst invalid = this.is_invalid(id);\r\n\t\tif (invalid) {\r\n\t\t\tstr = this.styles[invalid];\r\n\t\t\tstate = true;\r\n\t\t}\r\n\t\tif (this.callEvent(\"onRowMark\", [id, state, mode, invalid])) {\r\n\t\t\t// default logic\r\n\t\t\tstr = this.styles[state ? mode : \"clear\"] + \" \" + str;\r\n\r\n\t\t\tthis.$gantt[this._methods[0]](id, str);\r\n\r\n\t\t\tif (invalid && invalid.details) {\r\n\t\t\t\tstr += this.styles[invalid + \"_cell\"];\r\n\t\t\t\tfor (let i = 0; i < invalid.details.length; i++) {\r\n\t\t\t\t\tif (invalid.details[i]) {\r\n\t\t\t\t\t\tthis.$gantt[this._methods[1]](id, i, str);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tgetActionByState(state: string):string {\r\n\t\tif (state === \"inserted\") {\r\n\t\t\treturn \"create\";\r\n\t\t}\r\n\r\n\t\tif (state === \"updated\") {\r\n\t\t\treturn \"update\";\r\n\t\t}\r\n\r\n\t\tif (state === \"deleted\") {\r\n\t\t\treturn \"delete\";\r\n\t\t}\r\n\r\n\t\t// reorder\r\n\t\treturn \"update\";\r\n\t}\r\n\r\n\tgetState(id: number | string) {\r\n\t\treturn this.$gantt.getUserData(id, this.action_param, this._ganttMode);\r\n\t}\r\n\r\n\tis_invalid(id: number | string) {\r\n\t\treturn this._invalid[id];\r\n\t}\r\n\r\n\tset_invalid(id: number | string, mode: any, details?) {\r\n\t\tif (details) {\r\n\t\t\tmode = {\r\n\t\t\t\tvalue: mode,\r\n\t\t\t\tdetails,\r\n\t\t\t\ttoString: function() { // tslint:disable-line\r\n\t\t\t\t\treturn this.value.toString();\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t}\r\n\t\tthis._invalid[id] = mode;\r\n\t}\r\n\r\n\t/**\r\n\t * @desc: check mandatory fields and verify values of cells, initiate update (if specified). Can be redefined in order to provide custom validation\r\n\t * @param: rowId - id of row to set update-status for\r\n\t * @type: public\r\n\t */\r\n\t// tslint:disable-next-line\r\n\tcheckBeforeUpdate(rowId: number | string) {\r\n\t\treturn true;\r\n\t}\r\n\r\n\t/**\r\n\t * @desc: send row(s) values to server\r\n\t * @param: rowId - id of row which data to send. If not specified, then all \"updated\" rows will be send\r\n\t * @type: public\r\n\t */\r\n\tsendData(rowId?: any) {\r\n\t\tif (this.$gantt.editStop) {\r\n\t\t\tthis.$gantt.editStop();\r\n\t\t}\r\n\r\n\t\tif (typeof rowId === \"undefined\" || this._tSend) {\r\n\r\n\t\t\tconst pendingUpdateModes = [];\r\n\t\t\tif(this.modes){\r\n\t\t\t\tconst knownModes = [\"task\", \"link\", \"assignment\"];\r\n\t\t\t\tknownModes.forEach((mode) => {\r\n\t\t\t\t\tif(this.modes[mode] && this.modes[mode].updatedRows.length){\r\n\t\t\t\t\t\tpendingUpdateModes.push(mode);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\tif (pendingUpdateModes.length){\r\n\t\t\t\tfor(let i = 0; i < pendingUpdateModes.length; i++){\r\n\t\t\t\t\tthis.setGanttMode(pendingUpdateModes[i]);\r\n\t\t\t\t\tthis.sendAllData();\r\n\t\t\t\t}\r\n\t\t\t\treturn;\r\n\t\t\t} else {\r\n\t\t\t\treturn this.sendAllData();\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (this._in_progress[rowId]) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tthis.messages = [];\r\n\t\tif (!this.checkBeforeUpdate(rowId) && this.callEvent(\"onValidationError\", [rowId, this.messages])) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tthis._beforeSendData(this._getRowData(rowId), rowId);\r\n\t}\r\n\r\n\tserialize(data: any, id: any) {\r\n\t\tif (this._serializeAsJson) {\r\n\t\t\treturn this._serializeAsJSON(data);\r\n\t\t}\r\n\r\n\t\tif (typeof data === \"string\") {\r\n\t\t\treturn data;\r\n\t\t}\r\n\t\tif (typeof id !== \"undefined\") {\r\n\t\t\treturn this.serialize_one(data, \"\");\r\n\t\t} else {\r\n\t\t\tconst stack = [];\r\n\t\t\tconst keys = [];\r\n\t\t\tfor (const key in data) {\r\n\t\t\t\tif (data.hasOwnProperty(key)) {\r\n\t\t\t\t\tstack.push(this.serialize_one(data[key], key + this._postDelim));\r\n\t\t\t\t\tkeys.push(key);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tstack.push(\"ids=\" + this.escape(keys.join(\",\")));\r\n\t\t\tif (this.$gantt.security_key) {\r\n\t\t\t\tstack.push(\"dhx_security=\" + this.$gantt.security_key);\r\n\t\t\t}\r\n\t\t\treturn stack.join(\"&\");\r\n\t\t}\r\n\t}\r\n\r\n\tserialize_one(data: any, pref: string) {\r\n\t\tif (typeof data === \"string\") {\r\n\t\t\treturn data;\r\n\t\t}\r\n\t\tconst stack = [];\r\n\t\tlet serialized = \"\";\r\n\t\tfor (const key in data)\r\n\t\t\tif (data.hasOwnProperty(key)) {\r\n\t\t\t\tif ((key === \"id\" ||\r\n\t\t\t\t\tkey == this.action_param) && // tslint:disable-line\r\n\t\t\t\t\tthis._tMode === \"REST\") {\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\tif (typeof data[key] === \"string\" || typeof data[key] === \"number\") {\r\n\t\t\t\t\tserialized = data[key];\r\n\t\t\t\t} else {\r\n\t\t\t\t\tserialized = JSON.stringify(data[key]);\r\n\t\t\t\t}\r\n\t\t\t\tstack.push(this.escape((pref || \"\") + key) + \"=\" + this.escape(serialized));\r\n\t\t\t}\r\n\t\treturn stack.join(\"&\");\r\n\t}\r\n\r\n\tsendAllData() {\r\n\t\tif (!this.updatedRows.length) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tthis.messages = [];\r\n\t\tlet valid: any = true;\r\n\r\n\t\tthis._forEachUpdatedRow(function(rowId) {\r\n\t\t\tvalid = valid && this.checkBeforeUpdate(rowId);\r\n\t\t});\r\n\r\n\t\tif (!valid && !this.callEvent(\"onValidationError\", [\"\", this.messages])) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tif (this._tSend) {\r\n\t\t\tthis._sendData(this._getAllData());\r\n\t\t} else {\r\n\t\t\t// this.updatedRows can be spliced from onBeforeUpdate via dp.setUpdated false\r\n\t\t\t// use an iterator instead of for(var i = 0; i < this.updatedRows; i++) then\r\n\t\t\tthis._forEachUpdatedRow(function(rowId) {\r\n\t\t\t\tif (!this._in_progress[rowId]) {\r\n\t\t\t\t\tif (this.is_invalid(rowId)) {\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis._beforeSendData(this._getRowData(rowId), rowId);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tfindRow(pattern: any) {\r\n\t\tlet i = 0;\r\n\t\tfor (i = 0; i < this.updatedRows.length; i++) {\r\n\t\t\tif (pattern == this.updatedRows[i]) { // tslint:disable-line\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn i;\r\n\t}\r\n\r\n\t/**\r\n\t * @desc: define custom actions\r\n\t * @param: name - name of action, same as value of action attribute\r\n\t * @param: handler - custom function, which receives a XMl response content for action\r\n\t * @type: private\r\n\t */\r\n\tdefineAction(name: string, handler: any) {\r\n\t\tif (!this._uActions) {\r\n\t\t\tthis._uActions = {};\r\n\t\t}\r\n\t\tthis._uActions[name] = handler;\r\n\t}\r\n\r\n\t/**\r\n\t * @desc: used in combination with setOnBeforeUpdateHandler to create custom client-server transport system\r\n\t * @param: sid - id of item before update\r\n\t * @param: tid - id of item after up0ate\r\n\t * @param: action - action name\r\n\t * @type: public\r\n\t * @topic: 0\r\n\t */\r\n\tafterUpdateCallback(sid: number | string, tid: number | string, action: string, btag: any, ganttMode: string) {\r\n\t\tif(!this.$gantt){\r\n\t\t\t// destructor has been called before the callback\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tthis.setGanttMode(ganttMode);\r\n\r\n\t\tconst marker = sid;\r\n\t\tconst correct = (action !== \"error\" && action !== \"invalid\");\r\n\t\tif (!correct) {\r\n\t\t\tthis.set_invalid(sid, action);\r\n\t\t}\r\n\t\tif ((this._uActions) && (this._uActions[action]) && (!this._uActions[action](btag))) {\r\n\t\t\treturn (delete this._in_progress[marker]);\r\n\t\t}\r\n\r\n\t\tif (this._in_progress[marker] !== \"wait\") {\r\n\t\t\tthis.setUpdated(sid, false);\r\n\t\t}\r\n\r\n\t\tconst originalSid = sid;\r\n\r\n\t\tswitch (action) {\r\n\t\t\tcase \"inserted\":\r\n\t\t\tcase \"insert\":\r\n\t\t\t\tif (tid != sid) { // tslint:disable-line\r\n\t\t\t\t\tthis.setUpdated(sid, false);\r\n\t\t\t\t\tthis.$gantt[this._methods[2]](sid, tid);\r\n\t\t\t\t\tsid = tid;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"delete\":\r\n\t\t\tcase \"deleted\":\r\n\t\t\t\tif(!this.deleteAfterConfirmation || this._ganttMode !== \"task\"){\r\n\t\t\t\t\tthis.$gantt.setUserData(sid, this.action_param, \"true_deleted\", this._ganttMode);\r\n\t\t\t\t\tthis.$gantt[this._methods[3]](sid);\r\n\t\t\t\t\tdelete this._in_progress[marker];\r\n\t\t\t\t\treturn this.callEvent(\"onAfterUpdate\", [sid, action, tid, btag]);\r\n\t\t\t\t}else{\r\n\t\t\t\t\tif (this._ganttMode === \"task\" && this.$gantt.isTaskExists(sid)) {\r\n\t\t\t\t\t\tthis.$gantt.setUserData(sid, this.action_param, \"true_deleted\", this._ganttMode);\r\n\t\t\t\t\t\tconst task = this.$gantt.getTask(sid);\r\n\t\t\t\t\t\tthis.$gantt.silent(() => {\r\n\t\t\t\t\t\t\tthis.$gantt.deleteTask(sid);\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tthis.$gantt.callEvent(\"onAfterTaskDelete\", [sid, task]);\r\n\t\t\t\t\t\tthis.$gantt.render();\r\n\t\t\t\t\t\tdelete this._in_progress[marker];\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn this.callEvent(\"onAfterUpdate\", [sid, action, tid, btag]);\r\n\t\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif (this._in_progress[marker] !== \"wait\") {\r\n\t\t\tif (correct) {\r\n\t\t\t\tthis.$gantt.setUserData(sid, this.action_param, \"\", this._ganttMode);\r\n\t\t\t}\r\n\t\t\tdelete this._in_progress[marker];\r\n\t\t} else {\r\n\t\t\tdelete this._in_progress[marker];\r\n\t\t\tthis.setUpdated(tid, true, this.$gantt.getUserData(sid, this.action_param, this._ganttMode));\r\n\t\t}\r\n\r\n\t\tthis.callEvent(\"onAfterUpdate\", [originalSid, action, tid, btag]);\r\n\t}\r\n\r\n\t/**\r\n\t * @desc: response from server\r\n\t * @param: xml - XMLLoader object with response XML\r\n\t * @type: private\r\n\t */\r\n\tafterUpdate(that: any, xml: any, id?:any) {\r\n\t\tlet _xml;\r\n\t\tif (arguments.length === 3) {\r\n\t\t\t_xml = arguments[1];\r\n\t\t} else {\r\n\t\t\t// old dataprocessor\r\n\t\t\t_xml = arguments[4];\r\n\t\t}\r\n\t\tlet mode = this.getGanttMode();\r\n\t\tconst reqUrl = _xml.filePath || _xml.url;\r\n\r\n\t\tif (this._tMode !== \"REST\" && this._tMode !== \"REST-JSON\") {\r\n\t\t\tif (reqUrl.indexOf(\"gantt_mode=links\") !== -1) {\r\n\t\t\t\tmode = \"link\";\r\n\t\t\t} else if (reqUrl.indexOf(\"gantt_mode=assignments\") !== -1) {\r\n\t\t\t\tmode = \"assignment\";\r\n\t\t\t} else {\r\n\t\t\t\tmode = \"task\";\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (reqUrl.indexOf(\"/link\") >= 0) {\r\n\t\t\t\tmode = \"link\";\r\n\t\t\t} else if(reqUrl.indexOf(\"/assignment\") >= 0){\r\n\t\t\t\tmode = \"assignment\";\r\n\t\t\t} else {\r\n\t\t\t\tmode = \"task\";\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.setGanttMode(mode);\r\n\r\n\t\tconst ajax = this.$gantt.ajax;\r\n\t\t// try to use json first\r\n\t\tlet tag;\r\n\r\n\t\ttry {\r\n\t\t\ttag = JSON.parse(xml.xmlDoc.responseText);\r\n\t\t} catch (e) {\r\n\r\n\t\t\t// empty response also can be processed by json handler\r\n\t\t\tif (!xml.xmlDoc.responseText.length) {\r\n\t\t\t\ttag = {};\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tconst processCallback = (itemId: any) => {\r\n\t\t\tconst action = tag.action || this.getState(itemId) || \"updated\";\r\n\t\t\tconst sid = tag.sid || itemId[0];\r\n\t\t\tconst tid = tag.tid || itemId[0];\r\n\t\t\tthat.afterUpdateCallback(sid, tid, action, tag, mode);\r\n\t\t};\r\n\t\tif (tag) {\r\n\t\t\t// GS-753. When multiple tasks are updated, unhighlight all of them\r\n\t\t\tif (Array.isArray(id) && id.length > 1) {\r\n\t\t\t\tid.forEach((taskId) => processCallback(taskId));\r\n\t\t\t} else {\r\n\t\t\t\tprocessCallback(id);\r\n\t\t\t}\r\n\t\t\tthat.finalizeUpdate();\r\n\t\t\tthis.setGanttMode(mode);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// xml response\r\n\t\tconst top = ajax.xmltop(\"data\", xml.xmlDoc); // fix incorrect content type in IE\r\n\t\tif (!top) {\r\n\t\t\treturn this.cleanUpdate(id);\r\n\t\t}\r\n\t\tconst atag = ajax.xpath(\"//data/action\", top);\r\n\t\tif (!atag.length) {\r\n\t\t\treturn this.cleanUpdate(id);\r\n\t\t}\r\n\r\n\t\tfor (let i = 0; i < atag.length; i++) {\r\n\t\t\tconst btag = atag[i];\r\n\t\t\tconst action = btag.getAttribute(\"type\");\r\n\t\t\tconst sid = btag.getAttribute(\"sid\");\r\n\t\t\tconst tid = btag.getAttribute(\"tid\");\r\n\r\n\t\t\tthat.afterUpdateCallback(sid, tid, action, btag, mode);\r\n\t\t}\r\n\t\tthat.finalizeUpdate();\r\n\t}\r\n\r\n\tcleanUpdate(id: any[]) {\r\n\t\tif (id) {\r\n\t\t\tfor (let i = 0; i < id.length; i++) {\r\n\t\t\t\tdelete this._in_progress[id[i]];\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tfinalizeUpdate() {\r\n\t\tif (this._waitMode) {\r\n\t\t\tthis._waitMode--;\r\n\t\t}\r\n\r\n\t\tthis.callEvent(\"onAfterUpdateFinish\", []);\r\n\t\tif (!this.updatedRows.length) {\r\n\t\t\tthis.callEvent(\"onFullSync\", []);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @desc: initializes data-processor\r\n\t * @param: gantt - dhtmlxGantt object to attach this data-processor to\r\n\t * @type: public\r\n\t */\r\n\tinit(gantt: any) {\r\n\t\tif (this._initialized) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tthis.$gantt = gantt;\r\n\t\tif (this.$gantt._dp_init) {\r\n\t\t\tthis.$gantt._dp_init(this);\r\n\t\t}\r\n\r\n\t\tthis._setDefaultTransactionMode();\r\n\r\n\t\tthis.styles = {\r\n\t\t\tupdated:\"gantt_updated\",\r\n\t\t\torder:\"gantt_updated\",\r\n\t\t\tinserted:\"gantt_inserted\",\r\n\t\t\tdeleted:\"gantt_deleted\",\r\n\t\t\tdelete_confirmation:\"gantt_deleted\",\r\n\t\t\tinvalid:\"gantt_invalid\",\r\n\t\t\terror:\"gantt_error\",\r\n\t\t\tclear:\"\"\r\n\t\t};\r\n\r\n\t\tthis._methods=[\"_row_style\",\"setCellTextStyle\",\"_change_id\",\"_delete_task\"];\r\n\t\textendGantt(this.$gantt, this);\r\n\t\tconst dataProcessorEvents = new DataProcessorEvents(this.$gantt, this);\r\n\t\tdataProcessorEvents.attach();\r\n\t\tthis.attachEvent(\"onDestroy\", function() {\r\n\t\t\tdelete this.setGanttMode;\r\n\t\t\tdelete this._getRowData;\r\n\r\n\t\t\tdelete this.$gantt._dp;\r\n\t\t\tdelete this.$gantt._change_id;\r\n\t\t\tdelete this.$gantt._row_style;\r\n\t\t\tdelete this.$gantt._delete_task;\r\n\t\t\tdelete this.$gantt._sendTaskOrder;\r\n\t\t\tdelete this.$gantt;\r\n\r\n\t\t\tdataProcessorEvents.detach();\r\n\t\t});\r\n\t\tthis.$gantt.callEvent(\"onDataProcessorReady\", [this]);\r\n\t\tthis._initialized = true;\r\n\t}\r\n\r\n\tsetOnAfterUpdate(handler) {\r\n\t\tthis.attachEvent(\"onAfterUpdate\", handler);\r\n\t}\r\n\r\n\tsetOnBeforeUpdateHandler(handler) {\r\n\t\tthis.attachEvent(\"onBeforeDataSending\", handler);\r\n\t}\r\n\r\n\t/* starts autoupdate mode\r\n\t\t@param interval time interval for sending update requests\r\n\t*/\r\n\tsetAutoUpdate(interval, user) {\r\n\t\tinterval = interval || 2000;\r\n\r\n\t\tthis._user = user || (new Date()).valueOf();\r\n\t\tthis._needUpdate = false;\r\n\r\n\t\tthis._updateBusy = false;\r\n\r\n\t\tthis.attachEvent(\"onAfterUpdate\", this.afterAutoUpdate); // arguments sid, action, tid, xml_node;\r\n\r\n\t\tthis.attachEvent(\"onFullSync\", this.fullSync);\r\n\r\n\t\tsetInterval(() => {\r\n\t\t\tthis.loadUpdate();\r\n\t\t}, interval);\r\n\t}\r\n\r\n\t/* process updating request response\r\n\t\tif status == collision version is deprecated\r\n\t\tset flag for autoupdating immediately\r\n\t*/\r\n\tafterAutoUpdate(sid, action, tid, xml_node) { // tslint:disable-line\r\n\t\tif (action === \"collision\") {\r\n\t\t\tthis._needUpdate = true;\r\n\t\t\treturn false;\r\n\t\t} else {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\r\n\t/* callback function for onFillSync event\r\n\t\tcall update function if it's need\r\n\t*/\r\n\tfullSync() {\r\n\t\tif (this._needUpdate) {\r\n\t\t\tthis._needUpdate = false;\r\n\t\t\tthis.loadUpdate();\r\n\t\t}\r\n\t\treturn true;\r\n\t}\r\n\r\n\t/* sends query to the server and call callback function\r\n\t*/\r\n\tgetUpdates(url, callback) {\r\n\t\tconst ajax = this.$gantt.ajax;\r\n\t\tif (this._updateBusy) {\r\n\t\t\treturn false;\r\n\t\t} else {\r\n\t\t\tthis._updateBusy = true;\r\n\t\t}\r\n\r\n\t\tajax.get(url, callback);\r\n\r\n\t}\r\n\r\n\t/* loads updates and processes them\r\n\t*/\r\n\tloadUpdate() {\r\n\t\tconst ajax = this.$gantt.ajax;\r\n\t\tconst version = this.$gantt.getUserData(0, \"version\", this._ganttMode);\r\n\t\tlet url = this.serverProcessor + ajax.urlSeparator(this.serverProcessor) + [\"dhx_user=\" + this._user, \"dhx_version=\" + version].join(\"&\");\r\n\t\turl = url.replace(\"editing=true&\", \"\");\r\n\t\tthis.getUpdates(url, (xml) => {\r\n\t\t\tconst vers = ajax.xpath(\"//userdata\", xml);\r\n\t\t\tthis.$gantt.setUserData(0, \"version\", this._getXmlNodeValue(vers[0]), this._ganttMode);\r\n\r\n\t\t\tconst updates = ajax.xpath(\"//update\", xml);\r\n\t\t\tif (updates.length) {\r\n\t\t\t\tthis._silent_mode = true;\r\n\r\n\t\t\t\tfor (let i = 0; i < updates.length; i++) {\r\n\t\t\t\t\tconst status = updates[i].getAttribute(\"status\");\r\n\t\t\t\t\tconst id = updates[i].getAttribute(\"id\");\r\n\t\t\t\t\tconst parent = updates[i].getAttribute(\"parent\");\r\n\t\t\t\t\tswitch (status) {\r\n\t\t\t\t\t\tcase \"inserted\":\r\n\t\t\t\t\t\t\tthis.callEvent(\"insertCallback\", [updates[i], id, parent]);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase \"updated\":\r\n\t\t\t\t\t\t\tthis.callEvent(\"updateCallback\", [updates[i], id, parent]);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase \"deleted\":\r\n\t\t\t\t\t\t\tthis.callEvent(\"deleteCallback\", [updates[i], id, parent]);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis._silent_mode = false;\r\n\t\t\t}\r\n\r\n\t\t\tthis._updateBusy = false;\r\n\t\t});\r\n\t}\r\n\r\n\tdestructor() {\r\n\t\tthis.callEvent(\"onDestroy\", []);\r\n\t\tthis.detachAllEvents();\r\n\r\n\t\tthis.updatedRows = [];\r\n\t\tthis._in_progress = {}; // ?\r\n\t\tthis._invalid = {};\r\n\t\tthis._storage.clear();\r\n\t\tthis._storage = null;\r\n\t\tthis._headers = null;\r\n\t\tthis._payload = null;\r\n\t\tdelete this._initialized;\r\n\t}\r\n\r\n\tsetGanttMode(mode) {\r\n\t\tif (mode === \"tasks\") {\r\n\t\t\tmode = \"task\";\r\n\t\t} else if (mode === \"links\") {\r\n\t\t\tmode = \"link\";\r\n\t\t}\r\n\r\n\t\tconst modes = this.modes || {};\r\n\t\tconst ganttMode = this.getGanttMode();\r\n\t\tif (ganttMode) {\r\n\t\t\tmodes[ganttMode] = {\r\n\t\t\t\t_in_progress : this._in_progress,\r\n\t\t\t\t_invalid: this._invalid,\r\n\t\t\t\t_storage: this._storage,\r\n\t\t\t\tupdatedRows : this.updatedRows\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\tlet newState = modes[mode];\r\n\t\tif (!newState) {\r\n\t\t\tnewState = modes[mode] = {\r\n\t\t\t\t_in_progress : {},\r\n\t\t\t\t_invalid : {},\r\n\t\t\t\t_storage : SimpleStorage.create(),\r\n\t\t\t\tupdatedRows : []\r\n\t\t\t};\r\n\t\t}\r\n\t\tthis._in_progress = newState._in_progress;\r\n\t\tthis._invalid = newState._invalid;\r\n\t\tthis._storage = newState._storage;\r\n\t\tthis.updatedRows = newState.updatedRows;\r\n\t\tthis.modes = modes;\r\n\t\tthis._ganttMode = mode;\r\n\t}\r\n\tgetGanttMode():string {\r\n\t\treturn this._ganttMode;\r\n\t}\r\n\r\n\tstoreItem(item) {\r\n\t\tthis._storage.storeItem(item);\r\n\t}\r\n\r\n\turl(url: string) {\r\n\t\tthis.serverProcessor = this._serverProcessor = url;\r\n\t}\r\n\r\n\tprotected _beforeSendData(data: any, rowId: any) {\r\n\t\tif (!this.callEvent(\"onBeforeUpdate\", [rowId, this.getState(rowId), data])) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tthis._sendData(data, rowId);\r\n\t}\r\n\r\n\tprotected _serializeAsJSON(data: any) {\r\n\t\tif (typeof data === \"string\") {\r\n\t\t\treturn data;\r\n\t\t}\r\n\r\n\t\tconst copy = utils.copy(data);\r\n\t\tif (this._tMode === \"REST-JSON\") {\r\n\t\t\tdelete copy.id;\r\n\t\t\tdelete copy[this.action_param];\r\n\t\t}\r\n\r\n\t\treturn JSON.stringify(copy);\r\n\t}\r\n\r\n\tprotected _applyPayload(url: string) {\r\n\t\tconst ajax = this.$gantt.ajax;\r\n\t\tif (this._payload) {\r\n\t\t\tfor (const key in this._payload) {\r\n\t\t\t\turl = url + ajax.urlSeparator(url) + this.escape(key) + \"=\" + this.escape(this._payload[key]);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn url;\r\n\t}\r\n\r\n\t// GET/POST/JSON modes of the dataProcessor didn't send the whole data items in 'delete' requests\r\n\t// clear extra info from the data in order not to change the request format\r\n\tprotected _cleanupArgumentsBeforeSend(dataToSend: any) {\r\n\t\tlet processedData;\r\n\t\tif(dataToSend[this.action_param] === undefined){// hash of updated items, and not an individual item\r\n\t\t\tprocessedData = {};\r\n\t\t\tfor(const i in dataToSend) {\r\n\t\t\t\tprocessedData[i] = this._cleanupArgumentsBeforeSend(dataToSend[i]);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tprocessedData = this._cleanupItemBeforeSend(dataToSend);\r\n\t\t}\r\n\t\treturn processedData;\r\n\t}\r\n\tprotected _cleanupItemBeforeSend(updatedItem: any) {\r\n\t\tlet output = null;\r\n\t\tif(updatedItem){\r\n\t\t\tif(updatedItem[this.action_param] === \"deleted\"){\r\n\t\t\t\toutput = {};\r\n\t\t\t\toutput.id = updatedItem.id;\r\n\t\t\t\toutput[this.action_param] = updatedItem[this.action_param];\r\n\t\t\t}else{\r\n\t\t\t\toutput = updatedItem;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn output;\r\n\t}\r\n\r\n\tprotected _sendData(dataToSend: any, rowId?: any) {\r\n\t\tif (!dataToSend) {\r\n\t\t\treturn; // nothing to send\r\n\t\t}\r\n\t\tif (!this.callEvent(\"onBeforeDataSending\", rowId ? [rowId, this.getState(rowId), dataToSend] : [null, null, dataToSend])) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tif (rowId) {\r\n\t\t\tthis._in_progress[rowId] = (new Date()).valueOf();\r\n\t\t}\r\n\r\n\t\tconst ajax = this.$gantt.ajax;\r\n\r\n\t\tif (this._tMode === \"CUSTOM\") {\r\n\t\t\tconst taskState = this.getState(rowId);\r\n\t\t\tconst taskAction = this.getActionByState(taskState);\r\n\t\t\tconst ganttMode = this.getGanttMode();\r\n\t\t\tconst _onResolvedCreateUpdate = (tag) => {\r\n\t\t\t\tlet action = taskState || \"updated\";\r\n\t\t\t\tlet sid = rowId;\r\n\t\t\t\tlet tid = rowId;\r\n\r\n\t\t\t\tif (tag) {\r\n\t\t\t\t\taction = tag.action || taskState;\r\n\t\t\t\t\tsid = tag.sid || sid;\r\n\t\t\t\t\ttid = tag.id || tag.tid || tid;\r\n\t\t\t\t}\r\n\t\t\t\tthis.afterUpdateCallback(sid, tid, action, tag, ganttMode);\r\n\t\t\t};\r\n\r\n\t\t\tlet actionPromise;\r\n\t\t\tif (this._router instanceof Function) {\r\n\t\t\t\tif(this._routerParametersFormat === \"object\"){\r\n\t\t\t\t\tconst obj = {\r\n\t\t\t\t\t\tentity: ganttMode,\r\n\t\t\t\t\t\taction: taskAction,\r\n\t\t\t\t\t\tdata: dataToSend,\r\n\t\t\t\t\t\tid: rowId\r\n\t\t\t\t\t};\r\n\t\t\t\t\tactionPromise = this._router(obj);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tactionPromise = this._router(ganttMode, taskAction, dataToSend, rowId);\r\n\t\t\t\t}\r\n\t\t\t} else if (this._router[ganttMode] instanceof Function) {\r\n\t\t\t\tactionPromise = this._router[ganttMode](taskAction, dataToSend, rowId);\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconst errorMsgStart = \"Incorrect configuration of gantt.createDataProcessor\";\r\n\t\t\t\tconst errorMsgEnd = `\r\nYou need to either add missing properties to the dataProcessor router object or to use a router function.\r\nSee https://docs.dhtmlx.com/gantt/desktop__server_side.html#customrouting and https://docs.dhtmlx.com/gantt/api__gantt_createdataprocessor.html for details.`;\r\n\r\n\t\t\t\tif(!this._router[ganttMode]){\r\n\t\t\t\t\tthrow new Error(`${errorMsgStart}: router for the **${ganttMode}** entity is not defined. ${errorMsgEnd}`);\r\n\t\t\t\t}\r\n\t\t\t\tswitch (taskState) {\r\n\t\t\t\t\tcase \"inserted\":\r\n\t\t\t\t\t\tif(!this._router[ganttMode].create){\r\n\t\t\t\t\t\t\tthrow new Error(`${errorMsgStart}: **create** action for the **${ganttMode}** entity is not defined. ${errorMsgEnd}`);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tactionPromise = this._router[ganttMode].create(dataToSend);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \"deleted\":\r\n\t\t\t\t\t\tif(!this._router[ganttMode].delete){\r\n\t\t\t\t\t\t\tthrow new Error(`${errorMsgStart}: **delete** action for the **${ganttMode}** entity is not defined. ${errorMsgEnd}`);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tactionPromise = this._router[ganttMode].delete(rowId);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\tif(!this._router[ganttMode].update){\r\n\t\t\t\t\t\t\tthrow new Error(`${errorMsgStart}: **update**\" action for the **${ganttMode}** entity is not defined. ${errorMsgEnd}`);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tactionPromise = this._router[ganttMode].update(dataToSend, rowId);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif(actionPromise){\r\n\t\t\t\t// neither promise nor {tid: newId} response object\r\n\t\t\t\tif(!actionPromise.then &&\r\n\t\t\t\t\t(actionPromise.id === undefined && actionPromise.tid === undefined && actionPromise.action === undefined)){\r\n\t\t\t\t\tthrow new Error(\"Incorrect router return value. A Promise or a response object is expected\");\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif(actionPromise.then){\r\n\t\t\t\t\tactionPromise.then(_onResolvedCreateUpdate).catch((error) => {\r\n\t\t\t\t\t\tif(error && error.action){\r\n\t\t\t\t\t\t\t_onResolvedCreateUpdate(error);\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t_onResolvedCreateUpdate({ action: \"error\", value: error});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t}else{\r\n\t\t\t\t\t// custom method may return a response object in case of sync action\r\n\t\t\t\t\t_onResolvedCreateUpdate(actionPromise);\r\n\t\t\t\t}\r\n\t\t\t}else{\r\n\t\t\t\t_onResolvedCreateUpdate(null);\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet queryParams: any;\r\n\t\tqueryParams = {\r\n\t\t\tcallback: (xml) => {\r\n\t\t\t\tconst ids = [];\r\n\r\n\t\t\t\tif (rowId) {\r\n\t\t\t\t\tids.push(rowId);\r\n\t\t\t\t} else if (dataToSend) {\r\n\t\t\t\t\tfor (const key in dataToSend) {\r\n\t\t\t\t\t\tids.push(key);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn this.afterUpdate(this, xml, ids);\r\n\t\t\t},\r\n\t\t\theaders: this._headers\r\n\t\t};\r\n\r\n\t\tconst dhxVersion = \"dhx_version=\" + this.$gantt.getUserData(0, \"version\", this._ganttMode);\r\n\t\tconst urlParams = this.serverProcessor + (this._user ? (ajax.urlSeparator(this.serverProcessor) + [\"dhx_user=\" + this._user, dhxVersion].join(\"&\")) : \"\");\r\n\t\tlet url: any = this._applyPayload(urlParams);\r\n\t\tlet data;\r\n\r\n\t\tswitch (this._tMode) {\r\n\t\t\tcase \"GET\":\r\n\t\t\t\tdata = this._cleanupArgumentsBeforeSend(dataToSend);\r\n\t\t\t\tqueryParams.url = url + ajax.urlSeparator(url) + this.serialize(data, rowId);\r\n\t\t\t\tqueryParams.method = \"GET\";\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"POST\":\r\n\t\t\t\tdata = this._cleanupArgumentsBeforeSend(dataToSend);\r\n\t\t\t\tqueryParams.url = url;\r\n\t\t\t\tqueryParams.method = \"POST\";\r\n\t\t\t\tqueryParams.data = this.serialize(data, rowId);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"JSON\":\r\n\t\t\t\tdata = {};\r\n\t\t\t\tconst preprocessedData = this._cleanupItemBeforeSend(dataToSend);\r\n\t\t\t\tfor (const key in preprocessedData) {\r\n\t\t\t\t\tif (key === this.action_param || key === \"id\" || key === \"gr_id\") {\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdata[key] = preprocessedData[key];\r\n\t\t\t\t}\r\n\r\n\t\t\t\tqueryParams.url = url;\r\n\t\t\t\tqueryParams.method = \"POST\";\r\n\t\t\t\tqueryParams.data = JSON.stringify({\r\n\t\t\t\t\tid: rowId,\r\n\t\t\t\t\taction: dataToSend[this.action_param],\r\n\t\t\t\t\tdata\r\n\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"REST\":\r\n\t\t\tcase \"REST-JSON\":\r\n\t\t\t\turl = urlParams.replace(/(&|\\?)editing=true/, \"\");\r\n\t\t\t\tdata = \"\";\r\n\r\n\t\t\t\tswitch (this.getState(rowId)) {\r\n\t\t\t\t\tcase \"inserted\":\r\n\t\t\t\t\t\tqueryParams.method = \"POST\";\r\n\t\t\t\t\t\tqueryParams.data = this.serialize(dataToSend, rowId);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \"deleted\":\r\n\t\t\t\t\t\tqueryParams.method = \"DELETE\";\r\n\t\t\t\t\t\turl = url + (url.slice(-1) === \"/\" ? \"\" : \"/\") + rowId;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\tqueryParams.method = \"PUT\";\r\n\t\t\t\t\t\tqueryParams.data = this.serialize(dataToSend, rowId);\r\n\t\t\t\t\t\turl = url + (url.slice(-1) === \"/\" ? \"\" : \"/\") + rowId;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tqueryParams.url = this._applyPayload(url);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\tthis._waitMode++;\r\n\t\treturn ajax.query(queryParams);\r\n\t}\r\n\r\n\tprotected _forEachUpdatedRow(code: any) {\r\n\t\tconst updatedRows = this.updatedRows.slice();\r\n\t\tfor (let i = 0; i < updatedRows.length; i++) {\r\n\t\t\tconst rowId = updatedRows[i];\r\n\t\t\tif (this.$gantt.getUserData(rowId, this.action_param, this._ganttMode)) {\r\n\t\t\t\tcode.call(this, rowId);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tprotected _setDefaultTransactionMode() {\r\n\t\tif (this.serverProcessor) {\r\n\t\t\tthis.setTransactionMode(\"POST\", true);\r\n\t\t\tthis.serverProcessor += (this.serverProcessor.indexOf(\"?\") !== -1 ? \"&\" : \"?\") + \"editing=true\";\r\n\t\t\tthis._serverProcessor = this.serverProcessor;\r\n\t\t}\r\n\t}\r\n\r\n\t/* returns xml node value\r\n\t\t@param node\r\n\t\t\txml node\r\n\t*/\r\n\tprotected _getXmlNodeValue(node) {\r\n\t\tif (node.firstChild) {\r\n\t\t\treturn node.firstChild.nodeValue;\r\n\t\t}\r\n\t\treturn \"\";\r\n\t}\r\n\r\n\tprotected _getAllData() {\r\n\t\tconst out = {};\r\n\t\tlet hasOne = false;\r\n\r\n\t\tthis._forEachUpdatedRow(function(id) {\r\n\t\t\tif (this._in_progress[id] || this.is_invalid(id)){\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tconst row = this._getRowData(id);\r\n\t\t\tif (!this.callEvent(\"onBeforeUpdate\", [id, this.getState(id), row])) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tout[id] = row;\r\n\t\t\thasOne = true;\r\n\t\t\tthis._in_progress[id] = (new Date()).valueOf();\r\n\t\t});\r\n\r\n\t\treturn hasOne ? out : null;\r\n\t}\r\n\r\n\tprotected _prepareDate(value: Date) : string {\r\n\t\treturn this.$gantt.defined(this.$gantt.templates.xml_format) ? this.$gantt.templates.xml_format(value) : this.$gantt.templates.format_date(value);\r\n\t}\r\n\r\n\tprotected _prepareArray(value: any[], traversedObjects: object[]) : any[] {\r\n\t\ttraversedObjects.push(value);\r\n\r\n\t\treturn value.map((item) => {\r\n\t\t\tif(helpers.isDate(item)){\r\n\t\t\t\treturn this._prepareDate(item);\r\n\t\t\t} else if (Array.isArray(item) && !helpers.arrayIncludes(traversedObjects, item)){\r\n\t\t\t\treturn this._prepareArray(item, traversedObjects);\r\n\t\t\t} else if (item && typeof item === \"object\" && !helpers.arrayIncludes(traversedObjects, item)) {\r\n\t\t\t\treturn this._prepareObject(item, traversedObjects);\r\n\t\t\t} else {\r\n\t\t\t\treturn item;\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tprotected _prepareObject(rawItem: any, traversedObjects: object[]) : any {\r\n\t\tconst processedItem = {};\r\n\t\ttraversedObjects.push(rawItem);\r\n\r\n\t\tfor (const key in rawItem) {\r\n\t\t\tif (key.substr(0, 1) === \"$\") {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\tconst value = rawItem[key];\r\n\t\t\tif (helpers.isDate(value)) {\r\n\t\t\t\tprocessedItem[key] = this._prepareDate(value);\r\n\t\t\t} else if(value === null) {\r\n\t\t\t\tprocessedItem[key] = \"\";\r\n\t\t\t} else if (Array.isArray(value) && !helpers.arrayIncludes(traversedObjects, value)){\r\n\t\t\t\tprocessedItem[key] = this._prepareArray(value, traversedObjects);\r\n\t\t\t} else if (value && typeof value === \"object\" && !helpers.arrayIncludes(traversedObjects, value)) {\r\n\t\t\t\tprocessedItem[key] = this._prepareObject(value, traversedObjects);\r\n\t\t\t} else {\r\n\t\t\t\tprocessedItem[key] = value;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn processedItem;\r\n\t}\r\n\r\n\tprotected _prepareDataItem(rawItem: any): any {\r\n\t\tconst processedItem = this._prepareObject(rawItem, []);\r\n\r\n\t\tprocessedItem[this.action_param] = this.$gantt.getUserData(rawItem.id, this.action_param, this._ganttMode);\r\n\t\treturn processedItem;\r\n\t}\r\n\r\n\tprotected getStoredItem(id){\r\n\t\treturn this._storage.getStoredItem(id);\r\n\t}\r\n\r\n\tprotected _getRowData(id) {\r\n\t\tlet dataItem;\r\n\t\tconst gantt = this.$gantt;\r\n\t\tif (this.getGanttMode() === \"task\") {\r\n\t\t\tif(gantt.isTaskExists(id)){\r\n\t\t\t\tdataItem =this.$gantt.getTask(id);\r\n\t\t\t}\r\n\t\t} else if (this.getGanttMode() === \"assignment\") {\r\n\t\t\tif(this.$gantt.$data.assignmentsStore.exists(id)){\r\n\t\t\t\tdataItem =this.$gantt.$data.assignmentsStore.getItem(id);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif(gantt.isLinkExists(id)){\r\n\t\t\t\tdataItem =this.$gantt.getLink(id);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (!dataItem) {\r\n\t\t\tdataItem = this.getStoredItem(id);\r\n\t\t}\r\n\r\n\t\tif (!dataItem) {\r\n\t\t\tdataItem = { id };\r\n\t\t}\r\n\r\n\t\treturn this._prepareDataItem(dataItem);\r\n\t}\r\n}","var DataProcessor = require(\"./data_processor\");\n\nmodule.exports = {\n DEPRECATED_api: function DEPRECATED_api(server) {\n return new DataProcessor.DataProcessor(server);\n },\n createDataProcessor: DataProcessor.createDataProcessor,\n getDataProcessorModes: DataProcessor.getAvailableModes\n};","var isHeadless = require(\"../../utils/is_headless\");\n\nvar storeRenderCreator = function storeRenderCreator(name, gantt) {\n var store = gantt.getDatastore(name);\n var itemRepainter = {\n renderItem: function renderItem(id, renderer) {\n var renders = renderer.getLayers();\n var item = store.getItem(id);\n\n if (item && store.isVisible(id)) {\n for (var i = 0; i < renders.length; i++) {\n renders[i].render_item(item);\n }\n }\n },\n renderItems: function renderItems(renderer) {\n var renderers = renderer.getLayers();\n\n for (var i = 0; i < renderers.length; i++) {\n renderers[i].clear();\n }\n\n var allData = null;\n var loadedRanges = {};\n\n for (var _i = 0; _i < renderers.length; _i++) {\n var layer = renderers[_i];\n var layerData = void 0;\n\n if (layer.get_visible_range) {\n var range = layer.get_visible_range(store);\n\n if (range.start !== undefined && range.end !== undefined) {\n var key = range.start + \" - \" + range.end;\n\n if (loadedRanges[key]) {\n layerData = loadedRanges[key];\n } else {\n layerData = store.getIndexRange(range.start, range.end);\n loadedRanges[key] = layerData;\n }\n } else if (range.ids !== undefined) {\n layerData = range.ids.map(function (id) {\n return store.getItem(id);\n });\n } else {\n throw new Error(\"Invalid range returned from 'getVisibleRange' of the layer\");\n }\n } else {\n if (!allData) {\n allData = store.getVisibleItems();\n }\n\n layerData = allData;\n }\n\n if (layer.prepare_data) {\n // GS-1605. Highlight timeline cells below tasks and in an empty chart\n layer.prepare_data(layerData);\n }\n\n renderers[_i].render_items(layerData);\n }\n },\n updateItems: function updateItems(layer) {\n if (layer.update_items) {\n var data;\n\n if (layer.get_visible_range) {\n var range = layer.get_visible_range(store);\n\n if (range.start !== undefined && range.end !== undefined) {\n data = store.getIndexRange(range.start, range.end);\n } else if (range.ids !== undefined) {\n data = range.ids.map(function (id) {\n return store.getItem(id);\n });\n } else {\n throw new Error(\"Invalid range returned from 'getVisibleRange' of the layer\");\n }\n } else {\n data = store.getVisibleItems();\n }\n\n if (layer.prepare_data) {\n // GS-1605. Highlight timeline cells below tasks and in an empty chart\n layer.prepare_data(data, layer);\n }\n\n layer.update_items(data);\n }\n }\n };\n store.attachEvent(\"onStoreUpdated\", function (id, item, action) {\n if (isHeadless(gantt)) {\n return true;\n }\n\n var renderer = gantt.$services.getService(\"layers\").getDataRender(name);\n\n if (renderer) {\n renderer.onUpdateRequest = function (layer) {\n itemRepainter.updateItems(layer);\n };\n }\n });\n\n function skipRepaint(gantt) {\n var state = gantt.$services.getService(\"state\");\n\n if (state.getState(\"batchUpdate\").batch_update) {\n return true;\n } else {\n return false;\n }\n }\n\n store.attachEvent(\"onStoreUpdated\", function (id, item, action) {\n if (skipRepaint(gantt)) {\n return;\n }\n\n if (!id || action == \"move\" || action == \"delete\") {\n store.callEvent(\"onBeforeRefreshAll\", []);\n store.callEvent(\"onAfterRefreshAll\", []);\n } else {\n store.callEvent(\"onBeforeRefreshItem\", [item.id]);\n store.callEvent(\"onAfterRefreshItem\", [item.id]);\n }\n });\n store.attachEvent(\"onAfterRefreshAll\", function () {\n if (isHeadless(gantt)) {\n return true;\n }\n\n var renderer = gantt.$services.getService(\"layers\").getDataRender(name);\n\n if (renderer && !skipRepaint(gantt)) {\n itemRepainter.renderItems(renderer);\n }\n });\n store.attachEvent(\"onAfterRefreshItem\", function (id) {\n if (isHeadless(gantt)) {\n return true;\n }\n\n var renderer = gantt.$services.getService(\"layers\").getDataRender(name);\n\n if (renderer) {\n itemRepainter.renderItem(id, renderer);\n }\n }); // TODO: probably can be done more in a more efficient way\n\n store.attachEvent(\"onItemOpen\", function () {\n if (isHeadless(gantt)) {\n return true;\n }\n\n gantt.render();\n });\n store.attachEvent(\"onItemClose\", function () {\n if (isHeadless(gantt)) {\n return true;\n }\n\n gantt.render();\n });\n\n function refreshId(renders, oldId, newId, item) {\n for (var i = 0; i < renders.length; i++) {\n renders[i].change_id(oldId, newId);\n }\n }\n\n store.attachEvent(\"onIdChange\", function (oldId, newId) {\n if (isHeadless(gantt)) {\n return true;\n } // in case of linked datastores (tasks <-> links), id change should recalculate something in linked datastore before any repaint\n // use onBeforeIdChange for this hook.\n // TODO: use something more reasonable instead\n\n\n store.callEvent(\"onBeforeIdChange\", [oldId, newId]);\n\n if (skipRepaint(gantt)) {\n return;\n }\n\n if (!store.isSilent()) {\n var renderer = gantt.$services.getService(\"layers\").getDataRender(name);\n\n if (renderer) {\n // missing check for renderer GS-1814\n refreshId(renderer.getLayers(), oldId, newId, store.getItem(newId));\n itemRepainter.renderItem(newId, renderer);\n } else {\n // GS-1814 repaint ui to apply new id when the datastore don't have own renderer\n gantt.render();\n }\n }\n });\n};\n\nmodule.exports = {\n bindDataStore: storeRenderCreator\n};","function createDataStoreSelectMixin(store) {\n var selectedId = null;\n var deleteItem = store._removeItemInner;\n\n function _unselect(id) {\n selectedId = null;\n this.callEvent(\"onAfterUnselect\", [id]);\n }\n\n store._removeItemInner = function (id) {\n if (selectedId == id) {\n _unselect.call(this, id);\n }\n\n if (selectedId && this.eachItem) {\n this.eachItem(function (subItem) {\n if (subItem.id == selectedId) {\n _unselect.call(this, subItem.id);\n }\n }, id);\n }\n\n return deleteItem.apply(this, arguments);\n };\n\n store.attachEvent(\"onIdChange\", function (oldId, newId) {\n if (store.getSelectedId() == oldId) {\n store.silent(function () {\n store.unselect(oldId);\n store.select(newId);\n });\n }\n });\n return {\n select: function select(id) {\n if (id) {\n if (selectedId == id) return selectedId;\n\n if (!this._skip_refresh) {\n if (!this.callEvent(\"onBeforeSelect\", [id])) {\n return false;\n }\n }\n\n this.unselect();\n selectedId = id;\n\n if (!this._skip_refresh) {\n this.refresh(id);\n this.callEvent(\"onAfterSelect\", [id]);\n }\n }\n\n return selectedId;\n },\n getSelectedId: function getSelectedId() {\n return selectedId;\n },\n isSelected: function isSelected(id) {\n return id == selectedId;\n },\n unselect: function unselect(id) {\n var id = id || selectedId;\n if (!id) return;\n selectedId = null;\n\n if (!this._skip_refresh) {\n this.refresh(id);\n\n _unselect.call(this, id);\n }\n }\n };\n}\n\nmodule.exports = createDataStoreSelectMixin;","var utils = require(\"../../utils/utils\");\n\nvar createLinksStoreFacade = function createLinksStoreFacade() {\n return {\n getLinkCount: function getLinkCount() {\n return this.$data.linksStore.count();\n },\n getLink: function getLink(id) {\n return this.$data.linksStore.getItem(id);\n },\n getLinks: function getLinks() {\n return this.$data.linksStore.getItems();\n },\n isLinkExists: function isLinkExists(id) {\n return this.$data.linksStore.exists(id);\n },\n addLink: function addLink(link) {\n var newLink = this.$data.linksStore.addItem(link); // GS-1222. Update fullOrder otherwise the link won't appear after render\n\n if (this.$data.linksStore.isSilent()) {\n this.$data.linksStore.fullOrder.push(newLink);\n }\n\n return newLink;\n },\n updateLink: function updateLink(id, data) {\n if (!utils.defined(data)) data = this.getLink(id);\n this.$data.linksStore.updateItem(id, data);\n },\n deleteLink: function deleteLink(id) {\n return this.$data.linksStore.removeItem(id);\n },\n changeLinkId: function changeLinkId(oldid, newid) {\n return this.$data.linksStore.changeId(oldid, newid);\n }\n };\n};\n\nmodule.exports = createLinksStoreFacade;","var utils = require(\"../../utils/utils\");\n\nvar _require = require(\"../../utils/helpers\"),\n replaceValidZeroId = _require.replaceValidZeroId;\n\nvar createTasksDatastoreFacade = function createTasksDatastoreFacade() {\n return {\n getTask: function getTask(id) {\n id = replaceValidZeroId(id, this.config.root_id);\n this.assert(id, \"Invalid argument for gantt.getTask\");\n var task = this.$data.tasksStore.getItem(id);\n this.assert(task, \"Task not found id=\" + id);\n return task;\n },\n getTaskByTime: function getTaskByTime(from, to) {\n var p = this.$data.tasksStore.getItems();\n var res = [];\n\n if (!(from || to)) {\n res = p;\n } else {\n from = +from || -Infinity;\n to = +to || Infinity;\n\n for (var t = 0; t < p.length; t++) {\n var task = p[t];\n if (+task.start_date < to && +task.end_date > from) res.push(task);\n }\n }\n\n return res;\n },\n isTaskExists: function isTaskExists(id) {\n if (!this.$data || !this.$data.tasksStore) {\n return false;\n }\n\n return this.$data.tasksStore.exists(id);\n },\n updateTask: function updateTask(id, item) {\n if (!utils.defined(item)) item = this.getTask(id);\n this.$data.tasksStore.updateItem(id, item);\n if (this.isTaskExists(id)) this.refreshTask(id);\n },\n addTask: function addTask(item, parent, index) {\n if (!utils.defined(item.id)) item.id = utils.uid(); //GS-761: assert unique ID\n\n if (this.isTaskExists(item.id)) {\n var task = this.getTask(item.id);\n\n if (task.$index != item.$index) {\n // Someone may try to mistakenly add a task with the same ID, and most likely\n // use the string format for the dates. Gantt shouldn't break in this scenario\n if (item.start_date && typeof item.start_date === \"string\") {\n item.start_date = this.date.parseDate(item.start_date, \"parse_date\");\n }\n\n if (item.end_date && typeof item.end_date === \"string\") {\n item.end_date = this.date.parseDate(item.end_date, \"parse_date\");\n }\n\n return this.$data.tasksStore.updateItem(item.id, item);\n }\n }\n\n if (!utils.defined(parent)) parent = this.getParent(item) || 0;\n if (!this.isTaskExists(parent)) parent = this.config.root_id;\n this.setParent(item, parent);\n return this.$data.tasksStore.addItem(item, index, parent);\n },\n deleteTask: function deleteTask(id) {\n id = replaceValidZeroId(id, this.config.root_id);\n return this.$data.tasksStore.removeItem(id);\n },\n getTaskCount: function getTaskCount() {\n return this.$data.tasksStore.count();\n },\n getVisibleTaskCount: function getVisibleTaskCount() {\n return this.$data.tasksStore.countVisible();\n },\n getTaskIndex: function getTaskIndex(id) {\n return this.$data.tasksStore.getBranchIndex(id);\n },\n getGlobalTaskIndex: function getGlobalTaskIndex(id) {\n id = replaceValidZeroId(id, this.config.root_id);\n this.assert(id, \"Invalid argument\");\n return this.$data.tasksStore.getIndexById(id);\n },\n eachTask: function eachTask(code, parent, master) {\n return this.$data.tasksStore.eachItem(utils.bind(code, master || this), parent);\n },\n eachParent: function eachParent(callback, startTask, master) {\n return this.$data.tasksStore.eachParent(utils.bind(callback, master || this), startTask);\n },\n changeTaskId: function changeTaskId(oldid, newid) {\n this.$data.tasksStore.changeId(oldid, newid);\n var task = this.$data.tasksStore.getItem(newid);\n var links = [];\n\n if (task.$source) {\n links = links.concat(task.$source);\n }\n\n if (task.$target) {\n links = links.concat(task.$target);\n }\n\n for (var i = 0; i < links.length; i++) {\n var link = this.getLink(links[i]);\n\n if (link.source == oldid) {\n link.source = newid;\n }\n\n if (link.target == oldid) {\n link.target = newid;\n }\n }\n },\n calculateTaskLevel: function calculateTaskLevel(item) {\n return this.$data.tasksStore.calculateItemLevel(item);\n },\n getNext: function getNext(id) {\n return this.$data.tasksStore.getNext(id);\n },\n getPrev: function getPrev(id) {\n return this.$data.tasksStore.getPrev(id);\n },\n getParent: function getParent(id) {\n return this.$data.tasksStore.getParent(id);\n },\n setParent: function setParent(task, new_pid, silent) {\n return this.$data.tasksStore.setParent(task, new_pid, silent);\n },\n getSiblings: function getSiblings(id) {\n return this.$data.tasksStore.getSiblings(id).slice();\n },\n getNextSibling: function getNextSibling(id) {\n return this.$data.tasksStore.getNextSibling(id);\n },\n getPrevSibling: function getPrevSibling(id) {\n return this.$data.tasksStore.getPrevSibling(id);\n },\n getTaskByIndex: function getTaskByIndex(index) {\n var id = this.$data.tasksStore.getIdByIndex(index);\n\n if (this.isTaskExists(id)) {\n return this.getTask(id);\n } else {\n return null;\n }\n },\n getChildren: function getChildren(id) {\n if (!this.hasChild(id)) {\n return [];\n } else {\n return this.$data.tasksStore.getChildren(id).slice();\n }\n },\n hasChild: function hasChild(id) {\n return this.$data.tasksStore.hasChild(id);\n },\n open: function open(id) {\n this.$data.tasksStore.open(id);\n },\n close: function close(id) {\n this.$data.tasksStore.close(id);\n },\n moveTask: function moveTask(sid, tindex, parent) {\n parent = replaceValidZeroId(parent, this.config.root_id);\n return this.$data.tasksStore.move.apply(this.$data.tasksStore, arguments);\n },\n sort: function sort(field, desc, parent, silent) {\n var render = !silent; //4th argument to cancel redraw after sorting\n\n this.$data.tasksStore.sort(field, desc, parent);\n this.callEvent(\"onAfterSort\", [field, desc, parent]);\n\n if (render) {\n this.render();\n }\n }\n };\n};\n\nmodule.exports = createTasksDatastoreFacade;","var utils = require(\"../../utils/utils\");\n\nvar createTasksFacade = require(\"./datastore_tasks\"),\n createLinksFacade = require(\"./datastore_links\"),\n DataStore = require(\"../datastore/datastore\"),\n TreeDataStore = require(\"../datastore/treedatastore\"),\n createDatastoreSelect = require(\"../datastore/select\");\n\nvar datastoreRender = require(\"../datastore/datastore_render\");\n\nvar isHeadless = require(\"../../utils/is_headless\");\n\nvar _require = require(\"../../utils/helpers\"),\n replaceValidZeroId = _require.replaceValidZeroId; // TODO: remove workaround for mixup with es5 and ts imports\n\n\nif (DataStore[\"default\"]) {\n DataStore = DataStore[\"default\"];\n}\n\nfunction getDatastores() {\n var storeNames = this.$services.getService(\"datastores\");\n var res = [];\n\n for (var i = 0; i < storeNames.length; i++) {\n var store = this.getDatastore(storeNames[i]);\n\n if (!store.$destroyed) {\n res.push(store);\n }\n }\n\n return res;\n}\n\nvar createDatastoreFacade = function createDatastoreFacade() {\n return {\n createDatastore: function createDatastore(config) {\n var $StoreType = (config.type || \"\").toLowerCase() == \"treedatastore\" ? TreeDataStore : DataStore;\n\n if (config) {\n var self = this;\n\n config.openInitially = function () {\n return self.config.open_tree_initially;\n };\n\n config.copyOnParse = function () {\n return self.config.deepcopy_on_parse;\n };\n }\n\n var store = new $StoreType(config);\n this.mixin(store, createDatastoreSelect(store));\n\n if (config.name) {\n var servicePrefix = \"datastore:\";\n var storeAccessName = servicePrefix + config.name;\n store.attachEvent(\"onDestroy\", function () {\n this.$services.dropService(storeAccessName);\n var storeList = this.$services.getService(\"datastores\");\n\n for (var i = 0; i < storeList.length; i++) {\n if (storeList[i] === config.name) {\n storeList.splice(i, 1);\n break;\n }\n }\n }.bind(this));\n this.$services.dropService(storeAccessName);\n this.$services.setService(storeAccessName, function () {\n return store;\n });\n var storeList = this.$services.getService(\"datastores\");\n\n if (!storeList) {\n storeList = [];\n this.$services.setService(\"datastores\", function () {\n return storeList;\n });\n storeList.push(config.name);\n } else if (storeList.indexOf(config.name) < 0) {\n storeList.push(config.name);\n }\n\n datastoreRender.bindDataStore(config.name, this);\n }\n\n return store;\n },\n getDatastore: function getDatastore(name) {\n return this.$services.getService(\"datastore:\" + name);\n },\n _getDatastores: getDatastores,\n refreshData: function refreshData() {\n var scrollState;\n\n if (!isHeadless(this)) {\n scrollState = this.getScrollState();\n }\n\n this.callEvent(\"onBeforeDataRender\", []);\n var stores = getDatastores.call(this);\n\n for (var i = 0; i < stores.length; i++) {\n stores[i].refresh();\n }\n\n if (this.config.preserve_scroll && !isHeadless(this) && (scrollState.x || scrollState.y)) {\n this.scrollTo(scrollState.x, scrollState.y);\n }\n\n this.callEvent(\"onDataRender\", []);\n },\n isChildOf: function isChildOf(childId, parentId) {\n return this.$data.tasksStore.isChildOf(childId, parentId);\n },\n refreshTask: function refreshTask(taskId, refresh_links) {\n var task = this.getTask(taskId);\n var self = this;\n\n function refreshLinks() {\n if (refresh_links !== undefined && !refresh_links) return;\n\n for (var i = 0; i < task.$source.length; i++) {\n self.refreshLink(task.$source[i]);\n }\n\n for (var i = 0; i < task.$target.length; i++) {\n self.refreshLink(task.$target[i]);\n }\n }\n\n if (task && this.isTaskVisible(taskId)) {\n this.$data.tasksStore.refresh(taskId, !!this.getState(\"tasksDnd\").drag_id || refresh_links === false); // do quick refresh during drag and drop\n\n refreshLinks();\n } else if (this.isTaskExists(taskId) && this.isTaskExists(this.getParent(taskId)) && !this._bulk_dnd) {\n this.refreshTask(this.getParent(taskId));\n var hasSplitParent = false;\n this.eachParent(function (parent) {\n if (hasSplitParent || this.isSplitTask(parent)) {\n hasSplitParent = true;\n }\n }, taskId);\n\n if (hasSplitParent) {\n refreshLinks();\n }\n }\n },\n refreshLink: function refreshLink(linkId) {\n this.$data.linksStore.refresh(linkId, !!this.getState(\"tasksDnd\").drag_id); // do quick refresh during drag and drop\n },\n silent: function silent(code) {\n var gantt = this;\n gantt.$data.tasksStore.silent(function () {\n gantt.$data.linksStore.silent(function () {\n code();\n });\n });\n },\n clearAll: function clearAll() {\n var stores = getDatastores.call(this); // clear all stores without invoking clearAll event\n // in order to prevent calling handlers when only some stores are cleared\n\n for (var i = 0; i < stores.length; i++) {\n stores[i].silent(function () {\n stores[i].clearAll();\n });\n } // run clearAll again to invoke events\n\n\n for (var i = 0; i < stores.length; i++) {\n stores[i].clearAll();\n }\n\n this._update_flags();\n\n this.userdata = {};\n this.callEvent(\"onClear\", []);\n this.render();\n },\n _clear_data: function _clear_data() {\n this.$data.tasksStore.clearAll();\n this.$data.linksStore.clearAll();\n\n this._update_flags();\n\n this.userdata = {};\n },\n selectTask: function selectTask(id) {\n var store = this.$data.tasksStore;\n if (!this.config.select_task) return false;\n id = replaceValidZeroId(id, this.config.root_id);\n\n if (id) {\n var oldSelectId = this.getSelectedId();\n store.select(id); // GS-730. Split task is not included in the tree, \n // so the datastore renderer will think that the task is not visible\n\n if (oldSelectId && store.pull[oldSelectId].$split_subtask && oldSelectId != id) {\n this.refreshTask(oldSelectId);\n }\n\n if (store.pull[id].$split_subtask && oldSelectId != id) {\n // GS-1850. Do not repaint split task after double click\n this.refreshTask(id);\n }\n }\n\n return store.getSelectedId();\n },\n unselectTask: function unselectTask(id) {\n var store = this.$data.tasksStore;\n store.unselect(id); // GS-730. Split task is not included in the tree, \n // so the datastore renderer will think that the task is not visible\n\n if (id && store.pull[id].$split_subtask) {\n this.refreshTask(id);\n }\n },\n isSelectedTask: function isSelectedTask(id) {\n return this.$data.tasksStore.isSelected(id);\n },\n getSelectedId: function getSelectedId() {\n return this.$data.tasksStore.getSelectedId();\n }\n };\n};\n\nfunction createFacade() {\n var res = utils.mixin({}, createDatastoreFacade());\n utils.mixin(res, createTasksFacade());\n utils.mixin(res, createLinksFacade());\n return res;\n}\n\nmodule.exports = {\n create: createFacade\n};","var utils = require(\"../../utils/utils\");\n\nvar facadeFactory = require(\"./../facades/datastore\");\n\nvar calculateScaleRange = require(\"../gantt_data_range\");\n\nvar isPlaceholderTask = require(\"../../utils/placeholder_task\");\n\nfunction initDataStores(gantt) {\n var facade = facadeFactory.create();\n utils.mixin(gantt, facade);\n var tasksStore = gantt.createDatastore({\n name: \"task\",\n type: \"treeDatastore\",\n rootId: function rootId() {\n return gantt.config.root_id;\n },\n initItem: utils.bind(_init_task, gantt),\n getConfig: function getConfig() {\n return gantt.config;\n }\n });\n var linksStore = gantt.createDatastore({\n name: \"link\",\n initItem: utils.bind(_init_link, gantt)\n });\n gantt.attachEvent(\"onDestroy\", function () {\n tasksStore.destructor();\n linksStore.destructor();\n });\n gantt.attachEvent(\"onLinkValidation\", function (link) {\n if (gantt.isLinkExists(link.id) || link.id === \"predecessor_generated\") {\n // link was already added into gantt\n return true;\n }\n\n var source = gantt.getTask(link.source);\n var taskLinks = source.$source;\n\n for (var i = 0; i < taskLinks.length; i++) {\n var existingLink = gantt.getLink(taskLinks[i]);\n var sourceMatch = link.source == existingLink.source;\n var targetMatch = link.target == existingLink.target;\n var typeMatch = link.type == existingLink.type; // prevent creating duplicated links from the UI\n\n if (sourceMatch && targetMatch && typeMatch) {\n return false;\n }\n }\n\n return true;\n });\n tasksStore.attachEvent(\"onBeforeRefreshAll\", function () {\n var order = tasksStore.getVisibleItems();\n\n for (var i = 0; i < order.length; i++) {\n var item = order[i];\n item.$index = i;\n item.$local_index = gantt.getTaskIndex(item.id);\n gantt.resetProjectDates(item);\n }\n });\n tasksStore.attachEvent(\"onFilterItem\", function (id, task) {\n if (gantt.config.show_tasks_outside_timescale) {\n return true;\n }\n\n var min = null,\n max = null;\n\n if (gantt.config.start_date && gantt.config.end_date) {\n if (gantt._isAllowedUnscheduledTask(task)) return true;\n min = gantt.config.start_date.valueOf();\n max = gantt.config.end_date.valueOf();\n if (+task.start_date > max || +task.end_date < +min) return false;\n }\n\n return true;\n });\n tasksStore.attachEvent(\"onIdChange\", function (oldId, newId) {\n gantt._update_flags(oldId, newId);\n\n var changedTask = gantt.getTask(newId);\n\n if (!tasksStore.isSilent()) {\n if (changedTask.$split_subtask || changedTask.rollup) {\n gantt.eachParent(function (parent) {\n gantt.refreshTask(parent.id);\n }, newId);\n }\n }\n });\n tasksStore.attachEvent(\"onAfterUpdate\", function (id) {\n gantt._update_parents(id);\n\n if (gantt.getState(\"batchUpdate\").batch_update) {\n return true;\n }\n\n var task = tasksStore.getItem(id);\n if (!task.$source) task.$source = [];\n\n for (var i = 0; i < task.$source.length; i++) {\n linksStore.refresh(task.$source[i]);\n }\n\n if (!task.$target) task.$target = [];\n\n for (var i = 0; i < task.$target.length; i++) {\n linksStore.refresh(task.$target[i]);\n }\n });\n tasksStore.attachEvent(\"onBeforeItemMove\", function (sid, parent, tindex) {\n // GS-125. Don't allow users to move the placeholder task\n if (isPlaceholderTask(sid, gantt, tasksStore)) {\n //eslint-disable-next-line\n console.log(\"The placeholder task cannot be moved to another position.\");\n return false;\n }\n\n return true;\n });\n tasksStore.attachEvent(\"onAfterItemMove\", function (sid, parent, tindex) {\n var source = gantt.getTask(sid);\n\n if (this.getNextSibling(sid) !== null) {\n source.$drop_target = this.getNextSibling(sid);\n } else if (this.getPrevSibling(sid) !== null) {\n source.$drop_target = \"next:\" + this.getPrevSibling(sid);\n } else {\n source.$drop_target = \"next:null\";\n }\n });\n tasksStore.attachEvent(\"onStoreUpdated\", function (id, item, action) {\n if (action == \"delete\") {\n gantt._update_flags(id, null);\n }\n\n var state = gantt.$services.getService(\"state\");\n\n if (state.getState(\"batchUpdate\").batch_update) {\n return;\n }\n\n if (gantt.config.fit_tasks && action !== \"paint\") {\n var oldState = gantt.getState();\n calculateScaleRange(gantt);\n var newState = gantt.getState(); //this._init_tasks_range();\n\n if (+oldState.min_date != +newState.min_date || +oldState.max_date != +newState.max_date) {\n gantt.render();\n gantt.callEvent(\"onScaleAdjusted\", []);\n return true;\n }\n }\n\n if (action == \"add\" || action == \"move\" || action == \"delete\") {\n if (gantt.$layout) {\n gantt.$layout.resize();\n }\n } else if (!id) {\n linksStore.refresh();\n }\n });\n linksStore.attachEvent(\"onAfterAdd\", function (id, link) {\n sync_link(link);\n });\n linksStore.attachEvent(\"onAfterUpdate\", function (id, link) {\n sync_links();\n });\n linksStore.attachEvent(\"onAfterDelete\", function (id, link) {\n sync_link_delete(link);\n });\n linksStore.attachEvent(\"onBeforeIdChange\", function (oldId, newId) {\n sync_link_delete(gantt.mixin({\n id: oldId\n }, gantt.$data.linksStore.getItem(newId)));\n sync_link(gantt.$data.linksStore.getItem(newId));\n });\n\n function checkLinkedTaskVisibility(taskId) {\n var isVisible = gantt.isTaskVisible(taskId);\n\n if (!isVisible && gantt.isTaskExists(taskId)) {\n var parent = gantt.getParent(taskId);\n\n if (gantt.isTaskExists(parent) && gantt.isTaskVisible(parent)) {\n parent = gantt.getTask(parent);\n\n if (gantt.isSplitTask(parent)) {\n isVisible = true;\n }\n }\n }\n\n return isVisible;\n }\n\n linksStore.attachEvent(\"onFilterItem\", function (id, link) {\n if (!gantt.config.show_links) {\n return false;\n }\n\n var sourceVisible = checkLinkedTaskVisibility(link.source);\n var targetVisible = checkLinkedTaskVisibility(link.target);\n if (!(sourceVisible && targetVisible) || gantt._isAllowedUnscheduledTask(gantt.getTask(link.source)) || gantt._isAllowedUnscheduledTask(gantt.getTask(link.target))) return false;\n return gantt.callEvent(\"onBeforeLinkDisplay\", [id, link]);\n });\n\n (function () {\n // delete all connected links after task is deleted\n var treeHelper = require(\"../../utils/task_tree_helpers\");\n\n var deletedLinks = {};\n gantt.attachEvent(\"onBeforeTaskDelete\", function (id, item) {\n deletedLinks[id] = treeHelper.getSubtreeLinks(gantt, id);\n return true;\n });\n gantt.attachEvent(\"onAfterTaskDelete\", function (id, item) {\n if (deletedLinks[id]) {\n gantt.$data.linksStore.silent(function () {\n for (var i in deletedLinks[id]) {\n if (gantt.isLinkExists(i)) {\n gantt.$data.linksStore.removeItem(i);\n }\n\n sync_link_delete(deletedLinks[id][i]);\n }\n\n deletedLinks[id] = null;\n });\n }\n });\n })();\n\n gantt.attachEvent(\"onAfterLinkDelete\", function (id, link) {\n gantt.refreshTask(link.source);\n gantt.refreshTask(link.target);\n });\n gantt.attachEvent(\"onParse\", sync_links);\n mapEvents({\n source: linksStore,\n target: gantt,\n events: {\n \"onItemLoading\": \"onLinkLoading\",\n \"onBeforeAdd\": \"onBeforeLinkAdd\",\n \"onAfterAdd\": \"onAfterLinkAdd\",\n \"onBeforeUpdate\": \"onBeforeLinkUpdate\",\n \"onAfterUpdate\": \"onAfterLinkUpdate\",\n \"onBeforeDelete\": \"onBeforeLinkDelete\",\n \"onAfterDelete\": \"onAfterLinkDelete\",\n \"onIdChange\": \"onLinkIdChange\"\n }\n });\n mapEvents({\n source: tasksStore,\n target: gantt,\n events: {\n \"onItemLoading\": \"onTaskLoading\",\n \"onBeforeAdd\": \"onBeforeTaskAdd\",\n \"onAfterAdd\": \"onAfterTaskAdd\",\n \"onBeforeUpdate\": \"onBeforeTaskUpdate\",\n \"onAfterUpdate\": \"onAfterTaskUpdate\",\n \"onBeforeDelete\": \"onBeforeTaskDelete\",\n \"onAfterDelete\": \"onAfterTaskDelete\",\n \"onIdChange\": \"onTaskIdChange\",\n \"onBeforeItemMove\": \"onBeforeTaskMove\",\n \"onAfterItemMove\": \"onAfterTaskMove\",\n \"onFilterItem\": \"onBeforeTaskDisplay\",\n \"onItemOpen\": \"onTaskOpened\",\n \"onItemClose\": \"onTaskClosed\",\n \"onBeforeSelect\": \"onBeforeTaskSelected\",\n \"onAfterSelect\": \"onTaskSelected\",\n \"onAfterUnselect\": \"onTaskUnselected\"\n }\n });\n gantt.$data = {\n tasksStore: tasksStore,\n linksStore: linksStore\n };\n\n function sync_link(link) {\n if (gantt.isTaskExists(link.source)) {\n var sourceTask = gantt.getTask(link.source);\n sourceTask.$source = sourceTask.$source || [];\n sourceTask.$source.push(link.id);\n }\n\n if (gantt.isTaskExists(link.target)) {\n var targetTask = gantt.getTask(link.target);\n targetTask.$target = targetTask.$target || [];\n targetTask.$target.push(link.id);\n }\n }\n\n function sync_link_delete(link) {\n if (gantt.isTaskExists(link.source)) {\n var sourceTask = gantt.getTask(link.source);\n\n for (var i = 0; i < sourceTask.$source.length; i++) {\n if (sourceTask.$source[i] == link.id) {\n sourceTask.$source.splice(i, 1);\n break;\n }\n }\n }\n\n if (gantt.isTaskExists(link.target)) {\n var targetTask = gantt.getTask(link.target);\n\n for (var i = 0; i < targetTask.$target.length; i++) {\n if (targetTask.$target[i] == link.id) {\n targetTask.$target.splice(i, 1);\n break;\n }\n }\n }\n }\n\n function sync_links() {\n var task = null;\n var tasks = gantt.$data.tasksStore.getItems();\n\n for (var i = 0, len = tasks.length; i < len; i++) {\n task = tasks[i];\n task.$source = [];\n task.$target = [];\n }\n\n var links = gantt.$data.linksStore.getItems();\n\n for (var i = 0, len = links.length; i < len; i++) {\n var link = links[i];\n sync_link(link);\n }\n }\n\n function mapEvents(conf) {\n var mapFrom = conf.source;\n var mapTo = conf.target;\n\n for (var i in conf.events) {\n (function (sourceEvent, targetEvent) {\n mapFrom.attachEvent(sourceEvent, function () {\n return mapTo.callEvent(targetEvent, Array.prototype.slice.call(arguments));\n }, targetEvent);\n })(i, conf.events[i]);\n }\n }\n\n function _init_task(task) {\n if (!this.defined(task.id)) task.id = this.uid();\n if (task.start_date) task.start_date = gantt.date.parseDate(task.start_date, \"parse_date\");\n if (task.end_date) task.end_date = gantt.date.parseDate(task.end_date, \"parse_date\");\n var duration = null;\n\n if (task.duration || task.duration === 0) {\n task.duration = duration = task.duration * 1;\n }\n\n if (duration) {\n if (task.start_date && !task.end_date) {\n task.end_date = this.calculateEndDate(task);\n } else if (!task.start_date && task.end_date) {\n task.start_date = this.calculateEndDate({\n start_date: task.end_date,\n duration: -task.duration,\n task: task\n });\n } //task.$calculate_duration = false;\n\n }\n\n task.progress = Number(task.progress) || 0;\n\n if (this._isAllowedUnscheduledTask(task)) {\n this._set_default_task_timing(task);\n }\n\n this._init_task_timing(task);\n\n if (task.start_date && task.end_date) this.correctTaskWorkTime(task);\n task.$source = [];\n task.$target = [];\n var originalTask = this.$data.tasksStore.getItem(task.id);\n\n if (originalTask && !utils.defined(task.open)) {\n // if a task with the same id is already in the gantt and the new object doesn't specify the `open` state -\n // restore the `open` state we already have in the chart\n task.$open = originalTask.$open;\n }\n\n if (task.parent === undefined) {\n task.parent = this.config.root_id;\n }\n\n return task;\n }\n\n function _init_link(link) {\n if (!this.defined(link.id)) link.id = this.uid();\n return link;\n }\n}\n\nmodule.exports = initDataStores;","(function (global, undefined) {\n \"use strict\";\n\n if (global.setImmediate) {\n return;\n }\n\n var nextHandle = 1; // Spec says greater than zero\n\n var tasksByHandle = {};\n var currentlyRunningATask = false;\n var doc = global.document;\n var registerImmediate;\n\n function setImmediate(callback) {\n // Callback can either be a function or a string\n if (typeof callback !== \"function\") {\n callback = new Function(\"\" + callback);\n } // Copy function arguments\n\n\n var args = new Array(arguments.length - 1);\n\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i + 1];\n } // Store and register the task\n\n\n var task = {\n callback: callback,\n args: args\n };\n tasksByHandle[nextHandle] = task;\n registerImmediate(nextHandle);\n return nextHandle++;\n }\n\n function clearImmediate(handle) {\n delete tasksByHandle[handle];\n }\n\n function run(task) {\n var callback = task.callback;\n var args = task.args;\n\n switch (args.length) {\n case 0:\n callback();\n break;\n\n case 1:\n callback(args[0]);\n break;\n\n case 2:\n callback(args[0], args[1]);\n break;\n\n case 3:\n callback(args[0], args[1], args[2]);\n break;\n\n default:\n callback.apply(undefined, args);\n break;\n }\n }\n\n function runIfPresent(handle) {\n // From the spec: \"Wait until any invocations of this algorithm started before this one have completed.\"\n // So if we're currently running a task, we'll need to delay this invocation.\n if (currentlyRunningATask) {\n // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a\n // \"too much recursion\" error.\n setTimeout(runIfPresent, 0, handle);\n } else {\n var task = tasksByHandle[handle];\n\n if (task) {\n currentlyRunningATask = true;\n\n try {\n run(task);\n } finally {\n clearImmediate(handle);\n currentlyRunningATask = false;\n }\n }\n }\n }\n\n function installNextTickImplementation() {\n registerImmediate = function registerImmediate(handle) {\n process.nextTick(function () {\n runIfPresent(handle);\n });\n };\n }\n\n function canUsePostMessage() {\n // The test against `importScripts` prevents this implementation from being installed inside a web worker,\n // where `global.postMessage` means something completely different and can't be used for this purpose.\n if (global.postMessage && !global.importScripts) {\n var postMessageIsAsynchronous = true;\n var oldOnMessage = global.onmessage;\n\n global.onmessage = function () {\n postMessageIsAsynchronous = false;\n };\n\n global.postMessage(\"\", \"*\");\n global.onmessage = oldOnMessage;\n return postMessageIsAsynchronous;\n }\n }\n\n function installPostMessageImplementation() {\n // Installs an event handler on `global` for the `message` event: see\n // * https://developer.mozilla.org/en/DOM/window.postMessage\n // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages\n var messagePrefix = \"setImmediate$\" + Math.random() + \"$\";\n\n var onGlobalMessage = function onGlobalMessage(event) {\n if (event.source === global && typeof event.data === \"string\" && event.data.indexOf(messagePrefix) === 0) {\n runIfPresent(+event.data.slice(messagePrefix.length));\n }\n };\n\n if (global.addEventListener) {\n global.addEventListener(\"message\", onGlobalMessage, false);\n } else {\n global.attachEvent(\"onmessage\", onGlobalMessage);\n }\n\n registerImmediate = function registerImmediate(handle) {\n global.postMessage(messagePrefix + handle, \"*\");\n };\n }\n\n function installMessageChannelImplementation() {\n var channel = new MessageChannel();\n\n channel.port1.onmessage = function (event) {\n var handle = event.data;\n runIfPresent(handle);\n };\n\n registerImmediate = function registerImmediate(handle) {\n channel.port2.postMessage(handle);\n };\n }\n\n function installReadyStateChangeImplementation() {\n var html = doc.documentElement;\n\n registerImmediate = function registerImmediate(handle) {\n // Create a