iris-gantt 1.2.5 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Gantt/DependencyEditor.d.ts +1 -0
- package/dist/Gantt/DependencyEditor.d.ts.map +1 -1
- package/dist/Gantt/DependencyPopover.d.ts +1 -0
- package/dist/Gantt/DependencyPopover.d.ts.map +1 -1
- package/dist/Gantt/Gantt.d.ts +2 -1
- package/dist/Gantt/Gantt.d.ts.map +1 -1
- package/dist/Gantt/Grid.d.ts.map +1 -1
- package/dist/Gantt/TaskBar.d.ts.map +1 -1
- package/dist/gantt.css +1 -1
- package/dist/iris-gantt.js +1673 -1617
- package/dist/iris-gantt.umd.cjs +16 -16
- package/package.json +2 -1
package/dist/iris-gantt.umd.cjs
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
(function(R,
|
|
2
|
-
`+
|
|
3
|
-
`),
|
|
4
|
-
`),
|
|
5
|
-
`+
|
|
1
|
+
(function(R,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("react"),require("antd"),require("@fortawesome/react-fontawesome"),require("@fortawesome/free-solid-svg-icons"),require("dayjs")):typeof define=="function"&&define.amd?define(["exports","react","antd","@fortawesome/react-fontawesome","@fortawesome/free-solid-svg-icons","dayjs"],g):(R=typeof globalThis<"u"?globalThis:R||self,g(R.IrisGantt={},R.React,R.antd,R.ReactFontawesome,R.FontAwesomeSolid,R.dayjs))})(this,(function(R,g,p,le,G,Et){"use strict";var st={exports:{}},Ke={};var $t;function Jt(){if($t)return Ke;$t=1;var t=g,a=Symbol.for("react.element"),o=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,r=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,x={key:!0,ref:!0,__self:!0,__source:!0};function y(i,s,b){var c,w={},T=null,u=null;b!==void 0&&(T=""+b),s.key!==void 0&&(T=""+s.key),s.ref!==void 0&&(u=s.ref);for(c in s)l.call(s,c)&&!x.hasOwnProperty(c)&&(w[c]=s[c]);if(i&&i.defaultProps)for(c in s=i.defaultProps,s)w[c]===void 0&&(w[c]=s[c]);return{$$typeof:a,type:i,key:T,ref:u,props:w,_owner:r.current}}return Ke.Fragment=o,Ke.jsx=y,Ke.jsxs=y,Ke}var Qe={};var Ft;function Gt(){return Ft||(Ft=1,process.env.NODE_ENV!=="production"&&(function(){var t=g,a=Symbol.for("react.element"),o=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),y=Symbol.for("react.provider"),i=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),u=Symbol.for("react.offscreen"),h=Symbol.iterator,v="@@iterator";function j(n){if(n===null||typeof n!="object")return null;var m=h&&n[h]||n[v];return typeof m=="function"?m:null}var D=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function $(n){{for(var m=arguments.length,k=new Array(m>1?m-1:0),C=1;C<m;C++)k[C-1]=arguments[C];F("error",n,k)}}function F(n,m,k){{var C=D.ReactDebugCurrentFrame,X=C.getStackAddendum();X!==""&&(m+="%s",k=k.concat([X]));var V=k.map(function(H){return String(H)});V.unshift("Warning: "+m),Function.prototype.apply.call(console[n],console,V)}}var z=!1,ne=!1,q=!1,fe=!1,E=!1,K;K=Symbol.for("react.module.reference");function U(n){return!!(typeof n=="string"||typeof n=="function"||n===l||n===x||E||n===r||n===b||n===c||fe||n===u||z||ne||q||typeof n=="object"&&n!==null&&(n.$$typeof===T||n.$$typeof===w||n.$$typeof===y||n.$$typeof===i||n.$$typeof===s||n.$$typeof===K||n.getModuleId!==void 0))}function L(n,m,k){var C=n.displayName;if(C)return C;var X=m.displayName||m.name||"";return X!==""?k+"("+X+")":k}function W(n){return n.displayName||"Context"}function oe(n){if(n==null)return null;if(typeof n.tag=="number"&&$("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case l:return"Fragment";case o:return"Portal";case x:return"Profiler";case r:return"StrictMode";case b:return"Suspense";case c:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case i:var m=n;return W(m)+".Consumer";case y:var k=n;return W(k._context)+".Provider";case s:return L(n,n.render,"ForwardRef");case w:var C=n.displayName||null;return C!==null?C:oe(n.type)||"Memo";case T:{var X=n,V=X._payload,H=X._init;try{return oe(H(V))}catch{return null}}}return null}var Z=Object.assign,xe=0,Fe,ke,A,B,ue,ee,te;function Q(){}Q.__reactDisabledLog=!0;function f(){{if(xe===0){Fe=console.log,ke=console.info,A=console.warn,B=console.error,ue=console.group,ee=console.groupCollapsed,te=console.groupEnd;var n={configurable:!0,enumerable:!0,value:Q,writable:!0};Object.defineProperties(console,{info:n,log:n,warn:n,error:n,group:n,groupCollapsed:n,groupEnd:n})}xe++}}function M(){{if(xe--,xe===0){var n={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Z({},n,{value:Fe}),info:Z({},n,{value:ke}),warn:Z({},n,{value:A}),error:Z({},n,{value:B}),group:Z({},n,{value:ue}),groupCollapsed:Z({},n,{value:ee}),groupEnd:Z({},n,{value:te})})}xe<0&&$("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var P=D.ReactCurrentDispatcher,N;function _(n,m,k){{if(N===void 0)try{throw Error()}catch(X){var C=X.stack.trim().match(/\n( *(at )?)/);N=C&&C[1]||""}return`
|
|
2
|
+
`+N+n}}var ae=!1,re;{var Pe=typeof WeakMap=="function"?WeakMap:Map;re=new Pe}function se(n,m){if(!n||ae)return"";{var k=re.get(n);if(k!==void 0)return k}var C;ae=!0;var X=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var V;V=P.current,P.current=null,f();try{if(m){var H=function(){throw Error()};if(Object.defineProperty(H.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(H,[])}catch(je){C=je}Reflect.construct(n,[],H)}else{try{H.call()}catch(je){C=je}n.call(H.prototype)}}else{try{throw Error()}catch(je){C=je}n()}}catch(je){if(je&&C&&typeof je.stack=="string"){for(var Y=je.stack.split(`
|
|
3
|
+
`),we=C.stack.split(`
|
|
4
|
+
`),ce=Y.length-1,pe=we.length-1;ce>=1&&pe>=0&&Y[ce]!==we[pe];)pe--;for(;ce>=1&&pe>=0;ce--,pe--)if(Y[ce]!==we[pe]){if(ce!==1||pe!==1)do if(ce--,pe--,pe<0||Y[ce]!==we[pe]){var De=`
|
|
5
|
+
`+Y[ce].replace(" at new "," at ");return n.displayName&&De.includes("<anonymous>")&&(De=De.replace("<anonymous>",n.displayName)),typeof n=="function"&&re.set(n,De),De}while(ce>=1&&pe>=0);break}}}finally{ae=!1,P.current=V,M(),Error.prepareStackTrace=X}var Ze=n?n.displayName||n.name:"",He=Ze?_(Ze):"";return typeof n=="function"&&re.set(n,He),He}function Le(n,m,k){return se(n,!1)}function _e(n){var m=n.prototype;return!!(m&&m.isReactComponent)}function Oe(n,m,k){if(n==null)return"";if(typeof n=="function")return se(n,_e(n));if(typeof n=="string")return _(n);switch(n){case b:return _("Suspense");case c:return _("SuspenseList")}if(typeof n=="object")switch(n.$$typeof){case s:return Le(n.render);case w:return Oe(n.type,m,k);case T:{var C=n,X=C._payload,V=C._init;try{return Oe(V(X),m,k)}catch{}}}return""}var Te=Object.prototype.hasOwnProperty,Ce={},rt=D.ReactDebugCurrentFrame;function We(n){if(n){var m=n._owner,k=Oe(n.type,n._source,m?m.type:null);rt.setExtraStackFrame(k)}else rt.setExtraStackFrame(null)}function wt(n,m,k,C,X){{var V=Function.call.bind(Te);for(var H in n)if(V(n,H)){var Y=void 0;try{if(typeof n[H]!="function"){var we=Error((C||"React class")+": "+k+" type `"+H+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof n[H]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw we.name="Invariant Violation",we}Y=n[H](m,H,C,k,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(ce){Y=ce}Y&&!(Y instanceof Error)&&(We(X),$("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",C||"React class",k,H,typeof Y),We(null)),Y instanceof Error&&!(Y.message in Ce)&&(Ce[Y.message]=!0,We(X),$("Failed %s type: %s",k,Y.message),We(null))}}}var lt=Array.isArray;function Ne(n){return lt(n)}function vt(n){{var m=typeof Symbol=="function"&&Symbol.toStringTag,k=m&&n[Symbol.toStringTag]||n.constructor.name||"Object";return k}}function Ie(n){try{return Me(n),!1}catch{return!0}}function Me(n){return""+n}function ve(n){if(Ie(n))return $("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",vt(n)),Me(n)}var dt=D.ReactCurrentOwner,qt={key:!0,ref:!0,__self:!0,__source:!0},ct,ut;function jt(n){if(Te.call(n,"ref")){var m=Object.getOwnPropertyDescriptor(n,"ref").get;if(m&&m.isReactWarning)return!1}return n.ref!==void 0}function St(n){if(Te.call(n,"key")){var m=Object.getOwnPropertyDescriptor(n,"key").get;if(m&&m.isReactWarning)return!1}return n.key!==void 0}function nt(n,m){typeof n.ref=="string"&&dt.current}function Tt(n,m){{var k=function(){ct||(ct=!0,$("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",m))};k.isReactWarning=!0,Object.defineProperty(n,"key",{get:k,configurable:!0})}}function Dt(n,m){{var k=function(){ut||(ut=!0,$("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",m))};k.isReactWarning=!0,Object.defineProperty(n,"ref",{get:k,configurable:!0})}}var ot=function(n,m,k,C,X,V,H){var Y={$$typeof:a,type:n,key:m,ref:k,props:H,_owner:V};return Y._store={},Object.defineProperty(Y._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Y,"_self",{configurable:!1,enumerable:!1,writable:!1,value:C}),Object.defineProperty(Y,"_source",{configurable:!1,enumerable:!1,writable:!1,value:X}),Object.freeze&&(Object.freeze(Y.props),Object.freeze(Y)),Y};function kt(n,m,k,C,X){{var V,H={},Y=null,we=null;k!==void 0&&(ve(k),Y=""+k),St(m)&&(ve(m.key),Y=""+m.key),jt(m)&&(we=m.ref,nt(m,X));for(V in m)Te.call(m,V)&&!qt.hasOwnProperty(V)&&(H[V]=m[V]);if(n&&n.defaultProps){var ce=n.defaultProps;for(V in ce)H[V]===void 0&&(H[V]=ce[V])}if(Y||we){var pe=typeof n=="function"?n.displayName||n.name||"Unknown":n;Y&&Tt(H,pe),we&&Dt(H,pe)}return ot(n,Y,we,X,C,dt.current,H)}}var qe=D.ReactCurrentOwner,pt=D.ReactDebugCurrentFrame;function Ee(n){if(n){var m=n._owner,k=Oe(n.type,n._source,m?m.type:null);pt.setExtraStackFrame(k)}else pt.setExtraStackFrame(null)}var Je;Je=!1;function Ge(n){return typeof n=="object"&&n!==null&&n.$$typeof===a}function at(){{if(qe.current){var n=oe(qe.current.type);if(n)return`
|
|
6
6
|
|
|
7
|
-
Check the render method of \``+n+"`."}return""}}function
|
|
7
|
+
Check the render method of \``+n+"`."}return""}}function Lt(n){return""}var ht={};function d(n){{var m=at();if(!m){var k=typeof n=="string"?n:n.displayName||n.name;k&&(m=`
|
|
8
8
|
|
|
9
|
-
Check the top-level render call using <`+
|
|
9
|
+
Check the top-level render call using <`+k+">.")}return m}}function S(n,m){{if(!n._store||n._store.validated||n.key!=null)return;n._store.validated=!0;var k=d(m);if(ht[k])return;ht[k]=!0;var C="";n&&n._owner&&n._owner!==qe.current&&(C=" It was passed a child from "+oe(n._owner.type)+"."),Ee(n),$('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',k,C),Ee(null)}}function O(n,m){{if(typeof n!="object")return;if(Ne(n))for(var k=0;k<n.length;k++){var C=n[k];Ge(C)&&S(C,m)}else if(Ge(n))n._store&&(n._store.validated=!0);else if(n){var X=j(n);if(typeof X=="function"&&X!==n.entries)for(var V=X.call(n),H;!(H=V.next()).done;)Ge(H.value)&&S(H.value,m)}}}function I(n){{var m=n.type;if(m==null||typeof m=="string")return;var k;if(typeof m=="function")k=m.propTypes;else if(typeof m=="object"&&(m.$$typeof===s||m.$$typeof===w))k=m.propTypes;else return;if(k){var C=oe(m);wt(k,n.props,"prop",C,n)}else if(m.PropTypes!==void 0&&!Je){Je=!0;var X=oe(m);$("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",X||"Unknown")}typeof m.getDefaultProps=="function"&&!m.getDefaultProps.isReactClassApproved&&$("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function de(n){{for(var m=Object.keys(n.props),k=0;k<m.length;k++){var C=m[k];if(C!=="children"&&C!=="key"){Ee(n),$("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",C),Ee(null);break}}n.ref!==null&&(Ee(n),$("Invalid attribute `ref` supplied to `React.Fragment`."),Ee(null))}}var J={};function ge(n,m,k,C,X,V){{var H=U(n);if(!H){var Y="";(n===void 0||typeof n=="object"&&n!==null&&Object.keys(n).length===0)&&(Y+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var we=Lt();we?Y+=we:Y+=at();var ce;n===null?ce="null":Ne(n)?ce="array":n!==void 0&&n.$$typeof===a?(ce="<"+(oe(n.type)||"Unknown")+" />",Y=" Did you accidentally export a JSX literal instead of a component?"):ce=typeof n,$("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",ce,Y)}var pe=kt(n,m,k,X,V);if(pe==null)return pe;if(H){var De=m.children;if(De!==void 0)if(C)if(Ne(De)){for(var Ze=0;Ze<De.length;Ze++)O(De[Ze],n);Object.freeze&&Object.freeze(De)}else $("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else O(De,n)}if(Te.call(m,"key")){var He=oe(n),je=Object.keys(m).filter(function(Dr){return Dr!=="key"}),Mt=je.length>0?"{key: someKey, "+je.join(": ..., ")+": ...}":"{key: someKey}";if(!J[He+Mt]){var Tr=je.length>0?"{"+je.join(": ..., ")+": ...}":"{}";$(`A props object containing a "key" prop is being spread into JSX:
|
|
10
10
|
let props = %s;
|
|
11
11
|
<%s {...props} />
|
|
12
12
|
React keys must be passed directly to JSX without using spread:
|
|
13
13
|
let props = %s;
|
|
14
|
-
<%s key={someKey} {...props} />`,Et,We,Tr,We),be[We+Et]=!0}}return n===i?X(ce):ae(ce),ce}}function we(n,x,D){return ee(n,x,D,!0)}function _e(n,x,D){return ee(n,x,D,!1)}var ye=_e,De=we;et.Fragment=i,et.jsx=ye,et.jsxs=De})()),et}var Ot;function Zt(){return Ot||(Ot=1,process.env.NODE_ENV==="production"?lt.exports=Jt():lt.exports=Gt()),lt.exports}var e=Zt();const he=(t,s,o)=>{const i=new Date(t);switch(o){case"hour":i.setHours(i.getHours()+s);break;case"day":i.setDate(i.getDate()+s);break;case"week":i.setDate(i.getDate()+s*7);break;case"month":i.setMonth(i.getMonth()+s);break;case"quarter":i.setMonth(i.getMonth()+s*3);break;case"year":i.setFullYear(i.getFullYear()+s);break}return i},tt=(t,s)=>{const o=s.getTime()-t.getTime();return Math.ceil(o/(1e3*60*60*24))},Ct=(t,s)=>{const o=s.getTime()-t.getTime();return Math.ceil(o/(1e3*60*60))},fe=(t,s)=>{const o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],i=["January","February","March","April","May","June","July","August","September","October","November","December"],r=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],y={YYYY:t.getFullYear().toString(),YY:t.getFullYear().toString().slice(-2),MMMM:i[t.getMonth()],MMM:o[t.getMonth()],MM:String(t.getMonth()+1).padStart(2,"0"),M:String(t.getMonth()+1),DD:String(t.getDate()).padStart(2,"0"),D:String(t.getDate()),dddd:r[t.getDay()],HH:String(t.getHours()).padStart(2,"0"),H:String(t.getHours()),mm:String(t.getMinutes()).padStart(2,"0"),m:String(t.getMinutes())};return s.replace(/YYYY|YY|MMMM|MMM|MM|M|DD|D|dddd|HH|H|mm|m/g,g=>y[g])},xt=t=>{const s=t.getDay();return s===0||s===6},yt=(t,s)=>s.some(o=>o.getFullYear()===t.getFullYear()&&o.getMonth()===t.getMonth()&&o.getDate()===t.getDate()),Ie=t=>{const s=new Date(t);return s.setHours(0,0,0,0),s},Kt=t=>{const s=new Date(t);return s.setHours(23,59,59,999),s},Qt=(t,s,o="day")=>{switch(o){case"hour":return Ct(t,s);case"day":return tt(t,s);case"week":return Math.ceil(tt(t,s)/7);case"month":return(s.getFullYear()-t.getFullYear())*12+(s.getMonth()-t.getMonth());default:return tt(t,s)}};function er(t){if(!t||typeof t!="string")return null;const s=t.trim(),o=/^(\d+)(FS|SS|FF|SF)(([+-])(\d+)([dhwm]))?$/i,i=s.match(o);if(!i)return null;const r=parseInt(i[1],10),y=i[2].toUpperCase();let g=0,a="day";if(i[3]){const u=i[4]==="-"?-1:1;switch(g=parseInt(i[5],10)*u,i[6].toLowerCase()){case"d":a="day";break;case"h":a="hour";break;case"w":a="week";break;case"m":a="month";break}}return{taskNumber:r,type:y,lag:g,lagUnit:a}}function gt(t,s){switch(s){case"hour":return t/24;case"day":return t;case"week":return t*7;case"month":return t*30;default:return t}}function tr(t,s){const i={e2s:"FS",s2s:"SS",e2e:"FF",s2e:"SF"}[t.type];let r=`${s}${i}`;if(t.lag&&t.lag!==0){const y=t.lag>0?"+":"",a=(t.lagUnit||"day").charAt(0);let u=t.lag;if(t.lagUnit&&t.lagUnit!=="day")switch(t.lagUnit){case"hour":u=t.lag*24;break;case"week":u=t.lag/7;break;case"month":u=t.lag/30;break}r+=`${y}${Math.round(u)}${a}`}return r}function rr(t){return{FS:"e2s",SS:"s2s",FF:"e2e",SF:"s2e"}[t]}const He=t=>t?{popover:{backgroundColor:t.popoverBackground||"#fff",borderColor:t.popoverBorderColor||"#f0f0f0",borderRadius:t.popoverBorderRadius||"8px",boxShadow:t.popoverShadow||"0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05)",padding:t.popoverPadding||"0",fontFamily:t.popoverFontFamily||t.fontFamily||"inherit",fontSize:t.popoverFontSize||t.fontSize||"14px"},modal:{backgroundColor:t.modalBackground||"#fff",borderRadius:t.modalBorderRadius||"8px",borderColor:t.modalBorderColor||"#f0f0f0",boxShadow:t.modalShadow||"0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05)"},buttonPrimary:{backgroundColor:t.buttonPrimaryBackground||"#1677ff",color:t.buttonPrimaryColor||"#fff",borderRadius:t.buttonPrimaryBorderRadius||"6px",fontWeight:t.buttonPrimaryFontWeight||400,fontFamily:t.buttonPrimaryFontFamily||t.fontFamily||"inherit",boxShadow:"0 2px 0 rgba(5, 145, 255, 0.1)"},buttonDanger:{backgroundColor:t.buttonDangerBackground||"#ff4d4f",color:t.buttonDangerColor||"#fff",borderRadius:t.buttonPrimaryBorderRadius||"6px",boxShadow:"0 2px 0 rgba(255, 38, 5, 0.06)"},buttonSecondary:{backgroundColor:t.buttonSecondaryBackground||"transparent",color:t.buttonSecondaryColor||"rgba(0, 0, 0, 0.88)",borderColor:t.buttonSecondaryBorderColor||"#d9d9d9",borderRadius:t.buttonPrimaryBorderRadius||"6px",boxShadow:"0 2px 0 rgba(0, 0, 0, 0.02)"},input:{backgroundColor:t.inputBackground,borderColor:t.inputBorderColor,borderRadius:t.inputBorderRadius||"6px",fontFamily:t.inputFontFamily||t.fontFamily||"inherit",fontSize:t.inputFontSize||t.fontSize||"14px"},listItem:{hoverBackground:t.listItemHoverBackground||"#f5f5f5",selectedBackground:t.listItemSelectedBackground||"#e6f4ff",borderColor:t.listItemBorderColor||"#f0f0f0"},badge:{backgroundColor:t.badgeBackground||"#e6f4ff",borderColor:t.badgeBorderColor||"transparent",color:t.badgeColor||"#1677ff",fontSize:t.badgeFontSize||"12px",padding:t.badgePadding||"0 7px",borderRadius:t.badgeBorderRadius||"10px"},link:{color:t.linkColor||"#1677ff",hoverColor:t.linkHoverColor||"#69b1ff",fontWeight:t.linkFontWeight||400},font:{fontFamily:t.fontFamily||"inherit",fontSize:t.fontSize||"14px",fontWeight:t.fontWeight||400,lineHeight:t.lineHeight||1.5714285714285714,color:t.fontColor||"rgba(0, 0, 0, 0.88)"}}:{},{Text:Le,Paragraph:nr}=h.Typography,{Option:Ce}=h.Select,or=({task:t,allTasks:s,links:o,onAddDependency:i,onRemoveDependency:r,children:y,styleConfig:g})=>{const a=He(g),[u,b]=w.useState(!1),[c,j]=w.useState(null),[T,p]=w.useState("e2s"),[f,l]=w.useState("lag"),[E,M]=w.useState(0),[k,F]=w.useState(!0),W="day",V=o.find(P=>P.target===t.id),U=!!V,me=w.useMemo(()=>s.length===0?new Date:new Date(Math.min(...s.map(P=>P.start.getTime()))),[s]),v=()=>{if(c){const P=f==="lag"?E:-E,oe=gt(P,W);i(c,t.id,T,oe),b(!1),A()}},A=()=>{j(null),p("e2s"),l("lag"),M(0)},G=()=>{V&&r&&(r(V.id),b(!1),A())};w.useEffect(()=>{if(u&&(F(!0),V)){j(V.source),p(V.type);const P=V.lag||0;P>=0?(l("lag"),M(P)):(l("lead"),M(Math.abs(P)))}},[u,V]);const B=()=>{if(!k)return null;const P=T==="e2s",oe=T==="s2s",le=T==="e2e",ge=T==="s2e";let J=0,H=0,xe="",ue=0,pe=-1;P?(J=50,H=350,ue=250,pe=350,xe="M 250 60 L 300 60 L 300 140 L 348 140"):le?(J=100,H=100,ue=300,pe=-1,xe="M 300 60 L 350 60 L 350 140 L 302 140"):oe?(J=250,H=250,ue=250,pe=-1,xe="M 250 60 L 200 60 L 200 140 L 248 140"):ge&&(J=350,H=50,ue=350,pe=250,xe="M 350 60 L 300 60 L 300 140 L 252 140");const ve=c==="gantt-start-date",m=s.find(L=>L.id===c);return e.jsx("div",{style:{width:"100%",height:90,backgroundColor:"#fbfbfb",borderRadius:4,marginBottom:12,border:"1px solid #f0f0f0",position:"relative",overflow:"hidden",flexShrink:0},children:e.jsxs("svg",{viewBox:"0 0 600 200",style:{width:"100%",height:"100%"},preserveAspectRatio:"xMidYMid meet",children:[e.jsx("defs",{children:e.jsx("marker",{id:"arrowhead",markerWidth:"12",markerHeight:"9",refX:"12",refY:"4.5",orient:"auto",children:e.jsx("polygon",{points:"0 0, 12 4.5, 0 9",fill:"#8c8c8c"})})}),e.jsx("line",{x1:ue,x2:ue,y1:"0",y2:"200",stroke:"#f0f0f0",strokeDasharray:"3,3"}),pe!==-1&&e.jsx("line",{x1:pe,x2:pe,y1:"0",y2:"200",stroke:"#f0f0f0",strokeDasharray:"3,3"}),e.jsx("rect",{x:J,y:"35",width:"200",height:"50",rx:"4",fill:"#e6f4ff",stroke:"#91caff",strokeWidth:"2"}),e.jsx("text",{x:J+100,y:"66",fontSize:"15",textAnchor:"middle",fill:"#003a8c",fontWeight:"600",children:ve?"Start Date":m?`Stage ${s.indexOf(m)+1}`:"Predecessor"}),e.jsx("rect",{x:H,y:"115",width:"200",height:"50",rx:"4",fill:"#e6f4ff",stroke:"#91caff",strokeWidth:"2"}),e.jsxs("text",{x:H+100,y:"146",fontSize:"15",textAnchor:"middle",fill:"#003a8c",fontWeight:"600",children:["Stage ",s.indexOf(t)+1]}),e.jsx("path",{d:xe,fill:"none",stroke:"#8c8c8c",strokeWidth:"2.5",markerEnd:"url(#arrowhead)"})]})})},K=()=>{const P=c==="gantt-start-date",oe=s.find(H=>H.id===c);if(!c)return"Select a checklist from the list to see how it will relate to the current stage.";const le=s.indexOf(t)+1,ge=P?"Start Date":`Stage ${s.indexOf(oe)+1}`;let J="";switch(T){case"e2s":J=`Stage ${le} starts after ${ge} finishes`;break;case"s2s":J=`Stage ${le} starts when ${ge} starts`;break;case"e2e":J=`Stage ${le} finishes when ${ge} finishes`;break;case"s2e":J=`Stage ${le} finishes when ${ge} starts`;break}if(E>0){const H=`${E} ${W}${E>1?"s":""}`;f==="lag"?J+=` + ${H} delay`:J+=` - ${H} overlap`}return J+"."},ie=e.jsxs("div",{style:{width:550,backgroundColor:a.popover?.backgroundColor||"#fff",borderRadius:a.popover?.borderRadius||"8px",padding:"16px 20px",boxShadow:a.popover?.boxShadow,fontFamily:a.popover?.fontFamily},children:[e.jsx(Le,{strong:!0,style:{fontSize:"16px",display:"block",marginBottom:16,color:a.font?.color},children:"Add Dependency"}),e.jsxs("div",{style:{display:"flex",gap:12,marginBottom:14},children:[e.jsx("div",{style:{flex:1},children:e.jsxs(h.Select,{showSearch:!0,placeholder:"Select checklist",value:c,onChange:j,style:{width:"100%"},filterOption:(P,oe)=>{if(oe?.value==="gantt-start-date")return"start date".includes(P.toLowerCase());const le=s.find(J=>J.id===oe?.value);if(!le)return!1;const ge=s.indexOf(le)+1;return le.text.toLowerCase().includes(P.toLowerCase())||ge.toString().includes(P)},optionLabelProp:"label",children:[s.filter(P=>P.id!==t.id).map(P=>e.jsx(Ce,{value:P.id,label:P.text,children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",padding:"4px 0"},children:[e.jsxs(Le,{style:{fontSize:"13px"},children:[s.indexOf(P)+1,". ",P.text]}),e.jsxs(Le,{type:"secondary",style:{fontSize:"11px"},children:["Start: ",fe(P.start,"MMM D, YYYY")]})]})},P.id)),e.jsx(Ce,{value:"gantt-start-date",label:"Start Date",children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",padding:"4px 0",borderTop:"1px solid #f0f0f0",marginTop:"4px",paddingTop:"8px"},children:[e.jsx(Le,{style:{fontSize:"13px",fontWeight:600},children:"Start Date"}),e.jsx(Le,{type:"secondary",style:{fontSize:"11px"},children:fe(me,"MMM D, YYYY")})]})},"gantt-start-date")]})}),e.jsx("div",{style:{width:100},children:e.jsxs(h.Select,{value:T,onChange:p,style:{width:"100%"},children:[e.jsx(Ce,{value:"e2s",children:"FS"}),e.jsx(Ce,{value:"e2e",children:"FF"}),e.jsx(Ce,{value:"s2s",children:"SS"}),e.jsx(Ce,{value:"s2e",children:"SF"})]})})]}),e.jsxs("div",{style:{display:"flex",gap:12,marginBottom:14},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx(Le,{style:{fontSize:"12px",display:"block",marginBottom:6,color:a.font?.color},children:"Delay type"}),e.jsxs(h.Select,{value:f,onChange:l,style:{width:"100%"},children:[e.jsx(Ce,{value:"lag",children:"Lag by"}),e.jsx(Ce,{value:"lead",children:"Lead by"})]})]}),e.jsxs("div",{style:{flex:1},children:[e.jsx(Le,{style:{fontSize:"12px",display:"block",marginBottom:6,color:a.font?.color},children:"Days"}),e.jsx(h.InputNumber,{min:0,value:E,onChange:P=>M(P||0),style:{width:"100%"},placeholder:"0"})]})]}),e.jsx("div",{style:{backgroundColor:"#f5f5f5",padding:"10px 12px",borderRadius:"4px",marginBottom:14},children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px"},children:[e.jsx(Le,{style:{fontSize:"11px",color:a.font?.color},children:"FS: Finish to Start"}),e.jsx(Le,{style:{fontSize:"11px",color:a.font?.color},children:"SS: Start to Start"}),e.jsx(Le,{style:{fontSize:"11px",color:a.font?.color},children:"FF: Finish to Finish"}),e.jsx(Le,{style:{fontSize:"11px",color:a.font?.color},children:"SF: Start to Finish"})]})}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[e.jsx(Le,{strong:!0,style:{fontSize:"13px",color:a.font?.color},children:"Dependency preview"}),e.jsx("a",{onClick:()=>F(!k),style:{fontSize:"12px",color:"#1890ff",cursor:"pointer",textDecoration:"none"},children:k?"Hide preview":"Show preview"})]}),k&&e.jsxs(e.Fragment,{children:[B(),e.jsx(nr,{style:{fontSize:"12px",color:a.font?.color||"#262626",marginBottom:14,lineHeight:"1.5"},children:K()})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:10},children:[U&&e.jsx(h.Button,{danger:!0,onClick:G,style:{...a.buttonDanger},children:"Remove Dependency"}),e.jsx(h.Button,{type:"primary",onClick:v,disabled:!c,style:{...a.buttonPrimary,minWidth:100},children:U?"Update":"Add"})]})]});return e.jsx(h.Popover,{content:ie,trigger:"click",open:u,onOpenChange:b,placement:"bottomLeft",overlayClassName:"dependency-popover",overlayInnerStyle:{padding:0},children:y})},bt=w.memo(w.forwardRef(({tasks:t,allTasks:s=[],columns:o,selectedTask:i,onTaskClick:r,onTaskContextMenu:y,onTaskUpdate:g,onTaskDragStart:a,onAddTask:u,onAddDependency:b,onRemoveDependency:c,links:j=[],dropIndicator:T,reorderTask:p,styleConfig:f},l)=>{const E=w.useRef(null);w.useImperativeHandle(l,()=>E.current);const[M,k]=w.useState(null),[F,W]=w.useState(0),V=(v,A=0)=>{if(!v.parent)return A;const G=t.find(B=>B.id===v.parent);return G?V(G,A+1):A},U=(v,A)=>{if(A===v.duration)return;const G=he(new Date(v.start),A,"day");g?.({...v,duration:A,end:G})},me=(v,A)=>{if(A.template)return A.template(v);switch(A.name){case"text":{const G=V(v);return e.jsxs("div",{className:"gantt-grid-cell-text",style:{paddingLeft:G*14},children:[e.jsx("div",{className:"gantt-row-drag-handle",onMouseDown:B=>{B.preventDefault(),a?.(v.id,B.clientX,B.clientY,"reorder")},children:e.jsx(ne.FontAwesomeIcon,{icon:q.faGripVertical})}),v.type==="project"?e.jsx("span",{className:"gantt-tree-icon",onClick:B=>{B.stopPropagation(),g?.({...v,open:!v.open})},children:e.jsx(ne.FontAwesomeIcon,{icon:v.open?q.faChevronDown:q.faChevronRight})}):e.jsx("span",{style:{width:16,display:"inline-block"}}),e.jsx("span",{className:"gantt-task-name-text",children:v.text})]})}case"start":return fe(v.start,"DD-MM-YYYY");case"end":return fe(v.end,"DD-MM-YYYY");case"duration":return M===v.id?e.jsx(h.InputNumber,{size:"small",min:1,value:F,onChange:B=>W(B||1),onBlur:()=>{U(v,F),k(null)},onPressEnter:()=>{U(v,F),k(null)},autoFocus:!0,style:{width:"100%",fontSize:"12px"}}):e.jsxs("div",{onClick:B=>{B.stopPropagation(),k(v.id),W(v.duration)},style:{backgroundColor:"#fff7e6",padding:"2px 8px",borderRadius:"4px",border:"1px solid #ffd591",fontWeight:400,color:"#d46b08",display:"inline-block",fontSize:"12px",cursor:"text"},children:[v.duration," day",v.duration!==1?"s":""]});case"predecessors":{const B=j.filter(K=>K.target===v.id)[0];return e.jsx(or,{task:v,allTasks:s,links:j,onAddDependency:(K,ie,P,oe)=>b?.(K,ie,P,oe),onRemoveDependency:K=>c?.(K),styleConfig:f,children:e.jsx("div",{style:{cursor:"pointer",minHeight:"24px",width:"100%",display:"flex",alignItems:"center",gap:"4px"},children:B?(()=>{const K=s.find(P=>P.id===B.source),ie=K?s.indexOf(K)+1:0;return e.jsx("span",{style:{fontSize:"12px",backgroundColor:"#e6f4ff",border:"1px solid #91caff",color:"#1677ff",padding:"0 7px",borderRadius:"4px",whiteSpace:"nowrap"},children:tr(B,ie)})})():e.jsx("span",{style:{fontSize:"12px",color:"#1890ff",textDecoration:"none",fontWeight:500},onMouseEnter:K=>K.currentTarget.style.textDecoration="underline",onMouseLeave:K=>K.currentTarget.style.textDecoration="none",children:"Add"})})})}case"add":return e.jsx(h.Button,{type:"primary",size:"small",icon:e.jsx(ne.FontAwesomeIcon,{icon:q.faPlus,style:{fontSize:12}}),onClick:G=>{G.stopPropagation(),u?.(v.id)},title:"Add Subtask",style:{minWidth:"28px",width:"28px",height:"28px",padding:0,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px"}});case"progress":return e.jsxs("div",{className:"gantt-progress-cell",children:[e.jsx("div",{className:"gantt-progress-bar-bg",children:e.jsx("div",{className:"gantt-progress-bar-fill",style:{width:`${v.progress}%`}})}),e.jsxs("span",{className:"gantt-progress-text",children:[v.progress,"%"]})]});case"index":return e.jsx("span",{style:{color:"#8c8c8c"},children:s.indexOf(v)+1});default:return v[A.name]||""}};return e.jsxs("div",{className:"gantt-grid",ref:E,children:[e.jsx("div",{className:"gantt-grid-header",style:{display:"flex",minWidth:"100%"},children:o.map(v=>e.jsx("div",{className:"gantt-grid-header-cell",style:{width:v.width,minWidth:v.width,justifyContent:v.align==="center"?"center":"flex-start"},children:v.name==="add"?e.jsx("span",{style:{fontSize:11,color:"#64748b",fontWeight:600,whiteSpace:"nowrap"},children:"Add"}):e.jsxs(e.Fragment,{children:[v.label,v.name==="start"&&e.jsx(ne.FontAwesomeIcon,{icon:q.faChevronDown,style:{marginLeft:8,fontSize:10,color:"#64748b"}})]})},v.name))}),e.jsx("div",{className:"gantt-grid-body",children:t.map(v=>{const A=p?.id===v.id,G=p?.descendantIds.includes(v.id);return e.jsxs("div",{className:`gantt-grid-row ${i===v.id?"selected":""} ${A?"dragging-row":""} ${G?"descendant-dragging-row":""} ${T?.taskId===v.id?`drop-target-${T.position}`:""}`,onClick:()=>r(v.id),onContextMenu:B=>y?.(B,v.id),style:{display:"flex",minWidth:"100%"},children:[o.map(B=>{const K=B.name==="add";return e.jsx("div",{className:"gantt-grid-cell",style:{width:B.width,minWidth:B.width,textAlign:B.align||"left",display:"flex",alignItems:"center",justifyContent:K?"center":B.name==="text"?"flex-start":B.align==="center"?"center":B.align==="right"?"flex-end":"flex-start",visibility:"visible",opacity:1},children:me(v,B)},`${v.id}-${B.name}`)}),T?.taskId===v.id&&e.jsx("div",{className:`gantt-drop-indicator ${T.position}`})]},v.id)})})]})}));bt.displayName="Grid";const Nt=({task:t,position:s,selected:o,dragging:i,onClick:r,onDragStart:y,dragDeltaX:g=0,dragType:a=null,readonly:u=!1})=>{const b=(f,l)=>{u||(f.preventDefault(),f.stopPropagation(),y(f.clientX,f.clientY,l))},c=()=>{const f=["gantt-task-bar"];return t.type==="milestone"&&f.push("milestone"),t.type==="project"&&f.push("project"),o&&f.push("selected"),i&&f.push("dragging"),t.status&&f.push(`status-${t.status}`),f.join(" ")},j=()=>{let f=s.left,l=s.width;return i&&a&&(a==="move"?f+=g:a==="resize-left"?(f+=g,l-=g):a==="resize-right"&&(l+=g)),{left:`${f}px`,width:`${Math.max(l,0)}px`,backgroundColor:t.color||void 0}},T=(f=!1)=>e.jsxs(e.Fragment,{children:[!u&&!f&&e.jsx("div",{className:"gantt-task-resize-handle gantt-task-resize-left",onMouseDown:l=>b(l,"resize-left")}),!f&&t.type!=="milestone"&&e.jsx("div",{className:"gantt-task-progress",style:{width:`${t.progress}%`}}),e.jsx("div",{className:"gantt-task-content",children:!f&&e.jsx("span",{className:"gantt-task-text",children:t.text})}),!u&&!f&&e.jsx("div",{className:"gantt-task-resize-handle gantt-task-resize-right",onMouseDown:l=>b(l,"resize-right")})]}),p=e.jsxs("div",{className:"gantt-tooltip",children:[e.jsx("div",{className:"gantt-tooltip-title",children:t.text}),e.jsxs("div",{className:"gantt-tooltip-dates",children:[fe(t.start,"MMM D")," - ",fe(t.end,"MMM D")]}),e.jsxs("div",{className:"gantt-tooltip-progress",children:["Progress: ",t.progress,"%"]}),t.owner&&e.jsxs("div",{className:"gantt-tooltip-owner",children:["Owner: ",t.owner]})]});if(t.segments&&t.segments.length>0||t.onHoldPeriods&&t.onHoldPeriods.length>0){const f=t.end.getTime()-t.start.getTime();return e.jsxs("div",{className:"gantt-task-group",children:[t.onHoldPeriods?.map((l,E)=>e.jsx("div",{className:"gantt-on-hold-period",style:{left:`${s.left+(l.start.getTime()-t.start.getTime())/f*s.width}px`,width:`${(l.end.getTime()-l.start.getTime())/f*s.width}px`}},`hold-${E}`)),t.segments?.map((l,E)=>e.jsx(h.Tooltip,{title:p,mouseEnterDelay:.5,children:e.jsx("div",{className:c()+" segment",style:{left:`${s.left+(l.start.getTime()-t.start.getTime())/f*s.width}px`,width:`${(l.end.getTime()-l.start.getTime())/f*s.width}px`,backgroundColor:t.color||void 0},onClick:r,onMouseDown:M=>b(M,"move"),children:T(!0)})},`seg-${E}`))]})}return e.jsx(h.Tooltip,{title:p,mouseEnterDelay:.5,children:e.jsx("div",{className:c(),style:j(),onClick:r,onMouseDown:f=>b(f,"move"),children:T()})})},ar=({links:t,tasks:s,getTaskPosition:o})=>{const i=a=>s.find(u=>u.id===a),r=w.useMemo(()=>{let a=0,u=0;return s.forEach(b=>{try{const c=o(b);c&&typeof c.left=="number"&&typeof c.width=="number"&&(a=Math.max(a,c.left+c.width)),c&&typeof c.top=="number"&&typeof c.height=="number"&&(u=Math.max(u,c.top+c.height))}catch(c){console.warn("Failed to position task for link rendering:",b.id,c)}}),{width:Math.max(a,1e3),height:Math.max(u,100)}},[s,o]),y=a=>{const u=i(a.source),b=i(a.target);if(!u||!b)return"";const c=o(u),j=o(b),T=c.top+c.height/2,p=j.top+j.height/2;let f=0,l=0;switch(a.type){case"e2s":f=c.left+c.width,l=j.left;break;case"s2s":f=c.left,l=j.left;break;case"e2e":f=c.left+c.width,l=j.left+j.width;break;case"s2e":f=c.left,l=j.left+j.width;break}const E=l-f,M=p-T,k=20;if(a.type==="e2s")if(E>=k){const F=f+E/2;return`M ${f},${T} L ${F},${T} L ${F},${p} L ${l},${p}`}else{const F=k/2,W=T+M/2;return`M ${f},${T} L ${f+F},${T} L ${f+F},${W} L ${l-F},${W} L ${l-F},${p} L ${l},${p}`}else if(a.type==="s2s"){const F=Math.min(f,l)-k/2;return`M ${f},${T} L ${F},${T} L ${F},${p} L ${l},${p}`}else if(a.type==="e2e"){const F=Math.max(f,l)+k/2;return`M ${f},${T} L ${F},${T} L ${F},${p} L ${l},${p}`}else if(a.type==="s2e")if(E<=-k){const F=f+E/2;return`M ${f},${T} L ${F},${T} L ${F},${p} L ${l},${p}`}else{const F=k/2,W=T+M/2;return`M ${f},${T} L ${f-F},${T} L ${f-F},${W} L ${l+F},${W} L ${l+F},${p} L ${l},${p}`}return""},g=a=>{const u=i(a.target);if(!u)return"";const b=o(u),c=b.top+b.height/2,j=8,T=6;let p=0,f=!0;return a.type==="e2s"||a.type==="s2s"?(p=b.left,f=!0):(p=b.left+b.width,f=!1),f?`M ${p},${c} L ${p-j},${c-T/2} L ${p-j},${c+T/2} Z`:`M ${p},${c} L ${p+j},${c-T/2} L ${p+j},${c+T/2} Z`};return t.length===0?null:e.jsx("svg",{className:"gantt-links-layer",style:{overflow:"visible",width:r.width,height:r.height,position:"absolute",top:0,left:0,pointerEvents:"none"},children:t.map(a=>{const u=i(a.source),b=i(a.target);if(!u||!b)return null;const c=y(a),j=g(a);return!c||!j?null:e.jsxs("g",{className:"gantt-link",children:[e.jsx("path",{d:c,fill:"none",strokeWidth:"1.5",className:"gantt-link-line"}),e.jsx("path",{d:j,className:"gantt-link-arrow"})]},a.id)})})},sr=(t,s,o=60,i="day",r=1)=>{const[y,g]=w.useState({taskId:null,initialX:0,initialY:0,initialStart:new Date,initialEnd:new Date,type:null,dragDeltaX:0,dragDeltaY:0}),a=w.useCallback((c,j,T,p)=>{const f=t.find(l=>l.id===c);f&&g({taskId:c,initialX:j,initialY:T,initialStart:new Date(f.start),initialEnd:new Date(f.end),type:p,dragDeltaX:0,dragDeltaY:0})},[t]),u=w.useCallback((c,j)=>{if(!y.taskId||!y.type)return null;const T=c-y.initialX,p=j-y.initialY;if(g(F=>({...F,dragDeltaX:T,dragDeltaY:p})),y.type==="reorder")return null;const f=t.find(F=>F.id===y.taskId);if(!f)return null;const l=Math.round(T/o);let E=new Date(y.initialStart),M=new Date(y.initialEnd);switch(y.type){case"move":E=he(y.initialStart,l*r,i),M=he(y.initialEnd,l*r,i);break;case"resize-left":E=he(y.initialStart,l*r,i),E>=M&&(E=he(M,-r,i));break;case"resize-right":M=he(y.initialEnd,l*r,i),M<=E&&(M=he(E,r,i));break}const k=tt(E,M);return{...f,start:E,end:M,duration:k}},[y,t,o,r,i]),b=w.useCallback(c=>{if(c&&s){const{id:j,...T}=c;s(j,T)}g({taskId:null,initialX:0,initialY:0,initialStart:new Date,initialEnd:new Date,type:null,dragDeltaX:0,dragDeltaY:0})},[s]);return{dragState:y,handleDragStart:a,handleDrag:u,handleDragEnd:b}},wt=w.forwardRef(({tasks:t,links:s,range:o,scales:i,config:r,selectedTask:y,onTaskClick:g,onTaskDragStart:a,onTaskDragEnd:u,onTaskUpdate:b,zoomLevel:c,baselines:j},T)=>{const[p,f]=w.useState(t),l=(r.columnWidth||60)*c,E=r.baselines&&j&&j.size>0,{dragState:M,handleDragStart:k,handleDrag:F,handleDragEnd:W}=sr(p,b,l,i[1].unit,i[1].step);w.useEffect(()=>{(t.length!==p.length||t.some((L,C)=>{const O=p[C];return!O||L.id!==O.id||L.start.getTime()!==O.start.getTime()||L.end.getTime()!==O.end.getTime()}))&&f(t)},[t]);const V=w.useCallback(m=>{const L=[];let C=new Date(o.start);for(;C<=o.end;)L.push({date:new Date(C),label:fe(C,m.format||"D")}),C=he(C,m.step,m.unit);return L},[o.start,o.end]),U=w.useCallback(m=>{const L=i[1],C=o.start.getTime(),te=m.getTime()-C,re={hour:36e5,day:864e5,week:6048e5,month:2592e6,quarter:7776e6,year:31536e6}[L.unit]||864e5;return te/(re*L.step)*l},[i,o.start,l]),me=m=>{const L=U(m.start),C=U(m.end);return{left:L,width:Math.max(C-L,0)}},v=m=>{const L=U(m.start),C=U(m.end);return{left:L,width:Math.max(C-L,0)}},A=m=>{const L=me(m),C=p.findIndex(re=>re.id===m.id),O=r.rowHeight||48,te=32,Q=(O-te)/2;return{left:L.left,width:L.width,top:C*O+Q,height:te}},G=w.useRef(null),B=w.useCallback(m=>{M.taskId&&M.type&&(G.current&&cancelAnimationFrame(G.current),G.current=requestAnimationFrame(()=>{const L=F(m.clientX,m.clientY);L&&f(C=>C.map(O=>O.id===L.id?L:O))}))},[M,F]),K=w.useCallback(()=>{if(M.taskId){const m=p.find(L=>L.id===M.taskId);W(m||null),u()}},[M,p,W,u]),ie=i[1],P=w.useMemo(()=>V(ie),[V,ie]),oe=w.useCallback(()=>{const m=[];let L=-1,C=-1,O=0,te="";return P.forEach(Q=>{const re=Q.date.getMonth(),de=Q.date.getFullYear(),Se=fe(Q.date,"MMM YYYY");re!==L||de!==C?(L!==-1&&m.push({label:te,width:O}),L=re,C=de,O=l,te=Se):O+=l}),L!==-1&&m.push({label:te,width:O}),m},[P,l]),le=w.useCallback(()=>{const m=[];let L=-1,C=0,O=-1,te=-1,Q="";return P.forEach(re=>{const Se=re.date.getDate()<=15?0:1,Ae=re.date.getMonth(),Re=re.date.getFullYear(),Me=fe(re.date,"MMM"),$e=new Date(Re,Ae+1,0).getDate(),Ye=Se===0?`${Me} 1 - 15`:`${Me} 16 - ${$e}`;Se!==L||Ae!==O||Re!==te?(L!==-1&&m.push({label:Q,width:C}),L=Se,O=Ae,te=Re,C=l,Q=Ye):C+=l}),L!==-1&&m.push({label:Q,width:C}),m},[P,l]),ge=w.useMemo(()=>oe(),[oe]),J=w.useMemo(()=>le(),[le]),H=w.useMemo(()=>P.length*l,[P.length,l]),xe=w.useMemo(()=>{const m=new Date;return m.setHours(0,0,0,0),m},[]),ue=w.useMemo(()=>{if(!r.showTodayLine)return null;const m=U(xe);return m>=-l&&m<=H+l?Math.max(0,Math.min(m,H)):null},[r.showTodayLine,xe,H,l,U]),pe=w.useMemo(()=>{if(r.projectStartDate)return Ie(r.projectStartDate);if(t.length>0){const m=t.map(L=>L.start.getTime());return Ie(new Date(Math.min(...m)))}return null},[r.projectStartDate,t]),ve=w.useMemo(()=>{if(!r.showProjectStartLine||!pe)return null;const m=U(pe);return m>=-l&&m<=H+l?Math.max(0,Math.min(m,H)):null},[r.showProjectStartLine,pe,H,l,U]);return e.jsxs("div",{className:"gantt-timeline-container",ref:T,onMouseMove:B,onMouseUp:K,style:{width:H,position:"relative"},children:[e.jsxs("div",{className:"gantt-timeline-header",style:{width:H,minWidth:H,position:"relative"},children:[ue!==null&&r.showTodayLine&&r.todayLineLabel&&r.todayLineLabel!==""&&e.jsx("div",{className:"gantt-today-line-label",style:{position:"absolute",top:"calc(var(--gantt-scale-height, 24px) * 2)",left:`${ue}px`,transform:"translateX(-50%)",backgroundColor:r.todayLineColor||"#ff4d4f",color:"#ffffff",padding:"4px 10px",borderRadius:"4px",fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 2px 6px rgba(0, 0, 0, 0.2)",lineHeight:"1.2",zIndex:101,pointerEvents:"none",...r.todayLineLabelStyle},children:r.todayLineLabel}),ve!==null&&r.showProjectStartLine&&r.projectStartLineLabel&&r.projectStartLineLabel!==""&&e.jsx("div",{className:"gantt-project-start-line-label",style:{position:"absolute",top:"calc(var(--gantt-scale-height, 24px) * 2)",left:`${ve}px`,transform:"translateX(-50%)",backgroundColor:r.projectStartLineColor||"#40a9ff",color:"#ffffff",padding:"4px 10px",borderRadius:"4px",fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 2px 6px rgba(0, 0, 0, 0.2)",lineHeight:"1.2",zIndex:101,pointerEvents:"none",...r.projectStartLineLabelStyle},children:r.projectStartLineLabel}),e.jsx("div",{className:"gantt-timeline-scale gantt-timeline-scale-month",style:{width:H},children:ge.map((m,L)=>e.jsx("div",{className:"gantt-timeline-cell",style:{width:m.width,minWidth:m.width,maxWidth:m.width,borderRight:L===ge.length-1?"none":"var(--wx-gantt-border)"},children:m.label},`top-${L}`))}),e.jsx("div",{className:"gantt-timeline-scale gantt-timeline-scale-range",style:{width:H},children:J.map((m,L)=>e.jsx("div",{className:"gantt-timeline-cell",style:{width:m.width,minWidth:m.width,maxWidth:m.width,borderRight:L===J.length-1?"none":"var(--wx-gantt-border)"},children:m.label},`mid-${L}`))}),e.jsx("div",{className:"gantt-timeline-scale gantt-timeline-scale-day",style:{width:H},children:P.map((m,L)=>{const C=r.weekends&&xt(m.date),O=r.holidays&&yt(m.date,r.holidays);return e.jsx("div",{className:`gantt-timeline-cell ${C?"weekend":""} ${O?"holiday":""}`,style:{width:l,minWidth:l,maxWidth:l,borderRight:L===P.length-1?"none":"var(--wx-gantt-border)"},children:m.label},`day-${L}`)})})]}),e.jsxs("div",{className:"gantt-timeline-body",style:{width:H,position:"relative"},children:[ue!==null&&e.jsxs(e.Fragment,{children:[r.showTodayLineMarker!==!1&&(()=>{const m=r.todayLineMarkerSize||8,L=r.todayLineColor||"#ff4d4f",C=r.todayLineMarkerStyle||"triangle",O=r.todayLineOpacity!==void 0?r.todayLineOpacity:1;return C==="triangle"?e.jsx("div",{className:"gantt-today-line-marker",style:{position:"absolute",left:`${ue}px`,top:"-4px",transform:"translateX(-50%)",width:0,height:0,borderLeft:`${m}px solid transparent`,borderRight:`${m}px solid transparent`,borderBottom:`${m}px solid ${L}`,zIndex:7,pointerEvents:"none",opacity:O}}):C==="arrow"?e.jsx("div",{className:"gantt-today-line-marker",style:{position:"absolute",left:`${ue}px`,top:"-6px",transform:"translateX(-50%)",width:0,height:0,borderLeft:`${m}px solid transparent`,borderRight:`${m}px solid transparent`,borderBottom:`${m*.7}px solid ${L}`,zIndex:7,pointerEvents:"none",opacity:O}}):C==="dot"?e.jsx("div",{className:"gantt-today-line-marker",style:{position:"absolute",left:`${ue}px`,top:`-${m/2}px`,transform:"translateX(-50%)",width:`${m}px`,height:`${m}px`,borderRadius:"50%",backgroundColor:L,zIndex:7,pointerEvents:"none",opacity:O}}):null})(),e.jsx("div",{className:"gantt-today-line",style:{position:"absolute",left:`${ue}px`,top:0,bottom:0,width:`${r.todayLineWidth||1}px`,backgroundColor:r.todayLineColor||"#ff4d4f",opacity:r.todayLineOpacity!==void 0?r.todayLineOpacity:1,borderLeft:r.todayLineStyle==="dashed"?`${r.todayLineWidth||1}px dashed ${r.todayLineColor||"#ff4d4f"}`:r.todayLineStyle==="dotted"?`${r.todayLineWidth||1}px dotted ${r.todayLineColor||"#ff4d4f"}`:"none",zIndex:6,pointerEvents:"none"}})]}),ve!==null&&e.jsxs(e.Fragment,{children:[r.showProjectStartLineMarker!==!1&&(()=>{const m=r.projectStartLineMarkerSize||8,L=r.projectStartLineColor||"#40a9ff",C=r.projectStartLineMarkerStyle||"triangle",O=r.projectStartLineOpacity!==void 0?r.projectStartLineOpacity:1;return C==="triangle"?e.jsx("div",{className:"gantt-project-start-line-marker",style:{position:"absolute",left:`${ve}px`,top:"-4px",transform:"translateX(-50%)",width:0,height:0,borderLeft:`${m}px solid transparent`,borderRight:`${m}px solid transparent`,borderBottom:`${m}px solid ${L}`,zIndex:7,pointerEvents:"none",opacity:O}}):C==="arrow"?e.jsx("div",{className:"gantt-project-start-line-marker",style:{position:"absolute",left:`${ve}px`,top:"-6px",transform:"translateX(-50%)",width:0,height:0,borderLeft:`${m}px solid transparent`,borderRight:`${m}px solid transparent`,borderBottom:`${m*.7}px solid ${L}`,zIndex:7,pointerEvents:"none",opacity:O}}):C==="dot"?e.jsx("div",{className:"gantt-project-start-line-marker",style:{position:"absolute",left:`${ve}px`,top:`-${m/2}px`,transform:"translateX(-50%)",width:`${m}px`,height:`${m}px`,borderRadius:"50%",backgroundColor:L,zIndex:7,pointerEvents:"none",opacity:O}}):null})(),e.jsx("div",{className:"gantt-project-start-line",style:{position:"absolute",left:`${ve}px`,top:0,bottom:0,width:`${r.projectStartLineWidth||1}px`,backgroundColor:r.projectStartLineColor||"#40a9ff",opacity:r.projectStartLineOpacity!==void 0?r.projectStartLineOpacity:1,borderLeft:r.projectStartLineStyle==="dashed"?`${r.projectStartLineWidth||1}px dashed ${r.projectStartLineColor||"#40a9ff"}`:r.projectStartLineStyle==="dotted"?`${r.projectStartLineWidth||1}px dotted ${r.projectStartLineColor||"#40a9ff"}`:"none",zIndex:6,pointerEvents:"none"}})]}),e.jsx("div",{className:"gantt-timeline-grid",children:P.map((m,L)=>{const C=r.weekends&&xt(m.date),O=r.holidays&&yt(m.date,r.holidays);return e.jsx("div",{className:`gantt-timeline-grid-column ${C?"weekend":""} ${O?"holiday":""}`,style:{width:l,minWidth:l}},L)})}),s.length>0&&e.jsx(ar,{links:s,tasks:p,getTaskPosition:A}),e.jsx("div",{className:"gantt-timeline-tasks",style:{width:H},children:p.map(m=>{const L=me(m),C=E?j?.get(m.id):void 0,O=C?v(C):void 0;return e.jsxs("div",{className:"gantt-timeline-row",children:[C&&O&&e.jsx("div",{className:`gantt-baseline-bar ${m.type==="milestone"?"milestone":""}`,style:{left:`${O.left}px`,width:`${O.width}px`},title:`Baseline: ${C.start.toLocaleDateString()} - ${C.end.toLocaleDateString()}`}),e.jsx(Nt,{task:m,position:L,selected:y===m.id,dragging:M.taskId===m.id,dragDeltaX:M.dragDeltaX,dragType:M.type,onClick:()=>g(m.id),onDragStart:(te,Q,re)=>{k(m.id,te,Q,re),a(m.id,te,Q)},readonly:r.readonly})]},m.id)})})]})]})});wt.displayName="Timeline";const vt=w.forwardRef((t,s)=>e.jsx("div",{className:"gantt-chart-wrapper",style:{flex:1,minWidth:0},children:e.jsx(wt,{...t,ref:s})}));vt.displayName="Chart";const{Search:ir}=h.Input,At=({onFilterChange:t,owners:s=[],uiConfig:o={}})=>{const[i,r]=w.useState({searchText:"",status:"all",priority:"all",owner:""}),y=u=>{const b={...i,...u};r(b),t(b)},g=()=>{const u={searchText:"",status:"all",priority:"all",owner:""};r(u),t(u)},a=i.searchText!==""||i.status!=="all"||i.priority!=="all"||i.owner!=="";return e.jsx("div",{className:"gantt-filter-container",children:e.jsxs("div",{className:"gantt-filter-bar",children:[e.jsx("div",{className:"gantt-filter-left",children:e.jsx(ir,{placeholder:o.searchPlaceholder||"Search stages...",value:i.searchText,onChange:u=>y({searchText:u.target.value}),allowClear:!0,className:"gantt-search-antd",style:{width:250}})}),e.jsxs("div",{className:"gantt-filter-right",children:[e.jsx(h.Select,{value:i.status,onChange:u=>y({status:u}),className:"gantt-filter-select-antd",style:{width:140},options:[{value:"all",label:o.statusOptions?.all||"All Status"},{value:"not-started",label:o.statusOptions?.notStarted||"Not Started"},{value:"in-progress",label:o.statusOptions?.inProgress||"In Progress"},{value:"completed",label:o.statusOptions?.completed||"Completed"}]}),e.jsx(h.Select,{value:i.priority,onChange:u=>y({priority:u}),className:"gantt-filter-select-antd",style:{width:130},options:[{value:"all",label:o.priorityFilterOptions?.all||"All Priority"},{value:"low",label:o.priorityFilterOptions?.low||"Low"},{value:"medium",label:o.priorityFilterOptions?.medium||"Medium"},{value:"high",label:o.priorityFilterOptions?.high||"High"}]}),e.jsx(h.Select,{value:i.owner||void 0,onChange:u=>y({owner:u||""}),className:"gantt-filter-select-antd",style:{width:130},placeholder:o.allOwnersText||"All Owners",allowClear:!0,options:[{value:"",label:o.allOwnersText||"All Owners"},...(s||[]).map(u=>({value:u,label:u}))]}),a&&e.jsx(h.Button,{type:"default",danger:!0,icon:e.jsx(ne.FontAwesomeIcon,{icon:q.faTimesCircle}),onClick:g,className:"gantt-filter-clear-antd",children:o.clearFiltersText||"Clear"})]})]})})},Ne=(t,s)=>t?typeof t=="string"?e.jsx(ne.FontAwesomeIcon,{icon:s}):t:e.jsx(ne.FontAwesomeIcon,{icon:s}),Bt=({zoomLevel:t,setZoomLevel:s,onExport:o,onFilterChange:i,owners:r,onAddTask:y,uiConfig:g,iconConfig:a={},styleConfig:u})=>{const b=He(u),c=g.showZoomButtons!==!1,j=g.showExportButtons!==!1,T=c&&j;return e.jsxs("div",{className:"gantt-toolbar-wrapper",children:[e.jsxs("div",{className:"gantt-toolbar",children:[e.jsx("div",{className:"gantt-toolbar-left",children:e.jsx(h.Space,{size:8,children:g.showAddTaskButton!==!1&&e.jsx(h.Button,{type:"primary",icon:Ne(a.addTask,q.faPlus),onClick:()=>y?.(),style:b.buttonPrimary,children:g.addTaskButtonText||"New Stage"})})}),e.jsx("div",{className:"gantt-toolbar-right",children:e.jsxs(h.Space,{size:4,children:[c&&e.jsxs(e.Fragment,{children:[e.jsx(h.Tooltip,{title:g.zoomOutTooltip||"Zoom Out",children:e.jsx(h.Button,{icon:Ne(a.zoomOut,q.faSearchMinus),onClick:()=>s(Math.max(.5,t-.25)),style:b.buttonSecondary})}),e.jsx(h.Tooltip,{title:g.zoomInTooltip||"Zoom In",children:e.jsx(h.Button,{icon:Ne(a.zoomIn,q.faSearchPlus),onClick:()=>s(Math.min(2,t+.25)),style:b.buttonSecondary})}),e.jsx(h.Tooltip,{title:g.resetZoomTooltip||"Reset Zoom",children:e.jsx(h.Button,{icon:Ne(a.resetZoom,q.faRotateLeft),onClick:()=>s(1),style:b.buttonSecondary})})]}),T&&e.jsx(h.Divider,{type:"vertical",style:{height:24,margin:"0 4px"}}),j&&e.jsxs(e.Fragment,{children:[e.jsx(h.Tooltip,{title:g.exportCSVTooltip||"Export to CSV",children:e.jsx(h.Button,{icon:Ne(a.exportCSV,q.faFileCsv),onClick:()=>o("csv"),style:b.buttonSecondary})}),e.jsx(h.Tooltip,{title:g.exportExcelTooltip||"Export to Excel",children:e.jsx(h.Button,{icon:Ne(a.exportExcel,q.faFileExcel),onClick:()=>o("excel"),style:b.buttonSecondary})}),e.jsx(h.Tooltip,{title:g.exportJSONTooltip||"Export to JSON",children:e.jsx(h.Button,{icon:Ne(a.exportJSON,q.faFileCode),onClick:()=>o("json"),style:b.buttonSecondary})}),e.jsx(h.Tooltip,{title:g.exportPDFTooltip||"Export to PDF",children:e.jsx(h.Button,{icon:Ne(a.exportPDF,q.faFilePdf),onClick:()=>o("pdf"),style:b.buttonSecondary})})]})]})})]}),g.showFilterSearch!==!1&&e.jsx(At,{onFilterChange:i,owners:r,uiConfig:g})]})},{Option:Ue}=h.Select,{TextArea:lr}=h.Input,_t=({onCreateTask:t,onClose:s,uiConfig:o={},parentId:i,parentTaskName:r,styleConfig:y})=>{const[g]=h.Form.useForm(),a=He(y),u=b=>{const c=b.start.toDate(),j=new Date(c);j.setDate(j.getDate()+(b.duration||1)),t({text:b.text,start:c,end:j,duration:b.duration||1,progress:b.progress||0,type:b.type,color:typeof b.color=="string"?b.color:b.color?.toHexString?.()||"#4A90E2",owner:b.owner||"",priority:b.priority||"medium",details:b.details||"",parent:i},i),s()};return e.jsx(h.Modal,{title:i?(o.taskCreatorTitle||"Create Checklist")+(r?` for "${r}"`:""):o.taskCreatorTitle||"Create New Stage",open:!0,onCancel:s,onOk:()=>g.submit(),okText:o.taskCreatorOkText||"Create Stage",cancelText:o.taskCreatorCancelText||"Cancel",width:600,className:"gantt-modal-antd",styles:{content:a.modal,header:{borderBottom:`1px solid ${a.modal?.borderColor||"#f0f0f0"}`,marginBottom:16}},okButtonProps:{style:a.buttonPrimary},cancelButtonProps:{style:a.buttonSecondary},children:e.jsxs(h.Form,{form:g,layout:"vertical",onFinish:u,initialValues:{type:"task",priority:"medium",start:$t(),duration:1,progress:0,color:"#4A90E2"},children:[e.jsx(h.Form.Item,{name:"text",label:o.taskNameLabel||"Stage Name",rules:[{required:!0,message:o.taskNameRequired||"Please enter stage name"}],children:e.jsx(h.Input,{placeholder:o.taskNamePlaceholder||"Enter stage name",autoFocus:!0,style:a.input})}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsx(h.Form.Item,{name:"type",label:o.typeLabel||"Type",style:{flex:1},children:e.jsxs(h.Select,{style:a.input,children:[e.jsx(Ue,{value:"task",children:o.taskTypeOptions?.task||"Stage"}),e.jsx(Ue,{value:"milestone",children:o.taskTypeOptions?.milestone||"Milestone"}),e.jsx(Ue,{value:"project",children:o.taskTypeOptions?.project||"Project"})]})}),e.jsx(h.Form.Item,{name:"priority",label:o.priorityLabel||"Priority",style:{flex:1},children:e.jsxs(h.Select,{style:a.input,children:[e.jsx(Ue,{value:"low",children:o.priorityOptions?.low||"Low"}),e.jsx(Ue,{value:"medium",children:o.priorityOptions?.medium||"Medium"}),e.jsx(Ue,{value:"high",children:o.priorityOptions?.high||"High"})]})})]}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsx(h.Form.Item,{name:"start",label:o.startDateLabel||"Start Date",style:{flex:1},children:e.jsx(h.DatePicker,{style:{width:"100%",...a.input}})}),e.jsx(h.Form.Item,{name:"duration",label:o.durationLabel||"Duration (days)",style:{flex:1},children:e.jsx(h.InputNumber,{min:0,style:{width:"100%",...a.input}})})]}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsx(h.Form.Item,{name:"color",label:o.colorLabel||"Color",style:{flex:1},children:e.jsx(h.ColorPicker,{showText:!0})}),e.jsx(h.Form.Item,{name:"progress",label:o.progressLabel||"Progress (%)",style:{flex:1},children:e.jsx(h.InputNumber,{min:0,max:100,style:{width:"100%",...a.input}})})]}),e.jsx(h.Form.Item,{name:"owner",label:o.ownerLabel||"Owner",children:e.jsx(h.Input,{placeholder:o.ownerPlaceholder||"Assign to...",style:a.input})}),e.jsx(h.Form.Item,{name:"details",label:o.detailsLabel||"Details",children:e.jsx(lr,{placeholder:o.detailsPlaceholder||"Add stage description...",rows:3,style:a.input})})]})})},{Option:Ve}=h.Select,{TextArea:dr}=h.Input,{confirm:cr}=h.Modal,It=({task:t,onUpdate:s,onDelete:o,onClose:i,uiConfig:r={},styleConfig:y})=>{const[g]=h.Form.useForm(),a=He(y),u=c=>{const j=c.start.toDate(),T=new Date(j);T.setDate(T.getDate()+(c.duration||1)),s({...t,text:c.text,start:j,end:T,duration:c.duration||1,progress:c.progress||0,type:c.type,color:typeof c.color=="string"?c.color:c.color?.toHexString?.()||"#4A90E2",owner:c.owner||"",priority:c.priority||"medium",details:c.details||""}),i()},b=()=>{cr({title:r.deleteConfirmTitle?`${r.deleteConfirmTitle}: "${t.text}"?`:`Are you sure you want to delete "${t.text}"?`,icon:e.jsx(ne.FontAwesomeIcon,{icon:q.faExclamationTriangle,style:{color:"#faad14",marginRight:8}}),content:r.deleteConfirmContent||"This action cannot be undone.",okText:r.deleteConfirmOkText||"Yes, Delete",okType:"danger",cancelText:r.deleteConfirmCancelText||"No",onOk(){o(t.id),i()}})};return e.jsx(h.Modal,{title:r.taskEditorTitle||"Edit Stage",open:!0,onCancel:i,footer:[e.jsx(h.Button,{danger:!0,onClick:b,style:{float:"left",...a.buttonDanger},children:r.taskEditorDeleteText||"Delete"},"delete"),e.jsx(h.Button,{onClick:i,style:a.buttonSecondary,children:r.taskEditorCancelText||"Cancel"},"cancel"),e.jsx(h.Button,{type:"primary",onClick:()=>g.submit(),style:a.buttonPrimary,children:r.taskEditorSaveText||"Save Changes"},"submit")],width:600,className:"gantt-modal-antd",styles:{content:a.modal,header:{borderBottom:`1px solid ${a.modal?.borderColor||"#f0f0f0"}`,marginBottom:16}},children:e.jsxs(h.Form,{form:g,layout:"vertical",onFinish:u,initialValues:{text:t.text,type:t.type||"task",priority:t.priority||"medium",start:$t(t.start),duration:t.duration,progress:t.progress,color:t.color||"#4A90E2",owner:t.owner||"",details:t.details||""},children:[e.jsx(h.Form.Item,{name:"text",label:r.taskNameLabel||"Stage Name",rules:[{required:!0,message:r.taskNameRequired||"Please enter stage name"}],children:e.jsx(h.Input,{placeholder:r.taskNamePlaceholder||"Enter stage name",style:a.input})}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsx(h.Form.Item,{name:"type",label:r.typeLabel||"Type",style:{flex:1},children:e.jsxs(h.Select,{style:a.input,children:[e.jsx(Ve,{value:"task",children:r.taskTypeOptions?.task||"Stage"}),e.jsx(Ve,{value:"milestone",children:r.taskTypeOptions?.milestone||"Milestone"}),e.jsx(Ve,{value:"project",children:r.taskTypeOptions?.project||"Project"})]})}),e.jsx(h.Form.Item,{name:"priority",label:r.priorityLabel||"Priority",style:{flex:1},children:e.jsxs(h.Select,{style:a.input,children:[e.jsx(Ve,{value:"low",children:r.priorityOptions?.low||"Low"}),e.jsx(Ve,{value:"medium",children:r.priorityOptions?.medium||"Medium"}),e.jsx(Ve,{value:"high",children:r.priorityOptions?.high||"High"})]})})]}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsx(h.Form.Item,{name:"start",label:r.startDateLabel||"Start Date",style:{flex:1},children:e.jsx(h.DatePicker,{style:{width:"100%",...a.input}})}),e.jsx(h.Form.Item,{name:"duration",label:r.durationLabel||"Duration (days)",style:{flex:1},children:e.jsx(h.InputNumber,{min:0,style:{width:"100%",...a.input}})})]}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsx(h.Form.Item,{name:"color",label:r.colorLabel||"Color",style:{flex:1},children:e.jsx(h.ColorPicker,{showText:!0})}),e.jsx(h.Form.Item,{name:"progress",label:r.progressLabel||"Progress (%)",style:{flex:1},children:e.jsx(h.InputNumber,{min:0,max:100,style:{width:"100%",...a.input}})})]}),e.jsx(h.Form.Item,{name:"owner",label:r.ownerLabel||"Owner",children:e.jsx(h.Input,{placeholder:r.ownerPlaceholder||"Assign to...",style:a.input})}),e.jsx(h.Form.Item,{name:"details",label:r.detailsLabel||"Details",children:e.jsx(dr,{placeholder:r.detailsPlaceholder||"Add stage description...",rows:3,style:a.input})})]})})},{Title:rt,Text:Xe,Paragraph:ur}=h.Typography,{Option:Pe}=h.Select,Rt=({task:t,allTasks:s,links:o,onAddDependency:i,onRemoveDependency:r,onClose:y,styleConfig:g})=>{const a=He(g),[u,b]=w.useState(""),[c,j]=w.useState("e2s"),[T,p]=w.useState(0),[f,l]=w.useState("day"),[E,M]=w.useState(""),k=o.filter(v=>v.target===t.id),F=s.filter(v=>v.id!==t.id&&v.id!==t.parent),W=()=>{if(u){const v=gt(T,f);i(u,t.id,c,v),b(""),p(0),l("day")}},V=()=>{if(!E.trim())return;const v=er(E.trim());if(!v){alert(`Invalid format. Use: [TaskNumber][Type][+/-][Lag][Unit]
|
|
15
|
-
Example: 3FS+10d`);return}const A=v.taskNumber-1,G=s[A];if(!G){alert(`Task ${v.taskNumber} not found`);return}const B=rr(v.type),K=gt(v.lag,v.lagUnit);i(G.id,t.id,B,K),M("")},U=v=>{switch(v){case"e2s":return"Finish-to-Start (FS)";case"s2s":return"Start-to-Start (SS)";case"e2e":return"Finish-to-Finish (FF)";case"s2e":return"Start-to-Finish (SF)"}},me=v=>{switch(v){case"e2s":return"blue";case"s2s":return"green";case"e2e":return"purple";case"s2e":return"orange"}};return e.jsx(h.Modal,{title:e.jsx(rt,{level:4,style:{margin:0,color:a.font?.color},children:"Dependency Editor"}),open:!0,onCancel:y,footer:null,width:700,styles:{content:a.modal,header:{borderBottom:`1px solid ${a.modal?.borderColor||"#f0f0f0"}`}},children:e.jsxs("div",{style:{padding:"8px 0"},children:[e.jsx(h.Alert,{message:"Managing dependencies helps in auto-scheduling and critical path calculation.",type:"info",showIcon:!0,style:{marginBottom:20,...a.font}}),e.jsxs("div",{style:{display:"flex",gap:20,marginBottom:24},children:[e.jsx(h.Card,{title:e.jsx(rt,{level:5,style:{margin:0,fontSize:14,color:a.font?.color},children:"Settings"}),size:"small",style:{flex:1,...a.modal},headStyle:{borderBottom:`1px solid ${a.modal?.borderColor||"#f0f0f0"}`},children:e.jsxs(h.Space,{direction:"vertical",style:{width:"100%"},size:"middle",children:[e.jsxs("div",{children:[e.jsx(Xe,{style:{display:"block",marginBottom:8,fontSize:13,color:a.font?.color},children:"Predecessor"}),e.jsx(h.Select,{showSearch:!0,placeholder:"Select a task",optionFilterProp:"children",style:{width:"100%",...a.input},value:u,onChange:b,children:F.map(v=>e.jsxs(Pe,{value:v.id,children:["[",s.indexOf(v)+1,"] ",v.text]},v.id))})]}),e.jsxs("div",{children:[e.jsx(Xe,{style:{display:"block",marginBottom:8,fontSize:13,color:a.font?.color},children:"Type"}),e.jsxs(h.Select,{style:{width:"100%",...a.input},value:c,onChange:j,children:[e.jsx(Pe,{value:"e2s",children:"Finish-to-Start (FS)"}),e.jsx(Pe,{value:"s2s",children:"Start-to-Start (SS)"}),e.jsx(Pe,{value:"e2e",children:"Finish-to-Finish (FF)"}),e.jsx(Pe,{value:"s2e",children:"Start-to-Finish (SF)"})]})]}),e.jsxs("div",{style:{display:"flex",gap:12},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx(Xe,{style:{display:"block",marginBottom:8,fontSize:13,color:a.font?.color},children:"Lag/Lead"}),e.jsx(h.InputNumber,{style:{width:"100%",...a.input},value:T,onChange:v=>p(v||0)})]}),e.jsxs("div",{style:{flex:1},children:[e.jsx(Xe,{style:{display:"block",marginBottom:8,fontSize:13,color:a.font?.color},children:"Units"}),e.jsxs(h.Select,{style:{width:"100%",...a.input},value:f,onChange:l,children:[e.jsx(Pe,{value:"day",children:"Days"}),e.jsx(Pe,{value:"hour",children:"Hours"}),e.jsx(Pe,{value:"week",children:"Weeks"}),e.jsx(Pe,{value:"month",children:"Months"})]})]})]}),e.jsx(h.Button,{type:"primary",icon:e.jsx(ne.FontAwesomeIcon,{icon:q.faPlus,style:{marginRight:8}}),block:!0,onClick:W,disabled:!u,style:{height:40,marginTop:8,...a.buttonPrimary},children:"Add Dependency"})]})}),e.jsxs(h.Card,{title:e.jsx(rt,{level:5,style:{margin:0,fontSize:14,color:a.font?.color},children:"Quick Add"}),size:"small",style:{width:250,...a.modal},headStyle:{borderBottom:`1px solid ${a.modal?.borderColor||"#f0f0f0"}`},children:[e.jsxs(ur,{type:"secondary",style:{fontSize:12,marginBottom:16,color:a.font?.color,opacity:.7},children:["Format: [TaskNumber][Type][+/-][Lag][Unit]",e.jsx("br",{}),"Example: 3FS+10d"]}),e.jsx(h.Input,{placeholder:"e.g. 5FS+2d",value:E,onChange:v=>M(v.target.value),onPressEnter:V,style:{marginBottom:16,height:40,...a.input}}),e.jsx(h.Button,{block:!0,onClick:V,style:{height:40,...a.buttonSecondary},children:"Apply"})]})]}),e.jsx(h.Divider,{style:{margin:"0 0 24px 0",borderColor:a.modal?.borderColor}}),e.jsxs("div",{style:{maxHeight:300,overflowY:"auto"},children:[e.jsx(rt,{level:5,style:{fontSize:14,marginBottom:16,color:a.font?.color},children:"Current Dependencies"}),e.jsx(h.List,{dataSource:k,locale:{emptyText:e.jsx(Xe,{type:"secondary",style:{color:a.font?.color,opacity:.5},children:"No dependencies added yet."})},renderItem:v=>{const A=s.find(G=>G.id===v.source);return e.jsx(h.List.Item,{style:{padding:"12px 16px",background:"#fafafa",borderRadius:8,marginBottom:12,border:`1px solid ${a.listItem?.borderColor||"#f0f0f0"}`},actions:[e.jsx(h.Button,{type:"text",danger:!0,icon:e.jsx(ne.FontAwesomeIcon,{icon:q.faTrash}),onClick:()=>r(v.id)},"delete")],children:e.jsx(h.List.Item.Meta,{avatar:e.jsx("div",{style:{width:32,height:32,borderRadius:16,background:"#1890ff",display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:12,fontWeight:"bold"},children:A?s.indexOf(A)+1:"?"}),title:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontWeight:600,color:a.font?.color},children:A?.text||"Unknown Task"}),e.jsx(h.Tag,{color:me(v.type),style:{margin:0},children:U(v.type)})]}),description:e.jsx("div",{style:{display:"flex",alignItems:"center",gap:16,marginTop:4},children:e.jsxs("span",{style:{fontSize:12,color:a.font?.color,opacity:.7},children:[e.jsx(ne.FontAwesomeIcon,{icon:q.faLink,style:{marginRight:6}}),"Lag: ",v.lag||0," days"]})})})})}})]}),e.jsxs("div",{style:{marginTop:24,padding:"16px",background:"#fff7e6",borderRadius:8,border:"1px solid #ffe7ba"},children:[e.jsxs(rt,{level:5,style:{fontSize:13,marginBottom:8,display:"flex",alignItems:"center"},children:[e.jsx(ne.FontAwesomeIcon,{icon:q.faInfoCircle,style:{marginRight:8,color:"#fa8c16"}}),"Coming soon"]}),e.jsx(Xe,{style:{fontSize:12,color:"rgba(0,0,0,0.65)"},children:"Dependency visualization on the chart and automatic lag calculations based on working hours."})]})]})})},pr=({x:t,y:s,task:o,onEdit:i,onDelete:r,onCopy:y,onDependencies:g,onConvertToMilestone:a,onConvertToTask:u,onConvertToProject:b,onAutoSchedule:c,onClose:j,styleConfig:T})=>{const p=He(T);if(!o)return null;const f=[{key:"edit",label:"Edit",icon:e.jsx(ne.FontAwesomeIcon,{icon:q.faEdit}),onClick:()=>{i(),j()}},{key:"copy",label:"Copy",icon:e.jsx(ne.FontAwesomeIcon,{icon:q.faCopy}),onClick:()=>{y(),j()}},{key:"dependencies",label:"Dependencies",icon:e.jsx(ne.FontAwesomeIcon,{icon:q.faLink}),onClick:()=>{g(),j()}},{type:"divider"},{key:"convert",label:"Convert to",type:"submenu",children:[{key:"milestone",label:"Milestone",icon:e.jsx(ne.FontAwesomeIcon,{icon:q.faFlag}),disabled:o.type==="milestone",onClick:()=>{a(),j()}},{key:"task",label:"Task",icon:e.jsx(ne.FontAwesomeIcon,{icon:q.faTasks}),disabled:o.type==="task",onClick:()=>{u(),j()}},{key:"project",label:"Project",icon:e.jsx(ne.FontAwesomeIcon,{icon:q.faFolder}),disabled:o.type==="project",onClick:()=>{b(),j()}}]},{key:"auto-schedule",label:"Auto Schedule",icon:e.jsx(ne.FontAwesomeIcon,{icon:q.faRotateLeft}),onClick:()=>{c?.(),j()}},{type:"divider"},{key:"delete",label:"Delete",icon:e.jsx(ne.FontAwesomeIcon,{icon:q.faTrash}),danger:!0,onClick:()=>{r(),j()}}];return e.jsx("div",{className:"gantt-context-menu",style:{position:"fixed",left:`${t}px`,top:`${s}px`,zIndex:1e4},onClick:l=>l.stopPropagation(),children:e.jsx(h.Menu,{items:f,style:{boxShadow:p.popover?.boxShadow||"0 4px 12px rgba(0, 0, 0, 0.15)",borderRadius:p.popover?.borderRadius||"6px",border:`1px solid ${p.popover?.borderColor||"#e0e0e0"}`,backgroundColor:p.popover?.backgroundColor,color:p.font?.color,fontFamily:p.font?.fontFamily}})})},Yt=(t,s=[])=>{const[o,i]=w.useState([]),[r,y]=w.useState(-1),[g,a]=w.useState(t),[u,b]=w.useState(s);w.useEffect(()=>{a(t)},[t]),w.useEffect(()=>{b(s)},[s]);const c=w.useCallback((k,F,W)=>{const V={type:k,before:F,after:W,timestamp:Date.now()},U=o.slice(0,r+1);U.push(V),U.length>50?U.shift():y(r+1),i(U)},[o,r]),j=w.useCallback(()=>{if(r<0)return;const k=o[r];a(k.before.tasks),b(k.before.links),y(r-1)},[o,r]),T=w.useCallback(()=>{if(r>=o.length-1)return;const k=o[r+1];a(k.after.tasks),b(k.after.links),y(r+1)},[o,r]),p=r>=0,f=r<o.length-1,l=w.useCallback(k=>{const F={tasks:g,links:u},W=g.map(U=>U.id===k.id?k:U);c("task_update",F,{tasks:W,links:u}),a(W)},[g,u,c]),E=w.useCallback(k=>{const F={tasks:g,links:u},W=[...g,k];c("task_create",F,{tasks:W,links:u}),a(W)},[g,u,c]),M=w.useCallback(k=>{const F={tasks:g,links:u},W=g.filter(me=>me.id!==k),V=u.filter(me=>me.source!==k&&me.target!==k);c("task_delete",F,{tasks:W,links:V}),a(W),b(V)},[g,u,c]);return{tasks:g,links:u,setTasks:a,setLinks:b,undo:j,redo:T,canUndo:p,canRedo:f,updateTask:l,createTask:E,deleteTask:M,saveState:c,history:o}},zt=(t,s,o={mode:"forward"})=>{const i=new Map,r=new Map;return t.forEach(y=>{i.set(y.id,[]),r.set(y.id,[])}),s.forEach(y=>{y.type==="e2s"&&(i.get(y.target)?.push(y.source),r.get(y.source)?.push(y.target))}),o.mode==="forward"?hr(t,i,o):fr(t,r,o)},hr=(t,s,o)=>{const i=new Map,r=new Set,y=o.projectStart||new Date,g=a=>{if(r.has(a))return;const u=t.find(f=>f.id===a);if(!u)return;const b=s.get(a)||[];b.forEach(f=>g(f));let c=y;b.forEach(f=>{const l=i.get(f);l&&l.end>c&&(c=new Date(l.end))});const j=new Date(c),T=he(j,u.duration,"day"),p={...u,start:j,end:T};i.set(a,p),r.add(a)};return t.forEach(a=>g(a.id)),t.map(a=>i.get(a.id)||a)},fr=(t,s,o)=>{const i=new Map,r=new Set,y=o.projectEnd||new Date(Math.max(...t.map(a=>a.end.getTime()))),g=a=>{if(r.has(a))return;const u=t.find(f=>f.id===a);if(!u)return;const b=s.get(a)||[];b.forEach(f=>g(f));let c=y;b.forEach(f=>{const l=i.get(f);l&&l.start<c&&(c=new Date(l.start))});const j=new Date(c),T=he(j,-u.duration,"day"),p={...u,start:T,end:j};i.set(a,p),r.add(a)};return t.forEach(a=>g(a.id)),t.map(a=>i.get(a.id)||a)},mr=Object.freeze(Object.defineProperty({__proto__:null,autoSchedule:zt,levelResources:t=>{const s=new Map;t.forEach(i=>{i.owner&&(s.has(i.owner)||s.set(i.owner,[]),s.get(i.owner).push(i))});const o=[...t];return s.forEach(i=>{const r=i.sort((y,g)=>y.start.getTime()-g.start.getTime());for(let y=1;y<r.length;y++){const g=r[y],a=r[y-1];if(g.start<a.end){const u=o.findIndex(b=>b.id===g.id);if(u>=0){const b=new Date(a.end),c=he(b,g.duration,"day");o[u]={...g,start:b,end:c}}}}}),o}},Symbol.toStringTag,{value:"Module"})),Wt=t=>{const s=new Map;return t.forEach(o=>{s.set(o.id,{taskId:o.id,start:new Date(o.start),end:new Date(o.end)})}),s},Ht=t=>{const s=["ID","Task Name","Start Date","End Date","Duration","Progress","Type","Owner","Priority"],o=t.map(r=>[r.id,r.text,fe(r.start,"YYYY-MM-DD"),fe(r.end,"YYYY-MM-DD"),r.duration.toString(),`${r.progress}%`,r.type||"task",r.owner||"",r.priority||"medium"]),i=[s.join(","),...o.map(r=>r.map(y=>`"${y}"`).join(","))].join(`
|
|
16
|
-
`);
|
|
17
|
-
`);
|
|
14
|
+
<%s key={someKey} {...props} />`,Mt,He,Tr,He),J[He+Mt]=!0}}return n===l?de(pe):I(pe),pe}}function ie(n,m,k){return ge(n,m,k,!0)}function be(n,m,k){return ge(n,m,k,!1)}var Ye=be,ye=ie;Qe.Fragment=l,Qe.jsx=Ye,Qe.jsxs=ye})()),Qe}var Pt;function Zt(){return Pt||(Pt=1,process.env.NODE_ENV==="production"?st.exports=Jt():st.exports=Gt()),st.exports}var e=Zt();const he=(t,a,o)=>{const l=new Date(t);switch(o){case"hour":l.setHours(l.getHours()+a);break;case"day":l.setDate(l.getDate()+a);break;case"week":l.setDate(l.getDate()+a*7);break;case"month":l.setMonth(l.getMonth()+a);break;case"quarter":l.setMonth(l.getMonth()+a*3);break;case"year":l.setFullYear(l.getFullYear()+a);break}return l},et=(t,a)=>{const o=a.getTime()-t.getTime();return Math.ceil(o/(1e3*60*60*24))},Ot=(t,a)=>{const o=a.getTime()-t.getTime();return Math.ceil(o/(1e3*60*60))},me=(t,a)=>{const o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],l=["January","February","March","April","May","June","July","August","September","October","November","December"],r=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],x={YYYY:t.getFullYear().toString(),YY:t.getFullYear().toString().slice(-2),MMMM:l[t.getMonth()],MMM:o[t.getMonth()],MM:String(t.getMonth()+1).padStart(2,"0"),M:String(t.getMonth()+1),DD:String(t.getDate()).padStart(2,"0"),D:String(t.getDate()),dddd:r[t.getDay()],HH:String(t.getHours()).padStart(2,"0"),H:String(t.getHours()),mm:String(t.getMinutes()).padStart(2,"0"),m:String(t.getMinutes())};return a.replace(/YYYY|YY|MMMM|MMM|MM|M|DD|D|dddd|HH|H|mm|m/g,y=>x[y])},ft=t=>{const a=t.getDay();return a===0||a===6},mt=(t,a)=>a.some(o=>o.getFullYear()===t.getFullYear()&&o.getMonth()===t.getMonth()&&o.getDate()===t.getDate()),Re=t=>{const a=new Date(t);return a.setHours(0,0,0,0),a},Kt=t=>{const a=new Date(t);return a.setHours(23,59,59,999),a},Qt=(t,a,o="day")=>{switch(o){case"hour":return Ot(t,a);case"day":return et(t,a);case"week":return Math.ceil(et(t,a)/7);case"month":return(a.getFullYear()-t.getFullYear())*12+(a.getMonth()-t.getMonth());default:return et(t,a)}};function er(t){if(!t||typeof t!="string")return null;const a=t.trim(),o=/^(\d+)(FS|SS|FF|SF)(([+-])(\d+)([dhwm]))?$/i,l=a.match(o);if(!l)return null;const r=parseInt(l[1],10),x=l[2].toUpperCase();let y=0,i="day";if(l[3]){const s=l[4]==="-"?-1:1;switch(y=parseInt(l[5],10)*s,l[6].toLowerCase()){case"d":i="day";break;case"h":i="hour";break;case"w":i="week";break;case"m":i="month";break}}return{taskNumber:r,type:x,lag:y,lagUnit:i}}function xt(t,a){switch(a){case"hour":return t/24;case"day":return t;case"week":return t*7;case"month":return t*30;default:return t}}function tr(t,a){const l={e2s:"FS",s2s:"SS",e2e:"FF",s2e:"SF"}[t.type];let r=`${a}${l}`;if(t.lag&&t.lag!==0){const x=t.lag>0?"+":"",i=(t.lagUnit||"day").charAt(0);let s=t.lag;if(t.lagUnit&&t.lagUnit!=="day")switch(t.lagUnit){case"hour":s=t.lag*24;break;case"week":s=t.lag/7;break;case"month":s=t.lag/30;break}r+=`${x}${Math.round(s)}${i}`}return r}function rr(t){return{FS:"e2s",SS:"s2s",FF:"e2e",SF:"s2e"}[t]}const Ue=t=>t?{popover:{backgroundColor:t.popoverBackground||"#fff",borderColor:t.popoverBorderColor||"#f0f0f0",borderRadius:t.popoverBorderRadius||"8px",boxShadow:t.popoverShadow||"0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05)",padding:t.popoverPadding||"0",fontFamily:t.popoverFontFamily||t.fontFamily||"inherit",fontSize:t.popoverFontSize||t.fontSize||"14px"},modal:{backgroundColor:t.modalBackground||"#fff",borderRadius:t.modalBorderRadius||"8px",borderColor:t.modalBorderColor||"#f0f0f0",boxShadow:t.modalShadow||"0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05)"},buttonPrimary:{backgroundColor:t.buttonPrimaryBackground||"#1677ff",color:t.buttonPrimaryColor||"#fff",borderRadius:t.buttonPrimaryBorderRadius||"6px",fontWeight:t.buttonPrimaryFontWeight||400,fontFamily:t.buttonPrimaryFontFamily||t.fontFamily||"inherit",boxShadow:"0 2px 0 rgba(5, 145, 255, 0.1)"},buttonDanger:{backgroundColor:t.buttonDangerBackground||"#ff4d4f",color:t.buttonDangerColor||"#fff",borderRadius:t.buttonPrimaryBorderRadius||"6px",boxShadow:"0 2px 0 rgba(255, 38, 5, 0.06)"},buttonSecondary:{backgroundColor:t.buttonSecondaryBackground||"transparent",color:t.buttonSecondaryColor||"rgba(0, 0, 0, 0.88)",borderColor:t.buttonSecondaryBorderColor||"#d9d9d9",borderRadius:t.buttonPrimaryBorderRadius||"6px",boxShadow:"0 2px 0 rgba(0, 0, 0, 0.02)"},input:{backgroundColor:t.inputBackground,borderColor:t.inputBorderColor,borderRadius:t.inputBorderRadius||"6px",fontFamily:t.inputFontFamily||t.fontFamily||"inherit",fontSize:t.inputFontSize||t.fontSize||"14px"},listItem:{hoverBackground:t.listItemHoverBackground||"#f5f5f5",selectedBackground:t.listItemSelectedBackground||"#e6f4ff",borderColor:t.listItemBorderColor||"#f0f0f0"},badge:{backgroundColor:t.badgeBackground||"#e6f4ff",borderColor:t.badgeBorderColor||"transparent",color:t.badgeColor||"#1677ff",fontSize:t.badgeFontSize||"12px",padding:t.badgePadding||"0 7px",borderRadius:t.badgeBorderRadius||"10px"},link:{color:t.linkColor||"#1677ff",hoverColor:t.linkHoverColor||"#69b1ff",fontWeight:t.linkFontWeight||400},font:{fontFamily:t.fontFamily||"inherit",fontSize:t.fontSize||"14px",fontWeight:t.fontWeight||400,lineHeight:t.lineHeight||1.5714285714285714,color:t.fontColor||"rgba(0, 0, 0, 0.88)"}}:{},{Text:Se,Paragraph:nr}=p.Typography,{Option:Ae}=p.Select,or=({task:t,allTasks:a,links:o,onAddDependency:l,onRemoveDependency:r,onTaskUpdate:x,children:y,styleConfig:i})=>{const s=Ue(i),[b,c]=g.useState(!1),[w,T]=g.useState(null),[u,h]=g.useState("e2s"),[v,j]=g.useState("lag"),[D,$]=g.useState(0),[F,z]=g.useState(t.duration),[ne,q]=g.useState(!0),fe="day",E=o.find(A=>A.target===t.id),K=!!E,U=g.useMemo(()=>a.length===0?new Date:new Date(Math.min(...a.map(A=>A.start.getTime()))),[a]),L=()=>{if(w){const A=v==="lag"?D:-D,B=xt(A,fe);if(F!==t.duration&&x){const ue=he(new Date(t.start),F,"day");x({...t,duration:F,end:ue})}l(w,t.id,u,B),c(!1),W()}},W=()=>{T(null),h("e2s"),j("lag"),$(0),z(t.duration)},oe=()=>{E&&r&&(r(E.id),c(!1),W())},Z=A=>{if(c(A),A){if(q(!0),E){T(E.source),h(E.type);const B=E.lag||0;B>=0?(j("lag"),$(B)):(j("lead"),$(Math.abs(B)))}else W();z(t.duration)}},xe=()=>{if(!ne)return null;const A=u==="e2s",B=u==="s2s",ue=u==="e2e",ee=u==="s2e";let te=0,Q=0,f="",M=0,P=-1;A?(te=50,Q=350,M=250,P=350,f="M 250 60 L 300 60 L 300 140 L 348 140"):ue?(te=100,Q=100,M=300,P=-1,f="M 300 60 L 350 60 L 350 140 L 302 140"):B?(te=250,Q=250,M=250,P=-1,f="M 250 60 L 200 60 L 200 140 L 248 140"):ee&&(te=350,Q=50,M=350,P=250,f="M 350 60 L 300 60 L 300 140 L 252 140");const N=w==="gantt-start-date",_=a.find(ae=>ae.id===w);return e.jsx("div",{style:{width:"100%",height:90,backgroundColor:"#fbfbfb",borderRadius:4,marginBottom:12,border:"1px solid #f0f0f0",position:"relative",overflow:"hidden",flexShrink:0},children:e.jsxs("svg",{viewBox:"0 0 600 200",style:{width:"100%",height:"100%"},preserveAspectRatio:"xMidYMid meet",children:[e.jsx("defs",{children:e.jsx("marker",{id:"arrowhead",markerWidth:"12",markerHeight:"9",refX:"12",refY:"4.5",orient:"auto",children:e.jsx("polygon",{points:"0 0, 12 4.5, 0 9",fill:"#8c8c8c"})})}),e.jsx("line",{x1:M,x2:M,y1:"0",y2:"200",stroke:"#f0f0f0",strokeDasharray:"3,3"}),P!==-1&&e.jsx("line",{x1:P,x2:P,y1:"0",y2:"200",stroke:"#f0f0f0",strokeDasharray:"3,3"}),e.jsx("rect",{x:te,y:"35",width:"200",height:"50",rx:"4",fill:"#e6f4ff",stroke:"#91caff",strokeWidth:"2"}),e.jsx("text",{x:te+100,y:"66",fontSize:"15",textAnchor:"middle",fill:"#003a8c",fontWeight:"600",children:N?"Start Date":_?`Stage ${a.indexOf(_)+1}`:"Predecessor"}),e.jsx("rect",{x:Q,y:"115",width:"200",height:"50",rx:"4",fill:"#e6f4ff",stroke:"#91caff",strokeWidth:"2"}),e.jsxs("text",{x:Q+100,y:"146",fontSize:"15",textAnchor:"middle",fill:"#003a8c",fontWeight:"600",children:["Stage ",a.indexOf(t)+1]}),e.jsx("path",{d:f,fill:"none",stroke:"#8c8c8c",strokeWidth:"2.5",markerEnd:"url(#arrowhead)"})]})})},Fe=()=>{const A=w==="gantt-start-date",B=a.find(Q=>Q.id===w);if(!w)return"Select a checklist from the list to see how it will relate to the current stage.";const ue=a.indexOf(t)+1,ee=A?"Start Date":`Stage ${a.indexOf(B)+1}`;let te="";switch(u){case"e2s":te=`Stage ${ue} starts after ${ee} finishes`;break;case"s2s":te=`Stage ${ue} starts when ${ee} starts`;break;case"e2e":te=`Stage ${ue} finishes when ${ee} finishes`;break;case"s2e":te=`Stage ${ue} finishes when ${ee} starts`;break}if(D>0){const Q=`${D} ${fe}${D>1?"s":""}`;v==="lag"?te+=` + ${Q} delay`:te+=` - ${Q} overlap`}return te+"."},ke=e.jsxs("div",{style:{width:550,backgroundColor:s.popover?.backgroundColor||"#fff",borderRadius:s.popover?.borderRadius||"8px",padding:"16px 20px",boxShadow:s.popover?.boxShadow,fontFamily:s.popover?.fontFamily},children:[e.jsx(Se,{strong:!0,style:{fontSize:"16px",display:"block",marginBottom:16,color:s.font?.color},children:"Add Dependency"}),e.jsxs("div",{style:{display:"flex",gap:12,marginBottom:14},children:[e.jsx("div",{style:{flex:1},children:e.jsxs(p.Select,{showSearch:!0,placeholder:"Select checklist",value:w,onChange:T,style:{width:"100%"},filterOption:(A,B)=>{if(B?.value==="gantt-start-date")return"start date".includes(A.toLowerCase());const ue=a.find(te=>te.id===B?.value);if(!ue)return!1;const ee=a.indexOf(ue)+1;return ue.text.toLowerCase().includes(A.toLowerCase())||ee.toString().includes(A)},optionLabelProp:"label",children:[a.filter(A=>A.id!==t.id).map(A=>e.jsx(Ae,{value:A.id,label:A.text,children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",padding:"4px 0"},children:[e.jsxs(Se,{style:{fontSize:"13px"},children:[a.indexOf(A)+1,". ",A.text]}),e.jsxs(Se,{type:"secondary",style:{fontSize:"11px"},children:["Start: ",me(A.start,"MMM D, YYYY")]})]})},A.id)),e.jsx(Ae,{value:"gantt-start-date",label:"Start Date",children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",padding:"4px 0",borderTop:"1px solid #f0f0f0",marginTop:"4px",paddingTop:"8px"},children:[e.jsx(Se,{style:{fontSize:"13px",fontWeight:600},children:"Start Date"}),e.jsx(Se,{type:"secondary",style:{fontSize:"11px"},children:me(U,"MMM D, YYYY")})]})},"gantt-start-date")]})}),e.jsx("div",{style:{width:100},children:e.jsxs(p.Select,{value:u,onChange:h,style:{width:"100%"},children:[e.jsx(Ae,{value:"e2s",children:"FS"}),e.jsx(Ae,{value:"e2e",children:"FF"}),e.jsx(Ae,{value:"s2s",children:"SS"}),e.jsx(Ae,{value:"s2e",children:"SF"})]})})]}),e.jsxs("div",{style:{display:"flex",gap:12,marginBottom:14},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx(Se,{style:{fontSize:"12px",display:"block",marginBottom:6,color:s.font?.color},children:"Delay type"}),e.jsxs(p.Select,{value:v,onChange:j,style:{width:"100%"},children:[e.jsx(Ae,{value:"lag",children:"Lag by"}),e.jsx(Ae,{value:"lead",children:"Lead by"})]})]}),e.jsxs("div",{style:{flex:1},children:[e.jsx(Se,{style:{fontSize:"12px",display:"block",marginBottom:6,color:s.font?.color},children:"Days"}),e.jsx(p.InputNumber,{min:0,value:D,onChange:A=>$(A||0),style:{width:"100%"},placeholder:"0"})]})]}),e.jsxs("div",{style:{marginBottom:14},children:[e.jsx(Se,{style:{fontSize:"12px",display:"block",marginBottom:6,color:s.font?.color},children:"Duration (days)"}),e.jsx(p.InputNumber,{min:1,value:F,onChange:A=>z(A||1),style:{width:"100%"},placeholder:"Duration"})]}),e.jsx("div",{style:{backgroundColor:"#f5f5f5",padding:"10px 12px",borderRadius:"4px",marginBottom:14},children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px"},children:[e.jsx(Se,{style:{fontSize:"11px",color:s.font?.color},children:"FS: Finish to Start"}),e.jsx(Se,{style:{fontSize:"11px",color:s.font?.color},children:"SS: Start to Start"}),e.jsx(Se,{style:{fontSize:"11px",color:s.font?.color},children:"FF: Finish to Finish"}),e.jsx(Se,{style:{fontSize:"11px",color:s.font?.color},children:"SF: Start to Finish"})]})}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[e.jsx(Se,{strong:!0,style:{fontSize:"13px",color:s.font?.color},children:"Dependency preview"}),e.jsx("a",{onClick:()=>q(!ne),style:{fontSize:"12px",color:"#1890ff",cursor:"pointer",textDecoration:"none"},children:ne?"Hide preview":"Show preview"})]}),ne&&e.jsxs(e.Fragment,{children:[xe(),e.jsx(nr,{style:{fontSize:"12px",color:s.font?.color||"#262626",marginBottom:14,lineHeight:"1.5"},children:Fe()})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:10},children:[K&&e.jsx(p.Button,{danger:!0,onClick:oe,style:{...s.buttonDanger},children:"Remove Dependency"}),e.jsx(p.Button,{type:"primary",onClick:L,disabled:!w,style:{...s.buttonPrimary,minWidth:100},children:K?"Update":"Add"})]})]});return e.jsx(p.Popover,{content:ke,trigger:"click",open:b,onOpenChange:Z,placement:"bottomLeft",overlayClassName:"dependency-popover",overlayInnerStyle:{padding:0},children:y})},yt=g.memo(g.forwardRef(({tasks:t,allTasks:a=[],columns:o,selectedTask:l,onTaskClick:r,onTaskContextMenu:x,onTaskUpdate:y,onTaskDragStart:i,onAddTask:s,onAddDependency:b,onRemoveDependency:c,links:w=[],dropIndicator:T,reorderTask:u,styleConfig:h},v)=>{const j=g.useRef(null);g.useImperativeHandle(v,()=>j.current);const[D,$]=g.useState(null),[F,z]=g.useState(0),ne=(E,K=0)=>{if(!E.parent)return K;const U=t.find(L=>L.id===E.parent);return U?ne(U,K+1):K},q=(E,K)=>{if(K===E.duration)return;const U=he(new Date(E.start),K,"day");y?.({...E,duration:K,end:U})},fe=(E,K)=>{if(K.template)return K.template(E);switch(K.name){case"text":{const U=ne(E);return e.jsxs("div",{className:"gantt-grid-cell-text",style:{paddingLeft:U*14},children:[e.jsx("div",{className:"gantt-row-drag-handle",onMouseDown:L=>{L.preventDefault(),i?.(E.id,L.clientX,L.clientY,"reorder")},children:e.jsx(le.FontAwesomeIcon,{icon:G.faGripVertical})}),E.type==="project"?e.jsx("span",{className:"gantt-tree-icon",onClick:L=>{L.stopPropagation(),y?.({...E,open:!E.open})},children:e.jsx(le.FontAwesomeIcon,{icon:E.open?G.faChevronDown:G.faChevronRight})}):e.jsx("span",{style:{width:16,display:"inline-block"}}),e.jsx("span",{className:"gantt-task-name-text",children:E.text})]})}case"start":return me(E.start,"DD-MM-YYYY");case"end":return me(E.end,"DD-MM-YYYY");case"duration":return D===E.id?e.jsx(p.InputNumber,{size:"small",min:1,value:F,onChange:L=>z(L||1),onBlur:()=>{q(E,F),$(null)},onPressEnter:()=>{q(E,F),$(null)},autoFocus:!0,style:{width:"100%",fontSize:"12px"}}):e.jsxs("div",{onClick:L=>{L.stopPropagation(),$(E.id),z(E.duration)},style:{backgroundColor:"#fff7e6",padding:"2px 8px",borderRadius:"4px",border:"1px solid #ffd591",fontWeight:400,color:"#d46b08",display:"inline-block",fontSize:"12px",cursor:"text"},children:[E.duration," day",E.duration!==1?"s":""]});case"predecessors":{const L=w.filter(W=>W.target===E.id)[0];return e.jsx(or,{task:E,allTasks:a,links:w,onAddDependency:(W,oe,Z,xe)=>b?.(W,oe,Z,xe),onRemoveDependency:W=>c?.(W),onTaskUpdate:y,styleConfig:h,children:e.jsx("div",{style:{cursor:"pointer",minHeight:"24px",width:"100%",display:"flex",alignItems:"center",gap:"4px"},children:L?(()=>{const W=a.find(Z=>Z.id===L.source),oe=W?a.indexOf(W)+1:0;return e.jsx("span",{style:{fontSize:"12px",backgroundColor:"#e6f4ff",border:"1px solid #91caff",color:"#1677ff",padding:"0 7px",borderRadius:"4px",whiteSpace:"nowrap"},children:tr(L,oe)})})():e.jsx("span",{style:{fontSize:"12px",color:"#1890ff",textDecoration:"none",fontWeight:500},onMouseEnter:W=>W.currentTarget.style.textDecoration="underline",onMouseLeave:W=>W.currentTarget.style.textDecoration="none",children:"Add"})})})}case"add":return e.jsx(p.Button,{type:"primary",size:"small",icon:e.jsx(le.FontAwesomeIcon,{icon:G.faPlus,style:{fontSize:12}}),onClick:U=>{U.stopPropagation(),s?.(E.id)},title:"Add Subtask",style:{minWidth:"28px",width:"28px",height:"28px",padding:0,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px"}});case"progress":return e.jsxs("div",{className:"gantt-progress-cell",children:[e.jsx("div",{className:"gantt-progress-bar-bg",children:e.jsx("div",{className:"gantt-progress-bar-fill",style:{width:`${E.progress}%`}})}),e.jsxs("span",{className:"gantt-progress-text",children:[E.progress,"%"]})]});case"index":return e.jsx("span",{style:{color:"#8c8c8c"},children:a.indexOf(E)+1});default:return E[K.name]||""}};return e.jsxs("div",{className:"gantt-grid",ref:j,children:[e.jsx("div",{className:"gantt-grid-header",style:{display:"flex",minWidth:"100%"},children:o.map(E=>e.jsx("div",{className:"gantt-grid-header-cell",style:{width:E.width,minWidth:E.width,justifyContent:E.align==="center"?"center":"flex-start"},children:E.name==="add"?e.jsx("span",{style:{fontSize:11,color:"#64748b",fontWeight:600,whiteSpace:"nowrap"},children:"Add"}):e.jsxs(e.Fragment,{children:[E.label,E.name==="start"&&e.jsx(le.FontAwesomeIcon,{icon:G.faChevronDown,style:{marginLeft:8,fontSize:10,color:"#64748b"}})]})},E.name))}),e.jsx("div",{className:"gantt-grid-body",children:t.map(E=>{const K=u?.id===E.id,U=u?.descendantIds.includes(E.id);return e.jsxs("div",{className:`gantt-grid-row ${l===E.id?"selected":""} ${K?"dragging-row":""} ${U?"descendant-dragging-row":""} ${T?.taskId===E.id?`drop-target-${T.position}`:""}`,onClick:()=>r(E.id),onContextMenu:L=>x?.(L,E.id),style:{display:"flex",minWidth:"100%"},children:[o.map(L=>{const W=L.name==="add";return e.jsx("div",{className:"gantt-grid-cell",style:{width:L.width,minWidth:L.width,textAlign:L.align||"left",display:"flex",alignItems:"center",justifyContent:W?"center":L.name==="text"?"flex-start":L.align==="center"?"center":L.align==="right"?"flex-end":"flex-start",visibility:"visible",opacity:1},children:fe(E,L)},`${E.id}-${L.name}`)}),T?.taskId===E.id&&e.jsx("div",{className:`gantt-drop-indicator ${T.position}`})]},E.id)})})]})}));yt.displayName="Grid";const Ct=({task:t,position:a,selected:o,dragging:l,onClick:r,onDragStart:x,dragDeltaX:y=0,dragType:i=null,readonly:s=!1})=>{const b=(h,v)=>{s||(h.preventDefault(),h.stopPropagation(),x(h.clientX,h.clientY,v))},c=()=>{const h=["gantt-task-bar"];return t.type==="milestone"&&h.push("milestone"),t.type==="project"&&h.push("project"),o&&h.push("selected"),l&&h.push("dragging"),t.status&&h.push(`status-${t.status}`),h.join(" ")},w=()=>{let h=a.left,v=a.width;return l&&i&&(i==="move"?h+=y:i==="resize-left"?(h+=y,v-=y):i==="resize-right"&&(v+=y)),{left:`${h}px`,width:`${Math.max(v,0)}px`,backgroundColor:t.color||void 0}},T=(h=!1)=>e.jsxs(e.Fragment,{children:[!s&&!h&&e.jsx("div",{className:"gantt-task-resize-handle gantt-task-resize-left",onMouseDown:v=>b(v,"resize-left")}),!h&&t.type!=="milestone"&&e.jsx("div",{className:"gantt-task-progress",style:{width:`${t.progress}%`},children:t.progress>5&&t.progress<100&&e.jsxs("span",{className:"gantt-task-progress-text",children:[t.progress,"%"]})}),e.jsx("div",{className:"gantt-task-content",children:!h&&e.jsx("span",{className:"gantt-task-text",children:t.text})}),!s&&!h&&e.jsx("div",{className:"gantt-task-resize-handle gantt-task-resize-right",onMouseDown:v=>b(v,"resize-right")})]}),u=e.jsxs("div",{className:"gantt-tooltip",children:[e.jsx("div",{className:"gantt-tooltip-title",children:t.text}),e.jsxs("div",{className:"gantt-tooltip-dates",children:[me(t.start,"MMM D")," - ",me(t.end,"MMM D")]}),e.jsxs("div",{className:"gantt-tooltip-progress",children:["Progress: ",t.progress,"%"]}),t.owner&&e.jsxs("div",{className:"gantt-tooltip-owner",children:["Owner: ",t.owner]})]});if(t.segments&&t.segments.length>0||t.onHoldPeriods&&t.onHoldPeriods.length>0){const h=t.end.getTime()-t.start.getTime(),v=t.segments&&t.segments.length>0?t.segments:[{start:t.start,end:t.end,duration:t.duration||0}];return e.jsxs("div",{className:"gantt-task-group",children:[t.onHoldPeriods?.map((j,D)=>e.jsx("div",{className:"gantt-on-hold-period",style:{left:`${a.left+(j.start.getTime()-t.start.getTime())/h*a.width}px`,width:`${(j.end.getTime()-j.start.getTime())/h*a.width}px`}},`hold-${D}`)),v.map((j,D)=>e.jsx(p.Tooltip,{title:u,mouseEnterDelay:.5,children:e.jsx("div",{className:c()+" segment",style:{left:`${a.left+(j.start.getTime()-t.start.getTime())/h*a.width}px`,width:`${(j.end.getTime()-j.start.getTime())/h*a.width}px`,backgroundColor:t.color||void 0},onClick:r,onMouseDown:$=>b($,"move"),children:T(D>0)})},`seg-${D}`))]})}return e.jsx(p.Tooltip,{title:u,mouseEnterDelay:.5,children:e.jsx("div",{className:c(),style:w(),onClick:r,onMouseDown:h=>b(h,"move"),children:T()})})},ar=({links:t,tasks:a,getTaskPosition:o})=>{const l=i=>a.find(s=>s.id===i),r=g.useMemo(()=>{let i=0,s=0;return a.forEach(b=>{try{const c=o(b);c&&typeof c.left=="number"&&typeof c.width=="number"&&(i=Math.max(i,c.left+c.width)),c&&typeof c.top=="number"&&typeof c.height=="number"&&(s=Math.max(s,c.top+c.height))}catch(c){console.warn("Failed to position task for link rendering:",b.id,c)}}),{width:Math.max(i,1e3),height:Math.max(s,100)}},[a,o]),x=i=>{const s=l(i.source),b=l(i.target);if(!s||!b)return"";const c=o(s),w=o(b),T=c.top+c.height/2,u=w.top+w.height/2;let h=0,v=0;switch(i.type){case"e2s":h=c.left+c.width,v=w.left;break;case"s2s":h=c.left,v=w.left;break;case"e2e":h=c.left+c.width,v=w.left+w.width;break;case"s2e":h=c.left,v=w.left+w.width;break}const j=v-h,D=u-T,$=20;if(i.type==="e2s")if(j>=$){const F=h+j/2;return`M ${h},${T} L ${F},${T} L ${F},${u} L ${v},${u}`}else{const F=$/2,z=T+D/2;return`M ${h},${T} L ${h+F},${T} L ${h+F},${z} L ${v-F},${z} L ${v-F},${u} L ${v},${u}`}else if(i.type==="s2s"){const F=Math.min(h,v)-$/2;return`M ${h},${T} L ${F},${T} L ${F},${u} L ${v},${u}`}else if(i.type==="e2e"){const F=Math.max(h,v)+$/2;return`M ${h},${T} L ${F},${T} L ${F},${u} L ${v},${u}`}else if(i.type==="s2e")if(j<=-$){const F=h+j/2;return`M ${h},${T} L ${F},${T} L ${F},${u} L ${v},${u}`}else{const F=$/2,z=T+D/2;return`M ${h},${T} L ${h-F},${T} L ${h-F},${z} L ${v+F},${z} L ${v+F},${u} L ${v},${u}`}return""},y=i=>{const s=l(i.target);if(!s)return"";const b=o(s),c=b.top+b.height/2,w=8,T=6;let u=0,h=!0;return i.type==="e2s"||i.type==="s2s"?(u=b.left,h=!0):(u=b.left+b.width,h=!1),h?`M ${u},${c} L ${u-w},${c-T/2} L ${u-w},${c+T/2} Z`:`M ${u},${c} L ${u+w},${c-T/2} L ${u+w},${c+T/2} Z`};return t.length===0?null:e.jsx("svg",{className:"gantt-links-layer",style:{overflow:"visible",width:r.width,height:r.height,position:"absolute",top:0,left:0,pointerEvents:"none"},children:t.map(i=>{const s=l(i.source),b=l(i.target);if(!s||!b)return null;const c=x(i),w=y(i);return!c||!w?null:e.jsxs("g",{className:"gantt-link",children:[e.jsx("path",{d:c,fill:"none",strokeWidth:"1.5",className:"gantt-link-line"}),e.jsx("path",{d:w,className:"gantt-link-arrow"})]},i.id)})})},sr=(t,a,o=60,l="day",r=1)=>{const[x,y]=g.useState({taskId:null,initialX:0,initialY:0,initialStart:new Date,initialEnd:new Date,type:null,dragDeltaX:0,dragDeltaY:0}),i=g.useCallback((c,w,T,u)=>{const h=t.find(v=>v.id===c);h&&y({taskId:c,initialX:w,initialY:T,initialStart:new Date(h.start),initialEnd:new Date(h.end),type:u,dragDeltaX:0,dragDeltaY:0})},[t]),s=g.useCallback((c,w)=>{if(!x.taskId||!x.type)return null;const T=c-x.initialX,u=w-x.initialY;if(y(F=>({...F,dragDeltaX:T,dragDeltaY:u})),x.type==="reorder")return null;const h=t.find(F=>F.id===x.taskId);if(!h)return null;const v=Math.round(T/o);let j=new Date(x.initialStart),D=new Date(x.initialEnd);switch(x.type){case"move":j=he(x.initialStart,v*r,l),D=he(x.initialEnd,v*r,l);break;case"resize-left":j=he(x.initialStart,v*r,l),j>=D&&(j=he(D,-r,l));break;case"resize-right":D=he(x.initialEnd,v*r,l),D<=j&&(D=he(j,r,l));break}const $=et(j,D);return{...h,start:j,end:D,duration:$}},[x,t,o,r,l]),b=g.useCallback(c=>{if(c&&a){const{id:w,...T}=c;a(w,T)}y({taskId:null,initialX:0,initialY:0,initialStart:new Date,initialEnd:new Date,type:null,dragDeltaX:0,dragDeltaY:0})},[a]);return{dragState:x,handleDragStart:i,handleDrag:s,handleDragEnd:b}},gt=g.forwardRef(({tasks:t,links:a,range:o,scales:l,config:r,selectedTask:x,onTaskClick:y,onTaskDragStart:i,onTaskDragEnd:s,onTaskUpdate:b,zoomLevel:c,baselines:w},T)=>{const[u,h]=g.useState(t),v=(r.columnWidth||60)*c,j=r.baselines&&w&&w.size>0,{dragState:D,handleDragStart:$,handleDrag:F,handleDragEnd:z}=sr(u,b,v,l[1].unit,l[1].step);g.useEffect(()=>{(t.length!==u.length||t.some((M,P)=>{const N=u[P];return!N||M.id!==N.id||M.start.getTime()!==N.start.getTime()||M.end.getTime()!==N.end.getTime()}))&&h(t)},[t]);const ne=g.useCallback(f=>{const M=[];let P=new Date(o.start);for(;P<=o.end;)M.push({date:new Date(P),label:me(P,f.format||"D")}),P=he(P,f.step,f.unit);return M},[o.start,o.end]),q=g.useCallback(f=>{const M=l[1],P=o.start.getTime(),_=f.getTime()-P,re={hour:36e5,day:864e5,week:6048e5,month:2592e6,quarter:7776e6,year:31536e6}[M.unit]||864e5;return _/(re*M.step)*v},[l,o.start,v]),fe=f=>{const M=q(f.start),P=q(f.end);return{left:M,width:Math.max(P-M,0)}},E=f=>{const M=q(f.start),P=q(f.end);return{left:M,width:Math.max(P-M,0)}},K=f=>{const M=fe(f),P=u.findIndex(re=>re.id===f.id),N=r.rowHeight||48,_=32,ae=(N-_)/2;return{left:M.left,width:M.width,top:P*N+ae,height:_}},U=g.useRef(null),L=g.useCallback(f=>{D.taskId&&D.type&&(U.current&&cancelAnimationFrame(U.current),U.current=requestAnimationFrame(()=>{const M=F(f.clientX,f.clientY);M&&h(P=>P.map(N=>N.id===M.id?M:N))}))},[D,F]),W=g.useCallback(()=>{if(D.taskId){const f=u.find(M=>M.id===D.taskId);z(f||null),s()}},[D,u,z,s]),oe=l[1],Z=g.useMemo(()=>ne(oe),[ne,oe]),xe=g.useCallback(()=>{const f=[];let M=-1,P=-1,N=0,_="";return Z.forEach(ae=>{const re=ae.date.getMonth(),Pe=ae.date.getFullYear(),se=me(ae.date,"MMM YYYY");re!==M||Pe!==P?(M!==-1&&f.push({label:_,width:N}),M=re,P=Pe,N=v,_=se):N+=v}),M!==-1&&f.push({label:_,width:N}),f},[Z,v]),Fe=g.useCallback(()=>{const f=[];let M=-1,P=0,N=-1,_=-1,ae="";return Z.forEach(re=>{const se=re.date.getDate()<=15?0:1,Le=re.date.getMonth(),_e=re.date.getFullYear(),Oe=me(re.date,"MMM"),Te=new Date(_e,Le+1,0).getDate(),Ce=se===0?`${Oe} 1 - 15`:`${Oe} 16 - ${Te}`;se!==M||Le!==N||_e!==_?(M!==-1&&f.push({label:ae,width:P}),M=se,N=Le,_=_e,P=v,ae=Ce):P+=v}),M!==-1&&f.push({label:ae,width:P}),f},[Z,v]),ke=g.useMemo(()=>xe(),[xe]),A=g.useMemo(()=>Fe(),[Fe]),B=g.useMemo(()=>Z.length*v,[Z.length,v]),ue=g.useMemo(()=>{const f=new Date;return f.setHours(0,0,0,0),f},[]),ee=g.useMemo(()=>{if(!r.showTodayLine)return null;const f=q(ue);return f>=-v&&f<=B+v?Math.max(0,Math.min(f,B)):null},[r.showTodayLine,ue,B,v,q]),te=g.useMemo(()=>{if(r.projectStartDate)return Re(r.projectStartDate);if(t.length>0){const f=t.map(M=>M.start.getTime());return Re(new Date(Math.min(...f)))}return null},[r.projectStartDate,t]),Q=g.useMemo(()=>{if(!r.showProjectStartLine||!te)return null;const f=q(te);return f>=-v&&f<=B+v?Math.max(0,Math.min(f,B)):null},[r.showProjectStartLine,te,B,v,q]);return e.jsxs("div",{className:"gantt-timeline-container",ref:T,onMouseMove:L,onMouseUp:W,style:{width:B,position:"relative"},children:[e.jsxs("div",{className:"gantt-timeline-header",style:{width:B,minWidth:B,position:"relative"},children:[ee!==null&&r.showTodayLine&&r.todayLineLabel&&r.todayLineLabel!==""&&e.jsx("div",{className:"gantt-today-line-label",style:{position:"absolute",top:"calc(var(--gantt-scale-height, 24px) * 2)",left:`${ee}px`,transform:"translateX(-50%)",backgroundColor:r.todayLineColor||"#ff4d4f",color:"#ffffff",padding:"4px 10px",borderRadius:"4px",fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 2px 6px rgba(0, 0, 0, 0.2)",lineHeight:"1.2",zIndex:101,pointerEvents:"none",...r.todayLineLabelStyle},children:r.todayLineLabel}),Q!==null&&r.showProjectStartLine&&r.projectStartLineLabel&&r.projectStartLineLabel!==""&&e.jsx("div",{className:"gantt-project-start-line-label",style:{position:"absolute",top:"calc(var(--gantt-scale-height, 24px) * 2)",left:`${Q}px`,transform:"translateX(-50%)",backgroundColor:r.projectStartLineColor||"#40a9ff",color:"#ffffff",padding:"4px 10px",borderRadius:"4px",fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 2px 6px rgba(0, 0, 0, 0.2)",lineHeight:"1.2",zIndex:101,pointerEvents:"none",...r.projectStartLineLabelStyle},children:r.projectStartLineLabel}),e.jsx("div",{className:"gantt-timeline-scale gantt-timeline-scale-month",style:{width:B},children:ke.map((f,M)=>e.jsx("div",{className:"gantt-timeline-cell",style:{width:f.width,minWidth:f.width,maxWidth:f.width,borderRight:M===ke.length-1?"none":"var(--wx-gantt-border)"},children:f.label},`top-${M}`))}),e.jsx("div",{className:"gantt-timeline-scale gantt-timeline-scale-range",style:{width:B},children:A.map((f,M)=>e.jsx("div",{className:"gantt-timeline-cell",style:{width:f.width,minWidth:f.width,maxWidth:f.width,borderRight:M===A.length-1?"none":"var(--wx-gantt-border)"},children:f.label},`mid-${M}`))}),e.jsx("div",{className:"gantt-timeline-scale gantt-timeline-scale-day",style:{width:B},children:Z.map((f,M)=>{const P=r.weekends&&ft(f.date),N=r.holidays&&mt(f.date,r.holidays);return e.jsx("div",{className:`gantt-timeline-cell ${P?"weekend":""} ${N?"holiday":""}`,style:{width:v,minWidth:v,maxWidth:v,borderRight:M===Z.length-1?"none":"var(--wx-gantt-border)"},children:f.label},`day-${M}`)})})]}),e.jsxs("div",{className:"gantt-timeline-body",style:{width:B,position:"relative"},children:[ee!==null&&e.jsxs(e.Fragment,{children:[r.showTodayLineMarker!==!1&&(()=>{const f=r.todayLineMarkerSize||8,M=r.todayLineColor||"#ff4d4f",P=r.todayLineMarkerStyle||"triangle",N=r.todayLineOpacity!==void 0?r.todayLineOpacity:1;return P==="triangle"?e.jsx("div",{className:"gantt-today-line-marker",style:{position:"absolute",left:`${ee}px`,top:"-4px",transform:"translateX(-50%)",width:0,height:0,borderLeft:`${f}px solid transparent`,borderRight:`${f}px solid transparent`,borderBottom:`${f}px solid ${M}`,zIndex:7,pointerEvents:"none",opacity:N}}):P==="arrow"?e.jsx("div",{className:"gantt-today-line-marker",style:{position:"absolute",left:`${ee}px`,top:"-6px",transform:"translateX(-50%)",width:0,height:0,borderLeft:`${f}px solid transparent`,borderRight:`${f}px solid transparent`,borderBottom:`${f*.7}px solid ${M}`,zIndex:7,pointerEvents:"none",opacity:N}}):P==="dot"?e.jsx("div",{className:"gantt-today-line-marker",style:{position:"absolute",left:`${ee}px`,top:`-${f/2}px`,transform:"translateX(-50%)",width:`${f}px`,height:`${f}px`,borderRadius:"50%",backgroundColor:M,zIndex:7,pointerEvents:"none",opacity:N}}):null})(),e.jsx("div",{className:"gantt-today-line",style:{position:"absolute",left:`${ee}px`,top:0,bottom:0,width:`${r.todayLineWidth||1}px`,backgroundColor:r.todayLineColor||"#ff4d4f",opacity:r.todayLineOpacity!==void 0?r.todayLineOpacity:1,borderLeft:r.todayLineStyle==="dashed"?`${r.todayLineWidth||1}px dashed ${r.todayLineColor||"#ff4d4f"}`:r.todayLineStyle==="dotted"?`${r.todayLineWidth||1}px dotted ${r.todayLineColor||"#ff4d4f"}`:"none",zIndex:6,pointerEvents:"none"}})]}),Q!==null&&e.jsxs(e.Fragment,{children:[r.showProjectStartLineMarker!==!1&&(()=>{const f=r.projectStartLineMarkerSize||8,M=r.projectStartLineColor||"#40a9ff",P=r.projectStartLineMarkerStyle||"triangle",N=r.projectStartLineOpacity!==void 0?r.projectStartLineOpacity:1;return P==="triangle"?e.jsx("div",{className:"gantt-project-start-line-marker",style:{position:"absolute",left:`${Q}px`,top:"-4px",transform:"translateX(-50%)",width:0,height:0,borderLeft:`${f}px solid transparent`,borderRight:`${f}px solid transparent`,borderBottom:`${f}px solid ${M}`,zIndex:7,pointerEvents:"none",opacity:N}}):P==="arrow"?e.jsx("div",{className:"gantt-project-start-line-marker",style:{position:"absolute",left:`${Q}px`,top:"-6px",transform:"translateX(-50%)",width:0,height:0,borderLeft:`${f}px solid transparent`,borderRight:`${f}px solid transparent`,borderBottom:`${f*.7}px solid ${M}`,zIndex:7,pointerEvents:"none",opacity:N}}):P==="dot"?e.jsx("div",{className:"gantt-project-start-line-marker",style:{position:"absolute",left:`${Q}px`,top:`-${f/2}px`,transform:"translateX(-50%)",width:`${f}px`,height:`${f}px`,borderRadius:"50%",backgroundColor:M,zIndex:7,pointerEvents:"none",opacity:N}}):null})(),e.jsx("div",{className:"gantt-project-start-line",style:{position:"absolute",left:`${Q}px`,top:0,bottom:0,width:`${r.projectStartLineWidth||1}px`,backgroundColor:r.projectStartLineColor||"#40a9ff",opacity:r.projectStartLineOpacity!==void 0?r.projectStartLineOpacity:1,borderLeft:r.projectStartLineStyle==="dashed"?`${r.projectStartLineWidth||1}px dashed ${r.projectStartLineColor||"#40a9ff"}`:r.projectStartLineStyle==="dotted"?`${r.projectStartLineWidth||1}px dotted ${r.projectStartLineColor||"#40a9ff"}`:"none",zIndex:6,pointerEvents:"none"}})]}),e.jsx("div",{className:"gantt-timeline-grid",children:Z.map((f,M)=>{const P=r.weekends&&ft(f.date),N=r.holidays&&mt(f.date,r.holidays);return e.jsx("div",{className:`gantt-timeline-grid-column ${P?"weekend":""} ${N?"holiday":""}`,style:{width:v,minWidth:v}},M)})}),a.length>0&&e.jsx(ar,{links:a,tasks:u,getTaskPosition:K}),e.jsx("div",{className:"gantt-timeline-tasks",style:{width:B},children:u.map(f=>{const M=fe(f),P=j?w?.get(f.id):void 0,N=P?E(P):void 0;return e.jsxs("div",{className:"gantt-timeline-row",children:[P&&N&&e.jsx("div",{className:`gantt-baseline-bar ${f.type==="milestone"?"milestone":""}`,style:{left:`${N.left}px`,width:`${N.width}px`},title:`Baseline: ${P.start.toLocaleDateString()} - ${P.end.toLocaleDateString()}`}),e.jsx(Ct,{task:f,position:M,selected:x===f.id,dragging:D.taskId===f.id,dragDeltaX:D.dragDeltaX,dragType:D.type,onClick:()=>y(f.id),onDragStart:(_,ae,re)=>{$(f.id,_,ae,re),i(f.id,_,ae)},readonly:r.readonly})]},f.id)})})]})]})});gt.displayName="Timeline";const bt=g.forwardRef((t,a)=>e.jsx("div",{className:"gantt-chart-wrapper",style:{flex:1,minWidth:0},children:e.jsx(gt,{...t,ref:a})}));bt.displayName="Chart";const{Search:ir}=p.Input,Nt=({onFilterChange:t,owners:a=[],uiConfig:o={}})=>{const[l,r]=g.useState({searchText:"",status:"all",priority:"all",owner:""}),x=s=>{const b={...l,...s};r(b),t(b)},y=()=>{const s={searchText:"",status:"all",priority:"all",owner:""};r(s),t(s)},i=l.searchText!==""||l.status!=="all"||l.priority!=="all"||l.owner!=="";return e.jsx("div",{className:"gantt-filter-container",children:e.jsxs("div",{className:"gantt-filter-bar",children:[e.jsx("div",{className:"gantt-filter-left",children:e.jsx(ir,{placeholder:o.searchPlaceholder||"Search stages...",value:l.searchText,onChange:s=>x({searchText:s.target.value}),allowClear:!0,className:"gantt-search-antd",style:{width:250}})}),e.jsxs("div",{className:"gantt-filter-right",children:[e.jsx(p.Select,{value:l.status,onChange:s=>x({status:s}),className:"gantt-filter-select-antd",style:{width:140},options:[{value:"all",label:o.statusOptions?.all||"All Status"},{value:"not-started",label:o.statusOptions?.notStarted||"Not Started"},{value:"in-progress",label:o.statusOptions?.inProgress||"In Progress"},{value:"completed",label:o.statusOptions?.completed||"Completed"}]}),e.jsx(p.Select,{value:l.priority,onChange:s=>x({priority:s}),className:"gantt-filter-select-antd",style:{width:130},options:[{value:"all",label:o.priorityFilterOptions?.all||"All Priority"},{value:"low",label:o.priorityFilterOptions?.low||"Low"},{value:"medium",label:o.priorityFilterOptions?.medium||"Medium"},{value:"high",label:o.priorityFilterOptions?.high||"High"}]}),e.jsx(p.Select,{value:l.owner||void 0,onChange:s=>x({owner:s||""}),className:"gantt-filter-select-antd",style:{width:130},placeholder:o.allOwnersText||"All Owners",allowClear:!0,options:[{value:"",label:o.allOwnersText||"All Owners"},...(a||[]).map(s=>({value:s,label:s}))]}),i&&e.jsx(p.Button,{type:"default",danger:!0,icon:e.jsx(le.FontAwesomeIcon,{icon:G.faTimesCircle}),onClick:y,className:"gantt-filter-clear-antd",children:o.clearFiltersText||"Clear"})]})]})})},Be=(t,a)=>t?typeof t=="string"?e.jsx(le.FontAwesomeIcon,{icon:a}):t:e.jsx(le.FontAwesomeIcon,{icon:a}),At=({zoomLevel:t,setZoomLevel:a,onExport:o,onFilterChange:l,owners:r,onAddTask:x,uiConfig:y,iconConfig:i={},styleConfig:s})=>{const b=Ue(s),c=y.showZoomButtons!==!1,w=y.showExportButtons!==!1,T=c&&w;return e.jsxs("div",{className:"gantt-toolbar-wrapper",children:[e.jsxs("div",{className:"gantt-toolbar",children:[e.jsx("div",{className:"gantt-toolbar-left",children:e.jsx(p.Space,{size:8,children:y.showAddTaskButton!==!1&&e.jsx(p.Button,{type:"primary",icon:Be(i.addTask,G.faPlus),onClick:()=>x?.(),style:b.buttonPrimary,children:y.addTaskButtonText||"New Stage"})})}),e.jsx("div",{className:"gantt-toolbar-right",children:e.jsxs(p.Space,{size:4,children:[c&&e.jsxs(e.Fragment,{children:[e.jsx(p.Tooltip,{title:y.zoomOutTooltip||"Zoom Out",children:e.jsx(p.Button,{icon:Be(i.zoomOut,G.faSearchMinus),onClick:()=>a(Math.max(.5,t-.25)),style:b.buttonSecondary})}),e.jsx(p.Tooltip,{title:y.zoomInTooltip||"Zoom In",children:e.jsx(p.Button,{icon:Be(i.zoomIn,G.faSearchPlus),onClick:()=>a(Math.min(2,t+.25)),style:b.buttonSecondary})}),e.jsx(p.Tooltip,{title:y.resetZoomTooltip||"Reset Zoom",children:e.jsx(p.Button,{icon:Be(i.resetZoom,G.faRotateLeft),onClick:()=>a(1),style:b.buttonSecondary})})]}),T&&e.jsx(p.Divider,{type:"vertical",style:{height:24,margin:"0 4px"}}),w&&e.jsxs(e.Fragment,{children:[e.jsx(p.Tooltip,{title:y.exportCSVTooltip||"Export to CSV",children:e.jsx(p.Button,{icon:Be(i.exportCSV,G.faFileCsv),onClick:()=>o("csv"),style:b.buttonSecondary})}),e.jsx(p.Tooltip,{title:y.exportExcelTooltip||"Export to Excel",children:e.jsx(p.Button,{icon:Be(i.exportExcel,G.faFileExcel),onClick:()=>o("excel"),style:b.buttonSecondary})}),e.jsx(p.Tooltip,{title:y.exportJSONTooltip||"Export to JSON",children:e.jsx(p.Button,{icon:Be(i.exportJSON,G.faFileCode),onClick:()=>o("json"),style:b.buttonSecondary})}),e.jsx(p.Tooltip,{title:y.exportPDFTooltip||"Export to PDF",children:e.jsx(p.Button,{icon:Be(i.exportPDF,G.faFilePdf),onClick:()=>o("pdf"),style:b.buttonSecondary})})]})]})})]}),y.showFilterSearch!==!1&&e.jsx(Nt,{onFilterChange:l,owners:r,uiConfig:y})]})},{Option:Ve}=p.Select,{TextArea:lr}=p.Input,Bt=({onCreateTask:t,onClose:a,uiConfig:o={},parentId:l,parentTaskName:r,styleConfig:x})=>{const[y]=p.Form.useForm(),i=Ue(x),s=b=>{const c=b.start.toDate(),w=new Date(c);w.setDate(w.getDate()+(b.duration||1)),t({text:b.text,start:c,end:w,duration:b.duration||1,progress:b.progress||0,type:b.type,color:typeof b.color=="string"?b.color:b.color?.toHexString?.()||"#4A90E2",owner:b.owner||"",priority:b.priority||"medium",details:b.details||"",parent:l},l),a()};return e.jsx(p.Modal,{title:l?(o.taskCreatorTitle||"Create Checklist")+(r?` for "${r}"`:""):o.taskCreatorTitle||"Create New Stage",open:!0,onCancel:a,onOk:()=>y.submit(),okText:o.taskCreatorOkText||"Create Stage",cancelText:o.taskCreatorCancelText||"Cancel",width:600,className:"gantt-modal-antd",styles:{content:i.modal,header:{borderBottom:`1px solid ${i.modal?.borderColor||"#f0f0f0"}`,marginBottom:16}},okButtonProps:{style:i.buttonPrimary},cancelButtonProps:{style:i.buttonSecondary},children:e.jsxs(p.Form,{form:y,layout:"vertical",onFinish:s,initialValues:{type:"task",priority:"medium",start:Et(),duration:1,progress:0,color:"#4A90E2"},children:[e.jsx(p.Form.Item,{name:"text",label:o.taskNameLabel||"Stage Name",rules:[{required:!0,message:o.taskNameRequired||"Please enter stage name"}],children:e.jsx(p.Input,{placeholder:o.taskNamePlaceholder||"Enter stage name",autoFocus:!0,style:i.input})}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsx(p.Form.Item,{name:"type",label:o.typeLabel||"Type",style:{flex:1},children:e.jsxs(p.Select,{style:i.input,children:[e.jsx(Ve,{value:"task",children:o.taskTypeOptions?.task||"Stage"}),e.jsx(Ve,{value:"milestone",children:o.taskTypeOptions?.milestone||"Milestone"}),e.jsx(Ve,{value:"project",children:o.taskTypeOptions?.project||"Project"})]})}),e.jsx(p.Form.Item,{name:"priority",label:o.priorityLabel||"Priority",style:{flex:1},children:e.jsxs(p.Select,{style:i.input,children:[e.jsx(Ve,{value:"low",children:o.priorityOptions?.low||"Low"}),e.jsx(Ve,{value:"medium",children:o.priorityOptions?.medium||"Medium"}),e.jsx(Ve,{value:"high",children:o.priorityOptions?.high||"High"})]})})]}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsx(p.Form.Item,{name:"start",label:o.startDateLabel||"Start Date",style:{flex:1},children:e.jsx(p.DatePicker,{style:{width:"100%",...i.input}})}),e.jsx(p.Form.Item,{name:"duration",label:o.durationLabel||"Duration (days)",style:{flex:1},children:e.jsx(p.InputNumber,{min:0,style:{width:"100%",...i.input}})})]}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsx(p.Form.Item,{name:"color",label:o.colorLabel||"Color",style:{flex:1},children:e.jsx(p.ColorPicker,{showText:!0})}),e.jsx(p.Form.Item,{name:"progress",label:o.progressLabel||"Progress (%)",style:{flex:1},children:e.jsx(p.InputNumber,{min:0,max:100,style:{width:"100%",...i.input}})})]}),e.jsx(p.Form.Item,{name:"owner",label:o.ownerLabel||"Owner",children:e.jsx(p.Input,{placeholder:o.ownerPlaceholder||"Assign to...",style:i.input})}),e.jsx(p.Form.Item,{name:"details",label:o.detailsLabel||"Details",children:e.jsx(lr,{placeholder:o.detailsPlaceholder||"Add stage description...",rows:3,style:i.input})})]})})},{Option:Xe}=p.Select,{TextArea:dr}=p.Input,{confirm:cr}=p.Modal,_t=({task:t,onUpdate:a,onDelete:o,onClose:l,uiConfig:r={},styleConfig:x})=>{const[y]=p.Form.useForm(),i=Ue(x),s=c=>{const w=c.start.toDate(),T=new Date(w);T.setDate(T.getDate()+(c.duration||1)),a({...t,text:c.text,start:w,end:T,duration:c.duration||1,progress:c.progress||0,type:c.type,color:typeof c.color=="string"?c.color:c.color?.toHexString?.()||"#4A90E2",owner:c.owner||"",priority:c.priority||"medium",details:c.details||""}),l()},b=()=>{cr({title:r.deleteConfirmTitle?`${r.deleteConfirmTitle}: "${t.text}"?`:`Are you sure you want to delete "${t.text}"?`,icon:e.jsx(le.FontAwesomeIcon,{icon:G.faExclamationTriangle,style:{color:"#faad14",marginRight:8}}),content:r.deleteConfirmContent||"This action cannot be undone.",okText:r.deleteConfirmOkText||"Yes, Delete",okType:"danger",cancelText:r.deleteConfirmCancelText||"No",onOk(){o(t.id),l()}})};return e.jsx(p.Modal,{title:r.taskEditorTitle||"Edit Stage",open:!0,onCancel:l,footer:[e.jsx(p.Button,{danger:!0,onClick:b,style:{float:"left",...i.buttonDanger},children:r.taskEditorDeleteText||"Delete"},"delete"),e.jsx(p.Button,{onClick:l,style:i.buttonSecondary,children:r.taskEditorCancelText||"Cancel"},"cancel"),e.jsx(p.Button,{type:"primary",onClick:()=>y.submit(),style:i.buttonPrimary,children:r.taskEditorSaveText||"Save Changes"},"submit")],width:600,className:"gantt-modal-antd",styles:{content:i.modal,header:{borderBottom:`1px solid ${i.modal?.borderColor||"#f0f0f0"}`,marginBottom:16}},children:e.jsxs(p.Form,{form:y,layout:"vertical",onFinish:s,initialValues:{text:t.text,type:t.type||"task",priority:t.priority||"medium",start:Et(t.start),duration:t.duration,progress:t.progress,color:t.color||"#4A90E2",owner:t.owner||"",details:t.details||""},children:[e.jsx(p.Form.Item,{name:"text",label:r.taskNameLabel||"Stage Name",rules:[{required:!0,message:r.taskNameRequired||"Please enter stage name"}],children:e.jsx(p.Input,{placeholder:r.taskNamePlaceholder||"Enter stage name",style:i.input})}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsx(p.Form.Item,{name:"type",label:r.typeLabel||"Type",style:{flex:1},children:e.jsxs(p.Select,{style:i.input,children:[e.jsx(Xe,{value:"task",children:r.taskTypeOptions?.task||"Stage"}),e.jsx(Xe,{value:"milestone",children:r.taskTypeOptions?.milestone||"Milestone"}),e.jsx(Xe,{value:"project",children:r.taskTypeOptions?.project||"Project"})]})}),e.jsx(p.Form.Item,{name:"priority",label:r.priorityLabel||"Priority",style:{flex:1},children:e.jsxs(p.Select,{style:i.input,children:[e.jsx(Xe,{value:"low",children:r.priorityOptions?.low||"Low"}),e.jsx(Xe,{value:"medium",children:r.priorityOptions?.medium||"Medium"}),e.jsx(Xe,{value:"high",children:r.priorityOptions?.high||"High"})]})})]}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsx(p.Form.Item,{name:"start",label:r.startDateLabel||"Start Date",style:{flex:1},children:e.jsx(p.DatePicker,{style:{width:"100%",...i.input}})}),e.jsx(p.Form.Item,{name:"duration",label:r.durationLabel||"Duration (days)",style:{flex:1},children:e.jsx(p.InputNumber,{min:0,style:{width:"100%",...i.input}})})]}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsx(p.Form.Item,{name:"color",label:r.colorLabel||"Color",style:{flex:1},children:e.jsx(p.ColorPicker,{showText:!0})}),e.jsx(p.Form.Item,{name:"progress",label:r.progressLabel||"Progress (%)",style:{flex:1},children:e.jsx(p.InputNumber,{min:0,max:100,style:{width:"100%",...i.input}})})]}),e.jsx(p.Form.Item,{name:"owner",label:r.ownerLabel||"Owner",children:e.jsx(p.Input,{placeholder:r.ownerPlaceholder||"Assign to...",style:i.input})}),e.jsx(p.Form.Item,{name:"details",label:r.detailsLabel||"Details",children:e.jsx(dr,{placeholder:r.detailsPlaceholder||"Add stage description...",rows:3,style:i.input})})]})})},{Title:tt,Text:ze,Paragraph:ur}=p.Typography,{Option:$e}=p.Select,It=({task:t,allTasks:a,links:o,onAddDependency:l,onRemoveDependency:r,onTaskUpdate:x,onClose:y,styleConfig:i})=>{const s=Ue(i),[b,c]=g.useState(""),[w,T]=g.useState("e2s"),[u,h]=g.useState(0),[v,j]=g.useState("day"),[D,$]=g.useState(t.duration),[F,z]=g.useState(""),ne=o.filter(L=>L.target===t.id),q=a.filter(L=>L.id!==t.id&&L.id!==t.parent),fe=()=>{if(b){const L=xt(u,v);if(D!==t.duration&&x){const W=he(new Date(t.start),D,"day");x({...t,duration:D,end:W})}l(b,t.id,w,L),c(""),h(0),j("day")}},E=()=>{if(!F.trim())return;const L=er(F.trim());if(!L){alert(`Invalid format. Use: [TaskNumber][Type][+/-][Lag][Unit]
|
|
15
|
+
Example: 3FS+10d`);return}const W=L.taskNumber-1,oe=a[W];if(!oe){alert(`Task ${L.taskNumber} not found`);return}const Z=rr(L.type),xe=xt(L.lag,L.lagUnit);l(oe.id,t.id,Z,xe),z("")},K=L=>{switch(L){case"e2s":return"Finish-to-Start (FS)";case"s2s":return"Start-to-Start (SS)";case"e2e":return"Finish-to-Finish (FF)";case"s2e":return"Start-to-Finish (SF)"}},U=L=>{switch(L){case"e2s":return"blue";case"s2s":return"green";case"e2e":return"purple";case"s2e":return"orange"}};return e.jsx(p.Modal,{title:e.jsx(tt,{level:4,style:{margin:0,color:s.font?.color},children:"Dependency Editor"}),open:!0,onCancel:y,footer:null,width:700,styles:{content:s.modal,header:{borderBottom:`1px solid ${s.modal?.borderColor||"#f0f0f0"}`}},children:e.jsxs("div",{style:{padding:"8px 0"},children:[e.jsx(p.Alert,{message:"Managing dependencies helps in auto-scheduling and critical path calculation.",type:"info",showIcon:!0,style:{marginBottom:20,...s.font}}),e.jsxs("div",{style:{display:"flex",gap:20,marginBottom:24},children:[e.jsx(p.Card,{title:e.jsx(tt,{level:5,style:{margin:0,fontSize:14,color:s.font?.color},children:"Settings"}),size:"small",style:{flex:1,...s.modal},headStyle:{borderBottom:`1px solid ${s.modal?.borderColor||"#f0f0f0"}`},children:e.jsxs(p.Space,{direction:"vertical",style:{width:"100%"},size:"middle",children:[e.jsxs("div",{children:[e.jsx(ze,{style:{display:"block",marginBottom:8,fontSize:13,color:s.font?.color},children:"Predecessor"}),e.jsx(p.Select,{showSearch:!0,placeholder:"Select a task",optionFilterProp:"children",style:{width:"100%",...s.input},value:b,onChange:c,children:q.map(L=>e.jsxs($e,{value:L.id,children:["[",a.indexOf(L)+1,"] ",L.text]},L.id))})]}),e.jsxs("div",{children:[e.jsx(ze,{style:{display:"block",marginBottom:8,fontSize:13,color:s.font?.color},children:"Type"}),e.jsxs(p.Select,{style:{width:"100%",...s.input},value:w,onChange:T,children:[e.jsx($e,{value:"e2s",children:"Finish-to-Start (FS)"}),e.jsx($e,{value:"s2s",children:"Start-to-Start (SS)"}),e.jsx($e,{value:"e2e",children:"Finish-to-Finish (FF)"}),e.jsx($e,{value:"s2e",children:"Start-to-Finish (SF)"})]})]}),e.jsxs("div",{style:{display:"flex",gap:12},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx(ze,{style:{display:"block",marginBottom:8,fontSize:13,color:s.font?.color},children:"Lag/Lead"}),e.jsx(p.InputNumber,{style:{width:"100%",...s.input},value:u,onChange:L=>h(L||0)})]}),e.jsxs("div",{style:{flex:1},children:[e.jsx(ze,{style:{display:"block",marginBottom:8,fontSize:13,color:s.font?.color},children:"Units"}),e.jsxs(p.Select,{style:{width:"100%",...s.input},value:v,onChange:j,children:[e.jsx($e,{value:"day",children:"Days"}),e.jsx($e,{value:"hour",children:"Hours"}),e.jsx($e,{value:"week",children:"Weeks"}),e.jsx($e,{value:"month",children:"Months"})]})]})]}),e.jsxs("div",{children:[e.jsx(ze,{style:{display:"block",marginBottom:8,fontSize:13,color:s.font?.color},children:"Duration (days)"}),e.jsx(p.InputNumber,{style:{width:"100%",...s.input},min:1,value:D,onChange:L=>$(L||1)})]}),e.jsx(p.Button,{type:"primary",icon:e.jsx(le.FontAwesomeIcon,{icon:G.faPlus,style:{marginRight:8}}),block:!0,onClick:fe,disabled:!b,style:{height:40,marginTop:8,...s.buttonPrimary},children:"Add Dependency"})]})}),e.jsxs(p.Card,{title:e.jsx(tt,{level:5,style:{margin:0,fontSize:14,color:s.font?.color},children:"Quick Add"}),size:"small",style:{width:250,...s.modal},headStyle:{borderBottom:`1px solid ${s.modal?.borderColor||"#f0f0f0"}`},children:[e.jsxs(ur,{type:"secondary",style:{fontSize:12,marginBottom:16,color:s.font?.color,opacity:.7},children:["Format: [TaskNumber][Type][+/-][Lag][Unit]",e.jsx("br",{}),"Example: 3FS+10d"]}),e.jsx(p.Input,{placeholder:"e.g. 5FS+2d",value:F,onChange:L=>z(L.target.value),onPressEnter:E,style:{marginBottom:16,height:40,...s.input}}),e.jsx(p.Button,{block:!0,onClick:E,style:{height:40,...s.buttonSecondary},children:"Apply"})]})]}),e.jsx(p.Divider,{style:{margin:"0 0 24px 0",borderColor:s.modal?.borderColor}}),e.jsxs("div",{style:{maxHeight:300,overflowY:"auto"},children:[e.jsx(tt,{level:5,style:{fontSize:14,marginBottom:16,color:s.font?.color},children:"Current Dependencies"}),e.jsx(p.List,{dataSource:ne,locale:{emptyText:e.jsx(ze,{type:"secondary",style:{color:s.font?.color,opacity:.5},children:"No dependencies added yet."})},renderItem:L=>{const W=a.find(oe=>oe.id===L.source);return e.jsx(p.List.Item,{style:{padding:"12px 16px",background:"#fafafa",borderRadius:8,marginBottom:12,border:`1px solid ${s.listItem?.borderColor||"#f0f0f0"}`},actions:[e.jsx(p.Button,{type:"text",danger:!0,icon:e.jsx(le.FontAwesomeIcon,{icon:G.faTrash}),onClick:()=>r(L.id)},"delete")],children:e.jsx(p.List.Item.Meta,{avatar:e.jsx("div",{style:{width:32,height:32,borderRadius:16,background:"#1890ff",display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:12,fontWeight:"bold"},children:W?a.indexOf(W)+1:"?"}),title:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontWeight:600,color:s.font?.color},children:W?.text||"Unknown Task"}),e.jsx(p.Tag,{color:U(L.type),style:{margin:0},children:K(L.type)})]}),description:e.jsx("div",{style:{display:"flex",alignItems:"center",gap:16,marginTop:4},children:e.jsxs("span",{style:{fontSize:12,color:s.font?.color,opacity:.7},children:[e.jsx(le.FontAwesomeIcon,{icon:G.faLink,style:{marginRight:6}}),"Lag: ",L.lag||0," days"]})})})})}})]}),e.jsxs("div",{style:{marginTop:24,padding:"16px",background:"#fff7e6",borderRadius:8,border:"1px solid #ffe7ba"},children:[e.jsxs(tt,{level:5,style:{fontSize:13,marginBottom:8,display:"flex",alignItems:"center"},children:[e.jsx(le.FontAwesomeIcon,{icon:G.faInfoCircle,style:{marginRight:8,color:"#fa8c16"}}),"Coming soon"]}),e.jsx(ze,{style:{fontSize:12,color:"rgba(0,0,0,0.65)"},children:"Dependency visualization on the chart and automatic lag calculations based on working hours."})]})]})})},pr=({x:t,y:a,task:o,onEdit:l,onDelete:r,onCopy:x,onDependencies:y,onConvertToMilestone:i,onConvertToTask:s,onConvertToProject:b,onAutoSchedule:c,onClose:w,styleConfig:T})=>{const u=Ue(T);if(!o)return null;const h=[{key:"edit",label:"Edit",icon:e.jsx(le.FontAwesomeIcon,{icon:G.faEdit}),onClick:()=>{l(),w()}},{key:"copy",label:"Copy",icon:e.jsx(le.FontAwesomeIcon,{icon:G.faCopy}),onClick:()=>{x(),w()}},{key:"dependencies",label:"Dependencies",icon:e.jsx(le.FontAwesomeIcon,{icon:G.faLink}),onClick:()=>{y(),w()}},{type:"divider"},{key:"convert",label:"Convert to",type:"submenu",children:[{key:"milestone",label:"Milestone",icon:e.jsx(le.FontAwesomeIcon,{icon:G.faFlag}),disabled:o.type==="milestone",onClick:()=>{i(),w()}},{key:"task",label:"Task",icon:e.jsx(le.FontAwesomeIcon,{icon:G.faTasks}),disabled:o.type==="task",onClick:()=>{s(),w()}},{key:"project",label:"Project",icon:e.jsx(le.FontAwesomeIcon,{icon:G.faFolder}),disabled:o.type==="project",onClick:()=>{b(),w()}}]},{key:"auto-schedule",label:"Auto Schedule",icon:e.jsx(le.FontAwesomeIcon,{icon:G.faRotateLeft}),onClick:()=>{c?.(),w()}},{type:"divider"},{key:"delete",label:"Delete",icon:e.jsx(le.FontAwesomeIcon,{icon:G.faTrash}),danger:!0,onClick:()=>{r(),w()}}];return e.jsx("div",{className:"gantt-context-menu",style:{position:"fixed",left:`${t}px`,top:`${a}px`,zIndex:1e4},onClick:v=>v.stopPropagation(),children:e.jsx(p.Menu,{items:h,style:{boxShadow:u.popover?.boxShadow||"0 4px 12px rgba(0, 0, 0, 0.15)",borderRadius:u.popover?.borderRadius||"6px",border:`1px solid ${u.popover?.borderColor||"#e0e0e0"}`,backgroundColor:u.popover?.backgroundColor,color:u.font?.color,fontFamily:u.font?.fontFamily}})})},Yt=(t,a=[])=>{const[o,l]=g.useState([]),[r,x]=g.useState(-1),[y,i]=g.useState(t),[s,b]=g.useState(a);g.useEffect(()=>{i(t)},[t]),g.useEffect(()=>{b(a)},[a]);const c=g.useCallback(($,F,z)=>{const ne={type:$,before:F,after:z,timestamp:Date.now()},q=o.slice(0,r+1);q.push(ne),q.length>50?q.shift():x(r+1),l(q)},[o,r]),w=g.useCallback(()=>{if(r<0)return;const $=o[r];i($.before.tasks),b($.before.links),x(r-1)},[o,r]),T=g.useCallback(()=>{if(r>=o.length-1)return;const $=o[r+1];i($.after.tasks),b($.after.links),x(r+1)},[o,r]),u=r>=0,h=r<o.length-1,v=g.useCallback($=>{const F={tasks:y,links:s},z=y.map(q=>q.id===$.id?$:q);c("task_update",F,{tasks:z,links:s}),i(z)},[y,s,c]),j=g.useCallback($=>{const F={tasks:y,links:s},z=[...y,$];c("task_create",F,{tasks:z,links:s}),i(z)},[y,s,c]),D=g.useCallback($=>{const F={tasks:y,links:s},z=y.filter(fe=>fe.id!==$),ne=s.filter(fe=>fe.source!==$&&fe.target!==$);c("task_delete",F,{tasks:z,links:ne}),i(z),b(ne)},[y,s,c]);return{tasks:y,links:s,setTasks:i,setLinks:b,undo:w,redo:T,canUndo:u,canRedo:h,updateTask:v,createTask:j,deleteTask:D,saveState:c,history:o}},Rt=(t,a,o={mode:"forward"})=>{const l=new Map,r=new Map;return t.forEach(x=>{l.set(x.id,[]),r.set(x.id,[])}),a.forEach(x=>{x.type==="e2s"&&(l.get(x.target)?.push(x.source),r.get(x.source)?.push(x.target))}),o.mode==="forward"?hr(t,l,o):fr(t,r,o)},hr=(t,a,o)=>{const l=new Map,r=new Set,x=o.projectStart||new Date,y=i=>{if(r.has(i))return;const s=t.find(h=>h.id===i);if(!s)return;const b=a.get(i)||[];b.forEach(h=>y(h));let c=x;b.forEach(h=>{const v=l.get(h);v&&v.end>c&&(c=new Date(v.end))});const w=new Date(c),T=he(w,s.duration,"day"),u={...s,start:w,end:T};l.set(i,u),r.add(i)};return t.forEach(i=>y(i.id)),t.map(i=>l.get(i.id)||i)},fr=(t,a,o)=>{const l=new Map,r=new Set,x=o.projectEnd||new Date(Math.max(...t.map(i=>i.end.getTime()))),y=i=>{if(r.has(i))return;const s=t.find(h=>h.id===i);if(!s)return;const b=a.get(i)||[];b.forEach(h=>y(h));let c=x;b.forEach(h=>{const v=l.get(h);v&&v.start<c&&(c=new Date(v.start))});const w=new Date(c),T=he(w,-s.duration,"day"),u={...s,start:T,end:w};l.set(i,u),r.add(i)};return t.forEach(i=>y(i.id)),t.map(i=>l.get(i.id)||i)},mr=Object.freeze(Object.defineProperty({__proto__:null,autoSchedule:Rt,levelResources:t=>{const a=new Map;t.forEach(l=>{l.owner&&(a.has(l.owner)||a.set(l.owner,[]),a.get(l.owner).push(l))});const o=[...t];return a.forEach(l=>{const r=l.sort((x,y)=>x.start.getTime()-y.start.getTime());for(let x=1;x<r.length;x++){const y=r[x],i=r[x-1];if(y.start<i.end){const s=o.findIndex(b=>b.id===y.id);if(s>=0){const b=new Date(i.end),c=he(b,y.duration,"day");o[s]={...y,start:b,end:c}}}}}),o}},Symbol.toStringTag,{value:"Module"})),zt=t=>{const a=new Map;return t.forEach(o=>{a.set(o.id,{taskId:o.id,start:new Date(o.start),end:new Date(o.end)})}),a},Wt=t=>{const a=["ID","Task Name","Start Date","End Date","Duration","Progress","Type","Owner","Priority"],o=t.map(r=>[r.id,r.text,me(r.start,"YYYY-MM-DD"),me(r.end,"YYYY-MM-DD"),r.duration.toString(),`${r.progress}%`,r.type||"task",r.owner||"",r.priority||"medium"]),l=[a.join(","),...o.map(r=>r.map(x=>`"${x}"`).join(","))].join(`
|
|
16
|
+
`);it(l,"gantt-tasks.csv","text/csv")},Ht=t=>{const a=["ID","Task Name","Start Date","End Date","Duration","Progress","Type","Owner","Priority","Details"],o=t.map(r=>[r.id,r.text,me(r.start,"MM/DD/YYYY"),me(r.end,"MM/DD/YYYY"),r.duration.toString(),r.progress.toString(),r.type||"task",r.owner||"",r.priority||"medium",r.details||""]),l="\uFEFF"+[a.join(" "),...o.map(r=>r.map(x=>x.replace(/\t/g," ")).join(" "))].join(`
|
|
17
|
+
`);it(l,"gantt-tasks.xls","application/vnd.ms-excel")},Ut=(t,a)=>{const o={tasks:t,links:a,exported:new Date().toISOString(),version:"1.0"},l=JSON.stringify(o,null,2);it(l,"gantt-project.json","application/json")},Vt=t=>{const a=`
|
|
18
18
|
GANTT CHART PROJECT
|
|
19
19
|
Generated: ${new Date().toLocaleString()}
|
|
20
20
|
|
|
21
21
|
Tasks:
|
|
22
|
-
${t.map((o,
|
|
23
|
-
${
|
|
24
|
-
Start: ${
|
|
25
|
-
End: ${
|
|
22
|
+
${t.map((o,l)=>`
|
|
23
|
+
${l+1}. ${o.text}
|
|
24
|
+
Start: ${me(o.start,"MM/DD/YYYY")}
|
|
25
|
+
End: ${me(o.end,"MM/DD/YYYY")}
|
|
26
26
|
Duration: ${o.duration} days
|
|
27
27
|
Progress: ${o.progress}%
|
|
28
28
|
${o.owner?`Owner: ${o.owner}`:""}
|
|
29
29
|
`).join(`
|
|
30
30
|
`)}
|
|
31
|
-
`.trim();dt(s,"gantt-report.txt","text/plain"),alert("PDF export is a simplified text version. For full PDF with charts, a PDF library would be needed.")},xr=(t,s,o="png")=>{if(!document.getElementById(t)){alert("Could not find Gantt chart element to export");return}if(o==="svg"){alert("SVG export requires additional library. Use PNG or implement with dom-to-svg.");return}alert("Image export requires html2canvas library. Install with: npm install html2canvas")},dt=(t,s,o)=>{const i=new Blob([t],{type:o}),r=URL.createObjectURL(i);yr(r,s),URL.revokeObjectURL(r)},yr=(t,s)=>{const o=document.createElement("a");o.href=t,o.download=s,document.body.appendChild(o),o.click(),document.body.removeChild(o)},gr=Object.freeze(Object.defineProperty({__proto__:null,exportToCSV:Ht,exportToExcel:Ut,exportToImage:xr,exportToJSON:Vt,exportToPDF:Xt,importFromJSON:t=>new Promise((s,o)=>{const i=new FileReader;i.onload=r=>{try{const y=r.target?.result,g=JSON.parse(y),a=g.tasks.map(u=>({...u,start:new Date(u.start),end:new Date(u.end)}));s({tasks:a,links:g.links||[]})}catch{o(new Error("Invalid JSON file"))}},i.onerror=()=>o(new Error("Failed to read file")),i.readAsText(t)})},Symbol.toStringTag,{value:"Module"})),qt=(t,s)=>t.filter(o=>{if(s.searchText){const i=s.searchText.toLowerCase(),r=o.text.toLowerCase().includes(i),y=o.owner?.toLowerCase().includes(i),g=o.details?.toLowerCase().includes(i);if(!r&&!y&&!g)return!1}if(s.status!=="all"&&(o.progress===0?"not-started":o.progress===100?"completed":"in-progress")!==s.status||s.priority!=="all"&&o.priority!==s.priority||s.owner&&o.owner!==s.owner)return!1;if(s.dateRange){const i=o.start.getTime(),r=s.dateRange.start.getTime(),y=s.dateRange.end.getTime();if(i<r||i>y)return!1}return!0}),br=t=>[{name:"index",label:"",width:40,align:"center"},{name:"text",label:t?.columnLabels?.name||"Name",width:250,align:"left",resize:!0},{name:"predecessors",label:t?.columnLabels?.dependsOn||"Depends on",width:120,align:"left"},{name:"duration",label:t?.columnLabels?.duration||"Duration",width:110,align:"left"},{name:"start",label:t?.columnLabels?.start||"Start",width:130,align:"left"},{name:"add",label:"",width:50,align:"center"}],wr=[{unit:"month",step:1,format:"MMM"},{unit:"day",step:1,format:"D"}],vr={headerTitle:"Iris Gantt",showHeader:!0,showAddTaskButton:!0,showBaselineButton:!1,showZoomButtons:!0,showExportButtons:!0,showFilterSearch:!0,addTaskButtonText:"New Task",baselineButtonText:"Set Baseline",baselineButtonTextActive:"Baselines",zoomOutTooltip:"Zoom Out",zoomInTooltip:"Zoom In",resetZoomTooltip:"Reset Zoom",exportCSVTooltip:"Export to CSV",exportExcelTooltip:"Export to Excel",exportJSONTooltip:"Export to JSON",exportPDFTooltip:"Export to PDF",hideBaselinesTooltip:"Hide Baselines",showBaselinesTooltip:"Show Baselines",taskCreatorTitle:"Create New Task",taskCreatorOkText:"Create Task",taskCreatorCancelText:"Cancel",taskNameLabel:"Task Name",taskNamePlaceholder:"Enter task name",typeLabel:"Type",priorityLabel:"Priority",startDateLabel:"Start Date",durationLabel:"Duration (days)",colorLabel:"Color",progressLabel:"Progress (%)",ownerLabel:"Owner",ownerPlaceholder:"Assign to...",detailsLabel:"Details",detailsPlaceholder:"Add task description...",taskTypeOptions:{task:"Task",milestone:"Milestone",project:"Project"},priorityOptions:{low:"Low",medium:"Medium",high:"High"},taskEditorTitle:"Edit Task",taskEditorSaveText:"Save Changes",taskEditorCancelText:"Cancel",taskEditorDeleteText:"Delete",deleteConfirmTitle:"Delete Task",deleteConfirmContent:"This action cannot be undone.",deleteConfirmOkText:"Yes, Delete",deleteConfirmCancelText:"No",searchPlaceholder:"Search tasks...",allOwnersText:"All Owners",allStatusText:"All Status",allPriorityText:"All Priority",clearFiltersText:"Clear",statusOptions:{all:"All Status",notStarted:"Not Started",inProgress:"In Progress",completed:"Completed"},priorityFilterOptions:{all:"All Priority",low:"Low",medium:"Medium",high:"High"},columnLabels:{name:"Name",dependsOn:"Depends on",duration:"Duration",start:"Start"},taskNameRequired:"Please enter task name"},jr=({tasks:t=[],links:s=[],config:o={},uiConfig:i={},styleConfig:r={},iconConfig:y={},onTaskUpdate:g,onTaskCreate:a,onTaskDelete:u,onLinkCreate:b,onLinkDelete:c})=>{const j={...vr,...i},T=w.useMemo(()=>{const d={};return r.primary&&(d["--wx-gantt-primary"]=r.primary),r.primarySelected&&(d["--wx-gantt-primary-selected"]=r.primarySelected),r.success&&(d["--wx-gantt-success"]=r.success),r.warning&&(d["--wx-gantt-warning"]=r.warning),r.danger&&(d["--wx-gantt-danger"]=r.danger),r.background&&(d["--wx-gantt-background"]=r.background),r.backgroundAlt&&(d["--wx-gantt-background-alt"]=r.backgroundAlt),r.backgroundHover&&(d["--wx-gantt-background-hover"]=r.backgroundHover),r.selectColor&&(d["--wx-gantt-select-color"]=r.selectColor),r.taskColor&&(d["--wx-gantt-task-color"]=r.taskColor),r.taskFillColor&&(d["--wx-gantt-task-fill-color"]=r.taskFillColor),r.projectColor&&(d["--wx-gantt-project-color"]=r.projectColor),r.milestoneColor&&(d["--wx-gantt-milestone-color"]=r.milestoneColor),r.fontColor&&(d["--wx-gantt-font-color"]=r.fontColor),r.fontColorAlt&&(d["--wx-gantt-font-color-alt"]=r.fontColorAlt),r.iconColor&&(d["--wx-gantt-icon-color"]=r.iconColor),r.borderColor&&(d["--wx-gantt-border-color"]=r.borderColor),r.fontFamily&&(d["--wx-gantt-font-family"]=r.fontFamily),r.fontMono&&(d["--wx-gantt-font-mono"]=r.fontMono),r.fontSize&&(d["--wx-gantt-font-size"]=r.fontSize),r.fontWeight&&(d["--wx-gantt-font-weight"]=String(r.fontWeight)),r.lineHeight&&(d["--wx-gantt-line-height"]=String(r.lineHeight)),r.spacingXS&&(d["--gantt-spacing-xs"]=r.spacingXS),r.spacingSM&&(d["--gantt-spacing-sm"]=r.spacingSM),r.spacingMD&&(d["--gantt-spacing-md"]=r.spacingMD),r.spacingLG&&(d["--gantt-spacing-lg"]=r.spacingLG),r.customCSSVariables&&Object.entries(r.customCSSVariables).forEach(([S,$])=>{d[S.startsWith("--")?S:`--${S}`]=$}),d},[r]),p=Array.isArray(t)?t:[],f=Array.isArray(s)?s:[],{tasks:l,links:E,setTasks:M,setLinks:k,undo:F,redo:W,updateTask:V,createTask:U,deleteTask:me,saveState:v}=Yt(p,f),[A,G]=w.useState(l),[B,K]=w.useState(null),[ie,P]=w.useState(null),[oe,le]=w.useState(!1),[ge,J]=w.useState(void 0),[H,xe]=w.useState(void 0),[ue,pe]=w.useState(!1),[ve,m]=w.useState(null),[L,C]=w.useState(null),[O,te]=w.useState(null),[Q,re]=w.useState(null),[de,Se]=w.useState(null),[Ae,Re]=w.useState(1),[Me,$e]=w.useState(()=>p.length>0?Wt(p):new Map),[Ye]=w.useState(o.theme||"light"),[nt,qe]=w.useState({searchText:"",status:"all",priority:"all",owner:""}),ct=w.useRef(null),ze=w.useRef(null),ot=w.useRef(null),Be=w.useRef(!1),Fe=w.useRef(null),Te={columns:o.columns||br(i),scales:wr,readonly:!1,editable:!0,taskHeight:28,rowHeight:44,scaleHeight:28,columnWidth:80,minColumnWidth:60,autoSchedule:!1,criticalPath:!1,baselines:!0,weekends:!0,holidays:[],theme:Ye,locale:"en",showTodayLine:o.showTodayLine!==!1,todayLineColor:o.todayLineColor||"#ff4d4f",todayLineLabel:o.todayLineLabel!==void 0?o.todayLineLabel:"Today",todayLineWidth:o.todayLineWidth||1,todayLineStyle:o.todayLineStyle||"solid",todayLineOpacity:o.todayLineOpacity!==void 0?o.todayLineOpacity:1,todayLineLabelStyle:o.todayLineLabelStyle,showTodayLineMarker:o.showTodayLineMarker!==!1,todayLineMarkerSize:o.todayLineMarkerSize||8,todayLineMarkerStyle:o.todayLineMarkerStyle||"triangle",showProjectStartLine:o.showProjectStartLine!==!1,projectStartDate:o.projectStartDate,projectStartLineColor:o.projectStartLineColor||"#40a9ff",projectStartLineLabel:o.projectStartLineLabel!==void 0?o.projectStartLineLabel:"Start Project",projectStartLineWidth:o.projectStartLineWidth||1,projectStartLineStyle:o.projectStartLineStyle||"solid",projectStartLineOpacity:o.projectStartLineOpacity!==void 0?o.projectStartLineOpacity:1,projectStartLineLabelStyle:o.projectStartLineLabelStyle,showProjectStartLineMarker:o.showProjectStartLineMarker!==!1,projectStartLineMarkerSize:o.projectStartLineMarkerSize||8,projectStartLineMarkerStyle:o.projectStartLineMarkerStyle||"triangle",...o};w.useEffect(()=>{const d=qt(l,nt);G(($=>{const _=[],ae=X=>{if(!X)return!1;const be=$.find(ee=>ee.id===X);return be&&!be.open&&be.type==="project"?!0:ae(be?.parent)};return $.forEach(X=>{ae(X.parent)||_.push(X)}),_})(d))},[l,nt]);const ut=w.useMemo(()=>{if(!l||!Array.isArray(l))return[];try{return Array.from(new Set(l.map(d=>d?.owner).filter(Boolean)))}catch(d){return console.warn("Error extracting owners:",d),[]}},[l]),St=(()=>{const d=A.length>0?A:l;if(d.length===0){const X=new Date;return{start:Ie(he(X,-30,"day")),end:Ie(he(X,60,"day"))}}const S=d.map(X=>X.start.getTime()),$=d.map(X=>X.end.getTime()),_=new Date(Math.min(...S)),ae=new Date(Math.max(...$));return{start:Ie(he(_,-7,"day")),end:Ie(ae)}})(),pt=d=>{K(d)},ht=(d,S)=>{if(Te.readonly)return;d.preventDefault();const $=l.find(_=>_.id===S);$&&Se({x:d.clientX,y:d.clientY,task:$})},Tt=()=>{if(!de?.task)return;const d=de.task,S={...d,id:`task-${Date.now()}`,text:`${d.text} (Copy)`,start:he(d.start,7,"day"),end:he(d.end,7,"day")};U(S),a&&a(S)},at=d=>{if(!de?.task)return;const S={...de.task,type:d};V(S),g&&g(S)},Dt=(d,S,$,_)=>{if(!Te.readonly)if(_==="reorder"){const ae=A.findIndex(ee=>ee.id===d),X=(ee,we)=>{let _e=[];return we.filter(De=>De.parent===ee).forEach(De=>{_e.push(De.id),_e=[..._e,...X(De.id,we)]}),_e},be=X(d,l);te({id:d,initialIndex:ae,currentY:$,descendantIds:be}),document.body.classList.add("gantt-dragging")}else C(d)},kt=()=>{if(O&&Q){const d=l.find($=>$.id===O.id),S=l.find($=>$.id===Q.taskId);if(d&&S&&d.id!==S.id){const $=[d.id,...O.descendantIds];if(!$.includes(S.id)){const _=[...l],ae=Q.position==="inside"?S.id:S.parent,X=_.findIndex(ye=>ye.id===d.id);X!==-1&&(_[X]={..._[X],parent:ae});const be=_.filter(ye=>$.includes(ye.id)),ee=_.filter(ye=>!$.includes(ye.id));let we=ee.findIndex(ye=>ye.id===S.id);if(Q.position==="inside"){const ye=ee.filter(De=>De.parent===S.id);ye.length>0?we=ee.findIndex(De=>De.id===ye[ye.length-1].id)+1:we++}else if(Q.position==="below"){const ye=(n,x)=>{let D=[];return x.filter(Y=>Y.parent===n).forEach(Y=>{D.push(Y.id),D=[...D,...ye(Y.id,x)]}),D},De=ye(S.id,ee);De.length>0?we=ee.findIndex(n=>n.id===De[De.length-1])+1:we++}const _e={tasks:[...l],links:[...E]};ee.splice(we,0,...be),M(ee),v("task_update",_e,{tasks:ee,links:E})}}}C(null),te(null),re(null),document.body.classList.remove("gantt-dragging")},st=w.useRef(null),Lt=w.useCallback(d=>{O&&(st.current&&cancelAnimationFrame(st.current),st.current=requestAnimationFrame(()=>{const S=Te.rowHeight||44,$=ze.current?.querySelector(".gantt-grid-body");if(!$)return;const _=$.getBoundingClientRect(),ae=d.clientY-_.top;let X=Math.floor(ae/S);X=Math.max(0,Math.min(X,A.length-1));const be=A[X];if(be){const ee=ae-X*S;let we="above";be.type==="project"?ee<S*.3?we="above":ee>S*.7?we="below":we="inside":we=ee<S/2?"above":"below",be.id!==O.id?re({taskId:be.id,position:we}):re(null)}te(ee=>ee?{...ee,currentY:d.clientY}:null)}))},[O,A,Te.rowHeight]),ft=()=>{O&&kt()},it=(d,S)=>{const $={...d,id:`task-${Date.now()}`,parent:S};U($);const _={taskId:$.id,start:new Date($.start),end:new Date($.end)};$e(ae=>{const X=new Map(ae);return X.set($.id,_),X}),a&&a($)},Je=d=>{V(d),g&&g(d)},Oe=d=>{me(d),$e(S=>{const $=new Map(S);return $.delete(d),$}),u&&u(d)},Ge=(d,S,$,_)=>{const ae={id:`link-${Date.now()}`,source:d,target:S,type:$,lag:_};k([...E,ae]),b&&b(ae)},Ze=d=>{const S=E.filter($=>$.id!==d);k(S),c&&c(d)};w.useEffect(()=>{const d=new Map(Me);let S=!1;l.forEach(_=>{Me.has(_.id)||(d.set(_.id,{taskId:_.id,start:new Date(_.start),end:new Date(_.end)}),S=!0)});const $=new Set(l.map(_=>_.id));Me.forEach((_,ae)=>{$.has(ae)||(d.delete(ae),S=!0)}),S&&$e(d)},[l]),w.useEffect(()=>{const d=S=>{(S.ctrlKey||S.metaKey)&&(S.key==="z"&&!S.shiftKey?(S.preventDefault(),F()):(S.key==="y"||S.key==="z"&&S.shiftKey)&&(S.preventDefault(),W()))};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[F,W]),w.useEffect(()=>{const d=ze.current?.querySelector(".gantt-grid-body"),S=ct.current?.querySelector(".gantt-timeline-body");if(!d||!S)return;const $=()=>{Be.current||(Be.current=!0,S.scrollTop=d.scrollTop,Fe.current&&clearTimeout(Fe.current),Fe.current=window.setTimeout(()=>{Be.current=!1},150))},_=()=>{Be.current||(Be.current=!0,d.scrollTop=S.scrollTop,Fe.current&&clearTimeout(Fe.current),Fe.current=window.setTimeout(()=>{Be.current=!1},150))};return d.addEventListener("scroll",$,{passive:!0}),S.addEventListener("scroll",_,{passive:!0}),()=>{d.removeEventListener("scroll",$),S.removeEventListener("scroll",_),Fe.current&&clearTimeout(Fe.current)}},[A]);const mt={height:o.containerHeight||"100%",minHeight:o.containerMinHeight||"400px"},Mt=o.gridWidth?{"--gantt-grid-width":o.gridWidth}:{};return e.jsxs("div",{className:`gantt-page-wrapper theme-${Ye}`,style:{...mt,...T},children:[j.showHeader&&e.jsx("div",{className:"gantt-page-header",children:e.jsx("div",{className:"gantt-page-header-left",children:e.jsx("h1",{className:"gantt-page-title",children:j.headerTitle})})}),e.jsxs("div",{className:`gantt-container theme-${Te.theme}`,style:Mt,children:[e.jsx(Bt,{zoomLevel:Ae,setZoomLevel:Re,onExport:d=>{d==="csv"&&Ht(l),d==="excel"&&Ut(l),d==="json"&&Vt(l,E),d==="pdf"&&Xt(l)},onFilterChange:d=>qe(d),owners:ut||[],onAddTask:d=>{if(d){const S=l.find($=>$.id===d);J(d),xe(S?.text)}else J(void 0),xe(void 0);le(!0)},uiConfig:j,iconConfig:y,styleConfig:r}),e.jsxs("div",{className:"gantt-layout",ref:ot,onMouseMove:Lt,onMouseUp:ft,onMouseLeave:ft,children:[e.jsx(bt,{ref:ze,tasks:A,columns:Te.columns||[],selectedTask:B,onTaskClick:pt,onTaskContextMenu:ht,onTaskUpdate:Je,onTaskDragStart:Dt,onAddTask:d=>{if(d){const S=l.find($=>$.id===d);J(d),xe(S?.text)}else J(void 0),xe(void 0);le(!0)},onAddDependency:Ge,onRemoveDependency:Ze,onDependencyClick:d=>{const S=l.find($=>$.id===d);S&&(m(S),pe(!0))},links:E,allTasks:l,dropIndicator:Q,reorderTask:O,iconConfig:y,styleConfig:r}),e.jsx(vt,{ref:ct,tasks:A,links:E,range:St,scales:Te.scales,config:Te,selectedTask:B,draggedTask:L,onTaskClick:()=>{},onTaskDragStart:()=>{},onTaskDragEnd:()=>{},onTaskUpdate:(d,S)=>{const $=l.find(_=>_.id===d);$&&Je({...$,...S})},zoomLevel:Ae,baselines:Me})]}),oe&&e.jsx(_t,{onCreateTask:it,onClose:()=>{le(!1),J(void 0),xe(void 0)},uiConfig:j,parentId:ge,parentTaskName:H,styleConfig:r}),ie&&e.jsx(It,{task:ie,onUpdate:Je,onDelete:Oe,onClose:()=>P(null),uiConfig:j,styleConfig:r}),ue&&ve&&e.jsx(Rt,{task:ve,allTasks:l,links:E,onAddDependency:Ge,onRemoveDependency:Ze,onClose:()=>{pe(!1),m(null)},styleConfig:r}),de&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"gantt-context-menu-overlay",onClick:()=>Se(null),onContextMenu:d=>{d.preventDefault(),Se(null)}}),e.jsx(pr,{x:de.x,y:de.y,task:de.task,onEdit:()=>{de.task&&P(de.task)},onDelete:()=>{de.task&&Oe(de.task.id)},onCopy:Tt,onDependencies:()=>{de.task&&(m(de.task),pe(!0))},onConvertToMilestone:()=>at("milestone"),onConvertToTask:()=>at("task"),onConvertToProject:()=>at("project"),onClose:()=>Se(null),onAutoSchedule:()=>{const d=zt(l,E,{mode:"forward"});M(d),Se(null)},iconConfig:y,styleConfig:r})]}),O&&e.jsx("div",{className:"gantt-grid-row ghost-row",style:{height:Te.rowHeight,top:O.currentY-(Te.rowHeight||48)/2,left:ze.current?.getBoundingClientRect().left,position:"fixed",pointerEvents:"none",opacity:.8,zIndex:9999,width:ze.current?.offsetWidth,backgroundColor:"#ffffff",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",border:"1px solid #2196F3",display:"flex"},children:Te.columns?.map(d=>e.jsx("div",{className:"gantt-grid-cell",style:{width:d.width,textAlign:d.align||"left"},children:(()=>{const S=l.find($=>$.id===O.id);if(!S)return null;if(d.template)return d.template(S);switch(d.name){case"text":return e.jsxs("div",{className:"gantt-grid-cell-text",children:[e.jsx(ne.FontAwesomeIcon,{icon:q.faGripVertical,style:{marginRight:8,color:"#adb5bd"}}),e.jsxs("span",{className:"gantt-task-name-text",children:[S.text,O.descendantIds.length>0&&e.jsxs("span",{children:[" +",O.descendantIds.length," subtasks"]})]})]});case"start":return fe(S.start,"DD MMM YYYY");case"duration":return`${S.duration}`;default:return S[d.name]||""}})()},`ghost-${d.name}`))})]})]})},Sr=Object.freeze(Object.defineProperty({__proto__:null,calculateCriticalPath:(t,s)=>{const o=new Set,i=new Map,r=new Map,y=new Map;t.forEach(p=>{r.set(p.id,[]),y.set(p.id,[])}),s.forEach(p=>{p.type==="e2s"&&(r.get(p.source)?.push(p.target),y.get(p.target)?.push(p.source))});const g=new Map,a=new Map,u=(p,f=new Set)=>{if(f.has(p))return;f.add(p);const l=t.find(M=>M.id===p);if(!l)return;const E=y.get(p)||[];if(E.length===0)g.set(p,0),a.set(p,l.duration);else{let M=0;E.forEach(k=>{u(k,f);const F=a.get(k)||0;M=Math.max(M,F)}),g.set(p,M),a.set(p,M+l.duration)}};t.forEach(p=>u(p.id));const b=new Map,c=new Map,j=Math.max(...Array.from(a.values())),T=(p,f=new Set)=>{if(f.has(p))return;f.add(p);const l=t.find(M=>M.id===p);if(!l)return;const E=r.get(p)||[];if(E.length===0)c.set(p,j),b.set(p,j-l.duration);else{let M=1/0;E.forEach(k=>{T(k,f);const F=b.get(k)||0;M=Math.min(M,F)}),c.set(p,M),b.set(p,M-l.duration)}};return t.forEach(p=>T(p.id)),t.forEach(p=>{const f=g.get(p.id)||0,E=(b.get(p.id)||0)-f;i.set(p.id,E),Math.abs(E)<.01&&o.add(p.id)}),{criticalTasks:o,taskFloats:i,projectDuration:j}},getTaskFloat:(t,s)=>s.taskFloats.get(t)||0,isCriticalTask:(t,s)=>s.criticalTasks.has(t)},Symbol.toStringTag,{value:"Module"}));R.AutoScheduler=mr,R.Chart=vt,R.CriticalPath=Sr,R.DependencyEditor=Rt,R.ExportUtils=gr,R.FilterSearch=At,R.Gantt=jr,R.Grid=bt,R.TaskBar=Nt,R.TaskCreator=_t,R.TaskEditor=It,R.Timeline=wt,R.Toolbar=Bt,R.addToDate=he,R.applyFilters=qt,R.calculateDuration=Qt,R.createBaseline=Wt,R.formatDate=fe,R.getDaysBetween=tt,R.getEndOfDay=Kt,R.getHoursBetween=Ct,R.getStartOfDay=Ie,R.isHoliday=yt,R.isWeekend=xt,R.useUndoRedo=Yt,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})}));
|
|
31
|
+
`.trim();it(a,"gantt-report.txt","text/plain"),alert("PDF export is a simplified text version. For full PDF with charts, a PDF library would be needed.")},xr=(t,a,o="png")=>{if(!document.getElementById(t)){alert("Could not find Gantt chart element to export");return}if(o==="svg"){alert("SVG export requires additional library. Use PNG or implement with dom-to-svg.");return}alert("Image export requires html2canvas library. Install with: npm install html2canvas")},it=(t,a,o)=>{const l=new Blob([t],{type:o}),r=URL.createObjectURL(l);yr(r,a),URL.revokeObjectURL(r)},yr=(t,a)=>{const o=document.createElement("a");o.href=t,o.download=a,document.body.appendChild(o),o.click(),document.body.removeChild(o)},gr=Object.freeze(Object.defineProperty({__proto__:null,exportToCSV:Wt,exportToExcel:Ht,exportToImage:xr,exportToJSON:Ut,exportToPDF:Vt,importFromJSON:t=>new Promise((a,o)=>{const l=new FileReader;l.onload=r=>{try{const x=r.target?.result,y=JSON.parse(x),i=y.tasks.map(s=>({...s,start:new Date(s.start),end:new Date(s.end)}));a({tasks:i,links:y.links||[]})}catch{o(new Error("Invalid JSON file"))}},l.onerror=()=>o(new Error("Failed to read file")),l.readAsText(t)})},Symbol.toStringTag,{value:"Module"})),Xt=(t,a)=>t.filter(o=>{if(a.searchText){const l=a.searchText.toLowerCase(),r=o.text.toLowerCase().includes(l),x=o.owner?.toLowerCase().includes(l),y=o.details?.toLowerCase().includes(l);if(!r&&!x&&!y)return!1}if(a.status!=="all"&&(o.progress===0?"not-started":o.progress===100?"completed":"in-progress")!==a.status||a.priority!=="all"&&o.priority!==a.priority||a.owner&&o.owner!==a.owner)return!1;if(a.dateRange){const l=o.start.getTime(),r=a.dateRange.start.getTime(),x=a.dateRange.end.getTime();if(l<r||l>x)return!1}return!0}),br=t=>[{name:"index",label:"",width:40,align:"center"},{name:"text",label:t?.columnLabels?.name||"Name",width:250,align:"left",resize:!0},{name:"predecessors",label:t?.columnLabels?.dependsOn||"Depends on",width:120,align:"left"},{name:"duration",label:t?.columnLabels?.duration||"Duration",width:110,align:"left"},{name:"start",label:t?.columnLabels?.start||"Start",width:130,align:"left"},{name:"add",label:"",width:50,align:"center"}],wr=[{unit:"month",step:1,format:"MMM"},{unit:"day",step:1,format:"D"}],vr={headerTitle:"Iris Gantt",showHeader:!0,showAddTaskButton:!0,showBaselineButton:!1,showZoomButtons:!0,showExportButtons:!0,showFilterSearch:!0,addTaskButtonText:"New Task",baselineButtonText:"Set Baseline",baselineButtonTextActive:"Baselines",zoomOutTooltip:"Zoom Out",zoomInTooltip:"Zoom In",resetZoomTooltip:"Reset Zoom",exportCSVTooltip:"Export to CSV",exportExcelTooltip:"Export to Excel",exportJSONTooltip:"Export to JSON",exportPDFTooltip:"Export to PDF",hideBaselinesTooltip:"Hide Baselines",showBaselinesTooltip:"Show Baselines",taskCreatorTitle:"Create New Task",taskCreatorOkText:"Create Task",taskCreatorCancelText:"Cancel",taskNameLabel:"Task Name",taskNamePlaceholder:"Enter task name",typeLabel:"Type",priorityLabel:"Priority",startDateLabel:"Start Date",durationLabel:"Duration (days)",colorLabel:"Color",progressLabel:"Progress (%)",ownerLabel:"Owner",ownerPlaceholder:"Assign to...",detailsLabel:"Details",detailsPlaceholder:"Add task description...",taskTypeOptions:{task:"Task",milestone:"Milestone",project:"Project"},priorityOptions:{low:"Low",medium:"Medium",high:"High"},taskEditorTitle:"Edit Task",taskEditorSaveText:"Save Changes",taskEditorCancelText:"Cancel",taskEditorDeleteText:"Delete",deleteConfirmTitle:"Delete Task",deleteConfirmContent:"This action cannot be undone.",deleteConfirmOkText:"Yes, Delete",deleteConfirmCancelText:"No",searchPlaceholder:"Search tasks...",allOwnersText:"All Owners",allStatusText:"All Status",allPriorityText:"All Priority",clearFiltersText:"Clear",statusOptions:{all:"All Status",notStarted:"Not Started",inProgress:"In Progress",completed:"Completed"},priorityFilterOptions:{all:"All Priority",low:"Low",medium:"Medium",high:"High"},columnLabels:{name:"Name",dependsOn:"Depends on",duration:"Duration",start:"Start"},taskNameRequired:"Please enter task name"},jr=({tasks:t=[],links:a=[],config:o={},uiConfig:l={},styleConfig:r={},iconConfig:x={},onTaskUpdate:y,onTaskCreate:i,onTaskDelete:s,onLinkCreate:b,onLinkDelete:c,baselines:w})=>{const T={...vr,...l},u=g.useMemo(()=>{const d={};return r.primary&&(d["--wx-gantt-primary"]=r.primary),r.primarySelected&&(d["--wx-gantt-primary-selected"]=r.primarySelected),r.success&&(d["--wx-gantt-success"]=r.success),r.warning&&(d["--wx-gantt-warning"]=r.warning),r.danger&&(d["--wx-gantt-danger"]=r.danger),r.background&&(d["--wx-gantt-background"]=r.background),r.backgroundAlt&&(d["--wx-gantt-background-alt"]=r.backgroundAlt),r.backgroundHover&&(d["--wx-gantt-background-hover"]=r.backgroundHover),r.selectColor&&(d["--wx-gantt-select-color"]=r.selectColor),r.taskColor&&(d["--wx-gantt-task-color"]=r.taskColor),r.taskFillColor&&(d["--wx-gantt-task-fill-color"]=r.taskFillColor),r.projectColor&&(d["--wx-gantt-project-color"]=r.projectColor),r.milestoneColor&&(d["--wx-gantt-milestone-color"]=r.milestoneColor),r.fontColor&&(d["--wx-gantt-font-color"]=r.fontColor),r.fontColorAlt&&(d["--wx-gantt-font-color-alt"]=r.fontColorAlt),r.iconColor&&(d["--wx-gantt-icon-color"]=r.iconColor),r.borderColor&&(d["--wx-gantt-border-color"]=r.borderColor),r.fontFamily&&(d["--wx-gantt-font-family"]=r.fontFamily),r.fontMono&&(d["--wx-gantt-font-mono"]=r.fontMono),r.fontSize&&(d["--wx-gantt-font-size"]=r.fontSize),r.fontWeight&&(d["--wx-gantt-font-weight"]=String(r.fontWeight)),r.lineHeight&&(d["--wx-gantt-line-height"]=String(r.lineHeight)),r.spacingXS&&(d["--gantt-spacing-xs"]=r.spacingXS),r.spacingSM&&(d["--gantt-spacing-sm"]=r.spacingSM),r.spacingMD&&(d["--gantt-spacing-md"]=r.spacingMD),r.spacingLG&&(d["--gantt-spacing-lg"]=r.spacingLG),r.customCSSVariables&&Object.entries(r.customCSSVariables).forEach(([S,O])=>{d[S.startsWith("--")?S:`--${S}`]=O}),d},[r]),h=Array.isArray(t)?t:[],v=Array.isArray(a)?a:[],{tasks:j,links:D,setTasks:$,setLinks:F,undo:z,redo:ne,updateTask:q,createTask:fe,deleteTask:E,saveState:K}=Yt(h,v),[U,L]=g.useState(j),[W,oe]=g.useState(null),[Z,xe]=g.useState(null),[Fe,ke]=g.useState(!1),[A,B]=g.useState(void 0),[ue,ee]=g.useState(void 0),[te,Q]=g.useState(!1),[f,M]=g.useState(null),[P,N]=g.useState(null),[_,ae]=g.useState(null),[re,Pe]=g.useState(null),[se,Le]=g.useState(null),[_e,Oe]=g.useState(1),[Te,Ce]=g.useState(()=>w&&w.size>0?w:h.length>0?zt(h):new Map);g.useEffect(()=>{w&&w.size>0&&Ce(w)},[w]);const[rt]=g.useState(o.theme||"light"),[We,wt]=g.useState({searchText:"",status:"all",priority:"all",owner:""}),lt=g.useRef(null),Ne=g.useRef(null),vt=g.useRef(null),Ie=g.useRef(!1),Me=g.useRef(null),ve={columns:o.columns||br(l),scales:wr,readonly:!1,editable:!0,taskHeight:28,rowHeight:44,scaleHeight:28,columnWidth:80,minColumnWidth:60,autoSchedule:!1,criticalPath:!1,baselines:!0,weekends:!0,holidays:[],theme:rt,locale:"en",showTodayLine:o.showTodayLine!==!1,todayLineColor:o.todayLineColor||"#ff4d4f",todayLineLabel:o.todayLineLabel!==void 0?o.todayLineLabel:"Today",todayLineWidth:o.todayLineWidth||1,todayLineStyle:o.todayLineStyle||"solid",todayLineOpacity:o.todayLineOpacity!==void 0?o.todayLineOpacity:1,todayLineLabelStyle:o.todayLineLabelStyle,showTodayLineMarker:o.showTodayLineMarker!==!1,todayLineMarkerSize:o.todayLineMarkerSize||8,todayLineMarkerStyle:o.todayLineMarkerStyle||"triangle",showProjectStartLine:o.showProjectStartLine!==!1,projectStartDate:o.projectStartDate,projectStartLineColor:o.projectStartLineColor||"#40a9ff",projectStartLineLabel:o.projectStartLineLabel!==void 0?o.projectStartLineLabel:"Start Project",projectStartLineWidth:o.projectStartLineWidth||1,projectStartLineStyle:o.projectStartLineStyle||"solid",projectStartLineOpacity:o.projectStartLineOpacity!==void 0?o.projectStartLineOpacity:1,projectStartLineLabelStyle:o.projectStartLineLabelStyle,showProjectStartLineMarker:o.showProjectStartLineMarker!==!1,projectStartLineMarkerSize:o.projectStartLineMarkerSize||8,projectStartLineMarkerStyle:o.projectStartLineMarkerStyle||"triangle",...o};g.useEffect(()=>{const d=Xt(j,We);L((O=>{const I=[],de=J=>{if(!J)return!1;const ge=O.find(ie=>ie.id===J);return ge&&!ge.open&&ge.type==="project"?!0:de(ge?.parent)};return O.forEach(J=>{de(J.parent)||I.push(J)}),I})(d))},[j,We]);const dt=g.useMemo(()=>{if(!j||!Array.isArray(j))return[];try{return Array.from(new Set(j.map(d=>d?.owner).filter(Boolean)))}catch(d){return console.warn("Error extracting owners:",d),[]}},[j]),ct=(()=>{const d=U.length>0?U:j;if(d.length===0){const J=new Date;return{start:Re(he(J,-30,"day")),end:Re(he(J,60,"day"))}}const S=d.map(J=>J.start.getTime()),O=d.map(J=>J.end.getTime()),I=new Date(Math.min(...S)),de=new Date(Math.max(...O));return{start:Re(he(I,-7,"day")),end:Re(de)}})(),ut=d=>{oe(d)},jt=(d,S)=>{if(ve.readonly)return;d.preventDefault();const O=j.find(I=>I.id===S);O&&Le({x:d.clientX,y:d.clientY,task:O})},St=()=>{if(!se?.task)return;const d=se.task,S={...d,id:`task-${Date.now()}`,text:`${d.text} (Copy)`,start:he(d.start,7,"day"),end:he(d.end,7,"day")};fe(S),i&&i(S)},nt=d=>{if(!se?.task)return;const S={...se.task,type:d};q(S),y&&y(S)},Tt=(d,S,O,I)=>{if(!ve.readonly)if(I==="reorder"){const de=U.findIndex(ie=>ie.id===d),J=(ie,be)=>{let Ye=[];return be.filter(n=>n.parent===ie).forEach(n=>{Ye.push(n.id),Ye=[...Ye,...J(n.id,be)]}),Ye},ge=J(d,j);ae({id:d,initialIndex:de,currentY:O,descendantIds:ge}),document.body.classList.add("gantt-dragging")}else N(d)},Dt=()=>{if(_&&re){const d=j.find(O=>O.id===_.id),S=j.find(O=>O.id===re.taskId);if(d&&S&&d.id!==S.id){const O=[d.id,..._.descendantIds];if(!O.includes(S.id)){const I=[...j],de=re.position==="inside"?S.id:S.parent,J=I.findIndex(ye=>ye.id===d.id);J!==-1&&(I[J]={...I[J],parent:de});const ge=I.filter(ye=>O.includes(ye.id)),ie=I.filter(ye=>!O.includes(ye.id));let be=ie.findIndex(ye=>ye.id===S.id);if(re.position==="inside"){const ye=ie.filter(n=>n.parent===S.id);ye.length>0?be=ie.findIndex(n=>n.id===ye[ye.length-1].id)+1:be++}else if(re.position==="below"){const ye=(m,k)=>{let C=[];return k.filter(V=>V.parent===m).forEach(V=>{C.push(V.id),C=[...C,...ye(V.id,k)]}),C},n=ye(S.id,ie);n.length>0?be=ie.findIndex(m=>m.id===n[n.length-1])+1:be++}const Ye={tasks:[...j],links:[...D]};ie.splice(be,0,...ge),$(ie),K("task_update",Ye,{tasks:ie,links:D})}}}N(null),ae(null),Pe(null),document.body.classList.remove("gantt-dragging")},ot=g.useRef(null),kt=g.useCallback(d=>{_&&(ot.current&&cancelAnimationFrame(ot.current),ot.current=requestAnimationFrame(()=>{const S=ve.rowHeight||44,O=Ne.current?.querySelector(".gantt-grid-body");if(!O)return;const I=O.getBoundingClientRect(),de=d.clientY-I.top;let J=Math.floor(de/S);J=Math.max(0,Math.min(J,U.length-1));const ge=U[J];if(ge){const ie=de-J*S;let be="above";ge.type==="project"?ie<S*.3?be="above":ie>S*.7?be="below":be="inside":be=ie<S/2?"above":"below",ge.id!==_.id?Pe({taskId:ge.id,position:be}):Pe(null)}ae(ie=>ie?{...ie,currentY:d.clientY}:null)}))},[_,U,ve.rowHeight]),qe=()=>{_&&Dt()},pt=(d,S)=>{const O={...d,id:`task-${Date.now()}`,parent:S};fe(O);const I={taskId:O.id,start:new Date(O.start),end:new Date(O.end)};Ce(de=>{const J=new Map(de);return J.set(O.id,I),J}),i&&i(O)},Ee=d=>{q(d),y&&y(d)},Je=d=>{E(d),Ce(S=>{const O=new Map(S);return O.delete(d),O}),s&&s(d)},Ge=(d,S,O,I)=>{const de={id:`link-${Date.now()}`,source:d,target:S,type:O,lag:I};F([...D,de]),b&&b(de)},at=d=>{const S=D.filter(O=>O.id!==d);F(S),c&&c(d)};g.useEffect(()=>{const d=new Map(Te);let S=!1;j.forEach(I=>{Te.has(I.id)||(d.set(I.id,{taskId:I.id,start:new Date(I.start),end:new Date(I.end)}),S=!0)});const O=new Set(j.map(I=>I.id));Te.forEach((I,de)=>{O.has(de)||(d.delete(de),S=!0)}),S&&Ce(d)},[j]),g.useEffect(()=>{const d=S=>{(S.ctrlKey||S.metaKey)&&(S.key==="z"&&!S.shiftKey?(S.preventDefault(),z()):(S.key==="y"||S.key==="z"&&S.shiftKey)&&(S.preventDefault(),ne()))};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[z,ne]),g.useEffect(()=>{const d=Ne.current?.querySelector(".gantt-grid-body"),S=lt.current?.querySelector(".gantt-timeline-body");if(!d||!S)return;const O=()=>{Ie.current||(Ie.current=!0,S.scrollTop=d.scrollTop,Me.current&&clearTimeout(Me.current),Me.current=window.setTimeout(()=>{Ie.current=!1},150))},I=()=>{Ie.current||(Ie.current=!0,d.scrollTop=S.scrollTop,Me.current&&clearTimeout(Me.current),Me.current=window.setTimeout(()=>{Ie.current=!1},150))};return d.addEventListener("scroll",O,{passive:!0}),S.addEventListener("scroll",I,{passive:!0}),()=>{d.removeEventListener("scroll",O),S.removeEventListener("scroll",I),Me.current&&clearTimeout(Me.current)}},[U]);const Lt={height:o.containerHeight||"100%",minHeight:o.containerMinHeight||"400px"},ht=o.gridWidth?{"--gantt-grid-width":o.gridWidth}:{};return e.jsxs("div",{className:`gantt-page-wrapper theme-${rt}`,style:{...Lt,...u},children:[T.showHeader&&e.jsx("div",{className:"gantt-page-header",children:e.jsx("div",{className:"gantt-page-header-left",children:e.jsx("h1",{className:"gantt-page-title",children:T.headerTitle})})}),e.jsxs("div",{className:`gantt-container theme-${ve.theme}`,style:ht,children:[e.jsx(At,{zoomLevel:_e,setZoomLevel:Oe,onExport:d=>{d==="csv"&&Wt(j),d==="excel"&&Ht(j),d==="json"&&Ut(j,D),d==="pdf"&&Vt(j)},onFilterChange:d=>wt(d),owners:dt||[],onAddTask:d=>{if(d){const S=j.find(O=>O.id===d);B(d),ee(S?.text)}else B(void 0),ee(void 0);ke(!0)},uiConfig:T,iconConfig:x,styleConfig:r}),e.jsxs("div",{className:"gantt-layout",ref:vt,onMouseMove:kt,onMouseUp:qe,onMouseLeave:qe,children:[e.jsx(yt,{ref:Ne,tasks:U,columns:ve.columns||[],selectedTask:W,onTaskClick:ut,onTaskContextMenu:jt,onTaskUpdate:Ee,onTaskDragStart:Tt,onAddTask:d=>{if(d){const S=j.find(O=>O.id===d);B(d),ee(S?.text)}else B(void 0),ee(void 0);ke(!0)},onAddDependency:Ge,onRemoveDependency:at,onDependencyClick:d=>{const S=j.find(O=>O.id===d);S&&(M(S),Q(!0))},links:D,allTasks:j,dropIndicator:re,reorderTask:_,iconConfig:x,styleConfig:r}),e.jsx(bt,{ref:lt,tasks:U,links:D,range:ct,scales:ve.scales,config:ve,selectedTask:W,draggedTask:P,onTaskClick:()=>{},onTaskDragStart:()=>{},onTaskDragEnd:()=>{},onTaskUpdate:(d,S)=>{const O=j.find(I=>I.id===d);O&&Ee({...O,...S})},zoomLevel:_e,baselines:Te})]}),Fe&&e.jsx(Bt,{onCreateTask:pt,onClose:()=>{ke(!1),B(void 0),ee(void 0)},uiConfig:T,parentId:A,parentTaskName:ue,styleConfig:r}),Z&&e.jsx(_t,{task:Z,onUpdate:Ee,onDelete:Je,onClose:()=>xe(null),uiConfig:T,styleConfig:r}),te&&f&&e.jsx(It,{task:f,allTasks:j,links:D,onAddDependency:Ge,onRemoveDependency:at,onTaskUpdate:Ee,onClose:()=>{Q(!1),M(null)},styleConfig:r}),se&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"gantt-context-menu-overlay",onClick:()=>Le(null),onContextMenu:d=>{d.preventDefault(),Le(null)}}),e.jsx(pr,{x:se.x,y:se.y,task:se.task,onEdit:()=>{se.task&&xe(se.task)},onDelete:()=>{se.task&&Je(se.task.id)},onCopy:St,onDependencies:()=>{se.task&&(M(se.task),Q(!0))},onConvertToMilestone:()=>nt("milestone"),onConvertToTask:()=>nt("task"),onConvertToProject:()=>nt("project"),onClose:()=>Le(null),onAutoSchedule:()=>{const d=Rt(j,D,{mode:"forward"});$(d),Le(null)},iconConfig:x,styleConfig:r})]}),_&&e.jsx("div",{className:"gantt-grid-row ghost-row",style:{height:ve.rowHeight,top:_.currentY-(ve.rowHeight||48)/2,left:Ne.current?.getBoundingClientRect().left,position:"fixed",pointerEvents:"none",opacity:.8,zIndex:9999,width:Ne.current?.offsetWidth,backgroundColor:"#ffffff",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",border:"1px solid #2196F3",display:"flex"},children:ve.columns?.map(d=>e.jsx("div",{className:"gantt-grid-cell",style:{width:d.width,textAlign:d.align||"left"},children:(()=>{const S=j.find(O=>O.id===_.id);if(!S)return null;if(d.template)return d.template(S);switch(d.name){case"text":return e.jsxs("div",{className:"gantt-grid-cell-text",children:[e.jsx(le.FontAwesomeIcon,{icon:G.faGripVertical,style:{marginRight:8,color:"#adb5bd"}}),e.jsxs("span",{className:"gantt-task-name-text",children:[S.text,_.descendantIds.length>0&&e.jsxs("span",{children:[" +",_.descendantIds.length," subtasks"]})]})]});case"start":return me(S.start,"DD MMM YYYY");case"duration":return`${S.duration}`;default:return S[d.name]||""}})()},`ghost-${d.name}`))})]})]})},Sr=Object.freeze(Object.defineProperty({__proto__:null,calculateCriticalPath:(t,a)=>{const o=new Set,l=new Map,r=new Map,x=new Map;t.forEach(u=>{r.set(u.id,[]),x.set(u.id,[])}),a.forEach(u=>{u.type==="e2s"&&(r.get(u.source)?.push(u.target),x.get(u.target)?.push(u.source))});const y=new Map,i=new Map,s=(u,h=new Set)=>{if(h.has(u))return;h.add(u);const v=t.find(D=>D.id===u);if(!v)return;const j=x.get(u)||[];if(j.length===0)y.set(u,0),i.set(u,v.duration);else{let D=0;j.forEach($=>{s($,h);const F=i.get($)||0;D=Math.max(D,F)}),y.set(u,D),i.set(u,D+v.duration)}};t.forEach(u=>s(u.id));const b=new Map,c=new Map,w=Math.max(...Array.from(i.values())),T=(u,h=new Set)=>{if(h.has(u))return;h.add(u);const v=t.find(D=>D.id===u);if(!v)return;const j=r.get(u)||[];if(j.length===0)c.set(u,w),b.set(u,w-v.duration);else{let D=1/0;j.forEach($=>{T($,h);const F=b.get($)||0;D=Math.min(D,F)}),c.set(u,D),b.set(u,D-v.duration)}};return t.forEach(u=>T(u.id)),t.forEach(u=>{const h=y.get(u.id)||0,j=(b.get(u.id)||0)-h;l.set(u.id,j),Math.abs(j)<.01&&o.add(u.id)}),{criticalTasks:o,taskFloats:l,projectDuration:w}},getTaskFloat:(t,a)=>a.taskFloats.get(t)||0,isCriticalTask:(t,a)=>a.criticalTasks.has(t)},Symbol.toStringTag,{value:"Module"}));R.AutoScheduler=mr,R.Chart=bt,R.CriticalPath=Sr,R.DependencyEditor=It,R.ExportUtils=gr,R.FilterSearch=Nt,R.Gantt=jr,R.Grid=yt,R.TaskBar=Ct,R.TaskCreator=Bt,R.TaskEditor=_t,R.Timeline=gt,R.Toolbar=At,R.addToDate=he,R.applyFilters=Xt,R.calculateDuration=Qt,R.createBaseline=zt,R.formatDate=me,R.getDaysBetween=et,R.getEndOfDay=Kt,R.getHoursBetween=Ot,R.getStartOfDay=Re,R.isHoliday=mt,R.isWeekend=ft,R.useUndoRedo=Yt,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iris-gantt",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "A comprehensive, production-ready Gantt chart component built with React and TypeScript. Easy to install, simple to use.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gantt",
|
|
@@ -82,6 +82,7 @@
|
|
|
82
82
|
"@storybook/addon-onboarding": "^10.2.0",
|
|
83
83
|
"@storybook/addon-vitest": "^10.2.0",
|
|
84
84
|
"@storybook/react-vite": "^10.2.0",
|
|
85
|
+
"@types/d3-dispatch": "^3.0.7",
|
|
85
86
|
"@types/node": "^24.10.1",
|
|
86
87
|
"@types/react": "^18.3.0",
|
|
87
88
|
"@types/react-dom": "^18.3.0",
|