diff --git a/README.md b/README.md index 26fc264..b5aab86 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.7](https://img.shields.io/badge/npm-v.8.0.7-blue.svg)](https://www.npmjs.com/package/dhtmlx-gantt) +[![npm: v.8.0.8](https://img.shields.io/badge/npm-v.8.0.8-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.8.0.7 Standard +dhtmlxGantt v.8.0.8 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 2794e9f..8ad5a65 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "gantt", - "version": "8.0.7", + "version": "8.0.8", "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 404d8a1..89da98f 100644 --- a/codebase/dhtmlxgantt.d.ts +++ b/codebase/dhtmlxgantt.d.ts @@ -1,4 +1,4 @@ -// Type definitions for dhtmlxGantt 8.0.7 +// Type definitions for dhtmlxGantt 8.0.8 // Project: https://dhtmlx.com/docs/products/dhtmlxGantt type GanttCallback = (...args: any[]) => any; diff --git a/codebase/dhtmlxgantt.js b/codebase/dhtmlxgantt.js index 0755d18..fc04333 100644 --- a/codebase/dhtmlxgantt.js +++ b/codebase/dhtmlxgantt.js @@ -1,7 +1,7 @@ /* @license -dhtmlxGantt v.8.0.7 Standard +dhtmlxGantt v.8.0.8 Standard This version of dhtmlxGantt is distributed under GPL 2.0 license and can be legally used in GPL projects. @@ -17,7 +17,7 @@ To use dhtmlxGantt in non-GPL projects (and get Pro version of the product), ple * @author Feross Aboukhadijeh * @license MIT */ -var i=n(291),r=n(290),a=n(67);function o(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(o()=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function _(t,e){if(l.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return B(t).length;default:if(i)return F(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,n){var i=t[e];t[e]=t[n],t[n]=i}function p(t,e,n,i,r){if(0===t.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=r?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(r)return-1;n=t.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof e&&(e=l.from(e,i)),l.isBuffer(e))return 0===e.length?-1:v(t,e,n,i,r);if("number"==typeof e)return e&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):v(t,[e],n,i,r);throw new TypeError("val must be string, number or Buffer")}function v(t,e,n,i,r){var a,o=1,s=t.length,l=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;o=2,s/=2,l/=2,n/=2}function c(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(r){var u=-1;for(a=n;as&&(n=s-l),a=n;a>=0;a--){for(var d=!0,h=0;hr&&(i=r):i=r;var a=e.length;if(a%2!=0)throw new TypeError("Invalid hex string");i>a/2&&(i=a/2);for(var o=0;o>8,r=n%256,a.push(r),a.push(i);return a}(e,t.length-n),t,n,i)}function S(t,e,n){return 0===e&&n===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,n))}function T(t,e,n){n=Math.min(t.length,n);for(var i=[],r=e;r239?4:c>223?3:c>191?2:1;if(r+d<=n)switch(d){case 1:c<128&&(u=c);break;case 2:128==(192&(a=t[r+1]))&&(l=(31&c)<<6|63&a)>127&&(u=l);break;case 3:a=t[r+1],o=t[r+2],128==(192&a)&&128==(192&o)&&(l=(15&c)<<12|(63&a)<<6|63&o)>2047&&(l<55296||l>57343)&&(u=l);break;case 4:a=t[r+1],o=t[r+2],s=t[r+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(l=(15&c)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&l<1114112&&(u=l)}null===u?(u=65533,d=1):u>65535&&(u-=65536,i.push(u>>>10&1023|55296),u=56320|1023&u),i.push(u),r+=d}return function(t){var e=t.length;if(e<=$)return String.fromCharCode.apply(String,t);var n="",i=0;for(;ithis.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return A(this,e,n);case"utf8":case"utf-8":return T(this,e,n);case"ascii":return C(this,e,n);case"latin1":case"binary":return E(this,e,n);case"base64":return S(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,e,n);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}.apply(this,arguments)},l.prototype.equals=function(t){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===l.compare(this,t)},l.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),""},l.prototype.compare=function(t,e,n,i,r){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),e<0||n>t.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&e>=n)return 0;if(i>=r)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,r>>>=0,this===t)return 0;for(var a=r-i,o=n-e,s=Math.min(a,o),c=this.slice(i,r),u=t.slice(e,n),d=0;dr)&&(n=r),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return m(this,t,e,n);case"utf8":case"utf-8":return y(this,t,e,n);case"ascii":return k(this,t,e,n);case"latin1":case"binary":return b(this,t,e,n);case"base64":return x(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,t,e,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var $=4096;function C(t,e,n){var i="";n=Math.min(t.length,n);for(var r=e;ri)&&(n=i);for(var r="",a=e;an)throw new RangeError("Trying to access beyond buffer length")}function I(t,e,n,i,r,a){if(!l.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>r||et.length)throw new RangeError("Index out of range")}function P(t,e,n,i){e<0&&(e=65535+e+1);for(var r=0,a=Math.min(t.length-n,2);r>>8*(i?r:1-r)}function N(t,e,n,i){e<0&&(e=4294967295+e+1);for(var r=0,a=Math.min(t.length-n,4);r>>8*(i?r:3-r)&255}function O(t,e,n,i,r,a){if(n+i>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function L(t,e,n,i,a){return a||O(t,0,n,4),r.write(t,e,n,i,23,4),n+4}function R(t,e,n,i,a){return a||O(t,0,n,8),r.write(t,e,n,i,52,8),n+8}l.prototype.slice=function(t,e){var n,i=this.length;if(t=~~t,e=void 0===e?i:~~e,t<0?(t+=i)<0&&(t=0):t>i&&(t=i),e<0?(e+=i)<0&&(e=0):e>i&&(e=i),e0&&(r*=256);)i+=this[t+--e]*r;return i},l.prototype.readUInt8=function(t,e){return e||M(t,1,this.length),this[t]},l.prototype.readUInt16LE=function(t,e){return e||M(t,2,this.length),this[t]|this[t+1]<<8},l.prototype.readUInt16BE=function(t,e){return e||M(t,2,this.length),this[t]<<8|this[t+1]},l.prototype.readUInt32LE=function(t,e){return e||M(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},l.prototype.readUInt32BE=function(t,e){return e||M(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},l.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||M(t,e,this.length);for(var i=this[t],r=1,a=0;++a=(r*=128)&&(i-=Math.pow(2,8*e)),i},l.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||M(t,e,this.length);for(var i=e,r=1,a=this[t+--i];i>0&&(r*=256);)a+=this[t+--i]*r;return a>=(r*=128)&&(a-=Math.pow(2,8*e)),a},l.prototype.readInt8=function(t,e){return e||M(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},l.prototype.readInt16LE=function(t,e){e||M(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(t,e){e||M(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(t,e){return e||M(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},l.prototype.readInt32BE=function(t,e){return e||M(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},l.prototype.readFloatLE=function(t,e){return e||M(t,4,this.length),r.read(this,t,!0,23,4)},l.prototype.readFloatBE=function(t,e){return e||M(t,4,this.length),r.read(this,t,!1,23,4)},l.prototype.readDoubleLE=function(t,e){return e||M(t,8,this.length),r.read(this,t,!0,52,8)},l.prototype.readDoubleBE=function(t,e){return e||M(t,8,this.length),r.read(this,t,!1,52,8)},l.prototype.writeUIntLE=function(t,e,n,i){(t=+t,e|=0,n|=0,i)||I(this,t,e,n,Math.pow(2,8*n)-1,0);var r=1,a=0;for(this[e]=255&t;++a=0&&(a*=256);)this[e+r]=t/a&255;return e+n},l.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,1,255,0),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},l.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):P(this,t,e,!0),e+2},l.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):P(this,t,e,!1),e+2},l.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):N(this,t,e,!0),e+4},l.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):N(this,t,e,!1),e+4},l.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e|=0,!i){var r=Math.pow(2,8*n-1);I(this,t,e,n,r-1,-r)}var a=0,o=1,s=0;for(this[e]=255&t;++a>0)-s&255;return e+n},l.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e|=0,!i){var r=Math.pow(2,8*n-1);I(this,t,e,n,r-1,-r)}var a=n-1,o=1,s=0;for(this[e+a]=255&t;--a>=0&&(o*=256);)t<0&&0===s&&0!==this[e+a+1]&&(s=1),this[e+a]=(t/o>>0)-s&255;return e+n},l.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,1,127,-128),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},l.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):P(this,t,e,!0),e+2},l.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):P(this,t,e,!1),e+2},l.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):N(this,t,e,!0),e+4},l.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):N(this,t,e,!1),e+4},l.prototype.writeFloatLE=function(t,e,n){return L(this,t,e,!0,n)},l.prototype.writeFloatBE=function(t,e,n){return L(this,t,e,!1,n)},l.prototype.writeDoubleLE=function(t,e,n){return R(this,t,e,!0,n)},l.prototype.writeDoubleBE=function(t,e,n){return R(this,t,e,!1,n)},l.prototype.copy=function(t,e,n,i){if(n||(n=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e=0;--r)t[r+e]=this[r+n];else if(a<1e3||!l.TYPED_ARRAY_SUPPORT)for(r=0;r>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(a=e;a55295&&n<57344){if(!r){if(n>56319){(e-=3)>-1&&a.push(239,191,189);continue}if(o+1===i){(e-=3)>-1&&a.push(239,191,189);continue}r=n;continue}if(n<56320){(e-=3)>-1&&a.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(e-=3)>-1&&a.push(239,191,189);if(r=null,n<128){if((e-=1)<0)break;a.push(n)}else if(n<2048){if((e-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function B(t){return i.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(j,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,e,n,i){for(var r=0;r=e.length||r>=t.length);++r)e[r+n]=t[r];return r}}).call(this,n(4))},function(t,e,n){var i=n(0),r=n(5),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 n+=r.getHtmlSelect(t.options,[{key:"style",value:"width:100%;"},{key:"title",value:t.name}]),n+=""},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||un.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(20);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(),u=t.getTaskType(e.type),d=a.getBarHeight(e.id,u==l.types.milestone),h=0;u==l.types.milestone&&(h=(d-s.height)/2);var f=Math.floor((a.getItemHeight(e.id)-d)/2);u==l.types.milestone&&(s.left-=Math.round(d/2),s.width=d);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&&u!=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 u=document.createElement("div"),d=l;r.rtl&&(d=i-l),u.style.left=d+"px",u.className="gantt_task_progress_drag",s.appendChild(u),n.appendChild(u)}}(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,u=s.link_from_start,d=s.link_to_start,h=t.isLinkAllowed(c,i,u,d),f="";f=h?d?"link_start_allow":"link_finish_allow":d?"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:"+(u==l.types.milestone?s.height:d)+"px","line-height:"+Math.max(d<30?d-2:d,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)&&u!=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:"+d+"px","line-height:"+d+"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(33),r=n(5),a=n(0),o=n(2),s=n(43),l=n(128),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 u=0,d=t.count;!i.smart_scales||isNaN(e)||isNaN(n)||(u=o.findBinary(t.left,e),d=o.findBinary(t.left,n)+1),l=t.css||function(){},!t.css&&i.inherit_scale_class&&(l=r.scale_cell_class);for(var h=u;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 u=(t-n[s])/this._getColumnDuration(this._tasks,n[s]);return c?c[s]+(1-u):s+u},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 u=a[this.$config.bind+"_attribute"];if(!u&&this.$config.bind&&(u="data-"+this.$config.bind+"-id"),this.$config.item_attribute=u||null,!this.$config.layers){var d=this._createLayerConfig();this.$config.layers=d}var h=o(e,this);h.init(),this._renderHeaderResizers=h.doOnRender,this._mouseDelegates=n(31)(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=(d=this.$getConfig()).grid_elastic_columns,o=0,s=i.length;ou.max_width&&(d=u.max_width-u.width),r-=u.width,u.width+=d,l-=d}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&&(d.width=h=f-o),o+=h;var _=t._sort&&d.name==t._sort.name?"
":"",g=["gantt_grid_head_cell","gantt_grid_head_"+d.name,u?"gantt_last_cell":"",i.grid_header_class(d.name,d)].join(" "),p="width:"+(h-(u?1:0))+"px;",v=d.label||s["column_"+d.name]||s[d.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=u},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;u--){var d=u==t.length-1,h=this.initScaleConfig(t[u],r,a);d&&this.processIgnores(h),this.initColSizes(h,e,l,s[u]),this.limitVisibleRange(h),d&&(l=h.full_width),c.unshift(h)}for(u=0;u=+l&&(l=e.add(c,i,n));+c<+l;){o.call(this,new Date(c));var u=c.getTimezoneOffset();c=e.add(c,i,n),c=t._correct_dst_change(c,u,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),u=0,d=0;d"}};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,u,d,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 u=s.gravity+c.gravity,d=s[n]+c[n],h=u/d;t[o].$config.gravity=h*r,l.$config[n]=d-r,l.$config.gravity=u-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+u)return!1;if(e.y_endh){var g=h;h=d,d=g}if(f>_){g=_;_=f,f=g}return d+=-100,h+=100,f+=-100,_+=100,!(e.x>h&&e.x>_)&&!(e.x_endc.x&&f.topc.y&&u.push(h.id)}return{ids:u}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(196),r=n(195),a=n(194);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(208);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());var a=this.getChildren(r);a.indexOf(t.id+"")>-1||a.indexOf(+t.id)>-1||(1*e==e?a.splice(e,0,t.id):a.push(t.id),t.$rendered_parent=r)},_move_branch:function(t,e,n){this._eachItemMainRangeCache=null,this._replace_branch_child(e,t.id),this.exists(n)||n==this.$getRootId()?this._add_branch(t,void 0,n):delete this._branches[t.id],t.$level=this.calculateItemLevel(t),this.eachItem(function(t){t.$level=this.calculateItemLevel(t)},t.id)},_replace_branch_child:function(t,e,n){var r=this.getChildren(t);if(r&&void 0!==t){var a=i.$create(),o=r.indexOf(e+"");-1!=o||isNaN(+e)||(o=r.indexOf(+e)),o>-1&&(n?r.splice(o,1,n):r.splice(o,1)),a=r,this._branches[t]=a}},sort:function(t,e,n){this.exists(n)||(n=this.$getRootId()),t||(t="order");var i="string"==typeof t?function(e,n){return e[t]==n[t]||a.isDate(e[t])&&a.isDate(n[t])&&e[t].valueOf()==n[t].valueOf()?0:e[t]>n[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;n",'"',"`"," ","\r","\n","\t"]),d=["'"].concat(u),h=["%","/","?",";","#"].concat(d),f=["/","?","#"],_=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,p={javascript:!0,"javascript:":!0},v={javascript:!0,"javascript:":!0},m={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=n(275);function k(t,e,n){if(t&&a.isObject(t)&&t instanceof o)return t;var i=new o;return i.parse(t,e,n),i}o.prototype.parse=function(t,e,n){if(!a.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+i(t));var o=t.indexOf("?"),l=-1!==o&&o127?N+="x":N+=P[O];if(!N.match(_)){var R=M.slice(0,E),j=M.slice(E+1),H=P.match(g);H&&(R.push(H[1]),j.unshift(H[2])),j.length&&(k="/"+j.join(".")+k),this.hostname=R.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),D||(this.hostname=r.toASCII(this.hostname));var F=this.port?":"+this.port:"",B=this.hostname||"";this.host=B+F,this.href+=this.host,D&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==k[0]&&(k="/"+k))}if(!p[w])for(E=0,I=d.length;E0)&&n.host.split("@"))&&(n.auth=A.shift(),n.host=n.hostname=A.shift());return n.search=t.search,n.query=t.query,a.isNull(n.pathname)&&a.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!w.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var T=w.slice(-1)[0],$=(n.host||t.host||w.length>1)&&("."===T||".."===T)||""===T,C=0,E=w.length;E>=0;E--)"."===(T=w[E])?w.splice(E,1):".."===T?(w.splice(E,1),C++):C&&(w.splice(E,1),C--);if(!b&&!x)for(;C--;C)w.unshift("..");!b||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),$&&"/"!==w.join("/").substr(-1)&&w.push("");var A,D=""===w[0]||w[0]&&"/"===w[0].charAt(0);S&&(n.hostname=n.host=D?"":w.length?w.shift():"",(A=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=A.shift(),n.host=n.hostname=A.shift()));return(b=b||n.host&&w.length)&&!D&&w.unshift(""),w.length?n.pathname=w.join("/"):(n.pathname=null,n.path=null),a.isNull(n.pathname)&&a.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},o.prototype.parseHost=function(){var t=this.host,e=l.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},function(t,e,n){"use strict";t.exports=a;var i=n(12),r=n(17);function a(t){if(!(this instanceof a))return new a(t);i.call(this,t),this._transformState={afterTransform:function(t,e){var n=this._transformState;n.transforming=!1;var i=n.writecb;if(!i)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=e&&this.push(e),i(t);var r=this._readableState;r.reading=!1,(r.needReadable||r.length>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function s(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function l(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var i=n.charCodeAt(n.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function c(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function u(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function d(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(t){return t.toString(this.encoding)}function f(t){return t&&t.length?this.write(t):""}e.StringDecoder=a,a.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return r>0&&(t.lastNeed=r-1),r;if(--i=0)return r>0&&(t.lastNeed=r-2),r;if(--i=0)return r>0&&(2===r?r=0:t.lastNeed=r-3),r;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var i=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},a.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,n){(function(t){var i=void 0!==t&&t||"undefined"!=typeof self&&self||window,r=Function.prototype.apply;function a(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new a(r.call(setTimeout,i,arguments),clearTimeout)},e.setInterval=function(){return new a(r.call(setInterval,i,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(i,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(284),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(4))},function(t,e,n){"use strict";(function(e,i,r){var a=n(23);function o(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var i=t.entry;t.entry=null;for(;i;){var r=i.callback;e.pendingcb--,r(n),i=i.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=m;var s,l=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?i:a.nextTick;m.WritableState=v;var c=n(17);c.inherits=n(8);var u={deprecate:n(283)},d=n(60),h=n(22).Buffer,f=r.Uint8Array||function(){};var _,g=n(59);function p(){}function v(t,e){s=s||n(12),t=t||{};var i=e instanceof s;this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var r=t.highWaterMark,c=t.writableHighWaterMark,u=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:i&&(c||0===c)?c:u,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var d=!1===t.decodeStrings;this.decodeStrings=!d,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,i=n.sync,r=n.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,i,r){--e.pendingcb,n?(a.nextTick(r,i),a.nextTick(S,t,e),t._writableState.errorEmitted=!0,t.emit("error",i)):(r(i),t._writableState.errorEmitted=!0,t.emit("error",i),S(t,e))}(t,n,i,e,r);else{var o=x(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||b(t,n),i?l(k,t,n,o,r):k(t,n,o,r)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function m(t){if(s=s||n(12),!(_.call(m,this)||this instanceof s))return new m(t);this._writableState=new v(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),d.call(this)}function y(t,e,n,i,r,a,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,n?t._writev(r,e.onwrite):t._write(r,a,e.onwrite),e.sync=!1}function k(t,e,n,i){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),S(t,e)}function b(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var i=e.bufferedRequestCount,r=new Array(i),a=e.corkedRequestsFree;a.entry=n;for(var s=0,l=!0;n;)r[s]=n,n.isBuf||(l=!1),n=n.next,s+=1;r.allBuffers=l,y(t,e,!0,e.length,r,"",a.finish),e.pendingcb++,e.lastBufferedRequest=null,a.next?(e.corkedRequestsFree=a.next,a.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,u=n.encoding,d=n.callback;if(y(t,e,!1,e.objectMode?1:c.length,c,u,d),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function x(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function w(t,e){t._final(function(n){e.pendingcb--,n&&t.emit("error",n),e.prefinished=!0,t.emit("prefinish"),S(t,e)})}function S(t,e){var n=x(e);return n&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,a.nextTick(w,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),n}c.inherits(m,d),v.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(v.prototype,"buffer",{get:u.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(_=Function.prototype[Symbol.hasInstance],Object.defineProperty(m,Symbol.hasInstance,{value:function(t){return!!_.call(this,t)||this===m&&(t&&t._writableState instanceof v)}})):_=function(t){return t instanceof this},m.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},m.prototype.write=function(t,e,n){var i=this._writableState,r=!1,o=!i.objectMode&&function(t){return h.isBuffer(t)||t instanceof f}(t);return o&&!h.isBuffer(t)&&(t=function(t){return h.from(t)}(t)),"function"==typeof e&&(n=e,e=null),o?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof n&&(n=p),i.ended?function(t,e){var n=new Error("write after end");t.emit("error",n),a.nextTick(e,n)}(this,n):(o||function(t,e,n,i){var r=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||e.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(t.emit("error",o),a.nextTick(i,o),r=!1),r}(this,i,t,n))&&(i.pendingcb++,r=function(t,e,n,i,r,a){if(!n){var o=function(t,e,n){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=h.from(e,n));return e}(e,i,r);i!==o&&(n=!0,r="buffer",i=o)}var s=e.objectMode?1:i.length;e.length+=s;var l=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(m.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),m.prototype._write=function(t,e,n){n(new Error("_write() is not implemented"))},m.prototype._writev=null,m.prototype.end=function(t,e,n){var i=this._writableState;"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!==t&&void 0!==t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||i.finished||function(t,e,n){e.ending=!0,S(t,e),n&&(e.finished?a.nextTick(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,i,n)},Object.defineProperty(m.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),m.prototype.destroy=g.destroy,m.prototype._undestroy=g.undestroy,m.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,n(9),n(57).setImmediate,n(4))},function(t,e,n){"use strict";var i=n(23);function r(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var n=this,a=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return a||o?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||i.nextTick(r,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!e&&t?(i.nextTick(r,n,t),n._writableState&&(n._writableState.errorEmitted=!0)):e&&e(t)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(t,e,n){t.exports=n(61).EventEmitter},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)}function i(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(t){return"function"==typeof t}function a(t){return"object"===n(t)&&null!==t}function o(t){return void 0===t}t.exports=i,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._maxListeners=void 0,i.defaultMaxListeners=10,i.prototype.setMaxListeners=function(t){if(!function(t){return"number"==typeof t}(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},i.prototype.emit=function(t){var e,n,i,s,l,c;if(this._events||(this._events={}),"error"===t&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var u=new Error('Uncaught, unspecified "error" event. ('+e+")");throw u.context=e,u}if(o(n=this._events[t]))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(a(n))for(s=Array.prototype.slice.call(arguments,1),i=(c=n.slice()).length,l=0;l0&&this._events[t].length>n&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(t,e){if(!r(e))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(t,i),n||(n=!0,e.apply(this,arguments))}return i.listener=e,this.on(t,i),this},i.prototype.removeListener=function(t,e){var n,i,o,s;if(!r(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(o=(n=this._events[t]).length,i=-1,n===e||r(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(a(n)){for(s=o;s-- >0;)if(n[s]===e||n[s].listener&&n[s].listener===e){i=s;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},i.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[t]))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},i.prototype.listeners=function(t){return this._events&&this._events[t]?r(this._events[t])?[this._events[t]]:this._events[t].slice():[]},i.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(r(e))return 1;if(e)return e.length}return 0},i.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,n){"use strict";(function(e,i){var r=n(23);t.exports=y;var a,o=n(67);y.ReadableState=m;n(61).EventEmitter;var s=function(t,e){return t.listeners(e).length},l=n(60),c=n(22).Buffer,u=e.Uint8Array||function(){};var d=n(17);d.inherits=n(8);var h=n(287),f=void 0;f=h&&h.debuglog?h.debuglog("stream"):function(){};var _,g=n(286),p=n(59);d.inherits(y,l);var v=["error","close","destroy","pause","resume"];function m(t,e){a=a||n(12),t=t||{};var i=e instanceof a;this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var r=t.highWaterMark,o=t.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:i&&(o||0===o)?o:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new g,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(_||(_=n(56).StringDecoder),this.decoder=new _(t.encoding),this.encoding=t.encoding)}function y(t){if(a=a||n(12),!(this instanceof y))return new y(t);this._readableState=new m(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),l.call(this)}function k(t,e,n,i,r){var a,o=t._readableState;null===e?(o.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,S(t)}(t,o)):(r||(a=function(t,e){var n;(function(t){return c.isBuffer(t)||t instanceof u})(e)||"string"==typeof e||void 0===e||t.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));return n}(o,e)),a?t.emit("error",a):o.objectMode||e&&e.length>0?("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===c.prototype||(e=function(t){return c.from(t)}(e)),i?o.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):b(t,o,e,!0):o.ended?t.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(e=o.decoder.write(e),o.objectMode||0!==e.length?b(t,o,e,!1):$(t,o)):b(t,o,e,!1))):i||(o.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=x?t=x:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function S(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(f("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?r.nextTick(T,t):T(t))}function T(t){f("emit readable"),t.emit("readable"),D(t)}function $(t,e){e.readingMore||(e.readingMore=!0,r.nextTick(C,t,e))}function C(t,e){for(var n=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):n=function(t,e,n){var i;ta.length?a.length:t;if(o===a.length?r+=a:r+=a.slice(0,t),0===(t-=o)){o===a.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=a.slice(o));break}++i}return e.length-=i,r}(t,e):function(t,e){var n=c.allocUnsafe(t),i=e.head,r=1;i.data.copy(n),t-=i.data.length;for(;i=i.next;){var a=i.data,o=t>a.length?a.length:t;if(a.copy(n,n.length-t,0,o),0===(t-=o)){o===a.length?(++r,i.next?e.head=i.next:e.head=e.tail=null):(e.head=i,i.data=a.slice(o));break}++r}return e.length-=r,n}(t,e);return i}(t,e.buffer,e.decoder),n);var n}function I(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,r.nextTick(P,e,t))}function P(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function N(t,e){for(var n=0,i=t.length;n=e.highWaterMark||e.ended))return f("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?I(this):S(this),null;if(0===(t=w(t,e))&&e.ended)return 0===e.length&&I(this),null;var i,r=e.needReadable;return f("need readable",r),(0===e.length||e.length-t0?M(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&I(this)),null!==i&&this.emit("data",i),i},y.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},y.prototype.pipe=function(t,e){var n=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=t;break;case 1:a.pipes=[a.pipes,t];break;default:a.pipes.push(t)}a.pipesCount+=1,f("pipe count=%d opts=%j",a.pipesCount,e);var l=(!e||!1!==e.end)&&t!==i.stdout&&t!==i.stderr?u:y;function c(e,i){f("onunpipe"),e===n&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,f("cleanup"),t.removeListener("close",v),t.removeListener("finish",m),t.removeListener("drain",d),t.removeListener("error",p),t.removeListener("unpipe",c),n.removeListener("end",u),n.removeListener("end",y),n.removeListener("data",g),h=!0,!a.awaitDrain||t._writableState&&!t._writableState.needDrain||d())}function u(){f("onend"),t.end()}a.endEmitted?r.nextTick(l):n.once("end",l),t.on("unpipe",c);var d=function(t){return function(){var e=t._readableState;f("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,D(t))}}(n);t.on("drain",d);var h=!1;var _=!1;function g(e){f("ondata"),_=!1,!1!==t.write(e)||_||((1===a.pipesCount&&a.pipes===t||a.pipesCount>1&&-1!==N(a.pipes,t))&&!h&&(f("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,_=!0),n.pause())}function p(e){f("onerror",e),y(),t.removeListener("error",p),0===s(t,"error")&&t.emit("error",e)}function v(){t.removeListener("finish",m),y()}function m(){f("onfinish"),t.removeListener("close",v),y()}function y(){f("unpipe"),n.unpipe(t)}return n.on("data",g),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?o(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",p),t.once("close",v),t.once("finish",m),t.emit("pipe",n),a.flowing||(f("pipe resume"),n.resume()),t},y.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n),this);if(!t){var i=e.pipes,r=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var a=0;at._pos){var a=n.substr(t._pos);if("x-user-defined"===t._charset){for(var o=new r(a.length),s=0;st._pos&&(t.push(new r(new Uint8Array(c.result.slice(t._pos)))),t._pos=c.result.byteLength)},c.onload=function(){t.push(null)},c.readAsArrayBuffer(n)}t._xhr.readyState===l.DONE&&"ms-stream"!==t._mode&&t.push(null)}}).call(this,n(9),n(4),n(13).Buffer)},function(t,e,n){(function(t){e.fetch=s(t.fetch)&&s(t.ReadableStream),e.writableStream=s(t.WritableStream),e.abortController=s(t.AbortController),e.blobConstructor=!1;try{new Blob([new ArrayBuffer(1)]),e.blobConstructor=!0}catch(t){}var n;function i(){if(void 0!==n)return n;if(t.XMLHttpRequest){n=new t.XMLHttpRequest;try{n.open("GET",t.XDomainRequest?"/":"https://example.com")}catch(t){n=null}}else n=null;return n}function r(t){var e=i();if(!e)return!1;try{return e.responseType=t,e.responseType===t}catch(t){}return!1}var a=void 0!==t.ArrayBuffer,o=a&&s(t.ArrayBuffer.prototype.slice);function s(t){return"function"==typeof t}e.arraybuffer=e.fetch||a&&r("arraybuffer"),e.msstream=!e.fetch&&o&&r("ms-stream"),e.mozchunkedarraybuffer=!e.fetch&&a&&r("moz-chunked-arraybuffer"),e.overrideMimeType=e.fetch||!!i()&&s(i().overrideMimeType),e.vbArray=s(t.VBArray),n=null}).call(this,n(4))},function(t,e,n){(function(t){var i=n(288),r=n(64),a=n(280),o=n(279),s=n(54),l=e;l.request=function(e,n){e="string"==typeof e?s.parse(e):a(e);var r=-1===t.location.protocol.search(/^https?:$/)?"http:":"",o=e.protocol||r,l=e.hostname||e.host,c=e.port,u=e.path||"/";l&&-1!==l.indexOf(":")&&(l="["+l+"]"),e.url=(l?o+"//"+l:"")+(c?":"+c:"")+u,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var d=new i(e);return n&&d.on("response",n),d},l.get=function(t,e){var n=l.request(t,e);return n.end(),n},l.ClientRequest=i,l.IncomingMessage=r.IncomingMessage,l.Agent=function(){},l.Agent.defaultMaxSockets=4,l.globalAgent=new l.Agent,l.STATUS_CODES=o,l.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}).call(this,n(4))},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e){t.exports=function(t){var e=new RegExp("<(?:.|\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))},setTaskBarAttr:function(e,n){this._taskCommonAttr(e,n),n.setAttribute("role","img"),!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-selected",t.isSelectedTask(e.id)?"true":"false"),n.setAttribute("aria-level",e.$level+1||1),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("role","img"),n.setAttribute("aria-label",i(s)),t.isReadonly(e)&&n.setAttribute("aria-readonly",!0)},gridSeparatorAttr:function(t){t.setAttribute("role","columnheader")},rowResizerAttr:function(t){t.setAttribute("role","row")},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"),t.firstChild.setAttribute("aria-level","1")},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",role:"spinbutton"})},inlineEditorAttr:function(t){t.setAttribute("role","row")},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:"columnheader","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'"},reorderMarkerAttr:function(t){t.setAttribute("role","grid"),t.firstChild.removeAttribute("aria-level"),t.firstChild.setAttribute("aria-grabbed","true")},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' aria-level='1' "},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(18)(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(36);t.exports=function(t){var e=n(7)(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 u=i[c.constraint_date]||new Date;t.form_blocks._fill_lightbox_select(o,0,u,l,r);var d=i[c.constraint_type]||t.getConstraintType(i);a.value=d,s(o,d)},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(18)(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+"
",c="gantt_section_time";return"time"!==e.name&&(c+=" gantt_section_"+e.name),"
"+n+" "+l+"
"},a.prototype.set_value=function(e,n,i,r){var a,c,u,d,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,u=i[a.end_date]||t.calculateEndDate({start_date:c,duration:1,task:i}),d=Math.round(i[a.duration])||t.calculateDuration({start_date:c,end_date:u,task:i}),d=o(r).format(d),t.form_blocks._fill_lightbox_select(h,0,c,v,r),_.value=d,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(7)(t);function r(){return e.apply(this,arguments)||this}return i(r,e),r.prototype.render=function(t){var e=(t.height||"23")+"px",n="
";if(t.options&&t.options.length)for(var i=0;i"+t.options[i].label+"";return n+="
"},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(7)(t);function a(){return e.apply(this,arguments)||this}return r(a,e),a.prototype.render=function(t){var e=(t.height||"23")+"px",n="
";if(t.options&&t.options.length)for(var i=0;i"+t.options[i].label+"";else t.single_value=!0,n+="";return n+="
"},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(7)(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="gantt_section_time";"time"!==e.name&&(i+=" gantt_section_"+e.name);var r="
";return r+=n,e.single_date?(n=t.form_blocks.getTimePicker.call(this,e,!0),r+=""):r+="  –  ",r+=n,r+="
"},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(){d=new Date(o[s[2]].value,o[s[1]].value,o[s[0]].value,0,0),h=t.calculateEndDate({start_date:d,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 u=t._resolve_default_mapping(r);"string"==typeof u&&(u={start_date:u});var d=i[u.start_date]||new Date,h=i[u.end_date]||t.calculateEndDate({start_date:d,duration:1,task:i});t.form_blocks._fill_lightbox_select(o,0,d,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(7)(t);function r(){return e.apply(this,arguments)||this}return i(r,e),r.prototype.render=function(t){var e=(t.height||"130")+"px";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(7)(t);function r(){return e.apply(this,arguments)||this}return i(r,e),r.prototype.render=function(t){var e=(t.height||"30")+"px";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(78)(t),o=n(77)(t),s=n(76)(t),l=n(18)(t),c=n(75)(t),u=n(74)(t),d=n(73)(t),h=n(72)(t),f=n(18)(t),_=n(71)(t),g=n(70)(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,u="";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++)u+="";break;case"%d":for(e._time_format_order[0]=n,e._time_format_order.size++,l=1;l<32;l++)u+="";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 u}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 e=this.getLightboxValues();this.callEvent("onLightboxSave",[this._lightbox_id,e,!!e.$new])&&(t.$data.tasksStore._skipTaskRecalculation="lightbox",e.$new?(delete e.$new,this.addTask(e,e.parent,this.getTaskIndex(e.id))):this.isTaskExists(e.id)&&(this.mixin(this.getTask(e.id),e,!0),this.refreshTask(e.id),this.updateTask(e.id)),t.$data.tasksStore._skipTaskRecalculation=!1,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 d,parent:new h,radio:new u,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),t.config.touch){var e=!0;try{document.createEvent("TouchEvent")}catch(t){e=!1}e?t._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?t._touch_events(["pointermove","pointerdown","pointerup"],function(t){return"mouse"==t.pointerType?null:t},function(t){return!t||"mouse"==t.pointerType}):window.navigator.msPointerEnabled&&t._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})}}function n(e){var n=e.$config.scrollX?t.$ui.getView(e.$config.scrollX):null,i=e.$config.scrollY?t.$ui.getView(e.$config.scrollY):null,r={x:null,y:null};n&&(n.getScrollState().visible&&(r.x=n.$view.scrollLeft));i&&(i.getScrollState().visible&&(r.y=i.$view.scrollTop));return r}function i(){var e;return t.$ui.getView("timeline")&&(e=t.$ui.getView("timeline")._tasks_dnd),e}t.config.touch_drag=500,t.config.touch=!0,t.config.touch_feedback=!0,t.config.touch_feedback_duration=1,t._prevent_touch_scroll=!1,t._touch_feedback=function(){t.config.touch_feedback&&navigator.vibrate&&navigator.vibrate(t.config.touch_feedback_duration)},t.attachEvent("onGanttReady",e),t.attachEvent("onGanttLayoutReady",function(){t.$container&&t.attachEvent("onGanttRender",e,{once:!0})});var r=[];t._touch_events=function(e,a,o){for(var s,l=0,c=!1,u=!1,d=null,h=null,f=null,_=[],g=null,p={},v=0;v5||Math.abs(p)>5)&&(u=!0,l=0,s=g?n(g):t.getScrollState()),u){var v,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),v=n(g)):(t.scrollTo(y,k),v=t.getScrollState()),s.x!=v.x&&p>2*_||s.y!=v.y&&_>2*p)return m(e)}}return m(e)}return!0}}]);try{document.addEventListener("touchmove",function(e){t._touch_drag&&m(e)},{passive:!1})}catch(t){console.warn("Cannot prevent touch event for the page drag")}r.push([this.$container,"contextmenu",function(t){if(c)return m(t)}]),r.push([this.$container,e[1],function(e){if(p=e.touches.length,document&&document.body&&document.body.classList.add("gantt_touch_active"),!o(e))if(e.touches&&e.touches.length>1)c=!1;else{d=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]}}(d),t._locate_css(d,"gantt_hor_scroll")||t._locate_css(d,"gantt_ver_scroll")||(c=!0);var n=i();h=setTimeout(function(){var e=t.locate(d);n&&e&&!t._locate_css(d,"gantt_link_control")&&!t._locate_css(d,"gantt_grid_data")&&(n.on_mouse_down(d),n.drag&&n.drag.start_drag&&(!function(e){var n=t._getTaskLayers(),i=t.getTask(e);if(i){var r=t.isTaskVisible(e);if(r){f=e;for(var a=0;ae._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&&!x?c=0:c<0&&!b?c=0:c>0&&b+x>=w&&(c=0);var S=t.config.autoscroll_step;S&&S<2&&(S=2),c*=S||n,_*=S||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(84),n(83),n(82)],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,u=t.$ui.getView(a.$config.scrollY).$config.width,d=c-(a.$config.width+u);d<0&&(a.$config.width+=d,t.config.grid_width+=d)}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+d&&(h.y=a.bottom+d-r.height-s),h.right>a.right&&(h.x=a.right-r.width-o),h}function v(t){var n=u(),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=u(),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 d=(a-i)/(r-n),h=Math.atan(d);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 u=!!i.locateClassName(s,"gantt_link_control"),d=r,h=n,f=a,m=e.locate(s),k=!0,b=i.getTargetNode(s);if(i.isChildOf(b,e.$root)||(u=!1,m=null),u&&(k=!i.locateClassName(s,"task_end_date"),u=!!m),r=m,n=u,a=k,u){var x=e.getTask(m),w=t.$getConfig(),S=i.locateClassName(s,"gantt_link_control"),T=0;S&&(T=Math.floor(S.offsetWidth/2)),this._dir_end=g(x,!!a,T,w)}else this._dir_end=i.getRelativeEventPosition(s,t.$task_data),e.env.isEdge&&(this._dir_end.y+=window.scrollY);var $=!(h==u&&d==m&&f==k);return $&&(d&&e.refreshTask(d,!1),m&&e.refreshTask(m,!1)),$&&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=u();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(50),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 u=c-s.end;(ui||void 0===i)&&(i=d)}}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,u=e.getTask(a.id);if(this._handlers[a.mode]){if(a.mode===o.drag_mode.move){var d={};this._isMultiselect()&&e.getSelectedTasks().indexOf(a.id)>=0&&(d=this.dragMultiple);var h=!1;if(e.isSummaryTask(u)&&e.config.drag_project){var f={};f[a.id]=r.copy(a),h=!0,d=r.mixin(f,this.dragMultiple)}var _=this._find_max_shift(d,c);for(var g in void 0!==_&&(c=_),this._update_item_on_move(c,a.id,a.mode,a,n),d){var p=d[g];if(h&&p.id!=a.id&&(e._bulk_dnd=!0),void 0===_&&(h||Object.keys(d).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 u=i.getRelativeEventPosition(n,e.$task_data);c.start_x=u.x,c.start_y=u.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)o[t].id!=i.id&&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(98),a=n(97),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(31)(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),u=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 d=0;n.eachItem(function(t){-1!==n.getIndexById(t.id)&&d++},t.targetId),i.y=c+u+d*u}else i.y=c+u,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(24);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(24);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 u=s.getItem(e),d=s.calculateItemLevel(u);if(d===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(d>l)s.eachParent(function(t){s.calculateItemLevel(t)===l&&(e=t.id)},u),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(24),a=n(102),o=n(101),s=n(100),l=n(16);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=u(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)&&!d(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=u(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,t._waiAria.reorderMarkerAttr(c.config.marker),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 u(t){return i.locateAttribute(t,e.$config.item_attribute)}function d(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,u=e.getItemIndexByTopPosition(e.$state.scrollTop);if(a.exists(u)||(u=a.countVisible()-1),u<0)return a.$getRootId();var h=a.getIdByIndex(u),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 d(y)?a.getPrevSibling(y):a.getIdByIndex(m)}(n),l=null,u=e.$config.rowStore,h=!e.$getConfig().order_branch_free,f=i.getRelativeEventPosition(n,e.$grid_data).y;return document.doctype||(f+=window.scrollY),s!==u.$getRootId()&&(l=(f-e.getItemTop(s))/e.getItemHeight(s)),h?(r=a(c.config.id,s,l,f,u,c.config.level))&&r.targetParent&&d(r.targetParent)&&(s=u.getPrevSibling(r.targetParent),r=a(c.config.id,s,l,f,u,c.config.level)):r=o(c.config.id,s,l,f,u),r}}}},function(t,e,n){var i=n(1),r=n(16);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 u=c.getAttribute(e.$config.item_attribute);if(l(u))return!1;var d=s().getItem(u);return!t.isReadonly(d)&&(a.config.initial_open_state=d.$open,!!t.callEvent("onRowDragStart",[u,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,u=a.config,d=a._getGridPos(r);t._waiAria.reorderMarkerAttr(u.marker);var h=e.$getConfig(),f=s();d.y_.width&&(u.marker.style.width=_.width-10-2+"px",u.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;)T=f.getIdByIndex(x-C),$=f.getItem(T),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?$&&m($,g)&&g.id!=$.id&&f.move(g.id,-1,f.getParent($.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(104),a=n(103),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(31)(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.rowResizerAttr(a),a},update:null,getRectangle:i,getVisibleRange:r}}},function(t,e,n){var i=n(27),r=n(6),a=n(26),o=n(25),s=n(37);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={},u={},d={};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,u){var h=d[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"),u=a(o,r),d=u.start;d<=u.end;d++){var h=o.trace_x[d],f=o.trace_x[d+1]||t.date.add(h,o.step,o.unit),_=o.trace_x[d].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,u);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),u=o.getItemHeight(t.id)-1;if(s||l){var d=document.createElement("div");return d.className=["gantt_histogram_cell",s].join(" "),d.setAttribute(o.$config.item_attribute,t.id),d.style.cssText=["left:"+e.left+"px","width:"+e.width+"px","height:"+u+"px","line-height:"+u+"px","top:"+(e.top+1)+"px"].join(";"),l&&(l="
"+l+"
"),c&&(l="
"+l),l&&(d.innerHTML=l),d}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]={},u[i.id]=null,d[i.id]=null;for(var y=!!l,k=a(h,l),b=k.start;b<=k.end;b++){var x=g[b];if(x&&(!y||o(b,h,l,t))){var w=c.histogram_cell_capacity(x.start_date,x.end_date,i,x.tasks,x.assignments);v[x.start_date.valueOf()]=w||0;var S=r.getItemPosition(i,x.start_date,x.end_date),T=_(i,S,m,0,c,x,r);T&&(p.push(T),n[i.id][b]=T)}}var $=null;if(p.length){$=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(d)}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 x=s.grid_row_class.call(t,e.start_date,e.end_date,e);x&&(p+=" "+x)}l.isSelected(e.id)&&(p+=" gantt_selected");var w=document.createElement("div");w.className="gantt_row"+p+" gantt_row_"+t.getTaskType(e.type);var S=n.getItemHeight(e.id);return w.style.height=S+"px",w.style.lineHeight=S+"px",i.smart_rendering&&(w.style.position="absolute",w.style.left="0px",w.style.top=n.getItemTop(e.id)+"px"),n.$config.item_attribute&&(w.setAttribute(n.$config.item_attribute,e.id),w.setAttribute(n.$config.bind+"_id",e.id)),t._waiAria.taskRowAttr(e,w),w.innerHTML=c.join(""),w},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,u=e.dirs,d=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(u.left,h),_?(this.point_to(u.down,l),this.point_to(u.right,c)):(this.point_to(u.right,c),this.point_to(u.down,l)),this.point_to(u.right,h);else if(!f.from_start&&f.to_start)if(_=o.e_x>o.x+2*h,this.point_to(u.right,h),_)c-=h,this.point_to(u.down,l),this.point_to(u.right,c);else{c-=2*h;var g=l>0?1:-1;this.point_to(u.down,g*(d/2)),this.point_to(u.right,c),this.point_to(u.down,g*(Math.abs(l)-d/2)),this.point_to(u.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(u.left,h),_?(c+=2*h,g=l>0?1:-1,this.point_to(u.down,g*(d/2)),this.point_to(u.right,c),this.point_to(u.down,g*(Math.abs(l)-d/2)),this.point_to(u.left,h)):(c+=h,this.point_to(u.down,l),this.point_to(u.right,c))):(this.point_to(u.right,h),_?(this.point_to(u.right,c),this.point_to(u.down,l)):(this.point_to(u.down,l),this.point_to(u.right,c)),this.point_to(u.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),u=a(i,e,r);return{x:s?c.left:c.left+c.width,e_x:l?u.left:u.left+u.width,y:c.top+c.rowHeight/2-1,e_y:u.top+u.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 u=n.get_points(i,r,o,s),d=e.get_lines(u,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)&&u(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)?u(t.id,k):b&&!b.parentNode&&i.appendChild(b)}}},getRectangle:i,getVisibleRange:a,prepareData:l}}},function(t,e,n){var i=n(28),r=n(19),a=n(6);t.exports=function(t){var e=i(t),n={};function o(t,e,n,i,a){var o=!0;return i.smart_rendering&&(o=r(t,e,n,i,a)),o}function s(n,i,r,a){var o=t.copy(t.getTask(i.id));if(o.$rendered_at=n.id,!1!==t.callEvent("onBeforeRollupTaskDisplay",[o.id,o,n.id])){var s=e(o,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_rollup_child"),s.setAttribute("data-rollup-parent-id",n.id),s}}}function l(t,e){return t+"_"+e}return{render:function(e,i,r,a){if(!1!==e.rollup&&e.$rollup&&e.$rollup.length){var c=document.createElement("div"),u=t.getTaskPosition(e);return a&&(a.y=0,a.y_end=t.$task_bg.scrollHeight),e.$rollup.forEach(function(d){if(t.isTaskExists(d)){var h=t.getTask(d);if(o(h,a,i,r,t)){var f=s(e,h,i,u);f?(n[l(h.id,e.id)]=f,c.appendChild(f)):n[l(h.id,e.id)]=!1}}}),c}return!1},update:function(e,i,r,a,c){var u=document.createElement("div"),d=t.getTaskPosition(e);c.y=0,c.y_end=t.$task_bg.scrollHeight,e.$rollup.forEach(function(h){var f=t.getTask(h),_=l(f.id,e.id),g=o(f,c,r,a,t);if(g!==!!n[_])if(g){var p=s(e,f,r,d);n[_]=p||!1}else n[_]=!1;n[_]&&u.appendChild(n[_]),i.innerHTML="",i.appendChild(u)})},isInViewPort:r,getVisibleRange:a}}},function(t,e,n){var i=n(19);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(28),r=n(6),a=n(114),o=n(19);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),u=Math.floor((r.getItemHeight(n.id)-c)/2);return l.style.top=a.top+u+"px",l.classList.add("gantt_split_child"),o&&l.classList.add("gantt_split_subproject"),l}}}}function c(t,e){return t+"_"+e}function u(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(u(e,r)){var o=document.createElement("div"),d=t.getTaskPosition(e);return t.hasChild(e.id)&&t.eachTask(function(u){if(s(u,a,i,r,t)){var h=l(e,u,i,d);h?(n[c(u.id,e.id)]=h,o.appendChild(h)):n[c(u.id,e.id)]=!1}},e.id),o}return!1},update:function(e,i,r,a,o){if(u(e,a)){var d=document.createElement("div"),h=t.getTaskPosition(e);t.eachTask(function(u){var f=c(u.id,e.id),_=s(u,o,r,a,t);if(_!==!!n[f])if(_){var g=l(e,u,r,h);n[f]=g||!1}else n[f]=!1;n[f]&&d.appendChild(n[f]),i.innerHTML="",i.appendChild(d)},e.id)}},isInViewPort:a,getVisibleRange:r}}},function(t,e,n){var i=n(19),r=n(6),a=n(28);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(10)(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(10)(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(10)(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 u=l?" min='"+a(l)+"' ":"",d=c?" max='"+a(c)+"' ":"",h="
");s.innerHTML=h},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(10)(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(10)(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=n.min||0,a=n.max||100,o="
");i.innerHTML=o},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(10)(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,u=r.keyCode,d=!1;switch(u){case c.ENTER:t.isVisible()?(t.save(),r.preventDefault(),d=!0):s&&!(r.ctrlKey||r.metaKey||r.shiftKey)&&(n.startEdit(o.id,o.columnName),r.preventDefault(),d=!0);break;case c.ESC:t.isVisible()&&(t.hide(),r.preventDefault(),d=!0);break;case c.UP:case c.DOWN:break;case c.LEFT:case c.RIGHT:(s&&t.isVisible()||"date"===l.editorType)&&(d=!0);break;case c.SPACE:t.isVisible()&&(d=!0),s&&!t.isVisible()&&(n.startEdit(o.id,o.columnName),r.preventDefault(),d=!0);break;case c.DELETE:s&&!t.isVisible()?(n.startEdit(o.id,o.columnName),d=!0):s&&t.isVisible()&&(d=!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(),d=!0}break;default:if(t.isVisible())d=!0;else if(u>=48&&u<=57||u>95&&u<112||u>=64&&u<=91||u>185&&u<193||u>218&&u<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),d=!0)}}return!d})},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(125),r=n(124);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(126),r=n(123),a=n(122),o=n(121),s=n(120),l=n(119),c=n(118),u=n(0),d=n(1),h=n(5),f=n(117);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(e,n){var r=i.$getConfig(),a=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,u=0;u0?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 u.mixin(c,e),u.mixin(c,n),c}};return u.mixin(r,e),u.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(11),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;id[s]&&d[o]>e&&u>d[s]-l+2&&(e=u+(i?0:2),n=d[s]);else{var h=Math.max(d[o]-u,0);(u+=h)>Math.max(d[s]-h,0)&&u>e&&(e=u,n=d[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||(d=2*h,h=0)),d&&Math.abs(d)>Math.abs(h)){if(this._isVertical())return;if(i.x)return!0;if(!this.$scroll_hor||!this.$scroll_hor.offsetWidth)return!0;var _=d/-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(14));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(14));t.exports=a},function(t,e,n){var i=n(3),r=n(38),a=n(14),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 u(e,n,i){return"
"+e+"
"}function d(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&&(_+=u(h(s.ok,t.locale.labels.message_ok,"OK"),"ok",!0)),c&&(_+=u(h(s.cancel,t.locale.labels.message_cancel,"Cancel"),"cancel",!1)),s.buttons)for(var g=0;g",d.innerHTML=_,s.content){var v=s.content;"string"==typeof v&&(v=document.getElementById(v)),"none"==v.style.display&&(v.style.display=""),d.childNodes[s.title?1:0].appendChild(v)}return d.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=d,(l||c)&&(n=s),d}(l,d,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 d(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),o=t.config.start_date||t.getState().min_date;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}):o:o}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(),u=a.end_date.valueOf();t.resetProjectDates(a),r||c!=a.start_date.valueOf()||u!=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 u=(r=t.date[c+"_start"](t.date.add(r,l,c))).getTimezoneOffset();r=t._correct_dst_change(r,u,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))(d||h&&f)&&(s=r[n+"_start"](new Date(a)),l=r.add(s,i,n)),d?(d=!1,u=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)&&(u=this._getClosestWorkTimeFuture(a,g))}a=u}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 u=this.$gantt.date.week_start(new Date(s));if(s.valueOf()===u.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,u=this._getMinutesBetweenSingleDay(o,s),d=this._getMinutesBetweenSingleDay(l,c);return u+this._getWorkUnitsForRange(s,l,n,i)+d},_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,u=this._getMinutesBetweenSingleDay(o,s,n,i)/60,d=this._getMinutesBetweenSingleDay(l,c,n,i)/60,h=u+this._getWorkUnitsForRange(s,l,n,i)+d;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),u=Math.min(l.end,a.end),d=(u-c)/3600;d>r&&(d=r,u=c+60*r*60);var h=Math.round((u-c)/3600);i+=h,r-=h,a.start=u}}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),u=Math.min(l.end,a.end),d=(u-c)/60;d>r&&(d=r,u=c+60*r);var h=Math.round((u-c)/60);r-=h,i+=h,a.start=u}}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 u=Math.min(o,c.end),d=Math.max(a,c.start),h=(u-d)/60;h>r&&(h=r,d=u-60*r);var f=Math.abs(Math.round((u-d)/60));r-=f,i+=f,o=d}}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=null,m=l.length-1;m>=0;m--)if(l[m].start<_-1&&l[m].end>=_-1){g=!0,p=l[m],v=l[m-1];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)f<=_/60-p.startMinute?(r+=f,i=this.$gantt.date.add(i,-f,"minute")):(r+=_/60-p.startMinute,i=v?new Date(i.getFullYear(),i.getMonth(),i.getDate(),0,0,v.end):this.$gantt.date.day_start(i));else{var y=this._getMinutesPerHour(i);y<=f?(r+=y,i=this._nextDate(i,"hour",n)):(r+=(o=this._subtractMinutesUntilHourStart(i,f)).added,i=o.end)}else if(0===i.getHours()&&0===i.getMinutes()&&0===i.getSeconds()){if((k=this._getClosestWorkTimePast(i,"hour")).valueOf()===i.valueOf()){var k=this.$gantt.date.add(i,-1,"day"),b=this._getWorkHours(k);if(b.length){var x=b[b.length-1];k.setSeconds(x.durationSeconds)}}i=k}else i=this._getClosestWorkTimePast(new Date(i-1),"hour")}else i=this.$gantt.date.add(i,-1,"day")}if(r=h&&d>=l){if(r+=l,d==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&&d>=_.durationMinutes)r+=_.durationMinutes,i=this.$gantt.date.add(i,_.durationMinutes,"minute");else if(d<=_.endMinute-h/60)r+=d,i=this.$gantt.date.add(i,d,"minute");else{var p=this._getMinutesPerHour(i);p<=d?(r+=p,i=c?this.$gantt.date.add(i,p,"minute"):this._nextDate(i,"hour",n)):(r+=(a=this._addMinutesUntilHourEnd(i,d)).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,u=Array.isArray(l)?l:r.hours;a.dates[o]=this._toHoursArray(this._mergeHoursConfig(c,u))}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(42),a=n(198),o=n(197),s=n(192),l=n(191)();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(204),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},d=function(t){return--t});for(var h=this._dragX-this.$grid.$grid.getBoundingClientRect().left+this._scrollableGrid.getCorrection(),f=l;u(f,c)&&(void 0===t||void 0===e);f=d(f))o[f].hide||(s.startX=s.endX,s.endX+=o[f].width,h>=s.startX&&(h<=s.endX||!u(d(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(205);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),u=e.getItemTop(l)-n.scrollTop,d=i.getNodePosition(e.$grid_data),h=parseInt(s.marker.style.top,10),f=u+d.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(44).default,r=n(213).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"),u=t.templates.parse_date(i.getAttribute("data-start-date")),d=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(t.plugins().undo&&t.ext.undo.saveState(l,"task"),s){if(a===(g=h.getItem(s)).value)return;if(g.start_date.valueOf()===u.valueOf()&&g.end_date.valueOf()===d.valueOf())g.value=a,a?h.updateItem(g.id):h.removeItem(g.id);else{if(g.end_date.valueOf()>d.valueOf()){var _=t.copy(g);_.id=t.uid(),_.start_date=d,_.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.handleResourceCRUD(e,i),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 u=l.xmltop("data",e.xmlDoc);if(!u)return this.cleanUpdate(n);var d=l.xpath("//data/action",u);if(!d.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=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function _(t,e){if(l.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return B(t).length;default:if(i)return F(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,n){var i=t[e];t[e]=t[n],t[n]=i}function p(t,e,n,i,r){if(0===t.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=r?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(r)return-1;n=t.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof e&&(e=l.from(e,i)),l.isBuffer(e))return 0===e.length?-1:v(t,e,n,i,r);if("number"==typeof e)return e&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):v(t,[e],n,i,r);throw new TypeError("val must be string, number or Buffer")}function v(t,e,n,i,r){var a,o=1,s=t.length,l=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;o=2,s/=2,l/=2,n/=2}function c(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(r){var u=-1;for(a=n;as&&(n=s-l),a=n;a>=0;a--){for(var d=!0,h=0;hr&&(i=r):i=r;var a=e.length;if(a%2!=0)throw new TypeError("Invalid hex string");i>a/2&&(i=a/2);for(var o=0;o>8,r=n%256,a.push(r),a.push(i);return a}(e,t.length-n),t,n,i)}function S(t,e,n){return 0===e&&n===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,n))}function T(t,e,n){n=Math.min(t.length,n);for(var i=[],r=e;r239?4:c>223?3:c>191?2:1;if(r+d<=n)switch(d){case 1:c<128&&(u=c);break;case 2:128==(192&(a=t[r+1]))&&(l=(31&c)<<6|63&a)>127&&(u=l);break;case 3:a=t[r+1],o=t[r+2],128==(192&a)&&128==(192&o)&&(l=(15&c)<<12|(63&a)<<6|63&o)>2047&&(l<55296||l>57343)&&(u=l);break;case 4:a=t[r+1],o=t[r+2],s=t[r+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(l=(15&c)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&l<1114112&&(u=l)}null===u?(u=65533,d=1):u>65535&&(u-=65536,i.push(u>>>10&1023|55296),u=56320|1023&u),i.push(u),r+=d}return function(t){var e=t.length;if(e<=$)return String.fromCharCode.apply(String,t);var n="",i=0;for(;ithis.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return A(this,e,n);case"utf8":case"utf-8":return T(this,e,n);case"ascii":return C(this,e,n);case"latin1":case"binary":return E(this,e,n);case"base64":return S(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,e,n);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}.apply(this,arguments)},l.prototype.equals=function(t){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===l.compare(this,t)},l.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),""},l.prototype.compare=function(t,e,n,i,r){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),e<0||n>t.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&e>=n)return 0;if(i>=r)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,r>>>=0,this===t)return 0;for(var a=r-i,o=n-e,s=Math.min(a,o),c=this.slice(i,r),u=t.slice(e,n),d=0;dr)&&(n=r),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return m(this,t,e,n);case"utf8":case"utf-8":return y(this,t,e,n);case"ascii":return k(this,t,e,n);case"latin1":case"binary":return b(this,t,e,n);case"base64":return x(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,t,e,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var $=4096;function C(t,e,n){var i="";n=Math.min(t.length,n);for(var r=e;ri)&&(n=i);for(var r="",a=e;an)throw new RangeError("Trying to access beyond buffer length")}function I(t,e,n,i,r,a){if(!l.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>r||et.length)throw new RangeError("Index out of range")}function P(t,e,n,i){e<0&&(e=65535+e+1);for(var r=0,a=Math.min(t.length-n,2);r>>8*(i?r:1-r)}function N(t,e,n,i){e<0&&(e=4294967295+e+1);for(var r=0,a=Math.min(t.length-n,4);r>>8*(i?r:3-r)&255}function O(t,e,n,i,r,a){if(n+i>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function L(t,e,n,i,a){return a||O(t,0,n,4),r.write(t,e,n,i,23,4),n+4}function R(t,e,n,i,a){return a||O(t,0,n,8),r.write(t,e,n,i,52,8),n+8}l.prototype.slice=function(t,e){var n,i=this.length;if(t=~~t,e=void 0===e?i:~~e,t<0?(t+=i)<0&&(t=0):t>i&&(t=i),e<0?(e+=i)<0&&(e=0):e>i&&(e=i),e0&&(r*=256);)i+=this[t+--e]*r;return i},l.prototype.readUInt8=function(t,e){return e||M(t,1,this.length),this[t]},l.prototype.readUInt16LE=function(t,e){return e||M(t,2,this.length),this[t]|this[t+1]<<8},l.prototype.readUInt16BE=function(t,e){return e||M(t,2,this.length),this[t]<<8|this[t+1]},l.prototype.readUInt32LE=function(t,e){return e||M(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},l.prototype.readUInt32BE=function(t,e){return e||M(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},l.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||M(t,e,this.length);for(var i=this[t],r=1,a=0;++a=(r*=128)&&(i-=Math.pow(2,8*e)),i},l.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||M(t,e,this.length);for(var i=e,r=1,a=this[t+--i];i>0&&(r*=256);)a+=this[t+--i]*r;return a>=(r*=128)&&(a-=Math.pow(2,8*e)),a},l.prototype.readInt8=function(t,e){return e||M(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},l.prototype.readInt16LE=function(t,e){e||M(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(t,e){e||M(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(t,e){return e||M(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},l.prototype.readInt32BE=function(t,e){return e||M(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},l.prototype.readFloatLE=function(t,e){return e||M(t,4,this.length),r.read(this,t,!0,23,4)},l.prototype.readFloatBE=function(t,e){return e||M(t,4,this.length),r.read(this,t,!1,23,4)},l.prototype.readDoubleLE=function(t,e){return e||M(t,8,this.length),r.read(this,t,!0,52,8)},l.prototype.readDoubleBE=function(t,e){return e||M(t,8,this.length),r.read(this,t,!1,52,8)},l.prototype.writeUIntLE=function(t,e,n,i){(t=+t,e|=0,n|=0,i)||I(this,t,e,n,Math.pow(2,8*n)-1,0);var r=1,a=0;for(this[e]=255&t;++a=0&&(a*=256);)this[e+r]=t/a&255;return e+n},l.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,1,255,0),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},l.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):P(this,t,e,!0),e+2},l.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):P(this,t,e,!1),e+2},l.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):N(this,t,e,!0),e+4},l.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):N(this,t,e,!1),e+4},l.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e|=0,!i){var r=Math.pow(2,8*n-1);I(this,t,e,n,r-1,-r)}var a=0,o=1,s=0;for(this[e]=255&t;++a>0)-s&255;return e+n},l.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e|=0,!i){var r=Math.pow(2,8*n-1);I(this,t,e,n,r-1,-r)}var a=n-1,o=1,s=0;for(this[e+a]=255&t;--a>=0&&(o*=256);)t<0&&0===s&&0!==this[e+a+1]&&(s=1),this[e+a]=(t/o>>0)-s&255;return e+n},l.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,1,127,-128),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},l.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):P(this,t,e,!0),e+2},l.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):P(this,t,e,!1),e+2},l.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):N(this,t,e,!0),e+4},l.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):N(this,t,e,!1),e+4},l.prototype.writeFloatLE=function(t,e,n){return L(this,t,e,!0,n)},l.prototype.writeFloatBE=function(t,e,n){return L(this,t,e,!1,n)},l.prototype.writeDoubleLE=function(t,e,n){return R(this,t,e,!0,n)},l.prototype.writeDoubleBE=function(t,e,n){return R(this,t,e,!1,n)},l.prototype.copy=function(t,e,n,i){if(n||(n=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e=0;--r)t[r+e]=this[r+n];else if(a<1e3||!l.TYPED_ARRAY_SUPPORT)for(r=0;r>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(a=e;a55295&&n<57344){if(!r){if(n>56319){(e-=3)>-1&&a.push(239,191,189);continue}if(o+1===i){(e-=3)>-1&&a.push(239,191,189);continue}r=n;continue}if(n<56320){(e-=3)>-1&&a.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(e-=3)>-1&&a.push(239,191,189);if(r=null,n<128){if((e-=1)<0)break;a.push(n)}else if(n<2048){if((e-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function B(t){return i.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(j,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,e,n,i){for(var r=0;r=e.length||r>=t.length);++r)e[r+n]=t[r];return r}}).call(this,n(4))},function(t,e,n){var i=n(0),r=n(5),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 n+=r.getHtmlSelect(t.options,[{key:"style",value:"width:100%;"},{key:"title",value:t.name}]),n+=""},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||un.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(20);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(),u=t.getTaskType(e.type),d=a.getBarHeight(e.id,u==l.types.milestone),h=0;u==l.types.milestone&&(h=(d-s.height)/2);var f=Math.floor((a.getItemHeight(e.id)-d)/2);u==l.types.milestone&&(s.left-=Math.round(d/2),s.width=d);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&&u!=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 u=document.createElement("div"),d=l;r.rtl&&(d=i-l),u.style.left=d+"px",u.className="gantt_task_progress_drag",s.appendChild(u),n.appendChild(u)}}(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,u=s.link_from_start,d=s.link_to_start,h=t.isLinkAllowed(c,i,u,d),f="";f=h?d?"link_start_allow":"link_finish_allow":d?"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:"+(u==l.types.milestone?s.height:d)+"px","line-height:"+Math.max(d<30?d-2:d,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)&&u!=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:"+d+"px","line-height:"+d+"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(33),r=n(5),a=n(0),o=n(2),s=n(43),l=n(128),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 u=0,d=t.count;!i.smart_scales||isNaN(e)||isNaN(n)||(u=o.findBinary(t.left,e),d=o.findBinary(t.left,n)+1),l=t.css||function(){},!t.css&&i.inherit_scale_class&&(l=r.scale_cell_class);for(var h=u;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 u=(t-n[s])/this._getColumnDuration(this._tasks,n[s]);return c?c[s]+(1-u):s+u},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 u=a[this.$config.bind+"_attribute"];if(!u&&this.$config.bind&&(u="data-"+this.$config.bind+"-id"),this.$config.item_attribute=u||null,!this.$config.layers){var d=this._createLayerConfig();this.$config.layers=d}var h=o(e,this);h.init(),this._renderHeaderResizers=h.doOnRender,this._mouseDelegates=n(31)(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=(d=this.$getConfig()).grid_elastic_columns,o=0,s=i.length;ou.max_width&&(d=u.max_width-u.width),r-=u.width,u.width+=d,l-=d}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&&(d.width=h=f-o),o+=h;var _=t._sort&&d.name==t._sort.name?"
":"",g=["gantt_grid_head_cell","gantt_grid_head_"+d.name,u?"gantt_last_cell":"",i.grid_header_class(d.name,d)].join(" "),p="width:"+(h-(u?1:0))+"px;",v=d.label||s["column_"+d.name]||s[d.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=u},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;u--){var d=u==t.length-1,h=this.initScaleConfig(t[u],r,a);d&&this.processIgnores(h),this.initColSizes(h,e,l,s[u]),this.limitVisibleRange(h),d&&(l=h.full_width),c.unshift(h)}for(u=0;u=+l&&(l=e.add(c,i,n));+c<+l;){o.call(this,new Date(c));var u=c.getTimezoneOffset();c=e.add(c,i,n),c=t._correct_dst_change(c,u,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),u=0,d=0;d"}};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,u,d,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 u=s.gravity+c.gravity,d=s[n]+c[n],h=u/d;t[o].$config.gravity=h*r,l.$config[n]=d-r,l.$config.gravity=u-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+u)return!1;if(e.y_endh){var g=h;h=d,d=g}if(f>_){g=_;_=f,f=g}return d+=-100,h+=100,f+=-100,_+=100,!(e.x>h&&e.x>_)&&!(e.x_endc.x&&f.topc.y&&u.push(h.id)}return{ids:u}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(196),r=n(195),a=n(194);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(208);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());var a=this.getChildren(r);a.indexOf(t.id+"")>-1||a.indexOf(+t.id)>-1||(1*e==e?a.splice(e,0,t.id):a.push(t.id),t.$rendered_parent=r)},_move_branch:function(t,e,n){this._eachItemMainRangeCache=null,this._replace_branch_child(e,t.id),this.exists(n)||n==this.$getRootId()?this._add_branch(t,void 0,n):delete this._branches[t.id],t.$level=this.calculateItemLevel(t),this.eachItem(function(t){t.$level=this.calculateItemLevel(t)},t.id)},_replace_branch_child:function(t,e,n){var r=this.getChildren(t);if(r&&void 0!==t){var a=i.$create(),o=r.indexOf(e+"");-1!=o||isNaN(+e)||(o=r.indexOf(+e)),o>-1&&(n?r.splice(o,1,n):r.splice(o,1)),a=r,this._branches[t]=a}},sort:function(t,e,n){this.exists(n)||(n=this.$getRootId()),t||(t="order");var i="string"==typeof t?function(e,n){return e[t]==n[t]||a.isDate(e[t])&&a.isDate(n[t])&&e[t].valueOf()==n[t].valueOf()?0:e[t]>n[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;n",'"',"`"," ","\r","\n","\t"]),d=["'"].concat(u),h=["%","/","?",";","#"].concat(d),f=["/","?","#"],_=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,p={javascript:!0,"javascript:":!0},v={javascript:!0,"javascript:":!0},m={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=n(275);function k(t,e,n){if(t&&a.isObject(t)&&t instanceof o)return t;var i=new o;return i.parse(t,e,n),i}o.prototype.parse=function(t,e,n){if(!a.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+i(t));var o=t.indexOf("?"),l=-1!==o&&o127?N+="x":N+=P[O];if(!N.match(_)){var R=M.slice(0,E),j=M.slice(E+1),H=P.match(g);H&&(R.push(H[1]),j.unshift(H[2])),j.length&&(k="/"+j.join(".")+k),this.hostname=R.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),D||(this.hostname=r.toASCII(this.hostname));var F=this.port?":"+this.port:"",B=this.hostname||"";this.host=B+F,this.href+=this.host,D&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==k[0]&&(k="/"+k))}if(!p[w])for(E=0,I=d.length;E0)&&n.host.split("@"))&&(n.auth=A.shift(),n.host=n.hostname=A.shift());return n.search=t.search,n.query=t.query,a.isNull(n.pathname)&&a.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!w.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var T=w.slice(-1)[0],$=(n.host||t.host||w.length>1)&&("."===T||".."===T)||""===T,C=0,E=w.length;E>=0;E--)"."===(T=w[E])?w.splice(E,1):".."===T?(w.splice(E,1),C++):C&&(w.splice(E,1),C--);if(!b&&!x)for(;C--;C)w.unshift("..");!b||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),$&&"/"!==w.join("/").substr(-1)&&w.push("");var A,D=""===w[0]||w[0]&&"/"===w[0].charAt(0);S&&(n.hostname=n.host=D?"":w.length?w.shift():"",(A=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=A.shift(),n.host=n.hostname=A.shift()));return(b=b||n.host&&w.length)&&!D&&w.unshift(""),w.length?n.pathname=w.join("/"):(n.pathname=null,n.path=null),a.isNull(n.pathname)&&a.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},o.prototype.parseHost=function(){var t=this.host,e=l.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},function(t,e,n){"use strict";t.exports=a;var i=n(12),r=n(17);function a(t){if(!(this instanceof a))return new a(t);i.call(this,t),this._transformState={afterTransform:function(t,e){var n=this._transformState;n.transforming=!1;var i=n.writecb;if(!i)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=e&&this.push(e),i(t);var r=this._readableState;r.reading=!1,(r.needReadable||r.length>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function s(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function l(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var i=n.charCodeAt(n.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function c(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function u(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function d(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(t){return t.toString(this.encoding)}function f(t){return t&&t.length?this.write(t):""}e.StringDecoder=a,a.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return r>0&&(t.lastNeed=r-1),r;if(--i=0)return r>0&&(t.lastNeed=r-2),r;if(--i=0)return r>0&&(2===r?r=0:t.lastNeed=r-3),r;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var i=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},a.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,n){(function(t){var i=void 0!==t&&t||"undefined"!=typeof self&&self||window,r=Function.prototype.apply;function a(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new a(r.call(setTimeout,i,arguments),clearTimeout)},e.setInterval=function(){return new a(r.call(setInterval,i,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(i,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(284),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(4))},function(t,e,n){"use strict";(function(e,i,r){var a=n(23);function o(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var i=t.entry;t.entry=null;for(;i;){var r=i.callback;e.pendingcb--,r(n),i=i.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=m;var s,l=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?i:a.nextTick;m.WritableState=v;var c=n(17);c.inherits=n(8);var u={deprecate:n(283)},d=n(60),h=n(22).Buffer,f=r.Uint8Array||function(){};var _,g=n(59);function p(){}function v(t,e){s=s||n(12),t=t||{};var i=e instanceof s;this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var r=t.highWaterMark,c=t.writableHighWaterMark,u=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:i&&(c||0===c)?c:u,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var d=!1===t.decodeStrings;this.decodeStrings=!d,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,i=n.sync,r=n.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,i,r){--e.pendingcb,n?(a.nextTick(r,i),a.nextTick(S,t,e),t._writableState.errorEmitted=!0,t.emit("error",i)):(r(i),t._writableState.errorEmitted=!0,t.emit("error",i),S(t,e))}(t,n,i,e,r);else{var o=x(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||b(t,n),i?l(k,t,n,o,r):k(t,n,o,r)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function m(t){if(s=s||n(12),!(_.call(m,this)||this instanceof s))return new m(t);this._writableState=new v(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),d.call(this)}function y(t,e,n,i,r,a,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,n?t._writev(r,e.onwrite):t._write(r,a,e.onwrite),e.sync=!1}function k(t,e,n,i){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),S(t,e)}function b(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var i=e.bufferedRequestCount,r=new Array(i),a=e.corkedRequestsFree;a.entry=n;for(var s=0,l=!0;n;)r[s]=n,n.isBuf||(l=!1),n=n.next,s+=1;r.allBuffers=l,y(t,e,!0,e.length,r,"",a.finish),e.pendingcb++,e.lastBufferedRequest=null,a.next?(e.corkedRequestsFree=a.next,a.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,u=n.encoding,d=n.callback;if(y(t,e,!1,e.objectMode?1:c.length,c,u,d),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function x(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function w(t,e){t._final(function(n){e.pendingcb--,n&&t.emit("error",n),e.prefinished=!0,t.emit("prefinish"),S(t,e)})}function S(t,e){var n=x(e);return n&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,a.nextTick(w,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),n}c.inherits(m,d),v.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(v.prototype,"buffer",{get:u.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(_=Function.prototype[Symbol.hasInstance],Object.defineProperty(m,Symbol.hasInstance,{value:function(t){return!!_.call(this,t)||this===m&&(t&&t._writableState instanceof v)}})):_=function(t){return t instanceof this},m.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},m.prototype.write=function(t,e,n){var i=this._writableState,r=!1,o=!i.objectMode&&function(t){return h.isBuffer(t)||t instanceof f}(t);return o&&!h.isBuffer(t)&&(t=function(t){return h.from(t)}(t)),"function"==typeof e&&(n=e,e=null),o?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof n&&(n=p),i.ended?function(t,e){var n=new Error("write after end");t.emit("error",n),a.nextTick(e,n)}(this,n):(o||function(t,e,n,i){var r=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||e.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(t.emit("error",o),a.nextTick(i,o),r=!1),r}(this,i,t,n))&&(i.pendingcb++,r=function(t,e,n,i,r,a){if(!n){var o=function(t,e,n){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=h.from(e,n));return e}(e,i,r);i!==o&&(n=!0,r="buffer",i=o)}var s=e.objectMode?1:i.length;e.length+=s;var l=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(m.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),m.prototype._write=function(t,e,n){n(new Error("_write() is not implemented"))},m.prototype._writev=null,m.prototype.end=function(t,e,n){var i=this._writableState;"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!==t&&void 0!==t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||i.finished||function(t,e,n){e.ending=!0,S(t,e),n&&(e.finished?a.nextTick(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,i,n)},Object.defineProperty(m.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),m.prototype.destroy=g.destroy,m.prototype._undestroy=g.undestroy,m.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,n(9),n(57).setImmediate,n(4))},function(t,e,n){"use strict";var i=n(23);function r(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var n=this,a=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return a||o?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||i.nextTick(r,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!e&&t?(i.nextTick(r,n,t),n._writableState&&(n._writableState.errorEmitted=!0)):e&&e(t)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(t,e,n){t.exports=n(61).EventEmitter},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)}function i(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(t){return"function"==typeof t}function a(t){return"object"===n(t)&&null!==t}function o(t){return void 0===t}t.exports=i,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._maxListeners=void 0,i.defaultMaxListeners=10,i.prototype.setMaxListeners=function(t){if(!function(t){return"number"==typeof t}(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},i.prototype.emit=function(t){var e,n,i,s,l,c;if(this._events||(this._events={}),"error"===t&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var u=new Error('Uncaught, unspecified "error" event. ('+e+")");throw u.context=e,u}if(o(n=this._events[t]))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(a(n))for(s=Array.prototype.slice.call(arguments,1),i=(c=n.slice()).length,l=0;l0&&this._events[t].length>n&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(t,e){if(!r(e))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(t,i),n||(n=!0,e.apply(this,arguments))}return i.listener=e,this.on(t,i),this},i.prototype.removeListener=function(t,e){var n,i,o,s;if(!r(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(o=(n=this._events[t]).length,i=-1,n===e||r(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(a(n)){for(s=o;s-- >0;)if(n[s]===e||n[s].listener&&n[s].listener===e){i=s;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},i.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[t]))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},i.prototype.listeners=function(t){return this._events&&this._events[t]?r(this._events[t])?[this._events[t]]:this._events[t].slice():[]},i.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(r(e))return 1;if(e)return e.length}return 0},i.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,n){"use strict";(function(e,i){var r=n(23);t.exports=y;var a,o=n(67);y.ReadableState=m;n(61).EventEmitter;var s=function(t,e){return t.listeners(e).length},l=n(60),c=n(22).Buffer,u=e.Uint8Array||function(){};var d=n(17);d.inherits=n(8);var h=n(287),f=void 0;f=h&&h.debuglog?h.debuglog("stream"):function(){};var _,g=n(286),p=n(59);d.inherits(y,l);var v=["error","close","destroy","pause","resume"];function m(t,e){a=a||n(12),t=t||{};var i=e instanceof a;this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var r=t.highWaterMark,o=t.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:i&&(o||0===o)?o:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new g,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(_||(_=n(56).StringDecoder),this.decoder=new _(t.encoding),this.encoding=t.encoding)}function y(t){if(a=a||n(12),!(this instanceof y))return new y(t);this._readableState=new m(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),l.call(this)}function k(t,e,n,i,r){var a,o=t._readableState;null===e?(o.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,S(t)}(t,o)):(r||(a=function(t,e){var n;(function(t){return c.isBuffer(t)||t instanceof u})(e)||"string"==typeof e||void 0===e||t.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));return n}(o,e)),a?t.emit("error",a):o.objectMode||e&&e.length>0?("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===c.prototype||(e=function(t){return c.from(t)}(e)),i?o.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):b(t,o,e,!0):o.ended?t.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(e=o.decoder.write(e),o.objectMode||0!==e.length?b(t,o,e,!1):$(t,o)):b(t,o,e,!1))):i||(o.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=x?t=x:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function S(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(f("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?r.nextTick(T,t):T(t))}function T(t){f("emit readable"),t.emit("readable"),D(t)}function $(t,e){e.readingMore||(e.readingMore=!0,r.nextTick(C,t,e))}function C(t,e){for(var n=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):n=function(t,e,n){var i;ta.length?a.length:t;if(o===a.length?r+=a:r+=a.slice(0,t),0===(t-=o)){o===a.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=a.slice(o));break}++i}return e.length-=i,r}(t,e):function(t,e){var n=c.allocUnsafe(t),i=e.head,r=1;i.data.copy(n),t-=i.data.length;for(;i=i.next;){var a=i.data,o=t>a.length?a.length:t;if(a.copy(n,n.length-t,0,o),0===(t-=o)){o===a.length?(++r,i.next?e.head=i.next:e.head=e.tail=null):(e.head=i,i.data=a.slice(o));break}++r}return e.length-=r,n}(t,e);return i}(t,e.buffer,e.decoder),n);var n}function I(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,r.nextTick(P,e,t))}function P(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function N(t,e){for(var n=0,i=t.length;n=e.highWaterMark||e.ended))return f("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?I(this):S(this),null;if(0===(t=w(t,e))&&e.ended)return 0===e.length&&I(this),null;var i,r=e.needReadable;return f("need readable",r),(0===e.length||e.length-t0?M(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&I(this)),null!==i&&this.emit("data",i),i},y.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},y.prototype.pipe=function(t,e){var n=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=t;break;case 1:a.pipes=[a.pipes,t];break;default:a.pipes.push(t)}a.pipesCount+=1,f("pipe count=%d opts=%j",a.pipesCount,e);var l=(!e||!1!==e.end)&&t!==i.stdout&&t!==i.stderr?u:y;function c(e,i){f("onunpipe"),e===n&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,f("cleanup"),t.removeListener("close",v),t.removeListener("finish",m),t.removeListener("drain",d),t.removeListener("error",p),t.removeListener("unpipe",c),n.removeListener("end",u),n.removeListener("end",y),n.removeListener("data",g),h=!0,!a.awaitDrain||t._writableState&&!t._writableState.needDrain||d())}function u(){f("onend"),t.end()}a.endEmitted?r.nextTick(l):n.once("end",l),t.on("unpipe",c);var d=function(t){return function(){var e=t._readableState;f("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,D(t))}}(n);t.on("drain",d);var h=!1;var _=!1;function g(e){f("ondata"),_=!1,!1!==t.write(e)||_||((1===a.pipesCount&&a.pipes===t||a.pipesCount>1&&-1!==N(a.pipes,t))&&!h&&(f("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,_=!0),n.pause())}function p(e){f("onerror",e),y(),t.removeListener("error",p),0===s(t,"error")&&t.emit("error",e)}function v(){t.removeListener("finish",m),y()}function m(){f("onfinish"),t.removeListener("close",v),y()}function y(){f("unpipe"),n.unpipe(t)}return n.on("data",g),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?o(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",p),t.once("close",v),t.once("finish",m),t.emit("pipe",n),a.flowing||(f("pipe resume"),n.resume()),t},y.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n),this);if(!t){var i=e.pipes,r=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var a=0;at._pos){var a=n.substr(t._pos);if("x-user-defined"===t._charset){for(var o=new r(a.length),s=0;st._pos&&(t.push(new r(new Uint8Array(c.result.slice(t._pos)))),t._pos=c.result.byteLength)},c.onload=function(){t.push(null)},c.readAsArrayBuffer(n)}t._xhr.readyState===l.DONE&&"ms-stream"!==t._mode&&t.push(null)}}).call(this,n(9),n(4),n(13).Buffer)},function(t,e,n){(function(t){e.fetch=s(t.fetch)&&s(t.ReadableStream),e.writableStream=s(t.WritableStream),e.abortController=s(t.AbortController),e.blobConstructor=!1;try{new Blob([new ArrayBuffer(1)]),e.blobConstructor=!0}catch(t){}var n;function i(){if(void 0!==n)return n;if(t.XMLHttpRequest){n=new t.XMLHttpRequest;try{n.open("GET",t.XDomainRequest?"/":"https://example.com")}catch(t){n=null}}else n=null;return n}function r(t){var e=i();if(!e)return!1;try{return e.responseType=t,e.responseType===t}catch(t){}return!1}var a=void 0!==t.ArrayBuffer,o=a&&s(t.ArrayBuffer.prototype.slice);function s(t){return"function"==typeof t}e.arraybuffer=e.fetch||a&&r("arraybuffer"),e.msstream=!e.fetch&&o&&r("ms-stream"),e.mozchunkedarraybuffer=!e.fetch&&a&&r("moz-chunked-arraybuffer"),e.overrideMimeType=e.fetch||!!i()&&s(i().overrideMimeType),e.vbArray=s(t.VBArray),n=null}).call(this,n(4))},function(t,e,n){(function(t){var i=n(288),r=n(64),a=n(280),o=n(279),s=n(54),l=e;l.request=function(e,n){e="string"==typeof e?s.parse(e):a(e);var r=-1===t.location.protocol.search(/^https?:$/)?"http:":"",o=e.protocol||r,l=e.hostname||e.host,c=e.port,u=e.path||"/";l&&-1!==l.indexOf(":")&&(l="["+l+"]"),e.url=(l?o+"//"+l:"")+(c?":"+c:"")+u,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var d=new i(e);return n&&d.on("response",n),d},l.get=function(t,e){var n=l.request(t,e);return n.end(),n},l.ClientRequest=i,l.IncomingMessage=r.IncomingMessage,l.Agent=function(){},l.Agent.defaultMaxSockets=4,l.globalAgent=new l.Agent,l.STATUS_CODES=o,l.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}).call(this,n(4))},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e){t.exports=function(t){var e=new RegExp("<(?:.|\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))},setTaskBarAttr:function(e,n){this._taskCommonAttr(e,n),n.setAttribute("role","img"),!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-selected",t.isSelectedTask(e.id)?"true":"false"),n.setAttribute("aria-level",e.$level+1||1),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("role","img"),n.setAttribute("aria-label",i(s)),t.isReadonly(e)&&n.setAttribute("aria-readonly",!0)},gridSeparatorAttr:function(t){t.setAttribute("role","columnheader")},rowResizerAttr:function(t){t.setAttribute("role","row")},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"),t.firstChild.setAttribute("aria-level","1")},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",role:"spinbutton"})},inlineEditorAttr:function(t){t.setAttribute("role","row")},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:"columnheader","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'"},reorderMarkerAttr:function(t){t.setAttribute("role","grid"),t.firstChild.removeAttribute("aria-level"),t.firstChild.setAttribute("aria-grabbed","true")},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' aria-level='1' "},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(18)(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(36);t.exports=function(t){var e=n(7)(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 u=i[c.constraint_date]||new Date;t.form_blocks._fill_lightbox_select(o,0,u,l,r);var d=i[c.constraint_type]||t.getConstraintType(i);a.value=d,s(o,d)},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(18)(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+"
",c="gantt_section_time";return"time"!==e.name&&(c+=" gantt_section_"+e.name),"
"+n+" "+l+"
"},a.prototype.set_value=function(e,n,i,r){var a,c,u,d,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,u=i[a.end_date]||t.calculateEndDate({start_date:c,duration:1,task:i}),d=Math.round(i[a.duration])||t.calculateDuration({start_date:c,end_date:u,task:i}),d=o(r).format(d),t.form_blocks._fill_lightbox_select(h,0,c,v,r),_.value=d,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(7)(t);function r(){return e.apply(this,arguments)||this}return i(r,e),r.prototype.render=function(t){var e=(t.height||"23")+"px",n="
";if(t.options&&t.options.length)for(var i=0;i"+t.options[i].label+"";return n+="
"},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(7)(t);function a(){return e.apply(this,arguments)||this}return r(a,e),a.prototype.render=function(t){var e=(t.height||"23")+"px",n="
";if(t.options&&t.options.length)for(var i=0;i"+t.options[i].label+"";else t.single_value=!0,n+="";return n+="
"},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(7)(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="gantt_section_time";"time"!==e.name&&(i+=" gantt_section_"+e.name);var r="
";return r+=n,e.single_date?(n=t.form_blocks.getTimePicker.call(this,e,!0),r+=""):r+="  –  ",r+=n,r+="
"},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(){d=new Date(o[s[2]].value,o[s[1]].value,o[s[0]].value,0,0),h=t.calculateEndDate({start_date:d,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 u=t._resolve_default_mapping(r);"string"==typeof u&&(u={start_date:u});var d=i[u.start_date]||new Date,h=i[u.end_date]||t.calculateEndDate({start_date:d,duration:1,task:i});t.form_blocks._fill_lightbox_select(o,0,d,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(7)(t);function r(){return e.apply(this,arguments)||this}return i(r,e),r.prototype.render=function(t){var e=(t.height||"130")+"px";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(7)(t);function r(){return e.apply(this,arguments)||this}return i(r,e),r.prototype.render=function(t){var e=(t.height||"30")+"px";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(78)(t),o=n(77)(t),s=n(76)(t),l=n(18)(t),c=n(75)(t),u=n(74)(t),d=n(73)(t),h=n(72)(t),f=n(18)(t),_=n(71)(t),g=n(70)(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,u="";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++)u+="";break;case"%d":for(e._time_format_order[0]=n,e._time_format_order.size++,l=1;l<32;l++)u+="";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 u}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 e=this.getLightboxValues();this.callEvent("onLightboxSave",[this._lightbox_id,e,!!e.$new])&&(t.$data.tasksStore._skipTaskRecalculation="lightbox",e.$new?(delete e.$new,this.addTask(e,e.parent,this.getTaskIndex(e.id))):this.isTaskExists(e.id)&&(this.mixin(this.getTask(e.id),e,!0),this.refreshTask(e.id),this.updateTask(e.id)),t.$data.tasksStore._skipTaskRecalculation=!1,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 d,parent:new h,radio:new u,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),t.config.touch){var e=!0;try{document.createEvent("TouchEvent")}catch(t){e=!1}e?t._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?t._touch_events(["pointermove","pointerdown","pointerup"],function(t){return"mouse"==t.pointerType?null:t},function(t){return!t||"mouse"==t.pointerType}):window.navigator.msPointerEnabled&&t._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})}}function n(e){var n=e.$config.scrollX?t.$ui.getView(e.$config.scrollX):null,i=e.$config.scrollY?t.$ui.getView(e.$config.scrollY):null,r={x:null,y:null};n&&(n.getScrollState().visible&&(r.x=n.$view.scrollLeft));i&&(i.getScrollState().visible&&(r.y=i.$view.scrollTop));return r}function i(){var e;return t.$ui.getView("timeline")&&(e=t.$ui.getView("timeline")._tasks_dnd),e}t.config.touch_drag=75,t.config.touch=!0,t.config.touch_feedback=!0,t.config.touch_feedback_duration=1,t._prevent_touch_scroll=!1,t._touch_feedback=function(){t.config.touch_feedback&&navigator.vibrate&&navigator.vibrate(t.config.touch_feedback_duration)},t.attachEvent("onGanttReady",e),t.attachEvent("onGanttLayoutReady",function(){t.$container&&t.attachEvent("onGanttRender",e,{once:!0})});var r=[];t._touch_events=function(e,a,o){for(var s,l=0,c=!1,u=!1,d=null,h=null,f=null,_=[],g=null,p={},v=0;v5||Math.abs(p)>5)&&(u=!0,l=0,s=g?n(g):t.getScrollState()),u){var v,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),v=n(g)):(t.scrollTo(y,k),v=t.getScrollState()),s.x!=v.x&&p>2*_||s.y!=v.y&&_>2*p)return m(e)}}return m(e)}return!0}}]);try{document.addEventListener("touchmove",function(e){t._touch_drag&&m(e)},{passive:!1})}catch(t){console.warn("Cannot prevent touch event for the page drag")}r.push([this.$container,"contextmenu",function(t){if(c)return m(t)}]),r.push([this.$container,e[1],function(e){if(p=e.touches.length,document&&document.body&&document.body.classList.add("gantt_touch_active"),!o(e))if(e.touches&&e.touches.length>1)c=!1;else{d=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]}}(d),t._locate_css(d,"gantt_hor_scroll")||t._locate_css(d,"gantt_ver_scroll")||(c=!0);var n=i();h=setTimeout(function(){var e=t.locate(d);n&&e&&!t._locate_css(d,"gantt_link_control")&&!t._locate_css(d,"gantt_grid_data")&&(n.on_mouse_down(d),n.drag&&n.drag.start_drag&&(!function(e){var n=t._getTaskLayers(),i=t.getTask(e);if(i){var r=t.isTaskVisible(e);if(r){f=e;for(var a=0;ae._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&&!x?c=0:c<0&&!b?c=0:c>0&&b+x>=w&&(c=0);var S=t.config.autoscroll_step;S&&S<2&&(S=2),c*=S||n,_*=S||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(84),n(83),n(82)],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,u=t.$ui.getView(a.$config.scrollY).$config.width,d=c-(a.$config.width+u);d<0&&(a.$config.width+=d,t.config.grid_width+=d)}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+d&&(h.y=a.bottom+d-r.height-s),h.right>a.right&&(h.x=a.right-r.width-o),h}function v(t){var n=u(),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=u(),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 d=(a-i)/(r-n),h=Math.atan(d);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 u=!!i.locateClassName(s,"gantt_link_control"),d=r,h=n,f=a,m=e.locate(s),k=!0,b=i.getTargetNode(s);if(i.isChildOf(b,e.$root)||(u=!1,m=null),u&&(k=!i.locateClassName(s,"task_end_date"),u=!!m),r=m,n=u,a=k,u){var x=e.getTask(m),w=t.$getConfig(),S=i.locateClassName(s,"gantt_link_control"),T=0;S&&(T=Math.floor(S.offsetWidth/2)),this._dir_end=g(x,!!a,T,w)}else this._dir_end=i.getRelativeEventPosition(s,t.$task_data),e.env.isEdge&&(this._dir_end.y+=window.scrollY);var $=!(h==u&&d==m&&f==k);return $&&(d&&e.refreshTask(d,!1),m&&e.refreshTask(m,!1)),$&&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=u();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(50),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 u=c-s.end;(ui||void 0===i)&&(i=d)}}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,u=e.getTask(a.id);if(this._handlers[a.mode]){if(a.mode===o.drag_mode.move){var d={};this._isMultiselect()&&e.getSelectedTasks().indexOf(a.id)>=0&&(d=this.dragMultiple);var h=!1;if(e.isSummaryTask(u)&&e.config.drag_project){var f={};f[a.id]=r.copy(a),h=!0,d=r.mixin(f,this.dragMultiple)}var _=this._find_max_shift(d,c);for(var g in void 0!==_&&(c=_),this._update_item_on_move(c,a.id,a.mode,a,n),d){var p=d[g];if(h&&p.id!=a.id&&(e._bulk_dnd=!0),void 0===_&&(h||Object.keys(d).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 u=i.getRelativeEventPosition(n,e.$task_data);c.start_x=u.x,c.start_y=u.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)o[t].id!=i.id&&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(98),a=n(97),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(31)(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),u=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 d=0;n.eachItem(function(t){-1!==n.getIndexById(t.id)&&d++},t.targetId),i.y=c+u+d*u}else i.y=c+u,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(24);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(24);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 u=s.getItem(e),d=s.calculateItemLevel(u);if(d===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(d>l)s.eachParent(function(t){s.calculateItemLevel(t)===l&&(e=t.id)},u),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(24),a=n(102),o=n(101),s=n(100),l=n(16);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=u(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)&&!d(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=u(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,t._waiAria.reorderMarkerAttr(c.config.marker),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 u(t){return i.locateAttribute(t,e.$config.item_attribute)}function d(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,u=e.getItemIndexByTopPosition(e.$state.scrollTop);if(a.exists(u)||(u=a.countVisible()-1),u<0)return a.$getRootId();var h=a.getIdByIndex(u),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 d(y)?a.getPrevSibling(y):a.getIdByIndex(m)}(n),l=null,u=e.$config.rowStore,h=!e.$getConfig().order_branch_free,f=i.getRelativeEventPosition(n,e.$grid_data).y;return document.doctype||(f+=window.scrollY),s!==u.$getRootId()&&(l=(f-e.getItemTop(s))/e.getItemHeight(s)),h?(r=a(c.config.id,s,l,f,u,c.config.level))&&r.targetParent&&d(r.targetParent)&&(s=u.getPrevSibling(r.targetParent),r=a(c.config.id,s,l,f,u,c.config.level)):r=o(c.config.id,s,l,f,u),r}}}},function(t,e,n){var i=n(1),r=n(16);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 u=c.getAttribute(e.$config.item_attribute);if(l(u))return!1;var d=s().getItem(u);return!t.isReadonly(d)&&(a.config.initial_open_state=d.$open,!!t.callEvent("onRowDragStart",[u,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,u=a.config,d=a._getGridPos(r);t._waiAria.reorderMarkerAttr(u.marker);var h=e.$getConfig(),f=s();d.y_.width&&(u.marker.style.width=_.width-10-2+"px",u.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;)T=f.getIdByIndex(x-C),$=f.getItem(T),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?$&&m($,g)&&g.id!=$.id&&f.move(g.id,-1,f.getParent($.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(104),a=n(103),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(31)(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.rowResizerAttr(a),a},update:null,getRectangle:i,getVisibleRange:r}}},function(t,e,n){var i=n(27),r=n(6),a=n(26),o=n(25),s=n(37);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={},u={},d={};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,u){var h=d[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"),u=a(o,r),d=u.start;d<=u.end;d++){var h=o.trace_x[d],f=o.trace_x[d+1]||t.date.add(h,o.step,o.unit),_=o.trace_x[d].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,u);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),u=o.getItemHeight(t.id)-1;if(s||l){var d=document.createElement("div");return d.className=["gantt_histogram_cell",s].join(" "),d.setAttribute(o.$config.item_attribute,t.id),d.style.cssText=["left:"+e.left+"px","width:"+e.width+"px","height:"+u+"px","line-height:"+u+"px","top:"+(e.top+1)+"px"].join(";"),l&&(l="
"+l+"
"),c&&(l="
"+l),l&&(d.innerHTML=l),d}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]={},u[i.id]=null,d[i.id]=null;for(var y=!!l,k=a(h,l),b=k.start;b<=k.end;b++){var x=g[b];if(x&&(!y||o(b,h,l,t))){var w=c.histogram_cell_capacity(x.start_date,x.end_date,i,x.tasks,x.assignments);v[x.start_date.valueOf()]=w||0;var S=r.getItemPosition(i,x.start_date,x.end_date),T=_(i,S,m,0,c,x,r);T&&(p.push(T),n[i.id][b]=T)}}var $=null;if(p.length){$=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(d)}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 x=s.grid_row_class.call(t,e.start_date,e.end_date,e);x&&(p+=" "+x)}l.isSelected(e.id)&&(p+=" gantt_selected");var w=document.createElement("div");w.className="gantt_row"+p+" gantt_row_"+t.getTaskType(e.type);var S=n.getItemHeight(e.id);return w.style.height=S+"px",w.style.lineHeight=S+"px",i.smart_rendering&&(w.style.position="absolute",w.style.left="0px",w.style.top=n.getItemTop(e.id)+"px"),n.$config.item_attribute&&(w.setAttribute(n.$config.item_attribute,e.id),w.setAttribute(n.$config.bind+"_id",e.id)),t._waiAria.taskRowAttr(e,w),w.innerHTML=c.join(""),w},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,u=e.dirs,d=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(u.left,h),_?(this.point_to(u.down,l),this.point_to(u.right,c)):(this.point_to(u.right,c),this.point_to(u.down,l)),this.point_to(u.right,h);else if(!f.from_start&&f.to_start)if(_=o.e_x>o.x+2*h,this.point_to(u.right,h),_)c-=h,this.point_to(u.down,l),this.point_to(u.right,c);else{c-=2*h;var g=l>0?1:-1;this.point_to(u.down,g*(d/2)),this.point_to(u.right,c),this.point_to(u.down,g*(Math.abs(l)-d/2)),this.point_to(u.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(u.left,h),_?(c+=2*h,g=l>0?1:-1,this.point_to(u.down,g*(d/2)),this.point_to(u.right,c),this.point_to(u.down,g*(Math.abs(l)-d/2)),this.point_to(u.left,h)):(c+=h,this.point_to(u.down,l),this.point_to(u.right,c))):(this.point_to(u.right,h),_?(this.point_to(u.right,c),this.point_to(u.down,l)):(this.point_to(u.down,l),this.point_to(u.right,c)),this.point_to(u.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),u=a(i,e,r);return{x:s?c.left:c.left+c.width,e_x:l?u.left:u.left+u.width,y:c.top+c.rowHeight/2-1,e_y:u.top+u.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 u=n.get_points(i,r,o,s),d=e.get_lines(u,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)&&u(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)?u(t.id,k):b&&!b.parentNode&&i.appendChild(b)}}},getRectangle:i,getVisibleRange:a,prepareData:l}}},function(t,e,n){var i=n(28),r=n(19),a=n(6);t.exports=function(t){var e=i(t),n={};function o(t,e,n,i,a){var o=!0;return i.smart_rendering&&(o=r(t,e,n,i,a)),o}function s(n,i,r,a){var o=t.copy(t.getTask(i.id));if(o.$rendered_at=n.id,!1!==t.callEvent("onBeforeRollupTaskDisplay",[o.id,o,n.id])){var s=e(o,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_rollup_child"),s.setAttribute("data-rollup-parent-id",n.id),s}}}function l(t,e){return t+"_"+e}return{render:function(e,i,r,a){if(!1!==e.rollup&&e.$rollup&&e.$rollup.length){var c=document.createElement("div"),u=t.getTaskPosition(e);return a&&(a.y=0,a.y_end=t.$task_bg.scrollHeight),e.$rollup.forEach(function(d){if(t.isTaskExists(d)){var h=t.getTask(d);if(o(h,a,i,r,t)){var f=s(e,h,i,u);f?(n[l(h.id,e.id)]=f,c.appendChild(f)):n[l(h.id,e.id)]=!1}}}),c}return!1},update:function(e,i,r,a,c){var u=document.createElement("div"),d=t.getTaskPosition(e);c.y=0,c.y_end=t.$task_bg.scrollHeight,e.$rollup.forEach(function(h){var f=t.getTask(h),_=l(f.id,e.id),g=o(f,c,r,a,t);if(g!==!!n[_])if(g){var p=s(e,f,r,d);n[_]=p||!1}else n[_]=!1;n[_]&&u.appendChild(n[_]),i.innerHTML="",i.appendChild(u)})},isInViewPort:r,getVisibleRange:a}}},function(t,e,n){var i=n(19);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(28),r=n(6),a=n(114),o=n(19);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),u=Math.floor((r.getItemHeight(n.id)-c)/2);return l.style.top=a.top+u+"px",l.classList.add("gantt_split_child"),o&&l.classList.add("gantt_split_subproject"),l}}}}function c(t,e){return t+"_"+e}function u(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(u(e,r)){var o=document.createElement("div"),d=t.getTaskPosition(e);return t.hasChild(e.id)&&t.eachTask(function(u){if(s(u,a,i,r,t)){var h=l(e,u,i,d);h?(n[c(u.id,e.id)]=h,o.appendChild(h)):n[c(u.id,e.id)]=!1}},e.id),o}return!1},update:function(e,i,r,a,o){if(u(e,a)){var d=document.createElement("div"),h=t.getTaskPosition(e);t.eachTask(function(u){var f=c(u.id,e.id),_=s(u,o,r,a,t);if(_!==!!n[f])if(_){var g=l(e,u,r,h);n[f]=g||!1}else n[f]=!1;n[f]&&d.appendChild(n[f]),i.innerHTML="",i.appendChild(d)},e.id)}},isInViewPort:a,getVisibleRange:r}}},function(t,e,n){var i=n(19),r=n(6),a=n(28);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(10)(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(10)(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(10)(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 u=l?" min='"+a(l)+"' ":"",d=c?" max='"+a(c)+"' ":"",h="
");s.innerHTML=h},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(10)(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(10)(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=n.min||0,a=n.max||100,o="
");i.innerHTML=o},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(10)(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,u=r.keyCode,d=!1;switch(u){case c.ENTER:t.isVisible()?(t.save(),r.preventDefault(),d=!0):s&&!(r.ctrlKey||r.metaKey||r.shiftKey)&&(n.startEdit(o.id,o.columnName),r.preventDefault(),d=!0);break;case c.ESC:t.isVisible()&&(t.hide(),r.preventDefault(),d=!0);break;case c.UP:case c.DOWN:break;case c.LEFT:case c.RIGHT:(s&&t.isVisible()||"date"===l.editorType)&&(d=!0);break;case c.SPACE:t.isVisible()&&(d=!0),s&&!t.isVisible()&&(n.startEdit(o.id,o.columnName),r.preventDefault(),d=!0);break;case c.DELETE:s&&!t.isVisible()?(n.startEdit(o.id,o.columnName),d=!0):s&&t.isVisible()&&(d=!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(),d=!0}break;default:if(t.isVisible())d=!0;else if(u>=48&&u<=57||u>95&&u<112||u>=64&&u<=91||u>185&&u<193||u>218&&u<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),d=!0)}}return!d})},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(125),r=n(124);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(126),r=n(123),a=n(122),o=n(121),s=n(120),l=n(119),c=n(118),u=n(0),d=n(1),h=n(5),f=n(117);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(e,n){var r=i.$getConfig(),a=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,u=0;u0?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 u.mixin(c,e),u.mixin(c,n),c}};return u.mixin(r,e),u.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(11),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;id[s]&&d[o]>e&&u>d[s]-l+2&&(e=u+(i?0:2),n=d[s]);else{var h=Math.max(d[o]-u,0);(u+=h)>Math.max(d[s]-h,0)&&u>e&&(e=u,n=d[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||(d=2*h,h=0)),d&&Math.abs(d)>Math.abs(h)){if(this._isVertical())return;if(i.x)return!0;if(!this.$scroll_hor||!this.$scroll_hor.offsetWidth)return!0;var _=d/-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(14));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(14));t.exports=a},function(t,e,n){var i=n(3),r=n(38),a=n(14),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 u(e,n,i){return"
"+e+"
"}function d(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&&(_+=u(h(s.ok,t.locale.labels.message_ok,"OK"),"ok",!0)),c&&(_+=u(h(s.cancel,t.locale.labels.message_cancel,"Cancel"),"cancel",!1)),s.buttons)for(var g=0;g",d.innerHTML=_,s.content){var v=s.content;"string"==typeof v&&(v=document.getElementById(v)),"none"==v.style.display&&(v.style.display=""),d.childNodes[s.title?1:0].appendChild(v)}return d.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=d,(l||c)&&(n=s),d}(l,d,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 d(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),o=t.config.start_date||t.getState().min_date;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}):o:o}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(),u=a.end_date.valueOf();t.resetProjectDates(a),r||c!=a.start_date.valueOf()||u!=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 u=(r=t.date[c+"_start"](t.date.add(r,l,c))).getTimezoneOffset();r=t._correct_dst_change(r,u,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))(d||h&&f)&&(s=r[n+"_start"](new Date(a)),l=r.add(s,i,n)),d?(d=!1,u=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)&&(u=this._getClosestWorkTimeFuture(a,g))}a=u}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 u=this.$gantt.date.week_start(new Date(s));if(s.valueOf()===u.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,u=this._getMinutesBetweenSingleDay(o,s),d=this._getMinutesBetweenSingleDay(l,c);return u+this._getWorkUnitsForRange(s,l,n,i)+d},_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,u=this._getMinutesBetweenSingleDay(o,s,n,i)/60,d=this._getMinutesBetweenSingleDay(l,c,n,i)/60,h=u+this._getWorkUnitsForRange(s,l,n,i)+d;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),u=Math.min(l.end,a.end),d=(u-c)/3600;d>r&&(d=r,u=c+60*r*60);var h=Math.round((u-c)/3600);i+=h,r-=h,a.start=u}}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),u=Math.min(l.end,a.end),d=(u-c)/60;d>r&&(d=r,u=c+60*r);var h=Math.round((u-c)/60);r-=h,i+=h,a.start=u}}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 u=Math.min(o,c.end),d=Math.max(a,c.start),h=(u-d)/60;h>r&&(h=r,d=u-60*r);var f=Math.abs(Math.round((u-d)/60));r-=f,i+=f,o=d}}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=null,m=l.length-1;m>=0;m--)if(l[m].start<_-1&&l[m].end>=_-1){g=!0,p=l[m],v=l[m-1];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)f<=_/60-p.startMinute?(r+=f,i=this.$gantt.date.add(i,-f,"minute")):(r+=_/60-p.startMinute,i=v?new Date(i.getFullYear(),i.getMonth(),i.getDate(),0,0,v.end):this.$gantt.date.day_start(i));else{var y=this._getMinutesPerHour(i);y<=f?(r+=y,i=this._nextDate(i,"hour",n)):(r+=(o=this._subtractMinutesUntilHourStart(i,f)).added,i=o.end)}else if(0===i.getHours()&&0===i.getMinutes()&&0===i.getSeconds()){if((k=this._getClosestWorkTimePast(i,"hour")).valueOf()===i.valueOf()){var k=this.$gantt.date.add(i,-1,"day"),b=this._getWorkHours(k);if(b.length){var x=b[b.length-1];k.setSeconds(x.durationSeconds)}}i=k}else i=this._getClosestWorkTimePast(new Date(i-1),"hour")}else i=this.$gantt.date.add(i,-1,"day")}if(r=h&&d>=l){if(r+=l,d==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&&d>=_.durationMinutes)r+=_.durationMinutes,i=this.$gantt.date.add(i,_.durationMinutes,"minute");else if(d<=_.endMinute-h/60)r+=d,i=this.$gantt.date.add(i,d,"minute");else{var p=this._getMinutesPerHour(i);p<=d?(r+=p,i=c?this.$gantt.date.add(i,p,"minute"):this._nextDate(i,"hour",n)):(r+=(a=this._addMinutesUntilHourEnd(i,d)).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,u=Array.isArray(l)?l:r.hours;a.dates[o]=this._toHoursArray(this._mergeHoursConfig(c,u))}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(42),a=n(198),o=n(197),s=n(192),l=n(191)();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(204),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},d=function(t){return--t});for(var h=this._dragX-this.$grid.$grid.getBoundingClientRect().left+this._scrollableGrid.getCorrection(),f=l;u(f,c)&&(void 0===t||void 0===e);f=d(f))o[f].hide||(s.startX=s.endX,s.endX+=o[f].width,h>=s.startX&&(h<=s.endX||!u(d(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(205);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),u=e.getItemTop(l)-n.scrollTop,d=i.getNodePosition(e.$grid_data),h=parseInt(s.marker.style.top,10),f=u+d.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(44).default,r=n(213).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(){t.$container&&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"),u=t.templates.parse_date(i.getAttribute("data-start-date")),d=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(t.plugins().undo&&t.ext.undo.saveState(l,"task"),s){if(a===(g=h.getItem(s)).value)return;if(g.start_date.valueOf()===u.valueOf()&&g.end_date.valueOf()===d.valueOf())g.value=a,a?h.updateItem(g.id):h.removeItem(g.id);else{if(g.end_date.valueOf()>d.valueOf()){var _=t.copy(g);_.id=t.uid(),_.start_date=d,_.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.handleResourceCRUD(e,i),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 u=l.xmltop("data",e.xmlDoc);if(!u)return this.cleanUpdate(n);var d=l.xpath("//data/action",u);if(!d.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;i0;)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?u.call(this,t,e,n):this._schedule(function(){t.call(e,n)})},l.prototype.settlePromises=function(t){this._trampolineEnabled?d.call(this,t):this._schedule(function(){t._settlePromises()})}):(l.prototype.invokeLater=c,l.prototype.invoke=u,l.prototype.settlePromises=d),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),u=new t(e);u._propagateFrom(this,1);var d=this._target();if(u._setBoundTo(c),c instanceof t){var h={promiseRejectionQueued:!1,promise:u,target:d,bindingPromise:c};d._then(e,o,void 0,u,h),c._then(s,l,void 0,u,h),u._setOnCancel(c)}else u._resolveCallback(d);return u},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,u=t("./errors").Warning,d=t("./util"),h=t("./es5"),f=d.canAttachTrace,_=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,g=/\((?:timers\.js):\d+:\d+\)/,p=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,v=null,m=null,y=!1,k=!(0==d.env("BLUEBIRD_DEBUG")),b=!(0==d.env("BLUEBIRD_WARNINGS")||!k&&!d.env("BLUEBIRD_WARNINGS")),x=!(0==d.env("BLUEBIRD_LONG_STACK_TRACES")||!k&&!d.env("BLUEBIRD_LONG_STACK_TRACES")),w=0!=d.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(b||!!d.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:d.domainBind(e,t):void 0},e.onUnhandledRejectionHandled=function(t){var e=s();r="function"==typeof t?null===e?t:d.domainBind(e,t):void 0};var S=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,S=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 T=function(){try{if("function"==typeof CustomEvent){var t=new CustomEvent("CustomEvent");return d.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!d.global.dispatchEvent(i)}}if("function"==typeof Event){t=new Event("CustomEvent");return d.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}),!d.global.dispatchEvent(n)}}return(t=document.createEvent("CustomEvent")).initCustomEvent("testingtheevent",!1,!0,{}),d.global.dispatchEvent(t),function(t,e){var n=document.createEvent("CustomEvent");return n.initCustomEvent(t.toLowerCase(),!1,!0,e),!d.global.dispatchEvent(n)}}catch(t){}return function(){return!1}}(),$=d.isNode?function(){return n.emit.apply(n,arguments)}:d.global?function(t){var e="on"+t.toLowerCase(),n=d.global[e];return!!n&&(n.apply(d.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},A=function(t){var e=!1;try{e=$.apply(null,arguments)}catch(t){c.throwLater(t),e=!0}var n=!1;try{n=T(t,E[t].apply(null,arguments))}catch(t){c.throwLater(t),n=!0}return n||e};function D(){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: "+d.toString(t));i._attachCancellationCallback(t)})}catch(t){return t}}function I(t){if(!this._isCancellable())return this;var e=this._onCancel();void 0!==e?d.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function P(){return this._onCancelField}function N(t){this._onCancelField=t}function O(){this._cancellationParent=void 0,this._onCancelField=void 0}function L(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()&&S()),"warnings"in t){var n=t.warnings;tt.warnings=!!n,w=tt.warnings,d.isObject(n)&&"wForgottenReturn"in n&&(w=!!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=O,e.prototype._propagateFrom=L,e.prototype._onCancel=P,e.prototype._setOnCancel=N,e.prototype._attachCancellationCallback=I,e.prototype._execute=M,R=L,tt.cancellation=!0}return"monitoring"in t&&(t.monitoring&&!tt.monitoring?(tt.monitoring=!0,e.prototype._fireEvent=A):!t.monitoring&&tt.monitoring&&(tt.monitoring=!1,e.prototype._fireEvent=D)),e},e.prototype._fireEvent=D,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);d.notEnumerableProp(t,"stack",i.message+"\n"+i.stack.join("\n")),d.notEnumerableProp(t,"__stackCleaned__",!0)}}}function B(){this._trace=void 0}function z(t,n,i){if(tt.warnings){var r,a=new u(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")}A("warning",a)||V(a,"",!0)}}function U(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:U(e)}}function V(t,e,n){if("undefined"!=typeof console){var i;if(d.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?A(t,n,i)||r||V(n,"Unhandled rejection "):A(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():d.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 J=function(){return!1},X=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function K(t){var e=t.match(X);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()}d.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(U(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)},d.isNode&&n.stderr.isTTY?o=function(t,e){var n=e?"":"";console.warn(n+t+"\n")}:d.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 x&&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&&w){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=U(s),c=l.length-1;c>=0;--c){var u=l[c];if(!g.test(u)){var d=u.match(p);d&&(a="at "+d[1]+":"+d[2]+":"+d[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||(J=function(t){if(_.test(t))return!0;var e=K(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:T,fireGlobalEvent:$}}},{"./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 u(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 d=u("Warning","warning"),h=u("CancellationError","cancellation error"),f=u("TimeoutError","timeout error"),_=u("AggregateError","aggregate error");try{i=TypeError,r=RangeError}catch(t){i=u("TypeError","type error"),r=u("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 d(){return f.call(this,this.promise._target()._settledValue())}function h(t){if(!u(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(d,h,void 0,this,void 0)}}}return r.isRejected()?(u(this),o.e=t,o):(u(this),t)}return l.prototype.isFinallyHandler=function(){return 0===this.type},c.prototype._resultCancelled=function(){u(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"),u=c.tryCatch,d=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 _=u(h).call(f,t,n,a),g=c._popContext();if(o.checkForgottenReturns(_,g,null!==s?"Promise.filter":"Promise.map",c),_===d)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],u=arguments[2];i=o.isArray(c)?s(t).apply(u,c):s(t).call(u,c)}else i=s(t)();var d=l._popContext();return a.checkForgottenReturns(i,d,"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)},A.prototype.done=function(t,e){this._then(t,e,void 0,void 0,void 0)._setIsFinal()},A.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)},A.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},A.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new k(this).promise()},A.prototype.error=function(t){return this.caught(c.originatesFromRejection,t)},A.getNewLibraryCopy=e.exports,A.is=function(t){return t instanceof A},A.fromNode=A.fromCallback=function(t){var e=new A(p);e._captureStackTrace();var n=arguments.length>1&&!!Object(arguments[1]).multiArgs,i=E(t)($(e,n));return i===C&&e._rejectCallback(i.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},A.all=function(t){return new k(t).promise()},A.cast=function(t){var e=y(t);return e instanceof A||((e=new A(p))._captureStackTrace(),e._setFulfilled(),e._rejectionHandler0=t),e},A.resolve=A.fulfilled=A.cast,A.reject=A.rejected=function(t){var e=new A(p);return e._captureStackTrace(),e._rejectCallback(t,!0),e},A.setScheduler=function(t){if("function"!=typeof t)throw new _("expecting a function but got "+c.classString(t));return h.setScheduler(t)},A.prototype._then=function(t,e,n,i,r){var a=void 0!==r,o=a?r:new A(p),l=this._target(),u=l._bitField;a||(o._propagateFrom(this,3),o._captureStackTrace(),void 0===i&&0!=(2097152&this._bitField)&&(i=0!=(50397184&u)?this._boundValue():l===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,o));var d=s();if(0!=(50397184&u)){var f,_,v=l._settlePromiseCtx;0!=(33554432&u)?(_=l._rejectionHandler0,f=t):0!=(16777216&u)?(_=l._fulfillmentHandler0,f=e,l._unsetRejectionIsUnhandled()):(v=l._settlePromiseLateCancellationObserver,_=new g("late cancellation observer"),l._attachExtraTrace(_),f=e),h.invoke(v,l,{handler:null===d?f:"function"==typeof f&&c.domainBind(d,f),promise:o,receiver:i,value:_})}else l._addCallbacks(t,e,o,i,d);return o},A.prototype._length=function(){return 65535&this._bitField},A.prototype._isFateSealed=function(){return 0!=(117506048&this._bitField)},A.prototype._isFollowing=function(){return 67108864==(67108864&this._bitField)},A.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},A.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},A.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},A.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},A.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},A.prototype._isFinal=function(){return(4194304&this._bitField)>0},A.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},A.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},A.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},A.prototype._setAsyncGuaranteed=function(){h.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},A.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},A.prototype._promiseAt=function(t){return this[4*t-4+2]},A.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},A.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},A.prototype._boundValue=function(){},A.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)},A.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)},A.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},A.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},A.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 A))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())}},A.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()}},A.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()},A.prototype._settledValue=function(){var t=this._bitField;return 0!=(33554432&t)?this._rejectionHandler0:0!=(16777216&t)?this._fulfillmentHandler0:void 0},A.defer=A.pending=function(){return w.deprecated("Promise.defer","new Promise"),{promise:new A(p),resolve:D,reject:M}},c.notEnumerableProp(A,"_makeSelfResolutionError",i),t("./method")(A,p,y,a,w),t("./bind")(A,p,y,w),t("./cancel")(A,k,a,w),t("./direct_resolve")(A),t("./synchronous_inspection")(A),t("./join")(A,k,y,p,h,s),A.Promise=A,A.version="3.5.4",t("./map.js")(A,k,a,y,p,w),t("./call_get.js")(A),t("./using.js")(A,a,y,x,p,w),t("./timers.js")(A,p,w),t("./generators.js")(A,a,p,y,o,w),t("./nodeify.js")(A),t("./promisify.js")(A,p),t("./props.js")(A,k,y,a),t("./race.js")(A,p,y,a),t("./reduce.js")(A,k,a,y,p,w),t("./settle.js")(A,k,w),t("./some.js")(A,k,a),t("./filter.js")(A,p),t("./each.js")(A,p),t("./any.js")(A),c.toFastProperties(A),c.toFastProperties(A.prototype),I({a:1}),I({b:2}),I({c:3}),I(1),I(function(){}),I(void 0),I(!1),I(new A(p)),w.setBounds(d.firstLineError,c.lastLineError),A}},{"./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 d(this)},e.props=function(t){return d(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 u(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 u(t,e)},e.prototype.some=function(t){return u(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,u=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&&u===r&&(s._rejectCallback(u.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 u(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,u,void 0,l,void 0))._setOnCancel(l)):n=this._then(c,u,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,u=s.errorObj,d=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,u="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==i?i:void 0!==this?this:null;function d(){try{var t=c;return c=null,t.apply(this,arguments)}catch(t){return s.e=t,s}}function h(t){return c=t,d}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=x.test(t+"")&&a.names(t).length>0;if(n||i||r)return!0}return!1}catch(t){return!1}}function S(t){function e(){}e.prototype=t;var n=new e;function i(){return l(n.foo)}return i(),i(),t}var T=/^[a-z$_][a-z$_0-9]*$/i;function $(t){return T.test(t)}function C(t,e,n){for(var i=new Array(t),r=0;r10||t[0]>0}(),U.isNode&&U.toFastProperties(n);try{throw new Error}catch(t){U.lastLineError=t}e.exports=U},{"./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(9),n(4),n(57).setImmediate)},function(t,e,n){t.exports=n(233)},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(5),r=n(0),a=n(50),o=n(21),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,t._touch_drag=!0,!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,t._touch_drag=!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";function i(t,e){for(var n=0;n=0;a--){var o=this._queue[a],s=n[o.data.id];s&&(this.onResponse(o,s),s.error?o.reject(s.error):o.resolve(s.data),this._queue.splice(a,1))}}},{key:"on",value:function(t,e){var n=this._uid(),i=this._events[t],r=!!i;return r||(i=this._events[t]=[]),i.push({id:n,handler:e}),r||3!=this._mode||this._socket.send(JSON.stringify({action:"subscribe",name:t})),{name:t,id:n}}},{key:"_resubscribe",value:function(){if(3==this._mode)for(var t in this._events)this._socket.send(JSON.stringify({action:"subscribe",name:t}))}},{key:"detach",value:function(t){if(t){var e=t.id,n=t.name,i=this._events[n];if(i){var r=i.filter(function(t){return t.id!=e});r.length?this._events[n]=r:(delete this._events[n],3==this._mode&&this._socket.send(JSON.stringify({action:"unsubscribe",name:n})))}}else{if(3==this._mode)for(var a in this._events)this._socket.send(JSON.stringify({action:"unsubscribe",key:a}));this._events={}}}},{key:"fire",value:function(t,e){var n=this._events[t];if(n)for(var i=0;i11?"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(241).default,r=n(240).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(11),a=n(21),o=n(243).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,u){var d=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&&(d.onreadystatechange=function(){if(4==d.readyState||h&&3==d.readyState){if((200!=d.status||""===d.responseText)&&!t.callEvent("onAjaxError",[d]))return;setTimeout(function(){"function"==typeof s&&s.apply(a,[{xmlDoc:d,filePath:n}]),c(d),"function"==typeof s&&(s=null,d=null)},0)}});var f=!this||!this.cache;if("GET"==e&&f&&(n+=(n.indexOf("?")>=0?"&":"?")+"dhxr"+(new Date).getTime()+"=1"),d.open(e,n,o),l)for(var _ in l)d.setRequestHeader(_,l[_]);else"POST"==e.toUpperCase()||"PUT"==e||"DELETE"==e?d.setRequestHeader("Content-Type","application/x-www-form-urlencoded"):"GET"==e&&(r=null);if(d.setRequestHeader("X-Requested-With","XMLHttpRequest"),d.send(r),!o)return{xmlDoc:d,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(248),this.version="8.0.7",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(247).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(246)(),e.config=n(245)(),e.ajax=n(244)(e),e.date=n(242)(e),e.RemoteEvents=n(239).remoteEvents;var o=n(237)(e);e.$services.setService("dnd",function(){return o});var s=n(236)(e);e.$services.setService("templateLoader",function(){return s}),n(5)(e);var l=new(n(235));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(234),e.env=n(11),n(232)(e);var u=n(226);e.dataProcessor=u.DEPRECATED_api,e.createDataProcessor=u.createDataProcessor,n(221)(e),n(211)(e),n(210)(e),n(202)(e),n(201)(e),n(200)(e),n(187)(e),n(186).default(e),n(185)(e),n(184)(e),n(183)(e),n(180)(e),n(179).default(e);var d=n(178).default();return e.i18n={addLocale:d.addLocale,setLocale:function(t){if("string"==typeof t){var n=d.getLocale(t);n||(n=d.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:d.getLocale},e.i18n.setLocale("en"),e}},function(t,e,n){n(35);var i=n(249);t.exports=function(t){var e=i(t);return e.env.isNode||n(144)(e),e}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=100,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(51),r=n(1),a=n(2),o=n(254),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(255);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 u=t.buttons;u.length?c.style.display="":c.style.display="none";for(var d="",h=0;h
"+n.locale.labels[u[h]]+"
"}c.innerHTML=d,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._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(5);!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;n0&&c>l&&(c=l);for(var u=0;u=0?(d=g.substr(0,p),h=g.substr(p+1)):(d=g,h=""),f=decodeURIComponent(d),_=decodeURIComponent(h),i(o,f)?r(o[f])?o[f].push(_):o[f]=[o[f],_]:o[f]=_}return o};var r=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,e,n){"use strict";e.decode=e.parse=n(274),e.encode=e.stringify=n(273)},function(t,e,n){"use strict";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={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"===i(t)&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){(function(t,i){var r;function a(t){"@babel/helpers - typeof";return(a="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(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 u=n[o]={exports:{}};e[o][0].call(u.exports,function(t){var n=e[o][1][t];return r(n||t)},u,u.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?u.call(this,t,e,n):this._schedule(function(){t.call(e,n)})},l.prototype.settlePromises=function(t){this._trampolineEnabled?d.call(this,t):this._schedule(function(){t._settlePromises()})}):(l.prototype.invokeLater=c,l.prototype.invoke=u,l.prototype.settlePromises=d),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),u=new t(e);u._propagateFrom(this,1);var d=this._target();if(u._setBoundTo(c),c instanceof t){var h={promiseRejectionQueued:!1,promise:u,target:d,bindingPromise:c};d._then(e,o,void 0,u,h),c._then(s,l,void 0,u,h),u._setOnCancel(c)}else u._resolveCallback(d);return u},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,u=t("./errors").Warning,d=t("./util"),h=t("./es5"),f=d.canAttachTrace,_=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,g=/\((?:timers\.js):\d+:\d+\)/,p=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,v=null,m=null,y=!1,k=!(0==d.env("BLUEBIRD_DEBUG")),b=!(0==d.env("BLUEBIRD_WARNINGS")||!k&&!d.env("BLUEBIRD_WARNINGS")),x=!(0==d.env("BLUEBIRD_LONG_STACK_TRACES")||!k&&!d.env("BLUEBIRD_LONG_STACK_TRACES")),w=0!=d.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(b||!!d.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:d.domainBind(e,t):void 0},e.onUnhandledRejectionHandled=function(t){var e=s();r="function"==typeof t?null===e?t:d.domainBind(e,t):void 0};var S=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,S=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 T=function(){try{if("function"==typeof CustomEvent){var t=new CustomEvent("CustomEvent");return d.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!d.global.dispatchEvent(i)}}if("function"==typeof Event){t=new Event("CustomEvent");return d.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}),!d.global.dispatchEvent(n)}}return(t=document.createEvent("CustomEvent")).initCustomEvent("testingtheevent",!1,!0,{}),d.global.dispatchEvent(t),function(t,e){var n=document.createEvent("CustomEvent");return n.initCustomEvent(t.toLowerCase(),!1,!0,e),!d.global.dispatchEvent(n)}}catch(t){}return function(){return!1}}(),$=d.isNode?function(){return n.emit.apply(n,arguments)}:d.global?function(t){var e="on"+t.toLowerCase(),n=d.global[e];return!!n&&(n.apply(d.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},A=function(t){var e=!1;try{e=$.apply(null,arguments)}catch(t){c.throwLater(t),e=!0}var n=!1;try{n=T(t,E[t].apply(null,arguments))}catch(t){c.throwLater(t),n=!0}return n||e};function D(){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: "+d.toString(t));i._attachCancellationCallback(t)})}catch(t){return t}}function I(t){if(!this._isCancellable())return this;var e=this._onCancel();void 0!==e?d.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function P(){return this._onCancelField}function N(t){this._onCancelField=t}function O(){this._cancellationParent=void 0,this._onCancelField=void 0}function L(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()&&S()),"warnings"in t){var n=t.warnings;tt.warnings=!!n,w=tt.warnings,d.isObject(n)&&"wForgottenReturn"in n&&(w=!!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=O,e.prototype._propagateFrom=L,e.prototype._onCancel=P,e.prototype._setOnCancel=N,e.prototype._attachCancellationCallback=I,e.prototype._execute=M,R=L,tt.cancellation=!0}return"monitoring"in t&&(t.monitoring&&!tt.monitoring?(tt.monitoring=!0,e.prototype._fireEvent=A):!t.monitoring&&tt.monitoring&&(tt.monitoring=!1,e.prototype._fireEvent=D)),e},e.prototype._fireEvent=D,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);d.notEnumerableProp(t,"stack",i.message+"\n"+i.stack.join("\n")),d.notEnumerableProp(t,"__stackCleaned__",!0)}}}function B(){this._trace=void 0}function z(t,n,i){if(tt.warnings){var r,a=new u(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")}A("warning",a)||V(a,"",!0)}}function U(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:U(e)}}function V(t,e,n){if("undefined"!=typeof console){var i;if(d.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?A(t,n,i)||r||V(n,"Unhandled rejection "):A(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():d.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 J=function(){return!1},X=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function K(t){var e=t.match(X);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()}d.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(U(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)},d.isNode&&n.stderr.isTTY?o=function(t,e){var n=e?"":"";console.warn(n+t+"\n")}:d.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 x&&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&&w){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=U(s),c=l.length-1;c>=0;--c){var u=l[c];if(!g.test(u)){var d=u.match(p);d&&(a="at "+d[1]+":"+d[2]+":"+d[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||(J=function(t){if(_.test(t))return!0;var e=K(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:T,fireGlobalEvent:$}}},{"./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 u(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 d=u("Warning","warning"),h=u("CancellationError","cancellation error"),f=u("TimeoutError","timeout error"),_=u("AggregateError","aggregate error");try{i=TypeError,r=RangeError}catch(t){i=u("TypeError","type error"),r=u("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 d(){return f.call(this,this.promise._target()._settledValue())}function h(t){if(!u(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(d,h,void 0,this,void 0)}}}return r.isRejected()?(u(this),o.e=t,o):(u(this),t)}return l.prototype.isFinallyHandler=function(){return 0===this.type},c.prototype._resultCancelled=function(){u(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"),u=c.tryCatch,d=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 _=u(h).call(f,t,n,a),g=c._popContext();if(o.checkForgottenReturns(_,g,null!==s?"Promise.filter":"Promise.map",c),_===d)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],u=arguments[2];i=o.isArray(c)?s(t).apply(u,c):s(t).call(u,c)}else i=s(t)();var d=l._popContext();return a.checkForgottenReturns(i,d,"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)},A.prototype.done=function(t,e){this._then(t,e,void 0,void 0,void 0)._setIsFinal()},A.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)},A.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},A.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new k(this).promise()},A.prototype.error=function(t){return this.caught(c.originatesFromRejection,t)},A.getNewLibraryCopy=e.exports,A.is=function(t){return t instanceof A},A.fromNode=A.fromCallback=function(t){var e=new A(p);e._captureStackTrace();var n=arguments.length>1&&!!Object(arguments[1]).multiArgs,i=E(t)($(e,n));return i===C&&e._rejectCallback(i.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},A.all=function(t){return new k(t).promise()},A.cast=function(t){var e=y(t);return e instanceof A||((e=new A(p))._captureStackTrace(),e._setFulfilled(),e._rejectionHandler0=t),e},A.resolve=A.fulfilled=A.cast,A.reject=A.rejected=function(t){var e=new A(p);return e._captureStackTrace(),e._rejectCallback(t,!0),e},A.setScheduler=function(t){if("function"!=typeof t)throw new _("expecting a function but got "+c.classString(t));return h.setScheduler(t)},A.prototype._then=function(t,e,n,i,r){var a=void 0!==r,o=a?r:new A(p),l=this._target(),u=l._bitField;a||(o._propagateFrom(this,3),o._captureStackTrace(),void 0===i&&0!=(2097152&this._bitField)&&(i=0!=(50397184&u)?this._boundValue():l===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,o));var d=s();if(0!=(50397184&u)){var f,_,v=l._settlePromiseCtx;0!=(33554432&u)?(_=l._rejectionHandler0,f=t):0!=(16777216&u)?(_=l._fulfillmentHandler0,f=e,l._unsetRejectionIsUnhandled()):(v=l._settlePromiseLateCancellationObserver,_=new g("late cancellation observer"),l._attachExtraTrace(_),f=e),h.invoke(v,l,{handler:null===d?f:"function"==typeof f&&c.domainBind(d,f),promise:o,receiver:i,value:_})}else l._addCallbacks(t,e,o,i,d);return o},A.prototype._length=function(){return 65535&this._bitField},A.prototype._isFateSealed=function(){return 0!=(117506048&this._bitField)},A.prototype._isFollowing=function(){return 67108864==(67108864&this._bitField)},A.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},A.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},A.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},A.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},A.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},A.prototype._isFinal=function(){return(4194304&this._bitField)>0},A.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},A.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},A.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},A.prototype._setAsyncGuaranteed=function(){h.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},A.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},A.prototype._promiseAt=function(t){return this[4*t-4+2]},A.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},A.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},A.prototype._boundValue=function(){},A.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)},A.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)},A.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},A.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},A.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 A))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())}},A.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()}},A.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()},A.prototype._settledValue=function(){var t=this._bitField;return 0!=(33554432&t)?this._rejectionHandler0:0!=(16777216&t)?this._fulfillmentHandler0:void 0},A.defer=A.pending=function(){return w.deprecated("Promise.defer","new Promise"),{promise:new A(p),resolve:D,reject:M}},c.notEnumerableProp(A,"_makeSelfResolutionError",i),t("./method")(A,p,y,a,w),t("./bind")(A,p,y,w),t("./cancel")(A,k,a,w),t("./direct_resolve")(A),t("./synchronous_inspection")(A),t("./join")(A,k,y,p,h,s),A.Promise=A,A.version="3.5.4",t("./map.js")(A,k,a,y,p,w),t("./call_get.js")(A),t("./using.js")(A,a,y,x,p,w),t("./timers.js")(A,p,w),t("./generators.js")(A,a,p,y,o,w),t("./nodeify.js")(A),t("./promisify.js")(A,p),t("./props.js")(A,k,y,a),t("./race.js")(A,p,y,a),t("./reduce.js")(A,k,a,y,p,w),t("./settle.js")(A,k,w),t("./some.js")(A,k,a),t("./filter.js")(A,p),t("./each.js")(A,p),t("./any.js")(A),c.toFastProperties(A),c.toFastProperties(A.prototype),I({a:1}),I({b:2}),I({c:3}),I(1),I(function(){}),I(void 0),I(!1),I(new A(p)),w.setBounds(d.firstLineError,c.lastLineError),A}},{"./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 d(this)},e.props=function(t){return d(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 u(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 u(t,e)},e.prototype.some=function(t){return u(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,u=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&&u===r&&(s._rejectCallback(u.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 u(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,u,void 0,l,void 0))._setOnCancel(l)):n=this._then(c,u,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,u=s.errorObj,d=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,u="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==i?i:void 0!==this?this:null;function d(){try{var t=c;return c=null,t.apply(this,arguments)}catch(t){return s.e=t,s}}function h(t){return c=t,d}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=x.test(t+"")&&a.names(t).length>0;if(n||i||r)return!0}return!1}catch(t){return!1}}function S(t){function e(){}e.prototype=t;var n=new e;function i(){return l(n.foo)}return i(),i(),t}var T=/^[a-z$_][a-z$_0-9]*$/i;function $(t){return T.test(t)}function C(t,e,n){for(var i=new Array(t),r=0;r10||t[0]>0}(),U.isNode&&U.toFastProperties(n);try{throw new Error}catch(t){U.lastLineError=t}e.exports=U},{"./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(9),n(4),n(57).setImmediate)},function(t,e,n){t.exports=n(233)},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(5),r=n(0),a=n(50),o=n(21),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,t._touch_drag=!0,!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,t._touch_drag=!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";function i(t,e){for(var n=0;n=0;a--){var o=this._queue[a],s=n[o.data.id];s&&(this.onResponse(o,s),s.error?o.reject(s.error):o.resolve(s.data),this._queue.splice(a,1))}}},{key:"on",value:function(t,e){var n=this._uid(),i=this._events[t],r=!!i;return r||(i=this._events[t]=[]),i.push({id:n,handler:e}),r||3!=this._mode||this._socket.send(JSON.stringify({action:"subscribe",name:t})),{name:t,id:n}}},{key:"_resubscribe",value:function(){if(3==this._mode)for(var t in this._events)this._socket.send(JSON.stringify({action:"subscribe",name:t}))}},{key:"detach",value:function(t){if(t){var e=t.id,n=t.name,i=this._events[n];if(i){var r=i.filter(function(t){return t.id!=e});r.length?this._events[n]=r:(delete this._events[n],3==this._mode&&this._socket.send(JSON.stringify({action:"unsubscribe",name:n})))}}else{if(3==this._mode)for(var a in this._events)this._socket.send(JSON.stringify({action:"unsubscribe",key:a}));this._events={}}}},{key:"fire",value:function(t,e){var n=this._events[t];if(n)for(var i=0;i11?"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(241).default,r=n(240).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(11),a=n(21),o=n(243).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,u){var d=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&&(d.onreadystatechange=function(){if(4==d.readyState||h&&3==d.readyState){if((200!=d.status||""===d.responseText)&&!t.callEvent("onAjaxError",[d]))return;setTimeout(function(){"function"==typeof s&&s.apply(a,[{xmlDoc:d,filePath:n}]),c(d),"function"==typeof s&&(s=null,d=null)},0)}});var f=!this||!this.cache;if("GET"==e&&f&&(n+=(n.indexOf("?")>=0?"&":"?")+"dhxr"+(new Date).getTime()+"=1"),d.open(e,n,o),l)for(var _ in l)d.setRequestHeader(_,l[_]);else"POST"==e.toUpperCase()||"PUT"==e||"DELETE"==e?d.setRequestHeader("Content-Type","application/x-www-form-urlencoded"):"GET"==e&&(r=null);if(d.setRequestHeader("X-Requested-With","XMLHttpRequest"),d.send(r),!o)return{xmlDoc:d,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(248),this.version="8.0.8",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(247).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(246)(),e.config=n(245)(),e.ajax=n(244)(e),e.date=n(242)(e),e.RemoteEvents=n(239).remoteEvents;var o=n(237)(e);e.$services.setService("dnd",function(){return o});var s=n(236)(e);e.$services.setService("templateLoader",function(){return s}),n(5)(e);var l=new(n(235));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(234),e.env=n(11),n(232)(e);var u=n(226);e.dataProcessor=u.DEPRECATED_api,e.createDataProcessor=u.createDataProcessor,n(221)(e),n(211)(e),n(210)(e),n(202)(e),n(201)(e),n(200)(e),n(187)(e),n(186).default(e),n(185)(e),n(184)(e),n(183)(e),n(180)(e),n(179).default(e);var d=n(178).default();return e.i18n={addLocale:d.addLocale,setLocale:function(t){if("string"==typeof t){var n=d.getLocale(t);n||(n=d.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:d.getLocale},e.i18n.setLocale("en"),e}},function(t,e,n){n(35);var i=n(249);t.exports=function(t){var e=i(t);return e.env.isNode||n(144)(e),e}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=100,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;n1&&r.forEach(function(e){t.store(e,n.config.undo_types.task,!0)})}return t.store(e,n.config.undo_types.task)}),n.attachEvent("onAfterTaskDrag",function(e){(u||n.plugins().multiselect&&n.getSelectedTasks().length>1)&&c===e&&(u=!1,c=null,t.stopBatchAction()),t.store(e,n.config.undo_types.task,!0)}),n.attachEvent("onLightbox",function(e){return t.store(e,n.config.undo_types.task)}),n.attachEvent("onBeforeTaskAutoSchedule",function(e){return t.store(e.id,n.config.undo_types.task,!0),!0}),n.ext.inlineEditors){var d=null,h=null;n.attachEvent("onGanttLayoutReady",function(){d&&n.ext.inlineEditors.detachEvent(d),h&&n.ext.inlineEditors.detachEvent(h),h=n.ext.inlineEditors.attachEvent("onEditStart",function(e){t.store(e.id,n.config.undo_types.task)}),d=n.ext.inlineEditors.attachEvent("onBeforeEditStart",function(e){return t.stopBatchAction(),!0})})}},t.prototype._storeCommand=function(t){var e=this._undo;if(e.updateConfigs(),e.undoEnabled)if(this._batchMode)this._batchAction.commands.push(t);else{var n=e.action.create([t]);e.logAction(n)}},t.prototype._storeEntityCommand=function(t,e,n,i){var r=this._undo.command.create(t,e,n,i);this._storeCommand(r)},t.prototype._storeTaskCommand=function(t,e){this._gantt.isTaskExists(t.id)&&(t.$local_index=this._gantt.getTaskIndex(t.id)),this._storeEntityCommand(t,this.getInitialTask(t.id),e,this._undo.command.entity.task)},t.prototype._storeLinkCommand=function(t,e){this._storeEntityCommand(t,this.getInitialLink(t.id),e,this._undo.command.entity.link)},t.prototype._getLinks=function(t){return t.$source.concat(t.$target)},t.prototype._storeTask=function(t,e){var n=this;void 0===e&&(e=!1);var i=this._gantt;return this.setInitialTask(t,e),i.eachTask(function(t){n.setInitialTask(t.id)},t),!0},t.prototype._storeLink=function(t,e){return void 0===e&&(e=!1),this.setInitialLink(t,e),!0},t}();e.Monitor=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(252),r=n(251);e.default=function(t){var e=new r.Undo(t),n=new i.Monitor(e,t);function a(t,e,n){t&&(t.id===e&&(t.id=n),t.parent===e&&(t.parent=n))}function o(t,e,n){a(t.value,e,n),a(t.oldValue,e,n)}function s(t,e,n){t&&(t.source===e&&(t.source=n),t.target===e&&(t.target=n))}function l(t,e,n){s(t.value,e,n),s(t.oldValue,e,n)}function c(t,n,i){for(var r=e,a=0;an.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(51),r=n(1),a=n(2),o=n(254),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(255);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 u=t.buttons;u.length?c.style.display="":c.style.display="none";for(var d="",h=0;h
"+n.locale.labels[u[h]]+"
"}c.innerHTML=d,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._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(5);!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;n0&&c>l&&(c=l);for(var u=0;u=0?(d=g.substr(0,p),h=g.substr(p+1)):(d=g,h=""),f=decodeURIComponent(d),_=decodeURIComponent(h),i(o,f)?r(o[f])?o[f].push(_):o[f]=[o[f],_]:o[f]=_}return o};var r=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,e,n){"use strict";e.decode=e.parse=n(274),e.encode=e.stringify=n(273)},function(t,e,n){"use strict";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={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"===i(t)&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){(function(t,i){var r;function a(t){"@babel/helpers - typeof";return(a="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)} /*! https://mths.be/punycode v1.4.1 by @mathias */!function(o){var s="object"==a(e)&&e&&!e.nodeType&&e,l="object"==a(t)&&t&&!t.nodeType&&t,c="object"==(void 0===i?"undefined":a(i))&&i;c.global!==c&&c.window!==c&&c.self!==c||(o=c);var u,d,h=2147483647,f=36,_=1,g=26,p=38,v=700,m=72,y=128,k="-",b=/^xn--/,x=/[^\x20-\x7E]/,w=/[\x2E\u3002\uFF0E\uFF61]/g,S={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},T=f-_,$=Math.floor,C=String.fromCharCode;function E(t){throw new RangeError(S[t])}function A(t,e){for(var n=t.length,i=[];n--;)i[n]=e(t[n]);return i}function D(t,e){var n=t.split("@"),i="";return n.length>1&&(i=n[0]+"@",t=n[1]),i+A((t=t.replace(w,".")).split("."),e).join(".")}function M(t){for(var e,n,i=[],r=0,a=t.length;r=55296&&e<=56319&&r65535&&(e+=C((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=C(t)}).join("")}function P(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:f}function N(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function O(t,e,n){var i=0;for(t=n?$(t/v):t>>1,t+=$(t/e);t>T*g>>1;i+=f)t=$(t/T);return $(i+(T+1)*t/(t+p))}function L(t){var e,n,i,r,a,o,s,l,c,u,d=[],p=t.length,v=0,b=y,x=m;for((n=t.lastIndexOf(k))<0&&(n=0),i=0;i=128&&E("not-basic"),d.push(t.charCodeAt(i));for(r=n>0?n+1:0;r=p&&E("invalid-input"),((l=P(t.charCodeAt(r++)))>=f||l>$((h-v)/o))&&E("overflow"),v+=l*o,!(l<(c=s<=x?_:s>=x+g?g:s-x));s+=f)o>$(h/(u=f-c))&&E("overflow"),o*=u;x=O(v-a,e=d.length+1,0==a),$(v/e)>h-b&&E("overflow"),b+=$(v/e),v%=e,d.splice(v++,0,b)}return I(d)}function R(t){var e,n,i,r,a,o,s,l,c,u,d,p,v,b,x,w=[];for(p=(t=M(t)).length,e=y,n=0,a=m,o=0;o=e&&d$((h-n)/(v=i+1))&&E("overflow"),n+=(s-e)*v,e=s,o=0;oh&&E("overflow"),d==e){for(l=n,c=f;!(l<(u=c<=a?_:c>=a+g?g:c-a));c+=f)x=l-u,b=f-u,w.push(C(N(u+x%b,0))),l=$(x/b);w.push(C(N(l,0))),a=O(n,v,i==r),n=0,++i}++n,++e}return w.join("")}if(u={version:"1.4.1",ucs2:{decode:M,encode:I},decode:L,encode:R,toASCII:function(t){return D(t,function(t){return x.test(t)?"xn--"+R(t):t})},toUnicode:function(t){return D(t,function(t){return b.test(t)?L(t.slice(4).toLowerCase()):t})}},"object"==a(n(53))&&n(53))void 0===(r=function(){return u}.call(e,n,e,t))||(t.exports=r);else if(s&&l)if(t.exports==s)l.exports=u;else for(d in u)u.hasOwnProperty(d)&&(s[d]=u[d]);else o.punycode=u}(this)}).call(this,n(277)(t),n(4))},function(t,e){t.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},function(t,e){t.exports=function(){for(var t={},e=0;e0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n},t.prototype.concat=function(t){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var e=i.allocUnsafe(t>>>0),n=this.head,r=0;n;)a(n.data,e,r),r+=n.data.length,n=n.next;return e},t}(),r&&r.inspect&&r.inspect.custom&&(t.exports.prototype[r.inspect.custom]=function(){var t=r.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,e){},function(t,e,n){(function(e,i,r){var a=n(65),o=n(8),s=n(64),l=n(63),c=n(281),u=s.IncomingMessage,d=s.readyStates;var h=t.exports=function(t){var n,i=this;l.Writable.call(i),i._opts=t,i._body=[],i._headers={},t.auth&&i.setHeader("Authorization","Basic "+new e(t.auth).toString("base64")),Object.keys(t.headers).forEach(function(e){i.setHeader(e,t.headers[e])});var r=!0;if("disable-fetch"===t.mode||"requestTimeout"in t&&!a.abortController)r=!1,n=!0;else if("prefer-streaming"===t.mode)n=!1;else if("allow-wrong-content-type"===t.mode)n=!a.overrideMimeType;else{if(t.mode&&"default"!==t.mode&&"prefer-fast"!==t.mode)throw new Error("Invalid value for opts.mode");n=!0}i._mode=function(t,e){return a.fetch&&e?"fetch":a.mozchunkedarraybuffer?"moz-chunked-arraybuffer":a.msstream?"ms-stream":a.arraybuffer&&t?"arraybuffer":a.vbArray&&t?"text:vbarray":"text"}(n,r),i._fetchTimer=null,i.on("finish",function(){i._onFinish()})};o(h,l.Writable),h.prototype.setHeader=function(t,e){var n=t.toLowerCase();-1===f.indexOf(n)&&(this._headers[n]={name:t,value:e})},h.prototype.getHeader=function(t){var e=this._headers[t.toLowerCase()];return e?e.value:null},h.prototype.removeHeader=function(t){delete this._headers[t.toLowerCase()]},h.prototype._onFinish=function(){var t=this;if(!t._destroyed){var n=t._opts,o=t._headers,s=null;"GET"!==n.method&&"HEAD"!==n.method&&(s=a.arraybuffer?c(e.concat(t._body)):a.blobConstructor?new i.Blob(t._body.map(function(t){return c(t)}),{type:(o["content-type"]||{}).value||""}):e.concat(t._body).toString());var l=[];if(Object.keys(o).forEach(function(t){var e=o[t].name,n=o[t].value;Array.isArray(n)?n.forEach(function(t){l.push([e,t])}):l.push([e,n])}),"fetch"===t._mode){var u=null;if(a.abortController){var h=new AbortController;u=h.signal,t._fetchAbortController=h,"requestTimeout"in n&&0!==n.requestTimeout&&(t._fetchTimer=i.setTimeout(function(){t.emit("requestTimeout"),t._fetchAbortController&&t._fetchAbortController.abort()},n.requestTimeout))}i.fetch(t._opts.url,{method:t._opts.method,headers:l,body:s||void 0,mode:"cors",credentials:n.withCredentials?"include":"same-origin",signal:u}).then(function(e){t._fetchResponse=e,t._connect()},function(e){i.clearTimeout(t._fetchTimer),t._destroyed||t.emit("error",e)})}else{var f=t._xhr=new i.XMLHttpRequest;try{f.open(t._opts.method,t._opts.url,!0)}catch(e){return void r.nextTick(function(){t.emit("error",e)})}"responseType"in f&&(f.responseType=t._mode.split(":")[0]),"withCredentials"in f&&(f.withCredentials=!!n.withCredentials),"text"===t._mode&&"overrideMimeType"in f&&f.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in n&&(f.timeout=n.requestTimeout,f.ontimeout=function(){t.emit("requestTimeout")}),l.forEach(function(t){f.setRequestHeader(t[0],t[1])}),t._response=null,f.onreadystatechange=function(){switch(f.readyState){case d.LOADING:case d.DONE:t._onXHRProgress()}},"moz-chunked-arraybuffer"===t._mode&&(f.onprogress=function(){t._onXHRProgress()}),f.onerror=function(){t._destroyed||t.emit("error",new Error("XHR error"))};try{f.send(s)}catch(e){return void r.nextTick(function(){t.emit("error",e)})}}}},h.prototype._onXHRProgress=function(){(function(t){try{var e=t.status;return null!==e&&0!==e}catch(t){return!1}})(this._xhr)&&!this._destroyed&&(this._response||this._connect(),this._response._onXHRProgress())},h.prototype._connect=function(){var t=this;t._destroyed||(t._response=new u(t._xhr,t._fetchResponse,t._mode,t._fetchTimer),t._response.on("error",function(e){t.emit("error",e)}),t.emit("response",t._response))},h.prototype._write=function(t,e,n){this._body.push(t),n()},h.prototype.abort=h.prototype.destroy=function(){this._destroyed=!0,i.clearTimeout(this._fetchTimer),this._response&&(this._response._destroyed=!0),this._xhr?this._xhr.abort():this._fetchAbortController&&this._fetchAbortController.abort()},h.prototype.end=function(t,e,n){"function"==typeof t&&(n=t,t=void 0),l.Writable.prototype.end.call(this,t,e,n)},h.prototype.flushHeaders=function(){},h.prototype.setTimeout=function(){},h.prototype.setNoDelay=function(){},h.prototype.setSocketKeepAlive=function(){};var f=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]}).call(this,n(13).Buffer,n(4),n(9))},function(t,e,n){var i=n(66),r=n(54),a=t.exports;for(var o in i)i.hasOwnProperty(o)&&(a[o]=i[o]);function s(t){if("string"==typeof t&&(t=r.parse(t)),t.protocol||(t.protocol="https:"),"https:"!==t.protocol)throw new Error('Protocol "'+t.protocol+'" not supported. Expected "https:"');return t}a.request=function(t,e){return t=s(t),i.request.call(this,t,e)},a.get=function(t,e){return t=s(t),i.get.call(this,t,e)}},function(t,e){e.read=function(t,e,n,i,r){var a,o,s=8*r-i-1,l=(1<>1,u=-7,d=n?r-1:0,h=n?-1:1,f=t[e+d];for(d+=h,a=f&(1<<-u)-1,f>>=-u,u+=s;u>0;a=256*a+t[e+d],d+=h,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=i;u>0;o=256*o+t[e+d],d+=h,u-=8);if(0===a)a=1-c;else{if(a===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,i),a-=c}return(f?-1:1)*o*Math.pow(2,a-i)},e.write=function(t,e,n,i,r,a){var o,s,l,c=8*a-r-1,u=(1<>1,h=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:a-1,_=i?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),(e+=o+d>=1?h/l:h*Math.pow(2,1-d))*l>=2&&(o++,l/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(e*l-1)*Math.pow(2,r),o+=d):(s=e*Math.pow(2,d-1)*Math.pow(2,r),o=0));r>=8;t[n+f]=255&s,f+=_,s/=256,r-=8);for(o=o<0;t[n+f]=255&o,f+=_,o/=256,c-=8);t[n+f-_]|=128*g}},function(t,e,n){"use strict";e.byteLength=function(t){var e=c(t),n=e[0],i=e[1];return 3*(n+i)/4-i},e.toByteArray=function(t){for(var e,n=c(t),i=n[0],o=n[1],s=new a(function(t,e,n){return 3*(e+n)/4-n}(0,i,o)),l=0,u=o>0?i-4:i,d=0;d>16&255,s[l++]=e>>8&255,s[l++]=255&e;2===o&&(e=r[t.charCodeAt(d)]<<2|r[t.charCodeAt(d+1)]>>4,s[l++]=255&e);1===o&&(e=r[t.charCodeAt(d)]<<10|r[t.charCodeAt(d+1)]<<4|r[t.charCodeAt(d+2)]>>2,s[l++]=e>>8&255,s[l++]=255&e);return s},e.fromByteArray=function(t){for(var e,n=t.length,r=n%3,a=[],o=0,s=n-r;os?s:o+16383));1===r?(e=t[n-1],a.push(i[e>>2]+i[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],a.push(i[e>>10]+i[e>>4&63]+i[e<<2&63]+"="));return a.join("")};for(var i=[],r=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=o.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function u(t){return i[t>>18&63]+i[t>>12&63]+i[t>>6&63]+i[63&t]}function d(t,e,n){for(var i,r=[],a=e;a400))try{t=JSON.parse(o.responseText)}catch(t){}a&&a(t)},o.open("POST",n,!0),o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.send(r)},_ajaxToExport:function(t,n,i){delete t.callback;var r=t.server||e.ext.export_api._apiUrl,a="type="+n+"&store=1&data="+encodeURIComponent(JSON.stringify(t));e.ext.export_api._xdr(r,a,function(t){var e=t.xmlDoc||t,n=null;if(!(e.status>400))try{n=JSON.parse(e.responseText)}catch(t){}i(n)})},_serializableGanttConfig:function(t){var n=e.mixin({},t);return n.columns&&(n.columns=n.columns.map(function(t){var n=e.mixin({},t);return delete n.editor,n})),delete n.editor_types,n},_sendToExport:function(t,n){var i=e.date.date_to_str(e.config.date_format||e.config.xml_date);if(t.config&&(t.config=e.copy(e.ext.export_api._serializableGanttConfig(t.config)),e.ext.export_api._markColumns(t,n),t.config.start_date&&t.config.end_date&&(t.config.start_date instanceof Date&&(t.config.start_date=i(t.config.start_date)),t.config.end_date instanceof Date&&(t.config.end_date=i(t.config.end_date)))),e.env.isNode){var r=t.server||e.ext.export_api._apiUrl,a={type:n,store:0,data:JSON.stringify(t)},o=t.callback||function(t){console.log(t)};return e.ext.export_api._xdr(r,a,o)}if(t.callback)return e.ext.export_api._ajaxToExport(t,n,t.callback);var s=e.ext.export_api._createHiddenForm();s.firstChild.action=t.server||e.ext.export_api._apiUrl,s.firstChild.childNodes[0].value=JSON.stringify(t),s.firstChild.childNodes[1].value=n,s.firstChild.submit()},_createHiddenForm:function(){if(!e.ext.export_api._hidden_export_form){var t=e.ext.export_api._hidden_export_form=document.createElement("div");t.style.display="none",t.innerHTML="
",document.body.appendChild(t)}return e.ext.export_api._hidden_export_form},_copyObjectBase:function(t){var n={start_date:void 0,end_date:void 0};for(var i in t)"$"!==i.charAt(0)&&(n[i]=t[i]);var r=e.templates.xml_format||e.templates.format_date;return n.start_date=r(n.start_date),n.end_date&&(n.end_date=r(n.end_date)),n},_color_box:null,_color_hash:{},_getStyles:function(t){if(e.ext.export_api._color_box||(e.ext.export_api._color_box=document.createElement("DIV"),e.ext.export_api._color_box.style.cssText="position:absolute; display:none;",document.body.appendChild(e.ext.export_api._color_box)),e.ext.export_api._color_hash[t])return e.ext.export_api._color_hash[t];e.ext.export_api._color_box.className=t;var n=e.ext.export_api._getColor(e.ext.export_api._color_box,"color"),i=e.ext.export_api._getColor(e.ext.export_api._color_box,"backgroundColor");return e.ext.export_api._color_hash[t]=n+";"+i},_getMinutesWorktimeSettings:function(t){var e=[];return t.forEach(function(t){e.push(t.startMinute),e.push(t.endMinute)}),e},_getWorktimeSettings:function(){var t,n={hours:[0,24],minutes:null,dates:{0:!0,1:!0,2:!0,3:!0,4:!0,5:!0,6:!0}};if(e.config.work_time){var i=e._working_time_helper;if(i&&i.get_calendar)t=i.get_calendar();else if(i)t={hours:i.hours,minutes:null,dates:i.dates};else if(e.config.worktimes&&e.config.worktimes.global){var r=e.config.worktimes.global;if(r.parsed){var a=e.ext.export_api._getMinutesWorktimeSettings(r.parsed.hours);for(var o in t={hours:null,minutes:a,dates:{}},r.parsed.dates)Array.isArray(r.parsed.dates[o])?t.dates[o]=e.ext.export_api._getMinutesWorktimeSettings(r.parsed.dates[o]):t.dates[o]=r.parsed.dates[o]}else t={hours:r.hours,minutes:null,dates:r.dates}}else t=n}else t=n;return t},_eachTaskTimed:function(t,n){return function(i,r,a){r=r||e.config.root_id,a=a||e;var o=e.getChildren(r);if(o)for(var s=0;st)&&(!n||l.start_date-1){for(var s=0;sa.length&&(a=r[o].trace_x);for(o=0;o400))try{t=JSON.parse(s.responseText)}catch(t){}a&&a(t)},s.open("POST",n,!0),s.setRequestHeader("X-Requested-With","XMLHttpRequest"),s.send(r)}},e.exportToPDF=e.ext.export_api.exportToPDF,e.exportToPNG=e.ext.export_api.exportToPNG,e.exportToICal=e.ext.export_api.exportToICal,e.exportToExcel=e.ext.export_api.exportToExcel,e.exportToJSON=e.ext.export_api.exportToJSON,e.importFromExcel=e.ext.export_api.importFromExcel,e.importFromMSProject=e.ext.export_api.importFromMSProject,e.exportToMSProject=e.ext.export_api.exportToMSProject,e.importFromPrimaveraP6=e.ext.export_api.importFromPrimaveraP6,e.exportToPrimaveraP6=e.ext.export_api.exportToPrimaveraP6}}).call(this,n(13).Buffer)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){var e=this;this._mouseDown=!1,this._calculateDirectionVector=function(){if(e._trace.length>=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.scrollLayoutCell(t.$id,n.x,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(293);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(5),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};","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;","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};","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor;\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor;\n\n var TempCtor = function TempCtor() {};\n\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n };\n}","// 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};","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;","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n'use strict';\n/**/\n\nvar pna = require('process-nextick-args');\n/**/\n\n/**/\n\n\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n\n for (var key in obj) {\n keys.push(key);\n }\n\n return keys;\n};\n/**/\n\n\nmodule.exports = Duplex;\n/**/\n\nvar util = require('core-util-is');\n\nutil.inherits = require('inherits');\n/**/\n\nvar Readable = require('./_stream_readable');\n\nvar Writable = require('./_stream_writable');\n\nutil.inherits(Duplex, Readable);\n{\n // avoid scope creep, the keys array can then be collected\n var keys = objectKeys(Writable.prototype);\n\n for (var v = 0; v < keys.length; v++) {\n var method = keys[v];\n if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];\n }\n}\n\nfunction Duplex(options) {\n if (!(this instanceof Duplex)) return new Duplex(options);\n Readable.call(this, options);\n Writable.call(this, options);\n if (options && options.readable === false) this.readable = false;\n if (options && options.writable === false) this.writable = false;\n this.allowHalfOpen = true;\n if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;\n this.once('end', onend);\n}\n\nObject.defineProperty(Duplex.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n}); // the no-half-open enforcer\n\nfunction onend() {\n // if we allow half-open state, or if the writable side ended,\n // then we're ok.\n if (this.allowHalfOpen || this._writableState.ended) return; // no more data can be written.\n // But allow more writes to happen in this tick.\n\n pna.nextTick(onEndNT, this);\n}\n\nfunction onEndNT(self) {\n self.end();\n}\n\nObject.defineProperty(Duplex.prototype, 'destroyed', {\n get: function get() {\n if (this._readableState === undefined || this._writableState === undefined) {\n return false;\n }\n\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (this._readableState === undefined || this._writableState === undefined) {\n return;\n } // backward compatibility, the user is explicitly\n // managing destroyed\n\n\n this._readableState.destroyed = value;\n this._writableState.destroyed = value;\n }\n});\n\nDuplex.prototype._destroy = function (err, cb) {\n this.push(null);\n this.end();\n pna.nextTick(cb, err);\n};","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n\n/* eslint-disable no-proto */\n'use strict';\n\nvar base64 = require('base64-js');\n\nvar ieee754 = require('ieee754');\n\nvar isArray = require('isarray');\n\nexports.Buffer = Buffer;\nexports.SlowBuffer = SlowBuffer;\nexports.INSPECT_MAX_BYTES = 50;\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\n\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined ? global.TYPED_ARRAY_SUPPORT : typedArraySupport();\n/*\n * Export kMaxLength after typed array support is determined.\n */\n\nexports.kMaxLength = kMaxLength();\n\nfunction typedArraySupport() {\n try {\n var arr = new Uint8Array(1);\n arr.__proto__ = {\n __proto__: Uint8Array.prototype,\n foo: function foo() {\n return 42;\n }\n };\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0; // ie10 has broken `subarray`\n } catch (e) {\n return false;\n }\n}\n\nfunction kMaxLength() {\n return Buffer.TYPED_ARRAY_SUPPORT ? 0x7fffffff : 0x3fffffff;\n}\n\nfunction createBuffer(that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length');\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length);\n that.__proto__ = Buffer.prototype;\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length);\n }\n\n that.length = length;\n }\n\n return that;\n}\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\n\nfunction Buffer(arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length);\n } // Common case.\n\n\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error('If encoding is specified then the first argument must be a string');\n }\n\n return allocUnsafe(this, arg);\n }\n\n return from(this, arg, encodingOrOffset, length);\n}\n\nBuffer.poolSize = 8192; // not used by this implementation\n// TODO: Legacy, not needed anymore. Remove in next major version.\n\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype;\n return arr;\n};\n\nfunction from(that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number');\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length);\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset);\n }\n\n return fromObject(that, value);\n}\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\n\n\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length);\n};\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype;\n Buffer.__proto__ = Uint8Array;\n\n if (typeof Symbol !== 'undefined' && Symbol.species && Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n });\n }\n}\n\nfunction assertSize(size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number');\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative');\n }\n}\n\nfunction alloc(that, size, fill, encoding) {\n assertSize(size);\n\n if (size <= 0) {\n return createBuffer(that, size);\n }\n\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string' ? createBuffer(that, size).fill(fill, encoding) : createBuffer(that, size).fill(fill);\n }\n\n return createBuffer(that, size);\n}\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\n\n\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding);\n};\n\nfunction allocUnsafe(that, size) {\n assertSize(size);\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0);\n\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0;\n }\n }\n\n return that;\n}\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\n\n\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size);\n};\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\n\n\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size);\n};\n\nfunction fromString(that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8';\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding');\n }\n\n var length = byteLength(string, encoding) | 0;\n that = createBuffer(that, length);\n var actual = that.write(string, encoding);\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual);\n }\n\n return that;\n}\n\nfunction fromArrayLike(that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0;\n that = createBuffer(that, length);\n\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255;\n }\n\n return that;\n}\n\nfunction fromArrayBuffer(that, array, byteOffset, length) {\n array.byteLength; // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds');\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds');\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array);\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset);\n } else {\n array = new Uint8Array(array, byteOffset, length);\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array;\n that.__proto__ = Buffer.prototype;\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array);\n }\n\n return that;\n}\n\nfunction fromObject(that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0;\n that = createBuffer(that, len);\n\n if (that.length === 0) {\n return that;\n }\n\n obj.copy(that, 0, 0, len);\n return that;\n }\n\n if (obj) {\n if (typeof ArrayBuffer !== 'undefined' && obj.buffer instanceof ArrayBuffer || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0);\n }\n\n return fromArrayLike(that, obj);\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data);\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.');\n}\n\nfunction checked(length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + kMaxLength().toString(16) + ' bytes');\n }\n\n return length | 0;\n}\n\nfunction SlowBuffer(length) {\n if (+length != length) {\n // eslint-disable-line eqeqeq\n length = 0;\n }\n\n return Buffer.alloc(+length);\n}\n\nBuffer.isBuffer = function isBuffer(b) {\n return !!(b != null && b._isBuffer);\n};\n\nBuffer.compare = function compare(a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers');\n }\n\n if (a === b) return 0;\n var x = a.length;\n var y = b.length;\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i];\n y = b[i];\n break;\n }\n }\n\n if (x < y) return -1;\n if (y < x) return 1;\n return 0;\n};\n\nBuffer.isEncoding = function isEncoding(encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true;\n\n default:\n return false;\n }\n};\n\nBuffer.concat = function concat(list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers');\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0);\n }\n\n var i;\n\n if (length === undefined) {\n length = 0;\n\n for (i = 0; i < list.length; ++i) {\n length += list[i].length;\n }\n }\n\n var buffer = Buffer.allocUnsafe(length);\n var pos = 0;\n\n for (i = 0; i < list.length; ++i) {\n var buf = list[i];\n\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers');\n }\n\n buf.copy(buffer, pos);\n pos += buf.length;\n }\n\n return buffer;\n};\n\nfunction byteLength(string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length;\n }\n\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength;\n }\n\n if (typeof string !== 'string') {\n string = '' + string;\n }\n\n var len = string.length;\n if (len === 0) return 0; // Use a for loop to avoid recursion\n\n var loweredCase = false;\n\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len;\n\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length;\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2;\n\n case 'hex':\n return len >>> 1;\n\n case 'base64':\n return base64ToBytes(string).length;\n\n default:\n if (loweredCase) return utf8ToBytes(string).length; // assume utf8\n\n encoding = ('' + encoding).toLowerCase();\n loweredCase = true;\n }\n }\n}\n\nBuffer.byteLength = byteLength;\n\nfunction slowToString(encoding, start, end) {\n var loweredCase = false; // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n\n if (start === undefined || start < 0) {\n start = 0;\n } // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n\n\n if (start > this.length) {\n return '';\n }\n\n if (end === undefined || end > this.length) {\n end = this.length;\n }\n\n if (end <= 0) {\n return '';\n } // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n\n\n end >>>= 0;\n start >>>= 0;\n\n if (end <= start) {\n return '';\n }\n\n if (!encoding) encoding = 'utf8';\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end);\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end);\n\n case 'ascii':\n return asciiSlice(this, start, end);\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end);\n\n case 'base64':\n return base64Slice(this, start, end);\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end);\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);\n encoding = (encoding + '').toLowerCase();\n loweredCase = true;\n }\n }\n} // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\n\n\nBuffer.prototype._isBuffer = true;\n\nfunction swap(b, n, m) {\n var i = b[n];\n b[n] = b[m];\n b[m] = i;\n}\n\nBuffer.prototype.swap16 = function swap16() {\n var len = this.length;\n\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits');\n }\n\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1);\n }\n\n return this;\n};\n\nBuffer.prototype.swap32 = function swap32() {\n var len = this.length;\n\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits');\n }\n\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3);\n swap(this, i + 1, i + 2);\n }\n\n return this;\n};\n\nBuffer.prototype.swap64 = function swap64() {\n var len = this.length;\n\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits');\n }\n\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7);\n swap(this, i + 1, i + 6);\n swap(this, i + 2, i + 5);\n swap(this, i + 3, i + 4);\n }\n\n return this;\n};\n\nBuffer.prototype.toString = function toString() {\n var length = this.length | 0;\n if (length === 0) return '';\n if (arguments.length === 0) return utf8Slice(this, 0, length);\n return slowToString.apply(this, arguments);\n};\n\nBuffer.prototype.equals = function equals(b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer');\n if (this === b) return true;\n return Buffer.compare(this, b) === 0;\n};\n\nBuffer.prototype.inspect = function inspect() {\n var str = '';\n var max = exports.INSPECT_MAX_BYTES;\n\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ');\n if (this.length > max) str += ' ... ';\n }\n\n return '';\n};\n\nBuffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer');\n }\n\n if (start === undefined) {\n start = 0;\n }\n\n if (end === undefined) {\n end = target ? target.length : 0;\n }\n\n if (thisStart === undefined) {\n thisStart = 0;\n }\n\n if (thisEnd === undefined) {\n thisEnd = this.length;\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index');\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0;\n }\n\n if (thisStart >= thisEnd) {\n return -1;\n }\n\n if (start >= end) {\n return 1;\n }\n\n start >>>= 0;\n end >>>= 0;\n thisStart >>>= 0;\n thisEnd >>>= 0;\n if (this === target) return 0;\n var x = thisEnd - thisStart;\n var y = end - start;\n var len = Math.min(x, y);\n var thisCopy = this.slice(thisStart, thisEnd);\n var targetCopy = target.slice(start, end);\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i];\n y = targetCopy[i];\n break;\n }\n }\n\n if (x < y) return -1;\n if (y < x) return 1;\n return 0;\n}; // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\n\n\nfunction bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1; // Normalize byteOffset\n\n if (typeof byteOffset === 'string') {\n encoding = byteOffset;\n byteOffset = 0;\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff;\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000;\n }\n\n byteOffset = +byteOffset; // Coerce to Number.\n\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : buffer.length - 1;\n } // Normalize byteOffset: negative offsets start from the end of the buffer\n\n\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset;\n\n if (byteOffset >= buffer.length) {\n if (dir) return -1;else byteOffset = buffer.length - 1;\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0;else return -1;\n } // Normalize val\n\n\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding);\n } // Finally, search either indexOf (if dir is true) or lastIndexOf\n\n\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1;\n }\n\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir);\n } else if (typeof val === 'number') {\n val = val & 0xFF; // Search for a byte value [0-255]\n\n if (Buffer.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);\n }\n }\n\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);\n }\n\n throw new TypeError('val must be string, number or Buffer');\n}\n\nfunction arrayIndexOf(arr, val, byteOffset, encoding, dir) {\n var indexSize = 1;\n var arrLength = arr.length;\n var valLength = val.length;\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase();\n\n if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1;\n }\n\n indexSize = 2;\n arrLength /= 2;\n valLength /= 2;\n byteOffset /= 2;\n }\n }\n\n function read(buf, i) {\n if (indexSize === 1) {\n return buf[i];\n } else {\n return buf.readUInt16BE(i * indexSize);\n }\n }\n\n var i;\n\n if (dir) {\n var foundIndex = -1;\n\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i;\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;\n } else {\n if (foundIndex !== -1) i -= i - foundIndex;\n foundIndex = -1;\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;\n\n for (i = byteOffset; i >= 0; i--) {\n var found = true;\n\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false;\n break;\n }\n }\n\n if (found) return i;\n }\n }\n\n return -1;\n}\n\nBuffer.prototype.includes = function includes(val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1;\n};\n\nBuffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true);\n};\n\nBuffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false);\n};\n\nfunction hexWrite(buf, string, offset, length) {\n offset = Number(offset) || 0;\n var remaining = buf.length - offset;\n\n if (!length) {\n length = remaining;\n } else {\n length = Number(length);\n\n if (length > remaining) {\n length = remaining;\n }\n } // must be an even number of digits\n\n\n var strLen = string.length;\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string');\n\n if (length > strLen / 2) {\n length = strLen / 2;\n }\n\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16);\n if (isNaN(parsed)) return i;\n buf[offset + i] = parsed;\n }\n\n return i;\n}\n\nfunction utf8Write(buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);\n}\n\nfunction asciiWrite(buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length);\n}\n\nfunction latin1Write(buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length);\n}\n\nfunction base64Write(buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length);\n}\n\nfunction ucs2Write(buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);\n}\n\nBuffer.prototype.write = function write(string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8';\n length = this.length;\n offset = 0; // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset;\n length = this.length;\n offset = 0; // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0;\n\n if (isFinite(length)) {\n length = length | 0;\n if (encoding === undefined) encoding = 'utf8';\n } else {\n encoding = length;\n length = undefined;\n } // legacy write(string, encoding, offset, length) - remove in v0.13\n\n } else {\n throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported');\n }\n\n var remaining = this.length - offset;\n if (length === undefined || length > remaining) length = remaining;\n\n if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds');\n }\n\n if (!encoding) encoding = 'utf8';\n var loweredCase = false;\n\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length);\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length);\n\n case 'ascii':\n return asciiWrite(this, string, offset, length);\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length);\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length);\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length);\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);\n encoding = ('' + encoding).toLowerCase();\n loweredCase = true;\n }\n }\n};\n\nBuffer.prototype.toJSON = function toJSON() {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n };\n};\n\nfunction base64Slice(buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf);\n } else {\n return base64.fromByteArray(buf.slice(start, end));\n }\n}\n\nfunction utf8Slice(buf, start, end) {\n end = Math.min(buf.length, end);\n var res = [];\n var i = start;\n\n while (i < end) {\n var firstByte = buf[i];\n var codePoint = null;\n var bytesPerSequence = firstByte > 0xEF ? 4 : firstByte > 0xDF ? 3 : firstByte > 0xBF ? 2 : 1;\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint;\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte;\n }\n\n break;\n\n case 2:\n secondByte = buf[i + 1];\n\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | secondByte & 0x3F;\n\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint;\n }\n }\n\n break;\n\n case 3:\n secondByte = buf[i + 1];\n thirdByte = buf[i + 2];\n\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | thirdByte & 0x3F;\n\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint;\n }\n }\n\n break;\n\n case 4:\n secondByte = buf[i + 1];\n thirdByte = buf[i + 2];\n fourthByte = buf[i + 3];\n\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | fourthByte & 0x3F;\n\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint;\n }\n }\n\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD;\n bytesPerSequence = 1;\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000;\n res.push(codePoint >>> 10 & 0x3FF | 0xD800);\n codePoint = 0xDC00 | codePoint & 0x3FF;\n }\n\n res.push(codePoint);\n i += bytesPerSequence;\n }\n\n return decodeCodePointsArray(res);\n} // Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\n\n\nvar MAX_ARGUMENTS_LENGTH = 0x1000;\n\nfunction decodeCodePointsArray(codePoints) {\n var len = codePoints.length;\n\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints); // avoid extra slice()\n } // Decode in chunks to avoid \"call stack size exceeded\".\n\n\n var res = '';\n var i = 0;\n\n while (i < len) {\n res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));\n }\n\n return res;\n}\n\nfunction asciiSlice(buf, start, end) {\n var ret = '';\n end = Math.min(buf.length, end);\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F);\n }\n\n return ret;\n}\n\nfunction latin1Slice(buf, start, end) {\n var ret = '';\n end = Math.min(buf.length, end);\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i]);\n }\n\n return ret;\n}\n\nfunction hexSlice(buf, start, end) {\n var len = buf.length;\n if (!start || start < 0) start = 0;\n if (!end || end < 0 || end > len) end = len;\n var out = '';\n\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i]);\n }\n\n return out;\n}\n\nfunction utf16leSlice(buf, start, end) {\n var bytes = buf.slice(start, end);\n var res = '';\n\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);\n }\n\n return res;\n}\n\nBuffer.prototype.slice = function slice(start, end) {\n var len = this.length;\n start = ~~start;\n end = end === undefined ? len : ~~end;\n\n if (start < 0) {\n start += len;\n if (start < 0) start = 0;\n } else if (start > len) {\n start = len;\n }\n\n if (end < 0) {\n end += len;\n if (end < 0) end = 0;\n } else if (end > len) {\n end = len;\n }\n\n if (end < start) end = start;\n var newBuf;\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end);\n newBuf.__proto__ = Buffer.prototype;\n } else {\n var sliceLen = end - start;\n newBuf = new Buffer(sliceLen, undefined);\n\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start];\n }\n }\n\n return newBuf;\n};\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\n\n\nfunction checkOffset(offset, ext, length) {\n if (offset % 1 !== 0 || offset < 0) throw new RangeError('offset is not uint');\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length');\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) {\n offset = offset | 0;\n byteLength = byteLength | 0;\n if (!noAssert) checkOffset(offset, byteLength, this.length);\n var val = this[offset];\n var mul = 1;\n var i = 0;\n\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul;\n }\n\n return val;\n};\n\nBuffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) {\n offset = offset | 0;\n byteLength = byteLength | 0;\n\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length);\n }\n\n var val = this[offset + --byteLength];\n var mul = 1;\n\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul;\n }\n\n return val;\n};\n\nBuffer.prototype.readUInt8 = function readUInt8(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length);\n return this[offset];\n};\n\nBuffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length);\n return this[offset] | this[offset + 1] << 8;\n};\n\nBuffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length);\n return this[offset] << 8 | this[offset + 1];\n};\n\nBuffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length);\n return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 0x1000000;\n};\n\nBuffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length);\n return this[offset] * 0x1000000 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);\n};\n\nBuffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {\n offset = offset | 0;\n byteLength = byteLength | 0;\n if (!noAssert) checkOffset(offset, byteLength, this.length);\n var val = this[offset];\n var mul = 1;\n var i = 0;\n\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul;\n }\n\n mul *= 0x80;\n if (val >= mul) val -= Math.pow(2, 8 * byteLength);\n return val;\n};\n\nBuffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) {\n offset = offset | 0;\n byteLength = byteLength | 0;\n if (!noAssert) checkOffset(offset, byteLength, this.length);\n var i = byteLength;\n var mul = 1;\n var val = this[offset + --i];\n\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul;\n }\n\n mul *= 0x80;\n if (val >= mul) val -= Math.pow(2, 8 * byteLength);\n return val;\n};\n\nBuffer.prototype.readInt8 = function readInt8(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length);\n if (!(this[offset] & 0x80)) return this[offset];\n return (0xff - this[offset] + 1) * -1;\n};\n\nBuffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length);\n var val = this[offset] | this[offset + 1] << 8;\n return val & 0x8000 ? val | 0xFFFF0000 : val;\n};\n\nBuffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length);\n var val = this[offset + 1] | this[offset] << 8;\n return val & 0x8000 ? val | 0xFFFF0000 : val;\n};\n\nBuffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length);\n return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;\n};\n\nBuffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length);\n return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];\n};\n\nBuffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length);\n return ieee754.read(this, offset, true, 23, 4);\n};\n\nBuffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length);\n return ieee754.read(this, offset, false, 23, 4);\n};\n\nBuffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length);\n return ieee754.read(this, offset, true, 52, 8);\n};\n\nBuffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length);\n return ieee754.read(this, offset, false, 52, 8);\n};\n\nfunction checkInt(buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance');\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds');\n if (offset + ext > buf.length) throw new RangeError('Index out of range');\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) {\n value = +value;\n offset = offset | 0;\n byteLength = byteLength | 0;\n\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1;\n checkInt(this, value, offset, byteLength, maxBytes, 0);\n }\n\n var mul = 1;\n var i = 0;\n this[offset] = value & 0xFF;\n\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = value / mul & 0xFF;\n }\n\n return offset + byteLength;\n};\n\nBuffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) {\n value = +value;\n offset = offset | 0;\n byteLength = byteLength | 0;\n\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1;\n checkInt(this, value, offset, byteLength, maxBytes, 0);\n }\n\n var i = byteLength - 1;\n var mul = 1;\n this[offset + i] = value & 0xFF;\n\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = value / mul & 0xFF;\n }\n\n return offset + byteLength;\n};\n\nBuffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);\n this[offset] = value & 0xff;\n return offset + 1;\n};\n\nfunction objectWriteUInt16(buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1;\n\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & 0xff << 8 * (littleEndian ? i : 1 - i)) >>> (littleEndian ? i : 1 - i) * 8;\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = value & 0xff;\n this[offset + 1] = value >>> 8;\n } else {\n objectWriteUInt16(this, value, offset, true);\n }\n\n return offset + 2;\n};\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = value >>> 8;\n this[offset + 1] = value & 0xff;\n } else {\n objectWriteUInt16(this, value, offset, false);\n }\n\n return offset + 2;\n};\n\nfunction objectWriteUInt32(buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1;\n\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = value >>> (littleEndian ? i : 3 - i) * 8 & 0xff;\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = value >>> 24;\n this[offset + 2] = value >>> 16;\n this[offset + 1] = value >>> 8;\n this[offset] = value & 0xff;\n } else {\n objectWriteUInt32(this, value, offset, true);\n }\n\n return offset + 4;\n};\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = value >>> 24;\n this[offset + 1] = value >>> 16;\n this[offset + 2] = value >>> 8;\n this[offset + 3] = value & 0xff;\n } else {\n objectWriteUInt32(this, value, offset, false);\n }\n\n return offset + 4;\n};\n\nBuffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) {\n value = +value;\n offset = offset | 0;\n\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1);\n checkInt(this, value, offset, byteLength, limit - 1, -limit);\n }\n\n var i = 0;\n var mul = 1;\n var sub = 0;\n this[offset] = value & 0xFF;\n\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1;\n }\n\n this[offset + i] = (value / mul >> 0) - sub & 0xFF;\n }\n\n return offset + byteLength;\n};\n\nBuffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) {\n value = +value;\n offset = offset | 0;\n\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1);\n checkInt(this, value, offset, byteLength, limit - 1, -limit);\n }\n\n var i = byteLength - 1;\n var mul = 1;\n var sub = 0;\n this[offset + i] = value & 0xFF;\n\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1;\n }\n\n this[offset + i] = (value / mul >> 0) - sub & 0xFF;\n }\n\n return offset + byteLength;\n};\n\nBuffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);\n if (value < 0) value = 0xff + value + 1;\n this[offset] = value & 0xff;\n return offset + 1;\n};\n\nBuffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = value & 0xff;\n this[offset + 1] = value >>> 8;\n } else {\n objectWriteUInt16(this, value, offset, true);\n }\n\n return offset + 2;\n};\n\nBuffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = value >>> 8;\n this[offset + 1] = value & 0xff;\n } else {\n objectWriteUInt16(this, value, offset, false);\n }\n\n return offset + 2;\n};\n\nBuffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = value & 0xff;\n this[offset + 1] = value >>> 8;\n this[offset + 2] = value >>> 16;\n this[offset + 3] = value >>> 24;\n } else {\n objectWriteUInt32(this, value, offset, true);\n }\n\n return offset + 4;\n};\n\nBuffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);\n if (value < 0) value = 0xffffffff + value + 1;\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = value >>> 24;\n this[offset + 1] = value >>> 16;\n this[offset + 2] = value >>> 8;\n this[offset + 3] = value & 0xff;\n } else {\n objectWriteUInt32(this, value, offset, false);\n }\n\n return offset + 4;\n};\n\nfunction checkIEEE754(buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range');\n if (offset < 0) throw new RangeError('Index out of range');\n}\n\nfunction writeFloat(buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38);\n }\n\n ieee754.write(buf, value, offset, littleEndian, 23, 4);\n return offset + 4;\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert);\n};\n\nBuffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert);\n};\n\nfunction writeDouble(buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308);\n }\n\n ieee754.write(buf, value, offset, littleEndian, 52, 8);\n return offset + 8;\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert);\n};\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert);\n}; // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\n\n\nBuffer.prototype.copy = function copy(target, targetStart, start, end) {\n if (!start) start = 0;\n if (!end && end !== 0) end = this.length;\n if (targetStart >= target.length) targetStart = target.length;\n if (!targetStart) targetStart = 0;\n if (end > 0 && end < start) end = start; // Copy 0 bytes; we're done\n\n if (end === start) return 0;\n if (target.length === 0 || this.length === 0) return 0; // Fatal error conditions\n\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds');\n }\n\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds');\n if (end < 0) throw new RangeError('sourceEnd out of bounds'); // Are we oob?\n\n if (end > this.length) end = this.length;\n\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start;\n }\n\n var len = end - start;\n var i;\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start];\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start];\n }\n } else {\n Uint8Array.prototype.set.call(target, this.subarray(start, start + len), targetStart);\n }\n\n return len;\n}; // Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\n\n\nBuffer.prototype.fill = function fill(val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start;\n start = 0;\n end = this.length;\n } else if (typeof end === 'string') {\n encoding = end;\n end = this.length;\n }\n\n if (val.length === 1) {\n var code = val.charCodeAt(0);\n\n if (code < 256) {\n val = code;\n }\n }\n\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string');\n }\n\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding);\n }\n } else if (typeof val === 'number') {\n val = val & 255;\n } // Invalid ranges are not set to a default, so can range check early.\n\n\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index');\n }\n\n if (end <= start) {\n return this;\n }\n\n start = start >>> 0;\n end = end === undefined ? this.length : end >>> 0;\n if (!val) val = 0;\n var i;\n\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val;\n }\n } else {\n var bytes = Buffer.isBuffer(val) ? val : utf8ToBytes(new Buffer(val, encoding).toString());\n var len = bytes.length;\n\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len];\n }\n }\n\n return this;\n}; // HELPER FUNCTIONS\n// ================\n\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g;\n\nfunction base64clean(str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, ''); // Node converts strings with length < 2 to ''\n\n if (str.length < 2) return ''; // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n\n while (str.length % 4 !== 0) {\n str = str + '=';\n }\n\n return str;\n}\n\nfunction stringtrim(str) {\n if (str.trim) return str.trim();\n return str.replace(/^\\s+|\\s+$/g, '');\n}\n\nfunction toHex(n) {\n if (n < 16) return '0' + n.toString(16);\n return n.toString(16);\n}\n\nfunction utf8ToBytes(string, units) {\n units = units || Infinity;\n var codePoint;\n var length = string.length;\n var leadSurrogate = null;\n var bytes = [];\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i); // is surrogate component\n\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n continue;\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n continue;\n } // valid lead\n\n\n leadSurrogate = codePoint;\n continue;\n } // 2 leads in a row\n\n\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n leadSurrogate = codePoint;\n continue;\n } // valid surrogate pair\n\n\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n }\n\n leadSurrogate = null; // encode utf8\n\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break;\n bytes.push(codePoint);\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break;\n bytes.push(codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80);\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break;\n bytes.push(codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break;\n bytes.push(codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);\n } else {\n throw new Error('Invalid code point');\n }\n }\n\n return bytes;\n}\n\nfunction asciiToBytes(str) {\n var byteArray = [];\n\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF);\n }\n\n return byteArray;\n}\n\nfunction utf16leToBytes(str, units) {\n var c, hi, lo;\n var byteArray = [];\n\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break;\n c = str.charCodeAt(i);\n hi = c >> 8;\n lo = c % 256;\n byteArray.push(lo);\n byteArray.push(hi);\n }\n\n return byteArray;\n}\n\nfunction base64ToBytes(str) {\n return base64.toByteArray(base64clean(str));\n}\n\nfunction blitBuffer(src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if (i + offset >= dst.length || i >= src.length) break;\n dst[i + offset] = src[i];\n }\n\n return i;\n}\n\nfunction isnan(val) {\n return val !== val; // eslint-disable-line no-self-compare\n}","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};","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\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nfunction isArray(arg) {\n if (Array.isArray) {\n return Array.isArray(arg);\n }\n\n return objectToString(arg) === '[object Array]';\n}\n\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\n\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\n\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\n\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\n\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\n\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return _typeof(arg) === 'symbol';\n}\n\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\n\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return objectToString(re) === '[object RegExp]';\n}\n\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return _typeof(arg) === 'object' && arg !== null;\n}\n\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return objectToString(d) === '[object Date]';\n}\n\nexports.isDate = isDate;\n\nfunction isError(e) {\n return objectToString(e) === '[object Error]' || e instanceof Error;\n}\n\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\n\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null || typeof arg === 'boolean' || typeof arg === 'number' || typeof arg === 'string' || _typeof(arg) === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\n\nexports.isPrimitive = isPrimitive;\nexports.isBuffer = Buffer.isBuffer;\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\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 key: \"title\",\n value: sns.name\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};","/* 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;","/* eslint-disable node/no-deprecated-api */\nvar buffer = require('buffer');\n\nvar Buffer = buffer.Buffer; // alternative to using Object.keys for old browsers\n\nfunction copyProps(src, dst) {\n for (var key in src) {\n dst[key] = src[key];\n }\n}\n\nif (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {\n module.exports = buffer;\n} else {\n // Copy properties from require('buffer')\n copyProps(buffer, exports);\n exports.Buffer = SafeBuffer;\n}\n\nfunction SafeBuffer(arg, encodingOrOffset, length) {\n return Buffer(arg, encodingOrOffset, length);\n} // Copy static methods from Buffer\n\n\ncopyProps(Buffer, SafeBuffer);\n\nSafeBuffer.from = function (arg, encodingOrOffset, length) {\n if (typeof arg === 'number') {\n throw new TypeError('Argument must not be a number');\n }\n\n return Buffer(arg, encodingOrOffset, length);\n};\n\nSafeBuffer.alloc = function (size, fill, encoding) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number');\n }\n\n var buf = Buffer(size);\n\n if (fill !== undefined) {\n if (typeof encoding === 'string') {\n buf.fill(fill, encoding);\n } else {\n buf.fill(fill);\n }\n } else {\n buf.fill(0);\n }\n\n return buf;\n};\n\nSafeBuffer.allocUnsafe = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number');\n }\n\n return Buffer(size);\n};\n\nSafeBuffer.allocUnsafeSlow = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number');\n }\n\n return buffer.SlowBuffer(size);\n};","'use strict';\n\nif (!process.version || process.version.indexOf('v0.') === 0 || process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {\n module.exports = {\n nextTick: nextTick\n };\n} else {\n module.exports = process;\n}\n\nfunction nextTick(fn, arg1, arg2, arg3) {\n if (typeof fn !== 'function') {\n throw new TypeError('\"callback\" argument must be a function');\n }\n\n var len = arguments.length;\n var args, i;\n\n switch (len) {\n case 0:\n case 1:\n return process.nextTick(fn);\n\n case 2:\n return process.nextTick(function afterTickOne() {\n fn.call(null, arg1);\n });\n\n case 3:\n return process.nextTick(function afterTickTwo() {\n fn.call(null, arg1, arg2);\n });\n\n case 4:\n return process.nextTick(function afterTickThree() {\n fn.call(null, arg1, arg2, arg3);\n });\n\n default:\n args = new Array(len - 1);\n i = 0;\n\n while (i < args.length) {\n args[i++] = arguments[i];\n }\n\n return process.nextTick(function afterTick() {\n fn.apply(null, args);\n });\n }\n}","/**\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 }); //newColumnWidth--; // the total column width shouldn't match the outerWidth // GS-2190 reducing width seems to be not needed\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 if (task.unscheduled) {\n continue; // do not process assignments for unscheduled tasks\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 var scrollbarsToHide = [];\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 scrollbarsToHide.push(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 } // GS-2220\n\n\n scrollbarsToHide.forEach(function (scrollbar) {\n if (!(scrollbar.$config.group && visibleGroups[scrollbar.$config.group])) {\n hideScrollbar(scrollbar);\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 var index = branch.indexOf(id + \"\");\n\n if (index == -1) {\n index = branch.indexOf(+id);\n }\n\n return index;\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 = branch.indexOf(item.id + \"\") > -1 || branch.indexOf(+item.id) > -1;\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 var index = branch.indexOf(old_id + \"\");\n\n if (index == -1 && !isNaN(+old_id)) {\n index = branch.indexOf(+old_id);\n }\n\n if (index > -1) {\n if (new_id) {\n branch.splice(index, 1, new_id);\n } else {\n branch.splice(index, 1);\n }\n }\n\n newbranch = branch;\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 var renderedParent = this.pull[i].$rendered_parent;\n var actualParent = this.getParent(this.pull[i]);\n\n if (renderedParent !== actualParent) {\n this._move_branch(this.pull[i], renderedParent, actualParent);\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; // GS-2170. Do not recalculate the indexes and dates as they will be recalculated later\n\n this._skipTaskRecalculation = true;\n this.callEvent(\"onItemOpen\", [id]);\n }\n },\n close: function close(id) {\n if (this.exists(id)) {\n this.getItem(id).$open = false; // GS-2170. Do not recalculate the indexes and dates as they will be recalculated later\n\n this._skipTaskRecalculation = true;\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;","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;","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\n/* eslint-env browser */\nmodule.exports = (typeof self === \"undefined\" ? \"undefined\" : _typeof(self)) == 'object' ? self.FormData : window.FormData;","/* globals __webpack_amd_options__ */\r\nmodule.exports = __webpack_amd_options__;\r\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n'use strict';\n\nfunction _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 punycode = require('punycode');\n\nvar util = require('./util');\n\nexports.parse = urlParse;\nexports.resolve = urlResolve;\nexports.resolveObject = urlResolveObject;\nexports.format = urlFormat;\nexports.Url = Url;\n\nfunction Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.host = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.query = null;\n this.pathname = null;\n this.path = null;\n this.href = null;\n} // Reference: RFC 3986, RFC 1808, RFC 2396\n// define these here so at least they only have to be\n// compiled once on the first module load.\n\n\nvar protocolPattern = /^([a-z0-9.+-]+:)/i,\n portPattern = /:[0-9]*$/,\n // Special case for a simple path URL\nsimplePathPattern = /^(\\/\\/?(?!\\/)[^\\?\\s]*)(\\?[^\\s]*)?$/,\n // RFC 2396: characters reserved for delimiting URLs.\n// We actually just auto-escape these.\ndelims = ['<', '>', '\"', '`', ' ', '\\r', '\\n', '\\t'],\n // RFC 2396: characters not allowed for various reasons.\nunwise = ['{', '}', '|', '\\\\', '^', '`'].concat(delims),\n // Allowed by RFCs, but cause of XSS attacks. Always escape these.\nautoEscape = ['\\''].concat(unwise),\n // Characters that are never ever allowed in a hostname.\n// Note that any invalid chars are also handled, but these\n// are the ones that are *expected* to be seen, so we fast-path\n// them.\nnonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),\n hostEndingChars = ['/', '?', '#'],\n hostnameMaxLen = 255,\n hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,\n hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,\n // protocols that can allow \"unsafe\" and \"unwise\" chars.\nunsafeProtocol = {\n 'javascript': true,\n 'javascript:': true\n},\n // protocols that never have a hostname.\nhostlessProtocol = {\n 'javascript': true,\n 'javascript:': true\n},\n // protocols that always contain a // bit.\nslashedProtocol = {\n 'http': true,\n 'https': true,\n 'ftp': true,\n 'gopher': true,\n 'file': true,\n 'http:': true,\n 'https:': true,\n 'ftp:': true,\n 'gopher:': true,\n 'file:': true\n},\n querystring = require('querystring');\n\nfunction urlParse(url, parseQueryString, slashesDenoteHost) {\n if (url && util.isObject(url) && url instanceof Url) return url;\n var u = new Url();\n u.parse(url, parseQueryString, slashesDenoteHost);\n return u;\n}\n\nUrl.prototype.parse = function (url, parseQueryString, slashesDenoteHost) {\n if (!util.isString(url)) {\n throw new TypeError(\"Parameter 'url' must be a string, not \" + _typeof(url));\n } // Copy chrome, IE, opera backslash-handling behavior.\n // Back slashes before the query string get converted to forward slashes\n // See: https://code.google.com/p/chromium/issues/detail?id=25916\n\n\n var queryIndex = url.indexOf('?'),\n splitter = queryIndex !== -1 && queryIndex < url.indexOf('#') ? '?' : '#',\n uSplit = url.split(splitter),\n slashRegex = /\\\\/g;\n uSplit[0] = uSplit[0].replace(slashRegex, '/');\n url = uSplit.join(splitter);\n var rest = url; // trim before proceeding.\n // This is to support parse stuff like \" http://foo.com \\n\"\n\n rest = rest.trim();\n\n if (!slashesDenoteHost && url.split('#').length === 1) {\n // Try fast path regexp\n var simplePath = simplePathPattern.exec(rest);\n\n if (simplePath) {\n this.path = rest;\n this.href = rest;\n this.pathname = simplePath[1];\n\n if (simplePath[2]) {\n this.search = simplePath[2];\n\n if (parseQueryString) {\n this.query = querystring.parse(this.search.substr(1));\n } else {\n this.query = this.search.substr(1);\n }\n } else if (parseQueryString) {\n this.search = '';\n this.query = {};\n }\n\n return this;\n }\n }\n\n var proto = protocolPattern.exec(rest);\n\n if (proto) {\n proto = proto[0];\n var lowerProto = proto.toLowerCase();\n this.protocol = lowerProto;\n rest = rest.substr(proto.length);\n } // figure out if it's got a host\n // user@server is *always* interpreted as a hostname, and url\n // resolution will treat //foo/bar as host=foo,path=bar because that's\n // how the browser resolves relative URLs.\n\n\n if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@\\/]+@[^@\\/]+/)) {\n var slashes = rest.substr(0, 2) === '//';\n\n if (slashes && !(proto && hostlessProtocol[proto])) {\n rest = rest.substr(2);\n this.slashes = true;\n }\n }\n\n if (!hostlessProtocol[proto] && (slashes || proto && !slashedProtocol[proto])) {\n // there's a hostname.\n // the first instance of /, ?, ;, or # ends the host.\n //\n // If there is an @ in the hostname, then non-host chars *are* allowed\n // to the left of the last @ sign, unless some host-ending character\n // comes *before* the @-sign.\n // URLs are obnoxious.\n //\n // ex:\n // http://a@b@c/ => user:a@b host:c\n // http://a@b?@c => user:a host:c path:/?@c\n // v0.12 TODO(isaacs): This is not quite how Chrome does things.\n // Review our test case against browsers more comprehensively.\n // find the first instance of any hostEndingChars\n var hostEnd = -1;\n\n for (var i = 0; i < hostEndingChars.length; i++) {\n var hec = rest.indexOf(hostEndingChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) hostEnd = hec;\n } // at this point, either we have an explicit point where the\n // auth portion cannot go past, or the last @ char is the decider.\n\n\n var auth, atSign;\n\n if (hostEnd === -1) {\n // atSign can be anywhere.\n atSign = rest.lastIndexOf('@');\n } else {\n // atSign must be in auth portion.\n // http://a@b/c@d => host:b auth:a path:/c@d\n atSign = rest.lastIndexOf('@', hostEnd);\n } // Now we have a portion which is definitely the auth.\n // Pull that off.\n\n\n if (atSign !== -1) {\n auth = rest.slice(0, atSign);\n rest = rest.slice(atSign + 1);\n this.auth = decodeURIComponent(auth);\n } // the host is the remaining to the left of the first non-host char\n\n\n hostEnd = -1;\n\n for (var i = 0; i < nonHostChars.length; i++) {\n var hec = rest.indexOf(nonHostChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) hostEnd = hec;\n } // if we still have not hit it, then the entire thing is a host.\n\n\n if (hostEnd === -1) hostEnd = rest.length;\n this.host = rest.slice(0, hostEnd);\n rest = rest.slice(hostEnd); // pull out port.\n\n this.parseHost(); // we've indicated that there is a hostname,\n // so even if it's empty, it has to be present.\n\n this.hostname = this.hostname || ''; // if hostname begins with [ and ends with ]\n // assume that it's an IPv6 address.\n\n var ipv6Hostname = this.hostname[0] === '[' && this.hostname[this.hostname.length - 1] === ']'; // validate a little.\n\n if (!ipv6Hostname) {\n var hostparts = this.hostname.split(/\\./);\n\n for (var i = 0, l = hostparts.length; i < l; i++) {\n var part = hostparts[i];\n if (!part) continue;\n\n if (!part.match(hostnamePartPattern)) {\n var newpart = '';\n\n for (var j = 0, k = part.length; j < k; j++) {\n if (part.charCodeAt(j) > 127) {\n // we replace non-ASCII char with a temporary placeholder\n // we need this to make sure size of hostname is not\n // broken by replacing non-ASCII by nothing\n newpart += 'x';\n } else {\n newpart += part[j];\n }\n } // we test again with ASCII char only\n\n\n if (!newpart.match(hostnamePartPattern)) {\n var validParts = hostparts.slice(0, i);\n var notHost = hostparts.slice(i + 1);\n var bit = part.match(hostnamePartStart);\n\n if (bit) {\n validParts.push(bit[1]);\n notHost.unshift(bit[2]);\n }\n\n if (notHost.length) {\n rest = '/' + notHost.join('.') + rest;\n }\n\n this.hostname = validParts.join('.');\n break;\n }\n }\n }\n }\n\n if (this.hostname.length > hostnameMaxLen) {\n this.hostname = '';\n } else {\n // hostnames are always lower case.\n this.hostname = this.hostname.toLowerCase();\n }\n\n if (!ipv6Hostname) {\n // IDNA Support: Returns a punycoded representation of \"domain\".\n // It only converts parts of the domain name that\n // have non-ASCII characters, i.e. it doesn't matter if\n // you call it with a domain that already is ASCII-only.\n this.hostname = punycode.toASCII(this.hostname);\n }\n\n var p = this.port ? ':' + this.port : '';\n var h = this.hostname || '';\n this.host = h + p;\n this.href += this.host; // strip [ and ] from the hostname\n // the host field still retains them, though\n\n if (ipv6Hostname) {\n this.hostname = this.hostname.substr(1, this.hostname.length - 2);\n\n if (rest[0] !== '/') {\n rest = '/' + rest;\n }\n }\n } // now rest is set to the post-host stuff.\n // chop off any delim chars.\n\n\n if (!unsafeProtocol[lowerProto]) {\n // First, make 100% sure that any \"autoEscape\" chars get\n // escaped, even if encodeURIComponent doesn't think they\n // need to be.\n for (var i = 0, l = autoEscape.length; i < l; i++) {\n var ae = autoEscape[i];\n if (rest.indexOf(ae) === -1) continue;\n var esc = encodeURIComponent(ae);\n\n if (esc === ae) {\n esc = escape(ae);\n }\n\n rest = rest.split(ae).join(esc);\n }\n } // chop off from the tail first.\n\n\n var hash = rest.indexOf('#');\n\n if (hash !== -1) {\n // got a fragment string.\n this.hash = rest.substr(hash);\n rest = rest.slice(0, hash);\n }\n\n var qm = rest.indexOf('?');\n\n if (qm !== -1) {\n this.search = rest.substr(qm);\n this.query = rest.substr(qm + 1);\n\n if (parseQueryString) {\n this.query = querystring.parse(this.query);\n }\n\n rest = rest.slice(0, qm);\n } else if (parseQueryString) {\n // no query string, but parseQueryString still requested\n this.search = '';\n this.query = {};\n }\n\n if (rest) this.pathname = rest;\n\n if (slashedProtocol[lowerProto] && this.hostname && !this.pathname) {\n this.pathname = '/';\n } //to support http.request\n\n\n if (this.pathname || this.search) {\n var p = this.pathname || '';\n var s = this.search || '';\n this.path = p + s;\n } // finally, reconstruct the href based on what has been validated.\n\n\n this.href = this.format();\n return this;\n}; // format a parsed object into a url string\n\n\nfunction urlFormat(obj) {\n // ensure it's an object, and not a string url.\n // If it's an obj, this is a no-op.\n // this way, you can call url_format() on strings\n // to clean up potentially wonky urls.\n if (util.isString(obj)) obj = urlParse(obj);\n if (!(obj instanceof Url)) return Url.prototype.format.call(obj);\n return obj.format();\n}\n\nUrl.prototype.format = function () {\n var auth = this.auth || '';\n\n if (auth) {\n auth = encodeURIComponent(auth);\n auth = auth.replace(/%3A/i, ':');\n auth += '@';\n }\n\n var protocol = this.protocol || '',\n pathname = this.pathname || '',\n hash = this.hash || '',\n host = false,\n query = '';\n\n if (this.host) {\n host = auth + this.host;\n } else if (this.hostname) {\n host = auth + (this.hostname.indexOf(':') === -1 ? this.hostname : '[' + this.hostname + ']');\n\n if (this.port) {\n host += ':' + this.port;\n }\n }\n\n if (this.query && util.isObject(this.query) && Object.keys(this.query).length) {\n query = querystring.stringify(this.query);\n }\n\n var search = this.search || query && '?' + query || '';\n if (protocol && protocol.substr(-1) !== ':') protocol += ':'; // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.\n // unless they had them to begin with.\n\n if (this.slashes || (!protocol || slashedProtocol[protocol]) && host !== false) {\n host = '//' + (host || '');\n if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;\n } else if (!host) {\n host = '';\n }\n\n if (hash && hash.charAt(0) !== '#') hash = '#' + hash;\n if (search && search.charAt(0) !== '?') search = '?' + search;\n pathname = pathname.replace(/[?#]/g, function (match) {\n return encodeURIComponent(match);\n });\n search = search.replace('#', '%23');\n return protocol + host + pathname + search + hash;\n};\n\nfunction urlResolve(source, relative) {\n return urlParse(source, false, true).resolve(relative);\n}\n\nUrl.prototype.resolve = function (relative) {\n return this.resolveObject(urlParse(relative, false, true)).format();\n};\n\nfunction urlResolveObject(source, relative) {\n if (!source) return relative;\n return urlParse(source, false, true).resolveObject(relative);\n}\n\nUrl.prototype.resolveObject = function (relative) {\n if (util.isString(relative)) {\n var rel = new Url();\n rel.parse(relative, false, true);\n relative = rel;\n }\n\n var result = new Url();\n var tkeys = Object.keys(this);\n\n for (var tk = 0; tk < tkeys.length; tk++) {\n var tkey = tkeys[tk];\n result[tkey] = this[tkey];\n } // hash is always overridden, no matter what.\n // even href=\"\" will remove it.\n\n\n result.hash = relative.hash; // if the relative url is empty, then there's nothing left to do here.\n\n if (relative.href === '') {\n result.href = result.format();\n return result;\n } // hrefs like //foo/bar always cut to the protocol.\n\n\n if (relative.slashes && !relative.protocol) {\n // take everything except the protocol from relative\n var rkeys = Object.keys(relative);\n\n for (var rk = 0; rk < rkeys.length; rk++) {\n var rkey = rkeys[rk];\n if (rkey !== 'protocol') result[rkey] = relative[rkey];\n } //urlParse appends trailing / to urls like http://www.example.com\n\n\n if (slashedProtocol[result.protocol] && result.hostname && !result.pathname) {\n result.path = result.pathname = '/';\n }\n\n result.href = result.format();\n return result;\n }\n\n if (relative.protocol && relative.protocol !== result.protocol) {\n // if it's a known url protocol, then changing\n // the protocol does weird things\n // first, if it's not file:, then we MUST have a host,\n // and if there was a path\n // to begin with, then we MUST have a path.\n // if it is file:, then the host is dropped,\n // because that's known to be hostless.\n // anything else is assumed to be absolute.\n if (!slashedProtocol[relative.protocol]) {\n var keys = Object.keys(relative);\n\n for (var v = 0; v < keys.length; v++) {\n var k = keys[v];\n result[k] = relative[k];\n }\n\n result.href = result.format();\n return result;\n }\n\n result.protocol = relative.protocol;\n\n if (!relative.host && !hostlessProtocol[relative.protocol]) {\n var relPath = (relative.pathname || '').split('/');\n\n while (relPath.length && !(relative.host = relPath.shift())) {\n ;\n }\n\n if (!relative.host) relative.host = '';\n if (!relative.hostname) relative.hostname = '';\n if (relPath[0] !== '') relPath.unshift('');\n if (relPath.length < 2) relPath.unshift('');\n result.pathname = relPath.join('/');\n } else {\n result.pathname = relative.pathname;\n }\n\n result.search = relative.search;\n result.query = relative.query;\n result.host = relative.host || '';\n result.auth = relative.auth;\n result.hostname = relative.hostname || relative.host;\n result.port = relative.port; // to support http.request\n\n if (result.pathname || result.search) {\n var p = result.pathname || '';\n var s = result.search || '';\n result.path = p + s;\n }\n\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n }\n\n var isSourceAbs = result.pathname && result.pathname.charAt(0) === '/',\n isRelAbs = relative.host || relative.pathname && relative.pathname.charAt(0) === '/',\n mustEndAbs = isRelAbs || isSourceAbs || result.host && relative.pathname,\n removeAllDots = mustEndAbs,\n srcPath = result.pathname && result.pathname.split('/') || [],\n relPath = relative.pathname && relative.pathname.split('/') || [],\n psychotic = result.protocol && !slashedProtocol[result.protocol]; // if the url is a non-slashed url, then relative\n // links like ../.. should be able\n // to crawl up to the hostname, as well. This is strange.\n // result.protocol has already been set by now.\n // Later on, put the first path part into the host field.\n\n if (psychotic) {\n result.hostname = '';\n result.port = null;\n\n if (result.host) {\n if (srcPath[0] === '') srcPath[0] = result.host;else srcPath.unshift(result.host);\n }\n\n result.host = '';\n\n if (relative.protocol) {\n relative.hostname = null;\n relative.port = null;\n\n if (relative.host) {\n if (relPath[0] === '') relPath[0] = relative.host;else relPath.unshift(relative.host);\n }\n\n relative.host = null;\n }\n\n mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');\n }\n\n if (isRelAbs) {\n // it's absolute.\n result.host = relative.host || relative.host === '' ? relative.host : result.host;\n result.hostname = relative.hostname || relative.hostname === '' ? relative.hostname : result.hostname;\n result.search = relative.search;\n result.query = relative.query;\n srcPath = relPath; // fall through to the dot-handling below.\n } else if (relPath.length) {\n // it's relative\n // throw away the existing file, and take the new path instead.\n if (!srcPath) srcPath = [];\n srcPath.pop();\n srcPath = srcPath.concat(relPath);\n result.search = relative.search;\n result.query = relative.query;\n } else if (!util.isNullOrUndefined(relative.search)) {\n // just pull out the search.\n // like href='?foo'.\n // Put this after the other two cases because it simplifies the booleans\n if (psychotic) {\n result.hostname = result.host = srcPath.shift(); //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n\n var authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false;\n\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n\n result.search = relative.search;\n result.query = relative.query; //to support http.request\n\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : '');\n }\n\n result.href = result.format();\n return result;\n }\n\n if (!srcPath.length) {\n // no path at all. easy.\n // we've already handled the other stuff above.\n result.pathname = null; //to support http.request\n\n if (result.search) {\n result.path = '/' + result.search;\n } else {\n result.path = null;\n }\n\n result.href = result.format();\n return result;\n } // if a url ENDs in . or .., then it must get a trailing slash.\n // however, if it ends in anything else non-slashy,\n // then it must NOT get a trailing slash.\n\n\n var last = srcPath.slice(-1)[0];\n var hasTrailingSlash = (result.host || relative.host || srcPath.length > 1) && (last === '.' || last === '..') || last === ''; // strip single dots, resolve double dots to parent dir\n // if the path tries to go above the root, `up` ends up > 0\n\n var up = 0;\n\n for (var i = srcPath.length; i >= 0; i--) {\n last = srcPath[i];\n\n if (last === '.') {\n srcPath.splice(i, 1);\n } else if (last === '..') {\n srcPath.splice(i, 1);\n up++;\n } else if (up) {\n srcPath.splice(i, 1);\n up--;\n }\n } // if the path is allowed to go above the root, restore leading ..s\n\n\n if (!mustEndAbs && !removeAllDots) {\n for (; up--; up) {\n srcPath.unshift('..');\n }\n }\n\n if (mustEndAbs && srcPath[0] !== '' && (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {\n srcPath.unshift('');\n }\n\n if (hasTrailingSlash && srcPath.join('/').substr(-1) !== '/') {\n srcPath.push('');\n }\n\n var isAbsolute = srcPath[0] === '' || srcPath[0] && srcPath[0].charAt(0) === '/'; // put the host back\n\n if (psychotic) {\n result.hostname = result.host = isAbsolute ? '' : srcPath.length ? srcPath.shift() : ''; //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n\n var authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false;\n\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n\n mustEndAbs = mustEndAbs || result.host && srcPath.length;\n\n if (mustEndAbs && !isAbsolute) {\n srcPath.unshift('');\n }\n\n if (!srcPath.length) {\n result.pathname = null;\n result.path = null;\n } else {\n result.pathname = srcPath.join('/');\n } //to support request.http\n\n\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : '');\n }\n\n result.auth = relative.auth || result.auth;\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n};\n\nUrl.prototype.parseHost = function () {\n var host = this.host;\n var port = portPattern.exec(host);\n\n if (port) {\n port = port[0];\n\n if (port !== ':') {\n this.port = port.substr(1);\n }\n\n host = host.substr(0, host.length - port.length);\n }\n\n if (host) this.hostname = host;\n};","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n'use strict';\n\nmodule.exports = Transform;\n\nvar Duplex = require('./_stream_duplex');\n/**/\n\n\nvar util = require('core-util-is');\n\nutil.inherits = require('inherits');\n/**/\n\nutil.inherits(Transform, Duplex);\n\nfunction afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n var cb = ts.writecb;\n\n if (!cb) {\n return this.emit('error', new Error('write callback called multiple times'));\n }\n\n ts.writechunk = null;\n ts.writecb = null;\n if (data != null) // single equals check for both `null` and `undefined`\n this.push(data);\n cb(er);\n var rs = this._readableState;\n rs.reading = false;\n\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n}\n\nfunction Transform(options) {\n if (!(this instanceof Transform)) return new Transform(options);\n Duplex.call(this, options);\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n }; // start out asking for a readable event once data is transformed.\n\n this._readableState.needReadable = true; // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n\n this._readableState.sync = false;\n\n if (options) {\n if (typeof options.transform === 'function') this._transform = options.transform;\n if (typeof options.flush === 'function') this._flush = options.flush;\n } // When the writable side finishes, then flush out anything remaining.\n\n\n this.on('prefinish', prefinish);\n}\n\nfunction prefinish() {\n var _this = this;\n\n if (typeof this._flush === 'function') {\n this._flush(function (er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n}\n\nTransform.prototype.push = function (chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n}; // This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\n\n\nTransform.prototype._transform = function (chunk, encoding, cb) {\n throw new Error('_transform() is not implemented');\n};\n\nTransform.prototype._write = function (chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);\n }\n}; // Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\n\n\nTransform.prototype._read = function (n) {\n var ts = this._transformState;\n\n if (ts.writechunk !== null && ts.writecb && !ts.transforming) {\n ts.transforming = true;\n\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\n\nTransform.prototype._destroy = function (err, cb) {\n var _this2 = this;\n\n Duplex.prototype._destroy.call(this, err, function (err2) {\n cb(err2);\n\n _this2.emit('close');\n });\n};\n\nfunction done(stream, er, data) {\n if (er) return stream.emit('error', er);\n if (data != null) // single equals check for both `null` and `undefined`\n stream.push(data); // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n\n if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');\n if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');\n return stream.push(null);\n}","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n'use strict';\n/**/\n\nvar Buffer = require('safe-buffer').Buffer;\n/**/\n\n\nvar isEncoding = Buffer.isEncoding || function (encoding) {\n encoding = '' + encoding;\n\n switch (encoding && encoding.toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n case 'raw':\n return true;\n\n default:\n return false;\n }\n};\n\nfunction _normalizeEncoding(enc) {\n if (!enc) return 'utf8';\n var retried;\n\n while (true) {\n switch (enc) {\n case 'utf8':\n case 'utf-8':\n return 'utf8';\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return 'utf16le';\n\n case 'latin1':\n case 'binary':\n return 'latin1';\n\n case 'base64':\n case 'ascii':\n case 'hex':\n return enc;\n\n default:\n if (retried) return; // undefined\n\n enc = ('' + enc).toLowerCase();\n retried = true;\n }\n }\n}\n\n; // Do not cache `Buffer.isEncoding` when checking encoding names as some\n// modules monkey-patch it to support additional encodings\n\nfunction normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n\n if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n return nenc || enc;\n} // StringDecoder provides an interface for efficiently splitting a series of\n// buffers into a series of JS strings without breaking apart multi-byte\n// characters.\n\n\nexports.StringDecoder = StringDecoder;\n\nfunction StringDecoder(encoding) {\n this.encoding = normalizeEncoding(encoding);\n var nb;\n\n switch (this.encoding) {\n case 'utf16le':\n this.text = utf16Text;\n this.end = utf16End;\n nb = 4;\n break;\n\n case 'utf8':\n this.fillLast = utf8FillLast;\n nb = 4;\n break;\n\n case 'base64':\n this.text = base64Text;\n this.end = base64End;\n nb = 3;\n break;\n\n default:\n this.write = simpleWrite;\n this.end = simpleEnd;\n return;\n }\n\n this.lastNeed = 0;\n this.lastTotal = 0;\n this.lastChar = Buffer.allocUnsafe(nb);\n}\n\nStringDecoder.prototype.write = function (buf) {\n if (buf.length === 0) return '';\n var r;\n var i;\n\n if (this.lastNeed) {\n r = this.fillLast(buf);\n if (r === undefined) return '';\n i = this.lastNeed;\n this.lastNeed = 0;\n } else {\n i = 0;\n }\n\n if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);\n return r || '';\n};\n\nStringDecoder.prototype.end = utf8End; // Returns only complete characters in a Buffer\n\nStringDecoder.prototype.text = utf8Text; // Attempts to complete a partial non-UTF-8 character using bytes from a Buffer\n\nStringDecoder.prototype.fillLast = function (buf) {\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);\n this.lastNeed -= buf.length;\n}; // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a\n// continuation byte. If an invalid byte is detected, -2 is returned.\n\n\nfunction utf8CheckByte(_byte) {\n if (_byte <= 0x7F) return 0;else if (_byte >> 5 === 0x06) return 2;else if (_byte >> 4 === 0x0E) return 3;else if (_byte >> 3 === 0x1E) return 4;\n return _byte >> 6 === 0x02 ? -1 : -2;\n} // Checks at most 3 bytes at the end of a Buffer in order to detect an\n// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)\n// needed to complete the UTF-8 character (if applicable) are returned.\n\n\nfunction utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n\n return nb;\n }\n\n return 0;\n} // Validates as many continuation bytes for a multi-byte UTF-8 character as\n// needed or are available. If we see a non-continuation byte where we expect\n// one, we \"replace\" the validated continuation bytes we've seen so far with\n// a single UTF-8 replacement character ('\\ufffd'), to match v8's UTF-8 decoding\n// behavior. The continuation byte check is included three times in the case\n// where all of the continuation bytes for a character exist in the same buffer.\n// It is also done this way as a slight performance increase instead of using a\n// loop.\n\n\nfunction utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return \"\\uFFFD\";\n }\n\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return \"\\uFFFD\";\n }\n\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return \"\\uFFFD\";\n }\n }\n }\n} // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.\n\n\nfunction utf8FillLast(buf) {\n var p = this.lastTotal - this.lastNeed;\n var r = utf8CheckExtraBytes(this, buf, p);\n if (r !== undefined) return r;\n\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, p, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n\n buf.copy(this.lastChar, p, 0, buf.length);\n this.lastNeed -= buf.length;\n} // Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a\n// partial character, the character's bytes are buffered until the required\n// number of bytes are available.\n\n\nfunction utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n} // For UTF-8, a replacement character is added when ending on a partial\n// character.\n\n\nfunction utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + \"\\uFFFD\";\n return r;\n} // UTF-16LE typically needs two bytes per character, but even if we have an even\n// number of bytes available, we need to check if we end on a leading/high\n// surrogate. In that case, we need to wait for the next two bytes in order to\n// decode the last character properly.\n\n\nfunction utf16Text(buf, i) {\n if ((buf.length - i) % 2 === 0) {\n var r = buf.toString('utf16le', i);\n\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n\n if (c >= 0xD800 && c <= 0xDBFF) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n return r.slice(0, -1);\n }\n }\n\n return r;\n }\n\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf[buf.length - 1];\n return buf.toString('utf16le', i, buf.length - 1);\n} // For UTF-16LE we do not explicitly append special replacement characters if we\n// end on a partial character, we simply let v8 handle that.\n\n\nfunction utf16End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n\n if (this.lastNeed) {\n var end = this.lastTotal - this.lastNeed;\n return r + this.lastChar.toString('utf16le', 0, end);\n }\n\n return r;\n}\n\nfunction base64Text(buf, i) {\n var n = (buf.length - i) % 3;\n if (n === 0) return buf.toString('base64', i);\n this.lastNeed = 3 - n;\n this.lastTotal = 3;\n\n if (n === 1) {\n this.lastChar[0] = buf[buf.length - 1];\n } else {\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n }\n\n return buf.toString('base64', i, buf.length - n);\n}\n\nfunction base64End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);\n return r;\n} // Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)\n\n\nfunction simpleWrite(buf) {\n return buf.toString(this.encoding);\n}\n\nfunction simpleEnd(buf) {\n return buf && buf.length ? this.write(buf) : '';\n}","var scope = typeof global !== \"undefined\" && global || typeof self !== \"undefined\" && self || window;\nvar apply = Function.prototype.apply; // DOM APIs, for completeness\n\nexports.setTimeout = function () {\n return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);\n};\n\nexports.setInterval = function () {\n return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);\n};\n\nexports.clearTimeout = exports.clearInterval = function (timeout) {\n if (timeout) {\n timeout.close();\n }\n};\n\nfunction Timeout(id, clearFn) {\n this._id = id;\n this._clearFn = clearFn;\n}\n\nTimeout.prototype.unref = Timeout.prototype.ref = function () {};\n\nTimeout.prototype.close = function () {\n this._clearFn.call(scope, this._id);\n}; // Does not start the time, just sets up the members needed.\n\n\nexports.enroll = function (item, msecs) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = msecs;\n};\n\nexports.unenroll = function (item) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = -1;\n};\n\nexports._unrefActive = exports.active = function (item) {\n clearTimeout(item._idleTimeoutId);\n var msecs = item._idleTimeout;\n\n if (msecs >= 0) {\n item._idleTimeoutId = setTimeout(function onTimeout() {\n if (item._onTimeout) item._onTimeout();\n }, msecs);\n }\n}; // setimmediate attaches itself to the global object\n\n\nrequire(\"setimmediate\"); // On some exotic environments, it's not clear which object `setimmediate` was\n// able to install onto. Search each possibility in the same order as the\n// `setimmediate` library.\n\n\nexports.setImmediate = typeof self !== \"undefined\" && self.setImmediate || typeof global !== \"undefined\" && global.setImmediate || this && this.setImmediate;\nexports.clearImmediate = typeof self !== \"undefined\" && self.clearImmediate || typeof global !== \"undefined\" && global.clearImmediate || this && this.clearImmediate;","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n'use strict';\n/**/\n\nvar pna = require('process-nextick-args');\n/**/\n\n\nmodule.exports = Writable;\n/* */\n\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n this.next = null;\n} // It seems a linked list but it is not\n// there will be only 2 of these for each stream\n\n\nfunction CorkedRequest(state) {\n var _this = this;\n\n this.next = null;\n this.entry = null;\n\n this.finish = function () {\n onCorkedFinish(_this, state);\n };\n}\n/* */\n\n/**/\n\n\nvar asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;\n/**/\n\n/**/\n\nvar Duplex;\n/**/\n\nWritable.WritableState = WritableState;\n/**/\n\nvar util = require('core-util-is');\n\nutil.inherits = require('inherits');\n/**/\n\n/**/\n\nvar internalUtil = {\n deprecate: require('util-deprecate')\n};\n/**/\n\n/**/\n\nvar Stream = require('./internal/streams/stream');\n/**/\n\n/**/\n\n\nvar Buffer = require('safe-buffer').Buffer;\n\nvar OurUint8Array = global.Uint8Array || function () {};\n\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\n\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n/**/\n\n\nvar destroyImpl = require('./internal/streams/destroy');\n\nutil.inherits(Writable, Stream);\n\nfunction nop() {}\n\nfunction WritableState(options, stream) {\n Duplex = Duplex || require('./_stream_duplex');\n options = options || {}; // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n\n var isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n\n var hwm = options.highWaterMark;\n var writableHwm = options.writableHighWaterMark;\n var defaultHwm = this.objectMode ? 16 : 16 * 1024;\n if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm; // cast to ints.\n\n this.highWaterMark = Math.floor(this.highWaterMark); // if _final has been called\n\n this.finalCalled = false; // drain event flag.\n\n this.needDrain = false; // at the start of calling end()\n\n this.ending = false; // when end() has been called, and returned\n\n this.ended = false; // when 'finish' is emitted\n\n this.finished = false; // has it been destroyed\n\n this.destroyed = false; // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode; // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n\n this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n\n this.length = 0; // a flag to see when we're in the middle of a write.\n\n this.writing = false; // when true all writes will be buffered until .uncork() call\n\n this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n\n this.sync = true; // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n\n this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb)\n\n this.onwrite = function (er) {\n onwrite(stream, er);\n }; // the callback that the user supplies to write(chunk,encoding,cb)\n\n\n this.writecb = null; // the amount that is being written when _write is called.\n\n this.writelen = 0;\n this.bufferedRequest = null;\n this.lastBufferedRequest = null; // number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted\n\n this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n\n this.prefinished = false; // True if the error was already emitted and should not be thrown again\n\n this.errorEmitted = false; // count buffered requests\n\n this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always\n // one allocated and free to use, and we maintain at most two\n\n this.corkedRequestsFree = new CorkedRequest(this);\n}\n\nWritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n\n while (current) {\n out.push(current);\n current = current.next;\n }\n\n return out;\n};\n\n(function () {\n try {\n Object.defineProperty(WritableState.prototype, 'buffer', {\n get: internalUtil.deprecate(function () {\n return this.getBuffer();\n }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')\n });\n } catch (_) {}\n})(); // Test _writableState for inheritance to account for Duplex streams,\n// whose prototype chain only points to Readable.\n\n\nvar realHasInstance;\n\nif (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function value(object) {\n if (realHasInstance.call(this, object)) return true;\n if (this !== Writable) return false;\n return object && object._writableState instanceof WritableState;\n }\n });\n} else {\n realHasInstance = function realHasInstance(object) {\n return object instanceof this;\n };\n}\n\nfunction Writable(options) {\n Duplex = Duplex || require('./_stream_duplex'); // Writable ctor is applied to Duplexes, too.\n // `realHasInstance` is necessary because using plain `instanceof`\n // would return false, as no `_writableState` property is attached.\n // Trying to use the custom `instanceof` for Writable here will also break the\n // Node.js LazyTransform implementation, which has a non-trivial getter for\n // `_writableState` that would lead to infinite recursion.\n\n if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {\n return new Writable(options);\n }\n\n this._writableState = new WritableState(options, this); // legacy.\n\n this.writable = true;\n\n if (options) {\n if (typeof options.write === 'function') this._write = options.write;\n if (typeof options.writev === 'function') this._writev = options.writev;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n if (typeof options[\"final\"] === 'function') this._final = options[\"final\"];\n }\n\n Stream.call(this);\n} // Otherwise people can pipe Writable streams, which is just wrong.\n\n\nWritable.prototype.pipe = function () {\n this.emit('error', new Error('Cannot pipe, not readable'));\n};\n\nfunction writeAfterEnd(stream, cb) {\n var er = new Error('write after end'); // TODO: defer error events consistently everywhere, not just the cb\n\n stream.emit('error', er);\n pna.nextTick(cb, er);\n} // Checks that a user-supplied chunk is valid, especially for the particular\n// mode the stream is in. Currently this means that `null` is never accepted\n// and undefined/non-string values are only allowed in object mode.\n\n\nfunction validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n\n if (er) {\n stream.emit('error', er);\n pna.nextTick(cb, er);\n valid = false;\n }\n\n return valid;\n}\n\nWritable.prototype.write = function (chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n\n var isBuf = !state.objectMode && _isUint8Array(chunk);\n\n if (isBuf && !Buffer.isBuffer(chunk)) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;\n if (typeof cb !== 'function') cb = nop;\n if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n return ret;\n};\n\nWritable.prototype.cork = function () {\n var state = this._writableState;\n state.corked++;\n};\n\nWritable.prototype.uncork = function () {\n var state = this._writableState;\n\n if (state.corked) {\n state.corked--;\n if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);\n }\n};\n\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n // node::ParseEncoding() requires lower case.\n if (typeof encoding === 'string') encoding = encoding.toLowerCase();\n if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n};\n\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding);\n }\n\n return chunk;\n}\n\nObject.defineProperty(Writable.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n}); // if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\n\nfunction writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = 'buffer';\n chunk = newChunk;\n }\n }\n\n var len = state.objectMode ? 1 : chunk.length;\n state.length += len;\n var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false.\n\n if (!ret) state.needDrain = true;\n\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk: chunk,\n encoding: encoding,\n isBuf: isBuf,\n callback: cb,\n next: null\n };\n\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n\n return ret;\n}\n\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n\n if (sync) {\n // defer the callback if we are being called synchronously\n // to avoid piling up things on the stack\n pna.nextTick(cb, er); // this can emit finish, and it will always happen\n // after error\n\n pna.nextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n stream.emit('error', er);\n } else {\n // the caller expect this to happen before if\n // it is async\n cb(er);\n stream._writableState.errorEmitted = true;\n stream.emit('error', er); // this can emit finish, but finish must\n // always follow error\n\n finishMaybe(stream, state);\n }\n}\n\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n onwriteStateUpdate(state);\n if (er) onwriteError(stream, state, sync, er, cb);else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(state);\n\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n\n if (sync) {\n /**/\n asyncWrite(afterWrite, stream, state, finished, cb);\n /**/\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished) onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n} // Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\n\n\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it\n\n\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n\n if (stream._writev && entry && entry.next) {\n // Fast case, write everything using _writev()\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n var count = 0;\n var allBuffers = true;\n\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf) allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n\n buffer.allBuffers = allBuffers;\n doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time\n // as the hot path ends with doWrite\n\n state.pendingcb++;\n state.lastBufferedRequest = null;\n\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n state.corkedRequestsFree = new CorkedRequest(state);\n }\n\n state.bufferedRequestCount = 0;\n } else {\n // Slow case, write chunks one-by-one\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n\n if (state.writing) {\n break;\n }\n }\n\n if (entry === null) state.lastBufferedRequest = null;\n }\n\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n}\n\nWritable.prototype._write = function (chunk, encoding, cb) {\n cb(new Error('_write() is not implemented'));\n};\n\nWritable.prototype._writev = null;\n\nWritable.prototype.end = function (chunk, encoding, cb) {\n var state = this._writableState;\n\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks\n\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n } // ignore unnecessary end() calls.\n\n\n if (!state.ending && !state.finished) endWritable(this, state, cb);\n};\n\nfunction needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n}\n\nfunction callFinal(stream, state) {\n stream._final(function (err) {\n state.pendingcb--;\n\n if (err) {\n stream.emit('error', err);\n }\n\n state.prefinished = true;\n stream.emit('prefinish');\n finishMaybe(stream, state);\n });\n}\n\nfunction prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === 'function') {\n state.pendingcb++;\n state.finalCalled = true;\n pna.nextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit('prefinish');\n }\n }\n}\n\nfunction finishMaybe(stream, state) {\n var need = needFinish(state);\n\n if (need) {\n prefinish(stream, state);\n\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit('finish');\n }\n }\n\n return need;\n}\n\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n\n if (cb) {\n if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);\n }\n\n state.ended = true;\n stream.writable = false;\n}\n\nfunction onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n }\n\n if (state.corkedRequestsFree) {\n state.corkedRequestsFree.next = corkReq;\n } else {\n state.corkedRequestsFree = corkReq;\n }\n}\n\nObject.defineProperty(Writable.prototype, 'destroyed', {\n get: function get() {\n if (this._writableState === undefined) {\n return false;\n }\n\n return this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._writableState) {\n return;\n } // backward compatibility, the user is explicitly\n // managing destroyed\n\n\n this._writableState.destroyed = value;\n }\n});\nWritable.prototype.destroy = destroyImpl.destroy;\nWritable.prototype._undestroy = destroyImpl.undestroy;\n\nWritable.prototype._destroy = function (err, cb) {\n this.end();\n cb(err);\n};","'use strict';\n/**/\n\nvar pna = require('process-nextick-args');\n/**/\n// undocumented cb() API, needed for core, not for public API\n\n\nfunction destroy(err, cb) {\n var _this = this;\n\n var readableDestroyed = this._readableState && this._readableState.destroyed;\n var writableDestroyed = this._writableState && this._writableState.destroyed;\n\n if (readableDestroyed || writableDestroyed) {\n if (cb) {\n cb(err);\n } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {\n pna.nextTick(emitErrorNT, this, err);\n }\n\n return this;\n } // we set destroyed to true before firing error callbacks in order\n // to make it re-entrance safe in case destroy() is called within callbacks\n\n\n if (this._readableState) {\n this._readableState.destroyed = true;\n } // if this is a duplex stream mark the writable part as destroyed as well\n\n\n if (this._writableState) {\n this._writableState.destroyed = true;\n }\n\n this._destroy(err || null, function (err) {\n if (!cb && err) {\n pna.nextTick(emitErrorNT, _this, err);\n\n if (_this._writableState) {\n _this._writableState.errorEmitted = true;\n }\n } else if (cb) {\n cb(err);\n }\n });\n\n return this;\n}\n\nfunction undestroy() {\n if (this._readableState) {\n this._readableState.destroyed = false;\n this._readableState.reading = false;\n this._readableState.ended = false;\n this._readableState.endEmitted = false;\n }\n\n if (this._writableState) {\n this._writableState.destroyed = false;\n this._writableState.ended = false;\n this._writableState.ending = false;\n this._writableState.finished = false;\n this._writableState.errorEmitted = false;\n }\n}\n\nfunction emitErrorNT(self, err) {\n self.emit('error', err);\n}\n\nmodule.exports = {\n destroy: destroy,\n undestroy: undestroy\n};","module.exports = require('events').EventEmitter;","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\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\nfunction EventEmitter() {\n this._events = this._events || {};\n this._maxListeners = this._maxListeners || undefined;\n}\n\nmodule.exports = EventEmitter; // Backwards-compat with node 0.10.x\n\nEventEmitter.EventEmitter = EventEmitter;\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._maxListeners = undefined; // By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\n\nEventEmitter.defaultMaxListeners = 10; // Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\n\nEventEmitter.prototype.setMaxListeners = function (n) {\n if (!isNumber(n) || n < 0 || isNaN(n)) throw TypeError('n must be a positive number');\n this._maxListeners = n;\n return this;\n};\n\nEventEmitter.prototype.emit = function (type) {\n var er, handler, len, args, i, listeners;\n if (!this._events) this._events = {}; // If there is no 'error' event listener then throw.\n\n if (type === 'error') {\n if (!this._events.error || isObject(this._events.error) && !this._events.error.length) {\n er = arguments[1];\n\n if (er instanceof Error) {\n throw er; // Unhandled 'error' event\n } else {\n // At least give some kind of context to the user\n var err = new Error('Uncaught, unspecified \"error\" event. (' + er + ')');\n err.context = er;\n throw err;\n }\n }\n }\n\n handler = this._events[type];\n if (isUndefined(handler)) return false;\n\n if (isFunction(handler)) {\n switch (arguments.length) {\n // fast cases\n case 1:\n handler.call(this);\n break;\n\n case 2:\n handler.call(this, arguments[1]);\n break;\n\n case 3:\n handler.call(this, arguments[1], arguments[2]);\n break;\n // slower\n\n default:\n args = Array.prototype.slice.call(arguments, 1);\n handler.apply(this, args);\n }\n } else if (isObject(handler)) {\n args = Array.prototype.slice.call(arguments, 1);\n listeners = handler.slice();\n len = listeners.length;\n\n for (i = 0; i < len; i++) {\n listeners[i].apply(this, args);\n }\n }\n\n return true;\n};\n\nEventEmitter.prototype.addListener = function (type, listener) {\n var m;\n if (!isFunction(listener)) throw TypeError('listener must be a function');\n if (!this._events) this._events = {}; // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n\n if (this._events.newListener) this.emit('newListener', type, isFunction(listener.listener) ? listener.listener : listener);\n if (!this._events[type]) // Optimize the case of one listener. Don't need the extra array object.\n this._events[type] = listener;else if (isObject(this._events[type])) // If we've already got an array, just append.\n this._events[type].push(listener);else // Adding the second element, need to change to array.\n this._events[type] = [this._events[type], listener]; // Check for listener leak\n\n if (isObject(this._events[type]) && !this._events[type].warned) {\n if (!isUndefined(this._maxListeners)) {\n m = this._maxListeners;\n } else {\n m = EventEmitter.defaultMaxListeners;\n }\n\n if (m && m > 0 && this._events[type].length > m) {\n this._events[type].warned = true;\n console.error('(node) warning: possible EventEmitter memory ' + 'leak detected. %d listeners added. ' + 'Use emitter.setMaxListeners() to increase limit.', this._events[type].length);\n\n if (typeof console.trace === 'function') {\n // not supported in IE 10\n console.trace();\n }\n }\n }\n\n return this;\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.once = function (type, listener) {\n if (!isFunction(listener)) throw TypeError('listener must be a function');\n var fired = false;\n\n function g() {\n this.removeListener(type, g);\n\n if (!fired) {\n fired = true;\n listener.apply(this, arguments);\n }\n }\n\n g.listener = listener;\n this.on(type, g);\n return this;\n}; // emits a 'removeListener' event iff the listener was removed\n\n\nEventEmitter.prototype.removeListener = function (type, listener) {\n var list, position, length, i;\n if (!isFunction(listener)) throw TypeError('listener must be a function');\n if (!this._events || !this._events[type]) return this;\n list = this._events[type];\n length = list.length;\n position = -1;\n\n if (list === listener || isFunction(list.listener) && list.listener === listener) {\n delete this._events[type];\n if (this._events.removeListener) this.emit('removeListener', type, listener);\n } else if (isObject(list)) {\n for (i = length; i-- > 0;) {\n if (list[i] === listener || list[i].listener && list[i].listener === listener) {\n position = i;\n break;\n }\n }\n\n if (position < 0) return this;\n\n if (list.length === 1) {\n list.length = 0;\n delete this._events[type];\n } else {\n list.splice(position, 1);\n }\n\n if (this._events.removeListener) this.emit('removeListener', type, listener);\n }\n\n return this;\n};\n\nEventEmitter.prototype.removeAllListeners = function (type) {\n var key, listeners;\n if (!this._events) return this; // not listening for removeListener, no need to emit\n\n if (!this._events.removeListener) {\n if (arguments.length === 0) this._events = {};else if (this._events[type]) delete this._events[type];\n return this;\n } // emit removeListener for all listeners on all events\n\n\n if (arguments.length === 0) {\n for (key in this._events) {\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n\n this.removeAllListeners('removeListener');\n this._events = {};\n return this;\n }\n\n listeners = this._events[type];\n\n if (isFunction(listeners)) {\n this.removeListener(type, listeners);\n } else if (listeners) {\n // LIFO order\n while (listeners.length) {\n this.removeListener(type, listeners[listeners.length - 1]);\n }\n }\n\n delete this._events[type];\n return this;\n};\n\nEventEmitter.prototype.listeners = function (type) {\n var ret;\n if (!this._events || !this._events[type]) ret = [];else if (isFunction(this._events[type])) ret = [this._events[type]];else ret = this._events[type].slice();\n return ret;\n};\n\nEventEmitter.prototype.listenerCount = function (type) {\n if (this._events) {\n var evlistener = this._events[type];\n if (isFunction(evlistener)) return 1;else if (evlistener) return evlistener.length;\n }\n\n return 0;\n};\n\nEventEmitter.listenerCount = function (emitter, type) {\n return emitter.listenerCount(type);\n};\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\n\nfunction isObject(arg) {\n return _typeof(arg) === 'object' && arg !== null;\n}\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n'use strict';\n/**/\n\nvar pna = require('process-nextick-args');\n/**/\n\n\nmodule.exports = Readable;\n/**/\n\nvar isArray = require('isarray');\n/**/\n\n/**/\n\n\nvar Duplex;\n/**/\n\nReadable.ReadableState = ReadableState;\n/**/\n\nvar EE = require('events').EventEmitter;\n\nvar EElistenerCount = function EElistenerCount(emitter, type) {\n return emitter.listeners(type).length;\n};\n/**/\n\n/**/\n\n\nvar Stream = require('./internal/streams/stream');\n/**/\n\n/**/\n\n\nvar Buffer = require('safe-buffer').Buffer;\n\nvar OurUint8Array = global.Uint8Array || function () {};\n\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\n\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n/**/\n\n/**/\n\n\nvar util = require('core-util-is');\n\nutil.inherits = require('inherits');\n/**/\n\n/**/\n\nvar debugUtil = require('util');\n\nvar debug = void 0;\n\nif (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog('stream');\n} else {\n debug = function debug() {};\n}\n/**/\n\n\nvar BufferList = require('./internal/streams/BufferList');\n\nvar destroyImpl = require('./internal/streams/destroy');\n\nvar StringDecoder;\nutil.inherits(Readable, Stream);\nvar kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];\n\nfunction prependListener(emitter, event, fn) {\n // Sadly this is not cacheable as some libraries bundle their own\n // event emitter implementation with them.\n if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // This is a hack to make sure that our error handler is attached before any\n // userland ones. NEVER DO THIS. This is here only because this code needs\n // to continue to work with older versions of Node.js that do not include\n // the prependListener() method. The goal is to eventually remove this hack.\n\n if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];\n}\n\nfunction ReadableState(options, stream) {\n Duplex = Duplex || require('./_stream_duplex');\n options = options || {}; // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n\n var isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n\n var hwm = options.highWaterMark;\n var readableHwm = options.readableHighWaterMark;\n var defaultHwm = this.objectMode ? 16 : 16 * 1024;\n if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm; // cast to ints.\n\n this.highWaterMark = Math.floor(this.highWaterMark); // A linked list is used to store data chunks instead of an array because the\n // linked list can remove elements from the beginning faster than\n // array.shift()\n\n this.buffer = new BufferList();\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted\n // immediately, or on a later tick. We set this to true at first, because\n // any actions that shouldn't happen until \"later\" should generally also\n // not happen before the first read call.\n\n this.sync = true; // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false; // has it been destroyed\n\n this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n\n this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s\n\n this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled\n\n this.readingMore = false;\n this.decoder = null;\n this.encoding = null;\n\n if (options.encoding) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\n\nfunction Readable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n if (!(this instanceof Readable)) return new Readable(options);\n this._readableState = new ReadableState(options, this); // legacy\n\n this.readable = true;\n\n if (options) {\n if (typeof options.read === 'function') this._read = options.read;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n }\n\n Stream.call(this);\n}\n\nObject.defineProperty(Readable.prototype, 'destroyed', {\n get: function get() {\n if (this._readableState === undefined) {\n return false;\n }\n\n return this._readableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._readableState) {\n return;\n } // backward compatibility, the user is explicitly\n // managing destroyed\n\n\n this._readableState.destroyed = value;\n }\n});\nReadable.prototype.destroy = destroyImpl.destroy;\nReadable.prototype._undestroy = destroyImpl.undestroy;\n\nReadable.prototype._destroy = function (err, cb) {\n this.push(null);\n cb(err);\n}; // Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\n\n\nReadable.prototype.push = function (chunk, encoding) {\n var state = this._readableState;\n var skipChunkCheck;\n\n if (!state.objectMode) {\n if (typeof chunk === 'string') {\n encoding = encoding || state.defaultEncoding;\n\n if (encoding !== state.encoding) {\n chunk = Buffer.from(chunk, encoding);\n encoding = '';\n }\n\n skipChunkCheck = true;\n }\n } else {\n skipChunkCheck = true;\n }\n\n return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);\n}; // Unshift should *always* be something directly out of read()\n\n\nReadable.prototype.unshift = function (chunk) {\n return readableAddChunk(this, chunk, null, true, false);\n};\n\nfunction readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {\n var state = stream._readableState;\n\n if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else {\n var er;\n if (!skipChunkCheck) er = chunkInvalid(state, chunk);\n\n if (er) {\n stream.emit('error', er);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (addToFront) {\n if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);\n } else if (state.ended) {\n stream.emit('error', new Error('stream.push() after EOF'));\n } else {\n state.reading = false;\n\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk);\n if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);\n } else {\n addChunk(stream, state, chunk, false);\n }\n }\n } else if (!addToFront) {\n state.reading = false;\n }\n }\n\n return needMoreData(state);\n}\n\nfunction addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync) {\n stream.emit('data', chunk);\n stream.read(0);\n } else {\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);\n if (state.needReadable) emitReadable(stream);\n }\n\n maybeReadMore(stream, state);\n}\n\nfunction chunkInvalid(state, chunk) {\n var er;\n\n if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n\n return er;\n} // if it's past the high water mark, we can push in some more.\n// Also, if we have no data yet, we can stand some\n// more bytes. This is to work around cases where hwm=0,\n// such as the repl. Also, if the push() triggered a\n// readable event, and the user called read(largeNumber) such that\n// needReadable was set, then we ought to push more, so that another\n// 'readable' event will be triggered.\n\n\nfunction needMoreData(state) {\n return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n}\n\nReadable.prototype.isPaused = function () {\n return this._readableState.flowing === false;\n}; // backwards compatibility.\n\n\nReadable.prototype.setEncoding = function (enc) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n this._readableState.decoder = new StringDecoder(enc);\n this._readableState.encoding = enc;\n return this;\n}; // Don't raise the hwm > 8MB\n\n\nvar MAX_HWM = 0x800000;\n\nfunction computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2 to prevent increasing hwm excessively in\n // tiny amounts\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n\n return n;\n} // This function is designed to be inlinable, so please take care when making\n// changes to the function body.\n\n\nfunction howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.\n\n\nReadable.prototype.read = function (n) {\n debug('read', n);\n n = parseInt(n, 10);\n var state = this._readableState;\n var nOrig = n;\n if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n\n if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {\n debug('read: emitReadable', state.length, state.ended);\n if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);\n return null;\n }\n\n n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up.\n\n if (n === 0 && state.ended) {\n if (state.length === 0) endReadable(this);\n return null;\n } // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n // if we need a readable event, then we need to do some reading.\n\n\n var doRead = state.needReadable;\n debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some\n\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug('length less than watermark', doRead);\n } // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n\n\n if (state.ended || state.reading) {\n doRead = false;\n debug('reading or ended', doRead);\n } else if (doRead) {\n debug('do read');\n state.reading = true;\n state.sync = true; // if the length is currently zero, then we *need* a readable event.\n\n if (state.length === 0) state.needReadable = true; // call internal read method\n\n this._read(state.highWaterMark);\n\n state.sync = false; // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n\n if (!state.reading) n = howMuchToRead(nOrig, state);\n }\n\n var ret;\n if (n > 0) ret = fromList(n, state);else ret = null;\n\n if (ret === null) {\n state.needReadable = true;\n n = 0;\n } else {\n state.length -= n;\n }\n\n if (state.length === 0) {\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick.\n\n if (nOrig !== n && state.ended) endReadable(this);\n }\n\n if (ret !== null) this.emit('data', ret);\n return ret;\n};\n\nfunction onEofChunk(stream, state) {\n if (state.ended) return;\n\n if (state.decoder) {\n var chunk = state.decoder.end();\n\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n\n state.ended = true; // emit 'readable' now to make sure it gets picked up.\n\n emitReadable(stream);\n} // Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\n\n\nfunction emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}\n\nfunction emitReadable_(stream) {\n debug('emit readable');\n stream.emit('readable');\n flow(stream);\n} // at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\n\n\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n pna.nextTick(maybeReadMore_, stream, state);\n }\n}\n\nfunction maybeReadMore_(stream, state) {\n var len = state.length;\n\n while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {\n debug('maybeReadMore read 0');\n stream.read(0);\n if (len === state.length) // didn't get any data, stop spinning.\n break;else len = state.length;\n }\n\n state.readingMore = false;\n} // abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\n\n\nReadable.prototype._read = function (n) {\n this.emit('error', new Error('_read() is not implemented'));\n};\n\nReadable.prototype.pipe = function (dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n\n default:\n state.pipes.push(dest);\n break;\n }\n\n state.pipesCount += 1;\n debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n var endFn = doEnd ? onend : unpipe;\n if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);\n dest.on('unpipe', onunpipe);\n\n function onunpipe(readable, unpipeInfo) {\n debug('onunpipe');\n\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n\n function onend() {\n debug('onend');\n dest.end();\n } // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n\n\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n var cleanedUp = false;\n\n function cleanup() {\n debug('cleanup'); // cleanup event handlers once the pipe is broken\n\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', unpipe);\n src.removeListener('data', ondata);\n cleanedUp = true; // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n\n if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();\n } // If the user pushes more data while we're writing to dest then we'll end up\n // in ondata again. However, we only want to increase awaitDrain once because\n // dest will only emit one 'drain' event for the multiple writes.\n // => Introduce a guard on increasing awaitDrain.\n\n\n var increasedAwaitDrain = false;\n src.on('data', ondata);\n\n function ondata(chunk) {\n debug('ondata');\n increasedAwaitDrain = false;\n var ret = dest.write(chunk);\n\n if (false === ret && !increasedAwaitDrain) {\n // If the user unpiped during `dest.write()`, it is possible\n // to get stuck in a permanently paused state if that write\n // also returned false.\n // => Check whether `dest` is still a piping destination.\n if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {\n debug('false write response, pause', src._readableState.awaitDrain);\n src._readableState.awaitDrain++;\n increasedAwaitDrain = true;\n }\n\n src.pause();\n }\n } // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n\n\n function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);\n } // Make sure our error handler is attached before userland ones.\n\n\n prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once.\n\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n\n dest.once('close', onclose);\n\n function onfinish() {\n debug('onfinish');\n dest.removeListener('close', onclose);\n unpipe();\n }\n\n dest.once('finish', onfinish);\n\n function unpipe() {\n debug('unpipe');\n src.unpipe(dest);\n } // tell the dest that it's being piped to\n\n\n dest.emit('pipe', src); // start the flow if it hasn't been started already.\n\n if (!state.flowing) {\n debug('pipe resume');\n src.resume();\n }\n\n return dest;\n};\n\nfunction pipeOnDrain(src) {\n return function () {\n var state = src._readableState;\n debug('pipeOnDrain', state.awaitDrain);\n if (state.awaitDrain) state.awaitDrain--;\n\n if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {\n state.flowing = true;\n flow(src);\n }\n };\n}\n\nReadable.prototype.unpipe = function (dest) {\n var state = this._readableState;\n var unpipeInfo = {\n hasUnpiped: false\n }; // if we're not piping anywhere, then do nothing.\n\n if (state.pipesCount === 0) return this; // just one destination. most common case.\n\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes) return this;\n if (!dest) dest = state.pipes; // got a match.\n\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest) dest.emit('unpipe', this, unpipeInfo);\n return this;\n } // slow case. multiple pipe destinations.\n\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n\n for (var i = 0; i < len; i++) {\n dests[i].emit('unpipe', this, unpipeInfo);\n }\n\n return this;\n } // try to find the right one.\n\n\n var index = indexOf(state.pipes, dest);\n if (index === -1) return this;\n state.pipes.splice(index, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1) state.pipes = state.pipes[0];\n dest.emit('unpipe', this, unpipeInfo);\n return this;\n}; // set up data events if they are asked for\n// Ensure readable listeners eventually get something\n\n\nReadable.prototype.on = function (ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n\n if (ev === 'data') {\n // Start flowing on next tick if stream isn't explicitly paused\n if (this._readableState.flowing !== false) this.resume();\n } else if (ev === 'readable') {\n var state = this._readableState;\n\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true;\n state.emittedReadable = false;\n\n if (!state.reading) {\n pna.nextTick(nReadingNextTick, this);\n } else if (state.length) {\n emitReadable(this);\n }\n }\n }\n\n return res;\n};\n\nReadable.prototype.addListener = Readable.prototype.on;\n\nfunction nReadingNextTick(self) {\n debug('readable nexttick read 0');\n self.read(0);\n} // pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\n\n\nReadable.prototype.resume = function () {\n var state = this._readableState;\n\n if (!state.flowing) {\n debug('resume');\n state.flowing = true;\n resume(this, state);\n }\n\n return this;\n};\n\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n pna.nextTick(resume_, stream, state);\n }\n}\n\nfunction resume_(stream, state) {\n if (!state.reading) {\n debug('resume read 0');\n stream.read(0);\n }\n\n state.resumeScheduled = false;\n state.awaitDrain = 0;\n stream.emit('resume');\n flow(stream);\n if (state.flowing && !state.reading) stream.read(0);\n}\n\nReadable.prototype.pause = function () {\n debug('call pause flowing=%j', this._readableState.flowing);\n\n if (false !== this._readableState.flowing) {\n debug('pause');\n this._readableState.flowing = false;\n this.emit('pause');\n }\n\n return this;\n};\n\nfunction flow(stream) {\n var state = stream._readableState;\n debug('flow', state.flowing);\n\n while (state.flowing && stream.read() !== null) {}\n} // wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\n\n\nReadable.prototype.wrap = function (stream) {\n var _this = this;\n\n var state = this._readableState;\n var paused = false;\n stream.on('end', function () {\n debug('wrapped end');\n\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) _this.push(chunk);\n }\n\n _this.push(null);\n });\n stream.on('data', function (chunk) {\n debug('wrapped data');\n if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode\n\n if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;\n\n var ret = _this.push(chunk);\n\n if (!ret) {\n paused = true;\n stream.pause();\n }\n }); // proxy all the other methods.\n // important when wrapping filters and duplexes.\n\n for (var i in stream) {\n if (this[i] === undefined && typeof stream[i] === 'function') {\n this[i] = function (method) {\n return function () {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n } // proxy certain important events.\n\n\n for (var n = 0; n < kProxyEvents.length; n++) {\n stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));\n } // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n\n\n this._read = function (n) {\n debug('wrapped _read', n);\n\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n\n return this;\n};\n\nObject.defineProperty(Readable.prototype, 'readableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.highWaterMark;\n }\n}); // exposed for testing purposes only.\n\nReadable._fromList = fromList; // Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\n\nfunction fromList(n, state) {\n // nothing buffered\n if (state.length === 0) return null;\n var ret;\n if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {\n // read it all, truncate the list\n if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else {\n // read part of list\n ret = fromListPartial(n, state.buffer, state.decoder);\n }\n return ret;\n} // Extracts only enough buffered data to satisfy the amount requested.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\n\n\nfunction fromListPartial(n, list, hasStrings) {\n var ret;\n\n if (n < list.head.data.length) {\n // slice is the same for buffers and strings\n ret = list.head.data.slice(0, n);\n list.head.data = list.head.data.slice(n);\n } else if (n === list.head.data.length) {\n // first chunk is a perfect match\n ret = list.shift();\n } else {\n // result spans more than one buffer\n ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);\n }\n\n return ret;\n} // Copies a specified amount of characters from the list of buffered data\n// chunks.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\n\n\nfunction copyFromBufferString(n, list) {\n var p = list.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n\n while (p = p.next) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length) ret += str;else ret += str.slice(0, n);\n n -= nb;\n\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = str.slice(nb);\n }\n\n break;\n }\n\n ++c;\n }\n\n list.length -= c;\n return ret;\n} // Copies a specified amount of bytes from the list of buffered data chunks.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\n\n\nfunction copyFromBuffer(n, list) {\n var ret = Buffer.allocUnsafe(n);\n var p = list.head;\n var c = 1;\n p.data.copy(ret);\n n -= p.data.length;\n\n while (p = p.next) {\n var buf = p.data;\n var nb = n > buf.length ? buf.length : n;\n buf.copy(ret, ret.length - n, 0, nb);\n n -= nb;\n\n if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n\n break;\n }\n\n ++c;\n }\n\n list.length -= c;\n return ret;\n}\n\nfunction endReadable(stream) {\n var state = stream._readableState; // If we get here before consuming all the bytes, then that is a\n // bug in node. Should never happen.\n\n if (state.length > 0) throw new Error('\"endReadable()\" called on non-empty stream');\n\n if (!state.endEmitted) {\n state.ended = true;\n pna.nextTick(endReadableNT, state, stream);\n }\n}\n\nfunction endReadableNT(state, stream) {\n // Check that we didn't get one last unshift.\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n }\n}\n\nfunction indexOf(xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n\n return -1;\n}","exports = module.exports = require('./lib/_stream_readable.js');\nexports.Stream = exports;\nexports.Readable = exports;\nexports.Writable = require('./lib/_stream_writable.js');\nexports.Duplex = require('./lib/_stream_duplex.js');\nexports.Transform = require('./lib/_stream_transform.js');\nexports.PassThrough = require('./lib/_stream_passthrough.js');","var capability = require('./capability');\n\nvar inherits = require('inherits');\n\nvar stream = require('readable-stream');\n\nvar rStates = exports.readyStates = {\n UNSENT: 0,\n OPENED: 1,\n HEADERS_RECEIVED: 2,\n LOADING: 3,\n DONE: 4\n};\n\nvar IncomingMessage = exports.IncomingMessage = function (xhr, response, mode, fetchTimer) {\n var self = this;\n stream.Readable.call(self);\n self._mode = mode;\n self.headers = {};\n self.rawHeaders = [];\n self.trailers = {};\n self.rawTrailers = []; // Fake the 'close' event, but only once 'end' fires\n\n self.on('end', function () {\n // The nextTick is necessary to prevent the 'request' module from causing an infinite loop\n process.nextTick(function () {\n self.emit('close');\n });\n });\n\n if (mode === 'fetch') {\n var read = function read() {\n reader.read().then(function (result) {\n if (self._destroyed) return;\n\n if (result.done) {\n global.clearTimeout(fetchTimer);\n self.push(null);\n return;\n }\n\n self.push(new Buffer(result.value));\n read();\n })[\"catch\"](function (err) {\n global.clearTimeout(fetchTimer);\n if (!self._destroyed) self.emit('error', err);\n });\n };\n\n self._fetchResponse = response;\n self.url = response.url;\n self.statusCode = response.status;\n self.statusMessage = response.statusText;\n response.headers.forEach(function (header, key) {\n self.headers[key.toLowerCase()] = header;\n self.rawHeaders.push(key, header);\n });\n\n if (capability.writableStream) {\n var writable = new WritableStream({\n write: function write(chunk) {\n return new Promise(function (resolve, reject) {\n if (self._destroyed) {\n reject();\n } else if (self.push(new Buffer(chunk))) {\n resolve();\n } else {\n self._resumeFetch = resolve;\n }\n });\n },\n close: function close() {\n global.clearTimeout(fetchTimer);\n if (!self._destroyed) self.push(null);\n },\n abort: function abort(err) {\n if (!self._destroyed) self.emit('error', err);\n }\n });\n\n try {\n response.body.pipeTo(writable)[\"catch\"](function (err) {\n global.clearTimeout(fetchTimer);\n if (!self._destroyed) self.emit('error', err);\n });\n return;\n } catch (e) {} // pipeTo method isn't defined. Can't find a better way to feature test this\n\n } // fallback for when writableStream or pipeTo aren't available\n\n\n var reader = response.body.getReader();\n read();\n } else {\n self._xhr = xhr;\n self._pos = 0;\n self.url = xhr.responseURL;\n self.statusCode = xhr.status;\n self.statusMessage = xhr.statusText;\n var headers = xhr.getAllResponseHeaders().split(/\\r?\\n/);\n headers.forEach(function (header) {\n var matches = header.match(/^([^:]+):\\s*(.*)/);\n\n if (matches) {\n var key = matches[1].toLowerCase();\n\n if (key === 'set-cookie') {\n if (self.headers[key] === undefined) {\n self.headers[key] = [];\n }\n\n self.headers[key].push(matches[2]);\n } else if (self.headers[key] !== undefined) {\n self.headers[key] += ', ' + matches[2];\n } else {\n self.headers[key] = matches[2];\n }\n\n self.rawHeaders.push(matches[1], matches[2]);\n }\n });\n self._charset = 'x-user-defined';\n\n if (!capability.overrideMimeType) {\n var mimeType = self.rawHeaders['mime-type'];\n\n if (mimeType) {\n var charsetMatch = mimeType.match(/;\\s*charset=([^;])(;|$)/);\n\n if (charsetMatch) {\n self._charset = charsetMatch[1].toLowerCase();\n }\n }\n\n if (!self._charset) self._charset = 'utf-8'; // best guess\n }\n }\n};\n\ninherits(IncomingMessage, stream.Readable);\n\nIncomingMessage.prototype._read = function () {\n var self = this;\n var resolve = self._resumeFetch;\n\n if (resolve) {\n self._resumeFetch = null;\n resolve();\n }\n};\n\nIncomingMessage.prototype._onXHRProgress = function () {\n var self = this;\n var xhr = self._xhr;\n var response = null;\n\n switch (self._mode) {\n case 'text:vbarray':\n // For IE9\n if (xhr.readyState !== rStates.DONE) break;\n\n try {\n // This fails in IE8\n response = new global.VBArray(xhr.responseBody).toArray();\n } catch (e) {}\n\n if (response !== null) {\n self.push(new Buffer(response));\n break;\n }\n\n // Falls through in IE8\t\n\n case 'text':\n try {\n // This will fail when readyState = 3 in IE9. Switch mode and wait for readyState = 4\n response = xhr.responseText;\n } catch (e) {\n self._mode = 'text:vbarray';\n break;\n }\n\n if (response.length > self._pos) {\n var newData = response.substr(self._pos);\n\n if (self._charset === 'x-user-defined') {\n var buffer = new Buffer(newData.length);\n\n for (var i = 0; i < newData.length; i++) {\n buffer[i] = newData.charCodeAt(i) & 0xff;\n }\n\n self.push(buffer);\n } else {\n self.push(newData, self._charset);\n }\n\n self._pos = response.length;\n }\n\n break;\n\n case 'arraybuffer':\n if (xhr.readyState !== rStates.DONE || !xhr.response) break;\n response = xhr.response;\n self.push(new Buffer(new Uint8Array(response)));\n break;\n\n case 'moz-chunked-arraybuffer':\n // take whole\n response = xhr.response;\n if (xhr.readyState !== rStates.LOADING || !response) break;\n self.push(new Buffer(new Uint8Array(response)));\n break;\n\n case 'ms-stream':\n response = xhr.response;\n if (xhr.readyState !== rStates.LOADING) break;\n var reader = new global.MSStreamReader();\n\n reader.onprogress = function () {\n if (reader.result.byteLength > self._pos) {\n self.push(new Buffer(new Uint8Array(reader.result.slice(self._pos))));\n self._pos = reader.result.byteLength;\n }\n };\n\n reader.onload = function () {\n self.push(null);\n }; // reader.onerror = ??? // TODO: this\n\n\n reader.readAsArrayBuffer(response);\n break;\n } // The ms-stream case handles end separately in reader.onload()\n\n\n if (self._xhr.readyState === rStates.DONE && self._mode !== 'ms-stream') {\n self.push(null);\n }\n};","exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableStream);\nexports.writableStream = isFunction(global.WritableStream);\nexports.abortController = isFunction(global.AbortController);\nexports.blobConstructor = false;\n\ntry {\n new Blob([new ArrayBuffer(1)]);\n exports.blobConstructor = true;\n} catch (e) {} // The xhr request to example.com may violate some restrictive CSP configurations,\n// so if we're running in a browser that supports `fetch`, avoid calling getXHR()\n// and assume support for certain features below.\n\n\nvar xhr;\n\nfunction getXHR() {\n // Cache the xhr value\n if (xhr !== undefined) return xhr;\n\n if (global.XMLHttpRequest) {\n xhr = new global.XMLHttpRequest(); // If XDomainRequest is available (ie only, where xhr might not work\n // cross domain), use the page location. Otherwise use example.com\n // Note: this doesn't actually make an http request.\n\n try {\n xhr.open('GET', global.XDomainRequest ? '/' : 'https://example.com');\n } catch (e) {\n xhr = null;\n }\n } else {\n // Service workers don't have XHR\n xhr = null;\n }\n\n return xhr;\n}\n\nfunction checkTypeSupport(type) {\n var xhr = getXHR();\n if (!xhr) return false;\n\n try {\n xhr.responseType = type;\n return xhr.responseType === type;\n } catch (e) {}\n\n return false;\n} // For some strange reason, Safari 7.0 reports typeof global.ArrayBuffer === 'object'.\n// Safari 7.1 appears to have fixed this bug.\n\n\nvar haveArrayBuffer = typeof global.ArrayBuffer !== 'undefined';\nvar haveSlice = haveArrayBuffer && isFunction(global.ArrayBuffer.prototype.slice); // If fetch is supported, then arraybuffer will be supported too. Skip calling\n// checkTypeSupport(), since that calls getXHR().\n\nexports.arraybuffer = exports.fetch || haveArrayBuffer && checkTypeSupport('arraybuffer'); // These next two tests unavoidably show warnings in Chrome. Since fetch will always\n// be used if it's available, just return false for these to avoid the warnings.\n\nexports.msstream = !exports.fetch && haveSlice && checkTypeSupport('ms-stream');\nexports.mozchunkedarraybuffer = !exports.fetch && haveArrayBuffer && checkTypeSupport('moz-chunked-arraybuffer'); // If fetch is supported, then overrideMimeType will be supported too. Skip calling\n// getXHR().\n\nexports.overrideMimeType = exports.fetch || (getXHR() ? isFunction(getXHR().overrideMimeType) : false);\nexports.vbArray = isFunction(global.VBArray);\n\nfunction isFunction(value) {\n return typeof value === 'function';\n}\n\nxhr = null; // Help gc","var ClientRequest = require('./lib/request');\n\nvar response = require('./lib/response');\n\nvar extend = require('xtend');\n\nvar statusCodes = require('builtin-status-codes');\n\nvar url = require('url');\n\nvar http = exports;\n\nhttp.request = function (opts, cb) {\n if (typeof opts === 'string') opts = url.parse(opts);else opts = extend(opts); // Normally, the page is loaded from http or https, so not specifying a protocol\n // will result in a (valid) protocol-relative url. However, this won't work if\n // the protocol is something else, like 'file:'\n\n var defaultProtocol = global.location.protocol.search(/^https?:$/) === -1 ? 'http:' : '';\n var protocol = opts.protocol || defaultProtocol;\n var host = opts.hostname || opts.host;\n var port = opts.port;\n var path = opts.path || '/'; // Necessary for IPv6 addresses\n\n if (host && host.indexOf(':') !== -1) host = '[' + host + ']'; // This may be a relative url. The browser should always be able to interpret it correctly.\n\n opts.url = (host ? protocol + '//' + host : '') + (port ? ':' + port : '') + path;\n opts.method = (opts.method || 'GET').toUpperCase();\n opts.headers = opts.headers || {}; // Also valid opts.auth, opts.mode\n\n var req = new ClientRequest(opts);\n if (cb) req.on('response', cb);\n return req;\n};\n\nhttp.get = function get(opts, cb) {\n var req = http.request(opts, cb);\n req.end();\n return req;\n};\n\nhttp.ClientRequest = ClientRequest;\nhttp.IncomingMessage = response.IncomingMessage;\n\nhttp.Agent = function () {};\n\nhttp.Agent.defaultMaxSockets = 4;\nhttp.globalAgent = new http.Agent();\nhttp.STATUS_CODES = statusCodes;\nhttp.METHODS = ['CHECKOUT', 'CONNECT', 'COPY', 'DELETE', 'GET', 'HEAD', 'LOCK', 'M-SEARCH', 'MERGE', 'MKACTIVITY', 'MKCOL', 'MOVE', 'NOTIFY', 'OPTIONS', 'PATCH', 'POST', 'PROPFIND', 'PROPPATCH', 'PURGE', 'PUT', 'REPORT', 'SEARCH', 'SUBSCRIBE', 'TRACE', 'UNLOCK', 'UNSUBSCRIBE'];","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};","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 setTaskBarAttr: function setTaskBarAttr(task, div) {\n this._taskCommonAttr(task, div); // task bars are complex elements that should be treated as a single element\n\n\n div.setAttribute(\"role\", \"img\");\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\"); // selected attribute should be added only to the grid because\n // other parts don't have the keyboard navigation\n\n div.setAttribute(\"aria-selected\", gantt.isSelectedTask(task.id) ? \"true\" : \"false\"); // allowed values start from 1, set 1 for non-tree datastores\n\n div.setAttribute(\"aria-level\", task.$level + 1 || 1);\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); // links are complex elements that should be treated as a single element\n\n div.setAttribute(\"role\", \"img\");\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 // the only valid role for the grid header\n div.setAttribute(\"role\", \"columnheader\");\n },\n rowResizerAttr: function rowResizerAttr(div) {\n // the only valid role for the grid header\n div.setAttribute(\"role\", \"row\");\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 div.firstChild.setAttribute(\"aria-level\", \"1\");\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 \"role\": \"spinbutton\"\n });\n },\n inlineEditorAttr: function inlineEditorAttr(div) {\n div.setAttribute(\"role\", \"row\");\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 // a more precise role is button, but it is not valid for the grid header\n attrs = this.getAttributeString({\n \"role\": \"columnheader\",\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 reorderMarkerAttr: function reorderMarkerAttr(div) {\n div.setAttribute(\"role\", \"grid\");\n div.firstChild.removeAttribute(\"aria-level\");\n div.firstChild.setAttribute(\"aria-grabbed\", \"true\");\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' aria-level='1' \";\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 sectionClassName = \"gantt_section_time\";\n\n if (sns.name !== \"time\") {\n sectionClassName += \" gantt_section_\" + sns.name;\n }\n\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 sectionClassName = \"gantt_section_time\";\n\n if (sns.name !== \"time\") {\n sectionClassName += \" gantt_section_\" + sns.name;\n }\n\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.ontouchstart = function (e) {\n gantt._ready_to_dnd(e.touches[0]);\n };\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 var rootElement = gantt._lightbox_root || gantt.$root;\n rootElement.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 this.refreshData();\n }\n\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; // GS-2170. Do not recalculate the indexes and dates of other tasks\n // as they will be recalculated in the `refreshData`\n\n gantt.$data.tasksStore._skipTaskRecalculation = \"lightbox\";\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 gantt.$data.tasksStore._skipTaskRecalculation = false;\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);\n this.event(eventElement, \"touchmove\", function (e) {\n gantt._move_while_dnd(e.touches[0]);\n });\n this.event(eventElement, \"touchend\", function (e) {\n gantt._finish_dnd(e.touches[0]);\n }); // 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\", addTouchEvents);\n gantt.attachEvent(\"onGanttLayoutReady\", function () {\n if (gantt.$container) {\n gantt.attachEvent(\"onGanttRender\", addTouchEvents, {\n once: true\n });\n }\n });\n\n function addTouchEvents() {\n if (gantt.config.touch != \"force\") gantt.config.touch = gantt.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 (gantt.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 gantt._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 gantt._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 gantt._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 }\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 var multiTouchEvents = {};\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 }]); // prevent page drag on touch move\n\n try {\n document.addEventListener('touchmove', function (e) {\n if (gantt._touch_drag) {\n block_action(e);\n }\n }, {\n passive: false\n });\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn(\"Cannot prevent touch event for the page drag\");\n } //block touch context menu in IE10\n\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 multiTouchEvents = e.touches.length; // block pull-to-refresh\n\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 // we need that as touch events break if the target node is removed from the DOM\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(); // doubletap shouldn't happen with multitouch\n\n if (now - dblclicktime < 500 && multiTouchEvents <= 1) {\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 && e.cancelable) {\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) {\n var visible = gantt.isTaskVisible(taskId);\n\n if (visible) {\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 } else if (task.$split_subtask) {\n var renderedParent = task.$rendered_parent;\n visible = gantt.isTaskVisible(renderedParent);\n\n if (!visible) {\n return;\n }\n\n currentDndId = taskId;\n\n for (var _i2 = 0; _i2 < renders.length; _i2++) {\n var parent = renders[_i2].rendered[renderedParent];\n var taskNode = void 0;\n\n if (parent && parent.childNodes) {\n taskNode = parent.querySelector(\"[\".concat(gantt.config.task_attribute, \"=\\\"\").concat(task.id, \"\\\"]\"));\n }\n\n if (taskNode) {\n // move the child node to a different parent as the task bar will be repainted\n // and the initial node will be lost\n var _copy = taskNode.cloneNode(true);\n\n taskNode.parentNode.appendChild(_copy);\n gantt.$task_bars.appendChild(taskNode);\n taskNode.style.display = \"none\"; // don't add the node as rendered otherwise it will be lost:\n // renders[i].rendered[taskId] = taskNode;\n // instead, add it to dndNodes as its elements will be removed after drag\n\n dndNodes.push(taskNode);\n taskNode = null;\n }\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 // GS-1057: Don't call drag events for the dragged task as they will be called later\n if (dragMultiple[i].id != drag.id) {\n this._finalize_mouse_up(dragMultiple[i].id, config, dragMultiple[i], e);\n }\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\n gantt._waiAria.reorderMarkerAttr(dnd.config.marker);\n\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 gantt._waiAria.reorderMarkerAttr(dd.marker);\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.rowResizerAttr(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/factory/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 var renderedNodes = {};\n\n function checkVisibility(child, viewPort, timeline, config, gantt) {\n var isVisible = true; // GS-2123. Don't render rollup tasks that are outside the viewport\n\n if (config.smart_rendering) {\n isVisible = isInViewPort(child, viewPort, timeline, config, gantt);\n }\n\n return isVisible;\n }\n\n function generateChildElement(task, child, timeline, sizes) {\n var childCopy = gantt.copy(gantt.getTask(child.id));\n childCopy.$rendered_at = task.id; // a way to filter rollup tasks:\n\n var displayRollup = gantt.callEvent(\"onBeforeRollupTaskDisplay\", [childCopy.id, childCopy, task.id]);\n\n if (displayRollup === false) {\n return;\n }\n\n var element = defaultRender(childCopy, timeline);\n\n if (!element) {\n return;\n }\n\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 return element;\n }\n\n function getKey(childId, renderParentId) {\n return childId + \"_\" + renderParentId;\n }\n\n function renderRollupTask(task, timeline, config, viewPort) {\n if (task.rollup !== false && task.$rollup && task.$rollup.length) {\n var el = document.createElement('div'),\n sizes = gantt.getTaskPosition(task); // vertical position is not important for the rollup tasks as long as the parent is rendered\n\n if (viewPort) {\n viewPort.y = 0;\n viewPort.y_end = gantt.$task_bg.scrollHeight;\n }\n\n task.$rollup.forEach(function (itemId) {\n if (!gantt.isTaskExists(itemId)) {\n return;\n }\n\n var child = gantt.getTask(itemId);\n var isVisible = checkVisibility(child, viewPort, timeline, config, gantt);\n\n if (!isVisible) {\n return;\n }\n\n var element = generateChildElement(task, child, timeline, sizes);\n\n if (element) {\n renderedNodes[getKey(child.id, task.id)] = element;\n el.appendChild(element);\n } else {\n renderedNodes[getKey(child.id, task.id)] = false;\n }\n });\n return el;\n }\n\n return false;\n }\n\n function repaintRollupTask(task, itemNode, timeline, config, viewPort) {\n var el = document.createElement(\"div\"),\n sizes = gantt.getTaskPosition(task); // vertical position is not important for the rollup tasks as long as the parent is rendered\n\n viewPort.y = 0;\n viewPort.y_end = gantt.$task_bg.scrollHeight;\n task.$rollup.forEach(function (itemId) {\n var child = gantt.getTask(itemId);\n var rollupKey = getKey(child.id, task.id);\n var isVisible = checkVisibility(child, viewPort, timeline, config, gantt);\n\n if (isVisible !== !!renderedNodes[rollupKey]) {\n if (isVisible) {\n var element = generateChildElement(task, child, timeline, sizes);\n renderedNodes[rollupKey] = element || false;\n } else {\n renderedNodes[rollupKey] = false;\n }\n }\n\n if (!!renderedNodes[rollupKey]) {\n el.appendChild(renderedNodes[rollupKey]);\n }\n\n itemNode.innerHTML = \"\";\n itemNode.appendChild(el);\n });\n }\n\n return {\n render: renderRollupTask,\n update: repaintRollupTask,\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 if (child.hide_bar) {\n return;\n }\n\n var isProject = gantt.isSummaryTask(child);\n\n if (isProject) {\n gantt.resetProjectDates(child);\n }\n\n var childCopy = gantt.copy(gantt.getTask(child.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 = defaultRender(childCopy, 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 getKey(childId, renderParentId) {\n return childId + \"_\" + renderParentId;\n }\n\n function shouldUseSplitRendering(task, config) {\n return gantt.isSplitTask(task) && (config.open_split_tasks && !task.$open || !config.open_split_tasks) && gantt.hasChild(task.id);\n }\n\n function renderSplitTask(task, timeline, config, viewPort) {\n if (shouldUseSplitRendering(task, config)) {\n var el = document.createElement('div'),\n sizes = gantt.getTaskPosition(task);\n\n if (gantt.hasChild(task.id)) {\n gantt.eachTask(function (child) {\n var isVisible = checkVisibility(child, viewPort, timeline, config, gantt);\n\n if (!isVisible) {\n return;\n }\n\n var element = generateChildElement(task, child, timeline, sizes);\n\n if (element) {\n renderedNodes[getKey(child.id, task.id)] = element;\n el.appendChild(element);\n } else {\n renderedNodes[getKey(child.id, task.id)] = false;\n }\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 (shouldUseSplitRendering(task, config)) {\n var el = document.createElement(\"div\"),\n sizes = gantt.getTaskPosition(task);\n gantt.eachTask(function (child) {\n var splitKey = getKey(child.id, task.id);\n var isVisible = checkVisibility(child, viewPort, timeline, config, gantt);\n\n if (isVisible !== !!renderedNodes[splitKey]) {\n if (isVisible) {\n var element = generateChildElement(task, child, timeline, sizes);\n renderedNodes[splitKey] = element || false;\n } else {\n renderedNodes[splitKey] = false;\n }\n }\n\n if (!!renderedNodes[splitKey]) {\n el.appendChild(renderedNodes[splitKey]);\n }\n\n itemNode.innerHTML = \"\";\n itemNode.appendChild(el);\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 gantt._waiAria.inlineEditorAttr(el);\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 getVisibleLinksRangeFactory = require(\"./render/viewport/factory/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 var rangeFunction = getVisibleTaskRange;\n\n if (typeof config === \"function\") {\n config = {\n renderer: {\n render: config,\n getVisibleRange: rangeFunction\n }\n };\n } else {\n if (config.renderer && !config.renderer.getVisibleRange) {\n config.renderer.getVisibleRange = rangeFunction;\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 var rangeFunction = getVisibleLinksRangeFactory();\n\n if (typeof config === \"function\") {\n config = {\n renderer: {\n render: config,\n getVisibleRange: rangeFunction\n }\n };\n } else {\n if (config.renderer && !config.renderer.getVisibleRange) {\n config.renderer.getVisibleRange = rangeFunction;\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 var previousSize = getContainerSize(gantt);\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 // GS-2140. Don't repaint Gantt if it has the same sizes\n var currentSize = getContainerSize(gantt);\n\n if (previousSize.x == currentSize.x && previousSize.y == currentSize.y) {\n return;\n }\n\n previousSize = currentSize;\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\nfunction getContainerSize(gantt) {\n return {\n x: gantt.$root.offsetWidth,\n y: gantt.$root.offsetHeight\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\n if (gantt.$data.tasksStore._skipTaskRecalculation) {\n // do not repaint items, they will be repainted later in the onStoreUpdate event\n if (gantt.$data.tasksStore._skipTaskRecalculation != \"lightbox\") {\n gantt.$data.tasksStore._skipTaskRecalculation = false;\n }\n } else {\n gantt.getDatastore(storeNames[i]).callEvent(\"onBeforeRefreshAll\", []);\n }\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 // GS-2170. Do not recalculate the indexes and dates of other tasks\n // as they will be recalculated in the `refreshData`\n gantt.$data.tasksStore._skipTaskRecalculation = \"lightbox\";\n gantt.silent(function () {\n gantt.deleteTask(id, true);\n });\n gantt.$data.tasksStore._skipTaskRecalculation = false;\n gantt.refreshData();\n } else {\n gantt.$data.tasksStore._skipTaskRecalculation = true;\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 var minDate = gantt.config.start_date || gantt.getState().min_date;\n\n if (first) {\n if (first.start_date) {\n startDate = first.start_date;\n } else if (first.end_date) {\n startDate = gantt.calculateEndDate({\n start_date: first.end_date,\n duration: -gantt.config.duration_step,\n task: item\n });\n } else {\n startDate = minDate;\n }\n } else {\n startDate = minDate;\n }\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 } // TODO: verify testcase https://dhtmlxsupport.teamwork.com/desk/tickets/9625700/messages\n\n /*if (rangeMinutes === 0) {\r\n \trangeMinutes = left;\r\n \tminuteTo = minuteFrom + (left * 60);\r\n }*/\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 } // TODO: verify testcase https://dhtmlxsupport.teamwork.com/desk/tickets/9625700/messages\n\n /*if (rangeMinutes === 0) {\r\n \trangeMinutes = left;\r\n \tminuteTo = minuteFrom - (left * 60);\r\n }*/\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 minutePrecision = this._isMinutePrecision(start);\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 var prevInterval = 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 prevInterval = daySchedule[i - 1];\n break;\n }\n }\n\n if (isWorkHour) {\n // we're at the end of worktime interval and subtracting more than the duration of the interval\n // -> subtract the duration of the interval and move to the start of the interval (we're moving from end)\n if (timestamp === workInterval.end && left >= workInterval.durationMinutes) {\n added += workInterval.durationMinutes;\n start = this.$gantt.date.add(start, -workInterval.durationMinutes, \"minute\");\n } // worktime is set in whole hours (no intervals like 9:15-10:00)\n // the amount we need to subtract lies inside the interval\n else if (!minutePrecision && left <= timestamp / 60 - workInterval.startMinute) {\n added += left;\n start = this.$gantt.date.add(start, -left, \"minute\");\n } else if (minutePrecision) {\n // GS-2129. If the working time is set in minutes, we accumulate the working time in minutes from right to left\n // duration we need to subtract lies completely inside the work interval\n if (left <= timestamp / 60 - workInterval.startMinute) {\n added += left;\n start = this.$gantt.date.add(start, -left, \"minute\");\n } else {\n // we need to go trough multiple work intervals to subtract needed time\n added += timestamp / 60 - workInterval.startMinute;\n\n if (prevInterval) {\n start = new Date(start.getFullYear(), start.getMonth(), start.getDate(), 0, 0, prevInterval.end);\n } else {\n start = this.$gantt.date.day_start(start);\n }\n }\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\n var minutePrecision = this._isMinutePrecision(start);\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;\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; // when the working time settings are set in minutes move to the next minutes\n\n if (minutePrecision) {\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 _isMinutePrecision: function _isMinutePrecision(date) {\n var minutePrecision = false;\n\n this._getWorkHours(date).forEach(function (interval) {\n if (interval.startMinute % 60 || interval.endMinute % 60) {\n minutePrecision = true;\n }\n });\n\n return minutePrecision;\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) - obj.scrollTop;\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 var undoBatchCancel = false;\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 if (!item.unscheduled) {\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 }); // GS-2144. When we Undo something, the cache should be reset\n // during the `onStoreUpdated` event to properly update the assignments\n\n gantt.attachEvent(\"onBeforeUndo\", function (action) {\n undoBatchCancel = true;\n return true;\n });\n gantt.attachEvent(\"onAfterUndo\", function (action) {\n undoBatchCancel = true;\n });\n var resourceAssignmentsCache = null;\n var resourceTaskAssignmentsCache = null;\n var taskAssignmentsCache = null;\n resourceAssignmentsStore.attachEvent(\"onStoreUpdated\", function resetCache() {\n if (batchUpdate && !undoBatchCancel) {\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); // GS-2141. Track the changes by the Undo extension\n\n if (gantt.plugins().undo) {\n gantt.ext.undo.saveState(taskId, \"task\");\n }\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.handleResourceCRUD(dp, gantt);\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(); // Don't repaint the resource panel as the data didn't change\n\n store._skipResourceRepaint = true;\n store.select(id);\n store._skipResourceRepaint = false; // 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 // GS-2170 do not recalculate indexes and dates as the event will be called later in the onStoreUpdate event\n if (tasksStore._skipTaskRecalculation) {\n return;\n }\n\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 // GS-2170. Do not recalculate the indexes and dates of other tasks in the\n // onBeforeResize layout event, but do it later. If lightbox is opened, it will\n // trigger the refreshData, so the indexes and dates will be recalculated there\n if (this.$config.name == \"task\" && (action == \"add\" || action == \"delete\")) {\n if (this._skipTaskRecalculation != \"lightbox\") {\n this._skipTaskRecalculation = true;\n }\n }\n\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 _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\n/* @preserve\n * The MIT License (MIT)\n * \n * Copyright (c) 2013-2018 Petka Antonov\n * \n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n * \n */\n\n/**\n * bluebird build version 3.5.4\n * Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each\n*/\n!function (e) {\n if (\"object\" == (typeof exports === \"undefined\" ? \"undefined\" : _typeof(exports)) && \"undefined\" != typeof module) module.exports = e();else if (\"function\" == typeof define && define.amd) define([], e);else {\n var f;\n \"undefined\" != typeof window ? f = window : \"undefined\" != typeof global ? f = global : \"undefined\" != typeof self && (f = self), f.Promise = e();\n }\n}(function () {\n var define, module, exports;\n return function e(t, n, r) {\n function s(o, u) {\n if (!n[o]) {\n if (!t[o]) {\n var a = typeof _dereq_ == \"function\" && _dereq_;\n if (!u && a) return a(o, !0);\n if (i) return i(o, !0);\n var f = new Error(\"Cannot find module '\" + o + \"'\");\n throw f.code = \"MODULE_NOT_FOUND\", f;\n }\n\n var l = n[o] = {\n exports: {}\n };\n t[o][0].call(l.exports, function (e) {\n var n = t[o][1][e];\n return s(n ? n : e);\n }, l, l.exports, e, t, n, r);\n }\n\n return n[o].exports;\n }\n\n var i = typeof _dereq_ == \"function\" && _dereq_;\n\n for (var o = 0; o < r.length; o++) {\n s(r[o]);\n }\n\n return s;\n }({\n 1: [function (_dereq_, module, exports) {\n \"use strict\";\n\n module.exports = function (Promise) {\n var SomePromiseArray = Promise._SomePromiseArray;\n\n function any(promises) {\n var ret = new SomePromiseArray(promises);\n var promise = ret.promise();\n ret.setHowMany(1);\n ret.setUnwrap();\n ret.init();\n return promise;\n }\n\n Promise.any = function (promises) {\n return any(promises);\n };\n\n Promise.prototype.any = function () {\n return any(this);\n };\n };\n }, {}],\n 2: [function (_dereq_, module, exports) {\n \"use strict\";\n\n var firstLineError;\n\n try {\n throw new Error();\n } catch (e) {\n firstLineError = e;\n }\n\n var schedule = _dereq_(\"./schedule\");\n\n var Queue = _dereq_(\"./queue\");\n\n var util = _dereq_(\"./util\");\n\n function Async() {\n this._customScheduler = false;\n this._isTickUsed = false;\n this._lateQueue = new Queue(16);\n this._normalQueue = new Queue(16);\n this._haveDrainedQueues = false;\n this._trampolineEnabled = true;\n var self = this;\n\n this.drainQueues = function () {\n self._drainQueues();\n };\n\n this._schedule = schedule;\n }\n\n Async.prototype.setScheduler = function (fn) {\n var prev = this._schedule;\n this._schedule = fn;\n this._customScheduler = true;\n return prev;\n };\n\n Async.prototype.hasCustomScheduler = function () {\n return this._customScheduler;\n };\n\n Async.prototype.enableTrampoline = function () {\n this._trampolineEnabled = true;\n };\n\n Async.prototype.disableTrampolineIfNecessary = function () {\n if (util.hasDevTools) {\n this._trampolineEnabled = false;\n }\n };\n\n Async.prototype.haveItemsQueued = function () {\n return this._isTickUsed || this._haveDrainedQueues;\n };\n\n Async.prototype.fatalError = function (e, isNode) {\n if (isNode) {\n process.stderr.write(\"Fatal \" + (e instanceof Error ? e.stack : e) + \"\\n\");\n process.exit(2);\n } else {\n this.throwLater(e);\n }\n };\n\n Async.prototype.throwLater = function (fn, arg) {\n if (arguments.length === 1) {\n arg = fn;\n\n fn = function fn() {\n throw arg;\n };\n }\n\n if (typeof setTimeout !== \"undefined\") {\n setTimeout(function () {\n fn(arg);\n }, 0);\n } else try {\n this._schedule(function () {\n fn(arg);\n });\n } catch (e) {\n throw new Error(\"No async scheduler available\\n\\n See http://goo.gl/MqrFmX\\n\");\n }\n };\n\n function AsyncInvokeLater(fn, receiver, arg) {\n this._lateQueue.push(fn, receiver, arg);\n\n this._queueTick();\n }\n\n function AsyncInvoke(fn, receiver, arg) {\n this._normalQueue.push(fn, receiver, arg);\n\n this._queueTick();\n }\n\n function AsyncSettlePromises(promise) {\n this._normalQueue._pushOne(promise);\n\n this._queueTick();\n }\n\n if (!util.hasDevTools) {\n Async.prototype.invokeLater = AsyncInvokeLater;\n Async.prototype.invoke = AsyncInvoke;\n Async.prototype.settlePromises = AsyncSettlePromises;\n } else {\n Async.prototype.invokeLater = function (fn, receiver, arg) {\n if (this._trampolineEnabled) {\n AsyncInvokeLater.call(this, fn, receiver, arg);\n } else {\n this._schedule(function () {\n setTimeout(function () {\n fn.call(receiver, arg);\n }, 100);\n });\n }\n };\n\n Async.prototype.invoke = function (fn, receiver, arg) {\n if (this._trampolineEnabled) {\n AsyncInvoke.call(this, fn, receiver, arg);\n } else {\n this._schedule(function () {\n fn.call(receiver, arg);\n });\n }\n };\n\n Async.prototype.settlePromises = function (promise) {\n if (this._trampolineEnabled) {\n AsyncSettlePromises.call(this, promise);\n } else {\n this._schedule(function () {\n promise._settlePromises();\n });\n }\n };\n }\n\n function _drainQueue(queue) {\n while (queue.length() > 0) {\n _drainQueueStep(queue);\n }\n }\n\n function _drainQueueStep(queue) {\n var fn = queue.shift();\n\n if (typeof fn !== \"function\") {\n fn._settlePromises();\n } else {\n var receiver = queue.shift();\n var arg = queue.shift();\n fn.call(receiver, arg);\n }\n }\n\n Async.prototype._drainQueues = function () {\n _drainQueue(this._normalQueue);\n\n this._reset();\n\n this._haveDrainedQueues = true;\n\n _drainQueue(this._lateQueue);\n };\n\n Async.prototype._queueTick = function () {\n if (!this._isTickUsed) {\n this._isTickUsed = true;\n\n this._schedule(this.drainQueues);\n }\n };\n\n Async.prototype._reset = function () {\n this._isTickUsed = false;\n };\n\n module.exports = Async;\n module.exports.firstLineError = firstLineError;\n }, {\n \"./queue\": 26,\n \"./schedule\": 29,\n \"./util\": 36\n }],\n 3: [function (_dereq_, module, exports) {\n \"use strict\";\n\n module.exports = function (Promise, INTERNAL, tryConvertToPromise, debug) {\n var calledBind = false;\n\n var rejectThis = function rejectThis(_, e) {\n this._reject(e);\n };\n\n var targetRejected = function targetRejected(e, context) {\n context.promiseRejectionQueued = true;\n\n context.bindingPromise._then(rejectThis, rejectThis, null, this, e);\n };\n\n var bindingResolved = function bindingResolved(thisArg, context) {\n if ((this._bitField & 50397184) === 0) {\n this._resolveCallback(context.target);\n }\n };\n\n var bindingRejected = function bindingRejected(e, context) {\n if (!context.promiseRejectionQueued) this._reject(e);\n };\n\n Promise.prototype.bind = function (thisArg) {\n if (!calledBind) {\n calledBind = true;\n Promise.prototype._propagateFrom = debug.propagateFromFunction();\n Promise.prototype._boundValue = debug.boundValueFunction();\n }\n\n var maybePromise = tryConvertToPromise(thisArg);\n var ret = new Promise(INTERNAL);\n\n ret._propagateFrom(this, 1);\n\n var target = this._target();\n\n ret._setBoundTo(maybePromise);\n\n if (maybePromise instanceof Promise) {\n var context = {\n promiseRejectionQueued: false,\n promise: ret,\n target: target,\n bindingPromise: maybePromise\n };\n\n target._then(INTERNAL, targetRejected, undefined, ret, context);\n\n maybePromise._then(bindingResolved, bindingRejected, undefined, ret, context);\n\n ret._setOnCancel(maybePromise);\n } else {\n ret._resolveCallback(target);\n }\n\n return ret;\n };\n\n Promise.prototype._setBoundTo = function (obj) {\n if (obj !== undefined) {\n this._bitField = this._bitField | 2097152;\n this._boundTo = obj;\n } else {\n this._bitField = this._bitField & ~2097152;\n }\n };\n\n Promise.prototype._isBound = function () {\n return (this._bitField & 2097152) === 2097152;\n };\n\n Promise.bind = function (thisArg, value) {\n return Promise.resolve(value).bind(thisArg);\n };\n };\n }, {}],\n 4: [function (_dereq_, module, exports) {\n \"use strict\";\n\n var old;\n if (typeof Promise !== \"undefined\") old = Promise;\n\n function noConflict() {\n try {\n if (Promise === bluebird) Promise = old;\n } catch (e) {}\n\n return bluebird;\n }\n\n var bluebird = _dereq_(\"./promise\")();\n\n bluebird.noConflict = noConflict;\n module.exports = bluebird;\n }, {\n \"./promise\": 22\n }],\n 5: [function (_dereq_, module, exports) {\n \"use strict\";\n\n var cr = Object.create;\n\n if (cr) {\n var callerCache = cr(null);\n var getterCache = cr(null);\n callerCache[\" size\"] = getterCache[\" size\"] = 0;\n }\n\n module.exports = function (Promise) {\n var util = _dereq_(\"./util\");\n\n var canEvaluate = util.canEvaluate;\n var isIdentifier = util.isIdentifier;\n var getMethodCaller;\n var getGetter;\n\n if (!true) {\n var makeMethodCaller = function makeMethodCaller(methodName) {\n return new Function(\"ensureMethod\", \" \\n\\\n return function(obj) { \\n\\\n 'use strict' \\n\\\n var len = this.length; \\n\\\n ensureMethod(obj, 'methodName'); \\n\\\n switch(len) { \\n\\\n case 1: return obj.methodName(this[0]); \\n\\\n case 2: return obj.methodName(this[0], this[1]); \\n\\\n case 3: return obj.methodName(this[0], this[1], this[2]); \\n\\\n case 0: return obj.methodName(); \\n\\\n default: \\n\\\n return obj.methodName.apply(obj, this); \\n\\\n } \\n\\\n }; \\n\\\n \".replace(/methodName/g, methodName))(ensureMethod);\n };\n\n var makeGetter = function makeGetter(propertyName) {\n return new Function(\"obj\", \" \\n\\\n 'use strict'; \\n\\\n return obj.propertyName; \\n\\\n \".replace(\"propertyName\", propertyName));\n };\n\n var getCompiled = function getCompiled(name, compiler, cache) {\n var ret = cache[name];\n\n if (typeof ret !== \"function\") {\n if (!isIdentifier(name)) {\n return null;\n }\n\n ret = compiler(name);\n cache[name] = ret;\n cache[\" size\"]++;\n\n if (cache[\" size\"] > 512) {\n var keys = Object.keys(cache);\n\n for (var i = 0; i < 256; ++i) {\n delete cache[keys[i]];\n }\n\n cache[\" size\"] = keys.length - 256;\n }\n }\n\n return ret;\n };\n\n getMethodCaller = function getMethodCaller(name) {\n return getCompiled(name, makeMethodCaller, callerCache);\n };\n\n getGetter = function getGetter(name) {\n return getCompiled(name, makeGetter, getterCache);\n };\n }\n\n function ensureMethod(obj, methodName) {\n var fn;\n if (obj != null) fn = obj[methodName];\n\n if (typeof fn !== \"function\") {\n var message = \"Object \" + util.classString(obj) + \" has no method '\" + util.toString(methodName) + \"'\";\n throw new Promise.TypeError(message);\n }\n\n return fn;\n }\n\n function caller(obj) {\n var methodName = this.pop();\n var fn = ensureMethod(obj, methodName);\n return fn.apply(obj, this);\n }\n\n Promise.prototype.call = function (methodName) {\n var args = [].slice.call(arguments, 1);\n ;\n\n if (!true) {\n if (canEvaluate) {\n var maybeCaller = getMethodCaller(methodName);\n\n if (maybeCaller !== null) {\n return this._then(maybeCaller, undefined, undefined, args, undefined);\n }\n }\n }\n\n args.push(methodName);\n return this._then(caller, undefined, undefined, args, undefined);\n };\n\n function namedGetter(obj) {\n return obj[this];\n }\n\n function indexedGetter(obj) {\n var index = +this;\n if (index < 0) index = Math.max(0, index + obj.length);\n return obj[index];\n }\n\n Promise.prototype.get = function (propertyName) {\n var isIndex = typeof propertyName === \"number\";\n var getter;\n\n if (!isIndex) {\n if (canEvaluate) {\n var maybeGetter = getGetter(propertyName);\n getter = maybeGetter !== null ? maybeGetter : namedGetter;\n } else {\n getter = namedGetter;\n }\n } else {\n getter = indexedGetter;\n }\n\n return this._then(getter, undefined, undefined, propertyName, undefined);\n };\n };\n }, {\n \"./util\": 36\n }],\n 6: [function (_dereq_, module, exports) {\n \"use strict\";\n\n module.exports = function (Promise, PromiseArray, apiRejection, debug) {\n var util = _dereq_(\"./util\");\n\n var tryCatch = util.tryCatch;\n var errorObj = util.errorObj;\n var async = Promise._async;\n\n Promise.prototype[\"break\"] = Promise.prototype.cancel = function () {\n if (!debug.cancellation()) return this._warn(\"cancellation is disabled\");\n var promise = this;\n var child = promise;\n\n while (promise._isCancellable()) {\n if (!promise._cancelBy(child)) {\n if (child._isFollowing()) {\n child._followee().cancel();\n } else {\n child._cancelBranched();\n }\n\n break;\n }\n\n var parent = promise._cancellationParent;\n\n if (parent == null || !parent._isCancellable()) {\n if (promise._isFollowing()) {\n promise._followee().cancel();\n } else {\n promise._cancelBranched();\n }\n\n break;\n } else {\n if (promise._isFollowing()) promise._followee().cancel();\n\n promise._setWillBeCancelled();\n\n child = promise;\n promise = parent;\n }\n }\n };\n\n Promise.prototype._branchHasCancelled = function () {\n this._branchesRemainingToCancel--;\n };\n\n Promise.prototype._enoughBranchesHaveCancelled = function () {\n return this._branchesRemainingToCancel === undefined || this._branchesRemainingToCancel <= 0;\n };\n\n Promise.prototype._cancelBy = function (canceller) {\n if (canceller === this) {\n this._branchesRemainingToCancel = 0;\n\n this._invokeOnCancel();\n\n return true;\n } else {\n this._branchHasCancelled();\n\n if (this._enoughBranchesHaveCancelled()) {\n this._invokeOnCancel();\n\n return true;\n }\n }\n\n return false;\n };\n\n Promise.prototype._cancelBranched = function () {\n if (this._enoughBranchesHaveCancelled()) {\n this._cancel();\n }\n };\n\n Promise.prototype._cancel = function () {\n if (!this._isCancellable()) return;\n\n this._setCancelled();\n\n async.invoke(this._cancelPromises, this, undefined);\n };\n\n Promise.prototype._cancelPromises = function () {\n if (this._length() > 0) this._settlePromises();\n };\n\n Promise.prototype._unsetOnCancel = function () {\n this._onCancelField = undefined;\n };\n\n Promise.prototype._isCancellable = function () {\n return this.isPending() && !this._isCancelled();\n };\n\n Promise.prototype.isCancellable = function () {\n return this.isPending() && !this.isCancelled();\n };\n\n Promise.prototype._doInvokeOnCancel = function (onCancelCallback, internalOnly) {\n if (util.isArray(onCancelCallback)) {\n for (var i = 0; i < onCancelCallback.length; ++i) {\n this._doInvokeOnCancel(onCancelCallback[i], internalOnly);\n }\n } else if (onCancelCallback !== undefined) {\n if (typeof onCancelCallback === \"function\") {\n if (!internalOnly) {\n var e = tryCatch(onCancelCallback).call(this._boundValue());\n\n if (e === errorObj) {\n this._attachExtraTrace(e.e);\n\n async.throwLater(e.e);\n }\n }\n } else {\n onCancelCallback._resultCancelled(this);\n }\n }\n };\n\n Promise.prototype._invokeOnCancel = function () {\n var onCancelCallback = this._onCancel();\n\n this._unsetOnCancel();\n\n async.invoke(this._doInvokeOnCancel, this, onCancelCallback);\n };\n\n Promise.prototype._invokeInternalOnCancel = function () {\n if (this._isCancellable()) {\n this._doInvokeOnCancel(this._onCancel(), true);\n\n this._unsetOnCancel();\n }\n };\n\n Promise.prototype._resultCancelled = function () {\n this.cancel();\n };\n };\n }, {\n \"./util\": 36\n }],\n 7: [function (_dereq_, module, exports) {\n \"use strict\";\n\n module.exports = function (NEXT_FILTER) {\n var util = _dereq_(\"./util\");\n\n var getKeys = _dereq_(\"./es5\").keys;\n\n var tryCatch = util.tryCatch;\n var errorObj = util.errorObj;\n\n function catchFilter(instances, cb, promise) {\n return function (e) {\n var boundTo = promise._boundValue();\n\n predicateLoop: for (var i = 0; i < instances.length; ++i) {\n var item = instances[i];\n\n if (item === Error || item != null && item.prototype instanceof Error) {\n if (e instanceof item) {\n return tryCatch(cb).call(boundTo, e);\n }\n } else if (typeof item === \"function\") {\n var matchesPredicate = tryCatch(item).call(boundTo, e);\n\n if (matchesPredicate === errorObj) {\n return matchesPredicate;\n } else if (matchesPredicate) {\n return tryCatch(cb).call(boundTo, e);\n }\n } else if (util.isObject(e)) {\n var keys = getKeys(item);\n\n for (var j = 0; j < keys.length; ++j) {\n var key = keys[j];\n\n if (item[key] != e[key]) {\n continue predicateLoop;\n }\n }\n\n return tryCatch(cb).call(boundTo, e);\n }\n }\n\n return NEXT_FILTER;\n };\n }\n\n return catchFilter;\n };\n }, {\n \"./es5\": 13,\n \"./util\": 36\n }],\n 8: [function (_dereq_, module, exports) {\n \"use strict\";\n\n module.exports = function (Promise) {\n var longStackTraces = false;\n var contextStack = [];\n\n Promise.prototype._promiseCreated = function () {};\n\n Promise.prototype._pushContext = function () {};\n\n Promise.prototype._popContext = function () {\n return null;\n };\n\n Promise._peekContext = Promise.prototype._peekContext = function () {};\n\n function Context() {\n this._trace = new Context.CapturedTrace(peekContext());\n }\n\n Context.prototype._pushContext = function () {\n if (this._trace !== undefined) {\n this._trace._promiseCreated = null;\n contextStack.push(this._trace);\n }\n };\n\n Context.prototype._popContext = function () {\n if (this._trace !== undefined) {\n var trace = contextStack.pop();\n var ret = trace._promiseCreated;\n trace._promiseCreated = null;\n return ret;\n }\n\n return null;\n };\n\n function createContext() {\n if (longStackTraces) return new Context();\n }\n\n function peekContext() {\n var lastIndex = contextStack.length - 1;\n\n if (lastIndex >= 0) {\n return contextStack[lastIndex];\n }\n\n return undefined;\n }\n\n Context.CapturedTrace = null;\n Context.create = createContext;\n\n Context.deactivateLongStackTraces = function () {};\n\n Context.activateLongStackTraces = function () {\n var Promise_pushContext = Promise.prototype._pushContext;\n var Promise_popContext = Promise.prototype._popContext;\n var Promise_PeekContext = Promise._peekContext;\n var Promise_peekContext = Promise.prototype._peekContext;\n var Promise_promiseCreated = Promise.prototype._promiseCreated;\n\n Context.deactivateLongStackTraces = function () {\n Promise.prototype._pushContext = Promise_pushContext;\n Promise.prototype._popContext = Promise_popContext;\n Promise._peekContext = Promise_PeekContext;\n Promise.prototype._peekContext = Promise_peekContext;\n Promise.prototype._promiseCreated = Promise_promiseCreated;\n longStackTraces = false;\n };\n\n longStackTraces = true;\n Promise.prototype._pushContext = Context.prototype._pushContext;\n Promise.prototype._popContext = Context.prototype._popContext;\n Promise._peekContext = Promise.prototype._peekContext = peekContext;\n\n Promise.prototype._promiseCreated = function () {\n var ctx = this._peekContext();\n\n if (ctx && ctx._promiseCreated == null) ctx._promiseCreated = this;\n };\n };\n\n return Context;\n };\n }, {}],\n 9: [function (_dereq_, module, exports) {\n \"use strict\";\n\n module.exports = function (Promise, Context) {\n var getDomain = Promise._getDomain;\n var async = Promise._async;\n\n var Warning = _dereq_(\"./errors\").Warning;\n\n var util = _dereq_(\"./util\");\n\n var es5 = _dereq_(\"./es5\");\n\n var canAttachTrace = util.canAttachTrace;\n var unhandledRejectionHandled;\n var possiblyUnhandledRejection;\n var bluebirdFramePattern = /[\\\\\\/]bluebird[\\\\\\/]js[\\\\\\/](release|debug|instrumented)/;\n var nodeFramePattern = /\\((?:timers\\.js):\\d+:\\d+\\)/;\n var parseLinePattern = /[\\/<\\(](.+?):(\\d+):(\\d+)\\)?\\s*$/;\n var stackFramePattern = null;\n var formatStack = null;\n var indentStackFrames = false;\n var printWarning;\n var debugging = !!(util.env(\"BLUEBIRD_DEBUG\") != 0 && (true || util.env(\"BLUEBIRD_DEBUG\") || util.env(\"NODE_ENV\") === \"development\"));\n var warnings = !!(util.env(\"BLUEBIRD_WARNINGS\") != 0 && (debugging || util.env(\"BLUEBIRD_WARNINGS\")));\n var longStackTraces = !!(util.env(\"BLUEBIRD_LONG_STACK_TRACES\") != 0 && (debugging || util.env(\"BLUEBIRD_LONG_STACK_TRACES\")));\n var wForgottenReturn = util.env(\"BLUEBIRD_W_FORGOTTEN_RETURN\") != 0 && (warnings || !!util.env(\"BLUEBIRD_W_FORGOTTEN_RETURN\"));\n\n Promise.prototype.suppressUnhandledRejections = function () {\n var target = this._target();\n\n target._bitField = target._bitField & ~1048576 | 524288;\n };\n\n Promise.prototype._ensurePossibleRejectionHandled = function () {\n if ((this._bitField & 524288) !== 0) return;\n\n this._setRejectionIsUnhandled();\n\n var self = this;\n setTimeout(function () {\n self._notifyUnhandledRejection();\n }, 1);\n };\n\n Promise.prototype._notifyUnhandledRejectionIsHandled = function () {\n fireRejectionEvent(\"rejectionHandled\", unhandledRejectionHandled, undefined, this);\n };\n\n Promise.prototype._setReturnedNonUndefined = function () {\n this._bitField = this._bitField | 268435456;\n };\n\n Promise.prototype._returnedNonUndefined = function () {\n return (this._bitField & 268435456) !== 0;\n };\n\n Promise.prototype._notifyUnhandledRejection = function () {\n if (this._isRejectionUnhandled()) {\n var reason = this._settledValue();\n\n this._setUnhandledRejectionIsNotified();\n\n fireRejectionEvent(\"unhandledRejection\", possiblyUnhandledRejection, reason, this);\n }\n };\n\n Promise.prototype._setUnhandledRejectionIsNotified = function () {\n this._bitField = this._bitField | 262144;\n };\n\n Promise.prototype._unsetUnhandledRejectionIsNotified = function () {\n this._bitField = this._bitField & ~262144;\n };\n\n Promise.prototype._isUnhandledRejectionNotified = function () {\n return (this._bitField & 262144) > 0;\n };\n\n Promise.prototype._setRejectionIsUnhandled = function () {\n this._bitField = this._bitField | 1048576;\n };\n\n Promise.prototype._unsetRejectionIsUnhandled = function () {\n this._bitField = this._bitField & ~1048576;\n\n if (this._isUnhandledRejectionNotified()) {\n this._unsetUnhandledRejectionIsNotified();\n\n this._notifyUnhandledRejectionIsHandled();\n }\n };\n\n Promise.prototype._isRejectionUnhandled = function () {\n return (this._bitField & 1048576) > 0;\n };\n\n Promise.prototype._warn = function (message, shouldUseOwnTrace, promise) {\n return warn(message, shouldUseOwnTrace, promise || this);\n };\n\n Promise.onPossiblyUnhandledRejection = function (fn) {\n var domain = getDomain();\n possiblyUnhandledRejection = typeof fn === \"function\" ? domain === null ? fn : util.domainBind(domain, fn) : undefined;\n };\n\n Promise.onUnhandledRejectionHandled = function (fn) {\n var domain = getDomain();\n unhandledRejectionHandled = typeof fn === \"function\" ? domain === null ? fn : util.domainBind(domain, fn) : undefined;\n };\n\n var disableLongStackTraces = function disableLongStackTraces() {};\n\n Promise.longStackTraces = function () {\n if (async.haveItemsQueued() && !config.longStackTraces) {\n throw new Error(\"cannot enable long stack traces after promises have been created\\n\\n See http://goo.gl/MqrFmX\\n\");\n }\n\n if (!config.longStackTraces && longStackTracesIsSupported()) {\n var Promise_captureStackTrace = Promise.prototype._captureStackTrace;\n var Promise_attachExtraTrace = Promise.prototype._attachExtraTrace;\n var Promise_dereferenceTrace = Promise.prototype._dereferenceTrace;\n config.longStackTraces = true;\n\n disableLongStackTraces = function disableLongStackTraces() {\n if (async.haveItemsQueued() && !config.longStackTraces) {\n throw new Error(\"cannot enable long stack traces after promises have been created\\n\\n See http://goo.gl/MqrFmX\\n\");\n }\n\n Promise.prototype._captureStackTrace = Promise_captureStackTrace;\n Promise.prototype._attachExtraTrace = Promise_attachExtraTrace;\n Promise.prototype._dereferenceTrace = Promise_dereferenceTrace;\n Context.deactivateLongStackTraces();\n async.enableTrampoline();\n config.longStackTraces = false;\n };\n\n Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace;\n Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace;\n Promise.prototype._dereferenceTrace = longStackTracesDereferenceTrace;\n Context.activateLongStackTraces();\n async.disableTrampolineIfNecessary();\n }\n };\n\n Promise.hasLongStackTraces = function () {\n return config.longStackTraces && longStackTracesIsSupported();\n };\n\n var fireDomEvent = function () {\n try {\n if (typeof CustomEvent === \"function\") {\n var event = new CustomEvent(\"CustomEvent\");\n util.global.dispatchEvent(event);\n return function (name, event) {\n var eventData = {\n detail: event,\n cancelable: true\n };\n es5.defineProperty(eventData, \"promise\", {\n value: event.promise\n });\n es5.defineProperty(eventData, \"reason\", {\n value: event.reason\n });\n var domEvent = new CustomEvent(name.toLowerCase(), eventData);\n return !util.global.dispatchEvent(domEvent);\n };\n } else if (typeof Event === \"function\") {\n var event = new Event(\"CustomEvent\");\n util.global.dispatchEvent(event);\n return function (name, event) {\n var domEvent = new Event(name.toLowerCase(), {\n cancelable: true\n });\n domEvent.detail = event;\n es5.defineProperty(domEvent, \"promise\", {\n value: event.promise\n });\n es5.defineProperty(domEvent, \"reason\", {\n value: event.reason\n });\n return !util.global.dispatchEvent(domEvent);\n };\n } else {\n var event = document.createEvent(\"CustomEvent\");\n event.initCustomEvent(\"testingtheevent\", false, true, {});\n util.global.dispatchEvent(event);\n return function (name, event) {\n var domEvent = document.createEvent(\"CustomEvent\");\n domEvent.initCustomEvent(name.toLowerCase(), false, true, event);\n return !util.global.dispatchEvent(domEvent);\n };\n }\n } catch (e) {}\n\n return function () {\n return false;\n };\n }();\n\n var fireGlobalEvent = function () {\n if (util.isNode) {\n return function () {\n return process.emit.apply(process, arguments);\n };\n } else {\n if (!util.global) {\n return function () {\n return false;\n };\n }\n\n return function (name) {\n var methodName = \"on\" + name.toLowerCase();\n var method = util.global[methodName];\n if (!method) return false;\n method.apply(util.global, [].slice.call(arguments, 1));\n return true;\n };\n }\n }();\n\n function generatePromiseLifecycleEventObject(name, promise) {\n return {\n promise: promise\n };\n }\n\n var eventToObjectGenerator = {\n promiseCreated: generatePromiseLifecycleEventObject,\n promiseFulfilled: generatePromiseLifecycleEventObject,\n promiseRejected: generatePromiseLifecycleEventObject,\n promiseResolved: generatePromiseLifecycleEventObject,\n promiseCancelled: generatePromiseLifecycleEventObject,\n promiseChained: function promiseChained(name, promise, child) {\n return {\n promise: promise,\n child: child\n };\n },\n warning: function warning(name, _warning) {\n return {\n warning: _warning\n };\n },\n unhandledRejection: function unhandledRejection(name, reason, promise) {\n return {\n reason: reason,\n promise: promise\n };\n },\n rejectionHandled: generatePromiseLifecycleEventObject\n };\n\n var activeFireEvent = function activeFireEvent(name) {\n var globalEventFired = false;\n\n try {\n globalEventFired = fireGlobalEvent.apply(null, arguments);\n } catch (e) {\n async.throwLater(e);\n globalEventFired = true;\n }\n\n var domEventFired = false;\n\n try {\n domEventFired = fireDomEvent(name, eventToObjectGenerator[name].apply(null, arguments));\n } catch (e) {\n async.throwLater(e);\n domEventFired = true;\n }\n\n return domEventFired || globalEventFired;\n };\n\n Promise.config = function (opts) {\n opts = Object(opts);\n\n if (\"longStackTraces\" in opts) {\n if (opts.longStackTraces) {\n Promise.longStackTraces();\n } else if (!opts.longStackTraces && Promise.hasLongStackTraces()) {\n disableLongStackTraces();\n }\n }\n\n if (\"warnings\" in opts) {\n var warningsOption = opts.warnings;\n config.warnings = !!warningsOption;\n wForgottenReturn = config.warnings;\n\n if (util.isObject(warningsOption)) {\n if (\"wForgottenReturn\" in warningsOption) {\n wForgottenReturn = !!warningsOption.wForgottenReturn;\n }\n }\n }\n\n if (\"cancellation\" in opts && opts.cancellation && !config.cancellation) {\n if (async.haveItemsQueued()) {\n throw new Error(\"cannot enable cancellation after promises are in use\");\n }\n\n Promise.prototype._clearCancellationData = cancellationClearCancellationData;\n Promise.prototype._propagateFrom = cancellationPropagateFrom;\n Promise.prototype._onCancel = cancellationOnCancel;\n Promise.prototype._setOnCancel = cancellationSetOnCancel;\n Promise.prototype._attachCancellationCallback = cancellationAttachCancellationCallback;\n Promise.prototype._execute = cancellationExecute;\n _propagateFromFunction = cancellationPropagateFrom;\n config.cancellation = true;\n }\n\n if (\"monitoring\" in opts) {\n if (opts.monitoring && !config.monitoring) {\n config.monitoring = true;\n Promise.prototype._fireEvent = activeFireEvent;\n } else if (!opts.monitoring && config.monitoring) {\n config.monitoring = false;\n Promise.prototype._fireEvent = defaultFireEvent;\n }\n }\n\n return Promise;\n };\n\n function defaultFireEvent() {\n return false;\n }\n\n Promise.prototype._fireEvent = defaultFireEvent;\n\n Promise.prototype._execute = function (executor, resolve, reject) {\n try {\n executor(resolve, reject);\n } catch (e) {\n return e;\n }\n };\n\n Promise.prototype._onCancel = function () {};\n\n Promise.prototype._setOnCancel = function (handler) {\n ;\n };\n\n Promise.prototype._attachCancellationCallback = function (onCancel) {\n ;\n };\n\n Promise.prototype._captureStackTrace = function () {};\n\n Promise.prototype._attachExtraTrace = function () {};\n\n Promise.prototype._dereferenceTrace = function () {};\n\n Promise.prototype._clearCancellationData = function () {};\n\n Promise.prototype._propagateFrom = function (parent, flags) {\n ;\n ;\n };\n\n function cancellationExecute(executor, resolve, reject) {\n var promise = this;\n\n try {\n executor(resolve, reject, function (onCancel) {\n if (typeof onCancel !== \"function\") {\n throw new TypeError(\"onCancel must be a function, got: \" + util.toString(onCancel));\n }\n\n promise._attachCancellationCallback(onCancel);\n });\n } catch (e) {\n return e;\n }\n }\n\n function cancellationAttachCancellationCallback(onCancel) {\n if (!this._isCancellable()) return this;\n\n var previousOnCancel = this._onCancel();\n\n if (previousOnCancel !== undefined) {\n if (util.isArray(previousOnCancel)) {\n previousOnCancel.push(onCancel);\n } else {\n this._setOnCancel([previousOnCancel, onCancel]);\n }\n } else {\n this._setOnCancel(onCancel);\n }\n }\n\n function cancellationOnCancel() {\n return this._onCancelField;\n }\n\n function cancellationSetOnCancel(onCancel) {\n this._onCancelField = onCancel;\n }\n\n function cancellationClearCancellationData() {\n this._cancellationParent = undefined;\n this._onCancelField = undefined;\n }\n\n function cancellationPropagateFrom(parent, flags) {\n if ((flags & 1) !== 0) {\n this._cancellationParent = parent;\n var branchesRemainingToCancel = parent._branchesRemainingToCancel;\n\n if (branchesRemainingToCancel === undefined) {\n branchesRemainingToCancel = 0;\n }\n\n parent._branchesRemainingToCancel = branchesRemainingToCancel + 1;\n }\n\n if ((flags & 2) !== 0 && parent._isBound()) {\n this._setBoundTo(parent._boundTo);\n }\n }\n\n function bindingPropagateFrom(parent, flags) {\n if ((flags & 2) !== 0 && parent._isBound()) {\n this._setBoundTo(parent._boundTo);\n }\n }\n\n var _propagateFromFunction = bindingPropagateFrom;\n\n function _boundValueFunction() {\n var ret = this._boundTo;\n\n if (ret !== undefined) {\n if (ret instanceof Promise) {\n if (ret.isFulfilled()) {\n return ret.value();\n } else {\n return undefined;\n }\n }\n }\n\n return ret;\n }\n\n function longStackTracesCaptureStackTrace() {\n this._trace = new CapturedTrace(this._peekContext());\n }\n\n function longStackTracesAttachExtraTrace(error, ignoreSelf) {\n if (canAttachTrace(error)) {\n var trace = this._trace;\n\n if (trace !== undefined) {\n if (ignoreSelf) trace = trace._parent;\n }\n\n if (trace !== undefined) {\n trace.attachExtraTrace(error);\n } else if (!error.__stackCleaned__) {\n var parsed = parseStackAndMessage(error);\n util.notEnumerableProp(error, \"stack\", parsed.message + \"\\n\" + parsed.stack.join(\"\\n\"));\n util.notEnumerableProp(error, \"__stackCleaned__\", true);\n }\n }\n }\n\n function longStackTracesDereferenceTrace() {\n this._trace = undefined;\n }\n\n function checkForgottenReturns(returnValue, promiseCreated, name, promise, parent) {\n if (returnValue === undefined && promiseCreated !== null && wForgottenReturn) {\n if (parent !== undefined && parent._returnedNonUndefined()) return;\n if ((promise._bitField & 65535) === 0) return;\n if (name) name = name + \" \";\n var handlerLine = \"\";\n var creatorLine = \"\";\n\n if (promiseCreated._trace) {\n var traceLines = promiseCreated._trace.stack.split(\"\\n\");\n\n var stack = cleanStack(traceLines);\n\n for (var i = stack.length - 1; i >= 0; --i) {\n var line = stack[i];\n\n if (!nodeFramePattern.test(line)) {\n var lineMatches = line.match(parseLinePattern);\n\n if (lineMatches) {\n handlerLine = \"at \" + lineMatches[1] + \":\" + lineMatches[2] + \":\" + lineMatches[3] + \" \";\n }\n\n break;\n }\n }\n\n if (stack.length > 0) {\n var firstUserLine = stack[0];\n\n for (var i = 0; i < traceLines.length; ++i) {\n if (traceLines[i] === firstUserLine) {\n if (i > 0) {\n creatorLine = \"\\n\" + traceLines[i - 1];\n }\n\n break;\n }\n }\n }\n }\n\n var msg = \"a promise was created in a \" + name + \"handler \" + handlerLine + \"but was not returned from it, \" + \"see http://goo.gl/rRqMUw\" + creatorLine;\n\n promise._warn(msg, true, promiseCreated);\n }\n }\n\n function deprecated(name, replacement) {\n var message = name + \" is deprecated and will be removed in a future version.\";\n if (replacement) message += \" Use \" + replacement + \" instead.\";\n return warn(message);\n }\n\n function warn(message, shouldUseOwnTrace, promise) {\n if (!config.warnings) return;\n var warning = new Warning(message);\n var ctx;\n\n if (shouldUseOwnTrace) {\n promise._attachExtraTrace(warning);\n } else if (config.longStackTraces && (ctx = Promise._peekContext())) {\n ctx.attachExtraTrace(warning);\n } else {\n var parsed = parseStackAndMessage(warning);\n warning.stack = parsed.message + \"\\n\" + parsed.stack.join(\"\\n\");\n }\n\n if (!activeFireEvent(\"warning\", warning)) {\n formatAndLogError(warning, \"\", true);\n }\n }\n\n function reconstructStack(message, stacks) {\n for (var i = 0; i < stacks.length - 1; ++i) {\n stacks[i].push(\"From previous event:\");\n stacks[i] = stacks[i].join(\"\\n\");\n }\n\n if (i < stacks.length) {\n stacks[i] = stacks[i].join(\"\\n\");\n }\n\n return message + \"\\n\" + stacks.join(\"\\n\");\n }\n\n function removeDuplicateOrEmptyJumps(stacks) {\n for (var i = 0; i < stacks.length; ++i) {\n if (stacks[i].length === 0 || i + 1 < stacks.length && stacks[i][0] === stacks[i + 1][0]) {\n stacks.splice(i, 1);\n i--;\n }\n }\n }\n\n function removeCommonRoots(stacks) {\n var current = stacks[0];\n\n for (var i = 1; i < stacks.length; ++i) {\n var prev = stacks[i];\n var currentLastIndex = current.length - 1;\n var currentLastLine = current[currentLastIndex];\n var commonRootMeetPoint = -1;\n\n for (var j = prev.length - 1; j >= 0; --j) {\n if (prev[j] === currentLastLine) {\n commonRootMeetPoint = j;\n break;\n }\n }\n\n for (var j = commonRootMeetPoint; j >= 0; --j) {\n var line = prev[j];\n\n if (current[currentLastIndex] === line) {\n current.pop();\n currentLastIndex--;\n } else {\n break;\n }\n }\n\n current = prev;\n }\n }\n\n function cleanStack(stack) {\n var ret = [];\n\n for (var i = 0; i < stack.length; ++i) {\n var line = stack[i];\n var isTraceLine = \" (No stack trace)\" === line || stackFramePattern.test(line);\n var isInternalFrame = isTraceLine && shouldIgnore(line);\n\n if (isTraceLine && !isInternalFrame) {\n if (indentStackFrames && line.charAt(0) !== \" \") {\n line = \" \" + line;\n }\n\n ret.push(line);\n }\n }\n\n return ret;\n }\n\n function stackFramesAsArray(error) {\n var stack = error.stack.replace(/\\s+$/g, \"\").split(\"\\n\");\n\n for (var i = 0; i < stack.length; ++i) {\n var line = stack[i];\n\n if (\" (No stack trace)\" === line || stackFramePattern.test(line)) {\n break;\n }\n }\n\n if (i > 0 && error.name != \"SyntaxError\") {\n stack = stack.slice(i);\n }\n\n return stack;\n }\n\n function parseStackAndMessage(error) {\n var stack = error.stack;\n var message = error.toString();\n stack = typeof stack === \"string\" && stack.length > 0 ? stackFramesAsArray(error) : [\" (No stack trace)\"];\n return {\n message: message,\n stack: error.name == \"SyntaxError\" ? stack : cleanStack(stack)\n };\n }\n\n function formatAndLogError(error, title, isSoft) {\n if (typeof console !== \"undefined\") {\n var message;\n\n if (util.isObject(error)) {\n var stack = error.stack;\n message = title + formatStack(stack, error);\n } else {\n message = title + String(error);\n }\n\n if (typeof printWarning === \"function\") {\n printWarning(message, isSoft);\n } else if (typeof console.log === \"function\" || _typeof(console.log) === \"object\") {\n console.log(message);\n }\n }\n }\n\n function fireRejectionEvent(name, localHandler, reason, promise) {\n var localEventFired = false;\n\n try {\n if (typeof localHandler === \"function\") {\n localEventFired = true;\n\n if (name === \"rejectionHandled\") {\n localHandler(promise);\n } else {\n localHandler(reason, promise);\n }\n }\n } catch (e) {\n async.throwLater(e);\n }\n\n if (name === \"unhandledRejection\") {\n if (!activeFireEvent(name, reason, promise) && !localEventFired) {\n formatAndLogError(reason, \"Unhandled rejection \");\n }\n } else {\n activeFireEvent(name, promise);\n }\n }\n\n function formatNonError(obj) {\n var str;\n\n if (typeof obj === \"function\") {\n str = \"[function \" + (obj.name || \"anonymous\") + \"]\";\n } else {\n str = obj && typeof obj.toString === \"function\" ? obj.toString() : util.toString(obj);\n var ruselessToString = /\\[object [a-zA-Z0-9$_]+\\]/;\n\n if (ruselessToString.test(str)) {\n try {\n var newStr = JSON.stringify(obj);\n str = newStr;\n } catch (e) {}\n }\n\n if (str.length === 0) {\n str = \"(empty array)\";\n }\n }\n\n return \"(<\" + snip(str) + \">, no stack trace)\";\n }\n\n function snip(str) {\n var maxChars = 41;\n\n if (str.length < maxChars) {\n return str;\n }\n\n return str.substr(0, maxChars - 3) + \"...\";\n }\n\n function longStackTracesIsSupported() {\n return typeof captureStackTrace === \"function\";\n }\n\n var shouldIgnore = function shouldIgnore() {\n return false;\n };\n\n var parseLineInfoRegex = /[\\/<\\(]([^:\\/]+):(\\d+):(?:\\d+)\\)?\\s*$/;\n\n function parseLineInfo(line) {\n var matches = line.match(parseLineInfoRegex);\n\n if (matches) {\n return {\n fileName: matches[1],\n line: parseInt(matches[2], 10)\n };\n }\n }\n\n function setBounds(firstLineError, lastLineError) {\n if (!longStackTracesIsSupported()) return;\n var firstStackLines = firstLineError.stack.split(\"\\n\");\n var lastStackLines = lastLineError.stack.split(\"\\n\");\n var firstIndex = -1;\n var lastIndex = -1;\n var firstFileName;\n var lastFileName;\n\n for (var i = 0; i < firstStackLines.length; ++i) {\n var result = parseLineInfo(firstStackLines[i]);\n\n if (result) {\n firstFileName = result.fileName;\n firstIndex = result.line;\n break;\n }\n }\n\n for (var i = 0; i < lastStackLines.length; ++i) {\n var result = parseLineInfo(lastStackLines[i]);\n\n if (result) {\n lastFileName = result.fileName;\n lastIndex = result.line;\n break;\n }\n }\n\n if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName || firstFileName !== lastFileName || firstIndex >= lastIndex) {\n return;\n }\n\n shouldIgnore = function shouldIgnore(line) {\n if (bluebirdFramePattern.test(line)) return true;\n var info = parseLineInfo(line);\n\n if (info) {\n if (info.fileName === firstFileName && firstIndex <= info.line && info.line <= lastIndex) {\n return true;\n }\n }\n\n return false;\n };\n }\n\n function CapturedTrace(parent) {\n this._parent = parent;\n this._promisesCreated = 0;\n var length = this._length = 1 + (parent === undefined ? 0 : parent._length);\n captureStackTrace(this, CapturedTrace);\n if (length > 32) this.uncycle();\n }\n\n util.inherits(CapturedTrace, Error);\n Context.CapturedTrace = CapturedTrace;\n\n CapturedTrace.prototype.uncycle = function () {\n var length = this._length;\n if (length < 2) return;\n var nodes = [];\n var stackToIndex = {};\n\n for (var i = 0, node = this; node !== undefined; ++i) {\n nodes.push(node);\n node = node._parent;\n }\n\n length = this._length = i;\n\n for (var i = length - 1; i >= 0; --i) {\n var stack = nodes[i].stack;\n\n if (stackToIndex[stack] === undefined) {\n stackToIndex[stack] = i;\n }\n }\n\n for (var i = 0; i < length; ++i) {\n var currentStack = nodes[i].stack;\n var index = stackToIndex[currentStack];\n\n if (index !== undefined && index !== i) {\n if (index > 0) {\n nodes[index - 1]._parent = undefined;\n nodes[index - 1]._length = 1;\n }\n\n nodes[i]._parent = undefined;\n nodes[i]._length = 1;\n var cycleEdgeNode = i > 0 ? nodes[i - 1] : this;\n\n if (index < length - 1) {\n cycleEdgeNode._parent = nodes[index + 1];\n\n cycleEdgeNode._parent.uncycle();\n\n cycleEdgeNode._length = cycleEdgeNode._parent._length + 1;\n } else {\n cycleEdgeNode._parent = undefined;\n cycleEdgeNode._length = 1;\n }\n\n var currentChildLength = cycleEdgeNode._length + 1;\n\n for (var j = i - 2; j >= 0; --j) {\n nodes[j]._length = currentChildLength;\n currentChildLength++;\n }\n\n return;\n }\n }\n };\n\n CapturedTrace.prototype.attachExtraTrace = function (error) {\n if (error.__stackCleaned__) return;\n this.uncycle();\n var parsed = parseStackAndMessage(error);\n var message = parsed.message;\n var stacks = [parsed.stack];\n var trace = this;\n\n while (trace !== undefined) {\n stacks.push(cleanStack(trace.stack.split(\"\\n\")));\n trace = trace._parent;\n }\n\n removeCommonRoots(stacks);\n removeDuplicateOrEmptyJumps(stacks);\n util.notEnumerableProp(error, \"stack\", reconstructStack(message, stacks));\n util.notEnumerableProp(error, \"__stackCleaned__\", true);\n };\n\n var captureStackTrace = function stackDetection() {\n var v8stackFramePattern = /^\\s*at\\s*/;\n\n var v8stackFormatter = function v8stackFormatter(stack, error) {\n if (typeof stack === \"string\") return stack;\n\n if (error.name !== undefined && error.message !== undefined) {\n return error.toString();\n }\n\n return formatNonError(error);\n };\n\n if (typeof Error.stackTraceLimit === \"number\" && typeof Error.captureStackTrace === \"function\") {\n Error.stackTraceLimit += 6;\n stackFramePattern = v8stackFramePattern;\n formatStack = v8stackFormatter;\n var captureStackTrace = Error.captureStackTrace;\n\n shouldIgnore = function shouldIgnore(line) {\n return bluebirdFramePattern.test(line);\n };\n\n return function (receiver, ignoreUntil) {\n Error.stackTraceLimit += 6;\n captureStackTrace(receiver, ignoreUntil);\n Error.stackTraceLimit -= 6;\n };\n }\n\n var err = new Error();\n\n if (typeof err.stack === \"string\" && err.stack.split(\"\\n\")[0].indexOf(\"stackDetection@\") >= 0) {\n stackFramePattern = /@/;\n formatStack = v8stackFormatter;\n indentStackFrames = true;\n return function captureStackTrace(o) {\n o.stack = new Error().stack;\n };\n }\n\n var hasStackAfterThrow;\n\n try {\n throw new Error();\n } catch (e) {\n hasStackAfterThrow = \"stack\" in e;\n }\n\n if (!(\"stack\" in err) && hasStackAfterThrow && typeof Error.stackTraceLimit === \"number\") {\n stackFramePattern = v8stackFramePattern;\n formatStack = v8stackFormatter;\n return function captureStackTrace(o) {\n Error.stackTraceLimit += 6;\n\n try {\n throw new Error();\n } catch (e) {\n o.stack = e.stack;\n }\n\n Error.stackTraceLimit -= 6;\n };\n }\n\n formatStack = function formatStack(stack, error) {\n if (typeof stack === \"string\") return stack;\n\n if ((_typeof(error) === \"object\" || typeof error === \"function\") && error.name !== undefined && error.message !== undefined) {\n return error.toString();\n }\n\n return formatNonError(error);\n };\n\n return null;\n }([]);\n\n if (typeof console !== \"undefined\" && typeof console.warn !== \"undefined\") {\n printWarning = function printWarning(message) {\n console.warn(message);\n };\n\n if (util.isNode && process.stderr.isTTY) {\n printWarning = function printWarning(message, isSoft) {\n var color = isSoft ? \"\\x1B[33m\" : \"\\x1B[31m\";\n console.warn(color + message + \"\\x1B[0m\\n\");\n };\n } else if (!util.isNode && typeof new Error().stack === \"string\") {\n printWarning = function printWarning(message, isSoft) {\n console.warn(\"%c\" + message, isSoft ? \"color: darkorange\" : \"color: red\");\n };\n }\n }\n\n var config = {\n warnings: warnings,\n longStackTraces: false,\n cancellation: false,\n monitoring: false\n };\n if (longStackTraces) Promise.longStackTraces();\n return {\n longStackTraces: function longStackTraces() {\n return config.longStackTraces;\n },\n warnings: function warnings() {\n return config.warnings;\n },\n cancellation: function cancellation() {\n return config.cancellation;\n },\n monitoring: function monitoring() {\n return config.monitoring;\n },\n propagateFromFunction: function propagateFromFunction() {\n return _propagateFromFunction;\n },\n boundValueFunction: function boundValueFunction() {\n return _boundValueFunction;\n },\n checkForgottenReturns: checkForgottenReturns,\n setBounds: setBounds,\n warn: warn,\n deprecated: deprecated,\n CapturedTrace: CapturedTrace,\n fireDomEvent: fireDomEvent,\n fireGlobalEvent: fireGlobalEvent\n };\n };\n }, {\n \"./errors\": 12,\n \"./es5\": 13,\n \"./util\": 36\n }],\n 10: [function (_dereq_, module, exports) {\n \"use strict\";\n\n module.exports = function (Promise) {\n function returner() {\n return this.value;\n }\n\n function thrower() {\n throw this.reason;\n }\n\n Promise.prototype[\"return\"] = Promise.prototype.thenReturn = function (value) {\n if (value instanceof Promise) value.suppressUnhandledRejections();\n return this._then(returner, undefined, undefined, {\n value: value\n }, undefined);\n };\n\n Promise.prototype[\"throw\"] = Promise.prototype.thenThrow = function (reason) {\n return this._then(thrower, undefined, undefined, {\n reason: reason\n }, undefined);\n };\n\n Promise.prototype.catchThrow = function (reason) {\n if (arguments.length <= 1) {\n return this._then(undefined, thrower, undefined, {\n reason: reason\n }, undefined);\n } else {\n var _reason = arguments[1];\n\n var handler = function handler() {\n throw _reason;\n };\n\n return this.caught(reason, handler);\n }\n };\n\n Promise.prototype.catchReturn = function (value) {\n if (arguments.length <= 1) {\n if (value instanceof Promise) value.suppressUnhandledRejections();\n return this._then(undefined, returner, undefined, {\n value: value\n }, undefined);\n } else {\n var _value = arguments[1];\n if (_value instanceof Promise) _value.suppressUnhandledRejections();\n\n var handler = function handler() {\n return _value;\n };\n\n return this.caught(value, handler);\n }\n };\n };\n }, {}],\n 11: [function (_dereq_, module, exports) {\n \"use strict\";\n\n module.exports = function (Promise, INTERNAL) {\n var PromiseReduce = Promise.reduce;\n var PromiseAll = Promise.all;\n\n function promiseAllThis() {\n return PromiseAll(this);\n }\n\n function PromiseMapSeries(promises, fn) {\n return PromiseReduce(promises, fn, INTERNAL, INTERNAL);\n }\n\n Promise.prototype.each = function (fn) {\n return PromiseReduce(this, fn, INTERNAL, 0)._then(promiseAllThis, undefined, undefined, this, undefined);\n };\n\n Promise.prototype.mapSeries = function (fn) {\n return PromiseReduce(this, fn, INTERNAL, INTERNAL);\n };\n\n Promise.each = function (promises, fn) {\n return PromiseReduce(promises, fn, INTERNAL, 0)._then(promiseAllThis, undefined, undefined, promises, undefined);\n };\n\n Promise.mapSeries = PromiseMapSeries;\n };\n }, {}],\n 12: [function (_dereq_, module, exports) {\n \"use strict\";\n\n var es5 = _dereq_(\"./es5\");\n\n var Objectfreeze = es5.freeze;\n\n var util = _dereq_(\"./util\");\n\n var inherits = util.inherits;\n var notEnumerableProp = util.notEnumerableProp;\n\n function subError(nameProperty, defaultMessage) {\n function SubError(message) {\n if (!(this instanceof SubError)) return new SubError(message);\n notEnumerableProp(this, \"message\", typeof message === \"string\" ? message : defaultMessage);\n notEnumerableProp(this, \"name\", nameProperty);\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n } else {\n Error.call(this);\n }\n }\n\n inherits(SubError, Error);\n return SubError;\n }\n\n var _TypeError, _RangeError;\n\n var Warning = subError(\"Warning\", \"warning\");\n var CancellationError = subError(\"CancellationError\", \"cancellation error\");\n var TimeoutError = subError(\"TimeoutError\", \"timeout error\");\n var AggregateError = subError(\"AggregateError\", \"aggregate error\");\n\n try {\n _TypeError = TypeError;\n _RangeError = RangeError;\n } catch (e) {\n _TypeError = subError(\"TypeError\", \"type error\");\n _RangeError = subError(\"RangeError\", \"range error\");\n }\n\n var methods = (\"join pop push shift unshift slice filter forEach some \" + \"every map indexOf lastIndexOf reduce reduceRight sort reverse\").split(\" \");\n\n for (var i = 0; i < methods.length; ++i) {\n if (typeof Array.prototype[methods[i]] === \"function\") {\n AggregateError.prototype[methods[i]] = Array.prototype[methods[i]];\n }\n }\n\n es5.defineProperty(AggregateError.prototype, \"length\", {\n value: 0,\n configurable: false,\n writable: true,\n enumerable: true\n });\n AggregateError.prototype[\"isOperational\"] = true;\n var level = 0;\n\n AggregateError.prototype.toString = function () {\n var indent = Array(level * 4 + 1).join(\" \");\n var ret = \"\\n\" + indent + \"AggregateError of:\" + \"\\n\";\n level++;\n indent = Array(level * 4 + 1).join(\" \");\n\n for (var i = 0; i < this.length; ++i) {\n var str = this[i] === this ? \"[Circular AggregateError]\" : this[i] + \"\";\n var lines = str.split(\"\\n\");\n\n for (var j = 0; j < lines.length; ++j) {\n lines[j] = indent + lines[j];\n }\n\n str = lines.join(\"\\n\");\n ret += str + \"\\n\";\n }\n\n level--;\n return ret;\n };\n\n function OperationalError(message) {\n if (!(this instanceof OperationalError)) return new OperationalError(message);\n notEnumerableProp(this, \"name\", \"OperationalError\");\n notEnumerableProp(this, \"message\", message);\n this.cause = message;\n this[\"isOperational\"] = true;\n\n if (message instanceof Error) {\n notEnumerableProp(this, \"message\", message.message);\n notEnumerableProp(this, \"stack\", message.stack);\n } else if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n }\n\n inherits(OperationalError, Error);\n var errorTypes = Error[\"__BluebirdErrorTypes__\"];\n\n if (!errorTypes) {\n errorTypes = Objectfreeze({\n CancellationError: CancellationError,\n TimeoutError: TimeoutError,\n OperationalError: OperationalError,\n RejectionError: OperationalError,\n AggregateError: AggregateError\n });\n es5.defineProperty(Error, \"__BluebirdErrorTypes__\", {\n value: errorTypes,\n writable: false,\n enumerable: false,\n configurable: false\n });\n }\n\n module.exports = {\n Error: Error,\n TypeError: _TypeError,\n RangeError: _RangeError,\n CancellationError: errorTypes.CancellationError,\n OperationalError: errorTypes.OperationalError,\n TimeoutError: errorTypes.TimeoutError,\n AggregateError: errorTypes.AggregateError,\n Warning: Warning\n };\n }, {\n \"./es5\": 13,\n \"./util\": 36\n }],\n 13: [function (_dereq_, module, exports) {\n var isES5 = function () {\n \"use strict\";\n\n return this === undefined;\n }();\n\n if (isES5) {\n module.exports = {\n freeze: Object.freeze,\n defineProperty: Object.defineProperty,\n getDescriptor: Object.getOwnPropertyDescriptor,\n keys: Object.keys,\n names: Object.getOwnPropertyNames,\n getPrototypeOf: Object.getPrototypeOf,\n isArray: Array.isArray,\n isES5: isES5,\n propertyIsWritable: function propertyIsWritable(obj, prop) {\n var descriptor = Object.getOwnPropertyDescriptor(obj, prop);\n return !!(!descriptor || descriptor.writable || descriptor.set);\n }\n };\n } else {\n var has = {}.hasOwnProperty;\n var str = {}.toString;\n var proto = {}.constructor.prototype;\n\n var ObjectKeys = function ObjectKeys(o) {\n var ret = [];\n\n for (var key in o) {\n if (has.call(o, key)) {\n ret.push(key);\n }\n }\n\n return ret;\n };\n\n var ObjectGetDescriptor = function ObjectGetDescriptor(o, key) {\n return {\n value: o[key]\n };\n };\n\n var ObjectDefineProperty = function ObjectDefineProperty(o, key, desc) {\n o[key] = desc.value;\n return o;\n };\n\n var ObjectFreeze = function ObjectFreeze(obj) {\n return obj;\n };\n\n var ObjectGetPrototypeOf = function ObjectGetPrototypeOf(obj) {\n try {\n return Object(obj).constructor.prototype;\n } catch (e) {\n return proto;\n }\n };\n\n var ArrayIsArray = function ArrayIsArray(obj) {\n try {\n return str.call(obj) === \"[object Array]\";\n } catch (e) {\n return false;\n }\n };\n\n module.exports = {\n isArray: ArrayIsArray,\n keys: ObjectKeys,\n names: ObjectKeys,\n defineProperty: ObjectDefineProperty,\n getDescriptor: ObjectGetDescriptor,\n freeze: ObjectFreeze,\n getPrototypeOf: ObjectGetPrototypeOf,\n isES5: isES5,\n propertyIsWritable: function propertyIsWritable() {\n return true;\n }\n };\n }\n }, {}],\n 14: [function (_dereq_, module, exports) {\n \"use strict\";\n\n module.exports = function (Promise, INTERNAL) {\n var PromiseMap = Promise.map;\n\n Promise.prototype.filter = function (fn, options) {\n return PromiseMap(this, fn, options, INTERNAL);\n };\n\n Promise.filter = function (promises, fn, options) {\n return PromiseMap(promises, fn, options, INTERNAL);\n };\n };\n }, {}],\n 15: [function (_dereq_, module, exports) {\n \"use strict\";\n\n module.exports = function (Promise, tryConvertToPromise, NEXT_FILTER) {\n var util = _dereq_(\"./util\");\n\n var CancellationError = Promise.CancellationError;\n var errorObj = util.errorObj;\n\n var catchFilter = _dereq_(\"./catch_filter\")(NEXT_FILTER);\n\n function PassThroughHandlerContext(promise, type, handler) {\n this.promise = promise;\n this.type = type;\n this.handler = handler;\n this.called = false;\n this.cancelPromise = null;\n }\n\n PassThroughHandlerContext.prototype.isFinallyHandler = function () {\n return this.type === 0;\n };\n\n function FinallyHandlerCancelReaction(finallyHandler) {\n this.finallyHandler = finallyHandler;\n }\n\n FinallyHandlerCancelReaction.prototype._resultCancelled = function () {\n checkCancel(this.finallyHandler);\n };\n\n function checkCancel(ctx, reason) {\n if (ctx.cancelPromise != null) {\n if (arguments.length > 1) {\n ctx.cancelPromise._reject(reason);\n } else {\n ctx.cancelPromise._cancel();\n }\n\n ctx.cancelPromise = null;\n return true;\n }\n\n return false;\n }\n\n function succeed() {\n return finallyHandler.call(this, this.promise._target()._settledValue());\n }\n\n function fail(reason) {\n if (checkCancel(this, reason)) return;\n errorObj.e = reason;\n return errorObj;\n }\n\n function finallyHandler(reasonOrValue) {\n var promise = this.promise;\n var handler = this.handler;\n\n if (!this.called) {\n this.called = true;\n var ret = this.isFinallyHandler() ? handler.call(promise._boundValue()) : handler.call(promise._boundValue(), reasonOrValue);\n\n if (ret === NEXT_FILTER) {\n return ret;\n } else if (ret !== undefined) {\n promise._setReturnedNonUndefined();\n\n var maybePromise = tryConvertToPromise(ret, promise);\n\n if (maybePromise instanceof Promise) {\n if (this.cancelPromise != null) {\n if (maybePromise._isCancelled()) {\n var reason = new CancellationError(\"late cancellation observer\");\n\n promise._attachExtraTrace(reason);\n\n errorObj.e = reason;\n return errorObj;\n } else if (maybePromise.isPending()) {\n maybePromise._attachCancellationCallback(new FinallyHandlerCancelReaction(this));\n }\n }\n\n return maybePromise._then(succeed, fail, undefined, this, undefined);\n }\n }\n }\n\n if (promise.isRejected()) {\n checkCancel(this);\n errorObj.e = reasonOrValue;\n return errorObj;\n } else {\n checkCancel(this);\n return reasonOrValue;\n }\n }\n\n Promise.prototype._passThrough = function (handler, type, success, fail) {\n if (typeof handler !== \"function\") return this.then();\n return this._then(success, fail, undefined, new PassThroughHandlerContext(this, type, handler), undefined);\n };\n\n Promise.prototype.lastly = Promise.prototype[\"finally\"] = function (handler) {\n return this._passThrough(handler, 0, finallyHandler, finallyHandler);\n };\n\n Promise.prototype.tap = function (handler) {\n return this._passThrough(handler, 1, finallyHandler);\n };\n\n Promise.prototype.tapCatch = function (handlerOrPredicate) {\n var len = arguments.length;\n\n if (len === 1) {\n return this._passThrough(handlerOrPredicate, 1, undefined, finallyHandler);\n } else {\n var catchInstances = new Array(len - 1),\n j = 0,\n i;\n\n for (i = 0; i < len - 1; ++i) {\n var item = arguments[i];\n\n if (util.isObject(item)) {\n catchInstances[j++] = item;\n } else {\n return Promise.reject(new TypeError(\"tapCatch statement predicate: \" + \"expecting an object but got \" + util.classString(item)));\n }\n }\n\n catchInstances.length = j;\n var handler = arguments[i];\n return this._passThrough(catchFilter(catchInstances, handler, this), 1, undefined, finallyHandler);\n }\n };\n\n return PassThroughHandlerContext;\n };\n }, {\n \"./catch_filter\": 7,\n \"./util\": 36\n }],\n 16: [function (_dereq_, module, exports) {\n \"use strict\";\n\n module.exports = function (Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug) {\n var errors = _dereq_(\"./errors\");\n\n var TypeError = errors.TypeError;\n\n var util = _dereq_(\"./util\");\n\n var errorObj = util.errorObj;\n var tryCatch = util.tryCatch;\n var yieldHandlers = [];\n\n function promiseFromYieldHandler(value, yieldHandlers, traceParent) {\n for (var i = 0; i < yieldHandlers.length; ++i) {\n traceParent._pushContext();\n\n var result = tryCatch(yieldHandlers[i])(value);\n\n traceParent._popContext();\n\n if (result === errorObj) {\n traceParent._pushContext();\n\n var ret = Promise.reject(errorObj.e);\n\n traceParent._popContext();\n\n return ret;\n }\n\n var maybePromise = tryConvertToPromise(result, traceParent);\n if (maybePromise instanceof Promise) return maybePromise;\n }\n\n return null;\n }\n\n function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) {\n if (debug.cancellation()) {\n var internal = new Promise(INTERNAL);\n\n var _finallyPromise = this._finallyPromise = new Promise(INTERNAL);\n\n this._promise = internal.lastly(function () {\n return _finallyPromise;\n });\n\n internal._captureStackTrace();\n\n internal._setOnCancel(this);\n } else {\n var promise = this._promise = new Promise(INTERNAL);\n\n promise._captureStackTrace();\n }\n\n this._stack = stack;\n this._generatorFunction = generatorFunction;\n this._receiver = receiver;\n this._generator = undefined;\n this._yieldHandlers = typeof yieldHandler === \"function\" ? [yieldHandler].concat(yieldHandlers) : yieldHandlers;\n this._yieldedPromise = null;\n this._cancellationPhase = false;\n }\n\n util.inherits(PromiseSpawn, Proxyable);\n\n PromiseSpawn.prototype._isResolved = function () {\n return this._promise === null;\n };\n\n PromiseSpawn.prototype._cleanup = function () {\n this._promise = this._generator = null;\n\n if (debug.cancellation() && this._finallyPromise !== null) {\n this._finallyPromise._fulfill();\n\n this._finallyPromise = null;\n }\n };\n\n PromiseSpawn.prototype._promiseCancelled = function () {\n if (this._isResolved()) return;\n var implementsReturn = typeof this._generator[\"return\"] !== \"undefined\";\n var result;\n\n if (!implementsReturn) {\n var reason = new Promise.CancellationError(\"generator .return() sentinel\");\n Promise.coroutine.returnSentinel = reason;\n\n this._promise._attachExtraTrace(reason);\n\n this._promise._pushContext();\n\n result = tryCatch(this._generator[\"throw\"]).call(this._generator, reason);\n\n this._promise._popContext();\n } else {\n this._promise._pushContext();\n\n result = tryCatch(this._generator[\"return\"]).call(this._generator, undefined);\n\n this._promise._popContext();\n }\n\n this._cancellationPhase = true;\n this._yieldedPromise = null;\n\n this._continue(result);\n };\n\n PromiseSpawn.prototype._promiseFulfilled = function (value) {\n this._yieldedPromise = null;\n\n this._promise._pushContext();\n\n var result = tryCatch(this._generator.next).call(this._generator, value);\n\n this._promise._popContext();\n\n this._continue(result);\n };\n\n PromiseSpawn.prototype._promiseRejected = function (reason) {\n this._yieldedPromise = null;\n\n this._promise._attachExtraTrace(reason);\n\n this._promise._pushContext();\n\n var result = tryCatch(this._generator[\"throw\"]).call(this._generator, reason);\n\n this._promise._popContext();\n\n this._continue(result);\n };\n\n PromiseSpawn.prototype._resultCancelled = function () {\n if (this._yieldedPromise instanceof Promise) {\n var promise = this._yieldedPromise;\n this._yieldedPromise = null;\n promise.cancel();\n }\n };\n\n PromiseSpawn.prototype.promise = function () {\n return this._promise;\n };\n\n PromiseSpawn.prototype._run = function () {\n this._generator = this._generatorFunction.call(this._receiver);\n this._receiver = this._generatorFunction = undefined;\n\n this._promiseFulfilled(undefined);\n };\n\n PromiseSpawn.prototype._continue = function (result) {\n var promise = this._promise;\n\n if (result === errorObj) {\n this._cleanup();\n\n if (this._cancellationPhase) {\n return promise.cancel();\n } else {\n return promise._rejectCallback(result.e, false);\n }\n }\n\n var value = result.value;\n\n if (result.done === true) {\n this._cleanup();\n\n if (this._cancellationPhase) {\n return promise.cancel();\n } else {\n return promise._resolveCallback(value);\n }\n } else {\n var maybePromise = tryConvertToPromise(value, this._promise);\n\n if (!(maybePromise instanceof Promise)) {\n maybePromise = promiseFromYieldHandler(maybePromise, this._yieldHandlers, this._promise);\n\n if (maybePromise === null) {\n this._promiseRejected(new TypeError(\"A value %s was yielded that could not be treated as a promise\\n\\n See http://goo.gl/MqrFmX\\n\\n\".replace(\"%s\", String(value)) + \"From coroutine:\\n\" + this._stack.split(\"\\n\").slice(1, -7).join(\"\\n\")));\n\n return;\n }\n }\n\n maybePromise = maybePromise._target();\n var bitField = maybePromise._bitField;\n ;\n\n if ((bitField & 50397184) === 0) {\n this._yieldedPromise = maybePromise;\n\n maybePromise._proxy(this, null);\n } else if ((bitField & 33554432) !== 0) {\n Promise._async.invoke(this._promiseFulfilled, this, maybePromise._value());\n } else if ((bitField & 16777216) !== 0) {\n Promise._async.invoke(this._promiseRejected, this, maybePromise._reason());\n } else {\n this._promiseCancelled();\n }\n }\n };\n\n Promise.coroutine = function (generatorFunction, options) {\n if (typeof generatorFunction !== \"function\") {\n throw new TypeError(\"generatorFunction must be a function\\n\\n See http://goo.gl/MqrFmX\\n\");\n }\n\n var yieldHandler = Object(options).yieldHandler;\n var PromiseSpawn$ = PromiseSpawn;\n var stack = new Error().stack;\n return function () {\n var generator = generatorFunction.apply(this, arguments);\n var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler, stack);\n var ret = spawn.promise();\n spawn._generator = generator;\n\n spawn._promiseFulfilled(undefined);\n\n return ret;\n };\n };\n\n Promise.coroutine.addYieldHandler = function (fn) {\n if (typeof fn !== \"function\") {\n throw new TypeError(\"expecting a function but got \" + util.classString(fn));\n }\n\n yieldHandlers.push(fn);\n };\n\n Promise.spawn = function (generatorFunction) {\n debug.deprecated(\"Promise.spawn()\", \"Promise.coroutine()\");\n\n if (typeof generatorFunction !== \"function\") {\n return apiRejection(\"generatorFunction must be a function\\n\\n See http://goo.gl/MqrFmX\\n\");\n }\n\n var spawn = new PromiseSpawn(generatorFunction, this);\n var ret = spawn.promise();\n\n spawn._run(Promise.spawn);\n\n return ret;\n };\n };\n }, {\n \"./errors\": 12,\n \"./util\": 36\n }],\n 17: [function (_dereq_, module, exports) {\n \"use strict\";\n\n module.exports = function (Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain) {\n var util = _dereq_(\"./util\");\n\n var canEvaluate = util.canEvaluate;\n var tryCatch = util.tryCatch;\n var errorObj = util.errorObj;\n var reject;\n\n if (!true) {\n if (canEvaluate) {\n var thenCallback = function thenCallback(i) {\n return new Function(\"value\", \"holder\", \" \\n\\\n 'use strict'; \\n\\\n holder.pIndex = value; \\n\\\n holder.checkFulfillment(this); \\n\\\n \".replace(/Index/g, i));\n };\n\n var promiseSetter = function promiseSetter(i) {\n return new Function(\"promise\", \"holder\", \" \\n\\\n 'use strict'; \\n\\\n holder.pIndex = promise; \\n\\\n \".replace(/Index/g, i));\n };\n\n var generateHolderClass = function generateHolderClass(total) {\n var props = new Array(total);\n\n for (var i = 0; i < props.length; ++i) {\n props[i] = \"this.p\" + (i + 1);\n }\n\n var assignment = props.join(\" = \") + \" = null;\";\n var cancellationCode = \"var promise;\\n\" + props.map(function (prop) {\n return \" \\n\\\n promise = \" + prop + \"; \\n\\\n if (promise instanceof Promise) { \\n\\\n promise.cancel(); \\n\\\n } \\n\\\n \";\n }).join(\"\\n\");\n var passedArguments = props.join(\", \");\n var name = \"Holder$\" + total;\n var code = \"return function(tryCatch, errorObj, Promise, async) { \\n\\\n 'use strict'; \\n\\\n function [TheName](fn) { \\n\\\n [TheProperties] \\n\\\n this.fn = fn; \\n\\\n this.asyncNeeded = true; \\n\\\n this.now = 0; \\n\\\n } \\n\\\n \\n\\\n [TheName].prototype._callFunction = function(promise) { \\n\\\n promise._pushContext(); \\n\\\n var ret = tryCatch(this.fn)([ThePassedArguments]); \\n\\\n promise._popContext(); \\n\\\n if (ret === errorObj) { \\n\\\n promise._rejectCallback(ret.e, false); \\n\\\n } else { \\n\\\n promise._resolveCallback(ret); \\n\\\n } \\n\\\n }; \\n\\\n \\n\\\n [TheName].prototype.checkFulfillment = function(promise) { \\n\\\n var now = ++this.now; \\n\\\n if (now === [TheTotal]) { \\n\\\n if (this.asyncNeeded) { \\n\\\n async.invoke(this._callFunction, this, promise); \\n\\\n } else { \\n\\\n this._callFunction(promise); \\n\\\n } \\n\\\n \\n\\\n } \\n\\\n }; \\n\\\n \\n\\\n [TheName].prototype._resultCancelled = function() { \\n\\\n [CancellationCode] \\n\\\n }; \\n\\\n \\n\\\n return [TheName]; \\n\\\n }(tryCatch, errorObj, Promise, async); \\n\\\n \";\n code = code.replace(/\\[TheName\\]/g, name).replace(/\\[TheTotal\\]/g, total).replace(/\\[ThePassedArguments\\]/g, passedArguments).replace(/\\[TheProperties\\]/g, assignment).replace(/\\[CancellationCode\\]/g, cancellationCode);\n return new Function(\"tryCatch\", \"errorObj\", \"Promise\", \"async\", code)(tryCatch, errorObj, Promise, async);\n };\n\n var holderClasses = [];\n var thenCallbacks = [];\n var promiseSetters = [];\n\n for (var i = 0; i < 8; ++i) {\n holderClasses.push(generateHolderClass(i + 1));\n thenCallbacks.push(thenCallback(i + 1));\n promiseSetters.push(promiseSetter(i + 1));\n }\n\n reject = function reject(reason) {\n this._reject(reason);\n };\n }\n }\n\n Promise.join = function () {\n var last = arguments.length - 1;\n var fn;\n\n if (last > 0 && typeof arguments[last] === \"function\") {\n fn = arguments[last];\n\n if (!true) {\n if (last <= 8 && canEvaluate) {\n var ret = new Promise(INTERNAL);\n\n ret._captureStackTrace();\n\n var HolderClass = holderClasses[last - 1];\n var holder = new HolderClass(fn);\n var callbacks = thenCallbacks;\n\n for (var i = 0; i < last; ++i) {\n var maybePromise = tryConvertToPromise(arguments[i], ret);\n\n if (maybePromise instanceof Promise) {\n maybePromise = maybePromise._target();\n var bitField = maybePromise._bitField;\n ;\n\n if ((bitField & 50397184) === 0) {\n maybePromise._then(callbacks[i], reject, undefined, ret, holder);\n\n promiseSetters[i](maybePromise, holder);\n holder.asyncNeeded = false;\n } else if ((bitField & 33554432) !== 0) {\n callbacks[i].call(ret, maybePromise._value(), holder);\n } else if ((bitField & 16777216) !== 0) {\n ret._reject(maybePromise._reason());\n } else {\n ret._cancel();\n }\n } else {\n callbacks[i].call(ret, maybePromise, holder);\n }\n }\n\n if (!ret._isFateSealed()) {\n if (holder.asyncNeeded) {\n var domain = getDomain();\n\n if (domain !== null) {\n holder.fn = util.domainBind(domain, holder.fn);\n }\n }\n\n ret._setAsyncGuaranteed();\n\n ret._setOnCancel(holder);\n }\n\n return ret;\n }\n }\n }\n\n var args = [].slice.call(arguments);\n ;\n if (fn) args.pop();\n var ret = new PromiseArray(args).promise();\n return fn !== undefined ? ret.spread(fn) : ret;\n };\n };\n }, {\n \"./util\": 36\n }],\n 18: [function (_dereq_, module, exports) {\n \"use strict\";\n\n module.exports = function (Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug) {\n var getDomain = Promise._getDomain;\n\n var util = _dereq_(\"./util\");\n\n var tryCatch = util.tryCatch;\n var errorObj = util.errorObj;\n var async = Promise._async;\n\n function MappingPromiseArray(promises, fn, limit, _filter) {\n this.constructor$(promises);\n\n this._promise._captureStackTrace();\n\n var domain = getDomain();\n this._callback = domain === null ? fn : util.domainBind(domain, fn);\n this._preservedValues = _filter === INTERNAL ? new Array(this.length()) : null;\n this._limit = limit;\n this._inFlight = 0;\n this._queue = [];\n async.invoke(this._asyncInit, this, undefined);\n }\n\n util.inherits(MappingPromiseArray, PromiseArray);\n\n MappingPromiseArray.prototype._asyncInit = function () {\n this._init$(undefined, -2);\n };\n\n MappingPromiseArray.prototype._init = function () {};\n\n MappingPromiseArray.prototype._promiseFulfilled = function (value, index) {\n var values = this._values;\n var length = this.length();\n var preservedValues = this._preservedValues;\n var limit = this._limit;\n\n if (index < 0) {\n index = index * -1 - 1;\n values[index] = value;\n\n if (limit >= 1) {\n this._inFlight--;\n\n this._drainQueue();\n\n if (this._isResolved()) return true;\n }\n } else {\n if (limit >= 1 && this._inFlight >= limit) {\n values[index] = value;\n\n this._queue.push(index);\n\n return false;\n }\n\n if (preservedValues !== null) preservedValues[index] = value;\n var promise = this._promise;\n var callback = this._callback;\n\n var receiver = promise._boundValue();\n\n promise._pushContext();\n\n var ret = tryCatch(callback).call(receiver, value, index, length);\n\n var promiseCreated = promise._popContext();\n\n debug.checkForgottenReturns(ret, promiseCreated, preservedValues !== null ? \"Promise.filter\" : \"Promise.map\", promise);\n\n if (ret === errorObj) {\n this._reject(ret.e);\n\n return true;\n }\n\n var maybePromise = tryConvertToPromise(ret, this._promise);\n\n if (maybePromise instanceof Promise) {\n maybePromise = maybePromise._target();\n var bitField = maybePromise._bitField;\n ;\n\n if ((bitField & 50397184) === 0) {\n if (limit >= 1) this._inFlight++;\n values[index] = maybePromise;\n\n maybePromise._proxy(this, (index + 1) * -1);\n\n return false;\n } else if ((bitField & 33554432) !== 0) {\n ret = maybePromise._value();\n } else if ((bitField & 16777216) !== 0) {\n this._reject(maybePromise._reason());\n\n return true;\n } else {\n this._cancel();\n\n return true;\n }\n }\n\n values[index] = ret;\n }\n\n var totalResolved = ++this._totalResolved;\n\n if (totalResolved >= length) {\n if (preservedValues !== null) {\n this._filter(values, preservedValues);\n } else {\n this._resolve(values);\n }\n\n return true;\n }\n\n return false;\n };\n\n MappingPromiseArray.prototype._drainQueue = function () {\n var queue = this._queue;\n var limit = this._limit;\n var values = this._values;\n\n while (queue.length > 0 && this._inFlight < limit) {\n if (this._isResolved()) return;\n var index = queue.pop();\n\n this._promiseFulfilled(values[index], index);\n }\n };\n\n MappingPromiseArray.prototype._filter = function (booleans, values) {\n var len = values.length;\n var ret = new Array(len);\n var j = 0;\n\n for (var i = 0; i < len; ++i) {\n if (booleans[i]) ret[j++] = values[i];\n }\n\n ret.length = j;\n\n this._resolve(ret);\n };\n\n MappingPromiseArray.prototype.preservedValues = function () {\n return this._preservedValues;\n };\n\n function map(promises, fn, options, _filter) {\n if (typeof fn !== \"function\") {\n return apiRejection(\"expecting a function but got \" + util.classString(fn));\n }\n\n var limit = 0;\n\n if (options !== undefined) {\n if (_typeof(options) === \"object\" && options !== null) {\n if (typeof options.concurrency !== \"number\") {\n return Promise.reject(new TypeError(\"'concurrency' must be a number but it is \" + util.classString(options.concurrency)));\n }\n\n limit = options.concurrency;\n } else {\n return Promise.reject(new TypeError(\"options argument must be an object but it is \" + util.classString(options)));\n }\n }\n\n limit = typeof limit === \"number\" && isFinite(limit) && limit >= 1 ? limit : 0;\n return new MappingPromiseArray(promises, fn, limit, _filter).promise();\n }\n\n Promise.prototype.map = function (fn, options) {\n return map(this, fn, options, null);\n };\n\n Promise.map = function (promises, fn, options, _filter) {\n return map(promises, fn, options, _filter);\n };\n };\n }, {\n \"./util\": 36\n }],\n 19: [function (_dereq_, module, exports) {\n \"use strict\";\n\n module.exports = function (Promise, INTERNAL, tryConvertToPromise, apiRejection, debug) {\n var util = _dereq_(\"./util\");\n\n var tryCatch = util.tryCatch;\n\n Promise.method = function (fn) {\n if (typeof fn !== \"function\") {\n throw new Promise.TypeError(\"expecting a function but got \" + util.classString(fn));\n }\n\n return function () {\n var ret = new Promise(INTERNAL);\n\n ret._captureStackTrace();\n\n ret._pushContext();\n\n var value = tryCatch(fn).apply(this, arguments);\n\n var promiseCreated = ret._popContext();\n\n debug.checkForgottenReturns(value, promiseCreated, \"Promise.method\", ret);\n\n ret._resolveFromSyncValue(value);\n\n return ret;\n };\n };\n\n Promise.attempt = Promise[\"try\"] = function (fn) {\n if (typeof fn !== \"function\") {\n return apiRejection(\"expecting a function but got \" + util.classString(fn));\n }\n\n var ret = new Promise(INTERNAL);\n\n ret._captureStackTrace();\n\n ret._pushContext();\n\n var value;\n\n if (arguments.length > 1) {\n debug.deprecated(\"calling Promise.try with more than 1 argument\");\n var arg = arguments[1];\n var ctx = arguments[2];\n value = util.isArray(arg) ? tryCatch(fn).apply(ctx, arg) : tryCatch(fn).call(ctx, arg);\n } else {\n value = tryCatch(fn)();\n }\n\n var promiseCreated = ret._popContext();\n\n debug.checkForgottenReturns(value, promiseCreated, \"Promise.try\", ret);\n\n ret._resolveFromSyncValue(value);\n\n return ret;\n };\n\n Promise.prototype._resolveFromSyncValue = function (value) {\n if (value === util.errorObj) {\n this._rejectCallback(value.e, false);\n } else {\n this._resolveCallback(value, true);\n }\n };\n };\n }, {\n \"./util\": 36\n }],\n 20: [function (_dereq_, module, exports) {\n \"use strict\";\n\n var util = _dereq_(\"./util\");\n\n var maybeWrapAsError = util.maybeWrapAsError;\n\n var errors = _dereq_(\"./errors\");\n\n var OperationalError = errors.OperationalError;\n\n var es5 = _dereq_(\"./es5\");\n\n function isUntypedError(obj) {\n return obj instanceof Error && es5.getPrototypeOf(obj) === Error.prototype;\n }\n\n var rErrorKey = /^(?:name|message|stack|cause)$/;\n\n function wrapAsOperationalError(obj) {\n var ret;\n\n if (isUntypedError(obj)) {\n ret = new OperationalError(obj);\n ret.name = obj.name;\n ret.message = obj.message;\n ret.stack = obj.stack;\n var keys = es5.keys(obj);\n\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n\n if (!rErrorKey.test(key)) {\n ret[key] = obj[key];\n }\n }\n\n return ret;\n }\n\n util.markAsOriginatingFromRejection(obj);\n return obj;\n }\n\n function nodebackForPromise(promise, multiArgs) {\n return function (err, value) {\n if (promise === null) return;\n\n if (err) {\n var wrapped = wrapAsOperationalError(maybeWrapAsError(err));\n\n promise._attachExtraTrace(wrapped);\n\n promise._reject(wrapped);\n } else if (!multiArgs) {\n promise._fulfill(value);\n } else {\n var args = [].slice.call(arguments, 1);\n ;\n\n promise._fulfill(args);\n }\n\n promise = null;\n };\n }\n\n module.exports = nodebackForPromise;\n }, {\n \"./errors\": 12,\n \"./es5\": 13,\n \"./util\": 36\n }],\n 21: [function (_dereq_, module, exports) {\n \"use strict\";\n\n module.exports = function (Promise) {\n var util = _dereq_(\"./util\");\n\n var async = Promise._async;\n var tryCatch = util.tryCatch;\n var errorObj = util.errorObj;\n\n function spreadAdapter(val, nodeback) {\n var promise = this;\n if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback);\n var ret = tryCatch(nodeback).apply(promise._boundValue(), [null].concat(val));\n\n if (ret === errorObj) {\n async.throwLater(ret.e);\n }\n }\n\n function successAdapter(val, nodeback) {\n var promise = this;\n\n var receiver = promise._boundValue();\n\n var ret = val === undefined ? tryCatch(nodeback).call(receiver, null) : tryCatch(nodeback).call(receiver, null, val);\n\n if (ret === errorObj) {\n async.throwLater(ret.e);\n }\n }\n\n function errorAdapter(reason, nodeback) {\n var promise = this;\n\n if (!reason) {\n var newReason = new Error(reason + \"\");\n newReason.cause = reason;\n reason = newReason;\n }\n\n var ret = tryCatch(nodeback).call(promise._boundValue(), reason);\n\n if (ret === errorObj) {\n async.throwLater(ret.e);\n }\n }\n\n Promise.prototype.asCallback = Promise.prototype.nodeify = function (nodeback, options) {\n if (typeof nodeback == \"function\") {\n var adapter = successAdapter;\n\n if (options !== undefined && Object(options).spread) {\n adapter = spreadAdapter;\n }\n\n this._then(adapter, errorAdapter, undefined, this, nodeback);\n }\n\n return this;\n };\n };\n }, {\n \"./util\": 36\n }],\n 22: [function (_dereq_, module, exports) {\n \"use strict\";\n\n module.exports = function () {\n var makeSelfResolutionError = function makeSelfResolutionError() {\n return new TypeError(\"circular promise resolution chain\\n\\n See http://goo.gl/MqrFmX\\n\");\n };\n\n var reflectHandler = function reflectHandler() {\n return new Promise.PromiseInspection(this._target());\n };\n\n var apiRejection = function apiRejection(msg) {\n return Promise.reject(new TypeError(msg));\n };\n\n function Proxyable() {}\n\n var UNDEFINED_BINDING = {};\n\n var util = _dereq_(\"./util\");\n\n var getDomain;\n\n if (util.isNode) {\n getDomain = function getDomain() {\n var ret = process.domain;\n if (ret === undefined) ret = null;\n return ret;\n };\n } else {\n getDomain = function getDomain() {\n return null;\n };\n }\n\n util.notEnumerableProp(Promise, \"_getDomain\", getDomain);\n\n var es5 = _dereq_(\"./es5\");\n\n var Async = _dereq_(\"./async\");\n\n var async = new Async();\n es5.defineProperty(Promise, \"_async\", {\n value: async\n });\n\n var errors = _dereq_(\"./errors\");\n\n var TypeError = Promise.TypeError = errors.TypeError;\n Promise.RangeError = errors.RangeError;\n var CancellationError = Promise.CancellationError = errors.CancellationError;\n Promise.TimeoutError = errors.TimeoutError;\n Promise.OperationalError = errors.OperationalError;\n Promise.RejectionError = errors.OperationalError;\n Promise.AggregateError = errors.AggregateError;\n\n var INTERNAL = function INTERNAL() {};\n\n var APPLY = {};\n var NEXT_FILTER = {};\n\n var tryConvertToPromise = _dereq_(\"./thenables\")(Promise, INTERNAL);\n\n var PromiseArray = _dereq_(\"./promise_array\")(Promise, INTERNAL, tryConvertToPromise, apiRejection, Proxyable);\n\n var Context = _dereq_(\"./context\")(Promise);\n /*jshint unused:false*/\n\n\n var createContext = Context.create;\n\n var debug = _dereq_(\"./debuggability\")(Promise, Context);\n\n var CapturedTrace = debug.CapturedTrace;\n\n var PassThroughHandlerContext = _dereq_(\"./finally\")(Promise, tryConvertToPromise, NEXT_FILTER);\n\n var catchFilter = _dereq_(\"./catch_filter\")(NEXT_FILTER);\n\n var nodebackForPromise = _dereq_(\"./nodeback\");\n\n var errorObj = util.errorObj;\n var tryCatch = util.tryCatch;\n\n function check(self, executor) {\n if (self == null || self.constructor !== Promise) {\n throw new TypeError(\"the promise constructor cannot be invoked directly\\n\\n See http://goo.gl/MqrFmX\\n\");\n }\n\n if (typeof executor !== \"function\") {\n throw new TypeError(\"expecting a function but got \" + util.classString(executor));\n }\n }\n\n function Promise(executor) {\n if (executor !== INTERNAL) {\n check(this, executor);\n }\n\n this._bitField = 0;\n this._fulfillmentHandler0 = undefined;\n this._rejectionHandler0 = undefined;\n this._promise0 = undefined;\n this._receiver0 = undefined;\n\n this._resolveFromExecutor(executor);\n\n this._promiseCreated();\n\n this._fireEvent(\"promiseCreated\", this);\n }\n\n Promise.prototype.toString = function () {\n return \"[object Promise]\";\n };\n\n Promise.prototype.caught = Promise.prototype[\"catch\"] = function (fn) {\n var len = arguments.length;\n\n if (len > 1) {\n var catchInstances = new Array(len - 1),\n j = 0,\n i;\n\n for (i = 0; i < len - 1; ++i) {\n var item = arguments[i];\n\n if (util.isObject(item)) {\n catchInstances[j++] = item;\n } else {\n return apiRejection(\"Catch statement predicate: \" + \"expecting an object but got \" + util.classString(item));\n }\n }\n\n catchInstances.length = j;\n fn = arguments[i];\n return this.then(undefined, catchFilter(catchInstances, fn, this));\n }\n\n return this.then(undefined, fn);\n };\n\n Promise.prototype.reflect = function () {\n return this._then(reflectHandler, reflectHandler, undefined, this, undefined);\n };\n\n Promise.prototype.then = function (didFulfill, didReject) {\n if (debug.warnings() && arguments.length > 0 && typeof didFulfill !== \"function\" && typeof didReject !== \"function\") {\n var msg = \".then() only accepts functions but was passed: \" + util.classString(didFulfill);\n\n if (arguments.length > 1) {\n msg += \", \" + util.classString(didReject);\n }\n\n this._warn(msg);\n }\n\n return this._then(didFulfill, didReject, undefined, undefined, undefined);\n };\n\n Promise.prototype.done = function (didFulfill, didReject) {\n var promise = this._then(didFulfill, didReject, undefined, undefined, undefined);\n\n promise._setIsFinal();\n };\n\n Promise.prototype.spread = function (fn) {\n if (typeof fn !== \"function\") {\n return apiRejection(\"expecting a function but got \" + util.classString(fn));\n }\n\n return this.all()._then(fn, undefined, undefined, APPLY, undefined);\n };\n\n Promise.prototype.toJSON = function () {\n var ret = {\n isFulfilled: false,\n isRejected: false,\n fulfillmentValue: undefined,\n rejectionReason: undefined\n };\n\n if (this.isFulfilled()) {\n ret.fulfillmentValue = this.value();\n ret.isFulfilled = true;\n } else if (this.isRejected()) {\n ret.rejectionReason = this.reason();\n ret.isRejected = true;\n }\n\n return ret;\n };\n\n Promise.prototype.all = function () {\n if (arguments.length > 0) {\n this._warn(\".all() was passed arguments but it does not take any\");\n }\n\n return new PromiseArray(this).promise();\n };\n\n Promise.prototype.error = function (fn) {\n return this.caught(util.originatesFromRejection, fn);\n };\n\n Promise.getNewLibraryCopy = module.exports;\n\n Promise.is = function (val) {\n return val instanceof Promise;\n };\n\n Promise.fromNode = Promise.fromCallback = function (fn) {\n var ret = new Promise(INTERNAL);\n\n ret._captureStackTrace();\n\n var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs : false;\n var result = tryCatch(fn)(nodebackForPromise(ret, multiArgs));\n\n if (result === errorObj) {\n ret._rejectCallback(result.e, true);\n }\n\n if (!ret._isFateSealed()) ret._setAsyncGuaranteed();\n return ret;\n };\n\n Promise.all = function (promises) {\n return new PromiseArray(promises).promise();\n };\n\n Promise.cast = function (obj) {\n var ret = tryConvertToPromise(obj);\n\n if (!(ret instanceof Promise)) {\n ret = new Promise(INTERNAL);\n\n ret._captureStackTrace();\n\n ret._setFulfilled();\n\n ret._rejectionHandler0 = obj;\n }\n\n return ret;\n };\n\n Promise.resolve = Promise.fulfilled = Promise.cast;\n\n Promise.reject = Promise.rejected = function (reason) {\n var ret = new Promise(INTERNAL);\n\n ret._captureStackTrace();\n\n ret._rejectCallback(reason, true);\n\n return ret;\n };\n\n Promise.setScheduler = function (fn) {\n if (typeof fn !== \"function\") {\n throw new TypeError(\"expecting a function but got \" + util.classString(fn));\n }\n\n return async.setScheduler(fn);\n };\n\n Promise.prototype._then = function (didFulfill, didReject, _, receiver, internalData) {\n var haveInternalData = internalData !== undefined;\n var promise = haveInternalData ? internalData : new Promise(INTERNAL);\n\n var target = this._target();\n\n var bitField = target._bitField;\n\n if (!haveInternalData) {\n promise._propagateFrom(this, 3);\n\n promise._captureStackTrace();\n\n if (receiver === undefined && (this._bitField & 2097152) !== 0) {\n if (!((bitField & 50397184) === 0)) {\n receiver = this._boundValue();\n } else {\n receiver = target === this ? undefined : this._boundTo;\n }\n }\n\n this._fireEvent(\"promiseChained\", this, promise);\n }\n\n var domain = getDomain();\n\n if (!((bitField & 50397184) === 0)) {\n var handler,\n value,\n settler = target._settlePromiseCtx;\n\n if ((bitField & 33554432) !== 0) {\n value = target._rejectionHandler0;\n handler = didFulfill;\n } else if ((bitField & 16777216) !== 0) {\n value = target._fulfillmentHandler0;\n handler = didReject;\n\n target._unsetRejectionIsUnhandled();\n } else {\n settler = target._settlePromiseLateCancellationObserver;\n value = new CancellationError(\"late cancellation observer\");\n\n target._attachExtraTrace(value);\n\n handler = didReject;\n }\n\n async.invoke(settler, target, {\n handler: domain === null ? handler : typeof handler === \"function\" && util.domainBind(domain, handler),\n promise: promise,\n receiver: receiver,\n value: value\n });\n } else {\n target._addCallbacks(didFulfill, didReject, promise, receiver, domain);\n }\n\n return promise;\n };\n\n Promise.prototype._length = function () {\n return this._bitField & 65535;\n };\n\n Promise.prototype._isFateSealed = function () {\n return (this._bitField & 117506048) !== 0;\n };\n\n Promise.prototype._isFollowing = function () {\n return (this._bitField & 67108864) === 67108864;\n };\n\n Promise.prototype._setLength = function (len) {\n this._bitField = this._bitField & -65536 | len & 65535;\n };\n\n Promise.prototype._setFulfilled = function () {\n this._bitField = this._bitField | 33554432;\n\n this._fireEvent(\"promiseFulfilled\", this);\n };\n\n Promise.prototype._setRejected = function () {\n this._bitField = this._bitField | 16777216;\n\n this._fireEvent(\"promiseRejected\", this);\n };\n\n Promise.prototype._setFollowing = function () {\n this._bitField = this._bitField | 67108864;\n\n this._fireEvent(\"promiseResolved\", this);\n };\n\n Promise.prototype._setIsFinal = function () {\n this._bitField = this._bitField | 4194304;\n };\n\n Promise.prototype._isFinal = function () {\n return (this._bitField & 4194304) > 0;\n };\n\n Promise.prototype._unsetCancelled = function () {\n this._bitField = this._bitField & ~65536;\n };\n\n Promise.prototype._setCancelled = function () {\n this._bitField = this._bitField | 65536;\n\n this._fireEvent(\"promiseCancelled\", this);\n };\n\n Promise.prototype._setWillBeCancelled = function () {\n this._bitField = this._bitField | 8388608;\n };\n\n Promise.prototype._setAsyncGuaranteed = function () {\n if (async.hasCustomScheduler()) return;\n this._bitField = this._bitField | 134217728;\n };\n\n Promise.prototype._receiverAt = function (index) {\n var ret = index === 0 ? this._receiver0 : this[index * 4 - 4 + 3];\n\n if (ret === UNDEFINED_BINDING) {\n return undefined;\n } else if (ret === undefined && this._isBound()) {\n return this._boundValue();\n }\n\n return ret;\n };\n\n Promise.prototype._promiseAt = function (index) {\n return this[index * 4 - 4 + 2];\n };\n\n Promise.prototype._fulfillmentHandlerAt = function (index) {\n return this[index * 4 - 4 + 0];\n };\n\n Promise.prototype._rejectionHandlerAt = function (index) {\n return this[index * 4 - 4 + 1];\n };\n\n Promise.prototype._boundValue = function () {};\n\n Promise.prototype._migrateCallback0 = function (follower) {\n var bitField = follower._bitField;\n var fulfill = follower._fulfillmentHandler0;\n var reject = follower._rejectionHandler0;\n var promise = follower._promise0;\n\n var receiver = follower._receiverAt(0);\n\n if (receiver === undefined) receiver = UNDEFINED_BINDING;\n\n this._addCallbacks(fulfill, reject, promise, receiver, null);\n };\n\n Promise.prototype._migrateCallbackAt = function (follower, index) {\n var fulfill = follower._fulfillmentHandlerAt(index);\n\n var reject = follower._rejectionHandlerAt(index);\n\n var promise = follower._promiseAt(index);\n\n var receiver = follower._receiverAt(index);\n\n if (receiver === undefined) receiver = UNDEFINED_BINDING;\n\n this._addCallbacks(fulfill, reject, promise, receiver, null);\n };\n\n Promise.prototype._addCallbacks = function (fulfill, reject, promise, receiver, domain) {\n var index = this._length();\n\n if (index >= 65535 - 4) {\n index = 0;\n\n this._setLength(0);\n }\n\n if (index === 0) {\n this._promise0 = promise;\n this._receiver0 = receiver;\n\n if (typeof fulfill === \"function\") {\n this._fulfillmentHandler0 = domain === null ? fulfill : util.domainBind(domain, fulfill);\n }\n\n if (typeof reject === \"function\") {\n this._rejectionHandler0 = domain === null ? reject : util.domainBind(domain, reject);\n }\n } else {\n var base = index * 4 - 4;\n this[base + 2] = promise;\n this[base + 3] = receiver;\n\n if (typeof fulfill === \"function\") {\n this[base + 0] = domain === null ? fulfill : util.domainBind(domain, fulfill);\n }\n\n if (typeof reject === \"function\") {\n this[base + 1] = domain === null ? reject : util.domainBind(domain, reject);\n }\n }\n\n this._setLength(index + 1);\n\n return index;\n };\n\n Promise.prototype._proxy = function (proxyable, arg) {\n this._addCallbacks(undefined, undefined, arg, proxyable, null);\n };\n\n Promise.prototype._resolveCallback = function (value, shouldBind) {\n if ((this._bitField & 117506048) !== 0) return;\n if (value === this) return this._rejectCallback(makeSelfResolutionError(), false);\n var maybePromise = tryConvertToPromise(value, this);\n if (!(maybePromise instanceof Promise)) return this._fulfill(value);\n if (shouldBind) this._propagateFrom(maybePromise, 2);\n\n var promise = maybePromise._target();\n\n if (promise === this) {\n this._reject(makeSelfResolutionError());\n\n return;\n }\n\n var bitField = promise._bitField;\n\n if ((bitField & 50397184) === 0) {\n var len = this._length();\n\n if (len > 0) promise._migrateCallback0(this);\n\n for (var i = 1; i < len; ++i) {\n promise._migrateCallbackAt(this, i);\n }\n\n this._setFollowing();\n\n this._setLength(0);\n\n this._setFollowee(promise);\n } else if ((bitField & 33554432) !== 0) {\n this._fulfill(promise._value());\n } else if ((bitField & 16777216) !== 0) {\n this._reject(promise._reason());\n } else {\n var reason = new CancellationError(\"late cancellation observer\");\n\n promise._attachExtraTrace(reason);\n\n this._reject(reason);\n }\n };\n\n Promise.prototype._rejectCallback = function (reason, synchronous, ignoreNonErrorWarnings) {\n var trace = util.ensureErrorObject(reason);\n var hasStack = trace === reason;\n\n if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) {\n var message = \"a promise was rejected with a non-error: \" + util.classString(reason);\n\n this._warn(message, true);\n }\n\n this._attachExtraTrace(trace, synchronous ? hasStack : false);\n\n this._reject(reason);\n };\n\n Promise.prototype._resolveFromExecutor = function (executor) {\n if (executor === INTERNAL) return;\n var promise = this;\n\n this._captureStackTrace();\n\n this._pushContext();\n\n var synchronous = true;\n\n var r = this._execute(executor, function (value) {\n promise._resolveCallback(value);\n }, function (reason) {\n promise._rejectCallback(reason, synchronous);\n });\n\n synchronous = false;\n\n this._popContext();\n\n if (r !== undefined) {\n promise._rejectCallback(r, true);\n }\n };\n\n Promise.prototype._settlePromiseFromHandler = function (handler, receiver, value, promise) {\n var bitField = promise._bitField;\n if ((bitField & 65536) !== 0) return;\n\n promise._pushContext();\n\n var x;\n\n if (receiver === APPLY) {\n if (!value || typeof value.length !== \"number\") {\n x = errorObj;\n x.e = new TypeError(\"cannot .spread() a non-array: \" + util.classString(value));\n } else {\n x = tryCatch(handler).apply(this._boundValue(), value);\n }\n } else {\n x = tryCatch(handler).call(receiver, value);\n }\n\n var promiseCreated = promise._popContext();\n\n bitField = promise._bitField;\n if ((bitField & 65536) !== 0) return;\n\n if (x === NEXT_FILTER) {\n promise._reject(value);\n } else if (x === errorObj) {\n promise._rejectCallback(x.e, false);\n } else {\n debug.checkForgottenReturns(x, promiseCreated, \"\", promise, this);\n\n promise._resolveCallback(x);\n }\n };\n\n Promise.prototype._target = function () {\n var ret = this;\n\n while (ret._isFollowing()) {\n ret = ret._followee();\n }\n\n return ret;\n };\n\n Promise.prototype._followee = function () {\n return this._rejectionHandler0;\n };\n\n Promise.prototype._setFollowee = function (promise) {\n this._rejectionHandler0 = promise;\n };\n\n Promise.prototype._settlePromise = function (promise, handler, receiver, value) {\n var isPromise = promise instanceof Promise;\n var bitField = this._bitField;\n var asyncGuaranteed = (bitField & 134217728) !== 0;\n\n if ((bitField & 65536) !== 0) {\n if (isPromise) promise._invokeInternalOnCancel();\n\n if (receiver instanceof PassThroughHandlerContext && receiver.isFinallyHandler()) {\n receiver.cancelPromise = promise;\n\n if (tryCatch(handler).call(receiver, value) === errorObj) {\n promise._reject(errorObj.e);\n }\n } else if (handler === reflectHandler) {\n promise._fulfill(reflectHandler.call(receiver));\n } else if (receiver instanceof Proxyable) {\n receiver._promiseCancelled(promise);\n } else if (isPromise || promise instanceof PromiseArray) {\n promise._cancel();\n } else {\n receiver.cancel();\n }\n } else if (typeof handler === \"function\") {\n if (!isPromise) {\n handler.call(receiver, value, promise);\n } else {\n if (asyncGuaranteed) promise._setAsyncGuaranteed();\n\n this._settlePromiseFromHandler(handler, receiver, value, promise);\n }\n } else if (receiver instanceof Proxyable) {\n if (!receiver._isResolved()) {\n if ((bitField & 33554432) !== 0) {\n receiver._promiseFulfilled(value, promise);\n } else {\n receiver._promiseRejected(value, promise);\n }\n }\n } else if (isPromise) {\n if (asyncGuaranteed) promise._setAsyncGuaranteed();\n\n if ((bitField & 33554432) !== 0) {\n promise._fulfill(value);\n } else {\n promise._reject(value);\n }\n }\n };\n\n Promise.prototype._settlePromiseLateCancellationObserver = function (ctx) {\n var handler = ctx.handler;\n var promise = ctx.promise;\n var receiver = ctx.receiver;\n var value = ctx.value;\n\n if (typeof handler === \"function\") {\n if (!(promise instanceof Promise)) {\n handler.call(receiver, value, promise);\n } else {\n this._settlePromiseFromHandler(handler, receiver, value, promise);\n }\n } else if (promise instanceof Promise) {\n promise._reject(value);\n }\n };\n\n Promise.prototype._settlePromiseCtx = function (ctx) {\n this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value);\n };\n\n Promise.prototype._settlePromise0 = function (handler, value, bitField) {\n var promise = this._promise0;\n\n var receiver = this._receiverAt(0);\n\n this._promise0 = undefined;\n this._receiver0 = undefined;\n\n this._settlePromise(promise, handler, receiver, value);\n };\n\n Promise.prototype._clearCallbackDataAtIndex = function (index) {\n var base = index * 4 - 4;\n this[base + 2] = this[base + 3] = this[base + 0] = this[base + 1] = undefined;\n };\n\n Promise.prototype._fulfill = function (value) {\n var bitField = this._bitField;\n if ((bitField & 117506048) >>> 16) return;\n\n if (value === this) {\n var err = makeSelfResolutionError();\n\n this._attachExtraTrace(err);\n\n return this._reject(err);\n }\n\n this._setFulfilled();\n\n this._rejectionHandler0 = value;\n\n if ((bitField & 65535) > 0) {\n if ((bitField & 134217728) !== 0) {\n this._settlePromises();\n } else {\n async.settlePromises(this);\n }\n\n this._dereferenceTrace();\n }\n };\n\n Promise.prototype._reject = function (reason) {\n var bitField = this._bitField;\n if ((bitField & 117506048) >>> 16) return;\n\n this._setRejected();\n\n this._fulfillmentHandler0 = reason;\n\n if (this._isFinal()) {\n return async.fatalError(reason, util.isNode);\n }\n\n if ((bitField & 65535) > 0) {\n async.settlePromises(this);\n } else {\n this._ensurePossibleRejectionHandled();\n }\n };\n\n Promise.prototype._fulfillPromises = function (len, value) {\n for (var i = 1; i < len; i++) {\n var handler = this._fulfillmentHandlerAt(i);\n\n var promise = this._promiseAt(i);\n\n var receiver = this._receiverAt(i);\n\n this._clearCallbackDataAtIndex(i);\n\n this._settlePromise(promise, handler, receiver, value);\n }\n };\n\n Promise.prototype._rejectPromises = function (len, reason) {\n for (var i = 1; i < len; i++) {\n var handler = this._rejectionHandlerAt(i);\n\n var promise = this._promiseAt(i);\n\n var receiver = this._receiverAt(i);\n\n this._clearCallbackDataAtIndex(i);\n\n this._settlePromise(promise, handler, receiver, reason);\n }\n };\n\n Promise.prototype._settlePromises = function () {\n var bitField = this._bitField;\n var len = bitField & 65535;\n\n if (len > 0) {\n if ((bitField & 16842752) !== 0) {\n var reason = this._fulfillmentHandler0;\n\n this._settlePromise0(this._rejectionHandler0, reason, bitField);\n\n this._rejectPromises(len, reason);\n } else {\n var value = this._rejectionHandler0;\n\n this._settlePromise0(this._fulfillmentHandler0, value, bitField);\n\n this._fulfillPromises(len, value);\n }\n\n this._setLength(0);\n }\n\n this._clearCancellationData();\n };\n\n Promise.prototype._settledValue = function () {\n var bitField = this._bitField;\n\n if ((bitField & 33554432) !== 0) {\n return this._rejectionHandler0;\n } else if ((bitField & 16777216) !== 0) {\n return this._fulfillmentHandler0;\n }\n };\n\n function deferResolve(v) {\n this.promise._resolveCallback(v);\n }\n\n function deferReject(v) {\n this.promise._rejectCallback(v, false);\n }\n\n Promise.defer = Promise.pending = function () {\n debug.deprecated(\"Promise.defer\", \"new Promise\");\n var promise = new Promise(INTERNAL);\n return {\n promise: promise,\n resolve: deferResolve,\n reject: deferReject\n };\n };\n\n util.notEnumerableProp(Promise, \"_makeSelfResolutionError\", makeSelfResolutionError);\n\n _dereq_(\"./method\")(Promise, INTERNAL, tryConvertToPromise, apiRejection, debug);\n\n _dereq_(\"./bind\")(Promise, INTERNAL, tryConvertToPromise, debug);\n\n _dereq_(\"./cancel\")(Promise, PromiseArray, apiRejection, debug);\n\n _dereq_(\"./direct_resolve\")(Promise);\n\n _dereq_(\"./synchronous_inspection\")(Promise);\n\n _dereq_(\"./join\")(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain);\n\n Promise.Promise = Promise;\n Promise.version = \"3.5.4\";\n\n _dereq_('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);\n\n _dereq_('./call_get.js')(Promise);\n\n _dereq_('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug);\n\n _dereq_('./timers.js')(Promise, INTERNAL, debug);\n\n _dereq_('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug);\n\n _dereq_('./nodeify.js')(Promise);\n\n _dereq_('./promisify.js')(Promise, INTERNAL);\n\n _dereq_('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection);\n\n _dereq_('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection);\n\n _dereq_('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);\n\n _dereq_('./settle.js')(Promise, PromiseArray, debug);\n\n _dereq_('./some.js')(Promise, PromiseArray, apiRejection);\n\n _dereq_('./filter.js')(Promise, INTERNAL);\n\n _dereq_('./each.js')(Promise, INTERNAL);\n\n _dereq_('./any.js')(Promise);\n\n util.toFastProperties(Promise);\n util.toFastProperties(Promise.prototype);\n\n function fillTypes(value) {\n var p = new Promise(INTERNAL);\n p._fulfillmentHandler0 = value;\n p._rejectionHandler0 = value;\n p._promise0 = value;\n p._receiver0 = value;\n } // Complete slack tracking, opt out of field-type tracking and \n // stabilize map \n\n\n fillTypes({\n a: 1\n });\n fillTypes({\n b: 2\n });\n fillTypes({\n c: 3\n });\n fillTypes(1);\n fillTypes(function () {});\n fillTypes(undefined);\n fillTypes(false);\n fillTypes(new Promise(INTERNAL));\n debug.setBounds(Async.firstLineError, util.lastLineError);\n return Promise;\n };\n }, {\n \"./any.js\": 1,\n \"./async\": 2,\n \"./bind\": 3,\n \"./call_get.js\": 5,\n \"./cancel\": 6,\n \"./catch_filter\": 7,\n \"./context\": 8,\n \"./debuggability\": 9,\n \"./direct_resolve\": 10,\n \"./each.js\": 11,\n \"./errors\": 12,\n \"./es5\": 13,\n \"./filter.js\": 14,\n \"./finally\": 15,\n \"./generators.js\": 16,\n \"./join\": 17,\n \"./map.js\": 18,\n \"./method\": 19,\n \"./nodeback\": 20,\n \"./nodeify.js\": 21,\n \"./promise_array\": 23,\n \"./promisify.js\": 24,\n \"./props.js\": 25,\n \"./race.js\": 27,\n \"./reduce.js\": 28,\n \"./settle.js\": 30,\n \"./some.js\": 31,\n \"./synchronous_inspection\": 32,\n \"./thenables\": 33,\n \"./timers.js\": 34,\n \"./using.js\": 35,\n \"./util\": 36\n }],\n 23: [function (_dereq_, module, exports) {\n \"use strict\";\n\n module.exports = function (Promise, INTERNAL, tryConvertToPromise, apiRejection, Proxyable) {\n var util = _dereq_(\"./util\");\n\n var isArray = util.isArray;\n\n function toResolutionValue(val) {\n switch (val) {\n case -2:\n return [];\n\n case -3:\n return {};\n\n case -6:\n return new Map();\n }\n }\n\n function PromiseArray(values) {\n var promise = this._promise = new Promise(INTERNAL);\n\n if (values instanceof Promise) {\n promise._propagateFrom(values, 3);\n }\n\n promise._setOnCancel(this);\n\n this._values = values;\n this._length = 0;\n this._totalResolved = 0;\n\n this._init(undefined, -2);\n }\n\n util.inherits(PromiseArray, Proxyable);\n\n PromiseArray.prototype.length = function () {\n return this._length;\n };\n\n PromiseArray.prototype.promise = function () {\n return this._promise;\n };\n\n PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) {\n var values = tryConvertToPromise(this._values, this._promise);\n\n if (values instanceof Promise) {\n values = values._target();\n var bitField = values._bitField;\n ;\n this._values = values;\n\n if ((bitField & 50397184) === 0) {\n this._promise._setAsyncGuaranteed();\n\n return values._then(init, this._reject, undefined, this, resolveValueIfEmpty);\n } else if ((bitField & 33554432) !== 0) {\n values = values._value();\n } else if ((bitField & 16777216) !== 0) {\n return this._reject(values._reason());\n } else {\n return this._cancel();\n }\n }\n\n values = util.asArray(values);\n\n if (values === null) {\n var err = apiRejection(\"expecting an array or an iterable object but got \" + util.classString(values)).reason();\n\n this._promise._rejectCallback(err, false);\n\n return;\n }\n\n if (values.length === 0) {\n if (resolveValueIfEmpty === -5) {\n this._resolveEmptyArray();\n } else {\n this._resolve(toResolutionValue(resolveValueIfEmpty));\n }\n\n return;\n }\n\n this._iterate(values);\n };\n\n PromiseArray.prototype._iterate = function (values) {\n var len = this.getActualLength(values.length);\n this._length = len;\n this._values = this.shouldCopyValues() ? new Array(len) : this._values;\n var result = this._promise;\n var isResolved = false;\n var bitField = null;\n\n for (var i = 0; i < len; ++i) {\n var maybePromise = tryConvertToPromise(values[i], result);\n\n if (maybePromise instanceof Promise) {\n maybePromise = maybePromise._target();\n bitField = maybePromise._bitField;\n } else {\n bitField = null;\n }\n\n if (isResolved) {\n if (bitField !== null) {\n maybePromise.suppressUnhandledRejections();\n }\n } else if (bitField !== null) {\n if ((bitField & 50397184) === 0) {\n maybePromise._proxy(this, i);\n\n this._values[i] = maybePromise;\n } else if ((bitField & 33554432) !== 0) {\n isResolved = this._promiseFulfilled(maybePromise._value(), i);\n } else if ((bitField & 16777216) !== 0) {\n isResolved = this._promiseRejected(maybePromise._reason(), i);\n } else {\n isResolved = this._promiseCancelled(i);\n }\n } else {\n isResolved = this._promiseFulfilled(maybePromise, i);\n }\n }\n\n if (!isResolved) result._setAsyncGuaranteed();\n };\n\n PromiseArray.prototype._isResolved = function () {\n return this._values === null;\n };\n\n PromiseArray.prototype._resolve = function (value) {\n this._values = null;\n\n this._promise._fulfill(value);\n };\n\n PromiseArray.prototype._cancel = function () {\n if (this._isResolved() || !this._promise._isCancellable()) return;\n this._values = null;\n\n this._promise._cancel();\n };\n\n PromiseArray.prototype._reject = function (reason) {\n this._values = null;\n\n this._promise._rejectCallback(reason, false);\n };\n\n PromiseArray.prototype._promiseFulfilled = function (value, index) {\n this._values[index] = value;\n var totalResolved = ++this._totalResolved;\n\n if (totalResolved >= this._length) {\n this._resolve(this._values);\n\n return true;\n }\n\n return false;\n };\n\n PromiseArray.prototype._promiseCancelled = function () {\n this._cancel();\n\n return true;\n };\n\n PromiseArray.prototype._promiseRejected = function (reason) {\n this._totalResolved++;\n\n this._reject(reason);\n\n return true;\n };\n\n PromiseArray.prototype._resultCancelled = function () {\n if (this._isResolved()) return;\n var values = this._values;\n\n this._cancel();\n\n if (values instanceof Promise) {\n values.cancel();\n } else {\n for (var i = 0; i < values.length; ++i) {\n if (values[i] instanceof Promise) {\n values[i].cancel();\n }\n }\n }\n };\n\n PromiseArray.prototype.shouldCopyValues = function () {\n return true;\n };\n\n PromiseArray.prototype.getActualLength = function (len) {\n return len;\n };\n\n return PromiseArray;\n };\n }, {\n \"./util\": 36\n }],\n 24: [function (_dereq_, module, exports) {\n \"use strict\";\n\n module.exports = function (Promise, INTERNAL) {\n var THIS = {};\n\n var util = _dereq_(\"./util\");\n\n var nodebackForPromise = _dereq_(\"./nodeback\");\n\n var withAppended = util.withAppended;\n var maybeWrapAsError = util.maybeWrapAsError;\n var canEvaluate = util.canEvaluate;\n\n var TypeError = _dereq_(\"./errors\").TypeError;\n\n var defaultSuffix = \"Async\";\n var defaultPromisified = {\n __isPromisified__: true\n };\n var noCopyProps = [\"arity\", \"length\", \"name\", \"arguments\", \"caller\", \"callee\", \"prototype\", \"__isPromisified__\"];\n var noCopyPropsPattern = new RegExp(\"^(?:\" + noCopyProps.join(\"|\") + \")$\");\n\n var defaultFilter = function defaultFilter(name) {\n return util.isIdentifier(name) && name.charAt(0) !== \"_\" && name !== \"constructor\";\n };\n\n function propsFilter(key) {\n return !noCopyPropsPattern.test(key);\n }\n\n function isPromisified(fn) {\n try {\n return fn.__isPromisified__ === true;\n } catch (e) {\n return false;\n }\n }\n\n function hasPromisified(obj, key, suffix) {\n var val = util.getDataPropertyOrDefault(obj, key + suffix, defaultPromisified);\n return val ? isPromisified(val) : false;\n }\n\n function checkValid(ret, suffix, suffixRegexp) {\n for (var i = 0; i < ret.length; i += 2) {\n var key = ret[i];\n\n if (suffixRegexp.test(key)) {\n var keyWithoutAsyncSuffix = key.replace(suffixRegexp, \"\");\n\n for (var j = 0; j < ret.length; j += 2) {\n if (ret[j] === keyWithoutAsyncSuffix) {\n throw new TypeError(\"Cannot promisify an API that has normal methods with '%s'-suffix\\n\\n See http://goo.gl/MqrFmX\\n\".replace(\"%s\", suffix));\n }\n }\n }\n }\n }\n\n function promisifiableMethods(obj, suffix, suffixRegexp, filter) {\n var keys = util.inheritedDataKeys(obj);\n var ret = [];\n\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n var value = obj[key];\n var passesDefaultFilter = filter === defaultFilter ? true : defaultFilter(key, value, obj);\n\n if (typeof value === \"function\" && !isPromisified(value) && !hasPromisified(obj, key, suffix) && filter(key, value, obj, passesDefaultFilter)) {\n ret.push(key, value);\n }\n }\n\n checkValid(ret, suffix, suffixRegexp);\n return ret;\n }\n\n var escapeIdentRegex = function escapeIdentRegex(str) {\n return str.replace(/([$])/, \"\\\\$\");\n };\n\n var makeNodePromisifiedEval;\n\n if (!true) {\n var switchCaseArgumentOrder = function switchCaseArgumentOrder(likelyArgumentCount) {\n var ret = [likelyArgumentCount];\n var min = Math.max(0, likelyArgumentCount - 1 - 3);\n\n for (var i = likelyArgumentCount - 1; i >= min; --i) {\n ret.push(i);\n }\n\n for (var i = likelyArgumentCount + 1; i <= 3; ++i) {\n ret.push(i);\n }\n\n return ret;\n };\n\n var argumentSequence = function argumentSequence(argumentCount) {\n return util.filledRange(argumentCount, \"_arg\", \"\");\n };\n\n var parameterDeclaration = function parameterDeclaration(parameterCount) {\n return util.filledRange(Math.max(parameterCount, 3), \"_arg\", \"\");\n };\n\n var parameterCount = function parameterCount(fn) {\n if (typeof fn.length === \"number\") {\n return Math.max(Math.min(fn.length, 1023 + 1), 0);\n }\n\n return 0;\n };\n\n makeNodePromisifiedEval = function makeNodePromisifiedEval(callback, receiver, originalName, fn, _, multiArgs) {\n var newParameterCount = Math.max(0, parameterCount(fn) - 1);\n var argumentOrder = switchCaseArgumentOrder(newParameterCount);\n var shouldProxyThis = typeof callback === \"string\" || receiver === THIS;\n\n function generateCallForArgumentCount(count) {\n var args = argumentSequence(count).join(\", \");\n var comma = count > 0 ? \", \" : \"\";\n var ret;\n\n if (shouldProxyThis) {\n ret = \"ret = callback.call(this, {{args}}, nodeback); break;\\n\";\n } else {\n ret = receiver === undefined ? \"ret = callback({{args}}, nodeback); break;\\n\" : \"ret = callback.call(receiver, {{args}}, nodeback); break;\\n\";\n }\n\n return ret.replace(\"{{args}}\", args).replace(\", \", comma);\n }\n\n function generateArgumentSwitchCase() {\n var ret = \"\";\n\n for (var i = 0; i < argumentOrder.length; ++i) {\n ret += \"case \" + argumentOrder[i] + \":\" + generateCallForArgumentCount(argumentOrder[i]);\n }\n\n ret += \" \\n\\\n default: \\n\\\n var args = new Array(len + 1); \\n\\\n var i = 0; \\n\\\n for (var i = 0; i < len; ++i) { \\n\\\n args[i] = arguments[i]; \\n\\\n } \\n\\\n args[i] = nodeback; \\n\\\n [CodeForCall] \\n\\\n break; \\n\\\n \".replace(\"[CodeForCall]\", shouldProxyThis ? \"ret = callback.apply(this, args);\\n\" : \"ret = callback.apply(receiver, args);\\n\");\n return ret;\n }\n\n var getFunctionCode = typeof callback === \"string\" ? \"this != null ? this['\" + callback + \"'] : fn\" : \"fn\";\n var body = \"'use strict'; \\n\\\n var ret = function (Parameters) { \\n\\\n 'use strict'; \\n\\\n var len = arguments.length; \\n\\\n var promise = new Promise(INTERNAL); \\n\\\n promise._captureStackTrace(); \\n\\\n var nodeback = nodebackForPromise(promise, \" + multiArgs + \"); \\n\\\n var ret; \\n\\\n var callback = tryCatch([GetFunctionCode]); \\n\\\n switch(len) { \\n\\\n [CodeForSwitchCase] \\n\\\n } \\n\\\n if (ret === errorObj) { \\n\\\n promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\\n\\\n } \\n\\\n if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); \\n\\\n return promise; \\n\\\n }; \\n\\\n notEnumerableProp(ret, '__isPromisified__', true); \\n\\\n return ret; \\n\\\n \".replace(\"[CodeForSwitchCase]\", generateArgumentSwitchCase()).replace(\"[GetFunctionCode]\", getFunctionCode);\n body = body.replace(\"Parameters\", parameterDeclaration(newParameterCount));\n return new Function(\"Promise\", \"fn\", \"receiver\", \"withAppended\", \"maybeWrapAsError\", \"nodebackForPromise\", \"tryCatch\", \"errorObj\", \"notEnumerableProp\", \"INTERNAL\", body)(Promise, fn, receiver, withAppended, maybeWrapAsError, nodebackForPromise, util.tryCatch, util.errorObj, util.notEnumerableProp, INTERNAL);\n };\n }\n\n function makeNodePromisifiedClosure(callback, receiver, _, fn, __, multiArgs) {\n var defaultThis = function () {\n return this;\n }();\n\n var method = callback;\n\n if (typeof method === \"string\") {\n callback = fn;\n }\n\n function promisified() {\n var _receiver = receiver;\n if (receiver === THIS) _receiver = this;\n var promise = new Promise(INTERNAL);\n\n promise._captureStackTrace();\n\n var cb = typeof method === \"string\" && this !== defaultThis ? this[method] : callback;\n var fn = nodebackForPromise(promise, multiArgs);\n\n try {\n cb.apply(_receiver, withAppended(arguments, fn));\n } catch (e) {\n promise._rejectCallback(maybeWrapAsError(e), true, true);\n }\n\n if (!promise._isFateSealed()) promise._setAsyncGuaranteed();\n return promise;\n }\n\n util.notEnumerableProp(promisified, \"__isPromisified__\", true);\n return promisified;\n }\n\n var makeNodePromisified = canEvaluate ? makeNodePromisifiedEval : makeNodePromisifiedClosure;\n\n function promisifyAll(obj, suffix, filter, promisifier, multiArgs) {\n var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + \"$\");\n var methods = promisifiableMethods(obj, suffix, suffixRegexp, filter);\n\n for (var i = 0, len = methods.length; i < len; i += 2) {\n var key = methods[i];\n var fn = methods[i + 1];\n var promisifiedKey = key + suffix;\n\n if (promisifier === makeNodePromisified) {\n obj[promisifiedKey] = makeNodePromisified(key, THIS, key, fn, suffix, multiArgs);\n } else {\n var promisified = promisifier(fn, function () {\n return makeNodePromisified(key, THIS, key, fn, suffix, multiArgs);\n });\n util.notEnumerableProp(promisified, \"__isPromisified__\", true);\n obj[promisifiedKey] = promisified;\n }\n }\n\n util.toFastProperties(obj);\n return obj;\n }\n\n function promisify(callback, receiver, multiArgs) {\n return makeNodePromisified(callback, receiver, undefined, callback, null, multiArgs);\n }\n\n Promise.promisify = function (fn, options) {\n if (typeof fn !== \"function\") {\n throw new TypeError(\"expecting a function but got \" + util.classString(fn));\n }\n\n if (isPromisified(fn)) {\n return fn;\n }\n\n options = Object(options);\n var receiver = options.context === undefined ? THIS : options.context;\n var multiArgs = !!options.multiArgs;\n var ret = promisify(fn, receiver, multiArgs);\n util.copyDescriptors(fn, ret, propsFilter);\n return ret;\n };\n\n Promise.promisifyAll = function (target, options) {\n if (typeof target !== \"function\" && _typeof(target) !== \"object\") {\n throw new TypeError(\"the target of promisifyAll must be an object or a function\\n\\n See http://goo.gl/MqrFmX\\n\");\n }\n\n options = Object(options);\n var multiArgs = !!options.multiArgs;\n var suffix = options.suffix;\n if (typeof suffix !== \"string\") suffix = defaultSuffix;\n var filter = options.filter;\n if (typeof filter !== \"function\") filter = defaultFilter;\n var promisifier = options.promisifier;\n if (typeof promisifier !== \"function\") promisifier = makeNodePromisified;\n\n if (!util.isIdentifier(suffix)) {\n throw new RangeError(\"suffix must be a valid identifier\\n\\n See http://goo.gl/MqrFmX\\n\");\n }\n\n var keys = util.inheritedDataKeys(target);\n\n for (var i = 0; i < keys.length; ++i) {\n var value = target[keys[i]];\n\n if (keys[i] !== \"constructor\" && util.isClass(value)) {\n promisifyAll(value.prototype, suffix, filter, promisifier, multiArgs);\n promisifyAll(value, suffix, filter, promisifier, multiArgs);\n }\n }\n\n return promisifyAll(target, suffix, filter, promisifier, multiArgs);\n };\n };\n }, {\n \"./errors\": 12,\n \"./nodeback\": 20,\n \"./util\": 36\n }],\n 25: [function (_dereq_, module, exports) {\n \"use strict\";\n\n module.exports = function (Promise, PromiseArray, tryConvertToPromise, apiRejection) {\n var util = _dereq_(\"./util\");\n\n var isObject = util.isObject;\n\n var es5 = _dereq_(\"./es5\");\n\n var Es6Map;\n if (typeof Map === \"function\") Es6Map = Map;\n\n var mapToEntries = function () {\n var index = 0;\n var size = 0;\n\n function extractEntry(value, key) {\n this[index] = value;\n this[index + size] = key;\n index++;\n }\n\n return function mapToEntries(map) {\n size = map.size;\n index = 0;\n var ret = new Array(map.size * 2);\n map.forEach(extractEntry, ret);\n return ret;\n };\n }();\n\n var entriesToMap = function entriesToMap(entries) {\n var ret = new Es6Map();\n var length = entries.length / 2 | 0;\n\n for (var i = 0; i < length; ++i) {\n var key = entries[length + i];\n var value = entries[i];\n ret.set(key, value);\n }\n\n return ret;\n };\n\n function PropertiesPromiseArray(obj) {\n var isMap = false;\n var entries;\n\n if (Es6Map !== undefined && obj instanceof Es6Map) {\n entries = mapToEntries(obj);\n isMap = true;\n } else {\n var keys = es5.keys(obj);\n var len = keys.length;\n entries = new Array(len * 2);\n\n for (var i = 0; i < len; ++i) {\n var key = keys[i];\n entries[i] = obj[key];\n entries[i + len] = key;\n }\n }\n\n this.constructor$(entries);\n this._isMap = isMap;\n\n this._init$(undefined, isMap ? -6 : -3);\n }\n\n util.inherits(PropertiesPromiseArray, PromiseArray);\n\n PropertiesPromiseArray.prototype._init = function () {};\n\n PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) {\n this._values[index] = value;\n var totalResolved = ++this._totalResolved;\n\n if (totalResolved >= this._length) {\n var val;\n\n if (this._isMap) {\n val = entriesToMap(this._values);\n } else {\n val = {};\n var keyOffset = this.length();\n\n for (var i = 0, len = this.length(); i < len; ++i) {\n val[this._values[i + keyOffset]] = this._values[i];\n }\n }\n\n this._resolve(val);\n\n return true;\n }\n\n return false;\n };\n\n PropertiesPromiseArray.prototype.shouldCopyValues = function () {\n return false;\n };\n\n PropertiesPromiseArray.prototype.getActualLength = function (len) {\n return len >> 1;\n };\n\n function props(promises) {\n var ret;\n var castValue = tryConvertToPromise(promises);\n\n if (!isObject(castValue)) {\n return apiRejection(\"cannot await properties of a non-object\\n\\n See http://goo.gl/MqrFmX\\n\");\n } else if (castValue instanceof Promise) {\n ret = castValue._then(Promise.props, undefined, undefined, undefined, undefined);\n } else {\n ret = new PropertiesPromiseArray(castValue).promise();\n }\n\n if (castValue instanceof Promise) {\n ret._propagateFrom(castValue, 2);\n }\n\n return ret;\n }\n\n Promise.prototype.props = function () {\n return props(this);\n };\n\n Promise.props = function (promises) {\n return props(promises);\n };\n };\n }, {\n \"./es5\": 13,\n \"./util\": 36\n }],\n 26: [function (_dereq_, module, exports) {\n \"use strict\";\n\n function arrayMove(src, srcIndex, dst, dstIndex, len) {\n for (var j = 0; j < len; ++j) {\n dst[j + dstIndex] = src[j + srcIndex];\n src[j + srcIndex] = void 0;\n }\n }\n\n function Queue(capacity) {\n this._capacity = capacity;\n this._length = 0;\n this._front = 0;\n }\n\n Queue.prototype._willBeOverCapacity = function (size) {\n return this._capacity < size;\n };\n\n Queue.prototype._pushOne = function (arg) {\n var length = this.length();\n\n this._checkCapacity(length + 1);\n\n var i = this._front + length & this._capacity - 1;\n this[i] = arg;\n this._length = length + 1;\n };\n\n Queue.prototype.push = function (fn, receiver, arg) {\n var length = this.length() + 3;\n\n if (this._willBeOverCapacity(length)) {\n this._pushOne(fn);\n\n this._pushOne(receiver);\n\n this._pushOne(arg);\n\n return;\n }\n\n var j = this._front + length - 3;\n\n this._checkCapacity(length);\n\n var wrapMask = this._capacity - 1;\n this[j + 0 & wrapMask] = fn;\n this[j + 1 & wrapMask] = receiver;\n this[j + 2 & wrapMask] = arg;\n this._length = length;\n };\n\n Queue.prototype.shift = function () {\n var front = this._front,\n ret = this[front];\n this[front] = undefined;\n this._front = front + 1 & this._capacity - 1;\n this._length--;\n return ret;\n };\n\n Queue.prototype.length = function () {\n return this._length;\n };\n\n Queue.prototype._checkCapacity = function (size) {\n if (this._capacity < size) {\n this._resizeTo(this._capacity << 1);\n }\n };\n\n Queue.prototype._resizeTo = function (capacity) {\n var oldCapacity = this._capacity;\n this._capacity = capacity;\n var front = this._front;\n var length = this._length;\n var moveItemsCount = front + length & oldCapacity - 1;\n arrayMove(this, 0, this, oldCapacity, moveItemsCount);\n };\n\n module.exports = Queue;\n }, {}],\n 27: [function (_dereq_, module, exports) {\n \"use strict\";\n\n module.exports = function (Promise, INTERNAL, tryConvertToPromise, apiRejection) {\n var util = _dereq_(\"./util\");\n\n var raceLater = function raceLater(promise) {\n return promise.then(function (array) {\n return race(array, promise);\n });\n };\n\n function race(promises, parent) {\n var maybePromise = tryConvertToPromise(promises);\n\n if (maybePromise instanceof Promise) {\n return raceLater(maybePromise);\n } else {\n promises = util.asArray(promises);\n if (promises === null) return apiRejection(\"expecting an array or an iterable object but got \" + util.classString(promises));\n }\n\n var ret = new Promise(INTERNAL);\n\n if (parent !== undefined) {\n ret._propagateFrom(parent, 3);\n }\n\n var fulfill = ret._fulfill;\n var reject = ret._reject;\n\n for (var i = 0, len = promises.length; i < len; ++i) {\n var val = promises[i];\n\n if (val === undefined && !(i in promises)) {\n continue;\n }\n\n Promise.cast(val)._then(fulfill, reject, undefined, ret, null);\n }\n\n return ret;\n }\n\n Promise.race = function (promises) {\n return race(promises, undefined);\n };\n\n Promise.prototype.race = function () {\n return race(this, undefined);\n };\n };\n }, {\n \"./util\": 36\n }],\n 28: [function (_dereq_, module, exports) {\n \"use strict\";\n\n module.exports = function (Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug) {\n var getDomain = Promise._getDomain;\n\n var util = _dereq_(\"./util\");\n\n var tryCatch = util.tryCatch;\n\n function ReductionPromiseArray(promises, fn, initialValue, _each) {\n this.constructor$(promises);\n var domain = getDomain();\n this._fn = domain === null ? fn : util.domainBind(domain, fn);\n\n if (initialValue !== undefined) {\n initialValue = Promise.resolve(initialValue);\n\n initialValue._attachCancellationCallback(this);\n }\n\n this._initialValue = initialValue;\n this._currentCancellable = null;\n\n if (_each === INTERNAL) {\n this._eachValues = Array(this._length);\n } else if (_each === 0) {\n this._eachValues = null;\n } else {\n this._eachValues = undefined;\n }\n\n this._promise._captureStackTrace();\n\n this._init$(undefined, -5);\n }\n\n util.inherits(ReductionPromiseArray, PromiseArray);\n\n ReductionPromiseArray.prototype._gotAccum = function (accum) {\n if (this._eachValues !== undefined && this._eachValues !== null && accum !== INTERNAL) {\n this._eachValues.push(accum);\n }\n };\n\n ReductionPromiseArray.prototype._eachComplete = function (value) {\n if (this._eachValues !== null) {\n this._eachValues.push(value);\n }\n\n return this._eachValues;\n };\n\n ReductionPromiseArray.prototype._init = function () {};\n\n ReductionPromiseArray.prototype._resolveEmptyArray = function () {\n this._resolve(this._eachValues !== undefined ? this._eachValues : this._initialValue);\n };\n\n ReductionPromiseArray.prototype.shouldCopyValues = function () {\n return false;\n };\n\n ReductionPromiseArray.prototype._resolve = function (value) {\n this._promise._resolveCallback(value);\n\n this._values = null;\n };\n\n ReductionPromiseArray.prototype._resultCancelled = function (sender) {\n if (sender === this._initialValue) return this._cancel();\n if (this._isResolved()) return;\n\n this._resultCancelled$();\n\n if (this._currentCancellable instanceof Promise) {\n this._currentCancellable.cancel();\n }\n\n if (this._initialValue instanceof Promise) {\n this._initialValue.cancel();\n }\n };\n\n ReductionPromiseArray.prototype._iterate = function (values) {\n this._values = values;\n var value;\n var i;\n var length = values.length;\n\n if (this._initialValue !== undefined) {\n value = this._initialValue;\n i = 0;\n } else {\n value = Promise.resolve(values[0]);\n i = 1;\n }\n\n this._currentCancellable = value;\n\n if (!value.isRejected()) {\n for (; i < length; ++i) {\n var ctx = {\n accum: null,\n value: values[i],\n index: i,\n length: length,\n array: this\n };\n value = value._then(gotAccum, undefined, undefined, ctx, undefined);\n }\n }\n\n if (this._eachValues !== undefined) {\n value = value._then(this._eachComplete, undefined, undefined, this, undefined);\n }\n\n value._then(completed, completed, undefined, value, this);\n };\n\n Promise.prototype.reduce = function (fn, initialValue) {\n return reduce(this, fn, initialValue, null);\n };\n\n Promise.reduce = function (promises, fn, initialValue, _each) {\n return reduce(promises, fn, initialValue, _each);\n };\n\n function completed(valueOrReason, array) {\n if (this.isFulfilled()) {\n array._resolve(valueOrReason);\n } else {\n array._reject(valueOrReason);\n }\n }\n\n function reduce(promises, fn, initialValue, _each) {\n if (typeof fn !== \"function\") {\n return apiRejection(\"expecting a function but got \" + util.classString(fn));\n }\n\n var array = new ReductionPromiseArray(promises, fn, initialValue, _each);\n return array.promise();\n }\n\n function gotAccum(accum) {\n this.accum = accum;\n\n this.array._gotAccum(accum);\n\n var value = tryConvertToPromise(this.value, this.array._promise);\n\n if (value instanceof Promise) {\n this.array._currentCancellable = value;\n return value._then(gotValue, undefined, undefined, this, undefined);\n } else {\n return gotValue.call(this, value);\n }\n }\n\n function gotValue(value) {\n var array = this.array;\n var promise = array._promise;\n var fn = tryCatch(array._fn);\n\n promise._pushContext();\n\n var ret;\n\n if (array._eachValues !== undefined) {\n ret = fn.call(promise._boundValue(), value, this.index, this.length);\n } else {\n ret = fn.call(promise._boundValue(), this.accum, value, this.index, this.length);\n }\n\n if (ret instanceof Promise) {\n array._currentCancellable = ret;\n }\n\n var promiseCreated = promise._popContext();\n\n debug.checkForgottenReturns(ret, promiseCreated, array._eachValues !== undefined ? \"Promise.each\" : \"Promise.reduce\", promise);\n return ret;\n }\n };\n }, {\n \"./util\": 36\n }],\n 29: [function (_dereq_, module, exports) {\n \"use strict\";\n\n var util = _dereq_(\"./util\");\n\n var schedule;\n\n var noAsyncScheduler = function noAsyncScheduler() {\n throw new Error(\"No async scheduler available\\n\\n See http://goo.gl/MqrFmX\\n\");\n };\n\n var NativePromise = util.getNativePromise();\n\n if (util.isNode && typeof MutationObserver === \"undefined\") {\n var GlobalSetImmediate = global.setImmediate;\n var ProcessNextTick = process.nextTick;\n schedule = util.isRecentNode ? function (fn) {\n GlobalSetImmediate.call(global, fn);\n } : function (fn) {\n ProcessNextTick.call(process, fn);\n };\n } else if (typeof NativePromise === \"function\" && typeof NativePromise.resolve === \"function\") {\n var nativePromise = NativePromise.resolve();\n\n schedule = function schedule(fn) {\n nativePromise.then(fn);\n };\n } else if (typeof MutationObserver !== \"undefined\" && !(typeof window !== \"undefined\" && window.navigator && (window.navigator.standalone || window.cordova))) {\n schedule = function () {\n var div = document.createElement(\"div\");\n var opts = {\n attributes: true\n };\n var toggleScheduled = false;\n var div2 = document.createElement(\"div\");\n var o2 = new MutationObserver(function () {\n div.classList.toggle(\"foo\");\n toggleScheduled = false;\n });\n o2.observe(div2, opts);\n\n var scheduleToggle = function scheduleToggle() {\n if (toggleScheduled) return;\n toggleScheduled = true;\n div2.classList.toggle(\"foo\");\n };\n\n return function schedule(fn) {\n var o = new MutationObserver(function () {\n o.disconnect();\n fn();\n });\n o.observe(div, opts);\n scheduleToggle();\n };\n }();\n } else if (typeof setImmediate !== \"undefined\") {\n schedule = function schedule(fn) {\n setImmediate(fn);\n };\n } else if (typeof setTimeout !== \"undefined\") {\n schedule = function schedule(fn) {\n setTimeout(fn, 0);\n };\n } else {\n schedule = noAsyncScheduler;\n }\n\n module.exports = schedule;\n }, {\n \"./util\": 36\n }],\n 30: [function (_dereq_, module, exports) {\n \"use strict\";\n\n module.exports = function (Promise, PromiseArray, debug) {\n var PromiseInspection = Promise.PromiseInspection;\n\n var util = _dereq_(\"./util\");\n\n function SettledPromiseArray(values) {\n this.constructor$(values);\n }\n\n util.inherits(SettledPromiseArray, PromiseArray);\n\n SettledPromiseArray.prototype._promiseResolved = function (index, inspection) {\n this._values[index] = inspection;\n var totalResolved = ++this._totalResolved;\n\n if (totalResolved >= this._length) {\n this._resolve(this._values);\n\n return true;\n }\n\n return false;\n };\n\n SettledPromiseArray.prototype._promiseFulfilled = function (value, index) {\n var ret = new PromiseInspection();\n ret._bitField = 33554432;\n ret._settledValueField = value;\n return this._promiseResolved(index, ret);\n };\n\n SettledPromiseArray.prototype._promiseRejected = function (reason, index) {\n var ret = new PromiseInspection();\n ret._bitField = 16777216;\n ret._settledValueField = reason;\n return this._promiseResolved(index, ret);\n };\n\n Promise.settle = function (promises) {\n debug.deprecated(\".settle()\", \".reflect()\");\n return new SettledPromiseArray(promises).promise();\n };\n\n Promise.prototype.settle = function () {\n return Promise.settle(this);\n };\n };\n }, {\n \"./util\": 36\n }],\n 31: [function (_dereq_, module, exports) {\n \"use strict\";\n\n module.exports = function (Promise, PromiseArray, apiRejection) {\n var util = _dereq_(\"./util\");\n\n var RangeError = _dereq_(\"./errors\").RangeError;\n\n var AggregateError = _dereq_(\"./errors\").AggregateError;\n\n var isArray = util.isArray;\n var CANCELLATION = {};\n\n function SomePromiseArray(values) {\n this.constructor$(values);\n this._howMany = 0;\n this._unwrap = false;\n this._initialized = false;\n }\n\n util.inherits(SomePromiseArray, PromiseArray);\n\n SomePromiseArray.prototype._init = function () {\n if (!this._initialized) {\n return;\n }\n\n if (this._howMany === 0) {\n this._resolve([]);\n\n return;\n }\n\n this._init$(undefined, -5);\n\n var isArrayResolved = isArray(this._values);\n\n if (!this._isResolved() && isArrayResolved && this._howMany > this._canPossiblyFulfill()) {\n this._reject(this._getRangeError(this.length()));\n }\n };\n\n SomePromiseArray.prototype.init = function () {\n this._initialized = true;\n\n this._init();\n };\n\n SomePromiseArray.prototype.setUnwrap = function () {\n this._unwrap = true;\n };\n\n SomePromiseArray.prototype.howMany = function () {\n return this._howMany;\n };\n\n SomePromiseArray.prototype.setHowMany = function (count) {\n this._howMany = count;\n };\n\n SomePromiseArray.prototype._promiseFulfilled = function (value) {\n this._addFulfilled(value);\n\n if (this._fulfilled() === this.howMany()) {\n this._values.length = this.howMany();\n\n if (this.howMany() === 1 && this._unwrap) {\n this._resolve(this._values[0]);\n } else {\n this._resolve(this._values);\n }\n\n return true;\n }\n\n return false;\n };\n\n SomePromiseArray.prototype._promiseRejected = function (reason) {\n this._addRejected(reason);\n\n return this._checkOutcome();\n };\n\n SomePromiseArray.prototype._promiseCancelled = function () {\n if (this._values instanceof Promise || this._values == null) {\n return this._cancel();\n }\n\n this._addRejected(CANCELLATION);\n\n return this._checkOutcome();\n };\n\n SomePromiseArray.prototype._checkOutcome = function () {\n if (this.howMany() > this._canPossiblyFulfill()) {\n var e = new AggregateError();\n\n for (var i = this.length(); i < this._values.length; ++i) {\n if (this._values[i] !== CANCELLATION) {\n e.push(this._values[i]);\n }\n }\n\n if (e.length > 0) {\n this._reject(e);\n } else {\n this._cancel();\n }\n\n return true;\n }\n\n return false;\n };\n\n SomePromiseArray.prototype._fulfilled = function () {\n return this._totalResolved;\n };\n\n SomePromiseArray.prototype._rejected = function () {\n return this._values.length - this.length();\n };\n\n SomePromiseArray.prototype._addRejected = function (reason) {\n this._values.push(reason);\n };\n\n SomePromiseArray.prototype._addFulfilled = function (value) {\n this._values[this._totalResolved++] = value;\n };\n\n SomePromiseArray.prototype._canPossiblyFulfill = function () {\n return this.length() - this._rejected();\n };\n\n SomePromiseArray.prototype._getRangeError = function (count) {\n var message = \"Input array must contain at least \" + this._howMany + \" items but contains only \" + count + \" items\";\n return new RangeError(message);\n };\n\n SomePromiseArray.prototype._resolveEmptyArray = function () {\n this._reject(this._getRangeError(0));\n };\n\n function some(promises, howMany) {\n if ((howMany | 0) !== howMany || howMany < 0) {\n return apiRejection(\"expecting a positive integer\\n\\n See http://goo.gl/MqrFmX\\n\");\n }\n\n var ret = new SomePromiseArray(promises);\n var promise = ret.promise();\n ret.setHowMany(howMany);\n ret.init();\n return promise;\n }\n\n Promise.some = function (promises, howMany) {\n return some(promises, howMany);\n };\n\n Promise.prototype.some = function (howMany) {\n return some(this, howMany);\n };\n\n Promise._SomePromiseArray = SomePromiseArray;\n };\n }, {\n \"./errors\": 12,\n \"./util\": 36\n }],\n 32: [function (_dereq_, module, exports) {\n \"use strict\";\n\n module.exports = function (Promise) {\n function PromiseInspection(promise) {\n if (promise !== undefined) {\n promise = promise._target();\n this._bitField = promise._bitField;\n this._settledValueField = promise._isFateSealed() ? promise._settledValue() : undefined;\n } else {\n this._bitField = 0;\n this._settledValueField = undefined;\n }\n }\n\n PromiseInspection.prototype._settledValue = function () {\n return this._settledValueField;\n };\n\n var value = PromiseInspection.prototype.value = function () {\n if (!this.isFulfilled()) {\n throw new TypeError(\"cannot get fulfillment value of a non-fulfilled promise\\n\\n See http://goo.gl/MqrFmX\\n\");\n }\n\n return this._settledValue();\n };\n\n var reason = PromiseInspection.prototype.error = PromiseInspection.prototype.reason = function () {\n if (!this.isRejected()) {\n throw new TypeError(\"cannot get rejection reason of a non-rejected promise\\n\\n See http://goo.gl/MqrFmX\\n\");\n }\n\n return this._settledValue();\n };\n\n var isFulfilled = PromiseInspection.prototype.isFulfilled = function () {\n return (this._bitField & 33554432) !== 0;\n };\n\n var isRejected = PromiseInspection.prototype.isRejected = function () {\n return (this._bitField & 16777216) !== 0;\n };\n\n var isPending = PromiseInspection.prototype.isPending = function () {\n return (this._bitField & 50397184) === 0;\n };\n\n var isResolved = PromiseInspection.prototype.isResolved = function () {\n return (this._bitField & 50331648) !== 0;\n };\n\n PromiseInspection.prototype.isCancelled = function () {\n return (this._bitField & 8454144) !== 0;\n };\n\n Promise.prototype.__isCancelled = function () {\n return (this._bitField & 65536) === 65536;\n };\n\n Promise.prototype._isCancelled = function () {\n return this._target().__isCancelled();\n };\n\n Promise.prototype.isCancelled = function () {\n return (this._target()._bitField & 8454144) !== 0;\n };\n\n Promise.prototype.isPending = function () {\n return isPending.call(this._target());\n };\n\n Promise.prototype.isRejected = function () {\n return isRejected.call(this._target());\n };\n\n Promise.prototype.isFulfilled = function () {\n return isFulfilled.call(this._target());\n };\n\n Promise.prototype.isResolved = function () {\n return isResolved.call(this._target());\n };\n\n Promise.prototype.value = function () {\n return value.call(this._target());\n };\n\n Promise.prototype.reason = function () {\n var target = this._target();\n\n target._unsetRejectionIsUnhandled();\n\n return reason.call(target);\n };\n\n Promise.prototype._value = function () {\n return this._settledValue();\n };\n\n Promise.prototype._reason = function () {\n this._unsetRejectionIsUnhandled();\n\n return this._settledValue();\n };\n\n Promise.PromiseInspection = PromiseInspection;\n };\n }, {}],\n 33: [function (_dereq_, module, exports) {\n \"use strict\";\n\n module.exports = function (Promise, INTERNAL) {\n var util = _dereq_(\"./util\");\n\n var errorObj = util.errorObj;\n var isObject = util.isObject;\n\n function tryConvertToPromise(obj, context) {\n if (isObject(obj)) {\n if (obj instanceof Promise) return obj;\n var then = getThen(obj);\n\n if (then === errorObj) {\n if (context) context._pushContext();\n var ret = Promise.reject(then.e);\n if (context) context._popContext();\n return ret;\n } else if (typeof then === \"function\") {\n if (isAnyBluebirdPromise(obj)) {\n var ret = new Promise(INTERNAL);\n\n obj._then(ret._fulfill, ret._reject, undefined, ret, null);\n\n return ret;\n }\n\n return doThenable(obj, then, context);\n }\n }\n\n return obj;\n }\n\n function doGetThen(obj) {\n return obj.then;\n }\n\n function getThen(obj) {\n try {\n return doGetThen(obj);\n } catch (e) {\n errorObj.e = e;\n return errorObj;\n }\n }\n\n var hasProp = {}.hasOwnProperty;\n\n function isAnyBluebirdPromise(obj) {\n try {\n return hasProp.call(obj, \"_promise0\");\n } catch (e) {\n return false;\n }\n }\n\n function doThenable(x, then, context) {\n var promise = new Promise(INTERNAL);\n var ret = promise;\n if (context) context._pushContext();\n\n promise._captureStackTrace();\n\n if (context) context._popContext();\n var synchronous = true;\n var result = util.tryCatch(then).call(x, resolve, reject);\n synchronous = false;\n\n if (promise && result === errorObj) {\n promise._rejectCallback(result.e, true, true);\n\n promise = null;\n }\n\n function resolve(value) {\n if (!promise) return;\n\n promise._resolveCallback(value);\n\n promise = null;\n }\n\n function reject(reason) {\n if (!promise) return;\n\n promise._rejectCallback(reason, synchronous, true);\n\n promise = null;\n }\n\n return ret;\n }\n\n return tryConvertToPromise;\n };\n }, {\n \"./util\": 36\n }],\n 34: [function (_dereq_, module, exports) {\n \"use strict\";\n\n module.exports = function (Promise, INTERNAL, debug) {\n var util = _dereq_(\"./util\");\n\n var TimeoutError = Promise.TimeoutError;\n\n function HandleWrapper(handle) {\n this.handle = handle;\n }\n\n HandleWrapper.prototype._resultCancelled = function () {\n clearTimeout(this.handle);\n };\n\n var afterValue = function afterValue(value) {\n return delay(+this).thenReturn(value);\n };\n\n var delay = Promise.delay = function (ms, value) {\n var ret;\n var handle;\n\n if (value !== undefined) {\n ret = Promise.resolve(value)._then(afterValue, null, null, ms, undefined);\n\n if (debug.cancellation() && value instanceof Promise) {\n ret._setOnCancel(value);\n }\n } else {\n ret = new Promise(INTERNAL);\n handle = setTimeout(function () {\n ret._fulfill();\n }, +ms);\n\n if (debug.cancellation()) {\n ret._setOnCancel(new HandleWrapper(handle));\n }\n\n ret._captureStackTrace();\n }\n\n ret._setAsyncGuaranteed();\n\n return ret;\n };\n\n Promise.prototype.delay = function (ms) {\n return delay(ms, this);\n };\n\n var afterTimeout = function afterTimeout(promise, message, parent) {\n var err;\n\n if (typeof message !== \"string\") {\n if (message instanceof Error) {\n err = message;\n } else {\n err = new TimeoutError(\"operation timed out\");\n }\n } else {\n err = new TimeoutError(message);\n }\n\n util.markAsOriginatingFromRejection(err);\n\n promise._attachExtraTrace(err);\n\n promise._reject(err);\n\n if (parent != null) {\n parent.cancel();\n }\n };\n\n function successClear(value) {\n clearTimeout(this.handle);\n return value;\n }\n\n function failureClear(reason) {\n clearTimeout(this.handle);\n throw reason;\n }\n\n Promise.prototype.timeout = function (ms, message) {\n ms = +ms;\n var ret, parent;\n var handleWrapper = new HandleWrapper(setTimeout(function timeoutTimeout() {\n if (ret.isPending()) {\n afterTimeout(ret, message, parent);\n }\n }, ms));\n\n if (debug.cancellation()) {\n parent = this.then();\n ret = parent._then(successClear, failureClear, undefined, handleWrapper, undefined);\n\n ret._setOnCancel(handleWrapper);\n } else {\n ret = this._then(successClear, failureClear, undefined, handleWrapper, undefined);\n }\n\n return ret;\n };\n };\n }, {\n \"./util\": 36\n }],\n 35: [function (_dereq_, module, exports) {\n \"use strict\";\n\n module.exports = function (Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug) {\n var util = _dereq_(\"./util\");\n\n var TypeError = _dereq_(\"./errors\").TypeError;\n\n var inherits = _dereq_(\"./util\").inherits;\n\n var errorObj = util.errorObj;\n var tryCatch = util.tryCatch;\n var NULL = {};\n\n function thrower(e) {\n setTimeout(function () {\n throw e;\n }, 0);\n }\n\n function castPreservingDisposable(thenable) {\n var maybePromise = tryConvertToPromise(thenable);\n\n if (maybePromise !== thenable && typeof thenable._isDisposable === \"function\" && typeof thenable._getDisposer === \"function\" && thenable._isDisposable()) {\n maybePromise._setDisposable(thenable._getDisposer());\n }\n\n return maybePromise;\n }\n\n function dispose(resources, inspection) {\n var i = 0;\n var len = resources.length;\n var ret = new Promise(INTERNAL);\n\n function iterator() {\n if (i >= len) return ret._fulfill();\n var maybePromise = castPreservingDisposable(resources[i++]);\n\n if (maybePromise instanceof Promise && maybePromise._isDisposable()) {\n try {\n maybePromise = tryConvertToPromise(maybePromise._getDisposer().tryDispose(inspection), resources.promise);\n } catch (e) {\n return thrower(e);\n }\n\n if (maybePromise instanceof Promise) {\n return maybePromise._then(iterator, thrower, null, null, null);\n }\n }\n\n iterator();\n }\n\n iterator();\n return ret;\n }\n\n function Disposer(data, promise, context) {\n this._data = data;\n this._promise = promise;\n this._context = context;\n }\n\n Disposer.prototype.data = function () {\n return this._data;\n };\n\n Disposer.prototype.promise = function () {\n return this._promise;\n };\n\n Disposer.prototype.resource = function () {\n if (this.promise().isFulfilled()) {\n return this.promise().value();\n }\n\n return NULL;\n };\n\n Disposer.prototype.tryDispose = function (inspection) {\n var resource = this.resource();\n var context = this._context;\n if (context !== undefined) context._pushContext();\n var ret = resource !== NULL ? this.doDispose(resource, inspection) : null;\n if (context !== undefined) context._popContext();\n\n this._promise._unsetDisposable();\n\n this._data = null;\n return ret;\n };\n\n Disposer.isDisposer = function (d) {\n return d != null && typeof d.resource === \"function\" && typeof d.tryDispose === \"function\";\n };\n\n function FunctionDisposer(fn, promise, context) {\n this.constructor$(fn, promise, context);\n }\n\n inherits(FunctionDisposer, Disposer);\n\n FunctionDisposer.prototype.doDispose = function (resource, inspection) {\n var fn = this.data();\n return fn.call(resource, resource, inspection);\n };\n\n function maybeUnwrapDisposer(value) {\n if (Disposer.isDisposer(value)) {\n this.resources[this.index]._setDisposable(value);\n\n return value.promise();\n }\n\n return value;\n }\n\n function ResourceList(length) {\n this.length = length;\n this.promise = null;\n this[length - 1] = null;\n }\n\n ResourceList.prototype._resultCancelled = function () {\n var len = this.length;\n\n for (var i = 0; i < len; ++i) {\n var item = this[i];\n\n if (item instanceof Promise) {\n item.cancel();\n }\n }\n };\n\n Promise.using = function () {\n var len = arguments.length;\n if (len < 2) return apiRejection(\"you must pass at least 2 arguments to Promise.using\");\n var fn = arguments[len - 1];\n\n if (typeof fn !== \"function\") {\n return apiRejection(\"expecting a function but got \" + util.classString(fn));\n }\n\n var input;\n var spreadArgs = true;\n\n if (len === 2 && Array.isArray(arguments[0])) {\n input = arguments[0];\n len = input.length;\n spreadArgs = false;\n } else {\n input = arguments;\n len--;\n }\n\n var resources = new ResourceList(len);\n\n for (var i = 0; i < len; ++i) {\n var resource = input[i];\n\n if (Disposer.isDisposer(resource)) {\n var disposer = resource;\n resource = resource.promise();\n\n resource._setDisposable(disposer);\n } else {\n var maybePromise = tryConvertToPromise(resource);\n\n if (maybePromise instanceof Promise) {\n resource = maybePromise._then(maybeUnwrapDisposer, null, null, {\n resources: resources,\n index: i\n }, undefined);\n }\n }\n\n resources[i] = resource;\n }\n\n var reflectedResources = new Array(resources.length);\n\n for (var i = 0; i < reflectedResources.length; ++i) {\n reflectedResources[i] = Promise.resolve(resources[i]).reflect();\n }\n\n var resultPromise = Promise.all(reflectedResources).then(function (inspections) {\n for (var i = 0; i < inspections.length; ++i) {\n var inspection = inspections[i];\n\n if (inspection.isRejected()) {\n errorObj.e = inspection.error();\n return errorObj;\n } else if (!inspection.isFulfilled()) {\n resultPromise.cancel();\n return;\n }\n\n inspections[i] = inspection.value();\n }\n\n promise._pushContext();\n\n fn = tryCatch(fn);\n var ret = spreadArgs ? fn.apply(undefined, inspections) : fn(inspections);\n\n var promiseCreated = promise._popContext();\n\n debug.checkForgottenReturns(ret, promiseCreated, \"Promise.using\", promise);\n return ret;\n });\n var promise = resultPromise.lastly(function () {\n var inspection = new Promise.PromiseInspection(resultPromise);\n return dispose(resources, inspection);\n });\n resources.promise = promise;\n\n promise._setOnCancel(resources);\n\n return promise;\n };\n\n Promise.prototype._setDisposable = function (disposer) {\n this._bitField = this._bitField | 131072;\n this._disposer = disposer;\n };\n\n Promise.prototype._isDisposable = function () {\n return (this._bitField & 131072) > 0;\n };\n\n Promise.prototype._getDisposer = function () {\n return this._disposer;\n };\n\n Promise.prototype._unsetDisposable = function () {\n this._bitField = this._bitField & ~131072;\n this._disposer = undefined;\n };\n\n Promise.prototype.disposer = function (fn) {\n if (typeof fn === \"function\") {\n return new FunctionDisposer(fn, this, createContext());\n }\n\n throw new TypeError();\n };\n };\n }, {\n \"./errors\": 12,\n \"./util\": 36\n }],\n 36: [function (_dereq_, module, exports) {\n \"use strict\";\n\n var es5 = _dereq_(\"./es5\");\n\n var canEvaluate = typeof navigator == \"undefined\";\n var errorObj = {\n e: {}\n };\n var tryCatchTarget;\n var globalObject = typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : typeof global !== \"undefined\" ? global : this !== undefined ? this : null;\n\n function tryCatcher() {\n try {\n var target = tryCatchTarget;\n tryCatchTarget = null;\n return target.apply(this, arguments);\n } catch (e) {\n errorObj.e = e;\n return errorObj;\n }\n }\n\n function tryCatch(fn) {\n tryCatchTarget = fn;\n return tryCatcher;\n }\n\n var inherits = function inherits(Child, Parent) {\n var hasProp = {}.hasOwnProperty;\n\n function T() {\n this.constructor = Child;\n this.constructor$ = Parent;\n\n for (var propertyName in Parent.prototype) {\n if (hasProp.call(Parent.prototype, propertyName) && propertyName.charAt(propertyName.length - 1) !== \"$\") {\n this[propertyName + \"$\"] = Parent.prototype[propertyName];\n }\n }\n }\n\n T.prototype = Parent.prototype;\n Child.prototype = new T();\n return Child.prototype;\n };\n\n function isPrimitive(val) {\n return val == null || val === true || val === false || typeof val === \"string\" || typeof val === \"number\";\n }\n\n function isObject(value) {\n return typeof value === \"function\" || _typeof(value) === \"object\" && value !== null;\n }\n\n function maybeWrapAsError(maybeError) {\n if (!isPrimitive(maybeError)) return maybeError;\n return new Error(safeToString(maybeError));\n }\n\n function withAppended(target, appendee) {\n var len = target.length;\n var ret = new Array(len + 1);\n var i;\n\n for (i = 0; i < len; ++i) {\n ret[i] = target[i];\n }\n\n ret[i] = appendee;\n return ret;\n }\n\n function getDataPropertyOrDefault(obj, key, defaultValue) {\n if (es5.isES5) {\n var desc = Object.getOwnPropertyDescriptor(obj, key);\n\n if (desc != null) {\n return desc.get == null && desc.set == null ? desc.value : defaultValue;\n }\n } else {\n return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined;\n }\n }\n\n function notEnumerableProp(obj, name, value) {\n if (isPrimitive(obj)) return obj;\n var descriptor = {\n value: value,\n configurable: true,\n enumerable: false,\n writable: true\n };\n es5.defineProperty(obj, name, descriptor);\n return obj;\n }\n\n function thrower(r) {\n throw r;\n }\n\n var inheritedDataKeys = function () {\n var excludedPrototypes = [Array.prototype, Object.prototype, Function.prototype];\n\n var isExcludedProto = function isExcludedProto(val) {\n for (var i = 0; i < excludedPrototypes.length; ++i) {\n if (excludedPrototypes[i] === val) {\n return true;\n }\n }\n\n return false;\n };\n\n if (es5.isES5) {\n var getKeys = Object.getOwnPropertyNames;\n return function (obj) {\n var ret = [];\n var visitedKeys = Object.create(null);\n\n while (obj != null && !isExcludedProto(obj)) {\n var keys;\n\n try {\n keys = getKeys(obj);\n } catch (e) {\n return ret;\n }\n\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n if (visitedKeys[key]) continue;\n visitedKeys[key] = true;\n var desc = Object.getOwnPropertyDescriptor(obj, key);\n\n if (desc != null && desc.get == null && desc.set == null) {\n ret.push(key);\n }\n }\n\n obj = es5.getPrototypeOf(obj);\n }\n\n return ret;\n };\n } else {\n var hasProp = {}.hasOwnProperty;\n return function (obj) {\n if (isExcludedProto(obj)) return [];\n var ret = [];\n /*jshint forin:false */\n\n enumeration: for (var key in obj) {\n if (hasProp.call(obj, key)) {\n ret.push(key);\n } else {\n for (var i = 0; i < excludedPrototypes.length; ++i) {\n if (hasProp.call(excludedPrototypes[i], key)) {\n continue enumeration;\n }\n }\n\n ret.push(key);\n }\n }\n\n return ret;\n };\n }\n }();\n\n var thisAssignmentPattern = /this\\s*\\.\\s*\\S+\\s*=/;\n\n function isClass(fn) {\n try {\n if (typeof fn === \"function\") {\n var keys = es5.names(fn.prototype);\n var hasMethods = es5.isES5 && keys.length > 1;\n var hasMethodsOtherThanConstructor = keys.length > 0 && !(keys.length === 1 && keys[0] === \"constructor\");\n var hasThisAssignmentAndStaticMethods = thisAssignmentPattern.test(fn + \"\") && es5.names(fn).length > 0;\n\n if (hasMethods || hasMethodsOtherThanConstructor || hasThisAssignmentAndStaticMethods) {\n return true;\n }\n }\n\n return false;\n } catch (e) {\n return false;\n }\n }\n\n function toFastProperties(obj) {\n /*jshint -W027,-W055,-W031*/\n function FakeConstructor() {}\n\n FakeConstructor.prototype = obj;\n var receiver = new FakeConstructor();\n\n function ic() {\n return _typeof(receiver.foo);\n }\n\n ic();\n ic();\n return obj;\n eval(obj);\n }\n\n var rident = /^[a-z$_][a-z$_0-9]*$/i;\n\n function isIdentifier(str) {\n return rident.test(str);\n }\n\n function filledRange(count, prefix, suffix) {\n var ret = new Array(count);\n\n for (var i = 0; i < count; ++i) {\n ret[i] = prefix + i + suffix;\n }\n\n return ret;\n }\n\n function safeToString(obj) {\n try {\n return obj + \"\";\n } catch (e) {\n return \"[no string representation]\";\n }\n }\n\n function isError(obj) {\n return obj instanceof Error || obj !== null && _typeof(obj) === \"object\" && typeof obj.message === \"string\" && typeof obj.name === \"string\";\n }\n\n function markAsOriginatingFromRejection(e) {\n try {\n notEnumerableProp(e, \"isOperational\", true);\n } catch (ignore) {}\n }\n\n function originatesFromRejection(e) {\n if (e == null) return false;\n return e instanceof Error[\"__BluebirdErrorTypes__\"].OperationalError || e[\"isOperational\"] === true;\n }\n\n function canAttachTrace(obj) {\n return isError(obj) && es5.propertyIsWritable(obj, \"stack\");\n }\n\n var ensureErrorObject = function () {\n if (!(\"stack\" in new Error())) {\n return function (value) {\n if (canAttachTrace(value)) return value;\n\n try {\n throw new Error(safeToString(value));\n } catch (err) {\n return err;\n }\n };\n } else {\n return function (value) {\n if (canAttachTrace(value)) return value;\n return new Error(safeToString(value));\n };\n }\n }();\n\n function classString(obj) {\n return {}.toString.call(obj);\n }\n\n function copyDescriptors(from, to, filter) {\n var keys = es5.names(from);\n\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n\n if (filter(key)) {\n try {\n es5.defineProperty(to, key, es5.getDescriptor(from, key));\n } catch (ignore) {}\n }\n }\n }\n\n var asArray = function asArray(v) {\n if (es5.isArray(v)) {\n return v;\n }\n\n return null;\n };\n\n if (typeof Symbol !== \"undefined\" && Symbol.iterator) {\n var ArrayFrom = typeof Array.from === \"function\" ? function (v) {\n return Array.from(v);\n } : function (v) {\n var ret = [];\n var it = v[Symbol.iterator]();\n var itResult;\n\n while (!(itResult = it.next()).done) {\n ret.push(itResult.value);\n }\n\n return ret;\n };\n\n asArray = function asArray(v) {\n if (es5.isArray(v)) {\n return v;\n } else if (v != null && typeof v[Symbol.iterator] === \"function\") {\n return ArrayFrom(v);\n }\n\n return null;\n };\n }\n\n var isNode = typeof process !== \"undefined\" && classString(process).toLowerCase() === \"[object process]\";\n var hasEnvVariables = typeof process !== \"undefined\" && typeof process.env !== \"undefined\";\n\n function env(key) {\n return hasEnvVariables ? process.env[key] : undefined;\n }\n\n function getNativePromise() {\n if (typeof Promise === \"function\") {\n try {\n var promise = new Promise(function () {});\n\n if ({}.toString.call(promise) === \"[object Promise]\") {\n return Promise;\n }\n } catch (e) {}\n }\n }\n\n function domainBind(self, cb) {\n return self.bind(cb);\n }\n\n var ret = {\n isClass: isClass,\n isIdentifier: isIdentifier,\n inheritedDataKeys: inheritedDataKeys,\n getDataPropertyOrDefault: getDataPropertyOrDefault,\n thrower: thrower,\n isArray: es5.isArray,\n asArray: asArray,\n notEnumerableProp: notEnumerableProp,\n isPrimitive: isPrimitive,\n isObject: isObject,\n isError: isError,\n canEvaluate: canEvaluate,\n errorObj: errorObj,\n tryCatch: tryCatch,\n inherits: inherits,\n withAppended: withAppended,\n maybeWrapAsError: maybeWrapAsError,\n toFastProperties: toFastProperties,\n filledRange: filledRange,\n toString: safeToString,\n canAttachTrace: canAttachTrace,\n ensureErrorObject: ensureErrorObject,\n originatesFromRejection: originatesFromRejection,\n markAsOriginatingFromRejection: markAsOriginatingFromRejection,\n classString: classString,\n copyDescriptors: copyDescriptors,\n hasDevTools: typeof chrome !== \"undefined\" && chrome && typeof chrome.loadTimes === \"function\",\n isNode: isNode,\n hasEnvVariables: hasEnvVariables,\n env: env,\n global: globalObject,\n getNativePromise: getNativePromise,\n domainBind: domainBind\n };\n\n ret.isRecentNode = ret.isNode && function () {\n var version;\n\n if (process.versions && process.versions.node) {\n version = process.versions.node.split(\".\").map(Number);\n } else if (process.version) {\n version = process.version.split(\".\").map(Number);\n }\n\n return version[0] === 0 && version[1] > 10 || version[0] > 0;\n }();\n\n if (ret.isNode) ret.toFastProperties(process);\n\n try {\n throw new Error();\n } catch (e) {\n ret.lastLineError = e;\n }\n\n module.exports = ret;\n }, {\n \"./es5\": 13\n }]\n }, {}, [4])(4);\n});\n;\n\nif (typeof window !== 'undefined' && window !== null) {\n window.P = window.Promise;\n} else if (typeof self !== 'undefined' && self !== null) {\n self.P = self.Promise;\n}","module.exports = require(\"bluebird\");","var utils = require(\"../../utils/utils\");\n\nvar StateService = function StateService() {\n var stateProviders = {};\n\n function getState(name) {\n var provider = stateProviders[name];\n\n if (provider) {\n return stateProviders[name].method();\n } else {\n var res = {};\n\n for (var i in stateProviders) {\n if (!stateProviders[i].internal) utils.mixin(res, stateProviders[i].method(), true);\n }\n\n return res;\n }\n }\n\n function registerProvider(name, provider, internal) {\n stateProviders[name] = {\n method: provider,\n internal: internal\n };\n }\n\n function unregisterProvider(name) {\n delete stateProviders[name];\n }\n\n return {\n getState: getState,\n registerProvider: registerProvider,\n unregisterProvider: unregisterProvider\n };\n};\n\nmodule.exports = StateService;","module.exports = function (gantt) {\n var regTemplates = {};\n\n function initTemplate(name, initial, template_name) {\n template_name = template_name || name;\n var config = gantt.config,\n templates = gantt.templates;\n\n if (gantt.config[name] && regTemplates[template_name] != config[name]) {\n if (!(initial && templates[template_name])) {\n templates[template_name] = gantt.date.date_to_str(config[name]);\n regTemplates[template_name] = config[name];\n }\n }\n }\n\n function initTemplates() {\n var labels = gantt.locale.labels;\n labels.gantt_save_btn = labels.icon_save;\n labels.gantt_cancel_btn = labels.icon_cancel;\n labels.gantt_delete_btn = labels.icon_delete;\n var date = gantt.date; //build configuration based templates\n\n var d = date.date_to_str;\n var c = gantt.config;\n var format_date = d(c.xml_date || c.date_format, c.server_utc);\n var parse_date = date.str_to_date(c.xml_date || c.date_format, c.server_utc);\n initTemplate(\"date_scale\", true, undefined, gantt.config, gantt.templates);\n initTemplate(\"date_grid\", true, \"grid_date_format\", gantt.config, gantt.templates);\n initTemplate(\"task_date\", true, undefined, gantt.config, gantt.templates);\n gantt.mixin(gantt.templates, {\n xml_format: undefined,\n // deprecated\n format_date: format_date,\n xml_date: undefined,\n // deprecated\n parse_date: parse_date,\n progress_text: function progress_text(start, end, task) {\n return \"\";\n },\n grid_header_class: function grid_header_class(column, config) {\n return \"\";\n },\n task_text: function task_text(start, end, task) {\n return task.text;\n },\n task_class: function task_class(start, end, task) {\n return \"\";\n },\n task_end_date: function task_end_date(date) {\n return gantt.templates.task_date(date);\n },\n grid_row_class: function grid_row_class(start, end, task) {\n return \"\";\n },\n task_row_class: function task_row_class(start, end, task) {\n return \"\";\n },\n timeline_cell_class: function timeline_cell_class(item, date) {\n return \"\";\n },\n timeline_cell_content: function timeline_cell_content(item, date) {\n return \"\";\n },\n scale_cell_class: function scale_cell_class(date) {\n return \"\";\n },\n scale_row_class: function scale_row_class(date) {\n return \"\";\n },\n grid_indent: function grid_indent(item) {\n return \"
\";\n },\n grid_folder: function grid_folder(item) {\n return \"
\";\n },\n grid_file: function grid_file(item) {\n return \"
\";\n },\n grid_open: function grid_open(item) {\n return \"
\";\n },\n grid_blank: function grid_blank(item) {\n return \"
\";\n },\n date_grid: function date_grid(date, item, column) {\n if (item && gantt.isUnscheduledTask(item) && gantt.config.show_unscheduled) {\n return gantt.templates.task_unscheduled_time(item);\n } else {\n return gantt.templates.grid_date_format(date, column);\n }\n },\n task_time: function task_time(start, end, ev) {\n if (gantt.isUnscheduledTask(ev) && gantt.config.show_unscheduled) {\n return gantt.templates.task_unscheduled_time(ev);\n } else {\n return gantt.templates.task_date(start) + \" - \" + gantt.templates.task_end_date(end);\n }\n },\n task_unscheduled_time: function task_unscheduled_time(task) {\n return \"\";\n },\n time_picker: d(c.time_picker),\n link_class: function link_class(link) {\n return \"\";\n },\n link_description: function link_description(link) {\n var from = gantt.getTask(link.source),\n to = gantt.getTask(link.target);\n return \"\" + from.text + \"\" + to.text + \"\";\n },\n drag_link: function drag_link(from, from_start, to, to_start) {\n from = gantt.getTask(from);\n var labels = gantt.locale.labels;\n var text = \"\" + from.text + \" \" + (from_start ? labels.link_start : labels.link_end) + \"
\";\n\n if (to) {\n to = gantt.getTask(to);\n text += \" \" + to.text + \" \" + (to_start ? labels.link_start : labels.link_end) + \"
\";\n }\n\n return text;\n },\n drag_link_class: function drag_link_class(from, from_start, to, to_start) {\n var add = \"\";\n\n if (from && to) {\n var allowed = gantt.isLinkAllowed(from, to, from_start, to_start);\n add = \" \" + (allowed ? \"gantt_link_allow\" : \"gantt_link_deny\");\n }\n\n return \"gantt_link_tooltip\" + add;\n },\n\n /* used for aria-labels of bar elements and for tooltip.js */\n tooltip_date_format: date.date_to_str(\"%Y-%m-%d\"),\n tooltip_text: function tooltip_text(start, end, event) {\n return \"Task: \" + event.text + \"
Start date: \" + gantt.templates.tooltip_date_format(start) + \"
End date: \" + gantt.templates.tooltip_date_format(end);\n }\n });\n }\n\n return {\n initTemplates: initTemplates,\n initTemplate: initTemplate\n };\n};","var eventable = require(\"../../utils/eventable\");\n\nvar utils = require(\"../../utils/utils\");\n\nvar timeout = require(\"../../utils/timeout\");\n\nvar global = require(\"../../utils/global\");\n\nvar domHelpers = require(\"../ui/utils/dom_helpers\");\n\nmodule.exports = function (gantt) {\n function copyDomEvent(e) {\n return {\n target: e.target || e.srcElement,\n pageX: e.pageX,\n pageY: e.pageY,\n clientX: e.clientX,\n clientY: e.clientY,\n metaKey: e.metaKey,\n shiftKey: e.shiftKey,\n ctrlKey: e.ctrlKey,\n altKey: e.altKey\n };\n }\n\n function DnD(obj, config) {\n this._obj = obj;\n this._settings = config || {};\n eventable(this);\n var inputMethods = this.getInputMethods();\n this._drag_start_timer = null;\n gantt.attachEvent(\"onGanttScroll\", utils.bind(function (left, top) {\n this.clearDragTimer();\n }, this));\n var lastDown = 0;\n var eventParams = {\n passive: false\n };\n\n for (var i = 0; i < inputMethods.length; i++) {\n utils.bind(function (input) {\n gantt.event(obj, input.down, utils.bind(function (e) {\n if (!input.accessor(e)) {\n return;\n }\n\n if (config.preventDefault && config.selector && domHelpers.closest(e.target, config.selector)) {\n e.preventDefault();\n }\n\n if (gantt.config.touch && e.timeStamp && e.timeStamp - lastDown < 300) {\n return;\n }\n\n this._settings.original_target = copyDomEvent(e);\n\n if (gantt.config.touch) {\n this.clearDragTimer();\n this._drag_start_timer = setTimeout(utils.bind(function () {\n if (gantt.getState().lightbox) {\n return;\n }\n\n this.dragStart(obj, e, input);\n }, this), gantt.config.touch_drag);\n } else {\n this.dragStart(obj, e, input);\n }\n }, this), eventParams);\n var eventElement = document.body;\n gantt.event(eventElement, input.up, utils.bind(function (e) {\n if (!input.accessor(e)) {\n return;\n }\n\n this.clearDragTimer();\n }, this), eventParams);\n }, this)(inputMethods[i]);\n }\n }\n\n DnD.prototype = {\n traceDragEvents: function traceDragEvents(domElement, inputMethod) {\n var mousemove = utils.bind(function (e) {\n return this.dragMove(domElement, e, inputMethod.accessor);\n }, this);\n utils.bind(function (e) {\n return this.dragScroll(domElement, e);\n }, this);\n var limited_mousemove = utils.bind(function (e) {\n if (this.config.started && utils.defined(this.config.updates_per_second)) {\n if (!timeout(this, this.config.updates_per_second)) return;\n }\n\n var dndActive = mousemove(e);\n\n if (dndActive) {\n try {\n if (e && e.preventDefault && e.cancelable) {\n //e.cancelable condition - because navigator.vibrate is blocked by Chrome\n e.preventDefault(); //Cancel default action on DND\n } //Cancel default action on DND\n\n } catch (e) {// just suppress the exception, nothing needed to be done here\n } //e.cancelBubble = true;\n\n }\n\n return dndActive;\n }, this);\n var eventElement = domHelpers.getRootNode(gantt.$root);\n var mousemoveContainer = this.config.mousemoveContainer || domHelpers.getRootNode(gantt.$root);\n var eventParams = {\n passive: false\n };\n var mouseup = utils.bind(function (e) {\n gantt.eventRemove(mousemoveContainer, inputMethod.move, limited_mousemove);\n gantt.eventRemove(eventElement, inputMethod.up, mouseup, eventParams);\n return this.dragEnd(domElement);\n }, this);\n gantt.event(mousemoveContainer, inputMethod.move, limited_mousemove, eventParams);\n gantt.event(eventElement, inputMethod.up, mouseup, eventParams);\n },\n checkPositionChange: function checkPositionChange(pos) {\n var diff_x = pos.x - this.config.pos.x;\n var diff_y = pos.y - this.config.pos.y;\n var distance = Math.sqrt(Math.pow(Math.abs(diff_x), 2) + Math.pow(Math.abs(diff_y), 2));\n\n if (distance > this.config.sensitivity) {\n return true;\n } else {\n return false;\n }\n },\n initDnDMarker: function initDnDMarker() {\n // create dnd placeholder and put it in dom\n var marker = this.config.marker = document.createElement(\"div\");\n marker.className = \"gantt_drag_marker\"; // GS-1333: don't show any message when we resize grid columns\n\n marker.innerHTML = \"\";\n document.body.appendChild(marker);\n },\n backupEventTarget: function backupEventTarget(domEvent, getEvent) {\n if (!gantt.config.touch) {\n return;\n } // keep original event target in DOM in order to keep dnd on touchmove event\n\n\n var e = getEvent(domEvent);\n var el = e.target || e.srcElement;\n var copy = el.cloneNode(true); //this.config.target.target = copy;\n\n this.config.original_target = copyDomEvent(e);\n this.config.original_target.target = copy;\n this.config.backup_element = el;\n el.parentNode.appendChild(copy);\n el.style.display = \"none\";\n var mousemoveContainer = this.config.mousemoveContainer || document.body;\n mousemoveContainer.appendChild(el);\n },\n getInputMethods: function getInputMethods() {\n // bind actions to browser events\n var inputMethods = [];\n inputMethods.push({\n \"move\": \"mousemove\",\n \"down\": \"mousedown\",\n \"up\": \"mouseup\",\n \"accessor\": function accessor(e) {\n return e;\n }\n });\n\n if (gantt.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 inputMethods.push({\n \"move\": \"touchmove\",\n \"down\": \"touchstart\",\n \"up\": \"touchend\",\n \"accessor\": function accessor(ev) {\n if (ev.touches && ev.touches.length > 1) return null;\n if (ev.touches[0]) return {\n target: document.elementFromPoint(ev.touches[0].clientX, ev.touches[0].clientY),\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 }\n });\n } else if (global.navigator.pointerEnabled) {\n inputMethods.push({\n \"move\": \"pointermove\",\n \"down\": \"pointerdown\",\n \"up\": \"pointerup\",\n \"accessor\": function accessor(ev) {\n if (ev.pointerType == \"mouse\") return null;\n return ev;\n }\n });\n } else if (global.navigator.msPointerEnabled) {\n inputMethods.push({\n \"move\": \"MSPointerMove\",\n \"down\": \"MSPointerDown\",\n \"up\": \"MSPointerUp\",\n \"accessor\": function accessor(ev) {\n if (ev.pointerType == ev.MSPOINTER_TYPE_MOUSE) return null;\n return ev;\n }\n });\n }\n }\n\n return inputMethods;\n },\n clearDragTimer: function clearDragTimer() {\n if (this._drag_start_timer) {\n clearTimeout(this._drag_start_timer);\n this._drag_start_timer = null;\n }\n },\n dragStart: function dragStart(obj, e, inputMethod) {\n if (this.config && this.config.started) {\n return;\n }\n\n this.config = {\n obj: obj,\n marker: null,\n started: false,\n pos: this.getPosition(e),\n sensitivity: 4\n };\n if (this._settings) utils.mixin(this.config, this._settings, true);\n this.traceDragEvents(obj, inputMethod);\n gantt._prevent_touch_scroll = true;\n document.body.className += \" gantt_noselect\";\n\n if (gantt.config.touch) {\n this.dragMove(obj, e, inputMethod.accessor);\n }\n },\n dragMove: function dragMove(obj, e, getEvent) {\n var source = getEvent(e);\n if (!source) return false;\n\n if (!this.config.marker && !this.config.started) {\n var pos = this.getPosition(source);\n\n if (gantt.config.touch || this.checkPositionChange(pos)) {\n // real drag starts here,\n // when user moves mouse at first time after onmousedown\n this.config.started = true;\n this.config.ignore = false;\n gantt._touch_drag = true;\n\n if (this.callEvent(\"onBeforeDragStart\", [obj, this.config.original_target]) === false) {\n this.config.ignore = true;\n return false;\n }\n\n this.backupEventTarget(e, getEvent);\n this.initDnDMarker();\n\n gantt._touch_feedback();\n\n this.callEvent(\"onAfterDragStart\", [obj, this.config.original_target]);\n } else {\n this.config.ignore = true;\n }\n }\n\n if (!this.config.ignore) {\n // GS-1279 Gantt crashes on Mobile Firefox after starting to create a link and moving finger outisde the page.\n if (e.targetTouches && !source.target) return;\n source.pos = this.getPosition(source);\n this.config.marker.style.left = source.pos.x + \"px\";\n this.config.marker.style.top = source.pos.y + \"px\";\n this.callEvent(\"onDragMove\", [obj, source]);\n return true;\n }\n\n return false;\n },\n dragEnd: function dragEnd(obj) {\n var target = this.config.backup_element;\n\n if (target && target.parentNode) {\n target.parentNode.removeChild(target);\n }\n\n gantt._prevent_touch_scroll = false;\n\n if (this.config.marker) {\n this.config.marker.parentNode.removeChild(this.config.marker);\n this.config.marker = null;\n this.callEvent(\"onDragEnd\", []);\n }\n\n this.config.started = false;\n gantt._touch_drag = false;\n document.body.className = document.body.className.replace(\" gantt_noselect\", \"\");\n },\n getPosition: function getPosition(e) {\n var x = 0,\n y = 0;\n\n if (e.pageX || e.pageY) {\n x = e.pageX;\n y = e.pageY;\n } else if (e.clientX || e.clientY) {\n x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;\n y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;\n }\n\n return {\n x: x,\n y: y\n };\n }\n };\n return DnD;\n};","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nvar t = /*#__PURE__*/function () {\n function t(_t) {\n _classCallCheck(this, t);\n\n var e = _t.url,\n s = _t.token;\n this._url = e, this._token = s, this._mode = 1, this._seed = 1, this._queue = [], this.data = {}, this.api = {}, this._events = {};\n }\n\n _createClass(t, [{\n key: \"headers\",\n value: function headers() {\n return {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n \"Remote-Token\": this._token\n };\n }\n }, {\n key: \"fetch\",\n value: function (_fetch) {\n function fetch(_x, _x2) {\n return _fetch.apply(this, arguments);\n }\n\n fetch.toString = function () {\n return _fetch.toString();\n };\n\n return fetch;\n }(function (_t2, e) {\n var s = {\n credentials: \"include\",\n headers: this.headers()\n };\n return e && (s.method = \"POST\", s.body = e), fetch(_t2, s).then(function (_t3) {\n return _t3.json();\n });\n })\n }, {\n key: \"load\",\n value: function load(_t4) {\n var _this = this;\n\n return _t4 && (this._url = _t4), this.fetch(this._url).then(function (_t5) {\n return _this.parse(_t5);\n });\n }\n }, {\n key: \"parse\",\n value: function parse(_t6) {\n var e = _t6.key,\n s = _t6.websocket;\n e && (this._token = _t6.key);\n\n for (var _e in _t6.data) {\n this.data[_e] = _t6.data[_e];\n }\n\n for (var _e2 in _t6.api) {\n var _s = this.api[_e2] = {},\n i = _t6.api[_e2];\n\n for (var _t29 in i) {\n _s[_t29] = this._wrapper(_e2 + \".\" + _t29);\n }\n }\n\n return s && this.connect(), this;\n }\n }, {\n key: \"connect\",\n value: function connect() {\n var _this2 = this;\n\n var _t8 = this._socket;\n _t8 && (this._socket = null, _t8.onclose = function () {}, _t8.close()), this._mode = 2, this._socket = function (t, e, s, i) {\n var n = e;\n \"/\" === n[0] && (n = document.location.protocol + \"//\" + document.location.host + e);\n n = n.replace(/^http(s|):/, \"ws$1:\");\n var o = -1 != n.indexOf(\"?\") ? \"&\" : \"?\";\n n = \"\".concat(n).concat(o, \"token=\").concat(s, \"&ws=1\");\n var r = new WebSocket(n);\n return r.onclose = function () {\n return setTimeout(function () {\n return t.connect();\n }, 2e3);\n }, r.onmessage = function (e) {\n var s = JSON.parse(e.data);\n\n switch (s.action) {\n case \"result\":\n t.result(s.body, []);\n break;\n\n case \"event\":\n t.fire(s.body.name, s.body.value);\n break;\n\n case \"start\":\n i();\n break;\n\n default:\n t.onError(s.data);\n }\n }, r;\n }(this, this._url, this._token, function () {\n return _this2._mode = 3, _this2._send(), _this2._resubscribe(), _this2;\n });\n }\n }, {\n key: \"_wrapper\",\n value: function _wrapper(_t9) {\n return function () {\n var _this3 = this;\n\n var e = [].slice.call(arguments);\n var s = null;\n var i = new Promise(function (i, n) {\n s = {\n data: {\n id: _this3._uid(),\n name: _t9,\n args: e\n },\n status: 1,\n resolve: i,\n reject: n\n }, _this3._queue.push(s);\n });\n return this.onCall(s, i), 3 === this._mode ? this._send(s) : setTimeout(function () {\n return _this3._send();\n }, 1), i;\n }.bind(this);\n }\n }, {\n key: \"_uid\",\n value: function _uid() {\n return (this._seed++).toString();\n }\n }, {\n key: \"_send\",\n value: function _send(_t10) {\n var _this4 = this;\n\n if (2 == this._mode) return void setTimeout(function () {\n return _this4._send();\n }, 100);\n var e = _t10 ? [_t10] : this._queue.filter(function (_t11) {\n return 1 === _t11.status;\n });\n if (!e.length) return;\n var s = e.map(function (_t12) {\n return _t12.status = 2, _t12.data;\n });\n 3 !== this._mode ? this.fetch(this._url, JSON.stringify(s))[\"catch\"](function (_t13) {\n return _this4.onError(_t13);\n }).then(function (_t14) {\n return _this4.result(_t14, s);\n }) : this._socket.send(JSON.stringify({\n action: \"call\",\n body: s\n }));\n }\n }, {\n key: \"result\",\n value: function result(_t15, e) {\n var s = {};\n if (_t15) for (var _e3 = 0; _e3 < _t15.length; _e3++) {\n s[_t15[_e3].id] = _t15[_e3];\n } else for (var _t30 = 0; _t30 < e.length; _t30++) {\n s[e[_t30].id] = {\n id: e[_t30].id,\n error: \"Network Error\",\n data: null\n };\n }\n\n for (var _t31 = this._queue.length - 1; _t31 >= 0; _t31--) {\n var _e4 = this._queue[_t31],\n i = s[_e4.data.id];\n i && (this.onResponse(_e4, i), i.error ? _e4.reject(i.error) : _e4.resolve(i.data), this._queue.splice(_t31, 1));\n }\n }\n }, {\n key: \"on\",\n value: function on(_t18, e) {\n var s = this._uid();\n\n var i = this._events[_t18];\n var n = !!i;\n return n || (i = this._events[_t18] = []), i.push({\n id: s,\n handler: e\n }), n || 3 != this._mode || this._socket.send(JSON.stringify({\n action: \"subscribe\",\n name: _t18\n })), {\n name: _t18,\n id: s\n };\n }\n }, {\n key: \"_resubscribe\",\n value: function _resubscribe() {\n if (3 == this._mode) for (var _t32 in this._events) {\n this._socket.send(JSON.stringify({\n action: \"subscribe\",\n name: _t32\n }));\n }\n }\n }, {\n key: \"detach\",\n value: function detach(_t20) {\n if (!_t20) {\n if (3 == this._mode) for (var _t33 in this._events) {\n this._socket.send(JSON.stringify({\n action: \"unsubscribe\",\n key: _t33\n }));\n }\n return void (this._events = {});\n }\n\n var e = _t20.id,\n s = _t20.name,\n i = this._events[s];\n\n if (i) {\n var _t34 = i.filter(function (_t23) {\n return _t23.id != e;\n });\n\n _t34.length ? this._events[s] = _t34 : (delete this._events[s], 3 == this._mode && this._socket.send(JSON.stringify({\n action: \"unsubscribe\",\n name: s\n })));\n }\n }\n }, {\n key: \"fire\",\n value: function fire(_t24, e) {\n var s = this._events[_t24];\n if (s) for (var _t35 = 0; _t35 < s.length; _t35++) {\n s[_t35].handler(e);\n }\n }\n }, {\n key: \"onError\",\n value: function onError(_t26) {\n return null;\n }\n }, {\n key: \"onCall\",\n value: function onCall(_t27, e) {}\n }, {\n key: \"onResponse\",\n value: function onResponse(_t28, e) {}\n }]);\n\n return t;\n}();\n\nexport { t as Client };","var remote_client = require(\"remote-client\");\n\nmodule.exports = {\n remoteEvents: function remoteEvents(url, token) {\n var _this = this;\n\n var remote = new remote_client.Client({\n url: url,\n token: token\n }); // temporary patch, as we do not want credentials\n\n remote.fetch = function (url, body) {\n var req = {\n headers: this.headers()\n };\n\n if (body) {\n req.method = \"POST\";\n req.body = body;\n }\n\n return fetch(url, req).then(function (res) {\n return res.json();\n });\n };\n\n this._ready = remote.load().then(function (back) {\n return _this._remote = back;\n });\n\n function ready() {\n return this._ready;\n }\n\n function on(name, handler) {\n this.ready().then(function (back) {\n if (typeof name === \"string\") back.on(name, handler);else {\n for (var key in name) {\n back.on(key, name[key]);\n }\n }\n });\n }\n\n this.ready = ready;\n this.on = on;\n }\n};","const dateToStr = (format: string, utc: boolean, gantt) => {\r\n\treturn (date) => {\r\n\t\treturn format.replace(/%[a-zA-Z]/g, (a) => {\r\n\t\t\tswitch (a) {\r\n\t\t\t\tcase \"%d\": return utc ? gantt.date.to_fixed(date.getUTCDate()) : gantt.date.to_fixed(date.getDate());\r\n\t\t\t\tcase \"%m\": return utc ? gantt.date.to_fixed((date.getUTCMonth() + 1)) : gantt.date.to_fixed((date.getMonth() + 1));\r\n\t\t\t\tcase \"%j\": return utc ? date.getUTCDate() : date.getDate();\r\n\t\t\t\tcase \"%n\": return utc ? (date.getUTCMonth() + 1) : (date.getMonth() + 1);\r\n\t\t\t\tcase \"%y\": return utc ? gantt.date.to_fixed(date.getUTCFullYear() % 100) : gantt.date.to_fixed(date.getFullYear() % 100);\r\n\t\t\t\tcase \"%Y\": return utc ? date.getUTCFullYear() : date.getFullYear();\r\n\t\t\t\tcase \"%D\": return utc ? gantt.locale.date.day_short[date.getUTCDay()] : gantt.locale.date.day_short[date.getDay()];\r\n\t\t\t\tcase \"%l\": return utc ? gantt.locale.date.day_full[date.getUTCDay()] : gantt.locale.date.day_full[date.getDay()];\r\n\t\t\t\tcase \"%M\": return utc ? gantt.locale.date.month_short[date.getUTCMonth()] : gantt.locale.date.month_short[date.getMonth()];\r\n\t\t\t\tcase \"%F\": return utc ? gantt.locale.date.month_full[date.getUTCMonth()] : gantt.locale.date.month_full[date.getMonth()];\r\n\t\t\t\tcase \"%h\": return utc ? gantt.date.to_fixed((date.getUTCHours() + 11) % 12 + 1) : gantt.date.to_fixed((date.getHours() + 11) % 12 + 1);\r\n\t\t\t\tcase \"%g\": return utc ? ((date.getUTCHours() + 11) % 12 + 1) : ((date.getHours() + 11) % 12 + 1);\r\n\t\t\t\tcase \"%G\": return utc ? date.getUTCHours() : date.getHours();\r\n\t\t\t\tcase \"%H\": return utc ? gantt.date.to_fixed(date.getUTCHours()) : gantt.date.to_fixed(date.getHours());\r\n\t\t\t\tcase \"%i\": return utc ? gantt.date.to_fixed(date.getUTCMinutes()) : gantt.date.to_fixed(date.getMinutes());\r\n\t\t\t\tcase \"%a\": return utc ? (date.getUTCHours() > 11 ? \"pm\" : \"am\") : (date.getHours() > 11 ? \"pm\" : \"am\");\r\n\t\t\t\tcase \"%A\": return utc ? (date.getUTCHours() > 11 ? \"PM\" : \"AM\") : (date.getHours() > 11 ? \"PM\" : \"AM\");\r\n\t\t\t\tcase \"%s\": return utc ? gantt.date.to_fixed(date.getUTCSeconds()) : gantt.date.to_fixed(date.getSeconds());\r\n\t\t\t\tcase \"%W\": return utc ? gantt.date.to_fixed(gantt.date.getUTCISOWeek(date)) : gantt.date.to_fixed(gantt.date.getISOWeek(date));\r\n\t\t\t\tdefault: return a;\r\n\t\t\t}\r\n\t\t});\r\n\t};\r\n};\r\nconst strToDate = (format: string, utc: boolean, gantt:any) => {\r\n\treturn (date: string) => {\r\n\t\tconst set: Array = [0, 0, 1, 0, 0, 0];\r\n\t\tconst temp = date.match(/[a-zA-Z]+|[0-9]+/g);\r\n\t\tconst mask = format.match(/%[a-zA-Z]/g);\r\n\r\n\t\tfor (let i = 0; i < mask.length; i++) {\r\n\t\t\tswitch (mask[i]) {\r\n\t\t\t\tcase \"%j\":\r\n\t\t\t\tcase \"%d\":\r\n\t\t\t\t\tset[2] = temp[i] as unknown as number || 1;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"%n\":\r\n\t\t\t\tcase \"%m\":\r\n\t\t\t\t\tset[1] = (temp[i] as unknown as number || 1) - 1;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"%y\":\r\n\t\t\t\t\tset[0] = temp[i] as unknown as number * 1 + ((temp[i] as unknown as number) > 50 ? 1900 : 2000);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"%g\":\r\n\t\t\t\tcase \"%G\":\r\n\t\t\t\tcase \"%h\":\r\n\t\t\t\tcase \"%H\":\r\n\t\t\t\t\tset[3] = temp[i] as unknown as number || 0;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"%i\":\r\n\t\t\t\t\tset[4] = temp[i] as unknown as number || 0;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"%Y\":\r\n\t\t\t\t\tset[0] = temp[i] as unknown as number || 0;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"%a\":\r\n\t\t\t\tcase \"%A\":\r\n\t\t\t\t\tset[3] = set[3] as number % 12 + ((temp[i] || \"\").toLowerCase() === \"am\" ? 0 : 12);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"%s\":\r\n\t\t\t\t\tset[5] = temp[i] || 0;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"%M\":\r\n\t\t\t\t\tset[1] = gantt.locale.date.month_short_hash[temp[i]] || 0;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"%F\":\r\n\t\t\t\t\tset[1] = gantt.locale.date.month_full_hash[temp[i]] || 0;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (utc) {\r\n\t\t\treturn new Date(Date.UTC(\r\n\t\t\t\tset[0] as number,\r\n\t\t\t\tset[1] as number,\r\n\t\t\t\tset[2] as number,\r\n\t\t\t\tset[3] as number,\r\n\t\t\t\tset[4] as number,\r\n\t\t\t\tset[5] as number\r\n\t\t\t));\r\n\t\t}\r\n\t\treturn new Date(\r\n\t\t\tset[0] as number,\r\n\t\t\tset[1] as number,\r\n\t\t\tset[2] as number,\r\n\t\t\tset[3] as number,\r\n\t\t\tset[4] as number,\r\n\t\t\tset[5] as number\r\n\t\t);\r\n\t};\r\n\r\n};\r\n\r\n\r\nconst cspVersion = {\r\n\tdate_to_str: dateToStr,\r\n\tstr_to_date: strToDate\r\n};\r\n\r\nexport default cspVersion;","const dateToStr = (format: string, utc: boolean, gantt) => {\r\n\tformat = format.replace(/%[a-zA-Z]/g, (a) => {\r\n\t\tswitch (a) {\r\n\t\t\tcase \"%d\":\r\n\t\t\t\treturn `\"+to_fixed(date.get${utc?\"UTC\":\"\"}Date())+\"`;\r\n\t\t\tcase \"%m\":\r\n\t\t\t\treturn `\"+to_fixed((date.get${utc?\"UTC\":\"\"}Month()+1))+\"`;\r\n\t\t\tcase \"%j\":\r\n\t\t\t\treturn `\"+date.get${utc?\"UTC\":\"\"}Date()+\"`;\r\n\t\t\tcase \"%n\":\r\n\t\t\t\treturn `\"+(date.get${utc?\"UTC\":\"\"}Month()+1)+\"`;\r\n\t\t\tcase \"%y\":\r\n\t\t\t\treturn `\"+to_fixed(date.get${utc?\"UTC\":\"\"}FullYear()%100)+\"`;\r\n\t\t\tcase \"%Y\":\r\n\t\t\t\treturn `\"+date.get${utc?\"UTC\":\"\"}FullYear()+\"`;\r\n\t\t\tcase \"%D\":\r\n\t\t\t\treturn `\"+locale.date.day_short[date.get${utc?\"UTC\":\"\"}Day()]+\"`;\r\n\t\t\tcase \"%l\":\r\n\t\t\t\treturn `\"+locale.date.day_full[date.get${utc?\"UTC\":\"\"}Day()]+\"`;\r\n\t\t\tcase \"%M\":\r\n\t\t\t\treturn `\"+locale.date.month_short[date.get${utc?\"UTC\":\"\"}Month()]+\"`;\r\n\t\t\tcase \"%F\":\r\n\t\t\t\treturn `\"+locale.date.month_full[date.get${utc?\"UTC\":\"\"}Month()]+\"`;\r\n\t\t\tcase \"%h\":\r\n\t\t\t\treturn `\"+to_fixed((date.get${utc?\"UTC\":\"\"}Hours()+11)%12+1)+\"`;\r\n\t\t\tcase \"%g\":\r\n\t\t\t\treturn `\"+((date.get${utc?\"UTC\":\"\"}Hours()+11)%12+1)+\"`;\r\n\t\t\tcase \"%G\":\r\n\t\t\t\treturn `\"+date.get${utc?\"UTC\":\"\"}Hours()+\"`;\r\n\t\t\tcase \"%H\":\r\n\t\t\t\treturn `\"+to_fixed(date.get${utc?\"UTC\":\"\"}Hours())+\"`;\r\n\t\t\tcase \"%i\":\r\n\t\t\t\treturn `\"+to_fixed(date.get${utc?\"UTC\":\"\"}Minutes())+\"`;\r\n\t\t\tcase \"%a\":\r\n\t\t\t\treturn `\"+(date.get${utc?\"UTC\":\"\"}Hours()>11?\"pm\":\"am\")+\"`;\r\n\t\t\tcase \"%A\":\r\n\t\t\t\treturn `\"+(date.get${utc?\"UTC\":\"\"}Hours()>11?\"PM\":\"AM\")+\"`;\r\n\t\t\tcase \"%s\":\r\n\t\t\t\treturn `\"+to_fixed(date.get${utc?\"UTC\":\"\"}Seconds())+\"`;\r\n\t\t\tcase \"%W\":\r\n\t\t\t\treturn `\"+to_fixed(getISOWeek(date))+\"`;\r\n\t\t\tcase \"%w\":\r\n\t\t\t\treturn `\"+to_fixed(getWeek(date))+\"`;\r\n\t\t\tdefault:\r\n\t\t\t\treturn a;\r\n\t\t}\r\n\t});\r\n\r\n\t// tslint:disable-next-line: function-constructor\r\n\tconst dateToStrFn = new Function(\"date\", \"to_fixed\", \"locale\", \"getISOWeek\", \"getWeek\", `return \"${format}\";`);\r\n\r\n\treturn (date: Date) => {\r\n\t\treturn dateToStrFn(date, gantt.date.to_fixed, gantt.locale, gantt.date.getISOWeek, gantt.date.getWeek);\r\n\t};\r\n};\r\n\r\n\r\nconst strToDate = (format: string, utc: boolean, gantt:any) => {\r\n\tlet splt = \"var temp=date.match(/[a-zA-Z]+|[0-9]+/g);\";\r\n\tconst mask = format.match(/%[a-zA-Z]/g);\r\n\tfor (let i = 0; i < mask.length; i++) {\r\n\t\tswitch (mask[i]) {\r\n\t\t\tcase \"%j\":\r\n\t\t\tcase \"%d\":\r\n\t\t\t\tsplt += `set[2]=temp[${i}]||1;`;\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"%n\":\r\n\t\t\tcase \"%m\":\r\n\t\t\t\tsplt += `set[1]=(temp[${i}]||1)-1;`;\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"%y\":\r\n\t\t\t\tsplt += `set[0]=temp[${i}]*1+(temp[${i}]>50?1900:2000);`;\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"%g\":\r\n\t\t\tcase \"%G\":\r\n\t\t\tcase \"%h\":\r\n\t\t\tcase \"%H\":\r\n\t\t\t\tsplt += `set[3]=temp[${i}]||0;`;\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"%i\":\r\n\t\t\t\tsplt += `set[4]=temp[${i}]||0;`;\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"%Y\":\r\n\t\t\t\tsplt += `set[0]=temp[${i}]||0;`;\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"%a\":\r\n\t\t\tcase \"%A\":\r\n\t\t\t\tsplt += `set[3]=set[3]%12+((temp[${i}]||'').toLowerCase()=='am'?0:12);`;\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"%s\":\r\n\t\t\t\tsplt += `set[5]=temp[${i}]||0;`;\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"%M\":\r\n\t\t\t\tsplt += `set[1]=locale.date.month_short_hash[temp[${i}]]||0;`;\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"%F\":\r\n\t\t\t\tsplt += `set[1]=locale.date.month_full_hash[temp[${i}]]||0;`;\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\tlet code = \"set[0],set[1],set[2],set[3],set[4],set[5]\";\r\n\tif (utc) { code = ` Date.UTC(${code})`; }\r\n\t// tslint:disable-next-line: function-constructor\r\n\tconst strToDateFn = new Function(\"date\", \"locale\", `var set=[0,0,1,0,0,0]; ${splt} return new Date(${code});`);\r\n\r\n\treturn (dateString) => {\r\n\t\treturn strToDateFn(dateString, gantt.locale);\r\n\t};\r\n};\r\n\r\nconst fastVersion = {\r\n\tdate_to_str: dateToStr,\r\n\tstr_to_date: strToDate\r\n};\r\n\r\nexport default fastVersion;","/*\r\n %d - the day as a number with a leading zero ( 01 to 31 );\r\n %j - the day as a number without a leading zero ( 1 to 31 );\r\n %D - the day as an abbreviation ( Sun to Sat );\r\n %l - the day as a full name ( Sunday to Saturday );\r\n %W - the ISO-8601 week number of the year. Weeks start on Monday; 1)\r\n %m - the month as a number without a leading zero ( 1 to 12 );\r\n %n - the month as a number with a leading zero ( 01 to 12);\r\n %M - the month as an abbreviation ( Jan to Dec );\r\n %F - the month as a full name ( January to December );\r\n %y - the year as a two-digit number ( 00 to 99 );\r\n %Y - the year as a four-digit number ( 1900–9999 );\r\n %h - the hour based on the 12-hour clock ( 00 to 11 );\r\n %H - the hour based on the 24-hour clock ( 00 to 23 );\r\n %i - the minute as a number with a leading zero ( 00 to 59 );\r\n %s - the second as a number without a leading zero ( 00 to 59 ); 2)\r\n %a - displays am (for times from midnight until noon) and pm (for times from noon until midnight);\r\n %A - displays AM (for times from midnight until noon) and PM (for times from noon until midnight).\r\n*/\nvar fastVersion = require(\"./date_parsers/fast_version\")[\"default\"];\n\nvar cspCompliantVersion = require(\"./date_parsers/csp_compliant_version\")[\"default\"];\n\nmodule.exports = function (gantt) {\n var canUseCsp = null;\n\n function cspAutoCheck() {\n try {\n new Function(\"canUseCsp = false;\");\n } catch (e) {\n canUseCsp = true;\n }\n }\n\n function useCsp() {\n var result = false;\n\n if (gantt.config.csp === \"auto\") {\n if (canUseCsp === null) {\n cspAutoCheck();\n }\n\n result = canUseCsp;\n } else {\n result = gantt.config.csp;\n }\n\n return result;\n }\n\n var dateHelper = {\n init: function init() {\n var locale = gantt.locale;\n var s = locale.date.month_short;\n var t = locale.date.month_short_hash = {};\n\n for (var i = 0; i < s.length; i++) {\n t[s[i]] = i;\n }\n\n var s = locale.date.month_full;\n var t = locale.date.month_full_hash = {};\n\n for (var i = 0; i < s.length; i++) {\n t[s[i]] = i;\n }\n },\n date_part: function date_part(date) {\n var old = new Date(date);\n date.setHours(0);\n this.hour_start(date);\n if (date.getHours() && ( //shift to yesterday on dst\n date.getDate() < old.getDate() || date.getMonth() < old.getMonth() || date.getFullYear() < old.getFullYear())) date.setTime(date.getTime() + 60 * 60 * 1000 * (24 - date.getHours()));\n return date;\n },\n time_part: function time_part(date) {\n return (date.valueOf() / 1000 - date.getTimezoneOffset() * 60) % 86400;\n },\n week_start: function week_start(date) {\n var shift = date.getDay();\n\n if (gantt.config.start_on_monday) {\n if (shift === 0) shift = 6;else shift--;\n }\n\n return this.date_part(this.add(date, -1 * shift, \"day\"));\n },\n month_start: function month_start(date) {\n date.setDate(1);\n return this.date_part(date);\n },\n quarter_start: function quarter_start(date) {\n this.month_start(date);\n var m = date.getMonth(),\n res_month;\n\n if (m >= 9) {\n res_month = 9;\n } else if (m >= 6) {\n res_month = 6;\n } else if (m >= 3) {\n res_month = 3;\n } else {\n res_month = 0;\n }\n\n date.setMonth(res_month);\n return date;\n },\n year_start: function year_start(date) {\n date.setMonth(0);\n return this.month_start(date);\n },\n day_start: function day_start(date) {\n return this.date_part(date);\n },\n hour_start: function hour_start(date) {\n if (date.getMinutes()) date.setMinutes(0);\n this.minute_start(date);\n return date;\n },\n minute_start: function minute_start(date) {\n if (date.getSeconds()) date.setSeconds(0);\n if (date.getMilliseconds()) date.setMilliseconds(0);\n return date;\n },\n _add_days: function _add_days(modifiedDate, inc, originalDate) {\n modifiedDate.setDate(modifiedDate.getDate() + inc);\n var incCondition = inc >= 0;\n var getHoursCondition = !originalDate.getHours() && modifiedDate.getHours(); //shift to yesterday on dst\n\n var getDateCondition = modifiedDate.getDate() <= originalDate.getDate() || modifiedDate.getMonth() < originalDate.getMonth() || modifiedDate.getFullYear() < originalDate.getFullYear();\n\n if (incCondition && getHoursCondition && getDateCondition) {\n modifiedDate.setTime(modifiedDate.getTime() + 60 * 60 * 1000 * (24 - modifiedDate.getHours()));\n }\n\n var worktimeCalculation = inc > 1;\n\n if (worktimeCalculation && getHoursCondition) {\n // try to shift the modified Date to 00:00\n modifiedDate.setHours(0);\n }\n\n return modifiedDate;\n },\n add: function add(date, inc, mode) {\n /*jsl:ignore*/\n var ndate = new Date(date.valueOf());\n\n switch (mode) {\n case \"day\":\n ndate = this._add_days(ndate, inc, date);\n break;\n\n case \"week\":\n ndate = this._add_days(ndate, inc * 7, date);\n break;\n\n case \"month\":\n ndate.setMonth(ndate.getMonth() + inc);\n break;\n\n case \"year\":\n ndate.setYear(ndate.getFullYear() + inc);\n break;\n\n case \"hour\":\n /*\r\n \tadding hours/minutes via setHour(getHour() + inc) gives weird result when\r\n \tadding one hour to the time before switch to a Daylight Saving time\r\n \t\t\texample: //Sun Mar 30 2014 01:00:00 GMT+0100 (W. Europe Standard Time)\r\n \tnew Date(2014, 02, 30, 1).setHours(2)\r\n \t>>Sun Mar 30 2014 01:00:00 GMT+0100 (W. Europe Standard Time)\r\n \t\t\tsetTime seems working as expected\r\n */\n ndate.setTime(ndate.getTime() + inc * 60 * 60 * 1000);\n break;\n\n case \"minute\":\n ndate.setTime(ndate.getTime() + inc * 60 * 1000);\n break;\n\n default:\n return this[\"add_\" + mode](date, inc, mode);\n }\n\n return ndate;\n /*jsl:end*/\n },\n add_quarter: function add_quarter(date, inc) {\n return this.add(date, inc * 3, \"month\");\n },\n to_fixed: function to_fixed(num) {\n if (num < 10) return \"0\" + num;\n return num;\n },\n copy: function copy(date) {\n return new Date(date.valueOf());\n },\n date_to_str: function date_to_str(format, utc) {\n var result = fastVersion;\n\n if (useCsp()) {\n result = cspCompliantVersion;\n }\n\n return result.date_to_str(format, utc, gantt);\n },\n str_to_date: function str_to_date(format, utc) {\n var result = fastVersion;\n\n if (useCsp()) {\n result = cspCompliantVersion;\n }\n\n return result.str_to_date(format, utc, gantt);\n },\n getISOWeek: function getISOWeek(ndate) {\n return gantt.date._getWeekNumber(ndate, true);\n },\n _getWeekNumber: function _getWeekNumber(ndate, isoWeek) {\n if (!ndate) return false;\n var nday = ndate.getDay();\n\n if (isoWeek) {\n if (nday === 0) {\n nday = 7;\n }\n }\n\n var first_thursday = new Date(ndate.valueOf());\n first_thursday.setDate(ndate.getDate() + (4 - nday));\n var year_number = first_thursday.getFullYear(); // year of the first Thursday\n\n var ordinal_date = Math.round((first_thursday.getTime() - new Date(year_number, 0, 1).getTime()) / 86400000); //ordinal date of the first Thursday - 1 (so not really ordinal date)\n\n var week_number = 1 + Math.floor(ordinal_date / 7);\n return week_number;\n },\n getWeek: function getWeek(ndate) {\n return gantt.date._getWeekNumber(ndate, gantt.config.start_on_monday);\n },\n getUTCISOWeek: function getUTCISOWeek(ndate) {\n return gantt.date.getISOWeek(ndate);\n },\n convert_to_utc: function convert_to_utc(date) {\n return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());\n },\n parseDate: function parseDate(date, format) {\n // raw date may be of type string, number (timestamp) or something else\n // do not check for instanceof Date explicitly, since we may swap native date with different date implementation at some point\n if (date && !date.getFullYear) {\n if (typeof format !== \"function\") {\n if (typeof format === \"string\") {\n if (format === \"parse_date\" || format === \"xml_date\") {\n format = gantt.defined(gantt.templates.xml_date) ? gantt.templates.xml_date : gantt.templates.parse_date;\n } else {\n format = gantt.defined(gantt.templates[format]) ? gantt.templates[format] : gantt.date.str_to_date(format);\n }\n } else {\n format = gantt.defined(gantt.templates.xml_date) ? gantt.templates.xml_date : gantt.templates.parse_date;\n }\n }\n\n if (date) {\n date = format(date);\n } else {\n date = null;\n }\n }\n\n return date;\n }\n };\n return dateHelper;\n};","export default function serialize(data: object | string) {\r\n\tif (typeof data === \"string\" || typeof data === \"number\") {\r\n\t\treturn data;\r\n\t}\r\n\r\n\tlet result = \"\";\r\n\r\n\tfor (const key in data) {\r\n\t\tlet serialized = \"\";\r\n\t\tif (data.hasOwnProperty(key)) {\r\n\t\t\tif (typeof data[key] === \"string\") {\r\n\t\t\t\tserialized = encodeURIComponent(data[key]);\r\n\t\t\t} else if (typeof data[key] === \"number\") {\r\n\t\t\t\tserialized = data[key];\r\n\t\t\t} else {\r\n\t\t\t\tserialized = encodeURIComponent(JSON.stringify(data[key]));\r\n\t\t\t}\r\n\t\t\tserialized = key + \"=\" + serialized;\r\n\r\n\t\t\tif (result.length) {\r\n\t\t\t\tserialized = \"&\" + serialized;\r\n\t\t\t}\r\n\t\t\tresult += serialized;\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n}\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 env = require(\"../../utils/env\");\n\nvar global = require(\"../../utils/global\");\n\nvar serialize = require(\"./serialize\")[\"default\"];\n\nfunction createConfig(method, args) {\n var result = {\n method: method\n };\n\n if (args.length === 0) {\n throw new Error(\"Arguments list of query is wrong.\");\n }\n\n if (args.length === 1) {\n if (typeof args[0] === \"string\") {\n result.url = args[0];\n result.async = true;\n } else {\n result.url = args[0].url;\n result.async = args[0].async || true;\n result.callback = args[0].callback;\n result.headers = args[0].headers;\n }\n\n if (method === \"POST\" || \"PUT\") {\n if (args[0].data) {\n if (typeof args[0].data !== \"string\") {\n result.data = serialize(args[0].data);\n } else {\n result.data = args[0].data;\n }\n } else {\n result.data = \"\";\n }\n }\n\n return result;\n }\n\n result.url = args[0];\n\n switch (method) {\n case \"GET\":\n case \"DELETE\":\n result.callback = args[1];\n result.headers = args[2];\n break;\n\n case \"POST\":\n case \"PUT\":\n if (args[1]) {\n if (typeof args[1] !== \"string\") {\n result.data = serialize(args[1]);\n } else {\n result.data = args[1];\n }\n } else {\n result.data = \"\";\n }\n\n result.callback = args[2];\n result.headers = args[3];\n break;\n }\n\n return result;\n}\n\nmodule.exports = function (gantt) {\n return {\n // if false - dhxr param will added to prevent caching on client side (default),\n // if true - do not add extra params\n cache: true,\n // default method for load/loadStruct, post/get allowed\n // get - since 4.1.1, this should fix 412 error for macos safari\n method: \"get\",\n parse: function parse(data) {\n if (typeof data !== \"string\") return data;\n var obj;\n data = data.replace(/^[\\s]+/, \"\");\n\n if (typeof DOMParser !== \"undefined\" && !env.isIE) {\n // ff,ie9\n obj = new DOMParser().parseFromString(data, \"text/xml\");\n } else if (typeof global.ActiveXObject !== \"undefined\") {\n obj = new global.ActiveXObject(\"Microsoft.XMLDOM\");\n obj.async = \"false\";\n obj.loadXML(data);\n }\n\n return obj;\n },\n xmltop: function xmltop(tagname, xhr, obj) {\n if (typeof xhr.status == \"undefined\" || xhr.status < 400) {\n var xml = !xhr.responseXML ? this.parse(xhr.responseText || xhr) : xhr.responseXML || xhr;\n\n if (xml && xml.documentElement !== null && !xml.getElementsByTagName(\"parsererror\").length) {\n return xml.getElementsByTagName(tagname)[0];\n }\n }\n\n if (obj !== -1) gantt.callEvent(\"onLoadXMLError\", [\"Incorrect XML\", arguments[1], obj]);\n return document.createElement(\"DIV\");\n },\n xpath: function xpath(xpathExp, docObj) {\n if (!docObj.nodeName) docObj = docObj.responseXML || docObj;\n\n if (env.isIE) {\n return docObj.selectNodes(xpathExp) || [];\n } else {\n var rows = [];\n var first;\n var col = (docObj.ownerDocument || docObj).evaluate(xpathExp, docObj, null, XPathResult.ANY_TYPE, null);\n\n while (true) {\n first = col.iterateNext();\n\n if (first) {\n rows.push(first);\n } else {\n break;\n }\n }\n\n return rows;\n }\n },\n query: function query(config) {\n return this._call(config.method || \"GET\", config.url, config.data || \"\", config.async || true, config.callback, config.headers);\n },\n get: function get(url, onLoad, headers) {\n var config = createConfig(\"GET\", arguments);\n return this.query(config);\n },\n getSync: function getSync(url, headers) {\n var config = createConfig(\"GET\", arguments);\n config.async = false;\n return this.query(config);\n },\n put: function put(url, postData, onLoad, headers) {\n var config = createConfig(\"PUT\", arguments);\n return this.query(config);\n },\n del: function del(url, onLoad, headers) {\n /**\r\n * https://tools.ietf.org/html/rfc7231#section-4.3.5\r\n * A payload within a DELETE request message has no defined semantics;\r\n * sending a payload body on a DELETE request might cause some existing\r\n * implementations to reject the request.\r\n */\n var config = createConfig(\"DELETE\", arguments);\n return this.query(config);\n },\n post: function post(url, postData, onLoad, headers) {\n if (arguments.length == 1) {\n postData = \"\";\n } else if (arguments.length == 2 && typeof postData == \"function\") {\n onLoad = postData;\n postData = \"\";\n }\n\n var config = createConfig(\"POST\", arguments);\n return this.query(config);\n },\n postSync: function postSync(url, postData, headers) {\n postData = postData === null ? \"\" : String(postData);\n var config = createConfig(\"POST\", arguments);\n config.async = false;\n return this.query(config);\n },\n _call: function _call(method, url, postData, async, onLoad, headers) {\n return new gantt.Promise(function (resolve, reject) {\n var t = (typeof XMLHttpRequest === \"undefined\" ? \"undefined\" : _typeof(XMLHttpRequest)) !== undefined ? new XMLHttpRequest() : new global.ActiveXObject(\"Microsoft.XMLHTTP\");\n var isQt = navigator.userAgent.match(/AppleWebKit/) !== null && navigator.userAgent.match(/Qt/) !== null && navigator.userAgent.match(/Safari/) !== null;\n\n if (!!async) {\n t.onreadystatechange = function () {\n if (t.readyState == 4 || isQt && t.readyState == 3) {\n // what for long response and status 404?\n if (t.status != 200 || t.responseText === \"\") if (!gantt.callEvent(\"onAjaxError\", [t])) return;\n setTimeout(function () {\n if (typeof onLoad == \"function\") {\n onLoad.apply(global, [{\n xmlDoc: t,\n filePath: url\n }]); // dhtmlx-compat, response.xmlDoc.responseXML/responseText\n }\n\n resolve(t);\n\n if (typeof onLoad == \"function\") {\n onLoad = null;\n t = null;\n }\n }, 0);\n }\n };\n }\n\n var noCache = !this || !this.cache;\n\n if (method == \"GET\" && noCache) {\n url += (url.indexOf(\"?\") >= 0 ? \"&\" : \"?\") + \"dhxr\" + new Date().getTime() + \"=1\";\n }\n\n t.open(method, url, async);\n\n if (headers) {\n for (var key in headers) {\n t.setRequestHeader(key, headers[key]);\n }\n } else if (method.toUpperCase() == \"POST\" || method == \"PUT\" || method == \"DELETE\") {\n t.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\n } else if (method == \"GET\") {\n postData = null;\n }\n\n t.setRequestHeader(\"X-Requested-With\", \"XMLHttpRequest\");\n t.send(postData);\n if (!async) return {\n xmlDoc: t,\n filePath: url\n }; // dhtmlx-compat, response.xmlDoc.responseXML/responseText\n });\n },\n urlSeparator: function urlSeparator(str) {\n if (str.indexOf(\"?\") != -1) return \"&\";else return \"?\";\n }\n };\n};","type DurationUnits = \"minute\" | \"hour\" | \"day\" | \"week\" | \"month\" | \"year\";\r\ntype Align = \"left\" | \"center\" | \"right\";\r\ntype SectionType = \"textarea\"\r\n\t\t\t\t\t| \"time\"\r\n\t\t\t\t\t| \"duration\"\r\n\t\t\t\t\t| \"select\"\r\n\t\t\t\t\t| \"typeselect\"\r\n\t\t\t\t\t| \"parent\"\r\n\t\t\t\t\t| \"template\"\r\n\t\t\t\t\t| \"checkbox\"\r\n\t\t\t\t\t| \"radio\"\r\n\t\t\t\t\t| \"resources\"\r\n\t\t\t\t\t| \"constraint\";\r\n\r\ntype LightboxSection = Array;\r\n\r\ntype LayoutView = \"grid\"\r\n\t| \"timeline\"\r\n\t| \"resizer\"\r\n\t| \"scrollbar\"\r\n\t| \"resourceGrid\"\r\n\t| \"resourceTimeline\";\r\n\r\ninterface IColumnItem {\r\n\tname: string;\r\n\tlabel?: string;\r\n\ttree?: boolean;\r\n\talign?: Align;\r\n\thide?: boolean;\r\n\tmax_width?: number;\r\n\tmin_width?: number;\r\n\tresize?: boolean;\r\n\ttemplate?: (obj: any) => string;\r\n\twidth?: number | \"*\";\r\n}\r\n\r\nexport type TModifierKeys = \"metaKey\" | \"ctrlKey\" | \"altKey\" | \"shiftKey\" | false | undefined;\r\n\r\nexport interface IScale {\r\n\tcss?: () => string;\r\n\tdate?: string;\r\n\tstep: number;\r\n\ttemplate?: (date: Date) => string;\r\n\tunit: DurationUnits;\r\n}\r\n\r\ninterface ILightboxSection {\r\n\tname: string;\r\n\tmap_to: string;\r\n\ttype: SectionType;\r\n\theight?: number;\r\n\tfocus?: boolean;\r\n}\r\n\r\ninterface ILightboxTimeAndDurationSection extends ILightboxSection {\r\n\treadonly: boolean;\r\n\tyear_range: number[] | number;\r\n\tsingle_date: boolean;\r\n\ttime_format: string;\r\n}\r\n\r\ninterface ILightboxInputControl extends ILightboxSection {\r\n\tdefault_value?: any;\r\n\toptions?: Array<{key: string, label: string}>;\r\n}\r\n\r\ninterface ILightboxSelectControl extends ILightboxInputControl {\r\n\tonchange: () => boolean | undefined;\r\n}\r\n\r\ninterface ILightboxParentControl extends ILightboxSection {\r\n\tallow_root: boolean;\r\n\troot_label: string;\r\n\tsort?: (a: any, b: any) => -1 | 0 | 1;\r\n\tfilter?: (task: string | number | object) => boolean;\r\n\ttemplate?: (start: Date, end: Date, ev: object) => string;\r\n}\r\n\r\ninterface ILightboxTypeselectControl extends ILightboxSection {\r\n\tfilter?: (typeName: string) => boolean;\r\n}\r\n\r\n\r\ninterface ILayoutScrollbar {\r\n\tview: \"scrollbar\";\r\n\tscroll?: \"x\" | \"y\";\r\n\tid: string;\r\n\theight?: number;\r\n\twidth?: number;\r\n}\r\n\r\ninterface ILayoutView {\r\n\tview: LayoutView;\r\n\tid?: string;\r\n\tscrollX?: string;\r\n\tscrollY?: string;\r\n\tconfig?: object;\r\n}\r\n\r\ninterface ILayoutGrid extends ILayoutView {\r\n\tview: \"grid\";\r\n\tbind?: string;\r\n}\r\n\r\ninterface ILayoutTimeline extends ILayoutView {\r\n\tview: \"timeline\";\r\n\tbindLinks?: string;\r\n\tlayers?: any[];\r\n}\r\n\r\ninterface ILayoutResizer {\r\n\tview?: undefined;\r\n\tresizer: boolean;\r\n\twidth: number;\r\n}\r\n\r\ninterface ILayoutResourceGrid extends ILayoutView {\r\n\tview: \"resourceGrid\";\r\n\twidth: number;\r\n\tgroup: \"string\";\r\n}\r\n\r\ninterface ILayoutResourceTimeline extends ILayoutView {\r\n\tview: \"resourceTimeline\";\r\n\twidth: number;\r\n\tgroup: \"string\";\r\n}\r\n\r\ninterface ILayoutHtml {\r\n\thtml: string;\r\n\tcss: string;\r\n\twidth: number;\r\n}\r\n\r\ntype LayoutRow = ILayoutGrid\r\n\t| ILayoutTimeline\r\n\t| ILayoutResizer\r\n\t| ILayoutResourceGrid\r\n\t| ILayoutResourceTimeline\r\n\t| ILayoutHtml\r\n\t| ILayoutScrollbar\r\n\t| { cols: LayoutCol[] };\r\n\r\ntype LayoutCol = ILayoutGrid\r\n\t| ILayoutTimeline\r\n\t| ILayoutResizer\r\n\t| ILayoutResourceGrid\r\n\t| ILayoutResourceTimeline\r\n\t| ILayoutHtml\r\n\t| ILayoutScrollbar\r\n\t| { rows: LayoutRow[] };\r\n\r\ninterface ILayout {\r\n\tcss: string;\r\n\trows?: LayoutRow[];\r\n\tcols?: LayoutCol[];\r\n}\r\n\r\ntype TCsp = boolean | \"auto\";\r\n\r\ninterface IResourceConfig {\r\n\tdataprocessor_assignments?: boolean;\r\n\tdataprocessor_resources?: boolean;\r\n\teditable_resource_diagram?: boolean;\r\n\tresource_store?: {\r\n\t\ttype?: \"treeDataStore\"|\"dataStore\"|string;\r\n\t\tfetchTasks?: boolean;\r\n\t\tinitItem?: (item: any) => any;\r\n\t};\r\n\tlightbox_resources?: (resources: any[]) => any[];\r\n\r\n}\r\n\r\ninterface IGanttConfig {\r\n\tlayout: ILayout;\r\n\tlinks: {\r\n\t\tfinish_to_start: \"0\";\r\n\t\tstart_to_start: \"1\";\r\n\t\tfinish_to_finish: \"2\";\r\n\t\tstart_to_finish: \"3\";\r\n\t};\r\n\ttypes: {\r\n\t\ttask: string;\r\n\t\tproject: string;\r\n\t\tmilestone: string;\r\n\t};\r\n\tauto_types: boolean;\r\n\tduration_unit: DurationUnits;\r\n\twork_time: boolean;\r\n\tcorrect_work_time: boolean;\r\n\tskip_off_time: boolean;\r\n\tcascade_delete: boolean;\r\n\tautosize: boolean | string;\r\n\tautoscroll: boolean;\r\n\tshow_links: boolean;\r\n\tshow_task_cells: boolean;\r\n\tautosize_min_width: number;\r\n\tautoscroll_speed: number;\r\n\tdeepcopy_on_parse: boolean;\r\n\tstatic_background: boolean;\r\n\tstatic_background_cells: boolean;\r\n\tbranch_loading: boolean;\r\n\tbranch_loading_property: string;\r\n\tshow_loading: boolean;\r\n\tshow_chart: boolean;\r\n\tshow_grid: boolean;\r\n\tmin_duration: number;\r\n\tdate_format: string; // use instead xml_date\r\n\txml_date?: string; // deprecated\r\n\tstart_on_monday: boolean;\r\n\tserver_utc: boolean;\r\n\tshow_progress: boolean;\r\n\tfit_tasks: boolean;\r\n\tselect_task: boolean;\r\n\tscroll_on_click: boolean;\r\n\tsmart_rendering: boolean;\r\n\tpreserve_scroll: boolean;\r\n\treadonly: boolean;\r\n\tcontainer_resize_timeout: number;\r\n\r\n\t/*grid */\r\n\tdate_grid: string;\r\n\r\n\tdrag_links: boolean;\r\n\tdrag_progress: boolean;\r\n\tdrag_resize: boolean;\r\n\tdrag_project: boolean;\r\n\tdrag_move: boolean;\r\n\tdrag_mode: {\r\n\t\tresize: \"resize\",\r\n\t\tprogress: \"progress\",\r\n\t\tmove: \"move\",\r\n\t\tignore: \"ignore\"\r\n\t};\r\n\tround_dnd_dates: boolean;\r\n\tlink_wrapper_width: number;\r\n\troot_id: string | number;\r\n\r\n\tautofit: boolean;\r\n\tcolumns: IColumnItem[];\r\n\r\n\t/* scale*/\r\n\t/* it will be deprecated */\r\n\tdate_scale?: string;\r\n\tstep?: number;\r\n\tscale_unit?: DurationUnits;\r\n\tsubscales?: IScale[];\r\n\t/* it will be deprecated end */\r\n\r\n\tscales: IScale[];\r\n\r\n\tscale_offset_minimal: boolean;\r\n\r\n\tinherit_scale_class: boolean;\r\n\r\n\r\n\ttime_step: number;\r\n\tduration_step: number;\r\n\r\n\r\n\ttask_date: string;\r\n\ttime_picker: string;\r\n\ttask_attribute: string;\r\n\tlink_attribute: string;\r\n\tlayer_attribute: string;\r\n\tbuttons_left: string[];\r\n\t_migrate_buttons: {\r\n\t\tdhx_save_btn: \"gantt_save_btn\",\r\n\t\tdhx_cancel_btn: \"gantt_cancel_btn\",\r\n\t\tdhx_delete_btn: \"gantt_delete_btn\"\r\n\t};\r\n\r\n\tbuttons_right: string[];\r\n\r\n\r\n\tlightbox: {\r\n\t\tsections?: LightboxSection,\r\n\t\tproject_sections?: LightboxSection,\r\n\t\tmilestone_sections?: LightboxSection\r\n\t};\r\n\tdrag_lightbox: boolean;\r\n\tsort: boolean;\r\n\tdetails_on_create: boolean;\r\n\tdetails_on_dblclick: boolean;\r\n\tinitial_scroll: boolean;\r\n\ttask_scroll_offset: number;\r\n\r\n\torder_branch: boolean;\r\n\torder_branch_free: boolean;\r\n\r\n\t// task_height is deprecated, use 'bar_height` instead\r\n\ttask_height: number | \"full\";\r\n\tbar_height: number | \"full\";\r\n\tmin_column_width: number;\r\n\r\n\t// min width for grid column (when resizing)\r\n\tmin_grid_column_width: number;\r\n\t// name of the attribute with column index for resize element\r\n\tgrid_resizer_column_attribute: string;\r\n\t// name of the attribute with column index for resize element\r\n\t// grid_resizer_attribute: string; // usage of this parameter is not found\r\n\r\n\t// grid width can be increased after the column has been resized\r\n\tkeep_grid_width: boolean;\r\n\r\n\t// grid width can be adjusted\r\n\tgrid_resize: boolean;\r\n\tgrid_elastic_columns: boolean;\r\n\tshow_tasks_outside_timescale: boolean;\r\n\tshow_unscheduled: boolean;\r\n\treadonly_property: string;\r\n\teditable_property: string;\r\n\tcalendar_property: string;\r\n\tresource_calendars: object;\r\n\tdynamic_resource_calendars: boolean;\r\n\tinherit_calendar: boolean;\r\n\ttype_renderers: object;\r\n\r\n\tresize_rows: boolean;\r\n\t// name of the attribute with row index for resize element\r\n\ttask_grid_row_resizer_attribute: string;\r\n\t// min height for row (when resizing)\r\n\tmin_task_grid_row_height: number;\r\n\r\n\topen_tree_initially: boolean;\r\n\toptimize_render: boolean;\r\n\tprevent_default_scroll: boolean;\r\n\tshow_errors: boolean;\r\n\twai_aria_attributes: boolean;\r\n\tsmart_scales: boolean;\r\n\trtl: boolean;\r\n\tplaceholder_task: boolean | object;\r\n\thorizontal_scroll_key: TModifierKeys;\r\n\tdrag_timeline: {\r\n\t\tuseKey: TModifierKeys;\r\n\t\tignore: string;\r\n\t};\r\n\tdrag_multiple: boolean;\r\n\tcsp: TCsp;\r\n\r\n\tresources?: IResourceConfig;\r\n}\r\n\r\nmodule.exports = () => {\r\n\tconst result: IGanttConfig = {\r\n\t\tlayout: {\r\n\t\t\tcss: \"gantt_container\",\r\n\t\t\trows: [\r\n\t\t\t\t{\r\n\t\t\t\t\tcols: [\r\n\t\t\t\t\t\t{view: \"grid\", scrollX: \"scrollHor\", scrollY: \"scrollVer\"},\r\n\t\t\t\t\t\t{resizer: true, width: 1},\r\n\t\t\t\t\t\t{view: \"timeline\", scrollX: \"scrollHor\", scrollY: \"scrollVer\"},\r\n\t\t\t\t\t\t{view: \"scrollbar\", id: \"scrollVer\"}\r\n\t\t\t\t\t]\r\n\t\t\t\t},\r\n\t\t\t\t{view: \"scrollbar\", id: \"scrollHor\", height: 20}\r\n\t\t\t]\r\n\t\t},\r\n\t\tlinks: {\r\n\t\t\tfinish_to_start: \"0\",\r\n\t\t\tstart_to_start: \"1\",\r\n\t\t\tfinish_to_finish: \"2\",\r\n\t\t\tstart_to_finish: \"3\"\r\n\t\t},\r\n\t\ttypes: {\r\n\t\t\ttask: \"task\",\r\n\t\t\tproject: \"project\",\r\n\t\t\tmilestone: \"milestone\"\r\n\t\t},\r\n\t\tauto_types: false,\r\n\t\tduration_unit: \"day\",\r\n\t\twork_time: false,\r\n\t\tcorrect_work_time: false,\r\n\t\tskip_off_time: false,\r\n\r\n\t\tcascade_delete: true,\r\n\r\n\t\tautosize: false,\r\n\t\tautosize_min_width: 0,\r\n\t\tautoscroll: true,\r\n\t\tautoscroll_speed: 30,\r\n\t\tdeepcopy_on_parse: false,\r\n\t\tshow_links: true,\r\n\t\tshow_task_cells: true,\r\n\t\t// replace backgroung of the task area with a canvas img\r\n\t\tstatic_background: false,\r\n\t\tstatic_background_cells: true,\r\n\t\tbranch_loading: false,\r\n\t\tbranch_loading_property: \"$has_child\",\r\n\t\tshow_loading: false,\r\n\t\tshow_chart: true,\r\n\t\tshow_grid: true,\r\n\t\tmin_duration: 60 * 60 * 1000,\r\n\t\tdate_format: \"%d-%m-%Y %H:%i\", // use instead xml_date\r\n\t\txml_date: undefined, // \"%d-%m-%Y %H:%i\", // deprecated\r\n\t\tstart_on_monday: true,\r\n\t\tserver_utc: false,\r\n\t\tshow_progress: true,\r\n\t\tfit_tasks: false,\r\n\t\tselect_task: true,\r\n\t\tscroll_on_click: true,\r\n\t\tsmart_rendering: true,\r\n\t\tpreserve_scroll: true,\r\n\t\treadonly: false,\r\n\t\tcontainer_resize_timeout: 20,\r\n\r\n\t\t/*grid */\r\n\t\tdate_grid: \"%Y-%m-%d\",\r\n\r\n\t\tdrag_links: true,\r\n\t\tdrag_progress: true,\r\n\t\tdrag_resize: true,\r\n\t\tdrag_project: false,\r\n\t\tdrag_move: true,\r\n\t\tdrag_mode: {\r\n\t\t\tresize: \"resize\",\r\n\t\t\tprogress: \"progress\",\r\n\t\t\tmove: \"move\",\r\n\t\t\tignore: \"ignore\"\r\n\t\t},\r\n\t\tround_dnd_dates: true,\r\n\t\tlink_wrapper_width: 20,\r\n\t\troot_id: 0,\r\n\r\n\t\tautofit: false, // grid column automatic fit grid_width config\r\n\t\tcolumns: [\r\n\t\t\t{name: \"text\", tree: true, width: \"*\", resize: true},\r\n\t\t\t{name: \"start_date\", align: \"center\", resize: true},\r\n\t\t\t{name: \"duration\", align: \"center\"},\r\n\t\t\t{name: \"add\", width: 44}\r\n\t\t],\r\n\r\n\t\t/*scale*/\r\n\r\n\t\tscale_offset_minimal: true,\r\n\t\tinherit_scale_class: false,\r\n\r\n\t\tscales: [\r\n\t\t\t{\r\n\t\t\t\tunit: \"day\",\r\n\t\t\t\tstep: 1,\r\n\t\t\t\tdate: \"%d %M\"\r\n\t\t\t}\r\n\t\t],\r\n// \t\tdate_scale: \"%d %M\",\r\n\r\n\t\ttime_step: 60,\r\n\t\tduration_step: 1,\r\n\t\ttask_date: \"%d %F %Y\",\r\n\t\ttime_picker: \"%H:%i\",\r\n\t\ttask_attribute: \"data-task-id\",\r\n\t\tlink_attribute: \"data-link-id\",\r\n\t\tlayer_attribute: \"data-layer\",\r\n\t\tbuttons_left: [\r\n\t\t\t\"gantt_save_btn\",\r\n\t\t\t\"gantt_cancel_btn\"\r\n\t\t],\r\n\t\t_migrate_buttons: {\r\n\t\t\tdhx_save_btn: \"gantt_save_btn\",\r\n\t\t\tdhx_cancel_btn: \"gantt_cancel_btn\",\r\n\t\t\tdhx_delete_btn: \"gantt_delete_btn\"\r\n\t\t},\r\n\t\tbuttons_right: [\r\n\t\t\t\"gantt_delete_btn\"\r\n\t\t],\r\n\t\tlightbox: {\r\n\t\t\tsections: [\r\n\t\t\t\t{name: \"description\", height: 70, map_to: \"text\", type: \"textarea\", focus: true},\r\n\t\t\t\t{name: \"time\", type: \"duration\", map_to: \"auto\"}\r\n\t\t\t],\r\n\t\t\tproject_sections: [\r\n\t\t\t\t{name: \"description\", height: 70, map_to: \"text\", type: \"textarea\", focus: true},\r\n\t\t\t\t{name: \"type\", type: \"typeselect\", map_to: \"type\"},\r\n\t\t\t\t{name: \"time\", type: \"duration\", readonly: true, map_to: \"auto\"}\r\n\t\t\t],\r\n\t\t\tmilestone_sections: [\r\n\t\t\t\t{name: \"description\", height: 70, map_to: \"text\", type: \"textarea\", focus: true},\r\n\t\t\t\t{name: \"type\", type: \"typeselect\", map_to: \"type\"},\r\n\t\t\t\t{name: \"time\", type: \"duration\", single_date: true, map_to: \"auto\"}\r\n\t\t\t]\r\n\t\t},\r\n\t\tdrag_lightbox: true,\r\n\t\tsort: false,\r\n\t\tdetails_on_create: true,\r\n\t\tdetails_on_dblclick: true,\r\n\t\tinitial_scroll: true,\r\n\t\ttask_scroll_offset: 100,\r\n\r\n\t\torder_branch: false,\r\n\t\torder_branch_free: false,\r\n\r\n\t\t// task height is deprecated, use 'bar_height' instead\r\n\t\ttask_height: undefined,// number px of 'full' for row height\r\n\t\tbar_height: \"full\",\r\n\t\tmin_column_width: 70,\r\n\r\n\t\t// min width for grid column (when resizing)\r\n\t\tmin_grid_column_width: 70,\r\n\t\t// name of the attribute with column index for resize element\r\n\t\tgrid_resizer_column_attribute: \"data-column-index\",\r\n\t\t// name of the attribute with column index for resize element\r\n\t\t// grid_resizer_attribute: \"grid_resizer\", // - usage of this parameter is not found in code\r\n\r\n\t\t// grid width can be increased after the column has been resized\r\n\t\tkeep_grid_width: false,\r\n\r\n\t\t// grid width can be adjusted\r\n\t\tgrid_resize: false,\r\n\t\tgrid_elastic_columns: false,\r\n\t\tshow_tasks_outside_timescale: false,\r\n\t\tshow_unscheduled: true,\r\n\r\n\t\tresize_rows: false,\r\n\t\t// name of the attribute with row index for resize element\r\n\t\ttask_grid_row_resizer_attribute: \"data-row-index\",\r\n\t\t// min height for row (when resizing)\r\n\t\tmin_task_grid_row_height: 30,\r\n\r\n\t\t//\r\n\t\treadonly_property: \"readonly\",\r\n\t\teditable_property: \"editable\",\r\n\t\tcalendar_property: \"calendar_id\",\r\n\t\tresource_calendars: {},\r\n\t\tdynamic_resource_calendars: false,\r\n\t\tinherit_calendar: false,\r\n\t\ttype_renderers: {},\r\n\r\n\t\topen_tree_initially: false,\r\n\t\toptimize_render: true,\r\n\t\tprevent_default_scroll: false,\r\n\t\tshow_errors: true,\r\n\t\twai_aria_attributes: true,\r\n\t\tsmart_scales: true,\r\n\t\trtl:false,\r\n\t\tplaceholder_task: false,\r\n\t\thorizontal_scroll_key: \"shiftKey\",\r\n\t\tdrag_timeline: {\r\n\t\t\tuseKey: undefined,\r\n\t\t\tignore: \".gantt_task_line, .gantt_task_link\"\r\n\t\t},\r\n\t\tdrag_multiple: true,\r\n\t\tcsp: \"auto\"\r\n\t};\r\n\treturn result;\r\n};\r\n","module.exports = function () {\n var services = {};\n\n function register(name, getter) {\n services[name] = getter;\n }\n\n function getService(name) {\n if (!services[name]) {\n return null;\n }\n\n return services[name]();\n }\n\n function dropService(name) {\n if (services[name]) {\n delete services[name];\n }\n }\n\n var servicesEnum = {};\n return {\n services: servicesEnum,\n setService: register,\n getService: getService,\n dropService: dropService,\n destructor: function destructor() {\n for (var i in services) {\n if (services[i]) {\n var service = services[i];\n\n if (service && service.destructor) {\n service.destructor();\n }\n }\n }\n\n services = null;\n }\n };\n};","export default class ExtensionsManager{\r\n\tprivate _extensions:{[key:string]: GanttPlugin };\r\n\r\n\tconstructor(config: {[key:string]: GanttPlugin }){\r\n\t\tthis._extensions = {};\r\n\t\tfor(const i in config){\r\n\t\t\tthis._extensions[i] = config[i];\r\n\t\t}\r\n\t}\r\n\r\n\taddExtension = (name: string, ext: GanttPlugin) => {\r\n\t\tthis._extensions[name] = ext;\r\n\t}\r\n\r\n\tgetExtension = (name: string): GanttPlugin => {\r\n\t\treturn this._extensions[name];\r\n\t}\r\n}","module.exports = {\n KEY_CODES: {\n UP: 38,\n DOWN: 40,\n LEFT: 37,\n RIGHT: 39,\n SPACE: 32,\n ENTER: 13,\n DELETE: 46,\n ESC: 27,\n TAB: 9\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\nfunction DHXGantt() {\n this.constants = require(\"../constants\");\n this.version = VERSION;\n this.license = LICENSE;\n this.templates = {};\n this.ext = {};\n this.keys = {\n edit_save: this.constants.KEY_CODES.ENTER,\n edit_cancel: this.constants.KEY_CODES.ESC\n };\n}\n\nmodule.exports = function (supportedExtensions) {\n // use a named constructor to make gantt instance discoverable in heap snapshots\n var gantt = new DHXGantt();\n\n var ExtensionManager = require(\"../ext/extension_manager\")[\"default\"];\n\n var extensionManager = new ExtensionManager(supportedExtensions);\n var activePlugins = {};\n\n gantt.plugins = function (config) {\n for (var i in config) {\n if (config[i] && !activePlugins[i]) {\n var plugin = extensionManager.getExtension(i);\n\n if (plugin) {\n plugin(gantt);\n activePlugins[i] = true;\n }\n }\n }\n\n return activePlugins;\n };\n\n gantt.$services = require(\"../core/common/services\")();\n gantt.config = require(\"../core/common/config\")();\n gantt.ajax = require(\"../core/common/ajax\")(gantt);\n gantt.date = require(\"../core/common/date\")(gantt);\n gantt.RemoteEvents = require(\"../core/remote/remote_events\").remoteEvents;\n\n var dnd = require(\"../core/common/dnd\")(gantt);\n\n gantt.$services.setService(\"dnd\", function () {\n return dnd;\n });\n\n var templatesLoader = require(\"../core/common/templates\")(gantt);\n\n gantt.$services.setService(\"templateLoader\", function () {\n return templatesLoader;\n });\n\n require(\"../utils/eventable\")(gantt);\n\n var StateService = require(\"../core/common/state\");\n\n var stateService = new StateService();\n stateService.registerProvider(\"global\", function () {\n var res = {\n min_date: gantt._min_date,\n max_date: gantt._max_date,\n selected_task: null\n }; // do not throw error if getState called from non-initialized gantt\n\n if (gantt.$data && gantt.$data.tasksStore) {\n res.selected_task = gantt.$data.tasksStore.getSelectedId();\n }\n\n return res;\n });\n gantt.getState = stateService.getState;\n gantt.$services.setService(\"state\", function () {\n return stateService;\n });\n\n var utils = require(\"../utils/utils\");\n\n utils.mixin(gantt, utils);\n gantt.Promise = require(\"../utils/promise\");\n gantt.env = require(\"../utils/env\");\n\n require(\"../core/datastore/datastore_hooks\")(gantt);\n\n var DataProcessor = require(\"../core/dataprocessor\");\n\n gantt.dataProcessor = DataProcessor.DEPRECATED_api;\n gantt.createDataProcessor = DataProcessor.createDataProcessor;\n\n require(\"../core/plugins\")(gantt);\n\n require(\"../core/dynamic_loading\")(gantt);\n\n require(\"../core/grid_column_api\")(gantt);\n\n require(\"../core/tasks\")(gantt);\n\n require(\"../core/load\")(gantt);\n\n require(\"../core/worktime/work_time\")(gantt);\n\n require(\"../core/data\")(gantt);\n\n require(\"../publish_helpers/void_script_second\")[\"default\"](gantt);\n\n require(\"../core/data_task_types\")(gantt);\n\n require(\"../core/cached_functions\")(gantt);\n\n require(\"../core/gantt_core\")(gantt);\n\n require(\"../core/destructor\")(gantt);\n\n require(\"../publish_helpers/void_script_third\")[\"default\"](gantt);\n\n var i18n = require(\"../locale\")[\"default\"]();\n\n gantt.i18n = {\n addLocale: i18n.addLocale,\n setLocale: function setLocale(locale) {\n if (typeof locale === \"string\") {\n var localeObject = i18n.getLocale(locale);\n\n if (!localeObject) {\n localeObject = i18n.getLocale(\"en\");\n }\n\n gantt.locale = localeObject;\n } else if (locale) {\n if (!gantt.locale) {\n gantt.locale = locale;\n } else {\n for (var i in locale) {\n if (locale[i] && _typeof(locale[i]) === \"object\") {\n if (!gantt.locale[i]) {\n gantt.locale[i] = {};\n }\n\n gantt.mixin(gantt.locale[i], locale[i], true);\n } else {\n gantt.locale[i] = locale[i];\n }\n }\n }\n }\n },\n getLocale: i18n.getLocale\n };\n gantt.i18n.setLocale(\"en\");\n return gantt;\n};","require(\"css/skins/terrace.less\");\n\nvar factory = require(\"./make_instance_common\");\n\nmodule.exports = function (supportedExtensions) {\n var gantt = factory(supportedExtensions);\n\n if (!gantt.env.isNode) {\n require(\"../core/ui_core\")(gantt);\n }\n\n return gantt;\n};","import { IUndo, IUndoCommand, IUndoCommands, IUndoPropAction, IUndoPropCommand, TActionType, TEntityType, TUndoStack, TUndoValue } from \"./types\";\r\n\r\nconst MAX_UNDO_STEPS = 100;\r\n\r\nexport class Undo implements IUndo {\r\n\r\n\tmaxSteps = MAX_UNDO_STEPS;\r\n\tundoEnabled = true;\r\n\tredoEnabled = true;\r\n\taction: IUndoPropAction = {\r\n\t\tcreate: (commands?: IUndoCommand[]): IUndoCommands => {\r\n\t\t\treturn { commands: (commands ? commands.slice() : []) };\r\n\t\t},\r\n\t\tinvert: (action: IUndoCommands): IUndoCommands => {\r\n\t\t\tconst gantt = this._gantt;\r\n\t\t\tconst revert = gantt.copy(action);\r\n\t\t\tconst commands = this.command;\r\n\t\t\tfor (let i = 0; i < action.commands.length; i++) {\r\n\t\t\t\tconst command = revert.commands[i] = commands.invert(revert.commands[i]);\r\n\t\t\t\tif (command.type === commands.type.update || command.type === commands.type.move) {\r\n\t\t\t\t\t[command.value, command.oldValue] = [command.oldValue, command.value];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn revert as IUndoCommands;\r\n\t\t}\r\n\t};\r\n\tcommand: IUndoPropCommand = {\r\n\t\t// entities that require different processing for undoing-redoing changes (gantt.config.undo_types)\r\n\t\tentity: null,\r\n\r\n\t\t// types of traced actions (gantt.config.undo_actions)\r\n\t\ttype: null,\r\n\r\n\t\tcreate: (value: TUndoValue, oldValue: TUndoValue, type: TActionType, entity: TEntityType): IUndoCommand => {\r\n\t\t\tconst gantt = this._gantt;\r\n\t\t\treturn {\r\n\t\t\t\tentity,\r\n\t\t\t\ttype,\r\n\t\t\t\tvalue: gantt.copy(value),\r\n\t\t\t\toldValue: gantt.copy(oldValue || value)\r\n\t\t\t};\r\n\t\t},\r\n\t\tinvert: (command: IUndoCommand): IUndoCommand => {\r\n\t\t\tconst gantt = this._gantt;\r\n\t\t\tconst revert = gantt.copy(command);\r\n\t\t\trevert.type = this.command.inverseCommands(command.type);\r\n\t\t\treturn revert;\r\n\t\t},\r\n\t\tinverseCommands: (command: TActionType): TActionType => {\r\n\t\t\tconst gantt = this._gantt;\r\n\t\t\tconst types = this.command.type;\r\n\t\t\tswitch (command) {\r\n\t\t\t\tcase types.update:\r\n\t\t\t\t\treturn types.update;\r\n\t\t\t\tcase types.remove:\r\n\t\t\t\t\treturn types.add;\r\n\t\t\t\tcase types.add:\r\n\t\t\t\t\treturn types.remove;\r\n\t\t\t\tcase types.move:\r\n\t\t\t\t\treturn types.move;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tgantt.assert(false, \"Invalid command \"+ command);\r\n\t\t\t\t\treturn null;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\tprivate _undoStack = [];\r\n\tprivate _redoStack = [];\r\n\tprivate _gantt: any;\r\n\r\n\tconstructor(gantt: any){\r\n\t\tthis._gantt = gantt;\r\n\t}\r\n\tgetUndoStack() {\r\n\t\treturn this._undoStack;\r\n\t}\r\n\tsetUndoStack(stack: []) {\r\n\t\tthis._undoStack = stack;\r\n\t}\r\n\r\n\tgetRedoStack() {\r\n\t\treturn this._redoStack;\r\n\t}\r\n\tsetRedoStack(stack: []) {\r\n\t\tthis._redoStack = stack;\r\n\t}\r\n\r\n\tclearUndoStack() {\r\n\t\tthis._undoStack = [];\r\n\t}\r\n\r\n\tclearRedoStack() {\r\n\t\tthis._redoStack = [];\r\n\t}\r\n\r\n\tupdateConfigs() {\r\n\t\tconst gantt = this._gantt;\r\n\t\tthis.maxSteps = gantt.config.undo_steps || MAX_UNDO_STEPS;\r\n\t\tthis.command.entity = gantt.config.undo_types;\r\n\t\tthis.command.type = gantt.config.undo_actions;\r\n\t\tthis.undoEnabled = !!gantt.config.undo;\r\n\t\tthis.redoEnabled = !!gantt.config.redo; // GS-873, Redo should work even when the `gantt.config.undo` is disabled.\r\n\t}\r\n\r\n\tundo() {\r\n\t\tconst gantt = this._gantt;\r\n\t\tthis.updateConfigs();\r\n\t\tif (!this.undoEnabled) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst action = this._pop(this._undoStack);\r\n\t\tif (action) {\r\n\t\t\tthis._reorderCommands(action);\r\n\t\t}\r\n\t\tif (gantt.callEvent(\"onBeforeUndo\", [action]) !== false) {\r\n\t\t\tif (action) {\r\n\t\t\t\tthis._applyAction(this.action.invert(action));\r\n\t\t\t\tthis._push(this._redoStack, gantt.copy(action));\r\n\t\t\t\tgantt.callEvent(\"onAfterUndo\", [action]);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t\tgantt.callEvent(\"onAfterUndo\", [null]);\r\n\t}\r\n\r\n\tredo() {\r\n\t\tconst gantt = this._gantt;\r\n\t\tthis.updateConfigs();\r\n\t\tif (!this.redoEnabled) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst action = this._pop(this._redoStack);\r\n\t\tif (action) {\r\n\t\t\tthis._reorderCommands(action);\r\n\t\t}\r\n\r\n\t\tif (gantt.callEvent(\"onBeforeRedo\", [action]) !== false) {\r\n\t\t\tif (action) {\r\n\t\t\t\tthis._applyAction(action);\r\n\t\t\t\tthis._push(this._undoStack, gantt.copy(action));\r\n\t\t\t\tgantt.callEvent(\"onAfterRedo\", [action]);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t\tgantt.callEvent(\"onAfterRedo\", [null]);\r\n\t}\r\n\r\n\t// storeUndo:\r\n\tlogAction(action: IUndoCommands) {\r\n\t\tthis._push(this._undoStack, action);\r\n\t\tthis._redoStack = [];\r\n\t}\r\n\r\n\tprivate _push(stack: TUndoStack, action: IUndoCommands): IUndoCommands {\r\n\t\tconst gantt = this._gantt;\r\n\t\tif (!action.commands.length) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst event = stack === this._undoStack ? \"onBeforeUndoStack\" : \"onBeforeRedoStack\";\r\n\t\tif (gantt.callEvent(event, [action]) === false){\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t// commands can be removed from event handler\r\n\t\tif (!action.commands.length) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tstack.push(action);\r\n\t\twhile (stack.length > this.maxSteps) {\r\n\t\t\tstack.shift();\r\n\t\t}\r\n\t\treturn action;\r\n\t}\r\n\r\n\tprivate _pop(stack: TUndoStack): IUndoCommands {\r\n\t\treturn stack.pop();\r\n\t}\r\n\r\n\tprivate _reorderCommands(action) {\r\n\t\t// firstly process tasks and only then links\r\n\t\t// in order to ensure links are added not earlier than their tasks\r\n\t\t// firstly to 'move' actions and only then updates\r\n\t\tconst weights = { any: 0, link:1, task:2 };\r\n\t\tconst actionWeights = { move: 1, any:0 };\r\n\t\taction.commands.sort(function(a, b) {\r\n\t\t\tif (a.entity === \"task\" && b.entity === \"task\") {\r\n\t\t\t\tif (a.type !== b.type) {\r\n\t\t\t\t\treturn (actionWeights[b.type] || 0) - (actionWeights[a.type] || 0);\r\n\t\t\t\t} else if (a.type === \"move\" && a.oldValue && b.oldValue && b.oldValue.parent === a.oldValue.parent) {\r\n\t\t\t\t\treturn a.oldValue.$index - b.oldValue.$index;\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn 0;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tconst weightA = weights[a.entity] || weights.any;\r\n\t\t\t\tconst weightB = weights[b.entity] || weights.any;\r\n\t\t\t\treturn weightB - weightA;\r\n\t\t\t}\r\n\r\n\t\t});\r\n\t}\r\n\r\n\tprivate _applyAction(action: IUndoCommands) {\r\n\t\tlet command = null;\r\n\t\tconst entities = this.command.entity;\r\n\t\tconst actions = this.command.type;\r\n\t\tconst gantt = this._gantt;\r\n\t\tconst methods = {};\r\n\t\tmethods[entities.task] = {\r\n\t\t\tadd: \"addTask\",\r\n\t\t\tget: \"getTask\",\r\n\t\t\tupdate: \"updateTask\",\r\n\t\t\tremove: \"deleteTask\",\r\n\t\t\tmove: \"moveTask\",\r\n\t\t\tisExists: \"isTaskExists\"\r\n\t\t};\r\n\t\tmethods[entities.link] = {\r\n\t\t\tadd: \"addLink\",\r\n\t\t\tget: \"getLink\",\r\n\t\t\tupdate: \"updateLink\",\r\n\t\t\tremove: \"deleteLink\",\r\n\t\t\tisExists: \"isLinkExists\"\r\n\t\t};\r\n\r\n\t\tgantt.batchUpdate(function() {\r\n\t\t\tfor (let i = 0; i < action.commands.length; i++) {\r\n\t\t\t\tcommand = action.commands[i];\r\n\t\t\t\tconst method = methods[command.entity][command.type];\r\n\t\t\t\tconst getMethod = methods[command.entity].get;\r\n\t\t\t\tconst check = methods[command.entity].isExists;\r\n\r\n\t\t\t\tif (command.type === actions.add) {\r\n\t\t\t\t\tgantt[method](command.oldValue, command.oldValue.parent, command.oldValue.$local_index);\r\n\t\t\t\t} else if (command.type === actions.remove) {\r\n\t\t\t\t\tif (gantt[check](command.value.id)) {\r\n\t\t\t\t\t\tgantt[method](command.value.id);\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if (command.type === actions.update) {\r\n\t\t\t\t\tconst item = gantt[getMethod](command.value.id);\r\n\t\t\t\t\tfor(const prop in command.value){\r\n\t\t\t\t\t\tif(!prop.startsWith(\"$\") && !prop.startsWith(\"_\")){\r\n\t\t\t\t\t\t\titem[prop] = command.value[prop];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tgantt[method](command.value.id);\r\n\t\t\t\t} else if (command.type === actions.move) {\r\n\t\t\t\t\tgantt[method](command.value.id, command.value.$local_index, command.value.parent);\r\n\t\t\t\t\t// GS-680: We should send the changes to the server after we undo vertical reorder\r\n\t\t\t\t\tgantt.callEvent(\"onRowDragEnd\", [command.value.id]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n}","import { IInlineEditState, IMonitor, IUndo, IUndoCommand, TActionType, TEntityType, TUndoValue } from \"./types\";\r\n\r\nconst noTrack = {\r\n\tonBeforeUndo: \"onAfterUndo\",\r\n\tonBeforeRedo: \"onAfterRedo\"\r\n};\r\n\r\nconst batchActions = [\r\n\t\"onTaskDragStart\",\r\n\t\"onAfterTaskUpdate\",\r\n\t\"onAfterTaskDelete\",\r\n\t\"onBeforeBatchUpdate\"\r\n];\r\n\r\nexport class Monitor implements IMonitor {\r\n\tprivate _batchAction = null;\r\n\tprivate _batchMode = false;\r\n\tprivate _ignore = false;\r\n\tprivate _ignoreMoveEvents = false;\r\n\tprivate _initialTasks = {};\r\n\tprivate _initialLinks = {};\r\n\tprivate _nestedTasks = {};\r\n\tprivate _nestedLinks = {};\r\n\tprivate _timeout;\r\n\tprivate _gantt: any;\r\n\tprivate _undo: IUndo;\r\n\r\n\tconstructor(undo: IUndo, gantt: any) {\r\n\t\tthis._undo = undo;\r\n\t\tthis._gantt = gantt;\r\n\t\tthis._attachEvents();\r\n\t}\r\n\r\n\tstore(id: TaskID | LinkID, type: TEntityType, overwrite: boolean = false) {\r\n\t\tif (type === this._gantt.config.undo_types.task) {\r\n\t\t\treturn this._storeTask(id, overwrite);\r\n\t\t}\r\n\t\tif (type === this._gantt.config.undo_types.link) {\r\n\t\t\treturn this._storeLink(id, overwrite);\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\tisMoveEventsIgnored() {\r\n\t\treturn this._ignoreMoveEvents;\r\n\t}\r\n\ttoggleIgnoreMoveEvents(newValue?: boolean) {\r\n\t\tthis._ignoreMoveEvents = newValue || false;\r\n\t}\r\n\tstartIgnore() {\r\n\t\tthis._ignore = true;\r\n\t}\r\n\tstopIgnore() {\r\n\t\tthis._ignore = false;\r\n\t}\r\n\tstartBatchAction() {\r\n\t\t// try catching updates made from event handlers using timeout\r\n\t\tif (!this._timeout){\r\n\t\t\tthis._timeout = setTimeout(() => {\r\n\t\t\t\tthis.stopBatchAction();\r\n\t\t\t\tthis._timeout = null;\r\n\t\t\t}, 10);\r\n\t\t}\r\n\r\n\r\n\t\tif (this._ignore || this._batchMode) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tthis._batchMode = true;\r\n\t\tthis._batchAction = this._undo.action.create();\r\n\t}\r\n\tstopBatchAction() {\r\n\t\tif (this._ignore) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst undo = this._undo;\r\n\t\tif (this._batchAction) {\r\n\t\t\tundo.logAction(this._batchAction);\r\n\t\t}\r\n\t\tthis._batchMode = false;\r\n\t\tthis._batchAction = null;\r\n\t}\r\n\tonTaskAdded(task: ITask) {\r\n\t\tif (!this._ignore) {\r\n\t\t\tthis._storeTaskCommand(task, this._undo.command.type.add);\r\n\t\t}\r\n\t}\r\n\tonTaskUpdated(task: ITask) {\r\n\t\tif (!this._ignore) {\r\n\t\t\tthis._storeTaskCommand(task, this._undo.command.type.update);\r\n\t\t}\r\n\t}\r\n\tonTaskMoved(task: ITask) {\r\n\t\tif (!this._ignore) {\r\n\t\t\t(task as any).$local_index = this._gantt.getTaskIndex(task.id);\r\n\t\t\tconst oldValue = this.getInitialTask(task.id);\r\n\t\t\tif((task as any).$local_index === oldValue.$local_index &&\r\n\t\t\t\tthis._gantt.getParent(task) === this._gantt.getParent(oldValue)){\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\tthis._storeEntityCommand(\r\n\t\t\t\ttask,\r\n\t\t\t\tthis.getInitialTask(task.id),\r\n\t\t\t\tthis._undo.command.type.move,\r\n\t\t\t\tthis._undo.command.entity.task\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\tonTaskDeleted(task: ITask) {\r\n\t\tif (!this._ignore) {\r\n\t\t\tthis._storeTaskCommand(task, this._undo.command.type.remove);\r\n\t\t\tif (this._nestedTasks[task.id]) {\r\n\t\t\t\tconst children = this._nestedTasks[task.id];\r\n\t\t\t\tfor (let i = 0; i < children.length; i++) {\r\n\t\t\t\t\tthis._storeTaskCommand(children[i], this._undo.command.type.remove);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (this._nestedLinks[task.id]) {\r\n\t\t\t\tconst childrenLinks = this._nestedLinks[task.id];\r\n\t\t\t\tfor (let i = 0; i < childrenLinks.length; i++) {\r\n\t\t\t\t\tthis._storeLinkCommand(childrenLinks[i], this._undo.command.type.remove);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tonLinkAdded(link: ILink) {\r\n\t\tif (!this._ignore) {\r\n\t\t\tthis._storeLinkCommand(link, this._undo.command.type.add);\r\n\t\t}\r\n\t}\r\n\tonLinkUpdated(link: ILink) {\r\n\t\tif (!this._ignore) {\r\n\t\t\tthis._storeLinkCommand(link, this._undo.command.type.update);\r\n\t\t}\r\n\t}\r\n\tonLinkDeleted(link: ILink) {\r\n\t\tif (!this._ignore) {\r\n\t\t\tthis._storeLinkCommand(link, this._undo.command.type.remove);\r\n\t\t}\r\n\t}\r\n\tsetNestedTasks(id: TaskID, taskIds: TaskID[]) {\r\n\t\tconst gantt = this._gantt;\r\n\t\tlet task = null;\r\n\t\tconst tasks = [];\r\n\t\tlet\tlinkIds = this._getLinks(gantt.getTask(id));\r\n\r\n\t\tfor (let i = 0; i < taskIds.length; i++) {\r\n\t\t\ttask = this.setInitialTask(taskIds[i]);\r\n\t\t\tlinkIds = linkIds.concat(this._getLinks(task));\r\n\t\t\ttasks.push(task);\r\n\t\t}\r\n\r\n\t\tconst uniqueLinks = {};\r\n\t\tfor (let i = 0; i < linkIds.length; i++) {\r\n\t\t\tuniqueLinks[linkIds[i]] = true;\r\n\t\t}\r\n\t\tconst links = [];\r\n\t\tfor (const i in uniqueLinks) {\r\n\t\t\tlinks.push(this.setInitialLink(i));\r\n\t\t}\r\n\t\tthis._nestedTasks[id] = tasks;\r\n\t\tthis._nestedLinks[id] = links;\r\n\t}\r\n\tsetInitialTask(id: TaskID, overwrite?: boolean) {\r\n\t\tconst gantt = this._gantt;\r\n\t\tif (overwrite || (!this._initialTasks[id] || !this._batchMode)) {\r\n\t\t\tconst task = gantt.copy(gantt.getTask(id));\r\n\t\t\ttask.$index = gantt.getGlobalTaskIndex(id);\r\n\t\t\ttask.$local_index = gantt.getTaskIndex(id);\r\n\t\t\tthis.setInitialTaskObject(id, task);\r\n\t\t}\r\n\t\treturn this._initialTasks[id];\r\n\t}\r\n\tgetInitialTask(id: TaskID) {\r\n\t\treturn this._initialTasks[id];\r\n\t}\r\n\tclearInitialTasks() {\r\n\t\tthis._initialTasks = {};\r\n\t}\r\n\tsetInitialTaskObject(id: TaskID, object: ITask) {\r\n\t\tthis._initialTasks[id] = object;\r\n\t}\r\n\tsetInitialLink(id: LinkID, overwrite?: boolean) {\r\n\t\tif (!this._initialLinks[id] || !this._batchMode) {\r\n\t\t\tthis._initialLinks[id] = this._gantt.copy(this._gantt.getLink(id));\r\n\t\t}\r\n\t\treturn this._initialLinks[id];\r\n\t}\r\n\tgetInitialLink(id: LinkID) {\r\n\t\treturn this._initialLinks[id];\r\n\t}\r\n\tclearInitialLinks() {\r\n\t\tthis._initialLinks = {};\r\n\t}\r\n\tprivate _attachEvents() {\r\n\t\tlet deleteCacheCooldown = null;\r\n\t\tconst gantt = this._gantt;\r\n\r\n\t\tconst saveInitialAll = () => {\r\n\t\t\tif (!deleteCacheCooldown) {\r\n\t\t\t\tdeleteCacheCooldown = setTimeout(() => {\r\n\t\t\t\t\tdeleteCacheCooldown = null;\r\n\t\t\t\t});\r\n\r\n\t\t\t\tthis.clearInitialTasks();\r\n\t\t\t\tgantt.eachTask((task: ITask) => {\r\n\t\t\t\t\tthis.setInitialTask(task.id);\r\n\t\t\t\t});\r\n\r\n\t\t\t\tthis.clearInitialLinks();\r\n\t\t\t\tgantt.getLinks().forEach((link: ILink) => {\r\n\t\t\t\t\tthis.setInitialLink(link.id);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t};\r\n\t\tconst getMoveObjectByTaskId = (id: TaskID) => {\r\n\t\t\treturn gantt.copy(gantt.getTask(id));\r\n\t\t};\r\n\r\n\t\tfor (const i in noTrack) {\r\n\t\t\tgantt.attachEvent(i, () => {\r\n\t\t\t\tthis.startIgnore();\r\n\t\t\t\treturn true;\r\n\t\t\t});\r\n\t\t\tgantt.attachEvent(noTrack[i], () => {\r\n\t\t\t\tthis.stopIgnore();\r\n\t\t\t\treturn true;\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tfor (let i = 0; i < batchActions.length; i++) {\r\n\t\t\tgantt.attachEvent(batchActions[i], () => {\r\n\t\t\t\tthis.startBatchAction();\r\n\t\t\t\treturn true;\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tgantt.attachEvent(\"onParse\", () => {\r\n\t\t\tthis._undo.clearUndoStack();\r\n\t\t\tthis._undo.clearRedoStack();\r\n\t\t\tsaveInitialAll();\r\n\t\t});\r\n\t\tgantt.attachEvent(\"onAfterTaskAdd\", (id: TaskID, task: ITask) => {\r\n\t\t\tthis.setInitialTask(id, true);\r\n\t\t\tthis.onTaskAdded(task);\r\n\t\t});\r\n\t\tgantt.attachEvent(\"onAfterTaskUpdate\", (id: TaskID, task: ITask) => {\r\n\t\t\tthis.onTaskUpdated(task);\r\n\t\t});\r\n\t\tgantt.attachEvent(\"onAfterTaskDelete\", (id: TaskID, task: ITask) => {\r\n\t\t\tthis.onTaskDeleted(task);\r\n\t\t});\r\n\t\tgantt.attachEvent(\"onAfterLinkAdd\", (id: LinkID, link: ILink) => {\r\n\t\t\tthis.setInitialLink(id, true);\r\n\t\t\tthis.onLinkAdded(link);\r\n\t\t});\r\n\t\tgantt.attachEvent(\"onAfterLinkUpdate\", (id: LinkID, link: ILink) => {\r\n\t\t\tthis.onLinkUpdated(link);\r\n\t\t});\r\n\t\tgantt.attachEvent(\"onAfterLinkDelete\", (id: LinkID, link: ILink) => {\r\n\t\t\tthis.onLinkDeleted(link);\r\n\t\t});\r\n\t\tgantt.attachEvent(\"onRowDragEnd\", (id: TaskID, target: TaskID) => {\r\n\t\t\tthis.onTaskMoved(getMoveObjectByTaskId(id));\r\n\t\t\tthis.toggleIgnoreMoveEvents();\r\n\t\t\treturn true;\r\n\t\t});\r\n\t\tgantt.attachEvent(\"onBeforeTaskDelete\", (id: TaskID) => {\r\n\t\t\tthis.store(id, gantt.config.undo_types.task);\r\n\t\t\tconst nested = [];\r\n\r\n\t\t\t// remember task indexes in case their being deleted in a loop, so they could be restored in the correct order\r\n\t\t\tsaveInitialAll();\r\n\r\n\t\t\tgantt.eachTask((task: ITask) => {\r\n\t\t\t\tnested.push(task.id);\r\n\t\t\t}, id);\r\n\t\t\tthis.setNestedTasks(id, nested);\r\n\t\t\treturn true;\r\n\t\t});\r\n\t\tconst datastore = gantt.getDatastore(\"task\");\r\n\r\n\t\tdatastore.attachEvent(\"onBeforeItemMove\", (id: TaskID, parent: TaskID, tindex: number) => {\r\n\t\t\tif (!this.isMoveEventsIgnored()) {\r\n\t\t\t\tsaveInitialAll();\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t});\r\n\r\n\t\tdatastore.attachEvent(\"onAfterItemMove\", (id: TaskID, parent: TaskID, tindex: number) => {\r\n\t\t\tif (!this.isMoveEventsIgnored()) {\r\n\t\t\t\tthis.onTaskMoved(getMoveObjectByTaskId(id));\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t});\r\n\r\n\t\tgantt.attachEvent(\"onRowDragStart\", (id: TaskID, target: TaskID, e: Event) => {\r\n\t\t\tthis.toggleIgnoreMoveEvents(true);\r\n\t\t\tsaveInitialAll();\r\n\t\t\treturn true;\r\n\t\t});\r\n\r\n\t\tgantt.attachEvent(\"onBeforeTaskDrag\", (taskId: TaskID) => this.store(taskId, gantt.config.undo_types.task));\r\n\r\n\t\tgantt.attachEvent(\"onLightbox\", (taskId: TaskID) => this.store(taskId, gantt.config.undo_types.task));\r\n\r\n\t\tgantt.attachEvent(\"onBeforeTaskAutoSchedule\", (task: ITask) => {\r\n\t\t\tthis.store(task.id, gantt.config.undo_types.task);\r\n\t\t\treturn true;\r\n\t\t});\r\n\r\n\t\tif (gantt.ext.inlineEditors) {\r\n\t\t\tgantt.ext.inlineEditors.attachEvent(\"onEditStart\", (state: IInlineEditState) => {\r\n\t\t\t\tthis.store(state.id, gantt.config.undo_types.task);\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tprivate _storeCommand(command: IUndoCommand) {\r\n\t\tconst undo = this._undo;\r\n\t\tundo.updateConfigs();\r\n\r\n\t\tif (!undo.undoEnabled) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (this._batchMode) {\r\n\t\t\tthis._batchAction.commands.push(command);\r\n\t\t} else {\r\n\t\t\tconst action = undo.action.create([command]);\r\n\t\t\tundo.logAction(action);\r\n\t\t}\r\n\t}\r\n\tprivate _storeEntityCommand(obj: TUndoValue, old: TUndoValue, actionType: TActionType, entityType: TEntityType) {\r\n\t\tconst undo = this._undo;\r\n\t\tconst command = undo.command.create(obj, old, actionType, entityType);\r\n\t\tthis._storeCommand(command);\r\n\t}\r\n\tprivate _storeTaskCommand(obj: ITask, type: TActionType) {\r\n\t\tif(this._gantt.isTaskExists(obj.id)){\r\n\t\t\t(obj as any).$local_index = this._gantt.getTaskIndex(obj.id);\r\n\t\t}\r\n\r\n\t\tthis._storeEntityCommand(obj, this.getInitialTask(obj.id), type, this._undo.command.entity.task);\r\n\t}\r\n\tprivate _storeLinkCommand(obj: ILink, type: TActionType) {\r\n\t\tthis._storeEntityCommand(obj, this.getInitialLink(obj.id), type, this._undo.command.entity.link);\r\n\t}\r\n\tprivate _getLinks(task: ITask) {\r\n\t\treturn task.$source.concat(task.$target);\r\n\t}\r\n\tprivate _storeTask(taskId: TaskID, overwrite: boolean = false) {\r\n\t\tconst gantt = this._gantt;\r\n\t\tthis.setInitialTask(taskId, overwrite);\r\n\t\tgantt.eachTask((child: ITask) => {\r\n\t\t\tthis.setInitialTask(child.id);\r\n\t\t}, taskId);\r\n\t\treturn true;\r\n\t}\r\n\tprivate _storeLink(linkId: LinkID, overwrite: boolean = false) {\r\n\t\tthis.setInitialLink(linkId, overwrite);\r\n\t\treturn true;\r\n\t}\r\n}","import { Monitor } from \"./monitor\";\r\nimport { IMonitor, IUndoCommand, TEntityType, TUndoStack } from \"./types\";\r\nimport { Undo } from \"./undo\";\r\n\r\nexport default function(gantt: any){\r\n\r\nconst _undo = new Undo(gantt);\r\nconst monitor: IMonitor = new Monitor(_undo, gantt);\r\n\r\ngantt.config.undo = true;\r\ngantt.config.redo = true;\r\n\r\n/**\r\n * entities that require different processing for undoing-redoing changes\r\n * @type {{link: string, task: string}}\r\n */\r\ngantt.config.undo_types = {\r\n\tlink: \"link\",\r\n\ttask: \"task\"\r\n};\r\n\r\n/**\r\n * types of traced actions\r\n * @type {{update: string, remove: string, add: string}}\r\n */\r\ngantt.config.undo_actions = {\r\n\tupdate: \"update\",\r\n\tremove: \"remove\", // remove item from datastore\r\n\tadd: \"add\",\r\n\tmove: \"move\" // move task in grid\r\n};\r\n\r\nif (!gantt.ext) {\r\n\tgantt.ext = {};\r\n}\r\n\r\ngantt.ext.undo = {\r\n\tundo: () => _undo.undo(),\r\n\tredo: () => _undo.redo(),\r\n\tgetUndoStack: () => _undo.getUndoStack(),\r\n\tsetUndoStack: (stack:[]) => _undo.setUndoStack(stack),\r\n\tgetRedoStack: () => _undo.getRedoStack(),\r\n\tsetRedoStack: (stack:[]) => _undo.setRedoStack(stack),\r\n\tclearUndoStack: () => _undo.clearUndoStack(),\r\n\tclearRedoStack: () => _undo.clearRedoStack(),\r\n\tsaveState: (id: TaskID | LinkID, type: TEntityType) => monitor.store(id, type, true),\r\n\tgetInitialState: (id: TaskID | LinkID, type: TEntityType) => {\r\n\t\tif(type === gantt.config.undo_types.link){\r\n\t\t\treturn monitor.getInitialLink(id);\r\n\t\t}else{\r\n\t\t\treturn monitor.getInitialTask(id);\r\n\t\t}\r\n\t}\r\n};\r\n\r\ngantt.undo = gantt.ext.undo.undo;\r\ngantt.redo = gantt.ext.undo.redo;\r\ngantt.getUndoStack = gantt.ext.undo.getUndoStack;\r\ngantt.getRedoStack = gantt.ext.undo.getRedoStack;\r\ngantt.clearUndoStack = gantt.ext.undo.clearUndoStack;\r\ngantt.clearRedoStack = gantt.ext.undo.clearRedoStack;\r\n\r\nfunction updTask(task: ITask, oldId: TaskID, newId: TaskID) {\r\n\tif (!task) { return; }\r\n\r\n\tif (task.id === oldId) {\r\n\t\ttask.id = newId;\r\n\t}\r\n\r\n\tif (task.parent === oldId) {\r\n\t\ttask.parent = newId;\r\n\t}\r\n}\r\n\r\nfunction changeTaskCommandId(command: IUndoCommand, oldId: TaskID, newId: TaskID) {\r\n\tupdTask(command.value, oldId, newId);\r\n\tupdTask(command.oldValue, oldId, newId);\r\n}\r\n\r\nfunction updLink(link: ILink, oldTaskId: TaskID, newTaskId: TaskID) {\r\n\tif (!link) { return; }\r\n\tif (link.source === oldTaskId) {\r\n\t\tlink.source = newTaskId;\r\n\t}\r\n\tif (link.target === oldTaskId) {\r\n\t\tlink.target = newTaskId;\r\n\t}\r\n}\r\n\r\nfunction changeLinkCommandId(command: IUndoCommand, oldId: LinkID, newId: LinkID) {\r\n\tupdLink(command.value, oldId, newId);\r\n\tupdLink(command.oldValue, oldId, newId);\r\n}\r\n\r\nfunction updateTasksIds(log: TUndoStack, oldId: TaskID, newId: TaskID) {\r\n\tconst undo = _undo;\r\n\r\n\tfor (let i = 0; i < log.length; i++) {\r\n\t\tconst entry = log[i];\r\n\t\tfor (let j = 0; j < entry.commands.length; j++) {\r\n\t\t\tif (entry.commands[j].entity === undo.command.entity.task) {\r\n\t\t\t\tchangeTaskCommandId(entry.commands[j], oldId, newId);\r\n\t\t\t} else if (entry.commands[j].entity === undo.command.entity.link) {\r\n\t\t\t\tchangeLinkCommandId(entry.commands[j], oldId, newId);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nfunction updateLinksIds(log: TUndoStack, oldId: LinkID, newId: LinkID) {\r\n\tconst undo = _undo;\r\n\r\n\tfor (let i = 0; i < log.length; i++) {\r\n\t\tconst entry = log[i];\r\n\t\tfor (let j = 0; j < entry.commands.length; j++) {\r\n\t\t\tconst command = entry.commands[j];\r\n\t\t\tif (command.entity === undo.command.entity.link) {\r\n\t\t\t\tif (command.value && command.value.id === oldId) {\r\n\t\t\t\t\tcommand.value.id = newId;\r\n\t\t\t\t}\r\n\t\t\t\tif (command.oldValue && command.oldValue.id === oldId) {\r\n\t\t\t\t\tcommand.oldValue.id = newId;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\ngantt.attachEvent(\"onTaskIdChange\", (oldId: TaskID, newId: TaskID) => {\r\n\tconst undo = _undo;\r\n\tupdateTasksIds(undo.getUndoStack(), oldId, newId);\r\n\tupdateTasksIds(undo.getRedoStack(), oldId, newId);\r\n});\r\n\r\ngantt.attachEvent(\"onLinkIdChange\", (oldId: LinkID, newId: LinkID) => {\r\n\tconst undo = _undo;\r\n\tupdateLinksIds(undo.getUndoStack(), oldId, newId);\r\n\tupdateLinksIds(undo.getRedoStack(), oldId, newId);\r\n});\r\n\r\ngantt.attachEvent(\"onGanttReady\", () => {\r\n\t_undo.updateConfigs();\r\n});\r\n\r\n}","import * as domHelpers from \"../../core/ui/utils/dom_helpers\";\r\n\r\ninterface IViewPosition{\r\n\ttop: number;\r\n\tleft: number;\r\n}\r\n\r\ninterface IViewBox extends IViewPosition{\r\n\twidth: number;\r\n\theight: number;\r\n\tbottom: number;\r\n\tright: number;\r\n}\r\n\r\nexport class Tooltip {\r\n\tprivate _root: HTMLElement;\r\n\tprivate _tooltipNode: HTMLElement;\r\n\tprivate _gantt: any;\r\n\r\n\tconstructor(gantt: any){\r\n\t\tthis._gantt = gantt;\r\n\t}\r\n\r\n\tgetNode() : HTMLElement {\r\n\t\tconst gantt = this._gantt;\r\n\t\tif (!this._tooltipNode){\r\n\t\t\tthis._tooltipNode = document.createElement(\"div\");\r\n\t\t\tthis._tooltipNode.className = \"gantt_tooltip\";\r\n\t\t\tgantt._waiAria.tooltipAttr(this._tooltipNode);\r\n\t\t}\r\n\t\treturn this._tooltipNode;\r\n\t}\r\n\r\n\tsetViewport(node: HTMLElement):Tooltip{\r\n\t\tthis._root = node;\r\n\t\treturn this;\r\n\t}\r\n\r\n\tshow(left: number, top: number): Tooltip;\r\n\tshow(event: MouseEvent): Tooltip;\r\n\tshow(left: number | MouseEvent, top?: number): Tooltip {\r\n\t\tconst gantt = this._gantt;\r\n\t\tconst container = document.body;\r\n\t\tconst node = this.getNode();\r\n\r\n\t\tif(!domHelpers.isChildOf(node, container)){\r\n\t\t\tthis.hide();\r\n\t\t\tcontainer.appendChild(node);\r\n\t\t}\r\n\r\n\t\tif (this._isLikeMouseEvent(left)) {\r\n\t\t\tconst position = this._calculateTooltipPosition(left as MouseEvent);\r\n\t\t\ttop = position.top;\r\n\t\t\tleft = position.left;\r\n\t\t}\r\n\r\n\t\tnode.style.top = top + \"px\";\r\n\t\tnode.style.left = left + \"px\";\r\n\r\n\t\tgantt._waiAria.tooltipVisibleAttr(node);\r\n\t\treturn this;\r\n\t}\r\n\thide() : Tooltip{\r\n\t\tconst gantt = this._gantt;\r\n\t\tconst node = this.getNode();\r\n\t\tif(node && node.parentNode){\r\n\t\t\tnode.parentNode.removeChild(node);\r\n\t\t}\r\n\t\tgantt._waiAria.tooltipHiddenAttr(node);\r\n\t\treturn this;\r\n\t}\r\n\r\n\tsetContent(html: string) : Tooltip{\r\n\t\tconst node = this.getNode();\r\n\t\tnode.innerHTML = html;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t// it is for salesforce, because it proxies event to it own events\r\n\tprivate _isLikeMouseEvent(event: any): boolean {\r\n\t\tif (!event || typeof event !== \"object\") {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn \"clientX\" in event && \"clientY\" in event;\r\n\t}\r\n\r\n\tprivate _getViewPort() : HTMLElement {\r\n\t\treturn this._root || document.body;\r\n\t}\r\n\r\n\r\n\tprivate _calculateTooltipPosition(event: MouseEvent): IViewPosition{\r\n\t\tconst gantt = this._gantt;\r\n\t\t// top/left coordinates inside the viewport by mouse position\r\n\t\tconst viewport = this._getViewPortSize();\r\n\t\tconst tooltipNode = this.getNode();\r\n\t\tconst tooltip: IViewBox = {\r\n\t\t\ttop:0,\r\n\t\t\tleft: 0,\r\n\t\t\twidth: tooltipNode.offsetWidth,\r\n\t\t\theight: tooltipNode.offsetHeight,\r\n\t\t\tbottom: 0,\r\n\t\t\tright: 0\r\n\t\t};\r\n\r\n\t\tconst offsetX = gantt.config.tooltip_offset_x;\r\n\t\tconst offsetY = gantt.config.tooltip_offset_y;\r\n\r\n\t\tconst container = document.body;\r\n\t\tconst mouse = domHelpers.getRelativeEventPosition(event, container);\r\n\t\tconst containerPos = domHelpers.getNodePosition(container);\r\n\t\tmouse.y += containerPos.y; // to fix margin collapsing\r\n\r\n\t\ttooltip.top = mouse.y;\r\n\t\ttooltip.left = mouse.x;\r\n\t\ttooltip.top += offsetY;\r\n\t\ttooltip.left += offsetX;\r\n\t\ttooltip.bottom = tooltip.top + tooltip.height;\r\n\t\ttooltip.right = tooltip.left + tooltip.width;\r\n\r\n\t\tconst scrollTop = window.scrollY + container.scrollTop; // to fix margin collapsing\r\n\t\t// edge cases when the tooltip element can be partially hidden by edges of the viewport\r\n\t\tif(tooltip.top < viewport.top - scrollTop){\r\n\t\t\ttooltip.top = viewport.top;\r\n\t\t\ttooltip.bottom = tooltip.top + tooltip.height;\r\n\t\t}else if(tooltip.bottom > viewport.bottom){\r\n\t\t\ttooltip.bottom = viewport.bottom;\r\n\t\t\ttooltip.top = tooltip.bottom - tooltip.height;\r\n\t\t}\r\n\r\n\t\tif(tooltip.left < viewport.left){\r\n\t\t\ttooltip.left = viewport.left;\r\n\t\t\ttooltip.right = viewport.left + tooltip.width;\r\n\t\t}else if(tooltip.right > viewport.right){\r\n\t\t\ttooltip.right = viewport.right;\r\n\t\t\ttooltip.left = tooltip.right - tooltip.width;\r\n\t\t}\r\n\r\n\t\tif(mouse.x >= tooltip.left && mouse.x <= tooltip.right) {\r\n\t\t\ttooltip.left = mouse.x - tooltip.width - offsetX;\r\n\t\t\ttooltip.right = tooltip.left + tooltip.width;\r\n\t\t}\r\n\r\n\t\tif(mouse.y >= tooltip.top && mouse.y <= tooltip.bottom) {\r\n\t\t\ttooltip.top = mouse.y - tooltip.height - offsetY;\r\n\t\t\ttooltip.bottom = tooltip.top + tooltip.height;\r\n\t\t}\r\n\r\n\t\treturn tooltip;\r\n\t}\r\n\r\n\tprivate _getViewPortSize() : IViewBox {\r\n\t\tconst gantt = this._gantt;\r\n\t\tconst container = this._getViewPort();\r\n\t\tlet viewport = container;\r\n\t\tlet scrollTop = window.scrollY + document.body.scrollTop;\r\n\t\tlet scrollLeft = window.scrollX + document.body.scrollLeft;\r\n\t\tlet pos;\r\n\t\t// support for the initial tooltip mode where the tooltip element was attached to the data area of gantt\r\n\t\tif(container === gantt.$task_data){\r\n\t\t\tviewport = gantt.$task;\r\n\t\t\tscrollTop = 0;\r\n\t\t\tscrollLeft = 0;\r\n\t\t\tpos = domHelpers.getNodePosition(gantt.$task);\r\n\t\t}else{\r\n\t\t\tpos = domHelpers.getNodePosition(viewport);\r\n\t\t}\r\n\t\treturn {\r\n\t\t\tleft:pos.x + scrollLeft,\r\n\t\t\ttop: pos.y + scrollTop,\r\n\t\t\twidth: pos.width,\r\n\t\t\theight: pos.height,\r\n\t\t\tbottom: pos.y + pos.height + scrollTop,\r\n\t\t\tright: pos.x + pos.width + scrollLeft\r\n\t\t};\r\n\t}\r\n}\r\n","import * as domEventsScope from \"../../core/ui/utils/dom_event_scope\";\r\nimport * as domHelpers from \"../../core/ui/utils/dom_helpers\";\r\nimport * as helpers from \"../../utils/helpers\";\r\nimport { Tooltip } from \"./tooltip\";\r\n\r\ninterface ITrackerTarget {\r\n\tselector: string;\r\n\tonmouseenter: (event: MouseEvent, node: HTMLElement) => void;\r\n\tonmousemove: (event: MouseEvent, node: HTMLElement) => void;\r\n\tonmouseleave: (event: MouseEvent, node: HTMLElement) => void;\r\n\tglobal: boolean;\r\n}\r\n\r\ninterface ITooltipConfig {\r\n\tselector: string;\r\n\thtml: (event: MouseEvent, node: HTMLElement) => string;\r\n\tglobal: boolean;\r\n}\r\n\r\nexport class TooltipManager{\r\n\ttooltip: Tooltip;\r\n\tprotected _domEvents: any;\r\n\tprivate _listeners: object = {};\r\n\tprivate _gantt: any;\r\n\tprivate delayShow: any;\r\n\tprivate delayHide: any;\r\n\r\n\tconstructor(gantt: any) {\r\n\t\tthis.tooltip = new Tooltip(gantt);\r\n\t\tthis._gantt = gantt;\r\n\t\tthis._domEvents = domEventsScope();\r\n\t\tthis._initDelayedFunctions();\r\n\t}\r\n\r\n\tdestructor(): void{\r\n\t\tthis.tooltip.hide();\r\n\t\tthis._domEvents.detachAll();\r\n\t}\r\n\thideTooltip(): void{\r\n\t\tthis.delayHide();\r\n\t}\r\n\tattach(config: ITrackerTarget): void {\r\n\t\tlet root = document.body;\r\n\t\tconst gantt = this._gantt;\r\n\t\tif(!config.global){\r\n\t\t\troot = gantt.$root;\r\n\t\t}\r\n\r\n\t\tlet watchableTarget = null;\r\n\t\tconst handler = (event) => {\r\n\t\t\tconst eventTarget = domHelpers.getTargetNode(event);\r\n\t\t\tconst targetNode = domHelpers.closest(eventTarget, config.selector);\r\n\t\t\tif(domHelpers.isChildOf(eventTarget, this.tooltip.getNode())){\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tconst doOnMouseEnter = () => {\r\n\t\t\t\twatchableTarget = targetNode;\r\n\t\t\t\tconfig.onmouseenter(event, targetNode);\r\n\t\t\t};\r\n\r\n\t\t\tif(watchableTarget){\r\n\t\t\t\tif(targetNode && targetNode === watchableTarget){\r\n\t\t\t\t\tconfig.onmousemove(event, targetNode);\r\n\t\t\t\t}else{\r\n\t\t\t\t\tconfig.onmouseleave(event, watchableTarget);\r\n\t\t\t\t\twatchableTarget = null;\r\n\r\n\t\t\t\t\tif(targetNode && targetNode !== watchableTarget){\r\n\t\t\t\t\t\tdoOnMouseEnter();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}else{\r\n\t\t\t\tif(targetNode){\r\n\t\t\t\t\tdoOnMouseEnter();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tthis.detach(config.selector);\r\n\t\tthis._domEvents.attach(root, \"mousemove\", handler);\r\n\t\tthis._listeners[config.selector] = {\r\n\t\t\tnode: root,\r\n\t\t\thandler\r\n\t\t};\r\n\t}\r\n\r\n\tdetach(selector: string): void {\r\n\t\tconst listener = this._listeners[selector];\r\n\t\tif(listener){\r\n\t\t\tthis._domEvents.detach(listener.node, \"mousemove\", listener.handler);\r\n\t\t}\r\n\t}\r\n\r\n\ttooltipFor(config: ITooltipConfig): void {\r\n\t\tconst cloneDomEvent = (event: MouseEvent) => {\r\n\t\t\tlet clone = event;\r\n\t\t\t// making events survive timeout in ie\r\n\t\t\t// tslint:disable-next-line no-string-literal\r\n\t\t\tif(document[\"createEventObject\"] && !document.createEvent){\r\n\t\t\t\t// tslint:disable-next-line no-string-literal\r\n\t\t\t\tclone = document[\"createEventObject\"](event);\r\n\t\t\t}\r\n\t\t\treturn clone;\r\n\t\t};\r\n\t\tthis._initDelayedFunctions();\r\n\t\tthis.attach({\r\n\t\t\tselector: config.selector,\r\n\t\t\tglobal: config.global,\r\n\t\t\tonmouseenter:(event: MouseEvent, node: HTMLElement) => {\r\n\t\t\t\tconst html = config.html(event, node);\r\n\t\t\t\tif(html){\r\n\t\t\t\t\tthis.delayShow(cloneDomEvent(event), html);\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tonmousemove:(event: MouseEvent, node: HTMLElement) => {\r\n\t\t\t\tconst html = config.html(event, node);\r\n\t\t\t\tif(html){\r\n\t\t\t\t\tthis.delayShow(cloneDomEvent(event), html);\r\n\t\t\t\t}else{\r\n\t\t\t\t\tthis.delayShow.$cancelTimeout();\r\n\t\t\t\t\tthis.delayHide();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tonmouseleave:() => {\r\n\t\t\t\tthis.delayShow.$cancelTimeout();\r\n\t\t\t\tthis.delayHide();\r\n\t\t\t},\r\n\t\t});\r\n\t}\r\n\r\n\tprivate _initDelayedFunctions(){\r\n\t\tconst gantt = this._gantt;\r\n\t\t// reset delayed functions in order to apply current values of tooltip_timeout\r\n\t\tif(this.delayShow){\r\n\t\t\tthis.delayShow.$cancelTimeout();\r\n\t\t}\r\n\t\tif(this.delayHide){\r\n\t\t\tthis.delayHide.$cancelTimeout();\r\n\t\t}\r\n\t\tthis.tooltip.hide();\r\n\r\n\t\tthis.delayShow = helpers.delay((event: MouseEvent, html: string) => {\r\n\t\t\tif(gantt.callEvent(\"onBeforeTooltip\", [event]) === false) {\r\n\t\t\t\tthis.tooltip.hide();\r\n\t\t\t} else {\r\n\t\t\t\tthis.tooltip.setContent(html);\r\n\t\t\t\tthis.tooltip.show(event);\r\n\t\t\t}\r\n\t\t}, gantt.config.tooltip_timeout || 1);\r\n\r\n\t\tthis.delayHide = helpers.delay(() => {\r\n\t\t\tthis.delayShow.$cancelTimeout();\r\n\t\t\tthis.tooltip.hide();\r\n\t\t}, gantt.config.tooltip_hide_timeout || 1);\r\n\t}\r\n\r\n}","import {TooltipManager} from \"./tooltipManager\";\r\n\r\nexport default function(gantt: any){\r\n\r\ngantt.config.tooltip_timeout = 30;\r\ngantt.config.tooltip_offset_y = 20;\r\ngantt.config.tooltip_offset_x = 10;\r\ngantt.config.tooltip_hide_timeout = 30;\r\n\r\n\r\n\r\nconst tooltipManager = new TooltipManager(gantt);\r\n\r\ngantt.ext.tooltips = tooltipManager;\r\n\r\ngantt.attachEvent(\"onGanttReady\", function(){\r\n\r\n\ttooltipManager.tooltipFor({\r\n\t\tselector: \"[\"+gantt.config.task_attribute+\"]:not(.gantt_task_row)\",\r\n\t\thtml: (event: MouseEvent) => {\r\n\t\t\tif (gantt.config.touch && !gantt.config.touch_tooltip) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tconst targetTaskId = gantt.locate(event);\r\n\t\t\tif(gantt.isTaskExists(targetTaskId)){\r\n\t\t\t\tconst task = gantt.getTask(targetTaskId);\r\n\t\t\t\treturn gantt.templates.tooltip_text(task.start_date, task.end_date, task);\r\n\t\t\t}\r\n\t\t\treturn null;\r\n\t\t},\r\n\t\tglobal: false\r\n\t});\r\n});\r\n\r\ngantt.attachEvent(\"onDestroy\", function() {\r\n\ttooltipManager.destructor();\r\n});\r\n\r\ngantt.attachEvent(\"onLightbox\", function() {\r\n\ttooltipManager.hideTooltip();\r\n});\r\nconst isLinkCreate = () => {\r\n\tconst state = gantt.getState();\r\n\treturn !!state.link_source_id;\r\n};\r\ngantt.attachEvent(\"onBeforeTooltip\", function() {\r\n\tif (isLinkCreate()){\r\n\t\treturn false;\r\n\t}\r\n});\r\n\r\ngantt.attachEvent(\"onGanttScroll\", function(){\r\n\ttooltipManager.hideTooltip();\r\n});\r\n\r\n}","\r\ninterface IQuickInfoContainer{\r\n\tparent: HTMLElement;\r\n\txViewport: HTMLElement;\r\n\tyViewport: HTMLElement;\r\n}\r\n\r\nexport class QuickInfo {\r\n\tprivate _quickInfoTask: TaskID;\r\n\tprivate _quickInfoBoxId: number | string;\r\n\tprivate _quickInfoBox: HTMLElement;\r\n\tprivate _quickInfoReadonly: boolean | null;\r\n\tprivate _container: HTMLElement;\r\n\tprivate _gantt: any;\r\n\r\n\tconstructor(gantt: any) {\r\n\t\tthis._gantt = gantt;\r\n\t}\r\n\r\n\t// show at coordinates:\r\n\t// show(x: number, y: number)\r\n\t// show for a task:\r\n\t// show(id: TaskID)\r\n\tshow : {\r\n\t\t(x: number, y: number) : void;\r\n\t\t(id: TaskID) : void;\r\n\t} = (id: TaskID | number, y? : number) : void => {\r\n\t\tif (y === undefined) {\r\n\t\t\tthis._showForTask(id);\r\n\t\t} else {\r\n\t\t\tthis._showAtCoordinates(id as number, y);\r\n\t\t}\r\n\t}\r\n\r\n\thide = (forced?: boolean) : any => {\r\n\t\tconst gantt = this._gantt;\r\n\t\tconst qi = this._quickInfoBox;\r\n\t\tthis._quickInfoBoxId = 0;\r\n\t\tconst taskId = this._quickInfoTask;\r\n\t\tthis._quickInfoTask = null;\r\n\r\n\t\tif (qi && qi.parentNode){\r\n\r\n\t\t\tif (gantt.config.quick_info_detached) {\r\n\t\t\t\tgantt.callEvent(\"onAfterQuickInfo\", [taskId]);\r\n\t\t\t\treturn qi.parentNode.removeChild(qi);\r\n\t\t\t}\r\n\r\n\t\t\tqi.className += \" gantt_qi_hidden\";\r\n\t\t\tif (qi.style.right === \"auto\"){\r\n\t\t\t\tqi.style.left = \"-350px\";\r\n\t\t\t} else {\r\n\t\t\t\tqi.style.right = \"-350px\";\r\n\t\t\t}\r\n\r\n\t\t\tif (forced) {\r\n\t\t\t\tqi.style.left = qi.style.right = \"\";\r\n\t\t\t\tqi.parentNode.removeChild(qi);\r\n\t\t\t}\r\n\t\t\tgantt.callEvent(\"onAfterQuickInfo\", [taskId]);\r\n\t\t}\r\n\t}\r\n\r\n\tgetNode = (): HTMLElement => {\r\n\t\tif(this._quickInfoBox) {\r\n\t\t\treturn this._quickInfoBox;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\tsetContainer = (container: string|HTMLElement): void => {\r\n\t\tif(container){\r\n\t\t\tthis._container = typeof container === \"string\" ? document.getElementById(container) : container;\r\n\t\t}\r\n\t}\r\n\r\n\tsetContent = (content?: IQuickInfoContent) => {\r\n\t\tconst gantt = this._gantt;\r\n\r\n\t\tconst defaultContent = {\r\n\t\t\ttaskId: null,\r\n\t\t\theader: {\r\n\t\t\t\ttitle: \"\",\r\n\t\t\t\tdate: \"\"\r\n\t\t\t},\r\n\t\t\tcontent: \"\",\r\n\t\t\tbuttons: gantt.config.quickinfo_buttons\r\n\t\t};\r\n\r\n\t\tif(!content){\r\n\t\t\tcontent = defaultContent;\r\n\t\t}\r\n\r\n\t\tif(!content.taskId){\r\n\t\t\tcontent.taskId = defaultContent.taskId;\r\n\t\t}\r\n\r\n\t\tif(!content.header){\r\n\t\t\tcontent.header = defaultContent.header;\r\n\t\t}\r\n\r\n\t\tif(!content.header.title){\r\n\t\t\tcontent.header.title = defaultContent.header.title;\r\n\t\t}\r\n\t\tif(!content.header.date){\r\n\t\t\tcontent.header.date = defaultContent.header.date;\r\n\t\t}\r\n\t\tif(!content.content){\r\n\t\t\tcontent.content = defaultContent.content;\r\n\t\t}\r\n\t\tif(!content.buttons){\r\n\t\t\tcontent.buttons = defaultContent.buttons;\r\n\t\t}\r\n\r\n\r\n\t\tlet qi = this.getNode();\r\n\t\tif(!qi){\r\n\t\t\tqi = this._createQuickInfoElement();\r\n\t\t}\r\n\r\n\t\tif(content.taskId){\r\n\t\t\tthis._quickInfoBoxId = content.taskId;\r\n\t\t}\r\n\r\n\t\tconst titleBox = qi.querySelector(\".gantt_cal_qi_title\") as HTMLElement;\r\n\t\tconst titleContent = titleBox.querySelector(\".gantt_cal_qi_tcontent\");\r\n\t\tconst titleDate = titleBox.querySelector(\".gantt_cal_qi_tdate\");\r\n\t\tconst main = qi.querySelector(\".gantt_cal_qi_content\");\r\n\t\tconst controls = qi.querySelector(\".gantt_cal_qi_controls\") as HTMLElement;\r\n\r\n\t\tgantt._waiAria.quickInfoHeader(qi, [content.header.title, content.header.date].join(\" \"));\r\n\r\n\t\ttitleContent.innerHTML = content.header.title;\r\n\t\ttitleDate.innerHTML = content.header.date;\r\n\r\n\t\tif(!content.header.title && !content.header.date){\r\n\t\t\ttitleBox.style.display = \"none\";\r\n\t\t}else{\r\n\t\t\ttitleBox.style.display = \"\";\r\n\t\t}\r\n\t\tmain.innerHTML = content.content;\r\n\r\n\t\tconst buttons = content.buttons;\r\n\t\tif(!buttons.length){\r\n\t\t\tcontrols.style.display = \"none\";\r\n\t\t}else{\r\n\t\t\tcontrols.style.display = \"\";\r\n\t\t}\r\n\t\tlet html = \"\";\r\n\t\tfor (let i = 0; i < buttons.length; i++){\r\n\r\n\t\t\tconst ariaAttr = gantt._waiAria.quickInfoButtonAttrString(gantt.locale.labels[buttons[i]]);\r\n\r\n\t\t\thtml += \"
\"+gantt.locale.labels[buttons[i]]+\"
\";\r\n\t\t}\r\n\t\tcontrols.innerHTML = html;\r\n\r\n\t\tgantt.eventRemove(qi, \"click\", this._qiButtonClickHandler);\r\n\t\tgantt.eventRemove(qi, \"keypress\", this._qiKeyPressHandler);\r\n\r\n\t\tgantt.event(qi, \"click\", this._qiButtonClickHandler);\r\n\t\tgantt.event(qi, \"keypress\", this._qiKeyPressHandler);\r\n\t}\r\n\r\n\tprivate _qiButtonClickHandler = (ev) => {\r\n\t\tev = ev || event;\r\n\t\tthis._qi_button_click(ev.target || ev.srcElement);\r\n\t}\r\n\r\n\tprivate _qiKeyPressHandler = (e) => {\r\n\t\te = e || event;\r\n\t\t// @ts-ignore\r\n\t\tconst code = e.which||event.keyCode;\r\n\t\tif (code === 13 || code === 32){\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tthis._qi_button_click(e.target || e.srcElement);\r\n\t\t\t},1);\r\n\t\t}\r\n\t}\r\n\r\n\tprivate _showAtCoordinates(x: number, y: number) : void {\r\n\t\tthis.hide(true);\r\n\t\tthis._quickInfoBoxId = 0;\r\n\t\tthis._quickInfoTask = null;\r\n\t\tif(!this._quickInfoBox){\r\n\t\t\tthis._createQuickInfoElement();\r\n\t\t\tthis.setContent();\r\n\t\t}\r\n\r\n\t\tthis._appendAtCoordinates(x, y);\r\n\t\tthis._gantt.callEvent(\"onQuickInfo\", [null]);\r\n\t}\r\n\r\n\tprivate _showForTask(id: TaskID) : void {\r\n\t\tconst gantt = this._gantt;\r\n\t\tif ((\r\n\t\t\tid === this._quickInfoBoxId &&\r\n\t\t\tgantt.utils.dom.isChildOf(this._quickInfoBox, document.body)\r\n\t\t) || !gantt.config.show_quick_info) {\r\n\t\t\t// not show if the quick info is already displayed for this task, or if it shouldn't be displayed\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tthis.hide(true);\r\n\t\tconst offset = 6; // offset TASK <> QI-BOX in 'px'\r\n\t\tconst container = this._getContainer();\r\n\t\tconst pos = this._get_event_counter_part(id, offset, container.xViewport, container.yViewport);\r\n\r\n\t\tif (pos){\r\n\t\t\tthis._quickInfoBox = this._init_quick_info(id);\r\n\t\t\tthis._quickInfoTask = id;\r\n\t\t\tthis._quickInfoBox.className = this._prepare_quick_info_classname(id);\r\n\r\n\t\t\tthis._fill_quick_data(id);\r\n\t\t\tthis._show_quick_info(pos, offset);\r\n\t\t\tgantt.callEvent(\"onQuickInfo\", [id]);\r\n\t\t}\r\n\t}\r\n\r\n\tprivate _get_event_counter_part(id: TaskID, offset: number, xViewport: HTMLElement, yViewport: HTMLElement) : any {\r\n\t\tconst gantt = this._gantt;\r\n\t\tlet domEv = gantt.getTaskNode(id);\r\n\t\tif (!domEv) {\r\n\t\t\tdomEv = gantt.getTaskRowNode(id);\r\n\t\t\tif (!domEv) {\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\t\t}\r\n\t\tlet left = 0;\r\n\t\tconst top = offset + domEv.offsetTop + domEv.offsetHeight;\r\n\r\n\t\tlet node = domEv;\r\n\r\n\t\tif (gantt.utils.dom.isChildOf(node, xViewport)) {\r\n\t\t\twhile (node && node !== xViewport){\r\n\t\t\t\tleft += node.offsetLeft;\r\n\t\t\t\tnode = node.offsetParent;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tconst scroll = gantt.getScrollState();\r\n\r\n\t\tif(node){\r\n\t\t\tconst dx = (left + domEv.offsetWidth/2) - scroll.x > (xViewport.offsetWidth/2) ? 1 : 0;\r\n\t\t\tconst dy = (top + domEv.offsetHeight/2) - scroll.y > (yViewport.offsetHeight/2) ? 1 : 0;\r\n\r\n\t\t\treturn { left, top, dx, dy, width:domEv.offsetWidth, height:domEv.offsetHeight };\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\tprivate _createQuickInfoElement() : HTMLElement {\r\n\t\tconst gantt = this._gantt;\r\n\t\tconst qi = document.createElement(\"div\");\r\n\t\tqi.className += \"gantt_cal_quick_info\";\r\n\t\tgantt._waiAria.quickInfoAttr(qi);\r\n\r\n\t\t// title\r\n\t\tconst ariaAttr = gantt._waiAria.quickInfoHeaderAttrString();\r\n\t\tlet html = \"
\" +\r\n\t\t\t\"
\" +\r\n\t\t\t\"
\" +\r\n\t\t\t\"
\";\r\n\r\n\t\t// buttons\r\n\t\thtml += \"
\";\r\n\t\thtml += \"
\";\r\n\r\n\t\tqi.innerHTML = html;\r\n\r\n\r\n\t\tif (gantt.config.quick_info_detached) {\r\n\t\t\tconst container = this._getContainer();\r\n\t\t\tgantt.event(container.parent, \"scroll\", () => { this.hide(); });\r\n\t\t}\r\n\r\n\t\tthis._quickInfoBox = qi;\r\n\t\treturn qi;\r\n\t}\r\n\r\n\tprivate _init_quick_info(id: TaskID) : HTMLElement {\r\n\t\tconst gantt = this._gantt;\r\n\t\tconst task = gantt.getTask(id);\r\n\t\tif(typeof this._quickInfoReadonly === \"boolean\"){\r\n\t\t\tif(gantt.isReadonly(task) !== this._quickInfoReadonly){\r\n\t\t\t\tthis.hide(true);\r\n\t\t\t\tthis._quickInfoBox = null;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthis._quickInfoReadonly = gantt.isReadonly(task);\r\n\r\n\t\tif (!this._quickInfoBox){\r\n\t\t\tthis._quickInfoBox = this._createQuickInfoElement();\r\n\t\t}\r\n\r\n\t\treturn this._quickInfoBox;\r\n\t}\r\n\r\n\tprivate _prepare_quick_info_classname(id: TaskID) : string {\r\n\t\tconst gantt = this._gantt;\r\n\t\tconst task = gantt.getTask(id);\r\n\r\n\t\tlet css = \"gantt_cal_quick_info\";\r\n\t\tconst template = gantt.templates.quick_info_class(task.start_date, task.end_date, task);\r\n\r\n\t\tif(template){\r\n\t\t\tcss += \" \" + template;\r\n\t\t}\r\n\t\treturn css;\r\n\t}\r\n\r\n\tprivate _fill_quick_data(id: TaskID) : void {\r\n\t\tconst gantt = this._gantt;\r\n\t\tconst ev = gantt.getTask(id);\r\n\r\n\t\tthis._quickInfoBoxId = id;\r\n\r\n\t\tlet allowedButtons = [];\r\n\t\tif (this._quickInfoReadonly){\r\n\t\t\tconst buttons = gantt.config.quickinfo_buttons;\r\n\t\t\tconst isEditor = {icon_delete: true, icon_edit: true};\r\n\t\t\tfor (let i = 0; i < buttons.length; i++){\r\n\t\t\t\tif(this._quickInfoReadonly && isEditor[buttons[i]]){\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\tallowedButtons.push(buttons[i]);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tallowedButtons = gantt.config.quickinfo_buttons;\r\n\t\t}\r\n\r\n\t\tthis.setContent({\r\n\t\t\theader: {\r\n\t\t\t\ttitle: gantt.templates.quick_info_title(ev.start_date, ev.end_date, ev),\r\n\t\t\t\tdate: gantt.templates.quick_info_date(ev.start_date, ev.end_date, ev)\r\n\t\t\t},\r\n\t\t\tcontent: gantt.templates.quick_info_content(ev.start_date, ev.end_date, ev),\r\n\t\t\tbuttons: allowedButtons\r\n\t\t});\r\n\t}\r\n\r\n\tprivate _appendAtCoordinates(x: number, y: number): void {\r\n\t\tconst qi = this._quickInfoBox;\r\n\t\tconst container = this._getContainer();\r\n\t\tif (!qi.parentNode ||\r\n\t\t\tqi.parentNode.nodeName.toLowerCase() === \"#document-fragment\"){ // IE8\r\n\t\t\tcontainer.parent.appendChild(qi);\r\n\t\t}\r\n\r\n\t\tqi.style.left = x + \"px\";\r\n\t\tqi.style.top = y + \"px\";\r\n\t}\r\n\r\n\tprivate _show_quick_info(pos: any, offset: number) : void {\r\n\t\tconst gantt = this._gantt;\r\n\t\tconst qi = this._quickInfoBox;\r\n\t\tif (gantt.config.quick_info_detached) {\r\n\t\t\tconst container = this._getContainer();\r\n\t\t\tif (!qi.parentNode ||\r\n\t\t\t\tqi.parentNode.nodeName.toLowerCase() === \"#document-fragment\"){ // IE8\r\n\t\t\t\tcontainer.parent.appendChild(qi);\r\n\t\t\t}\r\n\t\t\tconst width = qi.offsetWidth;\r\n\t\t\tconst popupHeight = qi.offsetHeight;\r\n\r\n\t\t\tconst scrolls = gantt.getScrollState();\r\n\t\t\tconst xViewport = container.xViewport;\r\n\t\t\tconst yViewport = container.yViewport;\r\n\t\t\tconst screenWidth = xViewport.offsetWidth + scrolls.x - width;\r\n\r\n\t\t\tconst relativePopupTop = pos.top - scrolls.y;\r\n\t\t\tconst relativePopupBottom = relativePopupTop + popupHeight;\r\n\r\n\t\t\tlet top = pos.top;\r\n\t\t\tif(relativePopupBottom > yViewport.offsetHeight / 2){\r\n\t\t\t\ttop = pos.top - (popupHeight + pos.height + 2*offset);\r\n\t\t\t\tif(top < scrolls.y && relativePopupBottom <= yViewport.offsetHeight){\r\n\t\t\t\t\ttop = pos.top;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (top < scrolls.y) {\r\n\t\t\t\ttop = scrolls.y;\r\n\t\t\t}\r\n\r\n\t\t\tconst x = Math.min(Math.max(scrolls.x, pos.left - pos.dx*(width - pos.width)), screenWidth);\r\n\t\t\tconst y = top;\r\n\r\n\t\t\tthis._appendAtCoordinates(x, y);\r\n\t\t} else {\r\n\t\t\tqi.style.top = 20 + \"px\";\r\n\t\t\tif (pos.dx === 1){\r\n\t\t\t\tqi.style.right = \"auto\";\r\n\t\t\t\tqi.style.left = \"-300px\";\r\n\r\n\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\tqi.style.left = \"10px\";\r\n\t\t\t\t},1);\r\n\t\t\t} else {\r\n\t\t\t\tqi.style.left = \"auto\";\r\n\t\t\t\tqi.style.right = \"-300px\";\r\n\r\n\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\tqi.style.right = \"10px\";\r\n\t\t\t\t},1);\r\n\t\t\t}\r\n\t\t\tqi.className += \" gantt_qi_\"+(pos.dx === 1 ? \"left\" : \"right\");\r\n\t\t\tgantt.$root.appendChild(qi);\r\n\t\t}\r\n\t}\r\n\r\n\tprivate _qi_button_click(node: any) : void {\r\n\t\tconst gantt = this._gantt;\r\n\t\tconst box = this._quickInfoBox;\r\n\t\tif (!node || node === box){\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst mask = node.className;\r\n\t\tif (mask.indexOf(\"_icon\") !== -1){\r\n\t\t\tconst id = this._quickInfoBoxId;\r\n\t\t\tgantt.$click.buttons[mask.split(\" \")[1].replace(\"icon_\",\"\")](id);\r\n\t\t} else {\r\n\t\t\tthis._qi_button_click(node.parentNode);\r\n\t\t}\r\n\t}\r\n\r\n\tprivate _getContainer(): IQuickInfoContainer{\r\n\t\tconst gantt = this._gantt;\r\n\t\tlet container = this._container ? this._container : gantt.$task_data;\r\n\t\tif (container && container.offsetHeight && container.offsetWidth) {\r\n\t\t\treturn {\r\n\t\t\t\tparent: container,\r\n\t\t\t\txViewport: gantt.$task,\r\n\t\t\t\tyViewport: gantt.$task_data\r\n\t\t\t};\r\n\t\t}\r\n\t\tcontainer = this._container ? this._container : gantt.$grid_data;\r\n\t\tif (container && container.offsetHeight && container.offsetWidth) {\r\n\t\t\treturn {\r\n\t\t\t\tparent: container,\r\n\t\t\t\txViewport: gantt.$grid,\r\n\t\t\t\tyViewport: gantt.$grid_data\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\tparent: this._container ? this._container : gantt.$layout,\r\n\t\t\txViewport: gantt.$layout,\r\n\t\t\tyViewport: gantt.$layout\r\n\t\t};\r\n\t}\r\n}\r\n","import { QuickInfo } from \"./quickInfo\";\r\n\r\nexport default function(gantt: any){\r\n\r\nif (!gantt.ext) {\r\n\tgantt.ext = {};\r\n}\r\ngantt.ext.quickInfo = new QuickInfo(gantt);\r\n\r\ngantt.config.quickinfo_buttons = [\"icon_delete\",\"icon_edit\"];\r\ngantt.config.quick_info_detached = true;\r\ngantt.config.show_quick_info = true;\r\n\r\ngantt.templates.quick_info_title = function(start, end, ev){ return ev.text.substr(0,50); };\r\ngantt.templates.quick_info_content = function(start, end, ev){ return ev.details || ev.text; };\r\ngantt.templates.quick_info_date = function(start, end, ev){\r\n\treturn gantt.templates.task_time(start, end, ev);\r\n};\r\ngantt.templates.quick_info_class = function(start, end, task){ return \"\"; };\r\n\r\ngantt.attachEvent(\"onTaskClick\", function(id,e){\r\n\t// GS-1460 Don't show Quick Info when clicking on the \"+\" button\r\n\tif (!gantt.utils.dom.closest(e.target, \".gantt_add\")){\r\n\t\tsetTimeout(function() {\r\n\t\t\tgantt.ext.quickInfo.show(id);\r\n\t\t}, 0);\r\n\t}\r\n\r\n\treturn true;\r\n});\r\n\r\nconst events = [\"onViewChange\", \"onLightbox\", \"onBeforeTaskDelete\", \"onBeforeDrag\"];\r\nconst hidingFunction = function(){\r\n\tgantt.ext.quickInfo.hide();\r\n\treturn true;\r\n};\r\nfor (let i=0; i gantt.getGlobalTaskIndex(b) ? 1 : -1;\n });\n return res;\n },\n forSelected: function forSelected(callback) {\n var selected = this.getSelected();\n\n for (var i = 0; i < selected.length; i++) {\n callback(selected[i]);\n }\n },\n isSameLevel: function isSameLevel(id) {\n if (!this._one_level) return true;\n var last = this.getLastSelected();\n if (!last) return true;\n if (!(gantt.isTaskExists(last) && gantt.isTaskExists(id))) return true;\n return !!(gantt.calculateTaskLevel(gantt.getTask(last)) == gantt.calculateTaskLevel(gantt.getTask(id)));\n },\n afterSelect: function afterSelect(id) {\n if (gantt.isTaskExists(id)) {\n // FIXME: quick workaround to prevent re-filtering inside refresh on multiselect\n gantt._quickRefresh(function () {\n gantt.refreshTask(id);\n });\n }\n },\n doSelection: function doSelection(e) {\n if (!this.isActive()) return false; // deny selection when click on 'expand' or 'collapse' icons\n\n if (gantt._is_icon_open_click(e)) return false;\n var target_ev = gantt.locate(e);\n if (!target_ev) return false;\n if (!gantt.callEvent(\"onBeforeMultiSelect\", [e])) return false;\n var selected = this.getSelected();\n var defaultLast = this.getFirstSelected();\n var isLast = false;\n var last = this.getLastSelected();\n var multiSelect = gantt.config.multiselect;\n\n var singleSelection = function () {\n // GS-719: If the multiselect extension is added we still need a way\n // to open the inline editors after clicking on the cells in the grid\n var controller = gantt.ext.inlineEditors;\n var state = controller.getState();\n var cell = controller.locateCell(e.target);\n\n if (gantt.config.inline_editors_multiselect_open && 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\n this.setFirstSelected(target_ev);\n\n if (!this.isSelected(target_ev)) {\n this.select(target_ev, e);\n }\n\n selected = this.getSelected();\n\n for (var i = 0; i < selected.length; i++) {\n if (selected[i] !== target_ev) {\n this.unselect(selected[i], e);\n }\n }\n }.bind(this);\n\n var blockSelection = function () {\n if (!last) last = target_ev;else if (target_ev) {\n var first_indx = gantt.getGlobalTaskIndex(this.getFirstSelected());\n var target_indx = gantt.getGlobalTaskIndex(target_ev);\n var last_indx = gantt.getGlobalTaskIndex(last); // clear prev selection\n\n var tmp = last;\n\n while (gantt.getGlobalTaskIndex(tmp) !== first_indx) {\n this.unselect(tmp, e);\n tmp = first_indx > last_indx ? gantt.getNext(tmp) : gantt.getPrev(tmp);\n }\n\n tmp = target_ev;\n\n while (gantt.getGlobalTaskIndex(tmp) !== first_indx) {\n if (this.select(tmp, e) && !isLast) {\n isLast = true;\n defaultLast = tmp;\n }\n\n tmp = first_indx > target_indx ? gantt.getNext(tmp) : gantt.getPrev(tmp);\n }\n }\n }.bind(this);\n\n if (multiSelect && (e.ctrlKey || e.metaKey)) {\n if (!this.isSelected(target_ev)) this.setFirstSelected(target_ev);\n\n if (target_ev) {\n this.toggle(target_ev, e);\n }\n } else if (multiSelect && e.shiftKey) {\n if (!gantt.isTaskExists(this.getFirstSelected()) || this.getFirstSelected() === null) {\n this.setFirstSelected(target_ev);\n }\n\n if (selected.length) {\n // select a group of tasks\n blockSelection();\n } else {\n // select a task when no task is selected and Shift is pressed\n singleSelection();\n }\n } else {\n // no key press or no multiple selection on the mouse click\n singleSelection();\n }\n\n if (this.isSelected(target_ev)) {\n this.setLastSelected(target_ev);\n } else if (defaultLast) {\n if (target_ev == last) this.setLastSelected(e.shiftKey ? defaultLast : this.getDefaultSelected());\n } else {\n this.setLastSelected(null);\n }\n\n if (!this.getSelected().length) this.setLastSelected(null);\n if (!this.getLastSelected() || !this.isSelected(this.getFirstSelected())) this.setFirstSelected(this.getLastSelected());\n return true;\n }\n };\n\n (function () {\n var old_selectTask = gantt.selectTask;\n\n gantt.selectTask = function (id) {\n id = replaceValidZeroId(id, this.config.root_id);\n if (!id) return false;\n var multiselect = gantt._multiselect;\n var res = id;\n\n if (multiselect.isActive()) {\n if (multiselect.select(id, null)) {\n multiselect.setLastSelected(id);\n }\n\n multiselect.setFirstSelected(multiselect.getLastSelected());\n } else {\n res = old_selectTask.call(this, id);\n }\n\n return res;\n };\n\n var old_unselectTask = gantt.unselectTask;\n\n gantt.unselectTask = function (id) {\n var multiselect = gantt._multiselect;\n var isActive = multiselect.isActive();\n id = id || multiselect.getLastSelected();\n\n if (id && isActive) {\n multiselect.unselect(id, null);\n if (id == multiselect.getLastSelected()) multiselect.setLastSelected(null);\n gantt.refreshTask(id);\n multiselect.setFirstSelected(multiselect.getLastSelected());\n }\n\n var res = id;\n if (!isActive) res = old_unselectTask.call(this, id);\n return res;\n };\n\n gantt.toggleTaskSelection = function (id) {\n var multiselect = gantt._multiselect;\n\n if (id && multiselect.isActive()) {\n multiselect.toggle(id);\n multiselect.setFirstSelected(multiselect.getLastSelected());\n }\n };\n\n gantt.getSelectedTasks = function () {\n var multiselect = gantt._multiselect;\n multiselect.isActive();\n return multiselect.getSelected();\n };\n\n gantt.eachSelectedTask = function (callback) {\n return this._multiselect.forSelected(callback);\n };\n\n gantt.isSelectedTask = function (id) {\n return this._multiselect.isSelected(id);\n };\n\n gantt.getLastSelectedTask = function () {\n return this._multiselect.getLastSelected();\n };\n\n gantt.attachEvent(\"onGanttReady\", function () {\n var old_isSelected = gantt.$data.tasksStore.isSelected;\n\n gantt.$data.tasksStore.isSelected = function (id) {\n if (gantt._multiselect.isActive()) {\n return gantt._multiselect.isSelected(id);\n }\n\n return old_isSelected.call(this, id);\n };\n });\n })();\n\n gantt.attachEvent(\"onTaskIdChange\", function (id, new_id) {\n var multiselect = gantt._multiselect;\n if (!multiselect.isActive()) return true;\n\n if (gantt.isSelectedTask(id)) {\n multiselect.unselect(id, null);\n multiselect.select(new_id, null);\n }\n });\n gantt.attachEvent(\"onAfterTaskDelete\", function (id, item) {\n var multiselect = gantt._multiselect;\n if (!multiselect.isActive()) return true;\n\n if (multiselect._selected[id]) {\n // GS-1057: don't unselect the task here because the task is already unselected \n // it was in the select.js file before it was deleted\n // multiselect.unselect(id, null);\n multiselect._selected[id] = false;\n multiselect.setLastSelected(multiselect.getDefaultSelected());\n }\n\n multiselect.forSelected(function (task_id) {\n if (!gantt.isTaskExists(task_id)) multiselect.unselect(task_id, null);\n });\n });\n gantt.attachEvent(\"onBeforeTaskMultiSelect\", function (id, state, e) {\n var multiselect = gantt._multiselect;\n\n if (state && multiselect.isActive()) {\n if (multiselect._one_level) {\n return multiselect.isSameLevel(id);\n }\n }\n\n return true;\n });\n gantt.attachEvent(\"onTaskClick\", function (id, e) {\n if (gantt._multiselect.doSelection(e)) gantt.callEvent(\"onMultiSelect\", [e]);\n return true;\n });\n};","module.exports = function (gantt) {\n if (!gantt._markers) {\n gantt._markers = gantt.createDatastore({\n name: \"marker\",\n initItem: function initItem(marker) {\n marker.id = marker.id || gantt.uid();\n return marker;\n }\n });\n }\n\n gantt.config.show_markers = true;\n\n function render_marker(marker) {\n if (!gantt.config.show_markers) return false;\n if (!marker.start_date) return false;\n var state = gantt.getState();\n if (+marker.start_date > +state.max_date) return;\n if ((!marker.end_date || +marker.end_date < +state.min_date) && +marker.start_date < +state.min_date) return;\n var div = document.createElement(\"div\");\n div.setAttribute(\"data-marker-id\", marker.id);\n var css = \"gantt_marker\";\n if (gantt.templates.marker_class) css += \" \" + gantt.templates.marker_class(marker);\n\n if (marker.css) {\n css += \" \" + marker.css;\n }\n\n if (marker.title) {\n div.title = marker.title;\n }\n\n div.className = css;\n var start = gantt.posFromDate(marker.start_date);\n div.style.left = start + \"px\";\n var markerHeight = Math.max(gantt.getRowTop(gantt.getVisibleTaskCount()), 0) + \"px\";\n\n if (gantt.config.timeline_placeholder) {\n markerHeight = gantt.$container.scrollHeight + \"px\";\n }\n\n div.style.height = markerHeight;\n\n if (marker.end_date) {\n var end = gantt.posFromDate(marker.end_date);\n div.style.width = Math.max(end - start, 0) + \"px\";\n }\n\n if (marker.text) {\n div.innerHTML = \"
\" + marker.text + \"
\";\n }\n\n return div;\n }\n\n function initMarkerArea() {\n if (!gantt.$task_data) return;\n var markerArea = document.createElement(\"div\");\n markerArea.className = \"gantt_marker_area\";\n gantt.$task_data.appendChild(markerArea);\n gantt.$marker_area = markerArea;\n }\n\n gantt.attachEvent(\"onBeforeGanttRender\", function () {\n if (!gantt.$marker_area) initMarkerArea();\n });\n gantt.attachEvent(\"onDataRender\", function () {\n if (!gantt.$marker_area) {\n initMarkerArea();\n gantt.renderMarkers();\n }\n });\n gantt.attachEvent(\"onGanttLayoutReady\", function () {\n // GS-1304 - markers should attach when layout is initialized, both on gantt.init and gantt.resetLayout\n // wait for \"onBeforeGanttRender\", so all layout elements will be in DOM\n gantt.attachEvent(\"onBeforeGanttRender\", function () {\n initMarkerArea();\n var layers = gantt.$services.getService(\"layers\");\n var markerRenderer = layers.createDataRender({\n name: \"marker\",\n defaultContainer: function defaultContainer() {\n return gantt.$marker_area;\n }\n });\n markerRenderer.addLayer(render_marker);\n }, {\n once: true\n });\n });\n\n gantt.getMarker = function (id) {\n if (!this._markers) return null;\n return this._markers.getItem(id);\n };\n\n gantt.addMarker = function (marker) {\n return this._markers.addItem(marker);\n };\n\n gantt.deleteMarker = function (id) {\n if (!this._markers.exists(id)) return false;\n\n this._markers.removeItem(id);\n\n return true;\n };\n\n gantt.updateMarker = function (id) {\n this._markers.refresh(id);\n };\n\n gantt._getMarkers = function () {\n return this._markers.getItems();\n };\n\n gantt.renderMarkers = function () {\n this._markers.refresh();\n };\n};","module.exports = function (gantt) {\n gantt.$keyboardNavigation.dispatcher = {\n isActive: false,\n activeNode: null,\n globalNode: new gantt.$keyboardNavigation.GanttNode(),\n enable: function enable() {\n this.isActive = true;\n this.setActiveNode(this.getActiveNode());\n },\n disable: function disable() {\n this.isActive = false;\n },\n isEnabled: function isEnabled() {\n return !!this.isActive;\n },\n getDefaultNode: function getDefaultNode() {\n var node;\n\n if (gantt.config.keyboard_navigation_cells) {\n node = new gantt.$keyboardNavigation.TaskCell();\n } else {\n node = new gantt.$keyboardNavigation.TaskRow();\n }\n\n if (!node.isValid()) {\n node = node.fallback();\n }\n\n return node;\n },\n setDefaultNode: function setDefaultNode() {\n this.setActiveNode(this.getDefaultNode());\n },\n getActiveNode: function getActiveNode() {\n var node = this.activeNode;\n\n if (node && !node.isValid()) {\n node = node.fallback();\n }\n\n return node;\n },\n fromDomElement: function fromDomElement(e) {\n var inputs = [gantt.$keyboardNavigation.TaskRow, gantt.$keyboardNavigation.TaskCell, gantt.$keyboardNavigation.HeaderCell];\n\n for (var i = 0; i < inputs.length; i++) {\n if (inputs[i].prototype.fromDomElement) {\n var node = inputs[i].prototype.fromDomElement(e);\n if (node) return node;\n }\n }\n\n return null;\n },\n focusGlobalNode: function focusGlobalNode() {\n this.blurNode(this.globalNode);\n this.focusNode(this.globalNode);\n },\n setActiveNode: function setActiveNode(el) {\n //console.trace()\n var focusChanged = true;\n\n if (this.activeNode) {\n if (this.activeNode.compareTo(el)) {\n focusChanged = false;\n }\n }\n\n if (this.isEnabled()) {\n if (focusChanged) this.blurNode(this.activeNode);\n this.activeNode = el;\n this.focusNode(this.activeNode, !focusChanged);\n }\n },\n focusNode: function focusNode(el, keptFocus) {\n if (el && el.focus) {\n el.focus(keptFocus);\n }\n },\n blurNode: function blurNode(el) {\n if (el && el.blur) {\n el.blur();\n }\n },\n keyDownHandler: function keyDownHandler(e) {\n if (gantt.$keyboardNavigation.isModal()) return;\n if (!this.isEnabled()) return;\n\n if (e.defaultPrevented) {\n return;\n }\n\n var ganttNode = this.globalNode;\n var command = gantt.$keyboardNavigation.shortcuts.getCommandFromEvent(e);\n var activeElement = this.getActiveNode();\n var eventFacade = gantt.$keyboardNavigation.facade;\n\n if (eventFacade.callEvent(\"onKeyDown\", [command, e]) === false) {\n return;\n }\n\n if (!activeElement) {\n this.setDefaultNode();\n } else if (activeElement.findHandler(command)) {\n activeElement.doAction(command, e);\n } else if (ganttNode.findHandler(command)) {\n ganttNode.doAction(command, e);\n }\n },\n _timeout: null,\n awaitsFocus: function awaitsFocus() {\n return this._timeout !== null;\n },\n delay: function delay(callback, _delay) {\n clearTimeout(this._timeout);\n this._timeout = setTimeout(gantt.bind(function () {\n this._timeout = null;\n callback();\n }, this), _delay || 1);\n },\n clearDelay: function clearDelay() {\n clearTimeout(this._timeout);\n }\n };\n};","module.exports = function (gantt) {\n (function () {\n var modalsStack = [];\n\n function isModal() {\n return !!modalsStack.length;\n }\n\n function afterPopup(box) {\n setTimeout(function () {\n if (!isModal()) {\n if (!gantt.$destroyed) {\n gantt.focus();\n }\n }\n }, 1);\n }\n\n function startModal(box) {\n gantt.eventRemove(box, \"keydown\", trapFocus);\n gantt.event(box, \"keydown\", trapFocus);\n modalsStack.push(box); //gantt.$keyboardNavigation.dispatcher.disable();\n }\n\n function endModal() {\n var box = modalsStack.pop();\n\n if (box) {\n gantt.eventRemove(box, \"keydown\", trapFocus);\n }\n\n afterPopup(box);\n }\n\n function isTopModal(box) {\n return box == modalsStack[modalsStack.length - 1];\n }\n\n function trapFocus(event) {\n var target = event.currentTarget;\n if (!isTopModal(target)) return;\n gantt.$keyboardNavigation.trapFocus(target, event);\n }\n\n function traceLightbox() {\n startModal(gantt.getLightbox());\n }\n\n gantt.attachEvent(\"onLightbox\", traceLightbox);\n gantt.attachEvent(\"onAfterLightbox\", endModal);\n gantt.attachEvent(\"onLightboxChange\", function () {\n endModal();\n traceLightbox();\n });\n gantt.attachEvent(\"onAfterQuickInfo\", function () {\n afterPopup();\n });\n gantt.attachEvent(\"onMessagePopup\", function (box) {\n saveFocus();\n startModal(box);\n });\n gantt.attachEvent(\"onAfterMessagePopup\", function () {\n endModal();\n restoreFocus();\n });\n var focusElement = null;\n\n function saveFocus() {\n focusElement = gantt.utils.dom.getActiveElement();\n }\n\n function restoreFocus() {\n setTimeout(function () {\n if (focusElement) {\n focusElement.focus();\n focusElement = null;\n }\n }, 1);\n }\n\n gantt.$keyboardNavigation.isModal = isModal;\n })();\n};","module.exports = function (gantt) {\n var domHelpers = require(\"../../../core/ui/utils/dom_helpers\");\n\n var _require = require(\"../../../utils/helpers\"),\n replaceValidZeroId = _require.replaceValidZeroId;\n\n gantt.$keyboardNavigation.TaskCell = function (taskId, index) {\n taskId = replaceValidZeroId(taskId, gantt.config.root_id);\n\n if (!taskId) {\n var rootLevel = gantt.getChildren(gantt.config.root_id);\n\n if (rootLevel[0]) {\n taskId = rootLevel[0];\n }\n }\n\n this.taskId = taskId;\n this.columnIndex = index || 0; // provided task may not exist, in this case node will be detectes as invalid\n\n if (gantt.isTaskExists(this.taskId)) {\n this.index = gantt.getTaskIndex(this.taskId);\n this.globalIndex = gantt.getGlobalTaskIndex(this.taskId);\n }\n };\n\n gantt.$keyboardNavigation.TaskCell.prototype = gantt._compose(gantt.$keyboardNavigation.TaskRow, {\n _handlers: null,\n isValid: function isValid() {\n return gantt.$keyboardNavigation.TaskRow.prototype.isValid.call(this) && !!gantt.getGridColumns()[this.columnIndex];\n },\n fallback: function fallback() {\n var node = gantt.$keyboardNavigation.TaskRow.prototype.fallback.call(this);\n var result = node;\n\n if (node instanceof gantt.$keyboardNavigation.TaskRow) {\n var visibleColumns = gantt.getGridColumns();\n var index = this.columnIndex;\n\n while (index >= 0) {\n if (visibleColumns[index]) break;\n index--;\n }\n\n if (visibleColumns[index]) {\n result = new gantt.$keyboardNavigation.TaskCell(node.taskId, index);\n }\n }\n\n return result;\n },\n fromDomElement: function fromDomElement(el) {\n if (!gantt.config.keyboard_navigation_cells) {\n return null;\n }\n\n var taskId = gantt.locate(el);\n\n if (gantt.isTaskExists(taskId)) {\n var index = 0;\n var cellElement = domHelpers.locateAttribute(el, \"data-column-index\");\n\n if (cellElement) {\n index = cellElement.getAttribute(\"data-column-index\") * 1;\n }\n\n return new gantt.$keyboardNavigation.TaskCell(taskId, index);\n } else {\n return null;\n }\n },\n getNode: function getNode() {\n if (gantt.isTaskExists(this.taskId) && gantt.isTaskVisible(this.taskId)) {\n if (gantt.config.show_grid) {\n var row = gantt.$grid.querySelector(\".gantt_row[\" + gantt.config.task_attribute + \"='\" + this.taskId + \"']\");\n if (!row) return null;\n return row.querySelector(\"[data-column-index='\" + this.columnIndex + \"']\");\n } else {\n return gantt.getTaskNode(this.taskId);\n }\n }\n },\n keys: {\n \"up\": function up() {\n var nextElement = null;\n var prevTask = gantt.getPrev(this.taskId);\n\n if (!gantt.isTaskExists(prevTask)) {\n nextElement = new gantt.$keyboardNavigation.HeaderCell(this.columnIndex);\n } else {\n nextElement = new gantt.$keyboardNavigation.TaskCell(prevTask, this.columnIndex);\n }\n\n this.moveTo(nextElement);\n },\n \"down\": function down() {\n var nextTask = gantt.getNext(this.taskId);\n\n if (gantt.isTaskExists(nextTask)) {\n this.moveTo(new gantt.$keyboardNavigation.TaskCell(nextTask, this.columnIndex));\n }\n },\n \"left\": function left() {\n if (this.columnIndex > 0) {\n this.moveTo(new gantt.$keyboardNavigation.TaskCell(this.taskId, this.columnIndex - 1));\n }\n },\n \"right\": function right() {\n var columns = gantt.getGridColumns();\n\n if (this.columnIndex < columns.length - 1) {\n this.moveTo(new gantt.$keyboardNavigation.TaskCell(this.taskId, this.columnIndex + 1));\n }\n },\n \"end\": function end() {\n var columns = gantt.getGridColumns();\n this.moveTo(new gantt.$keyboardNavigation.TaskCell(this.taskId, columns.length - 1));\n },\n \"home\": function home() {\n this.moveTo(new gantt.$keyboardNavigation.TaskCell(this.taskId, 0));\n },\n \"pagedown\": function pagedown() {\n if (gantt.getVisibleTaskCount()) {\n this.moveTo(new gantt.$keyboardNavigation.TaskCell(gantt.getTaskByIndex(gantt.getVisibleTaskCount() - 1).id, this.columnIndex));\n }\n },\n \"pageup\": function pageup() {\n if (gantt.getVisibleTaskCount()) {\n this.moveTo(new gantt.$keyboardNavigation.TaskCell(gantt.getTaskByIndex(0).id, this.columnIndex));\n }\n }\n }\n });\n gantt.$keyboardNavigation.TaskCell.prototype.bindAll(gantt.$keyboardNavigation.TaskRow.prototype.keys);\n gantt.$keyboardNavigation.TaskCell.prototype.bindAll(gantt.$keyboardNavigation.TaskCell.prototype.keys);\n};","module.exports = function (gantt) {\n gantt.$keyboardNavigation.TaskRow = function (taskId) {\n if (!taskId) {\n var rootLevel = gantt.getChildren(gantt.config.root_id);\n\n if (rootLevel[0]) {\n taskId = rootLevel[0];\n }\n }\n\n this.taskId = taskId;\n\n if (gantt.isTaskExists(this.taskId)) {\n this.index = gantt.getTaskIndex(this.taskId);\n this.globalIndex = gantt.getGlobalTaskIndex(this.taskId);\n }\n };\n\n gantt.$keyboardNavigation.TaskRow.prototype = gantt._compose(gantt.$keyboardNavigation.KeyNavNode, {\n _handlers: null,\n isValid: function isValid() {\n return gantt.isTaskExists(this.taskId) && gantt.getTaskIndex(this.taskId) > -1;\n },\n fallback: function fallback() {\n if (!gantt.getVisibleTaskCount()) {\n var header = new gantt.$keyboardNavigation.HeaderCell();\n if (!header.isValid()) return null;else return header;\n } else {\n var nextIndex = -1; // GS-1393. When Gantt tries to restore the focus, it should rely on the global index\n\n if (gantt.getTaskByIndex(this.globalIndex - 1)) {\n nextIndex = this.globalIndex - 1;\n } else if (gantt.getTaskByIndex(this.globalIndex + 1)) {\n nextIndex = this.globalIndex + 1;\n } else {\n var globalIndex = this.globalIndex;\n\n while (globalIndex >= 0) {\n if (gantt.getTaskByIndex(globalIndex)) {\n nextIndex = globalIndex;\n break;\n }\n\n globalIndex--;\n }\n }\n\n if (nextIndex > -1) {\n return new gantt.$keyboardNavigation.TaskRow(gantt.getTaskByIndex(nextIndex).id);\n }\n }\n },\n fromDomElement: function fromDomElement(el) {\n if (gantt.config.keyboard_navigation_cells) {\n return null;\n }\n\n var taskId = gantt.locate(el);\n\n if (gantt.isTaskExists(taskId)) {\n return new gantt.$keyboardNavigation.TaskRow(taskId);\n } else {\n return null;\n }\n },\n getNode: function getNode() {\n if (gantt.isTaskExists(this.taskId) && gantt.isTaskVisible(this.taskId)) {\n if (gantt.config.show_grid) {\n return gantt.$grid.querySelector(\".gantt_row[\" + gantt.config.task_attribute + \"='\" + this.taskId + \"']\");\n } else {\n return gantt.getTaskNode(this.taskId);\n }\n }\n },\n focus: function focus(keptFocus) {\n if (!keptFocus) {\n var pos = gantt.getTaskPosition(gantt.getTask(this.taskId));\n var height = gantt.getTaskHeight(this.taskId);\n var scroll = gantt.getScrollState();\n var viewWidth;\n\n if (gantt.$task) {\n viewWidth = gantt.$task.offsetWidth;\n } else {\n viewWidth = scroll.inner_width;\n }\n\n var viewHeight;\n\n if (gantt.$grid_data || gantt.$task_data) {\n viewHeight = (gantt.$grid_data || gantt.$task_data).offsetHeight;\n } else {\n viewHeight = scroll.inner_height;\n }\n\n if (pos.top < scroll.y || pos.top + height > scroll.y + viewHeight) {\n gantt.scrollTo(null, pos.top - height * 5);\n } else if (gantt.config.scroll_on_click && gantt.config.show_chart) {\n // horizontal scroll activated\n if (pos.left > scroll.x + viewWidth) {\n // scroll forward to the start of the task\n gantt.scrollTo(pos.left - gantt.config.task_scroll_offset);\n } else if (pos.left + pos.width < scroll.x) {\n // scroll back to the end of the task\n gantt.scrollTo(pos.left + pos.width - gantt.config.task_scroll_offset);\n }\n }\n }\n\n gantt.$keyboardNavigation.KeyNavNode.prototype.focus.apply(this, [keptFocus]); // GS-152 if there are scrollbars with custom names, change their scroll position\n\n scrollGrid();\n\n function scrollGrid() {\n var grid = gantt.$ui.getView(\"grid\");\n var scrollPositionX = parseInt(grid.$grid.scrollLeft);\n var scrollPositionY = parseInt(grid.$grid_data.scrollTop);\n var attachedScrollbarHorizontal = grid.$config.scrollX;\n\n if (attachedScrollbarHorizontal && grid.$config.scrollable) {\n var scrollbarHorizontal = gantt.$ui.getView(attachedScrollbarHorizontal);\n\n if (scrollbarHorizontal) {\n scrollbarHorizontal.scrollTo(scrollPositionX, scrollPositionY);\n }\n }\n\n var attachedScrollbarVertical = grid.$config.scrollY;\n\n if (attachedScrollbarVertical) {\n var scrollbarVertical = gantt.$ui.getView(attachedScrollbarVertical);\n\n if (scrollbarVertical) {\n scrollbarVertical.scrollTo(scrollPositionX, scrollPositionY);\n }\n }\n }\n },\n keys: {\n \"pagedown\": function pagedown() {\n if (gantt.getVisibleTaskCount()) {\n this.moveTo(new gantt.$keyboardNavigation.TaskRow(gantt.getTaskByIndex(gantt.getVisibleTaskCount() - 1).id));\n }\n },\n \"pageup\": function pageup() {\n if (gantt.getVisibleTaskCount()) {\n this.moveTo(new gantt.$keyboardNavigation.TaskRow(gantt.getTaskByIndex(0).id));\n }\n },\n \"up\": function up() {\n var nextElement = null;\n var prevTask = gantt.getPrev(this.taskId);\n\n if (!gantt.isTaskExists(prevTask)) {\n nextElement = new gantt.$keyboardNavigation.HeaderCell();\n } else {\n nextElement = new gantt.$keyboardNavigation.TaskRow(prevTask);\n }\n\n this.moveTo(nextElement);\n },\n \"down\": function down() {\n var nextTask = gantt.getNext(this.taskId);\n\n if (gantt.isTaskExists(nextTask)) {\n this.moveTo(new gantt.$keyboardNavigation.TaskRow(nextTask));\n }\n },\n \"shift+down\": function shiftDown() {\n if (gantt.hasChild(this.taskId) && !gantt.getTask(this.taskId).$open) {\n gantt.open(this.taskId);\n }\n },\n \"shift+up\": function shiftUp() {\n if (gantt.hasChild(this.taskId) && gantt.getTask(this.taskId).$open) {\n gantt.close(this.taskId);\n }\n },\n \"shift+right\": function shiftRight() {\n if (gantt.isReadonly(this)) {\n return;\n }\n\n var prevId = gantt.getPrevSibling(this.taskId);\n\n if (gantt.isTaskExists(prevId) && !gantt.isChildOf(this.taskId, prevId)) {\n var parent = gantt.getTask(prevId);\n parent.$open = true;\n var result = gantt.moveTask(this.taskId, -1, prevId);\n if (result !== false) gantt.updateTask(this.taskId);\n }\n },\n \"shift+left\": function shiftLeft() {\n if (gantt.isReadonly(this)) {\n return;\n }\n\n var parent = gantt.getParent(this.taskId);\n\n if (gantt.isTaskExists(parent)) {\n var result = gantt.moveTask(this.taskId, gantt.getTaskIndex(parent) + 1, gantt.getParent(parent));\n if (result !== false) gantt.updateTask(this.taskId);\n }\n },\n // select\n \"space\": function space(e) {\n if (!gantt.isSelectedTask(this.taskId)) {\n gantt.selectTask(this.taskId);\n } else {\n gantt.unselectTask(this.taskId);\n }\n },\n // collapse\n \"ctrl+left\": function ctrlLeft(e) {\n gantt.close(this.taskId);\n },\n // expand\n \"ctrl+right\": function ctrlRight(e) {\n gantt.open(this.taskId);\n },\n // delete task\n \"delete\": function _delete(e) {\n if (gantt.isReadonly(this)) {\n return;\n }\n\n gantt.$click.buttons[\"delete\"](this.taskId);\n },\n // open lightbox\n \"enter\": function enter() {\n if (gantt.isReadonly(this)) {\n return;\n }\n\n gantt.showLightbox(this.taskId);\n },\n // add subtask\n \"ctrl+enter\": function ctrlEnter() {\n if (gantt.isReadonly(this)) {\n return;\n }\n\n gantt.createTask({}, this.taskId);\n }\n }\n });\n gantt.$keyboardNavigation.TaskRow.prototype.bindAll(gantt.$keyboardNavigation.TaskRow.prototype.keys);\n};","module.exports = function (gantt) {\n var domHelpers = require(\"../../../core/ui/utils/dom_helpers\");\n\n gantt.$keyboardNavigation.HeaderCell = function (index) {\n this.index = index || 0;\n };\n\n gantt.$keyboardNavigation.HeaderCell.prototype = gantt._compose(gantt.$keyboardNavigation.KeyNavNode, {\n _handlers: null,\n isValid: function isValid() {\n if (!gantt.config.show_grid) {\n if (gantt.getVisibleTaskCount()) return false;\n }\n\n return !!gantt.getGridColumns()[this.index] || !gantt.getVisibleTaskCount();\n },\n fallback: function fallback() {\n if (!gantt.config.show_grid) {\n if (gantt.getVisibleTaskCount()) {\n return new gantt.$keyboardNavigation.TaskRow();\n }\n\n return null;\n }\n\n var visibleColumns = gantt.getGridColumns();\n var index = this.index;\n\n while (index >= 0) {\n if (visibleColumns[index]) break;\n index--;\n }\n\n if (visibleColumns[index]) {\n return new gantt.$keyboardNavigation.HeaderCell(index);\n } else {\n return null;\n }\n },\n fromDomElement: function fromDomElement(el) {\n var cellElement = domHelpers.locateClassName(el, \"gantt_grid_head_cell\");\n\n if (cellElement) {\n var index = 0;\n\n while (cellElement && cellElement.previousSibling) {\n cellElement = cellElement.previousSibling;\n index += 1;\n }\n\n return new gantt.$keyboardNavigation.HeaderCell(index);\n } else {\n return null;\n }\n },\n getNode: function getNode() {\n var cells = gantt.$grid_scale.childNodes;\n return cells[this.index];\n },\n keys: {\n \"left\": function left() {\n if (this.index > 0) {\n this.moveTo(new gantt.$keyboardNavigation.HeaderCell(this.index - 1));\n }\n },\n \"right\": function right() {\n var columns = gantt.getGridColumns();\n\n if (this.index < columns.length - 1) {\n this.moveTo(new gantt.$keyboardNavigation.HeaderCell(this.index + 1));\n }\n },\n \"down\": function down() {\n var taskRow;\n var rootLevel = gantt.getChildren(gantt.config.root_id);\n\n if (gantt.isTaskExists(rootLevel[0])) {\n taskRow = rootLevel[0];\n }\n\n if (taskRow) {\n if (gantt.config.keyboard_navigation_cells) {\n this.moveTo(new gantt.$keyboardNavigation.TaskCell(taskRow, this.index));\n } else {\n this.moveTo(new gantt.$keyboardNavigation.TaskRow(taskRow));\n }\n }\n },\n \"end\": function end() {\n var columns = gantt.getGridColumns();\n this.moveTo(new gantt.$keyboardNavigation.HeaderCell(columns.length - 1));\n },\n \"home\": function home() {\n this.moveTo(new gantt.$keyboardNavigation.HeaderCell(0));\n },\n // press header button\n \"enter, space\": function enterSpace() {\n var node = domHelpers.getActiveElement();\n node.click();\n },\n // add new task\n \"ctrl+enter\": function ctrlEnter() {\n if (gantt.isReadonly(this)) {\n return;\n }\n\n gantt.createTask({}, this.taskId);\n }\n }\n });\n gantt.$keyboardNavigation.HeaderCell.prototype.bindAll(gantt.$keyboardNavigation.HeaderCell.prototype.keys);\n};","module.exports = function (gantt) {\n gantt.$keyboardNavigation.KeyNavNode = function () {};\n\n gantt.$keyboardNavigation.KeyNavNode.prototype = gantt._compose(gantt.$keyboardNavigation.EventHandler, {\n isValid: function isValid() {\n return true;\n },\n fallback: function fallback() {\n return null;\n },\n moveTo: function moveTo(element) {\n gantt.$keyboardNavigation.dispatcher.setActiveNode(element);\n },\n compareTo: function compareTo(b) {\n // good enough comparison of two random objects\n if (!b) return false;\n\n for (var i in this) {\n if (!!this[i] != !!b[i]) return false;\n var canStringifyThis = !!(this[i] && this[i].toString);\n var canStringifyThat = !!(b[i] && b[i].toString);\n if (canStringifyThat != canStringifyThis) return false;\n\n if (!(canStringifyThat && canStringifyThis)) {\n if (b[i] != this[i]) return false;\n } else {\n if (b[i].toString() != this[i].toString()) return false;\n }\n }\n\n return true;\n },\n getNode: function getNode() {},\n focus: function focus() {\n var node = this.getNode();\n if (!node) return;\n var eventFacade = gantt.$keyboardNavigation.facade;\n\n if (eventFacade.callEvent(\"onBeforeFocus\", [node]) === false) {\n return;\n }\n\n if (node) {\n node.setAttribute(\"tabindex\", \"-1\");\n\n if (!node.$eventAttached) {\n node.$eventAttached = true;\n gantt.event(node, \"focus\", function (e) {\n e.preventDefault();\n return false;\n }, false);\n } //node.className += \" gantt_focused\";\n\n\n if (gantt.utils.dom.isChildOf(document.activeElement, node)) {\n node = document.activeElement;\n }\n\n if (node.focus) node.focus();\n eventFacade.callEvent(\"onFocus\", [this.getNode()]);\n }\n },\n blur: function blur() {\n var node = this.getNode();\n\n if (node) {\n var eventFacade = gantt.$keyboardNavigation.facade;\n eventFacade.callEvent(\"onBlur\", [node]);\n node.setAttribute(\"tabindex\", \"-1\"); //node.className = (node.className || \"\").replace(/ ?gantt_focused/g, \"\");\n }\n }\n });\n};","module.exports = function (gantt) {\n gantt.$keyboardNavigation.GanttNode = function () {};\n\n gantt.$keyboardNavigation.GanttNode.prototype = gantt._compose(gantt.$keyboardNavigation.EventHandler, {\n focus: function focus() {\n gantt.focus();\n },\n blur: function blur() {},\n isEnabled: function isEnabled() {\n return gantt.$container.hasAttribute(\"tabindex\");\n },\n scrollHorizontal: function scrollHorizontal(dir) {\n var date = gantt.dateFromPos(gantt.getScrollState().x);\n var scale = gantt.getScale();\n var step = dir < 0 ? -scale.step : scale.step;\n date = gantt.date.add(date, step, scale.unit);\n gantt.scrollTo(gantt.posFromDate(date));\n },\n scrollVertical: function scrollVertical(dir) {\n var top = gantt.getScrollState().y;\n var step = gantt.config.row_height;\n gantt.scrollTo(null, top + (dir < 0 ? -1 : 1) * step);\n },\n keys: {\n \"alt+left\": function altLeft(e) {\n this.scrollHorizontal(-1);\n },\n \"alt+right\": function altRight(e) {\n this.scrollHorizontal(1);\n },\n \"alt+up\": function altUp(e) {\n this.scrollVertical(-1);\n },\n \"alt+down\": function altDown(e) {\n this.scrollVertical(1);\n },\n // undo\n \"ctrl+z\": function ctrlZ() {\n if (gantt.undo) gantt.undo();\n },\n // redo\n \"ctrl+r\": function ctrlR() {\n if (gantt.redo) gantt.redo();\n }\n }\n });\n gantt.$keyboardNavigation.GanttNode.prototype.bindAll(gantt.$keyboardNavigation.GanttNode.prototype.keys);\n};","module.exports = function (gantt) {\n (function () {\n var domHelpers = require(\"../../../core/ui/utils/dom_helpers\");\n\n gantt.$keyboardNavigation.getFocusableNodes = domHelpers.getFocusableNodes;\n\n gantt.$keyboardNavigation.trapFocus = function trapFocus(root, e) {\n if (e.keyCode != 9) return false;\n var focusable = gantt.$keyboardNavigation.getFocusableNodes(root);\n var currentFocus = domHelpers.getActiveElement();\n var currentIndex = -1;\n\n for (var i = 0; i < focusable.length; i++) {\n if (focusable[i] == currentFocus) {\n currentIndex = i;\n break;\n }\n }\n\n if (e.shiftKey) {\n // back tab\n if (currentIndex <= 0) {\n // go to the last element if we focused on the first\n var lastItem = focusable[focusable.length - 1];\n\n if (lastItem) {\n lastItem.focus();\n e.preventDefault();\n return true;\n }\n }\n } else {\n // forward tab\n if (currentIndex >= focusable.length - 1) {\n // forward tab from last element should go back to the first element\n var firstItem = focusable[0];\n\n if (firstItem) {\n firstItem.focus();\n e.preventDefault();\n return true;\n }\n }\n }\n\n return false;\n };\n })();\n};","module.exports = function (gantt) {\n gantt.$keyboardNavigation.EventHandler = {\n _handlers: null,\n findHandler: function findHandler(command) {\n if (!this._handlers) this._handlers = {};\n var shortcuts = gantt.$keyboardNavigation.shortcuts;\n var hash = shortcuts.getHash(command);\n return this._handlers[hash];\n },\n doAction: function doAction(command, e) {\n var handler = this.findHandler(command);\n\n if (handler) {\n var eventFacade = gantt.$keyboardNavigation.facade;\n\n if (eventFacade.callEvent(\"onBeforeAction\", [command, e]) === false) {\n return;\n }\n\n handler.call(this, e);\n if (e.preventDefault) e.preventDefault();else e.returnValue = false;\n }\n },\n bind: function bind(shortcut, handler) {\n if (!this._handlers) this._handlers = {};\n var shortcuts = gantt.$keyboardNavigation.shortcuts;\n var commands = shortcuts.parse(shortcut);\n\n for (var i = 0; i < commands.length; i++) {\n this._handlers[shortcuts.getHash(commands[i])] = handler;\n }\n },\n unbind: function unbind(shortcut) {\n var shortcuts = gantt.$keyboardNavigation.shortcuts;\n var commands = shortcuts.parse(shortcut);\n\n for (var i = 0; i < commands.length; i++) {\n if (this._handlers[shortcuts.getHash(commands[i])]) {\n delete this._handlers[shortcuts.getHash(commands[i])];\n }\n }\n },\n bindAll: function bindAll(map) {\n for (var i in map) {\n this.bind(i, map[i]);\n }\n },\n initKeys: function initKeys() {\n if (!this._handlers) this._handlers = {};\n\n if (this.keys) {\n this.bindAll(this.keys);\n }\n }\n };\n};","module.exports = function (gantt) {\n gantt.$keyboardNavigation.shortcuts = {\n createCommand: function createCommand() {\n return {\n modifiers: {\n \"shift\": false,\n \"alt\": false,\n \"ctrl\": false,\n \"meta\": false\n },\n keyCode: null\n };\n },\n parse: function parse(shortcut) {\n var commands = [];\n var expr = this.getExpressions(this.trim(shortcut));\n\n for (var i = 0; i < expr.length; i++) {\n var words = this.getWords(expr[i]);\n var command = this.createCommand();\n\n for (var j = 0; j < words.length; j++) {\n if (this.commandKeys[words[j]]) {\n command.modifiers[words[j]] = true;\n } else if (this.specialKeys[words[j]]) {\n command.keyCode = this.specialKeys[words[j]];\n } else {\n command.keyCode = words[j].charCodeAt(0);\n }\n }\n\n commands.push(command);\n }\n\n return commands;\n },\n getCommandFromEvent: function getCommandFromEvent(domEvent) {\n var command = this.createCommand();\n command.modifiers.shift = !!domEvent.shiftKey;\n command.modifiers.alt = !!domEvent.altKey;\n command.modifiers.ctrl = !!domEvent.ctrlKey;\n command.modifiers.meta = !!domEvent.metaKey;\n command.keyCode = domEvent.which || domEvent.keyCode;\n\n if (command.keyCode >= 96 && command.keyCode <= 105) {\n // numpad keys 96-105 -> 48-57\n command.keyCode -= 48; //convert numpad number code to regular number code\n }\n\n var printableKey = String.fromCharCode(command.keyCode);\n\n if (printableKey) {\n command.keyCode = printableKey.toLowerCase().charCodeAt(0);\n }\n\n return command;\n },\n getHashFromEvent: function getHashFromEvent(domEvent) {\n return this.getHash(this.getCommandFromEvent(domEvent));\n },\n getHash: function getHash(command) {\n var parts = [];\n\n for (var i in command.modifiers) {\n if (command.modifiers[i]) {\n parts.push(i);\n }\n }\n\n parts.push(command.keyCode);\n return parts.join(this.junctionChar);\n },\n getExpressions: function getExpressions(shortcut) {\n return shortcut.split(this.junctionChar);\n },\n getWords: function getWords(term) {\n return term.split(this.combinationChar);\n },\n trim: function trim(shortcut) {\n return shortcut.replace(/\\s/g, \"\");\n },\n junctionChar: \",\",\n combinationChar: \"+\",\n commandKeys: {\n \"shift\": 16,\n \"alt\": 18,\n \"ctrl\": 17,\n \"meta\": true\n },\n specialKeys: {\n \"backspace\": 8,\n \"tab\": 9,\n \"enter\": 13,\n \"esc\": 27,\n \"space\": 32,\n \"up\": 38,\n \"down\": 40,\n \"left\": 37,\n \"right\": 39,\n \"home\": 36,\n \"end\": 35,\n \"pageup\": 33,\n \"pagedown\": 34,\n \"delete\": 46,\n \"insert\": 45,\n \"plus\": 107,\n \"f1\": 112,\n \"f2\": 113,\n \"f3\": 114,\n \"f4\": 115,\n \"f5\": 116,\n \"f6\": 117,\n \"f7\": 118,\n \"f8\": 119,\n \"f9\": 120,\n \"f10\": 121,\n \"f11\": 122,\n \"f12\": 123\n }\n };\n};","module.exports = function (gantt) {\n var eventable = require(\"../utils/eventable\");\n\n function setupKeyNav(gantt) {\n gantt.config.keyboard_navigation = true;\n gantt.config.keyboard_navigation_cells = false;\n gantt.$keyboardNavigation = {};\n\n gantt._compose = function () {\n var parts = Array.prototype.slice.call(arguments, 0);\n var res = {};\n\n for (var i = 0; i < parts.length; i++) {\n var obj = parts[i];\n\n if (typeof obj == \"function\") {\n obj = new obj();\n }\n\n for (var p in obj) {\n res[p] = obj[p];\n }\n }\n\n return res;\n };\n\n require(\"./keyboard_navigation/common/keyboard_shortcuts\")(gantt);\n\n require(\"./keyboard_navigation/common/eventhandler\")(gantt);\n\n require(\"./keyboard_navigation/common/trap_modal_focus\")(gantt);\n\n require(\"./keyboard_navigation/elements/gantt_node\")(gantt);\n\n require(\"./keyboard_navigation/elements/nav_node\")(gantt);\n\n require(\"./keyboard_navigation/elements/header_cell\")(gantt);\n\n require(\"./keyboard_navigation/elements/task_row\")(gantt);\n\n require(\"./keyboard_navigation/elements/task_cell\")(gantt);\n\n require(\"./keyboard_navigation/modals\")(gantt);\n\n require(\"./keyboard_navigation/core\")(gantt);\n\n var domHelpers = require(\"../core/ui/utils/dom_helpers\");\n\n (function () {\n var dispatcher = gantt.$keyboardNavigation.dispatcher;\n\n dispatcher.isTaskFocused = function (id) {\n var node = dispatcher.activeNode;\n\n if (node instanceof gantt.$keyboardNavigation.TaskRow || node instanceof gantt.$keyboardNavigation.TaskCell) {\n if (node.taskId == id) {\n return true;\n }\n }\n\n return false;\n };\n\n var keyDownHandler = function keyDownHandler(e) {\n if (!gantt.config.keyboard_navigation) return; // GS-734 & GS-1078: we don't need keyboard navigation inside inline editors\n\n if (!gantt.config.keyboard_navigation_cells && isInlineEditorCell(e)) return;\n\n if (isNoKeyboardNavigationElement(e) || isLightboxElement(e)) {\n return;\n }\n\n return dispatcher.keyDownHandler(e);\n };\n\n var focusHandler = function focusHandler(e) {\n if (dispatcher.$preventDefault) {\n e.preventDefault();\n gantt.$container.blur();\n return false; // do nothing if key-nav focus is already planned\n } else if (!dispatcher.awaitsFocus()) {\n // otherwise - re-focus key-nav element on gantt focus\n dispatcher.focusGlobalNode();\n }\n };\n\n var reFocusActiveNode = function reFocusActiveNode() {\n if (!dispatcher.isEnabled()) return;\n var outsideGantt = !domHelpers.isChildOf(document.activeElement, gantt.$container) && document.activeElement.localName != \"body\";\n var activeNode = dispatcher.getActiveNode();\n if (!activeNode || outsideGantt) return;\n var domElement = activeNode.getNode();\n var top, left;\n\n if (domElement && domElement.parentNode) {\n top = domElement.parentNode.scrollTop;\n left = domElement.parentNode.scrollLeft;\n }\n\n activeNode.focus(true);\n\n if (domElement && domElement.parentNode) {\n domElement.parentNode.scrollTop = top;\n domElement.parentNode.scrollLeft = left;\n }\n };\n\n gantt.attachEvent(\"onDataRender\", function () {\n if (!gantt.config.keyboard_navigation) return;\n reFocusActiveNode();\n });\n gantt.attachEvent(\"onGanttRender\", function () {\n gantt.eventRemove(gantt.$root, \"keydown\", keyDownHandler);\n gantt.eventRemove(gantt.$container, \"focus\", focusHandler);\n gantt.eventRemove(gantt.$container, \"mousedown\", mousedownHandler);\n\n if (gantt.config.keyboard_navigation) {\n gantt.event(gantt.$root, \"keydown\", keyDownHandler);\n gantt.event(gantt.$container, \"focus\", focusHandler);\n gantt.event(gantt.$container, \"mousedown\", mousedownHandler);\n gantt.$container.setAttribute(\"tabindex\", \"0\");\n } else {\n gantt.$container.removeAttribute(\"tabindex\");\n }\n });\n\n function getTaskNodeConstructor() {\n if (gantt.config.keyboard_navigation_cells) {\n return gantt.$keyboardNavigation.TaskCell;\n } else {\n return gantt.$keyboardNavigation.TaskRow;\n }\n }\n\n function isInlineEditorCell(e) {\n return !!domHelpers.closest(e.target, \".gantt_grid_editor_placeholder\");\n } // GS-1445. Cancel keyboard navigation within custom elements\n\n\n function isNoKeyboardNavigationElement(e) {\n return !!domHelpers.closest(e.target, \".no_keyboard_navigation\");\n }\n\n function isLightboxElement(e) {\n return !!domHelpers.closest(e.target, \".gantt_cal_light\");\n }\n\n function mousedownHandler(e) {\n if (!gantt.config.keyboard_navigation) return true; // GS-734 & GS-1078: we don't need keyboard navigation inside inline editors\n\n if (!gantt.config.keyboard_navigation_cells && isInlineEditorCell(e)) return true;\n\n if (isNoKeyboardNavigationElement(e)) {\n return;\n }\n\n var focusNode;\n var locateTask = dispatcher.fromDomElement(e);\n\n if (locateTask) {\n //var node = getTaskNodeConstructor();\n if (dispatcher.activeNode instanceof gantt.$keyboardNavigation.TaskCell && domHelpers.isChildOf(e.target, gantt.$task)) {\n locateTask = new gantt.$keyboardNavigation.TaskCell(locateTask.taskId, dispatcher.activeNode.columnIndex);\n }\n\n focusNode = locateTask;\n }\n\n if (focusNode) {\n if (!dispatcher.isEnabled()) {\n dispatcher.activeNode = focusNode;\n } else {\n dispatcher.delay(function () {\n dispatcher.setActiveNode(focusNode);\n });\n }\n } else {\n // empty click should drop focus from gantt, insert of reselecting default node\n dispatcher.$preventDefault = true;\n setTimeout(function () {\n dispatcher.$preventDefault = false;\n }, 300);\n }\n }\n\n var onReady = gantt.attachEvent(\"onGanttReady\", function () {\n // restore focus on repainted tasks\n gantt.detachEvent(onReady);\n gantt.$data.tasksStore.attachEvent(\"onStoreUpdated\", function (id) {\n if (gantt.config.keyboard_navigation && dispatcher.isEnabled()) {\n var currentNode = dispatcher.getActiveNode();\n\n if (currentNode && currentNode.taskId == id) {\n reFocusActiveNode();\n }\n }\n });\n\n if (gantt._smart_render) {\n var updateRender = gantt._smart_render._redrawTasks;\n\n gantt._smart_render._redrawTasks = function (renderers, items) {\n if (gantt.config.keyboard_navigation && dispatcher.isEnabled()) {\n var currentNode = dispatcher.getActiveNode();\n\n if (currentNode && currentNode.taskId !== undefined) {\n var focusedItemVisible = false;\n\n for (var i = 0; i < items.length; i++) {\n if (items[i].id == currentNode.taskId && items[i].start_date) {\n focusedItemVisible = true;\n break;\n }\n }\n\n if (!focusedItemVisible) {\n items.push(gantt.getTask(currentNode.taskId));\n }\n }\n }\n\n var res = updateRender.apply(this, arguments);\n return res;\n };\n }\n });\n var createdTaskId = null;\n var keepFocusOnNewTask = false;\n gantt.attachEvent(\"onTaskCreated\", function (task) {\n createdTaskId = task.id;\n return true;\n });\n gantt.attachEvent(\"onAfterTaskAdd\", function (id, item) {\n if (!gantt.config.keyboard_navigation) return true;\n\n if (dispatcher.isEnabled()) {\n // GS-1394. After adding a new task, the focus shouldn't change to the placeholder task\n if (id == createdTaskId) {\n keepFocusOnNewTask = true;\n setTimeout(function () {\n keepFocusOnNewTask = false;\n createdTaskId = null;\n });\n }\n\n if (keepFocusOnNewTask && item.type == gantt.config.types.placeholder) {\n return;\n }\n\n var columnIndex = 0;\n var node = dispatcher.activeNode;\n\n if (node instanceof gantt.$keyboardNavigation.TaskCell) {\n columnIndex = node.columnIndex;\n }\n\n var nodeConstructor = getTaskNodeConstructor();\n\n if (item.type == gantt.config.types.placeholder && gantt.config.placeholder_task.focusOnCreate === false) {// do not focus on the placeholder task\n } else {\n dispatcher.setActiveNode(new nodeConstructor(id, columnIndex));\n }\n }\n });\n gantt.attachEvent(\"onTaskIdChange\", function (oldId, newId) {\n if (!gantt.config.keyboard_navigation) return true;\n var node = dispatcher.activeNode;\n\n if (dispatcher.isTaskFocused(oldId)) {\n node.taskId = newId;\n }\n\n return true;\n });\n var interval = setInterval(function () {\n if (!gantt.config.keyboard_navigation) return;\n\n if (!dispatcher.isEnabled()) {\n dispatcher.enable();\n }\n\n return;\n }, 500);\n gantt.attachEvent(\"onDestroy\", function () {\n clearInterval(interval);\n });\n\n function getScopeName(obj) {\n if (obj instanceof gantt.$keyboardNavigation.GanttNode) {\n return \"gantt\";\n } else if (obj instanceof gantt.$keyboardNavigation.HeaderCell) {\n return \"headerCell\";\n } else if (obj instanceof gantt.$keyboardNavigation.TaskRow) {\n return \"taskRow\";\n } else if (obj instanceof gantt.$keyboardNavigation.TaskCell) {\n return \"taskCell\";\n }\n\n return null;\n }\n\n function getScope(mode) {\n var scopes = {\n \"gantt\": gantt.$keyboardNavigation.GanttNode,\n \"headerCell\": gantt.$keyboardNavigation.HeaderCell,\n \"taskRow\": gantt.$keyboardNavigation.TaskRow,\n \"taskCell\": gantt.$keyboardNavigation.TaskCell\n };\n return scopes[mode] || scopes.gantt;\n }\n\n function findVisibleColumnIndex(columnName) {\n var columns = gantt.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 var keyNavFacade = {};\n eventable(keyNavFacade);\n gantt.mixin(keyNavFacade, {\n addShortcut: function addShortcut(shortcut, handler, scope) {\n var scopeObject = getScope(scope);\n\n if (scopeObject) {\n scopeObject.prototype.bind(shortcut, handler);\n }\n },\n getShortcutHandler: function getShortcutHandler(shortcut, scope) {\n var commands = gantt.$keyboardNavigation.shortcuts.parse(shortcut);\n\n if (commands.length) {\n return keyNavFacade.getCommandHandler(commands[0], scope);\n }\n },\n getCommandHandler: function getCommandHandler(command, scope) {\n var scopeObject = getScope(scope);\n\n if (scopeObject) {\n if (command) {\n return scopeObject.prototype.findHandler(command);\n }\n }\n },\n removeShortcut: function removeShortcut(shortcut, scope) {\n var scopeObject = getScope(scope);\n\n if (scopeObject) {\n scopeObject.prototype.unbind(shortcut);\n }\n },\n focus: function focus(config) {\n var type = config ? config.type : null;\n var constructor = getScope(type);\n var node;\n\n switch (type) {\n case \"taskCell\":\n node = new constructor(config.id, findVisibleColumnIndex(config.column));\n break;\n\n case \"taskRow\":\n node = new constructor(config.id);\n break;\n\n case \"headerCell\":\n node = new constructor(findVisibleColumnIndex(config.column));\n break;\n\n default:\n break;\n }\n\n dispatcher.delay(function () {\n if (node) {\n dispatcher.setActiveNode(node);\n } else {\n dispatcher.enable();\n\n if (!dispatcher.getActiveNode()) {\n dispatcher.setDefaultNode();\n } else {\n if (!dispatcher.awaitsFocus()) {\n dispatcher.enable();\n }\n }\n }\n });\n },\n getActiveNode: function getActiveNode() {\n if (dispatcher.isEnabled()) {\n var node = dispatcher.getActiveNode();\n var scope = getScopeName(node);\n var columns = gantt.getGridColumns();\n\n switch (scope) {\n case \"taskCell\":\n return {\n type: \"taskCell\",\n id: node.taskId,\n column: columns[node.columnIndex].name\n };\n\n case \"taskRow\":\n return {\n type: \"taskRow\",\n id: node.taskId\n };\n\n case \"headerCell\":\n return {\n type: \"headerCell\",\n column: columns[node.index].name\n };\n }\n }\n\n return null;\n }\n });\n gantt.$keyboardNavigation.facade = keyNavFacade;\n gantt.ext.keyboardNavigation = keyNavFacade;\n\n gantt.focus = function () {\n keyNavFacade.focus();\n };\n\n gantt.addShortcut = keyNavFacade.addShortcut;\n gantt.getShortcutHandler = keyNavFacade.getShortcutHandler;\n gantt.removeShortcut = keyNavFacade.removeShortcut;\n })();\n }\n\n setupKeyNav(gantt);\n};","export default function(gantt: any){\r\n\r\ninterface IBody extends HTMLElement {\r\n\tmsRequestFullscreen?: () => void;\r\n\tmozRequestFullScreen?: () => void;\r\n\twebkitRequestFullscreen?: (ALLOW_KEYBOARD_INPUT: any) => void;\r\n}\r\n\r\n\r\ninterface IConsole extends Console {\r\n\twarning?: (str: string) => void;\r\n}\r\n\r\ninterface IDocument extends Document {\r\n\tfullscreenElement: Element;\r\n\tmozFullScreenElement?: Element;\r\n\twebkitFullscreenElement?: Element;\r\n\tmsFullscreenElement?: Element;\r\n\twebkitFullscreenEnabled?: boolean;\r\n\tmozFullScreenEnabled?: boolean;\r\n\tmsFullscreenEnabled?: boolean;\r\n\tmsExitFullscreen?: () => void;\r\n\tmozCancelFullScreen?: () => void;\r\n\twebkitExitFullscreen?: () => void;\r\n}\r\n\r\ninterface IElement extends Element {\r\n\tALLOW_KEYBOARD_INPUT?: boolean;\r\n}\r\n\r\ninterface IElementSizes extends ISizes {\r\n\tmodified: boolean;\r\n}\r\n\r\ninterface ISizes {\r\n\twidth: null | string;\r\n\theight: null | string;\r\n\ttop: null | string;\r\n\tleft: null | string;\r\n\tposition: null | string;\r\n\tzIndex: null | number;\r\n}\r\n\r\nfunction isExpanded() {\r\n\tconst element = ((document as IDocument).fullscreenElement ||\r\n\t\t(document as IDocument).mozFullScreenElement ||\r\n\t\t(document as IDocument).webkitFullscreenElement ||\r\n\t\t(document as IDocument).msFullscreenElement);\r\n\treturn !!(element && element === document.body);\r\n}\r\n\r\nfunction isFullscreenAvailable() {\r\n\ttry {\r\n\t\treturn (document as IDocument).fullscreenEnabled ||\r\n\t\t\t(document as IDocument).webkitFullscreenEnabled ||\r\n\t\t\t(document as IDocument).mozFullScreenEnabled ||\r\n\t\t\t(document as IDocument).msFullscreenEnabled;\r\n\t} catch (e) {\r\n\t\tconsole.error(\"Fullscreen is not available:\", e); // tslint:disable-line:no-console\r\n\t}\r\n}\r\n\r\nconst state = gantt.$services.getService(\"state\");\r\nstate.registerProvider(\"fullscreen\", () => {\r\n\tif (isFullscreenAvailable()){\r\n\t\treturn { fullscreen: isExpanded() };\r\n\t} else {\r\n\t\treturn undefined;\r\n\t}\r\n});\r\n\r\nlet backupBodyPadding = {\r\n\toverflow: null,\r\n\tpadding: null,\r\n\tpaddingTop: null,\r\n\tpaddingRight: null,\r\n\tpaddingBottom: null,\r\n\tpaddingLeft: null\r\n};\r\n\r\nconst backupElementSizes: IElementSizes = {\r\n\twidth: null,\r\n\theight: null,\r\n\ttop: null,\r\n\tleft: null,\r\n\tposition: null,\r\n\tzIndex: null,\r\n\tmodified: false\r\n};\r\n\r\nlet backupPositioning = null;\r\nfunction resetParentPositioning(root){\r\n\tlet parent = root.parentNode;\r\n\tconst positions = [];\r\n\twhile(parent && parent.style){\r\n\t\tpositions.push({\r\n\t\t\telement: parent,\r\n\t\t\toriginalPositioning: parent.style.position\r\n\t\t});\r\n\t\tparent.style.position = \"static\";\r\n\t\tparent = parent.parentNode;\r\n\t}\r\n\treturn positions;\r\n}\r\n\r\nfunction restoreParentPositioning(positions: any[]){\r\n\tpositions.forEach(record => {\r\n\t\trecord.element.style.position = record.originalPositioning;\r\n\t});\r\n}\r\n\r\n// expand gantt root element to fullscreen automatically\r\nfunction setFullScreenSizes() {\r\n\tconst root = gantt.ext.fullscreen.getFullscreenElement();\r\n\tconst body = document.body;\r\n\tupdateSizes(root.style, backupElementSizes);\r\n\tbackupBodyPadding = {\r\n\t\toverflow: body.style.overflow,\r\n\t\tpadding: body.style.padding ? body.style.padding : null,\r\n\t\tpaddingTop: body.style.paddingTop ? body.style.paddingTop : null,\r\n\t\tpaddingRight: body.style.paddingRight ? body.style.paddingRight : null,\r\n\t\tpaddingBottom: body.style.paddingBottom ? body.style.paddingBottom : null,\r\n\t\tpaddingLeft: body.style.paddingLeft ? body.style.paddingLeft : null\r\n\t};\r\n\r\n\tif (body.style.padding) {\r\n\t\tbody.style.padding = \"0\";\r\n\t}\r\n\tif (body.style.paddingTop) {\r\n\t\tbody.style.paddingTop = \"0\";\r\n\t}\r\n\tif (body.style.paddingRight) {\r\n\t\tbody.style.paddingRight = \"0\";\r\n\t}\r\n\tif (body.style.paddingBottom) {\r\n\t\tbody.style.paddingBottom = \"0\";\r\n\t}\r\n\tif (body.style.paddingLeft) {\r\n\t\tbody.style.paddingLeft = \"0\";\r\n\t}\r\n\r\n\tbody.style.overflow = \"hidden\";\r\n\r\n\troot.style.width = \"100vw\";\r\n\troot.style.height = \"100vh\";\r\n\troot.style.top = \"0px\";\r\n\troot.style.left = \"0px\";\r\n\troot.style.position = \"absolute\";\r\n\troot.style.zIndex = 1;\r\n\tbackupElementSizes.modified = true;\r\n\tbackupPositioning = resetParentPositioning(root);\r\n}\r\n\r\nfunction restoreSizes() {\r\n\tconst root = gantt.ext.fullscreen.getFullscreenElement();\r\n\tconst body = document.body;\r\n\tif (backupElementSizes.modified) {\r\n\t\tif (backupBodyPadding.padding) {\r\n\t\t\tbody.style.padding = backupBodyPadding.padding;\r\n\t\t}\r\n\t\tif (backupBodyPadding.paddingTop) {\r\n\t\t\tbody.style.paddingTop = backupBodyPadding.paddingTop;\r\n\t\t}\r\n\t\tif (backupBodyPadding.paddingRight) {\r\n\t\t\tbody.style.paddingRight = backupBodyPadding.paddingRight;\r\n\t\t}\r\n\t\tif (backupBodyPadding.paddingBottom) {\r\n\t\t\tbody.style.paddingBottom = backupBodyPadding.paddingBottom;\r\n\t\t}\r\n\t\tif (backupBodyPadding.paddingLeft) {\r\n\t\t\tbody.style.paddingLeft = backupBodyPadding.paddingLeft;\r\n\t\t}\r\n\r\n\t\tbody.style.overflow = backupBodyPadding.overflow;\r\n\t\tbackupBodyPadding = {\r\n\t\t\toverflow: null,\r\n\t\t\tpadding: null,\r\n\t\t\tpaddingTop: null,\r\n\t\t\tpaddingRight: null,\r\n\t\t\tpaddingBottom: null,\r\n\t\t\tpaddingLeft: null\r\n\t\t};\r\n\t\tupdateSizes(backupElementSizes, root.style);\r\n\t\tbackupElementSizes.modified = false;\r\n\t}\r\n\trestoreParentPositioning(backupPositioning);\r\n\tbackupPositioning = null;\r\n}\r\n\r\nfunction updateSizes(source: ISizes, target: ISizes) {\r\n\ttarget.width = source.width;\r\n\ttarget.height = source.height;\r\n\ttarget.top = source.top;\r\n\ttarget.left = source.left;\r\n\ttarget.position = source.position;\r\n\ttarget.zIndex = source.zIndex;\r\n}\r\n\r\nfunction addDOMEvents() {\r\n\tgantt.event(document, \"webkitfullscreenchange\", onFullScreenChange);\r\n\tgantt.event(document, \"mozfullscreenchange\", onFullScreenChange);\r\n\tgantt.event(document, \"MSFullscreenChange\", onFullScreenChange);\r\n\t// For IE on Win 10\r\n\tgantt.event(document, \"fullscreenChange\", onFullScreenChange);\r\n\tgantt.event(document, \"fullscreenchange\", onFullScreenChange);\r\n}\r\n\r\nlet expandGantt = false;\r\nfunction onFullScreenChange() {\r\n\tif (!gantt.$container) {\r\n\t\t// do nothing if gantt is not yet initialized\r\n\t\treturn;\r\n\t}\r\n\tlet event: \"onExpand\" | \"onCollapse\";\r\n\tconst isBodyExpanded = isExpanded();\r\n\r\n\tif (isBodyExpanded) {\r\n\t\tif (expandGantt) {\r\n\t\t\tevent = \"onExpand\";\r\n\t\t\tsetFullScreenSizes();\r\n\t\t}\r\n\t} else if (expandGantt) {\r\n\t\texpandGantt = false;\r\n\t\tevent = \"onCollapse\";\r\n\t\trestoreSizes();\r\n\t}\r\n\tsetTimeout(() => {\r\n\t\tgantt.render();\r\n\t});\r\n\tsetTimeout(() => {\r\n\t\tgantt.callEvent(event, [gantt.ext.fullscreen.getFullscreenElement()]);\r\n\t});\r\n}\r\n\r\nfunction cantFullscreen() {\r\n\tif (!gantt.$container) { // check is gantt initialized or not\r\n\t\treturn true;\r\n\t}\r\n\tif (!gantt.ext.fullscreen.getFullscreenElement()) {\r\n\t\treturn true;\r\n\t}\r\n\tif (!isFullscreenAvailable()) {\r\n\t\t// tslint:disable-next-line: no-console\r\n\t\tconst method = (console as IConsole).warning || console.log;\r\n\t\tmethod(\"The `fullscreen` feature not being allowed, or full-screen mode not being supported\");\r\n\t\treturn true;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\ngantt.ext.fullscreen = {\r\n\texpand(): void {\r\n\t\tif (cantFullscreen()) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (isExpanded()) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (!gantt.callEvent(\"onBeforeExpand\", [this.getFullscreenElement()])) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\texpandGantt = true;\r\n\r\n\t\t// we switch body to fullscreen and then expand fullscreen element to viewport\r\n\t\t// we do it to correct display common elements: lightboxes, tooltip etc.\r\n\t\tconst element = document.body as IBody;\r\n\t\tconst requestArguments = element.webkitRequestFullscreen ?\r\n\t\t\t[(Element as unknown as IElement).ALLOW_KEYBOARD_INPUT] : [];\r\n\r\n\t\tconst requestFullscreen = element.msRequestFullscreen ||\r\n\t\t\telement.mozRequestFullScreen ||\r\n\t\t\telement.webkitRequestFullscreen ||\r\n\t\t\telement.requestFullscreen;\r\n\r\n\t\tif (requestFullscreen) {\r\n\t\t\trequestFullscreen.apply(element, requestArguments);\r\n\t\t}\r\n\t},\r\n\tcollapse(): void {\r\n\t\tif (cantFullscreen()) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (!isExpanded()) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (!gantt.callEvent(\"onBeforeCollapse\", [this.getFullscreenElement()])) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst requestExitFullscreen = (document as IDocument).msExitFullscreen ||\r\n\t\t\t(document as IDocument).mozCancelFullScreen ||\r\n\t\t\t(document as IDocument).webkitExitFullscreen ||\r\n\t\t\t(document as IDocument).exitFullscreen;\r\n\r\n\t\tif (requestExitFullscreen) {\r\n\t\t\trequestExitFullscreen.apply(document);\r\n\t\t}\r\n\t},\r\n\ttoggle(): void {\r\n\t\tif (cantFullscreen()) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (!isExpanded()) {\r\n\t\t\tthis.expand();\r\n\t\t} else {\r\n\t\t\tthis.collapse();\r\n\t\t}\r\n\r\n\t},\r\n\tgetFullscreenElement(): HTMLElement {\r\n\t\treturn gantt.$root;\r\n\t},\r\n};\r\n\r\ngantt.expand = function() {\r\n\tgantt.ext.fullscreen.expand();\r\n};\r\n\r\ngantt.collapse = function(){\r\n\tgantt.ext.fullscreen.collapse();\r\n};\r\n\r\ngantt.attachEvent(\"onGanttReady\", addDOMEvents);\r\n\r\n}","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n'use strict';\n\nfunction _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 stringifyPrimitive = function stringifyPrimitive(v) {\n switch (_typeof(v)) {\n case 'string':\n return v;\n\n case 'boolean':\n return v ? 'true' : 'false';\n\n case 'number':\n return isFinite(v) ? v : '';\n\n default:\n return '';\n }\n};\n\nmodule.exports = function (obj, sep, eq, name) {\n sep = sep || '&';\n eq = eq || '=';\n\n if (obj === null) {\n obj = undefined;\n }\n\n if (_typeof(obj) === 'object') {\n return map(objectKeys(obj), function (k) {\n var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n\n if (isArray(obj[k])) {\n return map(obj[k], function (v) {\n return ks + encodeURIComponent(stringifyPrimitive(v));\n }).join(sep);\n } else {\n return ks + encodeURIComponent(stringifyPrimitive(obj[k]));\n }\n }).join(sep);\n }\n\n if (!name) return '';\n return encodeURIComponent(stringifyPrimitive(name)) + eq + encodeURIComponent(stringifyPrimitive(obj));\n};\n\nvar isArray = Array.isArray || function (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]';\n};\n\nfunction map(xs, f) {\n if (xs.map) return xs.map(f);\n var res = [];\n\n for (var i = 0; i < xs.length; i++) {\n res.push(f(xs[i], i));\n }\n\n return res;\n}\n\nvar objectKeys = Object.keys || function (obj) {\n var res = [];\n\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);\n }\n\n return res;\n};","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n'use strict'; // If obj.hasOwnProperty has been overridden, then calling\n// obj.hasOwnProperty(prop) will break.\n// See: https://github.com/joyent/node/issues/1707\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nmodule.exports = function (qs, sep, eq, options) {\n sep = sep || '&';\n eq = eq || '=';\n var obj = {};\n\n if (typeof qs !== 'string' || qs.length === 0) {\n return obj;\n }\n\n var regexp = /\\+/g;\n qs = qs.split(sep);\n var maxKeys = 1000;\n\n if (options && typeof options.maxKeys === 'number') {\n maxKeys = options.maxKeys;\n }\n\n var len = qs.length; // maxKeys <= 0 means that we should not limit keys count\n\n if (maxKeys > 0 && len > maxKeys) {\n len = maxKeys;\n }\n\n for (var i = 0; i < len; ++i) {\n var x = qs[i].replace(regexp, '%20'),\n idx = x.indexOf(eq),\n kstr,\n vstr,\n k,\n v;\n\n if (idx >= 0) {\n kstr = x.substr(0, idx);\n vstr = x.substr(idx + 1);\n } else {\n kstr = x;\n vstr = '';\n }\n\n k = decodeURIComponent(kstr);\n v = decodeURIComponent(vstr);\n\n if (!hasOwnProperty(obj, k)) {\n obj[k] = v;\n } else if (isArray(obj[k])) {\n obj[k].push(v);\n } else {\n obj[k] = [obj[k], v];\n }\n }\n\n return obj;\n};\n\nvar isArray = Array.isArray || function (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]';\n};","'use strict';\n\nexports.decode = exports.parse = require('./decode');\nexports.encode = exports.stringify = require('./encode');","'use strict';\n\nfunction _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 isString: function isString(arg) {\n return typeof arg === 'string';\n },\n isObject: function isObject(arg) {\n return _typeof(arg) === 'object' && arg !== null;\n },\n isNull: function isNull(arg) {\n return arg === null;\n },\n isNullOrUndefined: function isNullOrUndefined(arg) {\n return arg == null;\n }\n};","module.exports = function (module) {\n if (!module.webpackPolyfill) {\n module.deprecate = function () {};\n\n module.paths = []; // module.parent = undefined by default\n\n if (!module.children) module.children = [];\n Object.defineProperty(module, \"loaded\", {\n enumerable: true,\n get: function get() {\n return module.l;\n }\n });\n Object.defineProperty(module, \"id\", {\n enumerable: true,\n get: function get() {\n return module.i;\n }\n });\n module.webpackPolyfill = 1;\n }\n\n return module;\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\n/*! https://mths.be/punycode v1.4.1 by @mathias */\n;\n\n(function (root) {\n /** Detect free variables */\n var freeExports = (typeof exports === \"undefined\" ? \"undefined\" : _typeof(exports)) == 'object' && exports && !exports.nodeType && exports;\n var freeModule = (typeof module === \"undefined\" ? \"undefined\" : _typeof(module)) == 'object' && module && !module.nodeType && module;\n var freeGlobal = (typeof global === \"undefined\" ? \"undefined\" : _typeof(global)) == 'object' && global;\n\n if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal) {\n root = freeGlobal;\n }\n /**\n * The `punycode` object.\n * @name punycode\n * @type Object\n */\n\n\n var punycode,\n\n /** Highest positive signed 32-bit float value */\n maxInt = 2147483647,\n // aka. 0x7FFFFFFF or 2^31-1\n\n /** Bootstring parameters */\n base = 36,\n tMin = 1,\n tMax = 26,\n skew = 38,\n damp = 700,\n initialBias = 72,\n initialN = 128,\n // 0x80\n delimiter = '-',\n // '\\x2D'\n\n /** Regular expressions */\n regexPunycode = /^xn--/,\n regexNonASCII = /[^\\x20-\\x7E]/,\n // unprintable ASCII chars + non-ASCII chars\n regexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g,\n // RFC 3490 separators\n\n /** Error messages */\n errors = {\n 'overflow': 'Overflow: input needs wider integers to process',\n 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n 'invalid-input': 'Invalid input'\n },\n\n /** Convenience shortcuts */\n baseMinusTMin = base - tMin,\n floor = Math.floor,\n stringFromCharCode = String.fromCharCode,\n\n /** Temporary variable */\n key;\n /*--------------------------------------------------------------------------*/\n\n /**\n * A generic error utility function.\n * @private\n * @param {String} type The error type.\n * @returns {Error} Throws a `RangeError` with the applicable error message.\n */\n\n function error(type) {\n throw new RangeError(errors[type]);\n }\n /**\n * A generic `Array#map` utility function.\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} callback The function that gets called for every array\n * item.\n * @returns {Array} A new array of values returned by the callback function.\n */\n\n\n function map(array, fn) {\n var length = array.length;\n var result = [];\n\n while (length--) {\n result[length] = fn(array[length]);\n }\n\n return result;\n }\n /**\n * A simple `Array#map`-like wrapper to work with domain name strings or email\n * addresses.\n * @private\n * @param {String} domain The domain name or email address.\n * @param {Function} callback The function that gets called for every\n * character.\n * @returns {Array} A new string of characters returned by the callback\n * function.\n */\n\n\n function mapDomain(string, fn) {\n var parts = string.split('@');\n var result = '';\n\n if (parts.length > 1) {\n // In email addresses, only the domain name should be punycoded. Leave\n // the local part (i.e. everything up to `@`) intact.\n result = parts[0] + '@';\n string = parts[1];\n } // Avoid `split(regex)` for IE8 compatibility. See #17.\n\n\n string = string.replace(regexSeparators, '\\x2E');\n var labels = string.split('.');\n var encoded = map(labels, fn).join('.');\n return result + encoded;\n }\n /**\n * Creates an array containing the numeric code points of each Unicode\n * character in the string. While JavaScript uses UCS-2 internally,\n * this function will convert a pair of surrogate halves (each of which\n * UCS-2 exposes as separate characters) into a single code point,\n * matching UTF-16.\n * @see `punycode.ucs2.encode`\n * @see \n * @memberOf punycode.ucs2\n * @name decode\n * @param {String} string The Unicode input string (UCS-2).\n * @returns {Array} The new array of code points.\n */\n\n\n function ucs2decode(string) {\n var output = [],\n counter = 0,\n length = string.length,\n value,\n extra;\n\n while (counter < length) {\n value = string.charCodeAt(counter++);\n\n if (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n // high surrogate, and there is a next character\n extra = string.charCodeAt(counter++);\n\n if ((extra & 0xFC00) == 0xDC00) {\n // low surrogate\n output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n } else {\n // unmatched surrogate; only append this code unit, in case the next\n // code unit is the high surrogate of a surrogate pair\n output.push(value);\n counter--;\n }\n } else {\n output.push(value);\n }\n }\n\n return output;\n }\n /**\n * Creates a string based on an array of numeric code points.\n * @see `punycode.ucs2.decode`\n * @memberOf punycode.ucs2\n * @name encode\n * @param {Array} codePoints The array of numeric code points.\n * @returns {String} The new Unicode string (UCS-2).\n */\n\n\n function ucs2encode(array) {\n return map(array, function (value) {\n var output = '';\n\n if (value > 0xFFFF) {\n value -= 0x10000;\n output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n value = 0xDC00 | value & 0x3FF;\n }\n\n output += stringFromCharCode(value);\n return output;\n }).join('');\n }\n /**\n * Converts a basic code point into a digit/integer.\n * @see `digitToBasic()`\n * @private\n * @param {Number} codePoint The basic numeric code point value.\n * @returns {Number} The numeric value of a basic code point (for use in\n * representing integers) in the range `0` to `base - 1`, or `base` if\n * the code point does not represent a value.\n */\n\n\n function basicToDigit(codePoint) {\n if (codePoint - 48 < 10) {\n return codePoint - 22;\n }\n\n if (codePoint - 65 < 26) {\n return codePoint - 65;\n }\n\n if (codePoint - 97 < 26) {\n return codePoint - 97;\n }\n\n return base;\n }\n /**\n * Converts a digit/integer into a basic code point.\n * @see `basicToDigit()`\n * @private\n * @param {Number} digit The numeric value of a basic code point.\n * @returns {Number} The basic code point whose value (when used for\n * representing integers) is `digit`, which needs to be in the range\n * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n * used; else, the lowercase form is used. The behavior is undefined\n * if `flag` is non-zero and `digit` has no uppercase form.\n */\n\n\n function digitToBasic(digit, flag) {\n // 0..25 map to ASCII a..z or A..Z\n // 26..35 map to ASCII 0..9\n return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n }\n /**\n * Bias adaptation function as per section 3.4 of RFC 3492.\n * https://tools.ietf.org/html/rfc3492#section-3.4\n * @private\n */\n\n\n function adapt(delta, numPoints, firstTime) {\n var k = 0;\n delta = firstTime ? floor(delta / damp) : delta >> 1;\n delta += floor(delta / numPoints);\n\n for (;\n /* no initialization */\n delta > baseMinusTMin * tMax >> 1; k += base) {\n delta = floor(delta / baseMinusTMin);\n }\n\n return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n }\n /**\n * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n * symbols.\n * @memberOf punycode\n * @param {String} input The Punycode string of ASCII-only symbols.\n * @returns {String} The resulting string of Unicode symbols.\n */\n\n\n function decode(input) {\n // Don't use UCS-2\n var output = [],\n inputLength = input.length,\n out,\n i = 0,\n n = initialN,\n bias = initialBias,\n basic,\n j,\n index,\n oldi,\n w,\n k,\n digit,\n t,\n\n /** Cached calculation results */\n baseMinusT; // Handle the basic code points: let `basic` be the number of input code\n // points before the last delimiter, or `0` if there is none, then copy\n // the first basic code points to the output.\n\n basic = input.lastIndexOf(delimiter);\n\n if (basic < 0) {\n basic = 0;\n }\n\n for (j = 0; j < basic; ++j) {\n // if it's not a basic code point\n if (input.charCodeAt(j) >= 0x80) {\n error('not-basic');\n }\n\n output.push(input.charCodeAt(j));\n } // Main decoding loop: start just after the last delimiter if any basic code\n // points were copied; start at the beginning otherwise.\n\n\n for (index = basic > 0 ? basic + 1 : 0; index < inputLength;)\n /* no final expression */\n {\n // `index` is the index of the next character to be consumed.\n // Decode a generalized variable-length integer into `delta`,\n // which gets added to `i`. The overflow checking is easier\n // if we increase `i` as we go, then subtract off its starting\n // value at the end to obtain `delta`.\n for (oldi = i, w = 1, k = base;;\n /* no condition */\n k += base) {\n if (index >= inputLength) {\n error('invalid-input');\n }\n\n digit = basicToDigit(input.charCodeAt(index++));\n\n if (digit >= base || digit > floor((maxInt - i) / w)) {\n error('overflow');\n }\n\n i += digit * w;\n t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;\n\n if (digit < t) {\n break;\n }\n\n baseMinusT = base - t;\n\n if (w > floor(maxInt / baseMinusT)) {\n error('overflow');\n }\n\n w *= baseMinusT;\n }\n\n out = output.length + 1;\n bias = adapt(i - oldi, out, oldi == 0); // `i` was supposed to wrap around from `out` to `0`,\n // incrementing `n` each time, so we'll fix that now:\n\n if (floor(i / out) > maxInt - n) {\n error('overflow');\n }\n\n n += floor(i / out);\n i %= out; // Insert `n` at position `i` of the output\n\n output.splice(i++, 0, n);\n }\n\n return ucs2encode(output);\n }\n /**\n * Converts a string of Unicode symbols (e.g. a domain name label) to a\n * Punycode string of ASCII-only symbols.\n * @memberOf punycode\n * @param {String} input The string of Unicode symbols.\n * @returns {String} The resulting Punycode string of ASCII-only symbols.\n */\n\n\n function encode(input) {\n var n,\n delta,\n handledCPCount,\n basicLength,\n bias,\n j,\n m,\n q,\n k,\n t,\n currentValue,\n output = [],\n\n /** `inputLength` will hold the number of code points in `input`. */\n inputLength,\n\n /** Cached calculation results */\n handledCPCountPlusOne,\n baseMinusT,\n qMinusT; // Convert the input in UCS-2 to Unicode\n\n input = ucs2decode(input); // Cache the length\n\n inputLength = input.length; // Initialize the state\n\n n = initialN;\n delta = 0;\n bias = initialBias; // Handle the basic code points\n\n for (j = 0; j < inputLength; ++j) {\n currentValue = input[j];\n\n if (currentValue < 0x80) {\n output.push(stringFromCharCode(currentValue));\n }\n }\n\n handledCPCount = basicLength = output.length; // `handledCPCount` is the number of code points that have been handled;\n // `basicLength` is the number of basic code points.\n // Finish the basic string - if it is not empty - with a delimiter\n\n if (basicLength) {\n output.push(delimiter);\n } // Main encoding loop:\n\n\n while (handledCPCount < inputLength) {\n // All non-basic code points < n have been handled already. Find the next\n // larger one:\n for (m = maxInt, j = 0; j < inputLength; ++j) {\n currentValue = input[j];\n\n if (currentValue >= n && currentValue < m) {\n m = currentValue;\n }\n } // Increase `delta` enough to advance the decoder's state to ,\n // but guard against overflow\n\n\n handledCPCountPlusOne = handledCPCount + 1;\n\n if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n error('overflow');\n }\n\n delta += (m - n) * handledCPCountPlusOne;\n n = m;\n\n for (j = 0; j < inputLength; ++j) {\n currentValue = input[j];\n\n if (currentValue < n && ++delta > maxInt) {\n error('overflow');\n }\n\n if (currentValue == n) {\n // Represent delta as a generalized variable-length integer\n for (q = delta, k = base;;\n /* no condition */\n k += base) {\n t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;\n\n if (q < t) {\n break;\n }\n\n qMinusT = q - t;\n baseMinusT = base - t;\n output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));\n q = floor(qMinusT / baseMinusT);\n }\n\n output.push(stringFromCharCode(digitToBasic(q, 0)));\n bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n delta = 0;\n ++handledCPCount;\n }\n }\n\n ++delta;\n ++n;\n }\n\n return output.join('');\n }\n /**\n * Converts a Punycode string representing a domain name or an email address\n * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n * it doesn't matter if you call it on a string that has already been\n * converted to Unicode.\n * @memberOf punycode\n * @param {String} input The Punycoded domain name or email address to\n * convert to Unicode.\n * @returns {String} The Unicode representation of the given Punycode\n * string.\n */\n\n\n function toUnicode(input) {\n return mapDomain(input, function (string) {\n return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;\n });\n }\n /**\n * Converts a Unicode string representing a domain name or an email address to\n * Punycode. Only the non-ASCII parts of the domain name will be converted,\n * i.e. it doesn't matter if you call it with a domain that's already in\n * ASCII.\n * @memberOf punycode\n * @param {String} input The domain name or email address to convert, as a\n * Unicode string.\n * @returns {String} The Punycode representation of the given domain name or\n * email address.\n */\n\n\n function toASCII(input) {\n return mapDomain(input, function (string) {\n return regexNonASCII.test(string) ? 'xn--' + encode(string) : string;\n });\n }\n /*--------------------------------------------------------------------------*/\n\n /** Define the public API */\n\n\n punycode = {\n /**\n * A string representing the current Punycode.js version number.\n * @memberOf punycode\n * @type String\n */\n 'version': '1.4.1',\n\n /**\n * An object of methods to convert from JavaScript's internal character\n * representation (UCS-2) to Unicode code points, and back.\n * @see \n * @memberOf punycode\n * @type Object\n */\n 'ucs2': {\n 'decode': ucs2decode,\n 'encode': ucs2encode\n },\n 'decode': decode,\n 'encode': encode,\n 'toASCII': toASCII,\n 'toUnicode': toUnicode\n };\n /** Expose `punycode` */\n // Some AMD build optimizers, like r.js, check for specific condition patterns\n // like the following:\n\n if (typeof define == 'function' && _typeof(define.amd) == 'object' && define.amd) {\n define('punycode', function () {\n return punycode;\n });\n } else if (freeExports && freeModule) {\n if (module.exports == freeExports) {\n // in Node.js, io.js, or RingoJS v0.8.0+\n freeModule.exports = punycode;\n } else {\n // in Narwhal or RingoJS v0.7.0-\n for (key in punycode) {\n punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);\n }\n }\n } else {\n // in Rhino or a web browser\n root.punycode = punycode;\n }\n})(this);","module.exports = {\n \"100\": \"Continue\",\n \"101\": \"Switching Protocols\",\n \"102\": \"Processing\",\n \"200\": \"OK\",\n \"201\": \"Created\",\n \"202\": \"Accepted\",\n \"203\": \"Non-Authoritative Information\",\n \"204\": \"No Content\",\n \"205\": \"Reset Content\",\n \"206\": \"Partial Content\",\n \"207\": \"Multi-Status\",\n \"208\": \"Already Reported\",\n \"226\": \"IM Used\",\n \"300\": \"Multiple Choices\",\n \"301\": \"Moved Permanently\",\n \"302\": \"Found\",\n \"303\": \"See Other\",\n \"304\": \"Not Modified\",\n \"305\": \"Use Proxy\",\n \"307\": \"Temporary Redirect\",\n \"308\": \"Permanent Redirect\",\n \"400\": \"Bad Request\",\n \"401\": \"Unauthorized\",\n \"402\": \"Payment Required\",\n \"403\": \"Forbidden\",\n \"404\": \"Not Found\",\n \"405\": \"Method Not Allowed\",\n \"406\": \"Not Acceptable\",\n \"407\": \"Proxy Authentication Required\",\n \"408\": \"Request Timeout\",\n \"409\": \"Conflict\",\n \"410\": \"Gone\",\n \"411\": \"Length Required\",\n \"412\": \"Precondition Failed\",\n \"413\": \"Payload Too Large\",\n \"414\": \"URI Too Long\",\n \"415\": \"Unsupported Media Type\",\n \"416\": \"Range Not Satisfiable\",\n \"417\": \"Expectation Failed\",\n \"418\": \"I'm a teapot\",\n \"421\": \"Misdirected Request\",\n \"422\": \"Unprocessable Entity\",\n \"423\": \"Locked\",\n \"424\": \"Failed Dependency\",\n \"425\": \"Unordered Collection\",\n \"426\": \"Upgrade Required\",\n \"428\": \"Precondition Required\",\n \"429\": \"Too Many Requests\",\n \"431\": \"Request Header Fields Too Large\",\n \"451\": \"Unavailable For Legal Reasons\",\n \"500\": \"Internal Server Error\",\n \"501\": \"Not Implemented\",\n \"502\": \"Bad Gateway\",\n \"503\": \"Service Unavailable\",\n \"504\": \"Gateway Timeout\",\n \"505\": \"HTTP Version Not Supported\",\n \"506\": \"Variant Also Negotiates\",\n \"507\": \"Insufficient Storage\",\n \"508\": \"Loop Detected\",\n \"509\": \"Bandwidth Limit Exceeded\",\n \"510\": \"Not Extended\",\n \"511\": \"Network Authentication Required\"\n};","module.exports = extend;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nfunction extend() {\n var target = {};\n\n for (var i = 0; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n}","var Buffer = require('buffer').Buffer;\n\nmodule.exports = function (buf) {\n // If the buffer is backed by a Uint8Array, a faster version will work\n if (buf instanceof Uint8Array) {\n // If the buffer isn't a subarray, return the underlying ArrayBuffer\n if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {\n return buf.buffer;\n } else if (typeof buf.buffer.slice === 'function') {\n // Otherwise we need to get a proper copy\n return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);\n }\n }\n\n if (Buffer.isBuffer(buf)) {\n // This is the slow version that will work with any Buffer\n // implementation (even in old browsers)\n var arrayCopy = new Uint8Array(buf.length);\n var len = buf.length;\n\n for (var i = 0; i < len; i++) {\n arrayCopy[i] = buf[i];\n }\n\n return arrayCopy.buffer;\n } else {\n throw new Error('Argument must be a Buffer');\n }\n};","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n'use strict';\n\nmodule.exports = PassThrough;\n\nvar Transform = require('./_stream_transform');\n/**/\n\n\nvar util = require('core-util-is');\n\nutil.inherits = require('inherits');\n/**/\n\nutil.inherits(PassThrough, Transform);\n\nfunction PassThrough(options) {\n if (!(this instanceof PassThrough)) return new PassThrough(options);\n Transform.call(this, options);\n}\n\nPassThrough.prototype._transform = function (chunk, encoding, cb) {\n cb(null, chunk);\n};","/**\n * Module exports.\n */\nmodule.exports = deprecate;\n/**\n * Mark that a method should not be used.\n * Returns a modified function which warns once by default.\n *\n * If `localStorage.noDeprecation = true` is set, then it is a no-op.\n *\n * If `localStorage.throwDeprecation = true` is set, then deprecated functions\n * will throw an Error when invoked.\n *\n * If `localStorage.traceDeprecation = true` is set, then deprecated functions\n * will invoke `console.trace()` instead of `console.error()`.\n *\n * @param {Function} fn - the function to deprecate\n * @param {String} msg - the string to print to the console when `fn` is invoked\n * @returns {Function} a new \"deprecated\" version of `fn`\n * @api public\n */\n\nfunction deprecate(fn, msg) {\n if (config('noDeprecation')) {\n return fn;\n }\n\n var warned = false;\n\n function deprecated() {\n if (!warned) {\n if (config('throwDeprecation')) {\n throw new Error(msg);\n } else if (config('traceDeprecation')) {\n console.trace(msg);\n } else {\n console.warn(msg);\n }\n\n warned = true;\n }\n\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n}\n/**\n * Checks `localStorage` for boolean values for the given `name`.\n *\n * @param {String} name\n * @returns {Boolean}\n * @api private\n */\n\n\nfunction config(name) {\n // accessing global.localStorage can trigger a DOMException in sandboxed iframes\n try {\n if (!global.localStorage) return false;\n } catch (_) {\n return false;\n }\n\n var val = global.localStorage[name];\n if (null == val) return false;\n return String(val).toLowerCase() === 'true';\n}","(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