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