UNPKG

react-gantt-chart

Version:
15 lines (13 loc) 62.3 kB
import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import o,{memo as n,useRef as a,useEffect as i,useState as l,useMemo as s}from"react"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */var d=function(){return d=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},d.apply(this,arguments)};function c(e,t,r,o){return new(r||(r=Promise))((function(n,a){function i(e){try{s(o.next(e))}catch(e){a(e)}}function l(e){try{s(o.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,l)}s((o=o.apply(e,t||[])).next())}))}function u(e,t){var r,o,n,a,i={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,o&&(n=2&a[0]?o.return:a[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,a[1])).done)return n;switch(o=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(n=i.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){i.label=a[1];break}if(6===a[0]&&i.label<n[1]){i.label=n[1],n=a;break}if(n&&i.label<n[2]){i.label=n[2],i.ops.push(a);break}n[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{r=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var g={rootStyle:{fill:"green",stroke:"green"}},h=function(r){var o=r.taskFromIndex,n=r.taskFromX1,a=r.taskFromX2,i=r.taskFromY,l=r.taskToIndex,s=r.taskToX1,c=r.taskToX2,u=r.taskToY,g=r.rowHeight,h=r.taskHeight,f=r.arrowIndent,v=r.rtl,y=r.rootStyle,p=!0===v?function(e){var t=e.taskFromIndex,r=e.taskFromX1,o=e.taskFromY,n=e.taskToIndex,a=e.taskToX2,i=e.taskToY,l=e.rowHeight,s=e.taskHeight,d=e.arrowIndent,c=t>n?-1:1,u=i+s/2,g=r-2*d,h=g>a?"":"H ".concat(a+d),f=g<a?-d:a-r+d;return["M ".concat(r," ").concat(o+s/2," \n h ").concat(-d," \n v ").concat(c*l/2," \n ").concat(h,"\n V ").concat(u," \n h ").concat(f),"".concat(a,",").concat(u," \n ").concat(a+5,",").concat(u+5," \n ").concat(a+5,",").concat(u-5)]}({taskFromIndex:o,taskFromX1:n,taskFromY:i,taskToIndex:l,taskToX2:c,taskToY:u,rowHeight:g,taskHeight:h,arrowIndent:f}):function(e){var t=e.taskFromIndex,r=e.taskFromX2,o=e.taskFromY,n=e.taskToIndex,a=e.taskToX1,i=e.taskToY,l=e.rowHeight,s=e.taskHeight,d=e.arrowIndent,c=t>n?-1:1,u=i+s/2,g=r+2*d,h=g<a?"":"H ".concat(a-d),f=g>a?d:a-r-d;return["M ".concat(r," ").concat(o+s/2," \n h ").concat(d," \n v ").concat(c*l/2," \n ").concat(h,"\n V ").concat(u," \n h ").concat(f),"".concat(a,",").concat(u," \n ").concat(a-5,",").concat(u-5," \n ").concat(a-5,",").concat(u+5)]}({taskFromIndex:o,taskFromX2:a,taskFromY:i,taskToIndex:l,taskToX1:s,taskToY:u,rowHeight:g,taskHeight:h,arrowIndent:f}),S=p[0],m=p[1];return e("g",d({style:y},{children:[t("path",{strokeWidth:"1.5",d:S,fill:"none"},void 0),t("polygon",{points:m},void 0)]}),void 0)};h.defaultProps=g;var f=n(h),v={rootStyle:{overflow:"auto",maxWidth:"100%"},bodyStyle:{height:1}},y=function(e){var r=e.scroll,o=e.onScroll,n=e.rootStyle,l=e.bodyStyle,s=a(null);return i((function(){s.current&&(s.current.scrollLeft=r)}),[r]),t("div",d({style:n,dir:"ltr",ref:s,onScroll:o},{children:t("div",{style:l},void 0)}),void 0)};y.defaultProps=v;var p={multiBarRowMode:!1,rootStyle:{position:"absolute",display:"flex",flexShrink:0,pointerEvents:"none",userSelect:"none"}},S=function(e){var r=e.task,o=e.rtl,n=e.children,s=e.arrowIndent,c=e.scrollX,u=e.scrollY,g=e.svgContainerHeight,h=e.svgContainerWidth,f=e.headerHeight,v=e.rowHeight,y=e.taskListWidth,p=e.multiBarRowMode,S=e.rootStyle,m=l(0),x=m[0],k=m[1],b=l(0),C=b[0],w=b[1],T=a(null),D=0!==C&&0!==x;return i((function(){if(T.current){var e=1.1*T.current.offsetHeight,t=1.1*T.current.offsetWidth,n=(!0===p&&void 0!==r.line?r.line:r.index)*v-u+f,a=void 0;if(o)(a=r.x1-1.5*s-t-c)<0&&(a=r.x2+1.5*s-c),t+a>h&&(a=h-t,n+=v);else t+(a=r.x2+1.5*s+y-c)>y+h&&(a=r.x1+y-1.5*s-c-t),a<y&&(a=h+y-t,n+=v);e+n-u>g-u&&(n=g-e),k(n),w(a)}}),[r,s,c,u,f,y,v,g,h,o,p]),t("div",d({ref:T,style:d(d({},S),{left:C,top:x,visibility:D?"visible":"hidden"})},{children:n}),void 0)};S.defaultProps=p;var m={rootStyle:{overflow:"hidden auto",width:"17px",flexShrink:0},bodyStyle:{width:1}},x=function(e){var r=e.scroll,o=e.onScroll,n=e.rootStyle,l=e.bodyStyle,s=a(null);return i((function(){s.current&&(s.current.scrollTop=r)}),[r]),t("div",d({style:n,onScroll:o,ref:s},{children:t("div",{style:l},void 0)}),void 0)};x.defaultProps=m;var k=Object.freeze({__proto__:null,Arrow:f,arrowDefaultProps:g,HorizontalScroll:y,horizontalScrollDefaultProps:v,Tooltip:S,tooltipDefaultProps:p,VerticalScroll:x,verticalScrollDefaultProps:m}),b={rootStyle:{cursor:"pointer",outline:"none"},barDisplay:t(r,{},void 0),leftBarDateHandle:t(r,{},void 0),rightBarDateHandle:t(r,{},void 0),barProgressHandle:t(r,{},void 0),onMouseEnter:function(){return null},onMouseLeave:function(){return null}},C=function(t){var r=t.isDateChangeable,o=t.isProgressChangeable,n=t.rootStyle,a=t.barDisplay,i=t.leftBarDateHandle,l=t.rightBarDateHandle,s=t.barProgressHandle,c=t.onMouseEnter,u=t.onMouseLeave;return e("g",d({style:n,tabIndex:0,onMouseEnter:c,onMouseLeave:u},{children:[a,e("g",{children:[!0===r&&e("g",{children:[i,l]},void 0),!0===o&&s]},void 0)]}),void 0)};C.defaultProps=b;var w=function(e,t){void 0===t&&(t=T);var r=e.tasks,o=e.dates,n=o[1].getTime()-o[0].getTime()-60*o[1].getTimezoneOffset()*1e3+60*o[0].getTimezoneOffset()*1e3,a=r.map((function(r,o){return t(d(d({},e),{task:r,taskIndex:o,dateDelta:n}))}));return a=a.map((function(e){for(var t=e.dependencies||[],r=function(r){var o=a.findIndex((function(e){return e.id===t[r]}));-1!==o&&a[o].barChildren.push(e)},o=0;o<t.length;o++)r(o);return e}))},T=function(e){return{task:P(d({},e)),milestone:W(d({},e)),project:H(d({},e))}[e.task.type]},D=function(e){return{task:P(d({},e)),milestone:P(d({},e)),project:H(d({},e))}[e.task.type]},P=function(e){var t,r,o=e.task,n=e.taskIndex,a=e.dates,i=e.dateDelta,l=e.rtl,s=e.multiBarRowMode,c=e.columnWidth,u=e.rowHeight,g=e.taskHeight,h=e.barCornerRadius,f=e.handleWidth,v=e.barProgressColor,y=e.barProgressSelectedColor,p=e.barBackgroundColor,S=e.barBackgroundSelectedColor;l?(r=M(o.start,a,i,c),t=M(o.end,a,i,c)):(t=B(o.start,a,i,c),r=B(o.end,a,i,c));var m=o.type;"task"===m&&r-t<2*f&&(m="smalltask",r=t+2*f);var x=F(t,r,o.progress,l),k=x[0],b=x[1],C=!0===s&&void 0!==o.line?o.line:n,w=L(C,u,g),T="project"===o.type?o.hideChildren:void 0,D=d({backgroundColor:p,backgroundSelectedColor:S,progressColor:v,progressSelectedColor:y},o.styles);return d(d({},o),{typeInternal:m,x1:t,x2:r,y:w,index:n,progressX:b,progressWidth:k,barCornerRadius:h,handleWidth:f,hideChildren:T,height:g,barChildren:[],styles:D})},H=function(e){var t,r,o=e.task,n=e.taskIndex,a=e.dates,i=e.dateDelta,l=e.rtl,s=e.multiBarRowMode,c=e.columnWidth,u=e.rowHeight,g=e.taskHeight,h=e.barCornerRadius,f=e.handleWidth,v=e.projectProgressColor,y=e.projectProgressSelectedColor,p=e.projectBackgroundColor,S=e.projectBackgroundSelectedColor;l?(r=M(o.start,a,i,c),t=M(o.end,a,i,c)):(t=B(o.start,a,i,c),r=B(o.end,a,i,c));var m=o.type;"task"===m&&r-t<2*f&&(m="smalltask",r=t+2*f);var x=F(t,r,o.progress,l),k=x[0],b=x[1],C=!0===s&&void 0!==o.line?o.line:n,w=L(C,u,g),T="project"===o.type?o.hideChildren:void 0,D=d({backgroundColor:p,backgroundSelectedColor:S,progressColor:v,progressSelectedColor:y},o.styles);return d(d({},o),{typeInternal:m,x1:t,x2:r,y:w,index:n,progressX:b,progressWidth:k,barCornerRadius:h,handleWidth:f,hideChildren:T,height:g,barChildren:[],styles:D})},W=function(e){var t=e.task,r=e.taskIndex,o=e.dates,n=e.dateDelta,a=e.multiBarRowMode,i=e.columnWidth,l=e.rowHeight,s=e.taskHeight,c=e.barCornerRadius,u=e.handleWidth,g=e.milestoneBackgroundColor,h=e.milestoneBackgroundSelectedColor,f=B(t.start,o,n,i),v=!0===a&&void 0!==t.line?t.line:r,y=L(v,l,s),p=f-.5*s,S=f+.5*s,m=s/1.414,x=d({backgroundColor:g,backgroundSelectedColor:h,progressColor:"",progressSelectedColor:""},t.styles);return d(d({},t),{end:t.start,x1:p,x2:S,y:y,index:r,progressX:0,progressWidth:0,barCornerRadius:c,handleWidth:u,typeInternal:t.type,progress:0,height:m,hideChildren:void 0,barChildren:[],styles:x})},B=function(e,t,r,o){var n=~~((e.getTime()-t[0].getTime()+e.getTimezoneOffset()-t[0].getTimezoneOffset())/r);return Math.round((n+(e.getTime()-t[n].getTime()-60*e.getTimezoneOffset()*1e3+60*t[n].getTimezoneOffset()*1e3)/r)*o)},M=function(e,t,r,o){var n=B(e,t,r,o);return n+=o},L=function(e,t,r){return e*t+(t-r)/2},F=function(e,t,r,o){var n=(t-e)*r*.01;return[n,o?t-n:e]},R=function(e,t){var r=t.x2-t.x1,o=Math.round(100*e/r);return o>=100?100:o<=0?0:o},E=function(e,t,r){return[e-5,t+r,e+5,t+r,e,t+r-8.66].join(",")},I=function(e,t,r){var o=Math.round((e-r.x1)/t)*t,n=r.x1+o;return[n,n+r.x2-r.x1]},j=function(e,t,r,o,n){var a=new Date((e-t)/o*n+r.getTime());return a=new Date(a.getTime()+6e4*(a.getTimezoneOffset()-r.getTimezoneOffset()))},z=function(e,t,r,o,n,a,i){var l;if("milestone"===r.type)l=X(e,t,r,o,n,a);else l=O(e,t,r,o,n,a,i);return l},O=function(e,t,r,o,n,a,i){var l=d({},r),s=!1;switch(t){case"progress":if(l.progress=i?function(e,t){if(e>=t.x2)return 0;if(e<=t.x1)return 100;var r=t.x2-t.x1;return Math.round(100*(t.x2-e)/r)}(e,r):function(e,t){if(e>=t.x2)return 100;if(e<=t.x1)return 0;var r=t.x2-t.x1;return Math.round(100*(e-t.x1)/r)}(e,r),s=l.progress!==r.progress){var c=F(l.x1,l.x2,l.progress,i),u=c[0],g=c[1];l.progressWidth=u,l.progressX=g}break;case"start":var h=function(e,t,r){e>=r.x2-2*r.handleWidth&&(e=r.x2-2*r.handleWidth);var o=Math.round((e-r.x1)/t)*t;return r.x1+o}(e,o,r);if(l.x1=h,s=l.x1!==r.x1){i?l.end=j(h,r.x1,r.end,o,n):l.start=j(h,r.x1,r.start,o,n);var f=F(l.x1,l.x2,l.progress,i);u=f[0],g=f[1];l.progressWidth=u,l.progressX=g}break;case"end":var v=function(e,t,r){e<=r.x1+2*r.handleWidth&&(e=r.x1+2*r.handleWidth);var o=Math.round((e-r.x2)/t)*t;return r.x2+o}(e,o,r);if(l.x2=v,s=l.x2!==r.x2){i?l.start=j(v,r.x2,r.start,o,n):l.end=j(v,r.x2,r.end,o,n);var y=F(l.x1,l.x2,l.progress,i);u=y[0],g=y[1];l.progressWidth=u,l.progressX=g}break;case"move":var p=I(e-a,o,r),S=p[0],m=p[1];if(s=S!==r.x1){l.start=j(S,r.x1,r.start,o,n),l.end=j(m,r.x2,r.end,o,n),l.x1=S,l.x2=m;var x=F(l.x1,l.x2,l.progress,i);u=x[0],g=x[1];l.progressWidth=u,l.progressX=g}}return{isChanged:s,changedTask:l}},X=function(e,t,r,o,n,a){var i=d({},r),l=!1;if("move"===t){var s=I(e-a,o,r),c=s[0],u=s[1];(l=c!==r.x1)&&(i.start=j(c,r.x1,r.start,o,n),i.end=i.start,i.x1=c,i.x2=u)}return{isChanged:l,changedTask:i}},_=Object.freeze({__proto__:null,convertToBarTasks:w,convertToBarTask:T,convertToBarTaskNR:D,convertToBar:P,convertToProject:H,convertToMilestone:W,progressWithByParams:F,progressByProgressWidth:R,getProgressPoint:E,handleTaskBySVGMouseEvent:z}),Y={x:0,y:0,rootStyle:{height:"50px"},barStyle:{height:"50px",width:"200px",userSelect:"none",strokeWidth:0,fill:"#B8C2CC"},progressStyle:{height:"50px",fill:"#A3A3FF"},progressX:50,progressWidth:100,barCornerRadius:5,onMouseDown:function(e){return console.log("BarDisplay click")}},A=function(r){var o=r.x,n=r.y,a=r.progressX,i=r.progressWidth,l=r.barCornerRadius,s=r.onMouseDown,c=r.rootStyle,u=r.barStyle,g=r.progressStyle;return e("g",d({style:c,onMouseDown:s},{children:[t("rect",{style:u,x:o,y:n,rx:l,ry:l},void 0),t("rect",{style:g,x:a,y:n,width:i,rx:l,ry:l},void 0)]}),void 0)};A.defaultProps=Y;var N={progressPoint:"15,10,25,10,20,0",onMouseDown:function(e){return console.log(e)},rootStyle:{fill:"#ddd",cursor:"ew-resize"}},G=function(e){var r=e.progressPoint,o=e.onMouseDown,n=e.rootStyle;return t("polygon",{style:n,points:r,onMouseDown:o},void 0)};G.defaultProps=N;var V={rootStyle:{cursor:"pointer",outline:"none"}},K=function(r){var o=r.rootStyle,n=r.task,a=r.isDateChangeable,i=r.isProgressChangeable,s=r.onEventStart,c=l(!1),u=c[0],g=c[1],h=E(n.progressWidth+n.x1,n.y,n.height);return e("g",d({style:o,tabIndex:0,onMouseEnter:function(){return g((function(){return!0}))},onMouseLeave:function(){return g((function(){return!1}))}},{children:[t(A,{x:n.x1,y:n.y,progressX:n.progressX,progressWidth:n.progressWidth,barCornerRadius:n.barCornerRadius,onMouseDown:function(e){!0===a&&s("move",n,e)},rootStyle:d(d({},Y),{height:n.height})},void 0),t("g",{children:!0===i&&t(G,{progressPoint:h,onMouseDown:function(e){s("progress",n,e)},rootStyle:{fill:"#ddd",cursor:"ew-resize",opacity:u?1:0,visibility:u?"visible":"hidden"}},void 0)},void 0)]}),void 0)};K.defaultProps=V;var Q={rootStyle:{cursor:"pointer",outline:"none"},backgroundStyle:{userSelect:"none"}},U=function(e){var r=e.task,o=e.isDateChangeable,n=e.isSelected,a=e.onEventStart,i=e.rootStyle,l=e.backgroundStyle,s="rotate(45 ".concat(r.x1+.356*r.height," \n ").concat(r.y+.85*r.height,")");return t("svg",{children:t("g",d({tabIndex:0,style:i},{children:t("rect",{style:l,fill:n?r.styles.backgroundSelectedColor:r.styles.backgroundColor,x:r.x1,width:r.height,y:r.y,height:r.height,rx:r.barCornerRadius,ry:r.barCornerRadius,transform:s,onMouseDown:function(e){o&&a("move",r,e)}},void 0)}),void 0)},void 0)};U.defaultProps=Q;var Z={rootStyle:{cursor:"pointer",outline:"none"},backgroundStyle:{userSelect:"none",opacity:.6,fill:"orange"},progressStyle:{fill:"green"}},J=function(r){var o=r.task,n=r.rootStyle,a=r.backgroundStyle,i=r.progressStyle;return t("svg",{children:e("g",d({tabIndex:0,style:n},{children:[t("rect",{style:a,x:o.x1,y:o.y,height:o.height,width:o.x2-o.x1,rx:o.barCornerRadius,ry:o.barCornerRadius},void 0),t("rect",{style:i,x:o.progressX,y:o.y,height:o.height,width:o.progressWidth,rx:o.barCornerRadius,ry:o.barCornerRadius},void 0)]}),void 0)},void 0)};J.defaultProps=Z;var q={x:0,y:0,width:10,height:30,barCornerRadius:5,onMouseDown:function(e){return console.log(e)},rootStyle:{fill:"#ddd",cursor:"ew-resize"}},$=function(e){var r=e.x,o=e.y,n=e.width,a=e.height,i=e.barCornerRadius,l=e.onMouseDown,s=e.rootStyle;return t("rect",{style:s,x:r,y:o,width:n,height:a,ry:i,rx:i,onMouseDown:l},void 0)};$.defaultProps=q;var ee,te=function(e){var r=e.task,o=e.rtl,n=e.isDateChangeable,a=e.isProgressChangeable,i=e.onEventStart,s=l(!1),c=s[0],u=s[1],g=t(A,{x:r.x1,y:r.y,progressX:r.progressX,progressWidth:r.progressWidth,barCornerRadius:r.barCornerRadius,onMouseDown:function(e){!0===n&&i("move",r,e)},rootStyle:d(d({},Y.rootStyle),{height:r.height}),barStyle:d(d({},Y.barStyle),{height:r.height,width:r.x2-r.x1}),progressStyle:d(d({},Y.progressStyle),{height:r.height})},void 0),h=t($,{x:r.x1+1,y:r.y+1,width:r.handleWidth,height:r.height-2,barCornerRadius:r.barCornerRadius,onMouseDown:function(e){return i("start",r,e)},rootStyle:{fill:"#ddd",cursor:"ew-resize",opacity:c?1:0,visibility:c?"visible":"hidden"}},void 0),f=t($,{x:r.x2-r.handleWidth-1,y:r.y+1,height:r.height-2,width:r.handleWidth,barCornerRadius:r.barCornerRadius,onMouseDown:function(e){return i("end",r,e)},rootStyle:{fill:"#ddd",cursor:"ew-resize",opacity:c?1:0,visibility:c?"visible":"hidden"}},void 0),v=E(+!o*r.progressWidth+r.progressX,r.y,r.height),y=t(G,{progressPoint:v,onMouseDown:function(e){return i("progress",r,e)},rootStyle:{fill:"#ddd",cursor:"ew-resize",opacity:c?1:0,visibility:c?"visible":"hidden"}},void 0);return t("svg",d({style:{overflow:"visible"}},{children:t(C,{rtl:o,isDateChangeable:n,isProgressChangeable:a,barDisplay:g,leftBarDateHandle:h,rightBarDateHandle:f,barProgressHandle:y,onMouseEnter:function(){return u((function(){return!0}))},onMouseLeave:function(){return u((function(){return!1}))}},void 0)}),void 0)},re=function(e){var r=e.task,o=e.rtl,n=e.isDateChangeable,a=e.isProgressChangeable,i=t(A,{x:r.x1,y:r.y,progressX:r.progressX,progressWidth:r.progressWidth,barCornerRadius:5,onMouseDown:function(e){console.log("BarDisplay (move): onMouseDown is not implemented")},rootStyle:d(d({},Y.rootStyle),{height:"".concat(48,"px")}),barStyle:d(d({},Y.barStyle),{height:"".concat(48,"px"),width:"".concat(r.x2-r.x1,"px"),fill:"#E0E3E7",stroke:"green",strokeWidth:"1px"}),progressStyle:d(d({},Y.progressStyle),{height:"".concat(48,"px"),fill:"transparent"})},void 0),l=t($,{x:r.x1+8+1,y:r.y+24-5,height:r.handleWidth,width:r.handleWidth,barCornerRadius:5,onMouseDown:function(e){console.log("BarDateHandle (start): onMouseDown is not implemented")},rootStyle:{fill:"#A9ADB2",stroke:"white",strokeWidth:"".concat(1,"px"),opacity:1,visibility:"visible"}},void 0),s=t($,{x:r.x2-r.handleWidth-8-1,y:r.y+24-5,height:r.handleWidth,width:r.handleWidth,barCornerRadius:5,onMouseDown:function(e){console.log("BarDateHandle (end): onMouseDown is not implemented")},rootStyle:{fill:"#A9ADB2",stroke:"white",strokeWidth:"".concat(1,"px"),opacity:1,visibility:"visible"}},void 0);return t("svg",d({style:{overflow:"visible"}},{children:t(C,{rtl:o,isDateChangeable:n,isProgressChangeable:a,barDisplay:i,leftBarDateHandle:l,rightBarDateHandle:s},void 0)}),void 0)};!function(e){e.QuarterDay="Quarter Day",e.HalfDay="Half Day",e.Day="Day",e.Week="Week",e.Month="Month"}(ee||(ee={}));var oe=Object.freeze({__proto__:null,get ViewMode(){return ee}}),ne={rootStyle:{stroke:"#e6e4e4"},lineStyle:{textAnchor:"middle",fill:"#555",userSelect:"none",pointerEvents:"none"},textStyle:{strokeWidth:.2,stroke:"#e6e4e4"}},ae=function(r){var o=r.value,n=r.x1Line,a=r.xText,i=r.y1Line,l=r.y2Line,s=r.yText,c=r.rootStyle,u=r.lineStyle,g=r.textStyle;return e("g",d({style:c},{children:[t("line",{style:u,x1:n,y1:i,x2:n,y2:l},o+"line"),t("text",d({style:g,y:s,x:a},{children:o}),o+"text")]}),void 0)};ae.defaultProps=ne;var ie={},le=function(e,t){void 0===t&&(t={});var r=JSON.stringify([e,t]),o=ie[r];return o||(o=new Intl.DateTimeFormat(e,t),ie[r]=o),o},se=function(e,t,r){return new Date(e.getFullYear()+("year"===r?t:0),e.getMonth()+("month"===r?t:0),e.getDate()+("day"===r?t:0),e.getHours()+("hour"===r?t:0),e.getMinutes()+("minute"===r?t:0),e.getSeconds()+("second"===r?t:0),e.getMilliseconds()+("millisecond"===r?t:0))},de=function(e,t){var r=["millisecond","second","minute","hour","day","month","year"],o=function(e){var o=r.indexOf(t);return r.indexOf(e)<=o};return new Date(e.getFullYear(),o("year")?0:e.getMonth(),o("month")?1:e.getDate(),o("day")?0:e.getHours(),o("hour")?0:e.getMinutes(),o("minute")?0:e.getSeconds(),o("second")?0:e.getMilliseconds())},ce=function(e,t){for(var r=e[0].start,o=e[0].start,n=0,a=e;n<a.length;n++){var i=a[n];i.start<r&&(r=i.start),i.end>o&&(o=i.end)}switch(t){case ee.Month:r=se(r,-1,"month"),r=de(r,"month"),o=se(o,1,"year"),o=de(o,"year");break;case ee.Week:r=de(r,"day"),o=de(o,"day"),r=se(he(r),-7,"day"),o=se(o,1.5,"month");break;case ee.Day:r=de(r,"day"),o=de(o,"day"),r=se(r,-1,"day"),o=se(o,19,"day");break;case ee.QuarterDay:r=de(r,"day"),o=de(o,"day"),r=se(r,-1,"day"),o=se(o,66,"hour");break;case ee.HalfDay:r=de(r,"day"),o=de(o,"day"),r=se(r,-1,"day"),o=se(o,108,"hour")}return[r,o]},ue=function(e,t,r){for(var o=new Date(e),n=[o];o<t;){switch(r){case ee.Month:o=se(o,1,"month");break;case ee.Week:o=se(o,7,"day");break;case ee.Day:o=se(o,1,"day");break;case ee.HalfDay:o=se(o,12,"hour");break;case ee.QuarterDay:o=se(o,6,"hour")}n.push(o)}return n},ge=function(e,t){var r=le(t,{month:"long"}).format(e);return r=r.replace(r[0],r[0].toLocaleUpperCase())},he=function(e){var t=e.getDay(),r=e.getDate()-t+(0===t?-6:1);return new Date(e.setDate(r))},fe=function(e){var t=new Date(e.valueOf()),r=(t.getDay()+6)%7;t.setDate(t.getDate()-r+3);var o=t.valueOf();t.setMonth(0,1),4!==t.getDay()&&t.setMonth(0,1+(4-t.getDay()+7)%7);var n=(1+Math.ceil((o-t.valueOf())/6048e5)).toString();return 1===n.length?"0".concat(n):n},ve=function(e,t){return new Date(t,e+1,0).getDate()},ye=Object.freeze({__proto__:null,getCachedDateTimeFormat:le,addToDate:se,startOfDate:de,ganttDateRange:ce,seedDates:ue,getLocaleMonth:ge,getWeekNumberISO8601:fe,getDaysInMonth:ve}),pe={rootStyle:{},headerStyle:{fill:"#ffffff",stroke:"#e0e0e0",strokeWidth:1.4},bottomTextStyle:{textAnchor:"middle",fill:"#333",userSelect:"none",pointerEvents:"none"},calenderHeaderRootStyle:ne.rootStyle,calenderHeaderLineStyle:ne.lineStyle,calenderHeaderTextStyle:ne.textStyle},Se=function(r){var o,n,a,i,l=r.columnWidth,s=r.dateSetup,c=r.headerHeight,u=r.locale,g=r.rtl,h=r.rootStyle,f=r.headerStyle,v=r.bottomTextStyle,y=r.calenderHeaderRootStyle,p=r.calenderHeaderLineStyle,S=r.calenderHeaderTextStyle,m=[],x=[];switch(s.viewMode){case ee.Month:o=function(){for(var e=[],r=[],o=.5*c,n=0;n<s.dates.length;n++){var a=s.dates[n],i=ge(a,u);if(r.push(t("text",d({style:v,y:.8*c,x:l*n+.5*l},{children:i}),i+a.getFullYear())),0===n||a.getFullYear()!==s.dates[n-1].getFullYear()){var h=a.getFullYear().toString(),f=void 0;f=g?(6+n+a.getMonth()+1)*l:(6+n-a.getMonth())*l,e.push(t(ae,{value:h,x1Line:l*n,y1Line:0,y2Line:c,xText:f,yText:.9*o,rootStyle:y,lineStyle:p,textStyle:S},h))}}return[e,r]}(),m=o[0],x=o[1];break;case ee.Week:n=function(){for(var e=[],r=[],o=1,n=.5*c,a=s.dates,i=a.length-1;i>=0;i--){var h=a[i],f="";0!==i&&h.getMonth()===a[i-1].getMonth()||(f="".concat(ge(h,u),", ").concat(h.getFullYear()));var m="W".concat(fe(h));r.push(t("text",d({style:v,y:.8*c,x:l*(i+ +g)},{children:m}),h.getTime())),f&&(i!==a.length-1&&e.push(t(ae,{value:f,x1Line:l*i+o*l,y1Line:0,y2Line:c,xText:l*i+l*o*.5,yText:.9*n,rootStyle:y,lineStyle:p,textStyle:S},f)),o=0),o++}return[e,r]}(),m=n[0],x=n[1];break;case ee.Day:a=function(){for(var e=[],r=[],o=.5*c,n=s.dates,a=0;a<n.length;a++){var i=n[a],g=i.getDate().toString();if(r.push(t("text",d({style:v,y:.8*c,x:l*a+.5*l},{children:g}),i.getTime())),a+1!==n.length&&i.getMonth()!==n[a+1].getMonth()){var h=ge(i,u);e.push(t(ae,{value:h,x1Line:l*(a+1),y1Line:0,y2Line:c,xText:l*(a+1)-ve(i.getMonth(),i.getFullYear())*l*.5,yText:.9*o,rootStyle:y,lineStyle:p,textStyle:S},h+i.getFullYear()))}}return[e,r]}(),m=a[0],x=a[1];break;default:i=function(){for(var e=[],r=[],o=s.viewMode===ee.HalfDay?2:4,n=.5*c,a=s.dates,i=0;i<a.length;i++){var h=a[i],f=le(u,{hour:"numeric"}).format(h);if(r.push(t("text",d({style:v,y:.8*c,x:l*(i+ +g)},{children:f}),h.getTime())),0===i||h.getDate()!==a[i-1].getDate()){var m="".concat(h.getDate()," ").concat(ge(h,u));e.push(t(ae,{value:m,x1Line:l*i+o*l,y1Line:0,y2Line:c,xText:l*i+o*l*.5,yText:.9*n,rootStyle:y,lineStyle:p,textStyle:S},m+h.getFullYear()))}}return[e,r]}(),m=i[0],x=i[1]}return t("svg",d({style:{overflow:"visible"}},{children:e("g",d({style:h},{children:[t("rect",{style:f,x:0,y:0,width:l*s.dates.length,height:c},void 0),m,x]}),void 0)}),void 0)};Se.defaultProps=pe;var me=function(r){for(var o=r.tasks,n=r.dates,a=r.rtl,i=r.rowHeight,l=r.columnWidth,s=r.svgWidth,c=r.todayColor,u=r.gridRowStyle,g=r.gridRowLineStyle,h=r.gridTickStyle,f=new Date,v=0,y=0,p=[],S=[t("line",{style:g,x:"0",y1:0,x2:s,y2:0},"RowLineFirst")],m=0,x=o;m<x.length;m++){var k=x[m];p.push(t("rect",{style:u,x:"0",y:v,width:s,height:i},"Row"+k.id)),S.push(t("line",{style:g,x:"0",y1:v+i,x2:s,y2:v+i},"RowLine"+k.id)),v+=i}for(var b=[],C=t("rect",{},void 0),w=0;w<n.length;w++){var T=n[w];b.push(t("line",{style:h,x1:y,y1:0,x2:y,y2:v},T.getTime())),(w+1!==n.length&&T.getTime()<f.getTime()&&n[w+1].getTime()>=f.getTime()||0!==w&&w+1===n.length&&T.getTime()<f.getTime()&&se(T,T.getTime()-n[w-1].getTime(),"millisecond").getTime()>=f.getTime())&&(C=t("rect",{x:y,y:0,width:l,height:v,fill:c},void 0)),a&&w+1!==n.length&&T.getTime()>=f.getTime()&&n[w+1].getTime()<f.getTime()&&(C=t("rect",{x:y+l,y:0,width:l,height:v,fill:c},void 0)),y+=l}return t("svg",d({style:{overflow:"visible"}},{children:e("g",{children:[t("g",{children:p},void 0),t("g",{children:S},void 0),t("g",{children:b},void 0),t("g",{children:C},void 0)]},void 0)}),void 0)};me.defaultProps={gridRowStyle:{fill:"#fff"},gridRowLineStyle:{stroke:"#ebeff2"},gridTickStyle:{stroke:"#e6e4e4"}};var xe={taskItemTextStyle:{fill:"#1B2026",textAnchor:"middle",fontWeight:"lighter",dominantBaseline:"central",userSelect:"none",pointerEvents:"none"},taskItemTextOutsideStyle:{fill:"#1B2026",textAnchor:"start",userSelect:"none",pointerEvents:"none"}},ke=function(r){var o,n,s=r.task,c=r.arrowIndent,u=r.isDelete,g=r.taskHeight,h=r.isSelected,f=r.rtl,v=r.onEventStart,y=r.taskItemTextStyle,p=r.taskItemTextOutsideStyle,S=l(t("div",{},void 0)),m=S[0],x=S[1],k=l(!0),b=k[0],C=k[1],w=a(null);return i((function(){switch(s.typeInternal){case"milestone":default:x((function(){return t(re,{task:r.task,rtl:r.rtl,isDateChangeable:r.isDateChangeable,isProgressChangeable:r.isProgressChangeable,onEventStart:r.onEventStart},void 0)}));break;case"project":x(t(J,{task:r.task,backgroundStyle:d(d({},Z.backgroundStyle),{fill:s.styles.backgroundColor,opacity:.1}),progressStyle:d(d({},Z.progressStyle),{fill:s.styles.progressSelectedColor})},void 0));break;case"smalltask":x(t(K,d({},r),void 0))}}),[s,h]),i((function(){w.current&&C(w.current.getBBox().width<s.x2-s.x1)}),[w,s]),t("svg",{children:e("g",d({onKeyDown:function(e){return function(e){"Delete"===e.key&&u&&v("delete",s,e);e.stopPropagation()}(e)},onMouseEnter:function(e){v("mouseenter",s,e)},onMouseLeave:function(e){v("mouseleave",s,e)},onDoubleClick:function(e){v("dblclick",s,e)},onFocus:function(){v("select",s)}},{children:[m,t("text",d({style:b?y:p,x:(o=s.x2-s.x1,n=s.barChildren.length>0,b?s.x1+.5*o:f&&w.current?s.x1-w.current.getBBox().width-c*+n-.2*c:s.x1+o+c*+n+.2*c),y:s.y+.5*g,ref:w},{children:s.name}),void 0)]}),void 0)},void 0)};ke.defaultProps=xe;var be={taskItemTextStyle:{fill:"#fff",textAnchor:"middle",fontWeight:"lighter",dominantBaseline:"central",userSelect:"none",pointerEvents:"none"},taskItemTextOutsideStyle:{fill:"#555",textAnchor:"start",userSelect:"none",pointerEvents:"none"}},Ce=function(r){var o,n,s=r.task,c=r.rtl,u=r.isDateChangeable,g=r.isProgressChangeable,h=r.isDelete,f=r.isSelected,v=r.taskHeight,y=r.arrowIndent,p=r.onEventStart,S=r.taskItemTextStyle,m=r.taskItemTextOutsideStyle,x=l(t("div",{},void 0)),k=x[0],b=x[1],C=l(!0),w=C[0],T=C[1],D=a(null);return i((function(){switch(s.typeInternal){case"milestone":b(t(U,d({},r),void 0));break;case"project":b(t(J,{task:s,backgroundStyle:d(d({},Z.backgroundStyle),{fill:s.styles.backgroundColor,opacity:1}),progressStyle:d(d({},Z.progressStyle),{fill:s.styles.progressSelectedColor})},void 0));break;case"smalltask":b(t(K,d({},r),void 0));break;default:b((function(){return t(te,{task:s,rtl:c,isDateChangeable:u,isProgressChangeable:g,onEventStart:p},void 0)}))}}),[s,f]),i((function(){D.current&&T(D.current.getBBox().width<s.x2-s.x1)}),[D,s]),t("svg",{children:e("g",d({onKeyDown:function(e){if("Delete"===e.key)h&&p("delete",s,e);e.stopPropagation()},onMouseEnter:function(e){p("mouseenter",s,e)},onMouseLeave:function(e){p("mouseleave",s,e)},onDoubleClick:function(e){p("dblclick",s,e)},onFocus:function(){p("select",s)}},{children:[k,t("text",d({style:w?S:m,x:(o=s.x2-s.x1,n=s.barChildren.length>0,w?s.x1+.5*o:c&&D.current?s.x1-D.current.getBBox().width-y*+n-.2*y:s.x1+o+y*+n+.2*y),y:s.y+.5*v,ref:D},{children:s.name}),void 0)]}),void 0)},void 0)};Ce.defaultProps=be;var we=function(r){var o=r.scrollY,n=r.TaskListHeader,l=r.TaskListTable,s=r.taskListHeaderProps,c=r.taskListTableProps,u=r.taskListTableWrapperStyles,g=r.taskListRef,h=a(null);return i((function(){h.current&&(h.current.scrollTop=o)}),[o]),e("div",d({ref:g},{children:[t(n,d({},s),void 0),t("div",d({style:u,ref:h},{children:t(l,d({},c),void 0)}),void 0)]}),void 0)},Te={columns:["Name","From","To"],rootStyle:{display:"table",borderBottom:"#e6e4e4 1px solid",borderTop:"#e6e4e4 1px solid",borderLeft:"#e6e4e4 1px solid"},headerStyle:{display:"table-row",listStyle:"none"},columnStyle:{display:"table-cell",verticalAlign:"middle"},columnSeparatorStyle:{borderRight:"1px solid rgb(196, 196, 196)",opacity:1,marginLeft:"-2px"}},De=function(r){var n=r.columns,a=r.rootStyle,i=r.headerStyle,l=r.columnStyle,s=r.columnSeparatorStyle,c=[];return n.forEach((function(r,a){var i=e(o.Fragment,{children:[t("div",d({style:l},{children:r}),void 0),a!==n.length-1&&t("div",{style:s},void 0)]},a);c.push(i)})),t("div",d({style:a},{children:t("div",d({style:i},{children:c}),void 0)}),void 0)};De.defaultProps=Te;var Pe={},He={weekday:"short",year:"numeric",month:"long",day:"numeric"},We={expanderSymbolOpen:"▼",expanderSymbolClose:"▶",expanderSymbolEmpty:"",showStartDateColumn:!0,showEndDateColumn:!0,rootStyle:{display:"table",borderBottom:"#e6e4e4 1px solid",borderLeft:"#e6e4e4 1px solid"},tableRowStyle:{display:"table-row",textOverflow:"ellipsis"},tableRowStyleProject:{},tableCellStyle:{display:"table-cell",verticalAlign:"middle",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},tableCellStyleProject:{},tableCellStyleTask:{},tableCellStyleMileStone:{},tableCellWrapperStyle:{display:"flex"},expanderStyle:{color:"rgb(86 86 86)",fontSize:"0.6rem",padding:"0.15rem 0.2rem 0rem 0.2rem",userSelect:"none",cursor:"pointer"},expanderEmptyStyle:{fontSize:"0.6rem",paddingLeft:"1rem",userSelect:"none"}},Be=function(r){var o=r.tasks,n=r.locale,a=r.expanderSymbolOpen,i=r.expanderSymbolClose,l=r.expanderSymbolEmpty,c=r.onExpanderClick,u=r.showStartDateColumn,g=r.showEndDateColumn,h=r.rootStyle,f=r.tableRowStyle,v=r.tableRowStyleProject,y=r.tableCellStyle,p=r.tableCellStyleProject,S=r.tableCellStyleTask,m=r.tableCellStyleMileStone,x=r.tableCellWrapperStyle,k=r.expanderStyle,b=r.expanderEmptyStyle,C=s((function(){return function(e){return function(t,r){var o=t.toString(),n=Pe[o];return n||(n=t.toLocaleDateString(e,r),Pe[o]=n),n}}(n)}),[n]);return t("div",d({style:h},{children:o.map((function(r){var o=l;!0===r.hideChildren?o=i:!1===r.hideChildren&&(o=a);var n=d(d({},f),"project"===r.type?v:{}),s=d(d(d(d({},y),"project"===r.type?p:{}),"task"===r.type?S:{}),"milestone"===r.type?m:{});return e("div",d({style:n},{children:[t("div",d({style:s,title:r.name},{children:e("div",d({style:x},{children:[t("div",d({style:o?k:b,onClick:function(){return c(r)}},{children:o}),void 0),t("div",{children:r.name},void 0)]}),void 0)}),void 0),!0===u&&e("div",d({style:s},{children:[" ",C(r.start,He)]}),void 0),!0===g&&e("div",d({style:s},{children:[" ",C(r.end,He)]}),void 0)]}),"".concat(r.id,"row"))}))}),void 0)};Be.defaultProps=We;var Me=Object.freeze({__proto__:null,Bar:C,barDefaultProps:b,BarSmall:K,barSmallDefaultProps:V,MileStone:U,mileStoneDefaultProps:Q,Project:J,projectDefaultProps:Z,BarDateHandle:$,barDateHandleDefaultProps:q,BarDisplay:A,barDisplayDefaultProps:Y,BarProgressHandle:G,barProgressHandleDefaultProps:N,BarOriginal:te,BarNationalResources:re,Calendar:Se,calendarDefaultProps:pe,CalendarHeader:ae,calendarHeaderDefaultProps:ne,Grid:me,TaskItemNationalResources:ke,taskItemNationalResourcesDefaultProps:xe,TaskItemOriginal:Ce,taskItemOriginalDefaultProps:be,TaskList:we,TaskListHeader:De,taskListHeaderDefaultProps:Te,TaskListTable:Be,taskListTableDefaultProps:We}),Le=Object.freeze({__proto__:null}),Fe=Object.freeze({__proto__:null}),Re=Object.freeze({__proto__:null}),Ee=Object.freeze({__proto__:null}),Ie=Object.freeze({__proto__:null,barTask:Le,custom:Fe,dateSetup:Re,ganttTaskActions:Ee,publicTypes:oe,get ViewMode(){return ee}});function je(e){return void 0!==e.key}function ze(e){return void 0!==e.clientX}function Oe(e){return void 0!==e.x1}function Xe(e){var t=e.filter((function(e){return e.hideChildren&&"project"===e.type}));if(t.length>0)for(var r=function(r){var o=t[r],n=_e(e,o);e=e.filter((function(e){return-1===n.indexOf(e)}))},o=0;t.length>o;o++)r(o);return e}function _e(e,t){var r=[],o=(r="project"!==t.type?e.filter((function(e){return e.dependencies&&-1!==e.dependencies.indexOf(t.id)})):e.filter((function(e){return e.project&&e.project===t.id}))).reduce((function(t,r){return t.concat(t,_e(e,r))}),[]);return r=r.concat(r,o)}var Ye=Object.freeze({__proto__:null,isKeyboardEvent:je,isMouseEvent:ze,isBarTask:Oe,removeHiddenTasks:Xe}),Ae=Object.freeze({__proto__:null,barHelper:_,dateHelper:ye,otherHelper:Ye,convertToBarTasks:w,convertToBarTask:T,convertToBarTaskNR:D,convertToBar:P,convertToProject:H,convertToMilestone:W,progressWithByParams:F,progressByProgressWidth:R,getProgressPoint:E,handleTaskBySVGMouseEvent:z,getCachedDateTimeFormat:le,addToDate:se,startOfDate:de,ganttDateRange:ce,seedDates:ue,getLocaleMonth:ge,getWeekNumberISO8601:fe,getDaysInMonth:ve,isKeyboardEvent:je,isMouseEvent:ze,isBarTask:Oe,removeHiddenTasks:Xe}),Ne=function(r){var o,n=r.tasks,a=r.dates,s=r.ganttEvent,g=r.selectedTask,h=r.rowHeight,v=r.columnWidth,y=r.timeStep,p=r.svg,S=r.taskHeight,m=r.arrowColor,x=r.arrowIndent,k=r.fontFamily,b=r.fontSize,C=r.rtl,w=r.setGanttEvent,T=r.setFailedTask,D=r.setSelectedTask,P=r.onDateChange,H=r.onProgressChange,W=r.onDoubleClick,B=r.onDelete,M=l(0),L=M[0],F=M[1],R=l(0),E=R[0],I=R[1],j=l(!1),O=j[0],X=j[1],_=null===(o=null==p?void 0:p.current)||void 0===o?void 0:o.createSVGPoint(),Y=function(e,t,r){return c(void 0,void 0,void 0,(function(){var o,n,a,i;return u(this,(function(l){switch(l.label){case 0:return r?[3,1]:("select"===e&&D(t.id),[3,7]);case 1:if(!je(r))return[3,6];if("delete"!==e)return[3,5];if(!B)return[3,5];l.label=2;case 2:return l.trys.push([2,4,,5]),[4,B(t)];case 3:return void 0!==(o=l.sent())&&o&&w({action:e,changedTask:t}),[3,5];case 4:return n=l.sent(),console.error("Error on Delete. "+n),[3,5];case 5:return[3,7];case 6:if("mouseenter"===e)s.action||w({action:e,changedTask:t,originalSelectedTask:t});else if("mouseleave"===e)"mouseenter"===s.action&&w({action:""});else if("dblclick"===e)W&&W(t);else if("move"===e){if(!(null==p?void 0:p.current)||!_)return[2];_.x=r.clientX,a=_.matrixTransform(null===(i=p.current.getScreenCTM())||void 0===i?void 0:i.inverse()),I(a.x-t.x1),w({action:e,changedTask:t,originalSelectedTask:t})}else w({action:e,changedTask:t,originalSelectedTask:t});l.label=7;case 7:return[2]}}))}))};return i((function(){var e=a[1].getTime()-a[0].getTime()-60*a[1].getTimezoneOffset()*1e3+60*a[0].getTimezoneOffset()*1e3;F(y*v/e)}),[v,a,y]),i((function(){var e=function(e){return c(void 0,void 0,void 0,(function(){var t,r,o,n,a;return u(this,(function(i){return s.changedTask&&_&&(null==p?void 0:p.current)?(e.preventDefault(),_.x=e.clientX,t=_.matrixTransform(null===(a=null==p?void 0:p.current.getScreenCTM())||void 0===a?void 0:a.inverse()),r=z(t.x,s.action,s.changedTask,L,y,E,C),o=r.isChanged,n=r.changedTask,o&&w({action:s.action,changedTask:n}),[2]):[2]}))}))},t=function(r){return c(void 0,void 0,void 0,(function(){var o,n,a,i,l,d,c,g,h;return u(this,(function(u){switch(u.label){case 0:if(o=s.action,n=s.originalSelectedTask,!((a=s.changedTask)&&_&&(null==p?void 0:p.current)&&n))return[2];if(r.preventDefault(),_.x=r.clientX,i=_.matrixTransform(null===(h=null==p?void 0:p.current.getScreenCTM())||void 0===h?void 0:h.inverse()),l=z(i.x,o,a,L,y,E,C).changedTask,d=n.start!==l.start||n.end!==l.end||n.progress!==l.progress,p.current.removeEventListener("mousemove",e),p.current.removeEventListener("mouseup",t),w({action:""}),X(!1),c=!0,"move"!==o&&"end"!==o&&"start"!==o||!P||!d)return[3,5];u.label=1;case 1:return u.trys.push([1,3,,4]),[4,P(l,l.barChildren)];case 2:return void 0!==(g=u.sent())&&(c=g),[3,4];case 3:return u.sent(),c=!1,[3,4];case 4:return[3,9];case 5:if(!H||!d)return[3,9];u.label=6;case 6:return u.trys.push([6,8,,9]),[4,H(l,l.barChildren)];case 7:return void 0!==(g=u.sent())&&(c=g),[3,9];case 8:return u.sent(),c=!1,[3,9];case 9:return c||T(n),[2]}}))}))};O||"move"!==s.action&&"end"!==s.action&&"start"!==s.action&&"progress"!==s.action||!(null==p?void 0:p.current)||(p.current.addEventListener("mousemove",e),p.current.addEventListener("mouseup",t),X(!0))}),[s,L,E,H,y,P,p,O]),e("g",d({className:"content"},{children:[t("g",d({className:"arrows",fill:m,stroke:m},{children:n.map((function(e){return e.barChildren.map((function(r){var o=n[r.index];return t(f,{taskFromIndex:e.index,taskFromX1:e.x1,taskFromX2:e.x2,taskFromY:e.y,taskToIndex:o.index,taskToX1:o.x1,taskToX2:o.x2,taskToY:o.y,rowHeight:h,taskHeight:S,arrowIndent:x,rtl:C,rootStyle:{fill:m,stroke:m}},"Arrow from ".concat(e.id," to ").concat(n[r.index].id))}))}))}),void 0),t("g",d({className:"bar",fontFamily:k,fontSize:b},{children:n.map((function(e){return t(Ce,{task:e,arrowIndent:x,taskHeight:S,isProgressChangeable:!!H&&!e.isDisabled,isDateChangeable:!!P&&!e.isDisabled,isDelete:!e.isDisabled,onEventStart:Y,isSelected:!!g&&e.id===g.id,rtl:C},e.id)}))}),void 0)]}),void 0)},Ge=function(r){var o=r.gridProps,n=r.calendarProps,l=r.barProps,s=r.ganttHeight,c=r.scrollY,u=r.scrollX,g=r.rootStyle,h=r.contentStyle,f=a(null),v=a(null),y=a(null);i((function(){v.current&&(v.current.scrollTop=c)}),[c]),i((function(){y.current&&(y.current.scrollLeft=u)}),[u]);var p=d(d({},l),{svg:f});return e("div",d({style:g,ref:y,dir:"ltr"},{children:[t("svg",d({height:n.headerHeight,width:o.svgWidth,fontFamily:l.fontFamily,xmlns:"http://www.w3.org/2000/svg"},{children:t(Se,d({},n),void 0)}),void 0),t("div",d({ref:v,style:d(d({},h),{height:s||void 0,width:o.svgWidth})},{children:e("svg",d({ref:f,height:l.rowHeight*l.tasks.length,width:o.svgWidth,fontFamily:l.fontFamily,xmlns:"http://www.w3.org/2000/svg"},{children:[t(me,d({},o),void 0),t(Ne,d({},p),void 0)]}),void 0)}),void 0)]}),void 0)};Ge.defaultProps={rootStyle:{overflow:"hidden",margin:0,padding:0,fontSize:0},contentStyle:{overflow:"hidden",margin:0,padding:0}};var Ve={bodyStyle:{display:"flex",padding:"0",margin:"0",listStyle:"none",outline:"none",position:"relative"},timeStep:3e5,onDateChange:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return console.log("onDateChange: ".concat(e))},onProgressChange:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return console.log("onProgressChange: ".concat(e))},onDoubleClick:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return console.log("onDoubleClick: ".concat(e))},onDelete:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return console.log("onDelete: ".concat(e))},onSelect:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return console.log("onSelect: ".concat(e))},onExpanderClick:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return console.log("onExpanderClick: ".concat(e))},viewMode:ee.Day,locale:"en-GB",rtl:!1,headerHeight:50,columnWidth:60,listCellWidth:"155px",rowHeight:50,ganttHeight:300,barFill:60,barCornerRadius:3,barProgressColor:"#a3a3ff",barProgressSelectedColor:"#8282f5",barBackgroundColor:"#b8c2cc",barBackgroundSelectedColor:"#aeb8c2",projectProgressColor:"#7db59a",projectProgressSelectedColor:"#59a985",projectBackgroundColor:"#fac465",projectBackgroundSelectedColor:"#f7bb53",milestoneBackgroundColor:"#f1c453",milestoneBackgroundSelectedColor:"#f29e4c",handleWidth:8,arrowColor:"grey",fontFamily:"Arial, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue",fontSize:"14px",arrowIndent:20,todayColor:"rgba(252, 248, 227, 0.5)",TooltipContent:function(r){var o=r.task,n=r.fontFamily,a=r.fontSize;return e("div",d({style:{background:"#fff",padding:"12px",boxShadow:"0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23)",fontFamily:n,fontSize:a}},{children:[t("b",d({style:{fontSize:a+6}},{children:"".concat(o.name,": ").concat(o.start.getDate(),"-").concat(o.start.getMonth()+1,"-").concat(o.start.getFullYear()," - ").concat(o.end.getDate(),"-").concat(o.end.getMonth()+1,"-").concat(o.end.getFullYear())}),void 0),o.end.getTime()-o.start.getTime()!=0&&t("p",d({style:{fontSize:"12px",marginBottom:"6px",color:"#666"}},{children:"Duration: ".concat(~~((o.end.getTime()-o.start.getTime())/864e5)," day(s)")}),void 0),t("p",d({style:{fontSize:"12px",marginBottom:"6px",color:"#666"}},{children:!!o.progress&&"Progress: ".concat(o.progress," %")}),void 0)]}),void 0)}},Ke=function(r){var o=r.tasks,n=r.bodyStyle,s=r.timeStep,c=r.onDateChange,u=r.onProgressChange,g=r.onDoubleClick,h=r.onDelete,f=r.onSelect,p=r.onExpanderClick,k=r.viewMode,b=r.locale,C=r.rtl,T=r.headerHeight,D=r.columnWidth,P=r.listCellWidth,H=r.rowHeight,W=r.ganttHeight,B=r.barFill,M=r.barCornerRadius,L=r.barProgressColor,F=r.barProgressSelectedColor,R=r.barBackgroundColor,E=r.barBackgroundSelectedColor,I=r.projectProgressColor,j=r.projectProgressSelectedColor,z=r.projectBackgroundColor,O=r.projectBackgroundSelectedColor,X=r.milestoneBackgroundColor,_=r.milestoneBackgroundSelectedColor,Y=r.handleWidth,A=r.arrowColor,N=r.fontFamily,G=r.fontSize,V=r.arrowIndent,K=r.todayColor,Q=r.TooltipContent,U=l((function(){var e=ce(o,k),t=e[0],r=e[1];return{viewMode:k,dates:ue(t,r,k)}})),Z=U[0],J=U[1],q=l(H*B/100),$=q[0],ee=q[1],te=l(0),re=te[0],oe=te[1],ne=l(0),ae=ne[0],ie=ne[1],le=l(W),se=le[0],de=le[1],ge=l([]),he=ge[0],fe=ge[1],ve=l({action:""}),ye=ve[0],pe=ve[1],Se=l(),me=Se[0],xe=Se[1],ke=l(null),be=ke[0],Ce=ke[1],Pe=l(0),He=Pe[0],Me=Pe[1],Le=l(-1),Fe=Le[0],Re=Le[1],Ee=l(!1),Ie=Ee[0],je=Ee[1],ze=a(null),Oe=a(null),_e=Z.dates.length*D,Ye=he.length*H;i((function(){var e=p?Xe(o):o,t=ce(e,k),r=t[0],n=t[1],a=ue(r,n,k);C&&(a=a.reverse(),-1===Fe&&Re(a.length*D)),J({dates:a,viewMode:k}),fe(w({tasks:e,dates:a,columnWidth:D,rowHeight:H,taskHeight:$,barCornerRadius:M,handleWidth:Y,rtl:C,barProgressColor:L,barProgressSelectedColor:F,barBackgroundColor:R,barBackgroundSelectedColor:E,projectProgressColor:I,projectProgressSelectedColor:j,projectBackgroundColor:z,projectBackgroundSelectedColor:O,milestoneBackgroundColor:X,milestoneBackgroundSelectedColor:_}))}),[o,k,H,M,D,$,Y,L,F,R,E,I,j,z,O,X,_,C,Fe,p]),i((function(){var e=ye.changedTask,t=ye.action;if(e)if("delete"===t)pe({action:""}),fe(he.filter((function(t){return t.id!==e.id})));else if("move"===t||"end"===t||"start"===t||"progress"===t){var r=he.find((function(t){return t.id===e.id}));if(r&&(r.start.getTime()!==e.start.getTime()||r.end.getTime()!==e.end.getTime()||r.progress!==e.progress)){var o=he.map((function(t){return t.id===e.id?e:t}));fe(o)}}}),[ye,he]),i((function(){ze.current&&ie(ze.current.offsetWidth-re)}),[ze,re]),i((function(){var e=function(e){if(e.shiftKey||e.deltaX){var t=e.deltaX?e.deltaX:e.deltaY,r=Fe+t;r<0?r=0:r>_e&&(r=_e),Re(r),e.preventDefault()}else if(W){var o=He+e.deltaY;o<0?o=0:o>Ye-W&&(o=Ye-W),o!==He&&(Me(o),e.preventDefault())}je(!0)};return ze.current&&ze.current.addEventListener("wheel",e,{passive:!1}),function(){ze.current&&ze.current.removeEventListener("wheel",e)}}),[ze.current,He,Fe,W,_e,C]),i((function(){be&&(fe(he.map((function(e){return e.id!==be.id?e:be}))),Ce(null))}),[be,he]),i((function(){var e=H*B/100;e!==$&&ee(e)}),[H,B,$]),i((function(){P||oe(0),Oe.current&&oe(Oe.current.offsetWidth)}),[Oe,P]),i((function(){de(W?W+T:o.length*H+T)}),[W,T,H,o]);var Ae={columnWidth:D,svgWidth:_e,tasks:o,rowHeight:H,dates:Z.dates,todayColor:K,rtl:C},Ne={dateSetup:Z,locale:b,headerHeight:T,columnWidth:D,rtl:C,rootStyle:{fontFamily:N,fontSize:G}},Ve={tasks:he,dates:Z.dates,ganttEvent:ye,selectedTask:me,rowHeight:H,taskHeight:$,columnWidth:D,arrowColor:A,timeStep:s,fontFamily:N,fontSize:G,arrowIndent:V,svgWidth:_e,rtl:C,setGanttEvent:pe,setFailedTask:Ce,setSelectedTask:function(e){var t=he.find((function(t){return t.id===e})),r=he.find((function(e){return!!me&&e.id===me.id}));f&&(r&&f(r,!1),t&&f(t,!0)),xe(t)},onDateChange:c,onProgressChange:u,onDoubleClick:g,onDelete:h},Ke={scrollY:He,TaskListHeader:De,TaskListTable:Be,taskListHeaderProps:{rootStyle:d(d({},Te.rootStyle),{fontFamily:"sans-serif",fontSize:"15px"}),headerStyle:d(d({},Te.headerStyle),{height:48}),columnStyle:d(d({},Te.columnStyle),{minWidth:150,textAlign:"center"}),columnSeparatorStyle:d(d({},Te.columnSeparatorStyle),{height:25,marginTop:10})},taskListTableProps:{tasks:he,locale:"en-GB",onExpanderClick:function(e){p&&void 0!==e.hideChildren&&p(d(d({},e),{hideChildren:!e.hideChildren}))},rootStyle:d(d({},We.rootStyle),{fontFamily:"Arial",fontSize:"15px"}),tableRowStyle:d(d({},We.tableRowStyle),{height:50}),tableCellStyle:d(d({},We.tableCellStyle),{minWidth:150,maxWidth:150})},taskListTableWrapperStyles:{height:W,overflow:"hidden"},taskListRef:Oe};return e("div",{children:[e("div",d({style:n,tabIndex:0,ref:ze},{children:[P&&t(we,d({},Ke),void 0),t(Ge,{barProps:Ve,gridProps:Ae,calendarProps:Ne,ganttHeight:W,scrollX:Fe,scrollY:He},void 0),ye.changedTask&&t(S,d({arrowIndent:V,rowHeight:H,svgContainerHeight:se,svgContainerWidth:ae,scrollX:Fe,scrollY:He,task:ye.changedTask,headerHeight:T,taskListWidth:re,rtl:C},{children:t(Q,{task:ye.changedTask,fontSize:"15px",fontFamily:"Arial"},void 0)}),void 0),t(x,{scroll:He,onScroll:function(e){He===e.currentTarget.scrollTop||Ie||Me(e.currentTarget.scrollTop),je(!1)},rootStyle:d(d({},m.rootStyle),{height:W,marginTop:T,marginLeft:C?"":"-17px"}),bodyStyle:d(d({},m.bodyStyle),{height:Ye})},void 0)]}),void 0),t(y,{scroll:Fe,onScroll:function(e){Fe===e.currentTarget.scrollLeft||Ie||Re(e.currentTarget.scrollLeft),je(!1)},rootStyle:d(d({},v.rootStyle),{margin:C?"0px ".concat(re,"px 0px 0px"):"0px 0px 0px ".concat(re,"px")}),bodyStyle:d(d({},v.bodyStyle),{width:_e})},void 0)]},void 0)};Ke.defaultProps=Ve;var Qe=function(r){var o,n=r.tasks,a=r.dates,s=r.ganttEvent,g=r.selectedTask,h=r.rowHeight,v=r.columnWidth,y=r.timeStep,p=r.svg,S=r.taskHeight,m=r.arrowColor,x=r.arrowIndent,k=r.fontFamily,b=r.fontSize,C=r.rtl,w=r.setGanttEvent,T=r.setFailedTask,D=r.setSelectedTask,P=r.onDateChange,H=r.onProgressChange,W=r.onDoubleClick,B=r.onDelete,M=l(0),L=M[0],F=M[1],R=l(0),E=R[0],I=R[1],j=l(!1),O=j[0],X=j[1],_=null===(o=null==p?void 0:p.current)||void 0===o?void 0:o.createSVGPoint(),Y=function(e,t,r){return c(void 0,void 0,void 0,(function(){var o,n,a,i;return u(this,(function(l){switch(l.label){case 0:return r?[3,1]:("select"===e&&D(t.id),[3,7]);case 1:if(!je(r))return[3,6];if("delete"!==e)return[3,5];if(!B)return[3,5];l.label=2;case 2:return l.trys.push([2,4,,5]),[4,B(t)];case 3:return void 0!==(o=l.sent())&&o&&w({action:e,changedTask:t}),[3,5];case 4:return n=l.sent(),console.error("Error on Delete. "+n),[3,5];case 5:return[3,7];case 6:if("mouseenter"===e)s.action||w({action:e,changedTask:t,originalSelectedTask:t});else if("mouseleave"===e)"mouseenter"===s.action&&w({action:""});else if("dblclick"===e)W&&W(t);else if("move"===e){if(!(null==p?void 0:p.current)||!_)return[2];_.x=r.clientX,a=_.matrixTransform(null===(i=p.current.getScreenCTM())||void 0===i?void 0:i.inverse()),I(a.x-t.x1),w({action:e,changedTask:t,originalSelectedTask:t})}else w({action:e,changedTask:t,originalSelectedTask:t});l.label=7;case 7:return[2]}}))}))};return i((function(){var e=a[1].getTime()-a[0].getTime()-60*a[1].getTimezoneOffset()*1e3+60*a[0].getTimezoneOffset()*1e3;F(y*v/e)}),[v,a,y]),i((function(){var e=function(e){return c(void 0,void 0,void 0,(function(){var t,r,o,n,a;return u(this,(function(i){return s.changedTask&&_&&(null==p?void 0:p.current)?(e.preventDefault(),_.x=e.clientX,t=_.matrixTransform(null===(a=null==p?void 0:p.current.getScreenCTM())||void 0===a?void 0:a.inverse()),r=z(t.x,s.action,s.changedTask,L,y,E,C),o=r.isChanged,n=r.changedTask,o&&w({action:s.action,changedTask:n}),[2]):[2]}))}))},t=function(r){return c(void 0,void 0,void 0,(function(){var o,n,a,i,l,d,c,g,h;return u(this,(function(u){switch(u.label){case 0:if(o=s.action,n=s.originalSelectedTask,!((a=s.changedTask)&&_&&(null==p?void 0:p.current)&&n))return[2];if(r.preventDefault(),_.x=r.clientX,i=_.matrixTransform(null===(h=null==p?void 0:p.current.getScreenCTM())||void 0===h?void 0:h.inverse()),l=z(i.x,o,a,L,y,E,C).changedTask,d=n.start!==l.start||n.end!==l.end||n.progress!==l.progress,p.current.removeEventListener("mousemove",e),p.current.removeEventListener("mouseup",t),w({action:""}),X(!1),c=!0,"move"!==o&&"end"!==o&&"start"!==o||!P||!d)return[3,5];u.label=1;case 1:return u.trys.push([1,3,,4]),[4,P(l,l.barChildren)];case 2:return void 0!==(g=u.sent())&&(c=g),[3,4];case 3:return u.sent(),c=!1,[3,4];case 4:return[3,9];case 5:if(!H||!d)return[3,9];u.label=6;case 6:return u.trys.push([6,8,,9]),[4,H(l,l.barChildren)];case 7:return void 0!==(g=u.sent())&&(c=g),[3,9];case 8:return u.sent(),c=!1,[3,9];case 9:return c||T(n),[2]}}))}))};O||"move"!==s.action&&"end"!==s.action&&"start"!==s.action&&"progress"!==s.action||!(null==p?void 0:p.current)||(p.current.addEventListener("mousemove",e),p.current.addEventListener("mouseup",t),X(!0))}),[s,L,E,H,y,P,p,O]),e("g",d({className:"content"},{children:[t("g",d({className:"arrows",fill:m,stroke:m},{children:n.map((function(e){return e.barChildren.map((function(r){var o=n[r.index];return t(f,{taskFromIndex:e.index,taskFromX1:e.x1,taskFromX2:e.x2,taskFromY:e.y,taskToIndex:o.index,taskToX1:o.x1,taskToX2:o.x2,taskToY:o.y,rowHeight:h,taskHeight:S,arrowIndent:x,rtl:C,rootStyle:{fill:m,stroke:m}},"Arrow from ".concat(e.id," to ").concat(n[r.index].id))}))}))}),void 0),t("g",d({className:"bar",fontFamily:k,fontSize:b},{children:n.map((function(e){return t(ke,{task:e,arrowIndent:x,taskHeight:S,isProgressChangeable:!!H&&!e.isDisabled,isDateChangeable:!!P&&!e.isDisabled,isDelete:!e.isDisabled,onEventStart:Y,isSelected:!!g&&e.id===g.id,rtl:C},e.id)}))}),void 0)]}),void 0)},Ue=function(r){var o=r.gridProps,n=r.calendarProps,l=r.barProps,s=r.ganttHeight,c=r.scrollY,u=r.scrollX,