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