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