iris-gantt 1.0.4 → 1.0.6

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.
@@ -1,23 +1,31 @@
1
- (function(N,S){typeof exports=="object"&&typeof module<"u"?S(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"],S):(N=typeof globalThis<"u"?globalThis:N||self,S(N.IrisGantt={},N.React,N.antd,N.ReactFontawesome,N.FontAwesomeSolid,N.dayjs))})(this,(function(N,S,o,I,A,_e){"use strict";var Te={exports:{}},we={};var Re;function ht(){if(Re)return we;Re=1;var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function i(a,s,p){var c=null;if(p!==void 0&&(c=""+p),s.key!==void 0&&(c=""+s.key),"key"in s){p={};for(var l in s)l!=="key"&&(p[l]=s[l])}else p=s;return s=p.ref,{$$typeof:t,type:a,key:c,ref:s!==void 0?s:null,props:p}}return we.Fragment=n,we.jsx=i,we.jsxs=i,we}var je={};var ze;function pt(){return ze||(ze=1,process.env.NODE_ENV!=="production"&&(function(){function t(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===W?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case F:return"Fragment";case b:return"Profiler";case f:return"StrictMode";case B:return"Suspense";case X:return"SuspenseList";case O:return"Activity"}if(typeof r=="object")switch(typeof r.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),r.$$typeof){case j:return"Portal";case $:return r.displayName||"Context";case E:return(r._context.displayName||"Context")+".Consumer";case L:var y=r.render;return r=r.displayName,r||(r=y.displayName||y.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case ee:return y=r.displayName||null,y!==null?y:t(r.type)||"Memo";case m:y=r._payload,r=r._init;try{return t(r(y))}catch{}}return null}function n(r){return""+r}function i(r){try{n(r);var y=!1}catch{y=!0}if(y){y=console;var k=y.error,P=typeof Symbol=="function"&&Symbol.toStringTag&&r[Symbol.toStringTag]||r.constructor.name||"Object";return k.call(y,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",P),n(r)}}function a(r){if(r===F)return"<>";if(typeof r=="object"&&r!==null&&r.$$typeof===m)return"<...>";try{var y=t(r);return y?"<"+y+">":"<...>"}catch{return"<...>"}}function s(){var r=U.A;return r===null?null:r.getOwner()}function p(){return Error("react-stack-top-frame")}function c(r){if(_.call(r,"key")){var y=Object.getOwnPropertyDescriptor(r,"key").get;if(y&&y.isReactWarning)return!1}return r.key!==void 0}function l(r,y){function k(){se||(se=!0,console.error("%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://react.dev/link/special-props)",y))}k.isReactWarning=!0,Object.defineProperty(r,"key",{get:k,configurable:!0})}function x(){var r=t(this.type);return Z[r]||(Z[r]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),r=this.props.ref,r!==void 0?r:null}function T(r,y,k,P,V,de){var R=k.ref;return r={$$typeof:h,type:r,key:y,props:k,_owner:P},(R!==void 0?R:null)!==null?Object.defineProperty(r,"ref",{enumerable:!1,get:x}):Object.defineProperty(r,"ref",{enumerable:!1,value:null}),r._store={},Object.defineProperty(r._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(r,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(r,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:V}),Object.defineProperty(r,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:de}),Object.freeze&&(Object.freeze(r.props),Object.freeze(r)),r}function d(r,y,k,P,V,de){var R=y.children;if(R!==void 0)if(P)if(oe(R)){for(P=0;P<R.length;P++)g(R[P]);Object.freeze&&Object.freeze(R)}else console.error("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 g(R);if(_.call(y,"key")){R=t(r);var K=Object.keys(y).filter(function(me){return me!=="key"});P=0<K.length?"{key: someKey, "+K.join(": ..., ")+": ...}":"{key: someKey}",C[R+P]||(K=0<K.length?"{"+K.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ (function(_,j){typeof exports=="object"&&typeof module<"u"?j(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"],j):(_=typeof globalThis<"u"?globalThis:_||self,j(_.IrisGantt={},_.React,_.antd,_.ReactFontawesome,_.FontAwesomeSolid,_.dayjs))})(this,(function(_,j,l,J,Y,Lt){"use strict";var rt={exports:{}},Xe={};var Et;function Gt(){if(Et)return Xe;Et=1;var n=j,a=Symbol.for("react.element"),s=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,t=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,g={key:!0,ref:!0,__self:!0,__source:!0};function y(i,c,v){var h,b={},k=null,x=null;v!==void 0&&(k=""+v),c.key!==void 0&&(k=""+c.key),c.ref!==void 0&&(x=c.ref);for(h in c)o.call(c,h)&&!g.hasOwnProperty(h)&&(b[h]=c[h]);if(i&&i.defaultProps)for(h in c=i.defaultProps,c)b[h]===void 0&&(b[h]=c[h]);return{$$typeof:a,type:i,key:k,ref:x,props:b,_owner:t.current}}return Xe.Fragment=s,Xe.jsx=y,Xe.jsxs=y,Xe}var Ke={};var Ft;function Xt(){return Ft||(Ft=1,process.env.NODE_ENV!=="production"&&(function(){var n=j,a=Symbol.for("react.element"),s=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),t=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),y=Symbol.for("react.provider"),i=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),b=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),x=Symbol.for("react.offscreen"),p=Symbol.iterator,u="@@iterator";function P(r){if(r===null||typeof r!="object")return null;var m=p&&r[p]||r[u];return typeof m=="function"?m:null}var L=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function f(r){{for(var m=arguments.length,D=new Array(m>1?m-1:0),F=1;F<m;F++)D[F-1]=arguments[F];M("error",r,D)}}function M(r,m,D){{var F=L.ReactDebugCurrentFrame,W=F.getStackAddendum();W!==""&&(m+="%s",D=D.concat([W]));var z=D.map(function(B){return String(B)});z.unshift("Warning: "+m),Function.prototype.apply.call(console[r],console,z)}}var A=!1,R=!1,O=!1,re=!1,ye=!1,w;w=Symbol.for("react.module.reference");function H(r){return!!(typeof r=="string"||typeof r=="function"||r===o||r===g||ye||r===t||r===v||r===h||re||r===x||A||R||O||typeof r=="object"&&r!==null&&(r.$$typeof===k||r.$$typeof===b||r.$$typeof===y||r.$$typeof===i||r.$$typeof===c||r.$$typeof===w||r.getModuleId!==void 0))}function Q(r,m,D){var F=r.displayName;if(F)return F;var W=m.displayName||m.name||"";return W!==""?D+"("+W+")":D}function ne(r){return r.displayName||"Context"}function U(r){if(r==null)return null;if(typeof r.tag=="number"&&f("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case o:return"Fragment";case s:return"Portal";case g:return"Profiler";case t:return"StrictMode";case v:return"Suspense";case h:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case i:var m=r;return ne(m)+".Consumer";case y:var D=r;return ne(D._context)+".Provider";case c:return Q(r,r.render,"ForwardRef");case b:var F=r.displayName||null;return F!==null?F:U(r.type)||"Memo";case k:{var W=r,z=W._payload,B=W._init;try{return U(B(z))}catch{return null}}}return null}var V=Object.assign,ce=0,de,me,Se,oe,Te,Ce,ke;function Me(){}Me.__reactDisabledLog=!0;function S(){{if(ce===0){de=console.log,me=console.info,Se=console.warn,oe=console.error,Te=console.group,Ce=console.groupCollapsed,ke=console.groupEnd;var r={configurable:!0,enumerable:!0,value:Me,writable:!0};Object.defineProperties(console,{info:r,log:r,warn:r,error:r,group:r,groupCollapsed:r,groupEnd:r})}ce++}}function E(){{if(ce--,ce===0){var r={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:V({},r,{value:de}),info:V({},r,{value:me}),warn:V({},r,{value:Se}),error:V({},r,{value:oe}),group:V({},r,{value:Te}),groupCollapsed:V({},r,{value:Ce}),groupEnd:V({},r,{value:ke})})}ce<0&&f("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var N=L.ReactCurrentDispatcher,$;function K(r,m,D){{if($===void 0)try{throw Error()}catch(W){var F=W.stack.trim().match(/\n( *(at )?)/);$=F&&F[1]||""}return`
2
+ `+$+r}}var X=!1,ee;{var se=typeof WeakMap=="function"?WeakMap:Map;ee=new se}function ge(r,m){if(!r||X)return"";{var D=ee.get(r);if(D!==void 0)return D}var F;X=!0;var W=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var z;z=N.current,N.current=null,S();try{if(m){var B=function(){throw Error()};if(Object.defineProperty(B.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(B,[])}catch(je){F=je}Reflect.construct(r,[],B)}else{try{B.call()}catch(je){F=je}r.call(B.prototype)}}else{try{throw Error()}catch(je){F=je}r()}}catch(je){if(je&&F&&typeof je.stack=="string"){for(var I=je.stack.split(`
3
+ `),xe=F.stack.split(`
4
+ `),te=I.length-1,ae=xe.length-1;te>=1&&ae>=0&&I[te]!==xe[ae];)ae--;for(;te>=1&&ae>=0;te--,ae--)if(I[te]!==xe[ae]){if(te!==1||ae!==1)do if(te--,ae--,ae<0||I[te]!==xe[ae]){var ve=`
5
+ `+I[te].replace(" at new "," at ");return r.displayName&&ve.includes("<anonymous>")&&(ve=ve.replace("<anonymous>",r.displayName)),typeof r=="function"&&ee.set(r,ve),ve}while(te>=1&&ae>=0);break}}}finally{X=!1,N.current=z,E(),Error.prepareStackTrace=W}var Ge=r?r.displayName||r.name:"",ze=Ge?K(Ge):"";return typeof r=="function"&&ee.set(r,ze),ze}function Ae(r,m,D){return ge(r,!1)}function Ye(r){var m=r.prototype;return!!(m&&m.isReactComponent)}function $e(r,m,D){if(r==null)return"";if(typeof r=="function")return ge(r,Ye(r));if(typeof r=="string")return K(r);switch(r){case v:return K("Suspense");case h:return K("SuspenseList")}if(typeof r=="object")switch(r.$$typeof){case c:return Ae(r.render);case b:return $e(r.type,m,D);case k:{var F=r,W=F._payload,z=F._init;try{return $e(z(W),m,D)}catch{}}}return""}var Le=Object.prototype.hasOwnProperty,Ue={},Qe=L.ReactDebugCurrentFrame;function Re(r){if(r){var m=r._owner,D=$e(r.type,r._source,m?m.type:null);Qe.setExtraStackFrame(D)}else Qe.setExtraStackFrame(null)}function wt(r,m,D,F,W){{var z=Function.call.bind(Le);for(var B in r)if(z(r,B)){var I=void 0;try{if(typeof r[B]!="function"){var xe=Error((F||"React class")+": "+D+" type `"+B+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[B]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw xe.name="Invariant Violation",xe}I=r[B](m,B,F,D,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(te){I=te}I&&!(I instanceof Error)&&(Re(W),f("%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).",F||"React class",D,B,typeof I),Re(null)),I instanceof Error&&!(I.message in Ue)&&(Ue[I.message]=!0,Re(W),f("Failed %s type: %s",D,I.message),Re(null))}}}var at=Array.isArray;function Oe(r){return at(r)}function jt(r){{var m=typeof Symbol=="function"&&Symbol.toStringTag,D=m&&r[Symbol.toStringTag]||r.constructor.name||"Object";return D}}function Ie(r){try{return De(r),!1}catch{return!0}}function De(r){return""+r}function we(r){if(Ie(r))return f("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",jt(r)),De(r)}var ot=L.ReactCurrentOwner,Jt={key:!0,ref:!0,__self:!0,__source:!0},it,lt;function bt(r){if(Le.call(r,"ref")){var m=Object.getOwnPropertyDescriptor(r,"ref").get;if(m&&m.isReactWarning)return!1}return r.ref!==void 0}function vt(r){if(Le.call(r,"key")){var m=Object.getOwnPropertyDescriptor(r,"key").get;if(m&&m.isReactWarning)return!1}return r.key!==void 0}function et(r,m){typeof r.ref=="string"&&ot.current}function St(r,m){{var D=function(){it||(it=!0,f("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",m))};D.isReactWarning=!0,Object.defineProperty(r,"key",{get:D,configurable:!0})}}function Tt(r,m){{var D=function(){lt||(lt=!0,f("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",m))};D.isReactWarning=!0,Object.defineProperty(r,"ref",{get:D,configurable:!0})}}var tt=function(r,m,D,F,W,z,B){var I={$$typeof:a,type:r,key:m,ref:D,props:B,_owner:z};return I._store={},Object.defineProperty(I._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(I,"_self",{configurable:!1,enumerable:!1,writable:!1,value:F}),Object.defineProperty(I,"_source",{configurable:!1,enumerable:!1,writable:!1,value:W}),Object.freeze&&(Object.freeze(I.props),Object.freeze(I)),I};function Dt(r,m,D,F,W){{var z,B={},I=null,xe=null;D!==void 0&&(we(D),I=""+D),vt(m)&&(we(m.key),I=""+m.key),bt(m)&&(xe=m.ref,et(m,W));for(z in m)Le.call(m,z)&&!Jt.hasOwnProperty(z)&&(B[z]=m[z]);if(r&&r.defaultProps){var te=r.defaultProps;for(z in te)B[z]===void 0&&(B[z]=te[z])}if(I||xe){var ae=typeof r=="function"?r.displayName||r.name||"Unknown":r;I&&St(B,ae),xe&&Tt(B,ae)}return tt(r,I,xe,W,F,ot.current,B)}}var Ve=L.ReactCurrentOwner,ct=L.ReactDebugCurrentFrame;function Ee(r){if(r){var m=r._owner,D=$e(r.type,r._source,m?m.type:null);ct.setExtraStackFrame(D)}else ct.setExtraStackFrame(null)}var qe;qe=!1;function Je(r){return typeof r=="object"&&r!==null&&r.$$typeof===a}function dt(){{if(Ve.current){var r=U(Ve.current.type);if(r)return`
6
+
7
+ Check the render method of \``+r+"`."}return""}}function kt(r){return""}var ut={};function d(r){{var m=dt();if(!m){var D=typeof r=="string"?r:r.displayName||r.name;D&&(m=`
8
+
9
+ Check the top-level render call using <`+D+">.")}return m}}function T(r,m){{if(!r._store||r._store.validated||r.key!=null)return;r._store.validated=!0;var D=d(m);if(ut[D])return;ut[D]=!0;var F="";r&&r._owner&&r._owner!==Ve.current&&(F=" It was passed a child from "+U(r._owner.type)+"."),Ee(r),f('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',D,F),Ee(null)}}function C(r,m){{if(typeof r!="object")return;if(Oe(r))for(var D=0;D<r.length;D++){var F=r[D];Je(F)&&T(F,m)}else if(Je(r))r._store&&(r._store.validated=!0);else if(r){var W=P(r);if(typeof W=="function"&&W!==r.entries)for(var z=W.call(r),B;!(B=z.next()).done;)Je(B.value)&&T(B.value,m)}}}function G(r){{var m=r.type;if(m==null||typeof m=="string")return;var D;if(typeof m=="function")D=m.propTypes;else if(typeof m=="object"&&(m.$$typeof===c||m.$$typeof===b))D=m.propTypes;else return;if(D){var F=U(m);wt(D,r.props,"prop",F,r)}else if(m.PropTypes!==void 0&&!qe){qe=!0;var W=U(m);f("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",W||"Unknown")}typeof m.getDefaultProps=="function"&&!m.getDefaultProps.isReactClassApproved&&f("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ue(r){{for(var m=Object.keys(r.props),D=0;D<m.length;D++){var F=m[D];if(F!=="children"&&F!=="key"){Ee(r),f("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",F),Ee(null);break}}r.ref!==null&&(Ee(r),f("Invalid attribute `ref` supplied to `React.Fragment`."),Ee(null))}}var q={};function he(r,m,D,F,W,z){{var B=H(r);if(!B){var I="";(r===void 0||typeof r=="object"&&r!==null&&Object.keys(r).length===0)&&(I+=" 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 xe=kt();xe?I+=xe:I+=dt();var te;r===null?te="null":Oe(r)?te="array":r!==void 0&&r.$$typeof===a?(te="<"+(U(r.type)||"Unknown")+" />",I=" Did you accidentally export a JSX literal instead of a component?"):te=typeof r,f("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",te,I)}var ae=Dt(r,m,D,W,z);if(ae==null)return ae;if(B){var ve=m.children;if(ve!==void 0)if(F)if(Oe(ve)){for(var Ge=0;Ge<ve.length;Ge++)C(ve[Ge],r);Object.freeze&&Object.freeze(ve)}else f("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 C(ve,r)}if(Le.call(m,"key")){var ze=U(r),je=Object.keys(m).filter(function(Dr){return Dr!=="key"}),Mt=je.length>0?"{key: someKey, "+je.join(": ..., ")+": ...}":"{key: someKey}";if(!q[ze+Mt]){var Tr=je.length>0?"{"+je.join(": ..., ")+": ...}":"{}";f(`A props object containing a "key" prop is being spread into JSX:
2
10
  let props = %s;
3
11
  <%s {...props} />
4
12
  React keys must be passed directly to JSX without using spread:
5
13
  let props = %s;
6
- <%s key={someKey} {...props} />`,P,R,K,R),C[R+P]=!0)}if(R=null,k!==void 0&&(i(k),R=""+k),c(y)&&(i(y.key),R=""+y.key),"key"in y){k={};for(var ue in y)ue!=="key"&&(k[ue]=y[ue])}else k=y;return R&&l(k,typeof r=="function"?r.displayName||r.name||"Unknown":r),T(r,R,k,s(),V,de)}function g(r){D(r)?r._store&&(r._store.validated=1):typeof r=="object"&&r!==null&&r.$$typeof===m&&(r._payload.status==="fulfilled"?D(r._payload.value)&&r._payload.value._store&&(r._payload.value._store.validated=1):r._store&&(r._store.validated=1))}function D(r){return typeof r=="object"&&r!==null&&r.$$typeof===h}var u=S,h=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),F=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),$=Symbol.for("react.context"),L=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),X=Symbol.for("react.suspense_list"),ee=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),O=Symbol.for("react.activity"),W=Symbol.for("react.client.reference"),U=u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,_=Object.prototype.hasOwnProperty,oe=Array.isArray,te=console.createTask?console.createTask:function(){return null};u={react_stack_bottom_frame:function(r){return r()}};var se,Z={},z=u.react_stack_bottom_frame.bind(u,p)(),v=te(a(p)),C={};je.Fragment=F,je.jsx=function(r,y,k){var P=1e4>U.recentlyCreatedOwnerStacks++;return d(r,y,k,!1,P?Error("react-stack-top-frame"):z,P?te(a(r)):v)},je.jsxs=function(r,y,k){var P=1e4>U.recentlyCreatedOwnerStacks++;return d(r,y,k,!0,P?Error("react-stack-top-frame"):z,P?te(a(r)):v)}})()),je}var He;function ft(){return He||(He=1,process.env.NODE_ENV==="production"?Te.exports=ht():Te.exports=pt()),Te.exports}var e=ft();const q=(t,n,i)=>{const a=new Date(t);switch(i){case"hour":a.setHours(a.getHours()+n);break;case"day":a.setDate(a.getDate()+n);break;case"week":a.setDate(a.getDate()+n*7);break;case"month":a.setMonth(a.getMonth()+n);break;case"quarter":a.setMonth(a.getMonth()+n*3);break;case"year":a.setFullYear(a.getFullYear()+n);break}return a},be=(t,n)=>{const i=n.getTime()-t.getTime();return Math.ceil(i/(1e3*60*60*24))},We=(t,n)=>{const i=n.getTime()-t.getTime();return Math.ceil(i/(1e3*60*60))},Q=(t,n)=>{const i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],a=["January","February","March","April","May","June","July","August","September","October","November","December"],s=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],p={YYYY:t.getFullYear().toString(),YY:t.getFullYear().toString().slice(-2),MMMM:a[t.getMonth()],MMM:i[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:s[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 n.replace(/YYYY|YY|MMMM|MMM|MM|M|DD|D|dddd|HH|H|mm|m/g,c=>p[c])},Ee=t=>{const n=t.getDay();return n===0||n===6},$e=(t,n)=>n.some(i=>i.getFullYear()===t.getFullYear()&&i.getMonth()===t.getMonth()&&i.getDate()===t.getDate()),Se=t=>{const n=new Date(t);return n.setHours(0,0,0,0),n},mt=t=>{const n=new Date(t);return n.setHours(23,59,59,999),n},xt=(t,n,i="day")=>{switch(i){case"hour":return We(t,n);case"day":return be(t,n);case"week":return Math.ceil(be(t,n)/7);case"month":return(n.getFullYear()-t.getFullYear())*12+(n.getMonth()-t.getMonth());default:return be(t,n)}};function gt(t){if(!t||typeof t!="string")return null;const n=t.trim(),i=/^(\d+)(FS|SS|FF|SF)(([+-])(\d+)([dhwm]))?$/i,a=n.match(i);if(!a)return null;const s=parseInt(a[1],10),p=a[2].toUpperCase();let c=0,l="day";if(a[3]){const x=a[4]==="-"?-1:1;switch(c=parseInt(a[5],10)*x,a[6].toLowerCase()){case"d":l="day";break;case"h":l="hour";break;case"w":l="week";break;case"m":l="month";break}}return{taskNumber:s,type:p,lag:c,lagUnit:l}}function Ne(t,n){switch(n){case"hour":return t/24;case"day":return t;case"week":return t*7;case"month":return t*30;default:return t}}function yt(t,n){const a={e2s:"FS",s2s:"SS",e2e:"FF",s2e:"SF"}[t.type];let s=`${n}${a}`;if(t.lag&&t.lag!==0){const p=t.lag>0?"+":"",l=(t.lagUnit||"day").charAt(0);let x=t.lag;if(t.lagUnit&&t.lagUnit!=="day")switch(t.lagUnit){case"hour":x=t.lag*24;break;case"week":x=t.lag/7;break;case"month":x=t.lag/30;break}s+=`${p}${Math.round(x)}${l}`}return s}function wt(t){return{FS:"e2s",SS:"s2s",FF:"e2e",SF:"s2e"}[t]}const{Text:pe,Paragraph:jt,Link:bt}=o.Typography,{Option:Ue}=o.Select,St=({task:t,allTasks:n,onAddDependency:i,children:a})=>{const[s,p]=S.useState(!1),[c,l]=S.useState(""),[x,T]=S.useState(null),[d,g]=S.useState("e2s"),[D,u]=S.useState("lag"),[h,j]=S.useState(0),[F,f]=S.useState(!0),b="day",E=S.useMemo(()=>{if(!c)return n.filter(O=>O.id!==t.id);const m=c.toLowerCase();return n.filter(O=>O.id!==t.id&&(O.text.toLowerCase().includes(m)||(n.indexOf(O)+1).toString().includes(m)))},[n,c,t.id]),$=()=>{if(x){const m=D==="lag"?h:-h,O=Ne(m,b);i(x,t.id,d,O),p(!1),L()}},L=()=>{l(""),T(null),g("e2s"),u("lag"),j(0)},B=()=>{if(!F)return null;const m=d==="e2s",O=d==="s2s",W=d==="e2e",U=d==="s2e";let _=0,oe=0,te="",se=0,Z=-1;return m?(_=20,oe=160,se=140,Z=160,te="M 140 40 L 150 40 C 160 40, 160 90, 150 90 L 160 90"):W?(_=60,oe=60,se=180,Z=-1,te="M 180 40 L 200 40 L 200 90 L 180 90"):O?(_=100,oe=100,se=100,Z=-1,te="M 100 40 L 80 40 L 80 90 L 100 90"):U&&(_=160,oe=20,se=160,Z=140,te="M 160 40 L 150 40 C 140 40, 140 90, 150 90 L 140 90"),e.jsx("div",{style:{width:"100%",height:120,backgroundColor:"#fff",borderRadius:4,marginBottom:10,border:"1px solid #e9ecef",position:"relative",overflow:"hidden"},children:e.jsxs("svg",{viewBox:"0 0 300 120",style:{width:"100%",height:"100%"},children:[e.jsx("line",{x1:se,x2:se,y1:"0",y2:"120",stroke:"#f0f0f0",strokeDasharray:"3,3"}),Z!==-1&&e.jsx("line",{x1:Z,x2:Z,y1:"0",y2:"120",stroke:"#f0f0f0",strokeDasharray:"3,3"}),e.jsx("rect",{x:_,y:"28",width:"120",height:"24",rx:"4",fill:"#bae7ff",stroke:"#69c0ff"}),e.jsx("text",{x:_+60,y:"44",fontSize:"11",textAnchor:"middle",fill:"#0050b3",children:"Task 2"}),e.jsx("rect",{x:oe,y:"78",width:"120",height:"24",rx:"4",fill:"#bae7ff",stroke:"#69c0ff"}),e.jsx("text",{x:oe+60,y:"94",fontSize:"11",textAnchor:"middle",fill:"#0050b3",children:"Task 3"}),e.jsx("path",{d:te,fill:"none",stroke:"#8c8c8c",strokeWidth:"1.5",markerEnd:"url(#arrowhead)"}),e.jsx("defs",{children:e.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"7",refX:"9",refY:"3.5",orient:"auto",children:e.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#8c8c8c"})})})]})})},X=()=>{const m=n.find(_=>_.id===x);if(!m)return"Select a task from the list to see how it will relate to the current task.";const O=n.indexOf(t)+1,W=n.indexOf(m)+1;let U="";switch(d){case"e2s":U=`Task ${O} starts after Task ${W} finishes`;break;case"s2s":U=`Task ${O} starts when Task ${W} starts`;break;case"e2e":U=`Task ${O} finishes when Task ${W} finishes`;break;case"s2e":U=`Task ${O} finishes when Task ${W} starts`;break}if(h>0){const _=`${h} ${b}${h>1?"s":""}`;D==="lag"?U+=` + ${_} delay`:U+=` - ${_} overlap`}return U+"."},ee=e.jsxs("div",{style:{display:"flex",width:620,height:480,backgroundColor:"#fff",borderRadius:"8px",overflow:"hidden"},children:[e.jsxs("div",{style:{flex:1,borderRight:"1px solid #f0f0f0",display:"flex",flexDirection:"column",padding:0},children:[e.jsx("div",{style:{padding:"12px"},children:e.jsx(o.Input,{placeholder:"Search task...",value:c,onChange:m=>l(m.target.value),style:{marginBottom:8},autoFocus:!0,size:"large"})}),e.jsx("div",{style:{flex:1,overflowY:"auto"},children:e.jsx(o.List,{size:"small",dataSource:E,renderItem:m=>e.jsxs(o.List.Item,{className:`task-list-item ${x===m.id?"selected":""}`,onClick:()=>T(m.id),style:{cursor:"pointer",padding:"8px 16px",backgroundColor:x===m.id?"#f0f7ff":"transparent",display:"flex",justifyContent:"space-between"},children:[e.jsxs("div",{style:{display:"flex",gap:12},children:[e.jsx(pe,{type:"secondary",style:{width:20},children:n.indexOf(m)+1}),e.jsx(pe,{children:m.text})]}),e.jsx(I.FontAwesomeIcon,{icon:A.faChevronRight,style:{fontSize:10,color:"#bfbfbf"}})]})})})]}),e.jsxs("div",{style:{width:340,padding:"24px",display:"flex",flexDirection:"column",borderLeft:"1px solid #f0f0f0"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:15},children:[e.jsx(pe,{strong:!0,children:"Dependency type"}),e.jsx(bt,{style:{fontSize:"12px"},onClick:()=>f(!F),children:F?"Hide preview":"Show preview"})]}),B(),e.jsx(jt,{style:{fontSize:"13px",color:"#262626",marginBottom:20,minHeight:48,lineHeight:"1.6"},children:X()}),e.jsx(o.Radio.Group,{value:d,onChange:m=>g(m.target.value),style:{width:"100%",marginBottom:20},children:e.jsxs(o.Space,{direction:"vertical",style:{width:"100%"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",width:"100%"},children:[e.jsx(o.Radio,{value:"e2s",children:"Finish to Start"}),e.jsx(pe,{type:"secondary",children:"FS"})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",width:"100%"},children:[e.jsx(o.Radio,{value:"e2e",children:"Finish to Finish"}),e.jsx(pe,{type:"secondary",children:"FF"})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",width:"100%"},children:[e.jsx(o.Radio,{value:"s2s",children:"Start to Start"}),e.jsx(pe,{type:"secondary",children:"SS"})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",width:"100%"},children:[e.jsx(o.Radio,{value:"s2e",children:"Start to Finish"}),e.jsx(pe,{type:"secondary",children:"SF"})]})]})}),e.jsxs("div",{style:{display:"flex",gap:"10px",marginBottom:20},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx(pe,{type:"secondary",style:{fontSize:"11px",display:"block",marginBottom:4},children:"Delay type"}),e.jsxs(o.Select,{value:D,onChange:m=>u(m),style:{width:"100%"},size:"large",children:[e.jsx(Ue,{value:"lag",children:"Lag by"}),e.jsx(Ue,{value:"lead",children:"Lead by"})]})]}),e.jsxs("div",{style:{width:100},children:[e.jsx(pe,{type:"secondary",style:{fontSize:"11px",display:"block",marginBottom:4},children:"Days"}),e.jsx(o.Space.Compact,{style:{width:"100%"},children:e.jsx(o.InputNumber,{min:0,value:h,onChange:m=>j(m||0),style:{width:"100%"},placeholder:"0",size:"large"})})]})]}),e.jsx(o.Button,{type:"primary",block:!0,onClick:$,disabled:!x,style:{marginTop:"auto",backgroundColor:"#5c67f2",height:44,borderRadius:"6px"},children:"Add"})]})]});return e.jsx(o.Popover,{content:ee,trigger:"click",open:s,onOpenChange:p,placement:"bottomLeft",overlayClassName:"dependency-popover",overlayInnerStyle:{padding:0},children:a})},Pe=S.forwardRef(({tasks:t,allTasks:n=[],columns:i,selectedTask:a,onTaskClick:s,onTaskContextMenu:p,onTaskUpdate:c,onTaskDragStart:l,onAddTask:x,onAddDependency:T,links:d=[],dropIndicator:g,reorderTask:D},u)=>{const h=S.useRef(null);S.useImperativeHandle(u,()=>h.current);const j=(f,b=0)=>{if(!f.parent)return b;const E=t.find($=>$.id===f.parent);return E?j(E,b+1):b},F=(f,b)=>{if(b.template)return b.template(f);switch(b.name){case"text":const E=j(f);return e.jsxs("div",{className:"gantt-grid-cell-text",style:{paddingLeft:E*14},children:[e.jsx("div",{className:"gantt-row-drag-handle",onMouseDown:L=>{L.preventDefault(),l?.(f.id,L.clientX,L.clientY,"reorder")},children:e.jsx(I.FontAwesomeIcon,{icon:A.faGripVertical})}),f.type==="project"?e.jsx("span",{className:"gantt-tree-icon",onClick:L=>{L.stopPropagation(),c?.({...f,open:!f.open})},children:e.jsx(I.FontAwesomeIcon,{icon:f.open?A.faChevronDown:A.faChevronRight})}):e.jsx("span",{style:{width:16,display:"inline-block"}}),e.jsx("span",{className:"gantt-task-name-text",children:f.text})]});case"start":return Q(f.start,"DD-MM-YYYY");case"end":return Q(f.end,"DD-MM-YYYY");case"duration":return e.jsxs("div",{style:{backgroundColor:"#f6e7db",padding:"4px 12px",borderRadius:"4px",fontWeight:600,color:"#434343",display:"inline-block",minWidth:"70px",textAlign:"center"},children:[f.duration," day",f.duration!==1?"s":""]});case"predecessors":const $=d.filter(L=>L.target===f.id);return e.jsx(St,{task:f,allTasks:n,links:d,onAddDependency:(L,B,X,ee)=>T?.(L,B,X,ee),children:e.jsx("div",{style:{cursor:"pointer",minHeight:"24px",width:"100%",display:"flex",alignItems:"center",gap:"4px"},children:$.map(L=>{const B=n.find(ee=>ee.id===L.source),X=B?n.indexOf(B)+1:0;return e.jsx("span",{style:{fontSize:"11px",backgroundColor:"#e6f7ff",border:"1px solid #91d5ff",color:"#0050b3",padding:"1px 6px",borderRadius:"4px",whiteSpace:"nowrap"},children:yt(L,X)},L.id)})})});case"add":return e.jsx(o.Button,{type:"text",size:"small",icon:e.jsx(I.FontAwesomeIcon,{icon:A.faPlus,style:{fontSize:12,color:"#adb5bd"}}),onClick:L=>{L.stopPropagation(),x?.(f.id)}});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:`${f.progress}%`}})}),e.jsxs("span",{className:"gantt-progress-text",children:[f.progress,"%"]})]});case"index":return e.jsx("span",{style:{color:"#8c8c8c"},children:n.indexOf(f)+1});default:return f[b.name]||""}};return e.jsxs("div",{className:"gantt-grid",ref:h,children:[e.jsx("div",{className:"gantt-grid-header",children:i.map(f=>e.jsx("div",{className:"gantt-grid-header-cell",style:{width:f.width,justifyContent:f.align==="center"?"center":"flex-start"},children:f.name==="add"?e.jsx(I.FontAwesomeIcon,{icon:A.faPlus,style:{fontSize:12,color:"#64748b",cursor:"pointer"},onClick:()=>x?.()}):e.jsxs(e.Fragment,{children:[f.label,f.name==="start"&&e.jsx(I.FontAwesomeIcon,{icon:A.faChevronDown,style:{marginLeft:8,fontSize:10,color:"#64748b"}})]})},f.name))}),e.jsx("div",{className:"gantt-grid-body",children:t.map(f=>{const b=D?.id===f.id,E=D?.descendantIds.includes(f.id);return e.jsxs("div",{className:`gantt-grid-row ${a===f.id?"selected":""} ${b?"dragging-row":""} ${E?"descendant-dragging-row":""} ${g?.taskId===f.id?`drop-target-${g.position}`:""}`,onClick:()=>s(f.id),onContextMenu:$=>p?.($,f.id),children:[i.map($=>e.jsx("div",{className:"gantt-grid-cell",style:{width:$.width,textAlign:$.align||"left"},children:F(f,$)},`${f.id}-${$.name}`)),g?.taskId===f.id&&e.jsx("div",{className:`gantt-drop-indicator ${g.position}`})]},f.id)})})]})});Pe.displayName="Grid";const Ge=({task:t,position:n,selected:i,dragging:a,onClick:s,onDragStart:p,dragDeltaX:c=0,dragType:l=null,readonly:x=!1})=>{const T=(h,j)=>{x||(h.preventDefault(),h.stopPropagation(),p(h.clientX,h.clientY,j))},d=()=>{const h=["gantt-task-bar"];return t.type==="milestone"&&h.push("milestone"),t.type==="project"&&h.push("project"),i&&h.push("selected"),a&&h.push("dragging"),h.join(" ")},g=()=>{let h=n.left,j=n.width;return a&&l&&(l==="move"?h+=c:l==="resize-left"?(h+=c,j-=c):l==="resize-right"&&(j+=c)),{left:`${h}px`,width:`${Math.max(j,0)}px`,backgroundColor:t.color||void 0}},D=(h=!1)=>e.jsxs(e.Fragment,{children:[!x&&t.type!=="milestone"&&!h&&e.jsx("div",{className:"gantt-task-resize-handle gantt-task-resize-left",onMouseDown:j=>T(j,"resize-left")}),!h&&t.type!=="milestone"&&e.jsx("div",{className:"gantt-task-progress",style:{width:`${t.progress}%`}}),e.jsx("div",{className:"gantt-task-content",children:!h&&t.type!=="milestone"&&e.jsx("span",{className:"gantt-task-text",children:t.text})}),t.type==="milestone"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"gantt-milestone-diamond"}),e.jsx("span",{className:"gantt-milestone-text",children:t.text})]}),!x&&t.type!=="milestone"&&!h&&e.jsx("div",{className:"gantt-task-resize-handle gantt-task-resize-right",onMouseDown:j=>T(j,"resize-right")})]}),u=e.jsxs("div",{className:"gantt-tooltip",children:[e.jsx("div",{className:"gantt-tooltip-title",children:t.text}),e.jsxs("div",{className:"gantt-tooltip-dates",children:[Q(t.start,"MMM D")," - ",Q(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]})]});return t.segments&&t.segments.length>0?e.jsx("div",{className:"gantt-task-group",children:t.segments.map((h,j)=>e.jsx(o.Tooltip,{title:u,mouseEnterDelay:.5,children:e.jsx("div",{className:d()+" segment",style:{left:`${n.left+(h.start.getTime()-t.start.getTime())/(t.end.getTime()-t.start.getTime())*n.width}px`,width:`${(h.end.getTime()-h.start.getTime())/(t.end.getTime()-t.start.getTime())*n.width}px`,backgroundColor:t.color||"#ADCFFE"},onClick:s,onMouseDown:F=>T(F,"move"),children:D(!0)})},j))}):e.jsx(o.Tooltip,{title:u,mouseEnterDelay:.5,children:e.jsx("div",{className:d(),style:g(),onClick:s,onMouseDown:h=>T(h,"move"),children:D()})})},Tt=({links:t,tasks:n,getTaskPosition:i})=>{const a=c=>n.find(l=>l.id===c),s=c=>{const l=a(c.source),x=a(c.target);if(!l||!x)return"";const T=i(l),d=i(x),g=T.top+T.height/2,D=d.top+d.height/2;let u=0,h=0;switch(c.type){case"e2s":u=T.left+T.width,h=d.left;break;case"s2s":u=T.left,h=d.left;break;case"e2e":u=T.left+T.width,h=d.left+d.width;break;case"s2e":u=T.left,h=d.left+d.width;break}const j=h-u,F=D-g,f=20;if(c.type==="e2s")if(j>=f){const b=u+j/2;return`M ${u},${g} L ${b},${g} L ${b},${D} L ${h},${D}`}else{const b=f/2,E=g+F/2;return`M ${u},${g} L ${u+b},${g} L ${u+b},${E} L ${h-b},${E} L ${h-b},${D} L ${h},${D}`}else if(c.type==="s2s"){const b=Math.min(u,h)-f/2;return`M ${u},${g} L ${b},${g} L ${b},${D} L ${h},${D}`}else if(c.type==="e2e"){const b=Math.max(u,h)+f/2;return`M ${u},${g} L ${b},${g} L ${b},${D} L ${h},${D}`}else if(c.type==="s2e")if(j<=-f){const b=u+j/2;return`M ${u},${g} L ${b},${g} L ${b},${D} L ${h},${D}`}else{const b=f/2,E=g+F/2;return`M ${u},${g} L ${u-b},${g} L ${u-b},${E} L ${h+b},${E} L ${h+b},${D} L ${h},${D}`}return""},p=c=>{const l=a(c.target);if(!l)return"";const x=i(l),T=x.top+x.height/2,d=8,g=6;let D=0,u=!0;return c.type==="e2s"||c.type==="s2s"?(D=x.left,u=!0):(D=x.left+x.width,u=!1),u?`M ${D},${T} L ${D-d},${T-g/2} L ${D-d},${T+g/2} Z`:`M ${D},${T} L ${D+d},${T-g/2} L ${D+d},${T+g/2} Z`};return e.jsx("svg",{className:"gantt-links-layer",style:{overflow:"visible"},children:t.map(c=>{const l=a(c.source),x=a(c.target);if(!l||!x)return null;const T=s(c),d=p(c);return e.jsxs("g",{className:"gantt-link",children:[e.jsx("path",{d:T,fill:"none",strokeWidth:"1.5",className:"gantt-link-line"}),e.jsx("path",{d,className:"gantt-link-arrow"})]},c.id)})})},vt=(t,n,i=60,a="day",s=1)=>{const[p,c]=S.useState({taskId:null,initialX:0,initialY:0,initialStart:new Date,initialEnd:new Date,type:null,dragDeltaX:0,dragDeltaY:0}),l=S.useCallback((d,g,D,u)=>{const h=t.find(j=>j.id===d);h&&c({taskId:d,initialX:g,initialY:D,initialStart:new Date(h.start),initialEnd:new Date(h.end),type:u,dragDeltaX:0,dragDeltaY:0})},[t]),x=S.useCallback((d,g)=>{if(!p.taskId||!p.type)return null;const D=d-p.initialX,u=g-p.initialY;if(c(E=>({...E,dragDeltaX:D,dragDeltaY:u})),p.type==="reorder")return null;const h=t.find(E=>E.id===p.taskId);if(!h)return null;const j=Math.round(D/i);let F=new Date(p.initialStart),f=new Date(p.initialEnd);switch(p.type){case"move":F=q(p.initialStart,j*s,a),f=q(p.initialEnd,j*s,a);break;case"resize-left":F=q(p.initialStart,j*s,a),F>=f&&(F=q(f,-s,a));break;case"resize-right":f=q(p.initialEnd,j*s,a),f<=F&&(f=q(F,s,a));break}const b=be(F,f);return{...h,start:F,end:f,duration:b}},[p,t,i]),T=S.useCallback(d=>{if(d&&n){const{id:g,...D}=d;n(g,D)}c({taskId:null,initialX:0,initialY:0,initialStart:new Date,initialEnd:new Date,type:null,dragDeltaX:0,dragDeltaY:0})},[n]);return{dragState:p,handleDragStart:l,handleDrag:x,handleDragEnd:T}},Ae=S.forwardRef(({tasks:t,links:n,range:i,scales:a,config:s,selectedTask:p,onTaskClick:c,onTaskDragStart:l,onTaskDragEnd:x,onTaskUpdate:T,zoomLevel:d,baselines:g},D)=>{const[u,h]=S.useState(t),j=(s.columnWidth||60)*d,F=s.baselines&&g&&g.size>0,{dragState:f,handleDragStart:b,handleDrag:E,handleDragEnd:$}=vt(u,T,j,a[1].unit,a[1].step);S.useEffect(()=>{h(t)},[t]);const L=v=>{const C=[];let r=new Date(i.start);for(;r<=i.end;)C.push({date:new Date(r),label:Q(r,v.format||"D")}),r=q(r,v.step,v.unit);return C},B=v=>{const C=a[1],r=i.start.getTime(),k=v.getTime()-r,V={hour:36e5,day:864e5,week:6048e5,month:2592e6,quarter:7776e6,year:31536e6}[C.unit]||864e5;return k/(V*C.step)*j},X=v=>{const C=B(v.start),r=B(v.end);return{left:C,width:Math.max(r-C,0)}},ee=v=>{const C=B(v.start),r=B(v.end);return{left:C,width:Math.max(r-C,0)}},m=v=>{const C=X(v),r=u.findIndex(V=>V.id===v.id),y=s.rowHeight||48,k=32,P=(y-k)/2;return{left:C.left,width:C.width,top:r*y+P,height:k}},O=S.useCallback(v=>{if(f.taskId&&f.type){const C=E(v.clientX,v.clientY);C&&h(r=>r.map(y=>y.id===C.id?C:y))}},[f,E]),W=S.useCallback(()=>{if(f.taskId){const v=u.find(C=>C.id===f.taskId);$(v||null),x()}},[f,u,$,x]),U=a[1],_=L(U),oe=()=>{const v=[];let C=-1,r=-1,y=0,k="";return _.forEach(P=>{const V=P.date.getMonth(),de=P.date.getFullYear(),R=Q(P.date,"MMM YYYY");V!==C||de!==r?(C!==-1&&v.push({label:k,width:y}),C=V,r=de,y=j,k=R):y+=j}),C!==-1&&v.push({label:k,width:y}),v},te=()=>{const v=[];let C=-1,r=0,y=-1,k=-1,P="";return _.forEach(V=>{const R=V.date.getDate()<=15?0:1,K=V.date.getMonth(),ue=V.date.getFullYear(),me=Q(V.date,"MMM"),Me=new Date(ue,K+1,0).getDate(),Le=R===0?`${me} 1 - 15`:`${me} 16 - ${Me}`;R!==C||K!==y||ue!==k?(C!==-1&&v.push({label:P,width:r}),C=R,y=K,k=ue,r=j,P=Le):r+=j}),C!==-1&&v.push({label:P,width:r}),v},se=oe(),Z=te(),z=_.length*j;return e.jsxs("div",{className:"gantt-timeline-container",ref:D,onMouseMove:O,onMouseUp:W,style:{width:z},children:[e.jsxs("div",{className:"gantt-timeline-header",style:{width:z,minWidth:z},children:[e.jsx("div",{className:"gantt-timeline-scale gantt-timeline-scale-month",style:{width:z},children:se.map((v,C)=>e.jsx("div",{className:"gantt-timeline-cell",style:{width:v.width,minWidth:v.width,maxWidth:v.width,borderRight:C===se.length-1?"none":"var(--wx-gantt-border)"},children:v.label},`top-${C}`))}),e.jsx("div",{className:"gantt-timeline-scale gantt-timeline-scale-range",style:{width:z},children:Z.map((v,C)=>e.jsx("div",{className:"gantt-timeline-cell",style:{width:v.width,minWidth:v.width,maxWidth:v.width,borderRight:C===Z.length-1?"none":"var(--wx-gantt-border)"},children:v.label},`mid-${C}`))}),e.jsx("div",{className:"gantt-timeline-scale gantt-timeline-scale-day",style:{width:z},children:_.map((v,C)=>{const r=s.weekends&&Ee(v.date),y=s.holidays&&$e(v.date,s.holidays);return e.jsx("div",{className:`gantt-timeline-cell ${r?"weekend":""} ${y?"holiday":""}`,style:{width:j,minWidth:j,maxWidth:j,borderRight:C===_.length-1?"none":"var(--wx-gantt-border)"},children:v.label},`day-${C}`)})})]}),e.jsxs("div",{className:"gantt-timeline-body",style:{width:z},children:[e.jsx("div",{className:"gantt-timeline-grid",children:_.map((v,C)=>{const r=s.weekends&&Ee(v.date),y=s.holidays&&$e(v.date,s.holidays);return e.jsx("div",{className:`gantt-timeline-grid-column ${r?"weekend":""} ${y?"holiday":""}`,style:{width:j,minWidth:j}},C)})}),n.length>0&&e.jsx(Tt,{links:n,tasks:u,getTaskPosition:m}),e.jsx("div",{className:"gantt-timeline-tasks",style:{width:z},children:u.map(v=>{const C=X(v),r=F?g?.get(v.id):void 0,y=r?ee(r):void 0;return e.jsxs("div",{className:"gantt-timeline-row",children:[r&&y&&v.type!=="milestone"&&e.jsx("div",{className:"gantt-baseline-bar",style:{left:`${y.left}px`,width:`${y.width}px`},title:`Baseline: ${r.start.toLocaleDateString()} - ${r.end.toLocaleDateString()}`}),e.jsx(Ge,{task:v,position:C,selected:p===v.id,dragging:f.taskId===v.id,dragDeltaX:f.dragDeltaX,dragType:f.type,onClick:()=>c(v.id),onDragStart:(k,P,V)=>{b(v.id,k,P,V),l(v.id,k,P)},readonly:s.readonly})]},v.id)})})]})]})});Ae.displayName="Timeline";const Ie=S.forwardRef((t,n)=>e.jsx("div",{className:"gantt-chart-wrapper",style:{flex:1,minWidth:0},children:e.jsx(Ae,{...t,ref:n})}));Ie.displayName="Chart";const{Search:Dt}=o.Input,Ve=({onFilterChange:t,owners:n=[]})=>{const[i,a]=S.useState({searchText:"",status:"all",priority:"all",owner:""}),s=l=>{const x={...i,...l};a(x),t(x)},p=()=>{const l={searchText:"",status:"all",priority:"all",owner:""};a(l),t(l)},c=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(Dt,{placeholder:"Search tasks...",value:i.searchText,onChange:l=>s({searchText:l.target.value}),allowClear:!0,className:"gantt-search-antd",style:{width:250}})}),e.jsxs("div",{className:"gantt-filter-right",children:[e.jsx(o.Select,{value:i.status,onChange:l=>s({status:l}),className:"gantt-filter-select-antd",style:{width:140},options:[{value:"all",label:"All Status"},{value:"not-started",label:"Not Started"},{value:"in-progress",label:"In Progress"},{value:"completed",label:"Completed"}]}),e.jsx(o.Select,{value:i.priority,onChange:l=>s({priority:l}),className:"gantt-filter-select-antd",style:{width:130},options:[{value:"all",label:"All Priority"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}]}),e.jsx(o.Select,{value:i.owner||void 0,onChange:l=>s({owner:l||""}),className:"gantt-filter-select-antd",style:{width:130},placeholder:"All Owners",allowClear:!0,options:[{value:"",label:"All Owners"},...(n||[]).map(l=>({value:l,label:l}))]}),c&&e.jsx(o.Button,{type:"default",danger:!0,icon:e.jsx(I.FontAwesomeIcon,{icon:A.faTimesCircle}),onClick:p,className:"gantt-filter-clear-antd",children:"Clear"})]})]})})},Je=(t,n)=>t.filter(i=>{if(n.searchText){const a=n.searchText.toLowerCase(),s=i.text.toLowerCase().includes(a),p=i.owner?.toLowerCase().includes(a),c=i.details?.toLowerCase().includes(a);if(!s&&!p&&!c)return!1}if(n.status!=="all"&&(i.progress===0?"not-started":i.progress===100?"completed":"in-progress")!==n.status||n.priority!=="all"&&i.priority!==n.priority||n.owner&&i.owner!==n.owner)return!1;if(n.dateRange){const a=i.start.getTime(),s=n.dateRange.start.getTime(),p=n.dateRange.end.getTime();if(a<s||a>p)return!1}return!0}),Xe=({zoomLevel:t,setZoomLevel:n,onBaselineToggle:i,showBaselines:a,onExport:s,onFilterChange:p,owners:c,onAddTask:l})=>e.jsxs("div",{className:"gantt-toolbar-wrapper",children:[e.jsxs("div",{className:"gantt-toolbar",children:[e.jsx("div",{className:"gantt-toolbar-left",children:e.jsxs(o.Space,{size:8,children:[e.jsx(o.Button,{type:"primary",icon:e.jsx(I.FontAwesomeIcon,{icon:A.faPlus}),onClick:l,children:"New Task"}),e.jsx(o.Tooltip,{title:a?"Hide Baselines":"Show Baselines",children:e.jsx(o.Button,{type:a?"primary":"default",icon:e.jsx(I.FontAwesomeIcon,{icon:A.faCalendarCheck}),onClick:i,children:a?"Baselines":"Set Baseline"})})]})}),e.jsx("div",{className:"gantt-toolbar-right",children:e.jsxs(o.Space,{size:4,children:[e.jsx(o.Tooltip,{title:"Zoom Out",children:e.jsx(o.Button,{icon:e.jsx(I.FontAwesomeIcon,{icon:A.faSearchMinus}),onClick:()=>n(Math.max(.5,t-.25))})}),e.jsx(o.Tooltip,{title:"Zoom In",children:e.jsx(o.Button,{icon:e.jsx(I.FontAwesomeIcon,{icon:A.faSearchPlus}),onClick:()=>n(Math.min(2,t+.25))})}),e.jsx(o.Tooltip,{title:"Reset Zoom",children:e.jsx(o.Button,{icon:e.jsx(I.FontAwesomeIcon,{icon:A.faRotateLeft}),onClick:()=>n(1)})}),e.jsx(o.Divider,{type:"vertical",style:{height:24,margin:"0 4px"}}),e.jsx(o.Tooltip,{title:"Export to CSV",children:e.jsx(o.Button,{icon:e.jsx(I.FontAwesomeIcon,{icon:A.faFileCsv}),onClick:()=>s("csv")})}),e.jsx(o.Tooltip,{title:"Export to Excel",children:e.jsx(o.Button,{icon:e.jsx(I.FontAwesomeIcon,{icon:A.faFileExcel}),onClick:()=>s("excel")})}),e.jsx(o.Tooltip,{title:"Export to JSON",children:e.jsx(o.Button,{icon:e.jsx(I.FontAwesomeIcon,{icon:A.faFileCode}),onClick:()=>s("json")})}),e.jsx(o.Tooltip,{title:"Export to PDF",children:e.jsx(o.Button,{icon:e.jsx(I.FontAwesomeIcon,{icon:A.faFilePdf}),onClick:()=>s("pdf")})})]})})]}),e.jsx(Ve,{onFilterChange:p,owners:c})]}),{Option:xe}=o.Select,{TextArea:Mt}=o.Input,qe=({onCreateTask:t,onClose:n})=>{const[i]=o.Form.useForm(),a=s=>{const p=s.start.toDate(),c=new Date(p);c.setDate(c.getDate()+(s.duration||1)),t({text:s.text,start:p,end:c,duration:s.duration||1,progress:s.progress||0,type:s.type,color:typeof s.color=="string"?s.color:s.color?.toHexString?.()||"#4A90E2",owner:s.owner||"",priority:s.priority||"medium",details:s.details||""}),n()};return e.jsx(o.Modal,{title:"Create New Task",open:!0,onCancel:n,onOk:()=>i.submit(),okText:"Create Task",cancelText:"Cancel",width:600,className:"gantt-modal-antd",children:e.jsxs(o.Form,{form:i,layout:"vertical",onFinish:a,initialValues:{type:"task",priority:"medium",start:_e(),duration:1,progress:0,color:"#4A90E2"},children:[e.jsx(o.Form.Item,{name:"text",label:"Task Name",rules:[{required:!0,message:"Please enter task name"}],children:e.jsx(o.Input,{placeholder:"Enter task name",autoFocus:!0})}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsx(o.Form.Item,{name:"type",label:"Type",style:{flex:1},children:e.jsxs(o.Select,{children:[e.jsx(xe,{value:"task",children:"Task"}),e.jsx(xe,{value:"milestone",children:"Milestone"}),e.jsx(xe,{value:"project",children:"Project"})]})}),e.jsx(o.Form.Item,{name:"priority",label:"Priority",style:{flex:1},children:e.jsxs(o.Select,{children:[e.jsx(xe,{value:"low",children:"Low"}),e.jsx(xe,{value:"medium",children:"Medium"}),e.jsx(xe,{value:"high",children:"High"})]})})]}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsx(o.Form.Item,{name:"start",label:"Start Date",style:{flex:1},children:e.jsx(o.DatePicker,{style:{width:"100%"}})}),e.jsx(o.Form.Item,{name:"duration",label:"Duration (days)",style:{flex:1},children:e.jsx(o.InputNumber,{min:0,style:{width:"100%"}})})]}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsx(o.Form.Item,{name:"color",label:"Color",style:{flex:1},children:e.jsx(o.ColorPicker,{showText:!0})}),e.jsx(o.Form.Item,{name:"progress",label:"Progress (%)",style:{flex:1},children:e.jsx(o.InputNumber,{min:0,max:100,style:{width:"100%"}})})]}),e.jsx(o.Form.Item,{name:"owner",label:"Owner",children:e.jsx(o.Input,{placeholder:"Assign to..."})}),e.jsx(o.Form.Item,{name:"details",label:"Details",children:e.jsx(Mt,{placeholder:"Add task description...",rows:3})})]})})},{Option:ge}=o.Select,{TextArea:Ct}=o.Input,{confirm:kt}=o.Modal,Ze=({task:t,onUpdate:n,onDelete:i,onClose:a})=>{const[s]=o.Form.useForm(),p=l=>{const x=l.start.toDate(),T=new Date(x);T.setDate(T.getDate()+(l.duration||1)),n({...t,text:l.text,start:x,end:T,duration:l.duration||1,progress:l.progress||0,type:l.type,color:typeof l.color=="string"?l.color:l.color?.toHexString?.()||"#4A90E2",owner:l.owner||"",priority:l.priority||"medium",details:l.details||""}),a()},c=()=>{kt({title:`Are you sure you want to delete "${t.text}"?`,icon:e.jsx(I.FontAwesomeIcon,{icon:A.faExclamationTriangle,style:{color:"#faad14",marginRight:8}}),content:"This action cannot be undone.",okText:"Yes, Delete",okType:"danger",cancelText:"No",onOk(){i(t.id),a()}})};return e.jsx(o.Modal,{title:"Edit Task",open:!0,onCancel:a,footer:[e.jsx(o.Button,{danger:!0,onClick:c,style:{float:"left"},children:"Delete"},"delete"),e.jsx(o.Button,{onClick:a,children:"Cancel"},"cancel"),e.jsx(o.Button,{type:"primary",onClick:()=>s.submit(),children:"Save Changes"},"submit")],width:600,className:"gantt-modal-antd",children:e.jsxs(o.Form,{form:s,layout:"vertical",onFinish:p,initialValues:{text:t.text,type:t.type||"task",priority:t.priority||"medium",start:_e(t.start),duration:t.duration,progress:t.progress,color:t.color||"#4A90E2",owner:t.owner||"",details:t.details||""},children:[e.jsx(o.Form.Item,{name:"text",label:"Task Name",rules:[{required:!0,message:"Please enter task name"}],children:e.jsx(o.Input,{placeholder:"Enter task name"})}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsx(o.Form.Item,{name:"type",label:"Type",style:{flex:1},children:e.jsxs(o.Select,{children:[e.jsx(ge,{value:"task",children:"Task"}),e.jsx(ge,{value:"milestone",children:"Milestone"}),e.jsx(ge,{value:"project",children:"Project"})]})}),e.jsx(o.Form.Item,{name:"priority",label:"Priority",style:{flex:1},children:e.jsxs(o.Select,{children:[e.jsx(ge,{value:"low",children:"Low"}),e.jsx(ge,{value:"medium",children:"Medium"}),e.jsx(ge,{value:"high",children:"High"})]})})]}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsx(o.Form.Item,{name:"start",label:"Start Date",style:{flex:1},children:e.jsx(o.DatePicker,{style:{width:"100%"}})}),e.jsx(o.Form.Item,{name:"duration",label:"Duration (days)",style:{flex:1},children:e.jsx(o.InputNumber,{min:0,style:{width:"100%"}})})]}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsx(o.Form.Item,{name:"color",label:"Color",style:{flex:1},children:e.jsx(o.ColorPicker,{showText:!0})}),e.jsx(o.Form.Item,{name:"progress",label:"Progress (%)",style:{flex:1},children:e.jsx(o.InputNumber,{min:0,max:100,style:{width:"100%"}})})]}),e.jsx(o.Form.Item,{name:"owner",label:"Owner",children:e.jsx(o.Input,{placeholder:"Assign to..."})}),e.jsx(o.Form.Item,{name:"details",label:"Details",children:e.jsx(Ct,{placeholder:"Add task description...",rows:3})})]})})},{Title:ve,Text:le,Paragraph:Ke}=o.Typography,{Option:fe}=o.Select,Qe=({task:t,allTasks:n,links:i,onAddDependency:a,onRemoveDependency:s,onClose:p})=>{const[c,l]=S.useState(""),[x,T]=S.useState("e2s"),[d,g]=S.useState(0),[D,u]=S.useState("day"),[h,j]=S.useState(""),F=i.filter(m=>m.target===t.id),f=i.filter(m=>m.source===t.id),b=n.filter(m=>m.id!==t.id&&m.id!==t.parent),E=()=>{if(c){const m=Ne(d,D);a(c,t.id,x,m),l(""),g(0),u("day")}},$=()=>{if(!h.trim())return;const m=gt(h.trim());if(!m){alert(`Invalid format. Use: [TaskNumber][Type][+/-][Lag][Unit]
7
- Example: 3FS+10d`);return}const O=m.taskNumber-1,W=n[O];if(!W){alert(`Task ${m.taskNumber} not found`);return}const U=wt(m.type),_=Ne(m.lag,m.lagUnit);a(W.id,t.id,U,_),j("")},L=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)"}},B=m=>{switch(m){case"e2s":return"blue";case"s2s":return"green";case"e2e":return"purple";case"s2e":return"orange"}},X=m=>!m||m===0?null:m>0?e.jsxs(o.Tag,{color:"warning",children:["+",m,"d lag"]}):e.jsxs(o.Tag,{color:"processing",children:[m,"d lead"]}),ee=(m,O)=>{const W=n.find(U=>U.id===(O==="source"?m.source:m.target));return e.jsx(o.List.Item,{actions:[e.jsx(o.Button,{type:"text",danger:!0,icon:e.jsx(I.FontAwesomeIcon,{icon:A.faTrash}),onClick:()=>s(m.id),children:"Remove"})],children:e.jsx(o.List.Item.Meta,{title:e.jsxs(o.Space,{children:[e.jsx(le,{strong:!0,style:{fontFamily:"IBM Plex Sans, sans-serif"},children:W?.text||(O==="source"?m.source:m.target)}),e.jsx(o.Tag,{color:B(m.type),children:L(m.type)}),X(m.lag)]}),description:e.jsxs(le,{type:"secondary",style:{fontFamily:"IBM Plex Sans, sans-serif",fontSize:"12px"},children:[W?.owner&&`Owner: ${W.owner}`,W?.priority&&` • Priority: ${W.priority}`]})})})};return e.jsxs(o.Modal,{title:e.jsxs(o.Space,{children:[e.jsx(I.FontAwesomeIcon,{icon:A.faLink,style:{fontSize:"20px"}}),e.jsx(ve,{level:4,style:{margin:0,fontFamily:"IBM Plex Mono, monospace"},children:"Task Dependencies"})]}),open:!0,onCancel:p,width:900,footer:null,className:"gantt-dependency-modal",styles:{body:{maxHeight:"70vh",overflowY:"auto",fontFamily:"IBM Plex Sans, sans-serif"}},children:[e.jsx(o.Card,{size:"small",style:{marginBottom:24,backgroundColor:"#f5f5f5",borderColor:"#d9d9d9"},children:e.jsxs(o.Space,{direction:"vertical",size:4,children:[e.jsx(le,{strong:!0,style:{fontFamily:"IBM Plex Mono, monospace",fontSize:"16px"},children:t.text}),e.jsxs(le,{type:"secondary",style:{fontFamily:"IBM Plex Sans, sans-serif",fontSize:"13px"},children:[t.start.toLocaleDateString()," → ",t.end.toLocaleDateString(),t.owner&&` • Owner: ${t.owner}`,t.priority&&` • Priority: ${t.priority}`]})]})}),e.jsxs("div",{style:{marginBottom:32},children:[e.jsxs(ve,{level:5,style:{fontFamily:"IBM Plex Mono, monospace",textTransform:"uppercase",letterSpacing:"0.5px",fontSize:"13px",color:"#595959"},children:[e.jsx(I.FontAwesomeIcon,{icon:A.faArrowDown,style:{marginRight:"8px"}}),"Depends On (Predecessors)"]}),F.length===0?e.jsx(o.Alert,{message:"No dependencies",description:"This task doesn't depend on any other tasks.",type:"info",showIcon:!0,style:{fontFamily:"IBM Plex Sans, sans-serif"}}):e.jsx(o.List,{dataSource:F,renderItem:m=>ee(m,"source"),bordered:!0,style:{fontFamily:"IBM Plex Sans, sans-serif"}})]}),e.jsxs("div",{style:{marginBottom:32},children:[e.jsxs(ve,{level:5,style:{fontFamily:"IBM Plex Mono, monospace",textTransform:"uppercase",letterSpacing:"0.5px",fontSize:"13px",color:"#595959"},children:[e.jsx(I.FontAwesomeIcon,{icon:A.faArrowUp,style:{marginRight:"8px"}}),"Dependents (Successors)"]}),f.length===0?e.jsx(o.Alert,{message:"No dependent tasks",description:"No other tasks depend on this task.",type:"info",showIcon:!0,style:{fontFamily:"IBM Plex Sans, sans-serif"}}):e.jsx(o.List,{dataSource:f,renderItem:m=>ee(m,"target"),bordered:!0,style:{fontFamily:"IBM Plex Sans, sans-serif"}})]}),e.jsx(o.Divider,{}),e.jsx(o.Card,{title:e.jsxs(ve,{level:5,style:{margin:0,fontFamily:"IBM Plex Mono, monospace",fontSize:"14px"},children:[e.jsx(I.FontAwesomeIcon,{icon:A.faPlus,style:{marginRight:"8px"}}),"Add New Dependency"]}),style:{marginBottom:24},children:e.jsxs(o.Space,{direction:"vertical",size:"large",style:{width:"100%"},children:[e.jsxs("div",{children:[e.jsx(le,{strong:!0,style:{fontFamily:"IBM Plex Sans, sans-serif",display:"block",marginBottom:8},children:"Quick Add (Keyboard Shortcut):"}),e.jsx(le,{type:"secondary",style:{fontFamily:"IBM Plex Sans, sans-serif",fontSize:"12px",display:"block",marginBottom:8},children:"Format: [TaskNumber][Type][+/-][Lag][Unit] • Example: 3FS+10d, 5SS-2w"}),e.jsxs(o.Space.Compact,{style:{width:"100%"},children:[e.jsx(o.Input,{placeholder:"e.g., 3FS+10d",value:h,onChange:m=>j(m.target.value),onPressEnter:$,size:"large",style:{fontFamily:"IBM Plex Mono, monospace"}}),e.jsx(o.Button,{type:"primary",size:"large",onClick:$,style:{fontFamily:"IBM Plex Sans, sans-serif"},children:"Add"})]})]}),e.jsx(o.Divider,{style:{margin:"8px 0"},children:"OR"}),e.jsxs("div",{children:[e.jsx(le,{strong:!0,style:{fontFamily:"IBM Plex Sans, sans-serif",display:"block",marginBottom:8},children:"Select Task:"}),e.jsx(o.Select,{placeholder:"Choose a task...",value:c||void 0,onChange:l,style:{width:"100%",fontFamily:"IBM Plex Sans, sans-serif"},size:"large",showSearch:!0,filterOption:(m,O)=>String(O?.children||"").toLowerCase().includes(m.toLowerCase()),children:b.map(m=>e.jsx(fe,{value:m.id,children:m.text},m.id))})]}),e.jsxs("div",{children:[e.jsx(le,{strong:!0,style:{fontFamily:"IBM Plex Sans, sans-serif",display:"block",marginBottom:8},children:"Dependency Type:"}),e.jsxs(o.Select,{value:x,onChange:T,style:{width:"100%",fontFamily:"IBM Plex Sans, sans-serif"},size:"large",children:[e.jsxs(fe,{value:"e2s",children:[e.jsx(o.Tag,{color:"blue",children:"FS"})," Finish-to-Start"]}),e.jsxs(fe,{value:"s2s",children:[e.jsx(o.Tag,{color:"green",children:"SS"})," Start-to-Start"]}),e.jsxs(fe,{value:"e2e",children:[e.jsx(o.Tag,{color:"purple",children:"FF"})," Finish-to-Finish"]}),e.jsxs(fe,{value:"s2e",children:[e.jsx(o.Tag,{color:"orange",children:"SF"})," Start-to-Finish"]})]})]}),e.jsx("div",{children:e.jsxs(o.Space,{direction:"vertical",size:4,style:{width:"100%"},children:[e.jsx(le,{strong:!0,style:{fontFamily:"IBM Plex Sans, sans-serif"},children:"Lead/Lag Time:"}),e.jsx(le,{type:"secondary",style:{fontFamily:"IBM Plex Sans, sans-serif",fontSize:"12px"},children:"Negative = lead time (overlap), Positive = lag time (delay)"}),e.jsxs(o.Space.Compact,{style:{width:"100%"},children:[e.jsx(o.InputNumber,{value:d,onChange:m=>g(m||0),style:{flex:1,fontFamily:"IBM Plex Sans, sans-serif"},size:"large",placeholder:"0",min:-365,max:365}),e.jsxs(o.Select,{value:D,onChange:u,style:{width:120,fontFamily:"IBM Plex Sans, sans-serif"},size:"large",children:[e.jsx(fe,{value:"day",children:"Days"}),e.jsx(fe,{value:"hour",children:"Hours"}),e.jsx(fe,{value:"week",children:"Weeks"}),e.jsx(fe,{value:"month",children:"Months"})]})]})]})}),e.jsx(o.Button,{type:"primary",size:"large",icon:e.jsx(I.FontAwesomeIcon,{icon:A.faPlus}),onClick:E,disabled:!c,block:!0,style:{fontFamily:"IBM Plex Sans, sans-serif",fontWeight:600},children:"Add Dependency"})]})}),e.jsx(o.Alert,{message:e.jsxs(le,{strong:!0,style:{fontFamily:"IBM Plex Mono, monospace"},children:[e.jsx(I.FontAwesomeIcon,{icon:A.faInfoCircle,style:{marginRight:"8px"}}),"Dependency Types Explained"]}),description:e.jsxs("div",{style:{fontFamily:"IBM Plex Sans, sans-serif"},children:[e.jsxs("ul",{style:{marginBottom:12,paddingLeft:20},children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Finish-to-Start (FS):"})," Successor starts after predecessor finishes"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Start-to-Start (SS):"})," Both tasks start at the same time"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Finish-to-Finish (FF):"})," Both tasks finish at the same time"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Start-to-Finish (SF):"})," Successor finishes when predecessor starts"]})]}),e.jsx(o.Divider,{style:{margin:"12px 0"}}),e.jsx(le,{strong:!0,style:{display:"block",marginBottom:4},children:"Keyboard Shortcuts:"}),e.jsx(Ke,{style:{margin:0,fontSize:"12px"},code:!0,children:"[TaskID][Type]+/-[Days]d"}),e.jsxs(Ke,{style:{margin:0,fontSize:"12px"},children:["Example: ",e.jsx("code",{children:"3FS+10d"})," = Task 3, Finish-to-Start, 10 days lag"]})]}),type:"info",showIcon:!0,icon:e.jsx(I.FontAwesomeIcon,{icon:A.faInfoCircle}),style:{marginTop:16}})]})},Ft=({x:t,y:n,task:i,onEdit:a,onDelete:s,onCopy:p,onDependencies:c,onConvertToMilestone:l,onConvertToTask:x,onConvertToProject:T,onAutoSchedule:d,onClose:g})=>{if(!i)return null;const D=[{key:"edit",label:"Edit",icon:e.jsx(I.FontAwesomeIcon,{icon:A.faEdit}),onClick:()=>{a(),g()}},{key:"copy",label:"Copy",icon:e.jsx(I.FontAwesomeIcon,{icon:A.faCopy}),onClick:()=>{p(),g()}},{key:"dependencies",label:"Dependencies",icon:e.jsx(I.FontAwesomeIcon,{icon:A.faLink}),onClick:()=>{c(),g()}},{type:"divider"},{key:"convert",label:"Convert to",type:"submenu",children:[{key:"milestone",label:"Milestone",icon:e.jsx(I.FontAwesomeIcon,{icon:A.faFlag}),disabled:i.type==="milestone",onClick:()=>{l(),g()}},{key:"task",label:"Task",icon:e.jsx(I.FontAwesomeIcon,{icon:A.faTasks}),disabled:i.type==="task",onClick:()=>{x(),g()}},{key:"project",label:"Project",icon:e.jsx(I.FontAwesomeIcon,{icon:A.faFolder}),disabled:i.type==="project",onClick:()=>{T(),g()}}]},{key:"auto-schedule",label:"Auto Schedule",icon:e.jsx(I.FontAwesomeIcon,{icon:A.faRotateLeft}),onClick:()=>{d?.(),g()}},{type:"divider"},{key:"delete",label:"Delete",icon:e.jsx(I.FontAwesomeIcon,{icon:A.faTrash}),danger:!0,onClick:()=>{s(),g()}}];return e.jsx("div",{className:"gantt-context-menu",style:{position:"fixed",left:`${t}px`,top:`${n}px`,zIndex:1e4},onClick:u=>u.stopPropagation(),children:e.jsx(o.Menu,{items:D,style:{boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",borderRadius:"6px",border:"1px solid #e0e0e0"}})})},et=(t,n=[])=>{const[i,a]=S.useState([]),[s,p]=S.useState(-1),[c,l]=S.useState(t),[x,T]=S.useState(n);S.useEffect(()=>{l(t)},[t]),S.useEffect(()=>{T(n)},[n]);const d=S.useCallback((b,E,$)=>{const L={type:b,before:E,after:$,timestamp:Date.now()},B=i.slice(0,s+1);B.push(L),B.length>50?B.shift():p(s+1),a(B)},[i,s]),g=S.useCallback(()=>{if(s<0)return;const b=i[s];l(b.before.tasks),T(b.before.links),p(s-1)},[i,s]),D=S.useCallback(()=>{if(s>=i.length-1)return;const b=i[s+1];l(b.after.tasks),T(b.after.links),p(s+1)},[i,s]),u=s>=0,h=s<i.length-1,j=S.useCallback(b=>{const E={tasks:c,links:x},$=c.map(B=>B.id===b.id?b:B);d("task_update",E,{tasks:$,links:x}),l($)},[c,x,d]),F=S.useCallback(b=>{const E={tasks:c,links:x},$=[...c,b];d("task_create",E,{tasks:$,links:x}),l($)},[c,x,d]),f=S.useCallback(b=>{const E={tasks:c,links:x},$=c.filter(X=>X.id!==b),L=x.filter(X=>X.source!==b&&X.target!==b);d("task_delete",E,{tasks:$,links:L}),l($),T(L)},[c,x,d]);return{tasks:c,links:x,setTasks:l,setLinks:T,undo:g,redo:D,canUndo:u,canRedo:h,updateTask:j,createTask:F,deleteTask:f,saveState:d,history:i}},tt=(t,n,i={mode:"forward"})=>{const a=new Map,s=new Map;return t.forEach(p=>{a.set(p.id,[]),s.set(p.id,[])}),n.forEach(p=>{p.type==="e2s"&&(a.get(p.target)?.push(p.source),s.get(p.source)?.push(p.target))}),i.mode==="forward"?Et(t,a,i):$t(t,s,i)},Et=(t,n,i)=>{const a=new Map,s=new Set,p=i.projectStart||new Date,c=l=>{if(s.has(l))return;const x=t.find(h=>h.id===l);if(!x)return;const T=n.get(l)||[];T.forEach(h=>c(h));let d=p;T.forEach(h=>{const j=a.get(h);j&&j.end>d&&(d=new Date(j.end))});const g=new Date(d),D=q(g,x.duration,"day"),u={...x,start:g,end:D};a.set(l,u),s.add(l)};return t.forEach(l=>c(l.id)),t.map(l=>a.get(l.id)||l)},$t=(t,n,i)=>{const a=new Map,s=new Set,p=i.projectEnd||new Date(Math.max(...t.map(l=>l.end.getTime()))),c=l=>{if(s.has(l))return;const x=t.find(h=>h.id===l);if(!x)return;const T=n.get(l)||[];T.forEach(h=>c(h));let d=p;T.forEach(h=>{const j=a.get(h);j&&j.start<d&&(d=new Date(j.start))});const g=new Date(d),D=q(g,-x.duration,"day"),u={...x,start:D,end:g};a.set(l,u),s.add(l)};return t.forEach(l=>c(l.id)),t.map(l=>a.get(l.id)||l)},Nt=Object.freeze(Object.defineProperty({__proto__:null,autoSchedule:tt,levelResources:t=>{const n=new Map;t.forEach(a=>{a.owner&&(n.has(a.owner)||n.set(a.owner,[]),n.get(a.owner).push(a))});const i=[...t];return n.forEach((a,s)=>{const p=a.sort((c,l)=>c.start.getTime()-l.start.getTime());for(let c=1;c<p.length;c++){const l=p[c],x=p[c-1];if(l.start<x.end){const T=i.findIndex(d=>d.id===l.id);if(T>=0){const d=new Date(x.end),g=q(d,l.duration,"day");i[T]={...l,start:d,end:g}}}}}),i}},Symbol.toStringTag,{value:"Module"})),nt=t=>{const n=new Map;return t.forEach(i=>{n.set(i.id,{taskId:i.id,start:new Date(i.start),end:new Date(i.end)})}),n},st=t=>{const n=["ID","Task Name","Start Date","End Date","Duration","Progress","Type","Owner","Priority"],i=t.map(s=>[s.id,s.text,Q(s.start,"YYYY-MM-DD"),Q(s.end,"YYYY-MM-DD"),s.duration.toString(),`${s.progress}%`,s.type||"task",s.owner||"",s.priority||"medium"]),a=[n.join(","),...i.map(s=>s.map(p=>`"${p}"`).join(","))].join(`
8
- `);De(a,"gantt-tasks.csv","text/csv")},rt=t=>{const n=["ID","Task Name","Start Date","End Date","Duration","Progress","Type","Owner","Priority","Details"],i=t.map(s=>[s.id,s.text,Q(s.start,"MM/DD/YYYY"),Q(s.end,"MM/DD/YYYY"),s.duration.toString(),s.progress.toString(),s.type||"task",s.owner||"",s.priority||"medium",s.details||""]),a="\uFEFF"+[n.join(" "),...i.map(s=>s.map(p=>p.replace(/\t/g," ")).join(" "))].join(`
9
- `);De(a,"gantt-tasks.xls","application/vnd.ms-excel")},it=(t,n)=>{const i={tasks:t,links:n,exported:new Date().toISOString(),version:"1.0"},a=JSON.stringify(i,null,2);De(a,"gantt-project.json","application/json")},ot=t=>{const n=`
14
+ <%s key={someKey} {...props} />`,Mt,ze,Tr,ze),q[ze+Mt]=!0}}return r===o?ue(ae):G(ae),ae}}function Z(r,m,D){return he(r,m,D,!0)}function pe(r,m,D){return he(r,m,D,!1)}var _e=pe,ie=Z;Ke.Fragment=o,Ke.jsx=_e,Ke.jsxs=ie})()),Ke}var Pt;function Kt(){return Pt||(Pt=1,process.env.NODE_ENV==="production"?rt.exports=Gt():rt.exports=Xt()),rt.exports}var e=Kt();const le=(n,a,s)=>{const o=new Date(n);switch(s){case"hour":o.setHours(o.getHours()+a);break;case"day":o.setDate(o.getDate()+a);break;case"week":o.setDate(o.getDate()+a*7);break;case"month":o.setMonth(o.getMonth()+a);break;case"quarter":o.setMonth(o.getMonth()+a*3);break;case"year":o.setFullYear(o.getFullYear()+a);break}return o},Ze=(n,a)=>{const s=a.getTime()-n.getTime();return Math.ceil(s/(1e3*60*60*24))},Ct=(n,a)=>{const s=a.getTime()-n.getTime();return Math.ceil(s/(1e3*60*60))},fe=(n,a)=>{const s=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],o=["January","February","March","April","May","June","July","August","September","October","November","December"],t=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],g={YYYY:n.getFullYear().toString(),YY:n.getFullYear().toString().slice(-2),MMMM:o[n.getMonth()],MMM:s[n.getMonth()],MM:String(n.getMonth()+1).padStart(2,"0"),M:String(n.getMonth()+1),DD:String(n.getDate()).padStart(2,"0"),D:String(n.getDate()),dddd:t[n.getDay()],HH:String(n.getHours()).padStart(2,"0"),H:String(n.getHours()),mm:String(n.getMinutes()).padStart(2,"0"),m:String(n.getMinutes())};return a.replace(/YYYY|YY|MMMM|MMM|MM|M|DD|D|dddd|HH|H|mm|m/g,y=>g[y])},ht=n=>{const a=n.getDay();return a===0||a===6},pt=(n,a)=>a.some(s=>s.getFullYear()===n.getFullYear()&&s.getMonth()===n.getMonth()&&s.getDate()===n.getDate()),Be=n=>{const a=new Date(n);return a.setHours(0,0,0,0),a},Zt=n=>{const a=new Date(n);return a.setHours(23,59,59,999),a},Qt=(n,a,s="day")=>{switch(s){case"hour":return Ct(n,a);case"day":return Ze(n,a);case"week":return Math.ceil(Ze(n,a)/7);case"month":return(a.getFullYear()-n.getFullYear())*12+(a.getMonth()-n.getMonth());default:return Ze(n,a)}};function er(n){if(!n||typeof n!="string")return null;const a=n.trim(),s=/^(\d+)(FS|SS|FF|SF)(([+-])(\d+)([dhwm]))?$/i,o=a.match(s);if(!o)return null;const t=parseInt(o[1],10),g=o[2].toUpperCase();let y=0,i="day";if(o[3]){const c=o[4]==="-"?-1:1;switch(y=parseInt(o[5],10)*c,o[6].toLowerCase()){case"d":i="day";break;case"h":i="hour";break;case"w":i="week";break;case"m":i="month";break}}return{taskNumber:t,type:g,lag:y,lagUnit:i}}function ft(n,a){switch(a){case"hour":return n/24;case"day":return n;case"week":return n*7;case"month":return n*30;default:return n}}function tr(n,a){const o={e2s:"FS",s2s:"SS",e2e:"FF",s2e:"SF"}[n.type];let t=`${a}${o}`;if(n.lag&&n.lag!==0){const g=n.lag>0?"+":"",i=(n.lagUnit||"day").charAt(0);let c=n.lag;if(n.lagUnit&&n.lagUnit!=="day")switch(n.lagUnit){case"hour":c=n.lag*24;break;case"week":c=n.lag/7;break;case"month":c=n.lag/30;break}t+=`${g}${Math.round(c)}${i}`}return t}function rr(n){return{FS:"e2s",SS:"s2s",FF:"e2e",SF:"s2e"}[n]}const{Text:Fe,Paragraph:nr,Link:sr}=l.Typography,{Option:$t}=l.Select,ar=({task:n,allTasks:a,onAddDependency:s,children:o})=>{const[t,g]=j.useState(!1),[y,i]=j.useState(""),[c,v]=j.useState(null),[h,b]=j.useState("e2s"),[k,x]=j.useState("lag"),[p,u]=j.useState(0),[P,L]=j.useState(!0),f="day",M=j.useMemo(()=>{if(!y)return a.filter(H=>H.id!==n.id);const w=y.toLowerCase();return a.filter(H=>H.id!==n.id&&(H.text.toLowerCase().includes(w)||(a.indexOf(H)+1).toString().includes(w)))},[a,y,n.id]),A=()=>{if(c){const w=k==="lag"?p:-p,H=ft(w,f);s(c,n.id,h,H),g(!1),R()}},R=()=>{i(""),v(null),b("e2s"),x("lag"),u(0)},O=()=>{if(!P)return null;const w=h==="e2s",H=h==="s2s",Q=h==="e2e",ne=h==="s2e";let U=0,V=0,ce="",de=0,me=-1;return w?(U=20,V=160,de=140,me=160,ce="M 140 40 L 150 40 C 160 40, 160 90, 150 90 L 160 90"):Q?(U=60,V=60,de=180,me=-1,ce="M 180 40 L 200 40 L 200 90 L 180 90"):H?(U=100,V=100,de=100,me=-1,ce="M 100 40 L 80 40 L 80 90 L 100 90"):ne&&(U=160,V=20,de=160,me=140,ce="M 160 40 L 150 40 C 140 40, 140 90, 150 90 L 140 90"),e.jsx("div",{style:{width:"100%",height:120,backgroundColor:"#fff",borderRadius:4,marginBottom:10,border:"1px solid #e9ecef",position:"relative",overflow:"hidden"},children:e.jsxs("svg",{viewBox:"0 0 300 120",style:{width:"100%",height:"100%"},children:[e.jsx("line",{x1:de,x2:de,y1:"0",y2:"120",stroke:"#f0f0f0",strokeDasharray:"3,3"}),me!==-1&&e.jsx("line",{x1:me,x2:me,y1:"0",y2:"120",stroke:"#f0f0f0",strokeDasharray:"3,3"}),e.jsx("rect",{x:U,y:"28",width:"120",height:"24",rx:"4",fill:"#bae7ff",stroke:"#69c0ff"}),e.jsx("text",{x:U+60,y:"44",fontSize:"11",textAnchor:"middle",fill:"#0050b3",children:"Task 2"}),e.jsx("rect",{x:V,y:"78",width:"120",height:"24",rx:"4",fill:"#bae7ff",stroke:"#69c0ff"}),e.jsx("text",{x:V+60,y:"94",fontSize:"11",textAnchor:"middle",fill:"#0050b3",children:"Task 3"}),e.jsx("path",{d:ce,fill:"none",stroke:"#8c8c8c",strokeWidth:"1.5",markerEnd:"url(#arrowhead)"}),e.jsx("defs",{children:e.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"7",refX:"9",refY:"3.5",orient:"auto",children:e.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#8c8c8c"})})})]})})},re=()=>{const w=a.find(U=>U.id===c);if(!w)return"Select a task from the list to see how it will relate to the current task.";const H=a.indexOf(n)+1,Q=a.indexOf(w)+1;let ne="";switch(h){case"e2s":ne=`Task ${H} starts after Task ${Q} finishes`;break;case"s2s":ne=`Task ${H} starts when Task ${Q} starts`;break;case"e2e":ne=`Task ${H} finishes when Task ${Q} finishes`;break;case"s2e":ne=`Task ${H} finishes when Task ${Q} starts`;break}if(p>0){const U=`${p} ${f}${p>1?"s":""}`;k==="lag"?ne+=` + ${U} delay`:ne+=` - ${U} overlap`}return ne+"."},ye=e.jsxs("div",{style:{display:"flex",width:620,height:480,backgroundColor:"#fff",borderRadius:"8px",overflow:"hidden"},children:[e.jsxs("div",{style:{flex:1,borderRight:"1px solid #f0f0f0",display:"flex",flexDirection:"column",padding:0},children:[e.jsx("div",{style:{padding:"12px"},children:e.jsx(l.Input,{placeholder:"Search task...",value:y,onChange:w=>i(w.target.value),style:{marginBottom:8},autoFocus:!0,size:"large"})}),e.jsx("div",{style:{flex:1,overflowY:"auto"},children:e.jsx(l.List,{size:"small",dataSource:M,renderItem:w=>e.jsxs(l.List.Item,{className:`task-list-item ${c===w.id?"selected":""}`,onClick:()=>v(w.id),style:{cursor:"pointer",padding:"8px 16px",backgroundColor:c===w.id?"#f0f7ff":"transparent",display:"flex",justifyContent:"space-between"},children:[e.jsxs("div",{style:{display:"flex",gap:12},children:[e.jsx(Fe,{type:"secondary",style:{width:20},children:a.indexOf(w)+1}),e.jsx(Fe,{children:w.text})]}),e.jsx(J.FontAwesomeIcon,{icon:Y.faChevronRight,style:{fontSize:10,color:"#bfbfbf"}})]})})})]}),e.jsxs("div",{style:{width:340,padding:"24px",display:"flex",flexDirection:"column",borderLeft:"1px solid #f0f0f0"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:15},children:[e.jsx(Fe,{strong:!0,children:"Dependency type"}),e.jsx(sr,{style:{fontSize:"12px"},onClick:()=>L(!P),children:P?"Hide preview":"Show preview"})]}),O(),e.jsx(nr,{style:{fontSize:"13px",color:"#262626",marginBottom:20,minHeight:48,lineHeight:"1.6"},children:re()}),e.jsx(l.Radio.Group,{value:h,onChange:w=>b(w.target.value),style:{width:"100%",marginBottom:20},children:e.jsxs(l.Space,{direction:"vertical",style:{width:"100%"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",width:"100%"},children:[e.jsx(l.Radio,{value:"e2s",children:"Finish to Start"}),e.jsx(Fe,{type:"secondary",children:"FS"})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",width:"100%"},children:[e.jsx(l.Radio,{value:"e2e",children:"Finish to Finish"}),e.jsx(Fe,{type:"secondary",children:"FF"})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",width:"100%"},children:[e.jsx(l.Radio,{value:"s2s",children:"Start to Start"}),e.jsx(Fe,{type:"secondary",children:"SS"})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",width:"100%"},children:[e.jsx(l.Radio,{value:"s2e",children:"Start to Finish"}),e.jsx(Fe,{type:"secondary",children:"SF"})]})]})}),e.jsxs("div",{style:{display:"flex",gap:"10px",marginBottom:20},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx(Fe,{type:"secondary",style:{fontSize:"11px",display:"block",marginBottom:4},children:"Delay type"}),e.jsxs(l.Select,{value:k,onChange:w=>x(w),style:{width:"100%"},size:"large",children:[e.jsx($t,{value:"lag",children:"Lag by"}),e.jsx($t,{value:"lead",children:"Lead by"})]})]}),e.jsxs("div",{style:{width:100},children:[e.jsx(Fe,{type:"secondary",style:{fontSize:"11px",display:"block",marginBottom:4},children:"Days"}),e.jsx(l.Space.Compact,{style:{width:"100%"},children:e.jsx(l.InputNumber,{min:0,value:p,onChange:w=>u(w||0),style:{width:"100%"},placeholder:"0",size:"large"})})]})]}),e.jsx(l.Button,{type:"primary",block:!0,onClick:A,disabled:!c,style:{marginTop:"auto",backgroundColor:"#5c67f2",height:44,borderRadius:"6px"},children:"Add"})]})]});return e.jsx(l.Popover,{content:ye,trigger:"click",open:t,onOpenChange:g,placement:"bottomLeft",overlayClassName:"dependency-popover",overlayInnerStyle:{padding:0},children:o})},mt=j.memo(j.forwardRef(({tasks:n,allTasks:a=[],columns:s,selectedTask:o,onTaskClick:t,onTaskContextMenu:g,onTaskUpdate:y,onTaskDragStart:i,onAddTask:c,onAddDependency:v,links:h=[],dropIndicator:b,reorderTask:k,iconConfig:x},p)=>{const u=j.useRef(null);j.useImperativeHandle(p,()=>u.current);const P=(f,M=0)=>{if(!f.parent)return M;const A=n.find(R=>R.id===f.parent);return A?P(A,M+1):M},L=(f,M)=>{if(M.template)return M.template(f);switch(M.name){case"text":const A=P(f);return e.jsxs("div",{className:"gantt-grid-cell-text",style:{paddingLeft:A*14},children:[e.jsx("div",{className:"gantt-row-drag-handle",onMouseDown:O=>{O.preventDefault(),i?.(f.id,O.clientX,O.clientY,"reorder")},children:e.jsx(J.FontAwesomeIcon,{icon:Y.faGripVertical})}),f.type==="project"?e.jsx("span",{className:"gantt-tree-icon",onClick:O=>{O.stopPropagation(),y?.({...f,open:!f.open})},children:e.jsx(J.FontAwesomeIcon,{icon:f.open?Y.faChevronDown:Y.faChevronRight})}):e.jsx("span",{style:{width:16,display:"inline-block"}}),e.jsx("span",{className:"gantt-task-name-text",children:f.text})]});case"start":return fe(f.start,"DD-MM-YYYY");case"end":return fe(f.end,"DD-MM-YYYY");case"duration":return e.jsxs("div",{style:{backgroundColor:"#f6e7db",padding:"4px 12px",borderRadius:"4px",fontWeight:600,color:"#434343",display:"inline-block",minWidth:"70px",textAlign:"center"},children:[f.duration," day",f.duration!==1?"s":""]});case"predecessors":const R=h.filter(O=>O.target===f.id);return e.jsx(ar,{task:f,allTasks:a,links:h,onAddDependency:(O,re,ye,w)=>v?.(O,re,ye,w),children:e.jsx("div",{style:{cursor:"pointer",minHeight:"24px",width:"100%",display:"flex",alignItems:"center",gap:"4px"},children:R.map(O=>{const re=a.find(w=>w.id===O.source),ye=re?a.indexOf(re)+1:0;return e.jsx("span",{style:{fontSize:"11px",backgroundColor:"#e6f7ff",border:"1px solid #91d5ff",color:"#0050b3",padding:"1px 6px",borderRadius:"4px",whiteSpace:"nowrap"},children:tr(O,ye)},O.id)})})});case"add":return e.jsx(l.Button,{type:"primary",size:"small",icon:e.jsx(J.FontAwesomeIcon,{icon:Y.faPlus,style:{fontSize:12}}),onClick:O=>{O.stopPropagation(),c?.(f.id)},title:"Add Subtask",style:{minWidth:"28px",width:"28px",height:"28px",padding:0,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px"}});case"progress":return 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:`${f.progress}%`}})}),e.jsxs("span",{className:"gantt-progress-text",children:[f.progress,"%"]})]});case"index":return e.jsx("span",{style:{color:"#8c8c8c"},children:a.indexOf(f)+1});default:return f[M.name]||""}};return e.jsxs("div",{className:"gantt-grid",ref:u,children:[e.jsx("div",{className:"gantt-grid-header",style:{display:"flex",minWidth:"100%"},children:s.map(f=>e.jsx("div",{className:"gantt-grid-header-cell",style:{width:f.width,minWidth:f.width,justifyContent:f.align==="center"?"center":"flex-start"},children:f.name==="add"?e.jsx("span",{style:{fontSize:11,color:"#64748b",fontWeight:600,whiteSpace:"nowrap"},children:"Add"}):e.jsxs(e.Fragment,{children:[f.label,f.name==="start"&&e.jsx(J.FontAwesomeIcon,{icon:Y.faChevronDown,style:{marginLeft:8,fontSize:10,color:"#64748b"}})]})},f.name))}),e.jsx("div",{className:"gantt-grid-body",children:n.map(f=>{const M=k?.id===f.id,A=k?.descendantIds.includes(f.id);return e.jsxs("div",{className:`gantt-grid-row ${o===f.id?"selected":""} ${M?"dragging-row":""} ${A?"descendant-dragging-row":""} ${b?.taskId===f.id?`drop-target-${b.position}`:""}`,onClick:()=>t(f.id),onContextMenu:R=>g?.(R,f.id),style:{display:"flex",minWidth:"100%"},children:[s.map(R=>{const O=R.name==="add";return e.jsx("div",{className:"gantt-grid-cell",style:{width:R.width,minWidth:R.width,textAlign:R.align||"left",display:"flex",alignItems:"center",justifyContent:O?"center":R.align||"flex-start",visibility:"visible",opacity:1},children:L(f,R)},`${f.id}-${R.name}`)}),b?.taskId===f.id&&e.jsx("div",{className:`gantt-drop-indicator ${b.position}`})]},f.id)})})]})}));mt.displayName="Grid";const Ot=({task:n,position:a,selected:s,dragging:o,onClick:t,onDragStart:g,dragDeltaX:y=0,dragType:i=null,readonly:c=!1})=>{const v=(p,u)=>{c||(p.preventDefault(),p.stopPropagation(),g(p.clientX,p.clientY,u))},h=()=>{const p=["gantt-task-bar"];return n.type==="milestone"&&p.push("milestone"),n.type==="project"&&p.push("project"),s&&p.push("selected"),o&&p.push("dragging"),p.join(" ")},b=()=>{let p=a.left,u=a.width;return o&&i&&(i==="move"?p+=y:i==="resize-left"?(p+=y,u-=y):i==="resize-right"&&(u+=y)),{left:`${p}px`,width:`${Math.max(u,0)}px`,backgroundColor:n.color||void 0}},k=(p=!1)=>e.jsxs(e.Fragment,{children:[!c&&n.type!=="milestone"&&!p&&e.jsx("div",{className:"gantt-task-resize-handle gantt-task-resize-left",onMouseDown:u=>v(u,"resize-left")}),!p&&n.type!=="milestone"&&e.jsx("div",{className:"gantt-task-progress",style:{width:`${n.progress}%`}}),e.jsx("div",{className:"gantt-task-content",children:!p&&n.type!=="milestone"&&e.jsx("span",{className:"gantt-task-text",children:n.text})}),n.type==="milestone"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"gantt-milestone-diamond"}),e.jsx("span",{className:"gantt-milestone-text",children:n.text})]}),!c&&n.type!=="milestone"&&!p&&e.jsx("div",{className:"gantt-task-resize-handle gantt-task-resize-right",onMouseDown:u=>v(u,"resize-right")})]}),x=e.jsxs("div",{className:"gantt-tooltip",children:[e.jsx("div",{className:"gantt-tooltip-title",children:n.text}),e.jsxs("div",{className:"gantt-tooltip-dates",children:[fe(n.start,"MMM D")," - ",fe(n.end,"MMM D")]}),e.jsxs("div",{className:"gantt-tooltip-progress",children:["Progress: ",n.progress,"%"]}),n.owner&&e.jsxs("div",{className:"gantt-tooltip-owner",children:["Owner: ",n.owner]})]});return n.segments&&n.segments.length>0?e.jsx("div",{className:"gantt-task-group",children:n.segments.map((p,u)=>e.jsx(l.Tooltip,{title:x,mouseEnterDelay:.5,children:e.jsx("div",{className:h()+" segment",style:{left:`${a.left+(p.start.getTime()-n.start.getTime())/(n.end.getTime()-n.start.getTime())*a.width}px`,width:`${(p.end.getTime()-p.start.getTime())/(n.end.getTime()-n.start.getTime())*a.width}px`,backgroundColor:n.color||"#ADCFFE"},onClick:t,onMouseDown:P=>v(P,"move"),children:k(!0)})},u))}):e.jsx(l.Tooltip,{title:x,mouseEnterDelay:.5,children:e.jsx("div",{className:h(),style:b(),onClick:t,onMouseDown:p=>v(p,"move"),children:k()})})},or=({links:n,tasks:a,getTaskPosition:s})=>{const o=i=>a.find(c=>c.id===i),t=j.useMemo(()=>{let i=0,c=0;return a.forEach(v=>{try{const h=s(v);h&&typeof h.left=="number"&&typeof h.width=="number"&&(i=Math.max(i,h.left+h.width)),h&&typeof h.top=="number"&&typeof h.height=="number"&&(c=Math.max(c,h.top+h.height))}catch(h){console.warn("Failed to position task for link rendering:",v.id,h)}}),{width:Math.max(i,1e3),height:Math.max(c,100)}},[a,s]),g=i=>{const c=o(i.source),v=o(i.target);if(!c||!v)return"";const h=s(c),b=s(v),k=h.top+h.height/2,x=b.top+b.height/2;let p=0,u=0;switch(i.type){case"e2s":p=h.left+h.width,u=b.left;break;case"s2s":p=h.left,u=b.left;break;case"e2e":p=h.left+h.width,u=b.left+b.width;break;case"s2e":p=h.left,u=b.left+b.width;break}const P=u-p,L=x-k,f=20;if(i.type==="e2s")if(P>=f){const M=p+P/2;return`M ${p},${k} L ${M},${k} L ${M},${x} L ${u},${x}`}else{const M=f/2,A=k+L/2;return`M ${p},${k} L ${p+M},${k} L ${p+M},${A} L ${u-M},${A} L ${u-M},${x} L ${u},${x}`}else if(i.type==="s2s"){const M=Math.min(p,u)-f/2;return`M ${p},${k} L ${M},${k} L ${M},${x} L ${u},${x}`}else if(i.type==="e2e"){const M=Math.max(p,u)+f/2;return`M ${p},${k} L ${M},${k} L ${M},${x} L ${u},${x}`}else if(i.type==="s2e")if(P<=-f){const M=p+P/2;return`M ${p},${k} L ${M},${k} L ${M},${x} L ${u},${x}`}else{const M=f/2,A=k+L/2;return`M ${p},${k} L ${p-M},${k} L ${p-M},${A} L ${u+M},${A} L ${u+M},${x} L ${u},${x}`}return""},y=i=>{const c=o(i.target);if(!c)return"";const v=s(c),h=v.top+v.height/2,b=8,k=6;let x=0,p=!0;return i.type==="e2s"||i.type==="s2s"?(x=v.left,p=!0):(x=v.left+v.width,p=!1),p?`M ${x},${h} L ${x-b},${h-k/2} L ${x-b},${h+k/2} Z`:`M ${x},${h} L ${x+b},${h-k/2} L ${x+b},${h+k/2} Z`};return n.length===0?null:e.jsx("svg",{className:"gantt-links-layer",style:{overflow:"visible",width:t.width,height:t.height,position:"absolute",top:0,left:0,pointerEvents:"none"},children:n.map(i=>{const c=o(i.source),v=o(i.target);if(!c||!v)return null;const h=g(i),b=y(i);return!h||!b?null:e.jsxs("g",{className:"gantt-link",children:[e.jsx("path",{d:h,fill:"none",strokeWidth:"1.5",className:"gantt-link-line"}),e.jsx("path",{d:b,className:"gantt-link-arrow"})]},i.id)})})},ir=(n,a,s=60,o="day",t=1)=>{const[g,y]=j.useState({taskId:null,initialX:0,initialY:0,initialStart:new Date,initialEnd:new Date,type:null,dragDeltaX:0,dragDeltaY:0}),i=j.useCallback((h,b,k,x)=>{const p=n.find(u=>u.id===h);p&&y({taskId:h,initialX:b,initialY:k,initialStart:new Date(p.start),initialEnd:new Date(p.end),type:x,dragDeltaX:0,dragDeltaY:0})},[n]),c=j.useCallback((h,b)=>{if(!g.taskId||!g.type)return null;const k=h-g.initialX,x=b-g.initialY;if(y(M=>({...M,dragDeltaX:k,dragDeltaY:x})),g.type==="reorder")return null;const p=n.find(M=>M.id===g.taskId);if(!p)return null;const u=Math.round(k/s);let P=new Date(g.initialStart),L=new Date(g.initialEnd);switch(g.type){case"move":P=le(g.initialStart,u*t,o),L=le(g.initialEnd,u*t,o);break;case"resize-left":P=le(g.initialStart,u*t,o),P>=L&&(P=le(L,-t,o));break;case"resize-right":L=le(g.initialEnd,u*t,o),L<=P&&(L=le(P,t,o));break}const f=Ze(P,L);return{...p,start:P,end:L,duration:f}},[g,n,s]),v=j.useCallback(h=>{if(h&&a){const{id:b,...k}=h;a(b,k)}y({taskId:null,initialX:0,initialY:0,initialStart:new Date,initialEnd:new Date,type:null,dragDeltaX:0,dragDeltaY:0})},[a]);return{dragState:g,handleDragStart:i,handleDrag:c,handleDragEnd:v}},xt=j.forwardRef(({tasks:n,links:a,range:s,scales:o,config:t,selectedTask:g,onTaskClick:y,onTaskDragStart:i,onTaskDragEnd:c,onTaskUpdate:v,zoomLevel:h,baselines:b},k)=>{const[x,p]=j.useState(n),u=(t.columnWidth||60)*h,P=t.baselines&&b&&b.size>0,{dragState:L,handleDragStart:f,handleDrag:M,handleDragEnd:A}=ir(x,v,u,o[1].unit,o[1].step);j.useEffect(()=>{(n.length!==x.length||n.some((E,N)=>{const $=x[N];return!$||E.id!==$.id||E.start.getTime()!==$.start.getTime()||E.end.getTime()!==$.end.getTime()}))&&p(n)},[n]);const R=j.useCallback(S=>{const E=[];let N=new Date(s.start);for(;N<=s.end;)E.push({date:new Date(N),label:fe(N,S.format||"D")}),N=le(N,S.step,S.unit);return E},[s.start.getTime(),s.end.getTime()]),O=j.useCallback(S=>{const E=o[1],N=s.start.getTime(),K=S.getTime()-N,ee={hour:36e5,day:864e5,week:6048e5,month:2592e6,quarter:7776e6,year:31536e6}[E.unit]||864e5;return K/(ee*E.step)*u},[o,s.start,u]),re=S=>{const E=O(S.start),N=O(S.end);return{left:E,width:Math.max(N-E,0)}},ye=S=>{const E=O(S.start),N=O(S.end);return{left:E,width:Math.max(N-E,0)}},w=S=>{const E=re(S),N=x.findIndex(ee=>ee.id===S.id),$=t.rowHeight||48,K=32,X=($-K)/2;return{left:E.left,width:E.width,top:N*$+X,height:K}},H=j.useRef(null),Q=j.useCallback(S=>{L.taskId&&L.type&&(H.current&&cancelAnimationFrame(H.current),H.current=requestAnimationFrame(()=>{const E=M(S.clientX,S.clientY);E&&p(N=>N.map($=>$.id===E.id?E:$))}))},[L,M]),ne=j.useCallback(()=>{if(L.taskId){const S=x.find(E=>E.id===L.taskId);A(S||null),c()}},[L,x,A,c]),U=o[1],V=j.useMemo(()=>R(U),[R,U]),ce=j.useCallback(()=>{const S=[];let E=-1,N=-1,$=0,K="";return V.forEach(X=>{const ee=X.date.getMonth(),se=X.date.getFullYear(),ge=fe(X.date,"MMM YYYY");ee!==E||se!==N?(E!==-1&&S.push({label:K,width:$}),E=ee,N=se,$=u,K=ge):$+=u}),E!==-1&&S.push({label:K,width:$}),S},[V,u]),de=j.useCallback(()=>{const S=[];let E=-1,N=0,$=-1,K=-1,X="";return V.forEach(ee=>{const ge=ee.date.getDate()<=15?0:1,Ae=ee.date.getMonth(),Ye=ee.date.getFullYear(),$e=fe(ee.date,"MMM"),Le=new Date(Ye,Ae+1,0).getDate(),Ue=ge===0?`${$e} 1 - 15`:`${$e} 16 - ${Le}`;ge!==E||Ae!==$||Ye!==K?(E!==-1&&S.push({label:X,width:N}),E=ge,$=Ae,K=Ye,N=u,X=Ue):N+=u}),E!==-1&&S.push({label:X,width:N}),S},[V,u]),me=j.useMemo(()=>ce(),[ce]),Se=j.useMemo(()=>de(),[de]),oe=j.useMemo(()=>V.length*u,[V.length,u]),Te=j.useMemo(()=>{const S=new Date;return S.setHours(0,0,0,0),S},[]),Ce=j.useMemo(()=>{if(!t.showTodayLine)return null;const S=O(Te);return S>=-u&&S<=oe+u?Math.max(0,Math.min(S,oe)):null},[t.showTodayLine,Te,oe,u,O]),ke=j.useMemo(()=>{if(t.projectStartDate)return Be(t.projectStartDate);if(n.length>0){const S=n.map(E=>E.start.getTime());return Be(new Date(Math.min(...S)))}return null},[t.projectStartDate,n]),Me=j.useMemo(()=>{if(!t.showProjectStartLine||!ke)return null;const S=O(ke);return S>=-u&&S<=oe+u?Math.max(0,Math.min(S,oe)):null},[t.showProjectStartLine,ke,oe,u,O]);return e.jsxs("div",{className:"gantt-timeline-container",ref:k,onMouseMove:Q,onMouseUp:ne,style:{width:oe,position:"relative"},children:[(t.todayLineLabel||t.projectStartLineLabel)&&e.jsxs("div",{style:{position:"absolute",top:"-40px",left:0,right:0,height:"32px",zIndex:100,pointerEvents:"none"},children:[Ce!==null&&t.todayLineLabel&&e.jsx("div",{className:"gantt-today-line-label",style:{position:"absolute",top:"0",left:`${Ce}px`,transform:"translateX(-50%)",backgroundColor:t.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",...t.todayLineLabelStyle},children:t.todayLineLabel}),Me!==null&&t.projectStartLineLabel&&e.jsx("div",{className:"gantt-project-start-line-label",style:{position:"absolute",top:"0",left:`${Me}px`,transform:"translateX(-50%)",backgroundColor:t.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",...t.projectStartLineLabelStyle},children:t.projectStartLineLabel})]}),e.jsxs("div",{className:"gantt-timeline-header",style:{width:oe,minWidth:oe,position:"relative"},children:[e.jsx("div",{className:"gantt-timeline-scale gantt-timeline-scale-month",style:{width:oe},children:me.map((S,E)=>e.jsx("div",{className:"gantt-timeline-cell",style:{width:S.width,minWidth:S.width,maxWidth:S.width,borderRight:E===me.length-1?"none":"var(--wx-gantt-border)"},children:S.label},`top-${E}`))}),e.jsx("div",{className:"gantt-timeline-scale gantt-timeline-scale-range",style:{width:oe},children:Se.map((S,E)=>e.jsx("div",{className:"gantt-timeline-cell",style:{width:S.width,minWidth:S.width,maxWidth:S.width,borderRight:E===Se.length-1?"none":"var(--wx-gantt-border)"},children:S.label},`mid-${E}`))}),e.jsx("div",{className:"gantt-timeline-scale gantt-timeline-scale-day",style:{width:oe},children:V.map((S,E)=>{const N=t.weekends&&ht(S.date),$=t.holidays&&pt(S.date,t.holidays);return e.jsx("div",{className:`gantt-timeline-cell ${N?"weekend":""} ${$?"holiday":""}`,style:{width:u,minWidth:u,maxWidth:u,borderRight:E===V.length-1?"none":"var(--wx-gantt-border)"},children:S.label},`day-${E}`)})})]}),e.jsxs("div",{className:"gantt-timeline-body",style:{width:oe,position:"relative"},children:[Ce!==null&&e.jsx("div",{className:"gantt-today-line",style:{position:"absolute",left:`${Ce}px`,top:0,bottom:0,width:`${t.todayLineWidth||1}px`,backgroundColor:t.todayLineColor||"#ff4d4f",opacity:t.todayLineOpacity!==void 0?t.todayLineOpacity:1,borderLeft:t.todayLineStyle==="dashed"?`${t.todayLineWidth||1}px dashed ${t.todayLineColor||"#ff4d4f"}`:t.todayLineStyle==="dotted"?`${t.todayLineWidth||1}px dotted ${t.todayLineColor||"#ff4d4f"}`:"none",zIndex:6,pointerEvents:"none"}}),Me!==null&&e.jsx("div",{className:"gantt-project-start-line",style:{position:"absolute",left:`${Me}px`,top:0,bottom:0,width:`${t.projectStartLineWidth||1}px`,backgroundColor:t.projectStartLineColor||"#40a9ff",opacity:t.projectStartLineOpacity!==void 0?t.projectStartLineOpacity:1,borderLeft:t.projectStartLineStyle==="dashed"?`${t.projectStartLineWidth||1}px dashed ${t.projectStartLineColor||"#40a9ff"}`:t.projectStartLineStyle==="dotted"?`${t.projectStartLineWidth||1}px dotted ${t.projectStartLineColor||"#40a9ff"}`:"none",zIndex:6,pointerEvents:"none"}}),e.jsx("div",{className:"gantt-timeline-grid",children:V.map((S,E)=>{const N=t.weekends&&ht(S.date),$=t.holidays&&pt(S.date,t.holidays);return e.jsx("div",{className:`gantt-timeline-grid-column ${N?"weekend":""} ${$?"holiday":""}`,style:{width:u,minWidth:u}},E)})}),a.length>0&&e.jsx(or,{links:a,tasks:x,getTaskPosition:w}),e.jsx("div",{className:"gantt-timeline-tasks",style:{width:oe},children:x.map(S=>{const E=re(S),N=P?b?.get(S.id):void 0,$=N?ye(N):void 0;return e.jsxs("div",{className:"gantt-timeline-row",children:[N&&$&&S.type!=="milestone"&&e.jsx("div",{className:"gantt-baseline-bar",style:{left:`${$.left}px`,width:`${$.width}px`},title:`Baseline: ${N.start.toLocaleDateString()} - ${N.end.toLocaleDateString()}`}),e.jsx(Ot,{task:S,position:E,selected:g===S.id,dragging:L.taskId===S.id,dragDeltaX:L.dragDeltaX,dragType:L.type,onClick:()=>y(S.id),onDragStart:(K,X,ee)=>{f(S.id,K,X,ee),i(S.id,K,X)},readonly:t.readonly})]},S.id)})})]})]})});xt.displayName="Timeline";const yt=j.forwardRef((n,a)=>e.jsx("div",{className:"gantt-chart-wrapper",style:{flex:1,minWidth:0},children:e.jsx(xt,{...n,ref:a})}));yt.displayName="Chart";const{Search:lr}=l.Input,Nt=({onFilterChange:n,owners:a=[],uiConfig:s={}})=>{const[o,t]=j.useState({searchText:"",status:"all",priority:"all",owner:""}),g=c=>{const v={...o,...c};t(v),n(v)},y=()=>{const c={searchText:"",status:"all",priority:"all",owner:""};t(c),n(c)},i=o.searchText!==""||o.status!=="all"||o.priority!=="all"||o.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(lr,{placeholder:s.searchPlaceholder||"Search tasks...",value:o.searchText,onChange:c=>g({searchText:c.target.value}),allowClear:!0,className:"gantt-search-antd",style:{width:250}})}),e.jsxs("div",{className:"gantt-filter-right",children:[e.jsx(l.Select,{value:o.status,onChange:c=>g({status:c}),className:"gantt-filter-select-antd",style:{width:140},options:[{value:"all",label:s.statusOptions?.all||"All Status"},{value:"not-started",label:s.statusOptions?.notStarted||"Not Started"},{value:"in-progress",label:s.statusOptions?.inProgress||"In Progress"},{value:"completed",label:s.statusOptions?.completed||"Completed"}]}),e.jsx(l.Select,{value:o.priority,onChange:c=>g({priority:c}),className:"gantt-filter-select-antd",style:{width:130},options:[{value:"all",label:s.priorityFilterOptions?.all||"All Priority"},{value:"low",label:s.priorityFilterOptions?.low||"Low"},{value:"medium",label:s.priorityFilterOptions?.medium||"Medium"},{value:"high",label:s.priorityFilterOptions?.high||"High"}]}),e.jsx(l.Select,{value:o.owner||void 0,onChange:c=>g({owner:c||""}),className:"gantt-filter-select-antd",style:{width:130},placeholder:s.allOwnersText||"All Owners",allowClear:!0,options:[{value:"",label:s.allOwnersText||"All Owners"},...(a||[]).map(c=>({value:c,label:c}))]}),i&&e.jsx(l.Button,{type:"default",danger:!0,icon:e.jsx(J.FontAwesomeIcon,{icon:Y.faTimesCircle}),onClick:y,className:"gantt-filter-clear-antd",children:s.clearFiltersText||"Clear"})]})]})})},At=(n,a)=>n.filter(s=>{if(a.searchText){const o=a.searchText.toLowerCase(),t=s.text.toLowerCase().includes(o),g=s.owner?.toLowerCase().includes(o),y=s.details?.toLowerCase().includes(o);if(!t&&!g&&!y)return!1}if(a.status!=="all"&&(s.progress===0?"not-started":s.progress===100?"completed":"in-progress")!==a.status||a.priority!=="all"&&s.priority!==a.priority||a.owner&&s.owner!==a.owner)return!1;if(a.dateRange){const o=s.start.getTime(),t=a.dateRange.start.getTime(),g=a.dateRange.end.getTime();if(o<t||o>g)return!1}return!0}),Ne=(n,a)=>n?typeof n=="string"?e.jsx(J.FontAwesomeIcon,{icon:a}):n:e.jsx(J.FontAwesomeIcon,{icon:a}),It=({zoomLevel:n,setZoomLevel:a,onExport:s,onFilterChange:o,owners:t,onAddTask:g,uiConfig:y,iconConfig:i={}})=>{const c=y.showZoomButtons!==!1,v=y.showExportButtons!==!1,h=c&&v;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(l.Space,{size:8,children:y.showAddTaskButton!==!1&&e.jsx(l.Button,{type:"primary",icon:Ne(i.addTask,Y.faPlus),onClick:()=>g?.(),children:y.addTaskButtonText||"New Task"})})}),e.jsx("div",{className:"gantt-toolbar-right",children:e.jsxs(l.Space,{size:4,children:[c&&e.jsxs(e.Fragment,{children:[e.jsx(l.Tooltip,{title:y.zoomOutTooltip||"Zoom Out",children:e.jsx(l.Button,{icon:Ne(i.zoomOut,Y.faSearchMinus),onClick:()=>a(Math.max(.5,n-.25))})}),e.jsx(l.Tooltip,{title:y.zoomInTooltip||"Zoom In",children:e.jsx(l.Button,{icon:Ne(i.zoomIn,Y.faSearchPlus),onClick:()=>a(Math.min(2,n+.25))})}),e.jsx(l.Tooltip,{title:y.resetZoomTooltip||"Reset Zoom",children:e.jsx(l.Button,{icon:Ne(i.resetZoom,Y.faRotateLeft),onClick:()=>a(1)})})]}),h&&e.jsx(l.Divider,{type:"vertical",style:{height:24,margin:"0 4px"}}),v&&e.jsxs(e.Fragment,{children:[e.jsx(l.Tooltip,{title:y.exportCSVTooltip||"Export to CSV",children:e.jsx(l.Button,{icon:Ne(i.exportCSV,Y.faFileCsv),onClick:()=>s("csv")})}),e.jsx(l.Tooltip,{title:y.exportExcelTooltip||"Export to Excel",children:e.jsx(l.Button,{icon:Ne(i.exportExcel,Y.faFileExcel),onClick:()=>s("excel")})}),e.jsx(l.Tooltip,{title:y.exportJSONTooltip||"Export to JSON",children:e.jsx(l.Button,{icon:Ne(i.exportJSON,Y.faFileCode),onClick:()=>s("json")})}),e.jsx(l.Tooltip,{title:y.exportPDFTooltip||"Export to PDF",children:e.jsx(l.Button,{icon:Ne(i.exportPDF,Y.faFilePdf),onClick:()=>s("pdf")})})]})]})})]}),y.showFilterSearch!==!1&&e.jsx(Nt,{onFilterChange:o,owners:t,uiConfig:y})]})},{Option:We}=l.Select,{TextArea:cr}=l.Input,_t=({onCreateTask:n,onClose:a,uiConfig:s={},parentId:o,parentTaskName:t})=>{const[g]=l.Form.useForm(),y=i=>{const c=i.start.toDate(),v=new Date(c);v.setDate(v.getDate()+(i.duration||1)),n({text:i.text,start:c,end:v,duration:i.duration||1,progress:i.progress||0,type:i.type,color:typeof i.color=="string"?i.color:i.color?.toHexString?.()||"#4A90E2",owner:i.owner||"",priority:i.priority||"medium",details:i.details||"",parent:o},o),a()};return e.jsx(l.Modal,{title:o?(s.taskCreatorTitle||"Create Subtask")+(t?` for "${t}"`:""):s.taskCreatorTitle||"Create New Task",open:!0,onCancel:a,onOk:()=>g.submit(),okText:s.taskCreatorOkText||"Create Task",cancelText:s.taskCreatorCancelText||"Cancel",width:600,className:"gantt-modal-antd",children:e.jsxs(l.Form,{form:g,layout:"vertical",onFinish:y,initialValues:{type:"task",priority:"medium",start:Lt(),duration:1,progress:0,color:"#4A90E2"},children:[e.jsx(l.Form.Item,{name:"text",label:s.taskNameLabel||"Task Name",rules:[{required:!0,message:s.taskNameRequired||"Please enter task name"}],children:e.jsx(l.Input,{placeholder:s.taskNamePlaceholder||"Enter task name",autoFocus:!0})}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsx(l.Form.Item,{name:"type",label:s.typeLabel||"Type",style:{flex:1},children:e.jsxs(l.Select,{children:[e.jsx(We,{value:"task",children:s.taskTypeOptions?.task||"Task"}),e.jsx(We,{value:"milestone",children:s.taskTypeOptions?.milestone||"Milestone"}),e.jsx(We,{value:"project",children:s.taskTypeOptions?.project||"Project"})]})}),e.jsx(l.Form.Item,{name:"priority",label:s.priorityLabel||"Priority",style:{flex:1},children:e.jsxs(l.Select,{children:[e.jsx(We,{value:"low",children:s.priorityOptions?.low||"Low"}),e.jsx(We,{value:"medium",children:s.priorityOptions?.medium||"Medium"}),e.jsx(We,{value:"high",children:s.priorityOptions?.high||"High"})]})})]}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsx(l.Form.Item,{name:"start",label:s.startDateLabel||"Start Date",style:{flex:1},children:e.jsx(l.DatePicker,{style:{width:"100%"}})}),e.jsx(l.Form.Item,{name:"duration",label:s.durationLabel||"Duration (days)",style:{flex:1},children:e.jsx(l.InputNumber,{min:0,style:{width:"100%"}})})]}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsx(l.Form.Item,{name:"color",label:s.colorLabel||"Color",style:{flex:1},children:e.jsx(l.ColorPicker,{showText:!0})}),e.jsx(l.Form.Item,{name:"progress",label:s.progressLabel||"Progress (%)",style:{flex:1},children:e.jsx(l.InputNumber,{min:0,max:100,style:{width:"100%"}})})]}),e.jsx(l.Form.Item,{name:"owner",label:s.ownerLabel||"Owner",children:e.jsx(l.Input,{placeholder:s.ownerPlaceholder||"Assign to..."})}),e.jsx(l.Form.Item,{name:"details",label:s.detailsLabel||"Details",children:e.jsx(cr,{placeholder:s.detailsPlaceholder||"Add task description...",rows:3})})]})})},{Option:He}=l.Select,{TextArea:dr}=l.Input,{confirm:ur}=l.Modal,Bt=({task:n,onUpdate:a,onDelete:s,onClose:o,uiConfig:t={}})=>{const[g]=l.Form.useForm(),y=c=>{const v=c.start.toDate(),h=new Date(v);h.setDate(h.getDate()+(c.duration||1)),a({...n,text:c.text,start:v,end:h,duration:c.duration||1,progress:c.progress||0,type:c.type,color:typeof c.color=="string"?c.color:c.color?.toHexString?.()||"#4A90E2",owner:c.owner||"",priority:c.priority||"medium",details:c.details||""}),o()},i=()=>{ur({title:t.deleteConfirmTitle?`${t.deleteConfirmTitle}: "${n.text}"?`:`Are you sure you want to delete "${n.text}"?`,icon:e.jsx(J.FontAwesomeIcon,{icon:Y.faExclamationTriangle,style:{color:"#faad14",marginRight:8}}),content:t.deleteConfirmContent||"This action cannot be undone.",okText:t.deleteConfirmOkText||"Yes, Delete",okType:"danger",cancelText:t.deleteConfirmCancelText||"No",onOk(){s(n.id),o()}})};return e.jsx(l.Modal,{title:t.taskEditorTitle||"Edit Task",open:!0,onCancel:o,footer:[e.jsx(l.Button,{danger:!0,onClick:i,style:{float:"left"},children:t.taskEditorDeleteText||"Delete"},"delete"),e.jsx(l.Button,{onClick:o,children:t.taskEditorCancelText||"Cancel"},"cancel"),e.jsx(l.Button,{type:"primary",onClick:()=>g.submit(),children:t.taskEditorSaveText||"Save Changes"},"submit")],width:600,className:"gantt-modal-antd",children:e.jsxs(l.Form,{form:g,layout:"vertical",onFinish:y,initialValues:{text:n.text,type:n.type||"task",priority:n.priority||"medium",start:Lt(n.start),duration:n.duration,progress:n.progress,color:n.color||"#4A90E2",owner:n.owner||"",details:n.details||""},children:[e.jsx(l.Form.Item,{name:"text",label:t.taskNameLabel||"Task Name",rules:[{required:!0,message:t.taskNameRequired||"Please enter task name"}],children:e.jsx(l.Input,{placeholder:t.taskNamePlaceholder||"Enter task name"})}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsx(l.Form.Item,{name:"type",label:t.typeLabel||"Type",style:{flex:1},children:e.jsxs(l.Select,{children:[e.jsx(He,{value:"task",children:t.taskTypeOptions?.task||"Task"}),e.jsx(He,{value:"milestone",children:t.taskTypeOptions?.milestone||"Milestone"}),e.jsx(He,{value:"project",children:t.taskTypeOptions?.project||"Project"})]})}),e.jsx(l.Form.Item,{name:"priority",label:t.priorityLabel||"Priority",style:{flex:1},children:e.jsxs(l.Select,{children:[e.jsx(He,{value:"low",children:t.priorityOptions?.low||"Low"}),e.jsx(He,{value:"medium",children:t.priorityOptions?.medium||"Medium"}),e.jsx(He,{value:"high",children:t.priorityOptions?.high||"High"})]})})]}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsx(l.Form.Item,{name:"start",label:t.startDateLabel||"Start Date",style:{flex:1},children:e.jsx(l.DatePicker,{style:{width:"100%"}})}),e.jsx(l.Form.Item,{name:"duration",label:t.durationLabel||"Duration (days)",style:{flex:1},children:e.jsx(l.InputNumber,{min:0,style:{width:"100%"}})})]}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsx(l.Form.Item,{name:"color",label:t.colorLabel||"Color",style:{flex:1},children:e.jsx(l.ColorPicker,{showText:!0})}),e.jsx(l.Form.Item,{name:"progress",label:t.progressLabel||"Progress (%)",style:{flex:1},children:e.jsx(l.InputNumber,{min:0,max:100,style:{width:"100%"}})})]}),e.jsx(l.Form.Item,{name:"owner",label:t.ownerLabel||"Owner",children:e.jsx(l.Input,{placeholder:t.ownerPlaceholder||"Assign to..."})}),e.jsx(l.Form.Item,{name:"details",label:t.detailsLabel||"Details",children:e.jsx(dr,{placeholder:t.detailsPlaceholder||"Add task description...",rows:3})})]})})},{Title:nt,Text:be,Paragraph:Yt}=l.Typography,{Option:Pe}=l.Select,Rt=({task:n,allTasks:a,links:s,onAddDependency:o,onRemoveDependency:t,onClose:g})=>{const[y,i]=j.useState(""),[c,v]=j.useState("e2s"),[h,b]=j.useState(0),[k,x]=j.useState("day"),[p,u]=j.useState(""),P=s.filter(w=>w.target===n.id),L=s.filter(w=>w.source===n.id),f=a.filter(w=>w.id!==n.id&&w.id!==n.parent),M=()=>{if(y){const w=ft(h,k);o(y,n.id,c,w),i(""),b(0),x("day")}},A=()=>{if(!p.trim())return;const w=er(p.trim());if(!w){alert(`Invalid format. Use: [TaskNumber][Type][+/-][Lag][Unit]
15
+ Example: 3FS+10d`);return}const H=w.taskNumber-1,Q=a[H];if(!Q){alert(`Task ${w.taskNumber} not found`);return}const ne=rr(w.type),U=ft(w.lag,w.lagUnit);o(Q.id,n.id,ne,U),u("")},R=w=>{switch(w){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)"}},O=w=>{switch(w){case"e2s":return"blue";case"s2s":return"green";case"e2e":return"purple";case"s2e":return"orange"}},re=w=>!w||w===0?null:w>0?e.jsxs(l.Tag,{color:"warning",children:["+",w,"d lag"]}):e.jsxs(l.Tag,{color:"processing",children:[w,"d lead"]}),ye=(w,H)=>{const Q=a.find(ne=>ne.id===(H==="source"?w.source:w.target));return e.jsx(l.List.Item,{actions:[e.jsx(l.Button,{type:"text",danger:!0,icon:e.jsx(J.FontAwesomeIcon,{icon:Y.faTrash}),onClick:()=>t(w.id),children:"Remove"})],children:e.jsx(l.List.Item.Meta,{title:e.jsxs(l.Space,{children:[e.jsx(be,{strong:!0,style:{fontFamily:"IBM Plex Sans, sans-serif"},children:Q?.text||(H==="source"?w.source:w.target)}),e.jsx(l.Tag,{color:O(w.type),children:R(w.type)}),re(w.lag)]}),description:e.jsxs(be,{type:"secondary",style:{fontFamily:"IBM Plex Sans, sans-serif",fontSize:"12px"},children:[Q?.owner&&`Owner: ${Q.owner}`,Q?.priority&&` • Priority: ${Q.priority}`]})})})};return e.jsxs(l.Modal,{title:e.jsxs(l.Space,{children:[e.jsx(J.FontAwesomeIcon,{icon:Y.faLink,style:{fontSize:"20px"}}),e.jsx(nt,{level:4,style:{margin:0,fontFamily:"IBM Plex Mono, monospace"},children:"Task Dependencies"})]}),open:!0,onCancel:g,width:900,footer:null,className:"gantt-dependency-modal",styles:{body:{maxHeight:"70vh",overflowY:"auto",fontFamily:"IBM Plex Sans, sans-serif"}},children:[e.jsx(l.Card,{size:"small",style:{marginBottom:24,backgroundColor:"#f5f5f5",borderColor:"#d9d9d9"},children:e.jsxs(l.Space,{direction:"vertical",size:4,children:[e.jsx(be,{strong:!0,style:{fontFamily:"IBM Plex Mono, monospace",fontSize:"16px"},children:n.text}),e.jsxs(be,{type:"secondary",style:{fontFamily:"IBM Plex Sans, sans-serif",fontSize:"13px"},children:[n.start.toLocaleDateString()," → ",n.end.toLocaleDateString(),n.owner&&` • Owner: ${n.owner}`,n.priority&&` • Priority: ${n.priority}`]})]})}),e.jsxs("div",{style:{marginBottom:32},children:[e.jsxs(nt,{level:5,style:{fontFamily:"IBM Plex Mono, monospace",textTransform:"uppercase",letterSpacing:"0.5px",fontSize:"13px",color:"#595959"},children:[e.jsx(J.FontAwesomeIcon,{icon:Y.faArrowDown,style:{marginRight:"8px"}}),"Depends On (Predecessors)"]}),P.length===0?e.jsx(l.Alert,{message:"No dependencies",description:"This task doesn't depend on any other tasks.",type:"info",showIcon:!0,style:{fontFamily:"IBM Plex Sans, sans-serif"}}):e.jsx(l.List,{dataSource:P,renderItem:w=>ye(w,"source"),bordered:!0,style:{fontFamily:"IBM Plex Sans, sans-serif"}})]}),e.jsxs("div",{style:{marginBottom:32},children:[e.jsxs(nt,{level:5,style:{fontFamily:"IBM Plex Mono, monospace",textTransform:"uppercase",letterSpacing:"0.5px",fontSize:"13px",color:"#595959"},children:[e.jsx(J.FontAwesomeIcon,{icon:Y.faArrowUp,style:{marginRight:"8px"}}),"Dependents (Successors)"]}),L.length===0?e.jsx(l.Alert,{message:"No dependent tasks",description:"No other tasks depend on this task.",type:"info",showIcon:!0,style:{fontFamily:"IBM Plex Sans, sans-serif"}}):e.jsx(l.List,{dataSource:L,renderItem:w=>ye(w,"target"),bordered:!0,style:{fontFamily:"IBM Plex Sans, sans-serif"}})]}),e.jsx(l.Divider,{}),e.jsx(l.Card,{title:e.jsxs(nt,{level:5,style:{margin:0,fontFamily:"IBM Plex Mono, monospace",fontSize:"14px"},children:[e.jsx(J.FontAwesomeIcon,{icon:Y.faPlus,style:{marginRight:"8px"}}),"Add New Dependency"]}),style:{marginBottom:24},children:e.jsxs(l.Space,{direction:"vertical",size:"large",style:{width:"100%"},children:[e.jsxs("div",{children:[e.jsx(be,{strong:!0,style:{fontFamily:"IBM Plex Sans, sans-serif",display:"block",marginBottom:8},children:"Quick Add (Keyboard Shortcut):"}),e.jsx(be,{type:"secondary",style:{fontFamily:"IBM Plex Sans, sans-serif",fontSize:"12px",display:"block",marginBottom:8},children:"Format: [TaskNumber][Type][+/-][Lag][Unit] • Example: 3FS+10d, 5SS-2w"}),e.jsxs(l.Space.Compact,{style:{width:"100%"},children:[e.jsx(l.Input,{placeholder:"e.g., 3FS+10d",value:p,onChange:w=>u(w.target.value),onPressEnter:A,size:"large",style:{fontFamily:"IBM Plex Mono, monospace"}}),e.jsx(l.Button,{type:"primary",size:"large",onClick:A,style:{fontFamily:"IBM Plex Sans, sans-serif"},children:"Add"})]})]}),e.jsx(l.Divider,{style:{margin:"8px 0"},children:"OR"}),e.jsxs("div",{children:[e.jsx(be,{strong:!0,style:{fontFamily:"IBM Plex Sans, sans-serif",display:"block",marginBottom:8},children:"Select Task:"}),e.jsx(l.Select,{placeholder:"Choose a task...",value:y||void 0,onChange:i,style:{width:"100%",fontFamily:"IBM Plex Sans, sans-serif"},size:"large",showSearch:!0,filterOption:(w,H)=>String(H?.children||"").toLowerCase().includes(w.toLowerCase()),children:f.map(w=>e.jsx(Pe,{value:w.id,children:w.text},w.id))})]}),e.jsxs("div",{children:[e.jsx(be,{strong:!0,style:{fontFamily:"IBM Plex Sans, sans-serif",display:"block",marginBottom:8},children:"Dependency Type:"}),e.jsxs(l.Select,{value:c,onChange:v,style:{width:"100%",fontFamily:"IBM Plex Sans, sans-serif"},size:"large",children:[e.jsxs(Pe,{value:"e2s",children:[e.jsx(l.Tag,{color:"blue",children:"FS"})," Finish-to-Start"]}),e.jsxs(Pe,{value:"s2s",children:[e.jsx(l.Tag,{color:"green",children:"SS"})," Start-to-Start"]}),e.jsxs(Pe,{value:"e2e",children:[e.jsx(l.Tag,{color:"purple",children:"FF"})," Finish-to-Finish"]}),e.jsxs(Pe,{value:"s2e",children:[e.jsx(l.Tag,{color:"orange",children:"SF"})," Start-to-Finish"]})]})]}),e.jsx("div",{children:e.jsxs(l.Space,{direction:"vertical",size:4,style:{width:"100%"},children:[e.jsx(be,{strong:!0,style:{fontFamily:"IBM Plex Sans, sans-serif"},children:"Lead/Lag Time:"}),e.jsx(be,{type:"secondary",style:{fontFamily:"IBM Plex Sans, sans-serif",fontSize:"12px"},children:"Negative = lead time (overlap), Positive = lag time (delay)"}),e.jsxs(l.Space.Compact,{style:{width:"100%"},children:[e.jsx(l.InputNumber,{value:h,onChange:w=>b(w||0),style:{flex:1,fontFamily:"IBM Plex Sans, sans-serif"},size:"large",placeholder:"0",min:-365,max:365}),e.jsxs(l.Select,{value:k,onChange:x,style:{width:120,fontFamily:"IBM Plex Sans, sans-serif"},size:"large",children:[e.jsx(Pe,{value:"day",children:"Days"}),e.jsx(Pe,{value:"hour",children:"Hours"}),e.jsx(Pe,{value:"week",children:"Weeks"}),e.jsx(Pe,{value:"month",children:"Months"})]})]})]})}),e.jsx(l.Button,{type:"primary",size:"large",icon:e.jsx(J.FontAwesomeIcon,{icon:Y.faPlus}),onClick:M,disabled:!y,block:!0,style:{fontFamily:"IBM Plex Sans, sans-serif",fontWeight:600},children:"Add Dependency"})]})}),e.jsx(l.Alert,{message:e.jsxs(be,{strong:!0,style:{fontFamily:"IBM Plex Mono, monospace"},children:[e.jsx(J.FontAwesomeIcon,{icon:Y.faInfoCircle,style:{marginRight:"8px"}}),"Dependency Types Explained"]}),description:e.jsxs("div",{style:{fontFamily:"IBM Plex Sans, sans-serif"},children:[e.jsxs("ul",{style:{marginBottom:12,paddingLeft:20},children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Finish-to-Start (FS):"})," Successor starts after predecessor finishes"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Start-to-Start (SS):"})," Both tasks start at the same time"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Finish-to-Finish (FF):"})," Both tasks finish at the same time"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Start-to-Finish (SF):"})," Successor finishes when predecessor starts"]})]}),e.jsx(l.Divider,{style:{margin:"12px 0"}}),e.jsx(be,{strong:!0,style:{display:"block",marginBottom:4},children:"Keyboard Shortcuts:"}),e.jsx(Yt,{style:{margin:0,fontSize:"12px"},code:!0,children:"[TaskID][Type]+/-[Days]d"}),e.jsxs(Yt,{style:{margin:0,fontSize:"12px"},children:["Example: ",e.jsx("code",{children:"3FS+10d"})," = Task 3, Finish-to-Start, 10 days lag"]})]}),type:"info",showIcon:!0,icon:e.jsx(J.FontAwesomeIcon,{icon:Y.faInfoCircle}),style:{marginTop:16}})]})},hr=({x:n,y:a,task:s,onEdit:o,onDelete:t,onCopy:g,onDependencies:y,onConvertToMilestone:i,onConvertToTask:c,onConvertToProject:v,onAutoSchedule:h,onClose:b,iconConfig:k})=>{if(!s)return null;const x=[{key:"edit",label:"Edit",icon:e.jsx(J.FontAwesomeIcon,{icon:Y.faEdit}),onClick:()=>{o(),b()}},{key:"copy",label:"Copy",icon:e.jsx(J.FontAwesomeIcon,{icon:Y.faCopy}),onClick:()=>{g(),b()}},{key:"dependencies",label:"Dependencies",icon:e.jsx(J.FontAwesomeIcon,{icon:Y.faLink}),onClick:()=>{y(),b()}},{type:"divider"},{key:"convert",label:"Convert to",type:"submenu",children:[{key:"milestone",label:"Milestone",icon:e.jsx(J.FontAwesomeIcon,{icon:Y.faFlag}),disabled:s.type==="milestone",onClick:()=>{i(),b()}},{key:"task",label:"Task",icon:e.jsx(J.FontAwesomeIcon,{icon:Y.faTasks}),disabled:s.type==="task",onClick:()=>{c(),b()}},{key:"project",label:"Project",icon:e.jsx(J.FontAwesomeIcon,{icon:Y.faFolder}),disabled:s.type==="project",onClick:()=>{v(),b()}}]},{key:"auto-schedule",label:"Auto Schedule",icon:e.jsx(J.FontAwesomeIcon,{icon:Y.faRotateLeft}),onClick:()=>{h?.(),b()}},{type:"divider"},{key:"delete",label:"Delete",icon:e.jsx(J.FontAwesomeIcon,{icon:Y.faTrash}),danger:!0,onClick:()=>{t(),b()}}];return e.jsx("div",{className:"gantt-context-menu",style:{position:"fixed",left:`${n}px`,top:`${a}px`,zIndex:1e4},onClick:p=>p.stopPropagation(),children:e.jsx(l.Menu,{items:x,style:{boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",borderRadius:"6px",border:"1px solid #e0e0e0"}})})},zt=(n,a=[])=>{const[s,o]=j.useState([]),[t,g]=j.useState(-1),[y,i]=j.useState(n),[c,v]=j.useState(a);j.useEffect(()=>{i(n)},[n]),j.useEffect(()=>{v(a)},[a]);const h=j.useCallback((f,M,A)=>{const R={type:f,before:M,after:A,timestamp:Date.now()},O=s.slice(0,t+1);O.push(R),O.length>50?O.shift():g(t+1),o(O)},[s,t]),b=j.useCallback(()=>{if(t<0)return;const f=s[t];i(f.before.tasks),v(f.before.links),g(t-1)},[s,t]),k=j.useCallback(()=>{if(t>=s.length-1)return;const f=s[t+1];i(f.after.tasks),v(f.after.links),g(t+1)},[s,t]),x=t>=0,p=t<s.length-1,u=j.useCallback(f=>{const M={tasks:y,links:c},A=y.map(O=>O.id===f.id?f:O);h("task_update",M,{tasks:A,links:c}),i(A)},[y,c,h]),P=j.useCallback(f=>{const M={tasks:y,links:c},A=[...y,f];h("task_create",M,{tasks:A,links:c}),i(A)},[y,c,h]),L=j.useCallback(f=>{const M={tasks:y,links:c},A=y.filter(re=>re.id!==f),R=c.filter(re=>re.source!==f&&re.target!==f);h("task_delete",M,{tasks:A,links:R}),i(A),v(R)},[y,c,h]);return{tasks:y,links:c,setTasks:i,setLinks:v,undo:b,redo:k,canUndo:x,canRedo:p,updateTask:u,createTask:P,deleteTask:L,saveState:h,history:s}},Wt=(n,a,s={mode:"forward"})=>{const o=new Map,t=new Map;return n.forEach(g=>{o.set(g.id,[]),t.set(g.id,[])}),a.forEach(g=>{g.type==="e2s"&&(o.get(g.target)?.push(g.source),t.get(g.source)?.push(g.target))}),s.mode==="forward"?pr(n,o,s):fr(n,t,s)},pr=(n,a,s)=>{const o=new Map,t=new Set,g=s.projectStart||new Date,y=i=>{if(t.has(i))return;const c=n.find(p=>p.id===i);if(!c)return;const v=a.get(i)||[];v.forEach(p=>y(p));let h=g;v.forEach(p=>{const u=o.get(p);u&&u.end>h&&(h=new Date(u.end))});const b=new Date(h),k=le(b,c.duration,"day"),x={...c,start:b,end:k};o.set(i,x),t.add(i)};return n.forEach(i=>y(i.id)),n.map(i=>o.get(i.id)||i)},fr=(n,a,s)=>{const o=new Map,t=new Set,g=s.projectEnd||new Date(Math.max(...n.map(i=>i.end.getTime()))),y=i=>{if(t.has(i))return;const c=n.find(p=>p.id===i);if(!c)return;const v=a.get(i)||[];v.forEach(p=>y(p));let h=g;v.forEach(p=>{const u=o.get(p);u&&u.start<h&&(h=new Date(u.start))});const b=new Date(h),k=le(b,-c.duration,"day"),x={...c,start:k,end:b};o.set(i,x),t.add(i)};return n.forEach(i=>y(i.id)),n.map(i=>o.get(i.id)||i)},mr=Object.freeze(Object.defineProperty({__proto__:null,autoSchedule:Wt,levelResources:n=>{const a=new Map;n.forEach(o=>{o.owner&&(a.has(o.owner)||a.set(o.owner,[]),a.get(o.owner).push(o))});const s=[...n];return a.forEach((o,t)=>{const g=o.sort((y,i)=>y.start.getTime()-i.start.getTime());for(let y=1;y<g.length;y++){const i=g[y],c=g[y-1];if(i.start<c.end){const v=s.findIndex(h=>h.id===i.id);if(v>=0){const h=new Date(c.end),b=le(h,i.duration,"day");s[v]={...i,start:h,end:b}}}}}),s}},Symbol.toStringTag,{value:"Module"})),gt=n=>{const a=new Map;return n.forEach(s=>{a.set(s.id,{taskId:s.id,start:new Date(s.start),end:new Date(s.end)})}),a},Ht=n=>{const a=["ID","Task Name","Start Date","End Date","Duration","Progress","Type","Owner","Priority"],s=n.map(t=>[t.id,t.text,fe(t.start,"YYYY-MM-DD"),fe(t.end,"YYYY-MM-DD"),t.duration.toString(),`${t.progress}%`,t.type||"task",t.owner||"",t.priority||"medium"]),o=[a.join(","),...s.map(t=>t.map(g=>`"${g}"`).join(","))].join(`
16
+ `);st(o,"gantt-tasks.csv","text/csv")},Ut=n=>{const a=["ID","Task Name","Start Date","End Date","Duration","Progress","Type","Owner","Priority","Details"],s=n.map(t=>[t.id,t.text,fe(t.start,"MM/DD/YYYY"),fe(t.end,"MM/DD/YYYY"),t.duration.toString(),t.progress.toString(),t.type||"task",t.owner||"",t.priority||"medium",t.details||""]),o="\uFEFF"+[a.join(" "),...s.map(t=>t.map(g=>g.replace(/\t/g," ")).join(" "))].join(`
17
+ `);st(o,"gantt-tasks.xls","application/vnd.ms-excel")},Vt=(n,a)=>{const s={tasks:n,links:a,exported:new Date().toISOString(),version:"1.0"},o=JSON.stringify(s,null,2);st(o,"gantt-project.json","application/json")},qt=n=>{const a=`
10
18
  GANTT CHART PROJECT
11
19
  Generated: ${new Date().toLocaleString()}
12
20
 
13
21
  Tasks:
14
- ${t.map((i,a)=>`
15
- ${a+1}. ${i.text}
16
- Start: ${Q(i.start,"MM/DD/YYYY")}
17
- End: ${Q(i.end,"MM/DD/YYYY")}
18
- Duration: ${i.duration} days
19
- Progress: ${i.progress}%
20
- ${i.owner?`Owner: ${i.owner}`:""}
22
+ ${n.map((s,o)=>`
23
+ ${o+1}. ${s.text}
24
+ Start: ${fe(s.start,"MM/DD/YYYY")}
25
+ End: ${fe(s.end,"MM/DD/YYYY")}
26
+ Duration: ${s.duration} days
27
+ Progress: ${s.progress}%
28
+ ${s.owner?`Owner: ${s.owner}`:""}
21
29
  `).join(`
22
30
  `)}
23
- `.trim();De(n,"gantt-report.txt","text/plain"),alert("PDF export is a simplified text version. For full PDF with charts, a PDF library would be needed.")},Pt=(t,n,i="png")=>{if(!document.getElementById(t)){alert("Could not find Gantt chart element to export");return}if(i==="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")},De=(t,n,i)=>{const a=new Blob([t],{type:i}),s=URL.createObjectURL(a);At(s,n),URL.revokeObjectURL(s)},At=(t,n)=>{const i=document.createElement("a");i.href=t,i.download=n,document.body.appendChild(i),i.click(),document.body.removeChild(i)},It=Object.freeze(Object.defineProperty({__proto__:null,exportToCSV:st,exportToExcel:rt,exportToImage:Pt,exportToJSON:it,exportToPDF:ot,importFromJSON:t=>new Promise((n,i)=>{const a=new FileReader;a.onload=s=>{try{const p=s.target?.result,c=JSON.parse(p),l=c.tasks.map(x=>({...x,start:new Date(x.start),end:new Date(x.end)}));n({tasks:l,links:c.links||[]})}catch{i(new Error("Invalid JSON file"))}},a.onerror=()=>i(new Error("Failed to read file")),a.readAsText(t)})},Symbol.toStringTag,{value:"Module"})),Lt=[{name:"index",label:"",width:40,align:"center"},{name:"text",label:"Name",width:300,align:"left",resize:!0},{name:"predecessors",label:"Depends on",width:120,align:"left"},{name:"duration",label:"Duration",width:100,align:"left"},{name:"start",label:"Start",width:120,align:"left"},{name:"add",label:"",width:40,align:"center"}],Yt=[{unit:"month",step:1,format:"MMM"},{unit:"day",step:1,format:"D"}],at=({tasks:t=[],links:n=[],config:i={},onTaskUpdate:a,onTaskCreate:s,onTaskDelete:p,onLinkCreate:c,onLinkDelete:l})=>{const x=Array.isArray(t)?t:[],T=Array.isArray(n)?n:[],{tasks:d,links:g,setTasks:D,setLinks:u,undo:h,redo:j,updateTask:F,createTask:f,deleteTask:b,saveState:E}=et(x,T),[$,L]=S.useState(d),[B,X]=S.useState(null),[ee,m]=S.useState(null),[O,W]=S.useState(!1),[U,_]=S.useState(!1),[oe,te]=S.useState(null),[se,Z]=S.useState(null),[z,v]=S.useState(null),[C,r]=S.useState(null),[y,k]=S.useState(null),[P,V]=S.useState(1),[de,R]=S.useState(new Map),[K,ue]=S.useState(!1),[me]=S.useState(i.theme||"light"),[Me,Le]=S.useState({searchText:"",status:"all",priority:"all",owner:""}),Ot=S.useRef(null),Ce=S.useRef(null),_t=S.useRef(null),he={columns:Lt,scales:Yt,readonly:!1,editable:!0,taskHeight:28,rowHeight:44,scaleHeight:28,columnWidth:80,minColumnWidth:60,autoSchedule:!1,criticalPath:!1,baselines:K,weekends:!0,holidays:[],theme:me,locale:"en",...i};S.useEffect(()=>{const w=Je(d,Me);L((Y=>{const J=[],re=H=>{if(!H)return!1;const ae=Y.find(G=>G.id===H);return ae&&!ae.open&&ae.type==="project"?!0:re(ae?.parent)};return Y.forEach(H=>{re(H.parent)||J.push(H)}),J})(w))},[d,Me]);const Rt=S.useMemo(()=>{if(!d||!Array.isArray(d))return[];try{return Array.from(new Set(d.map(w=>w?.owner).filter(Boolean)))}catch(w){return console.warn("Error extracting owners:",w),[]}},[d]),zt=(()=>{const w=$.length>0?$:d;if(w.length===0){const H=new Date;return{start:Se(q(H,-30,"day")),end:Se(q(H,60,"day"))}}const M=w.map(H=>H.start.getTime()),Y=w.map(H=>H.end.getTime()),J=new Date(Math.min(...M)),re=new Date(Math.max(...Y));return{start:Se(q(J,-7,"day")),end:Se(re)}})(),Ht=w=>{X(w)},Wt=(w,M)=>{if(he.readonly)return;w.preventDefault();const Y=d.find(J=>J.id===M);Y&&k({x:w.clientX,y:w.clientY,task:Y})},Ut=()=>{if(!y?.task)return;const w=y.task,M={...w,id:`task-${Date.now()}`,text:`${w.text} (Copy)`,start:q(w.start,7,"day"),end:q(w.end,7,"day")};f(M),s&&s(M)},Ye=w=>{if(!y?.task)return;const M={...y.task,type:w};F(M),a&&a(M)},Gt=(w,M,Y,J)=>{if(!he.readonly)if(J==="reorder"){const re=$.findIndex(G=>G.id===w),H=(G,ie)=>{let ye=[];return ie.filter(ce=>ce.parent===G).forEach(ce=>{ye.push(ce.id),ye=[...ye,...H(ce.id,ie)]}),ye},ae=H(w,d);v({id:w,initialIndex:re,currentY:Y,descendantIds:ae}),document.body.classList.add("gantt-dragging")}else Z(w)},Vt=()=>{if(z&&C){const w=d.find(Y=>Y.id===z.id),M=d.find(Y=>Y.id===C.taskId);if(w&&M&&w.id!==M.id){const Y=[w.id,...z.descendantIds];if(!Y.includes(M.id)){const J=[...d];let re=C.position==="inside"?M.id:M.parent;const H=J.findIndex(ne=>ne.id===w.id);H!==-1&&(J[H]={...J[H],parent:re});const ae=J.filter(ne=>Y.includes(ne.id)),G=J.filter(ne=>!Y.includes(ne.id));let ie=G.findIndex(ne=>ne.id===M.id);if(C.position==="inside"){const ne=G.filter(ce=>ce.parent===M.id);ne.length>0?ie=G.findIndex(ce=>ce.id===ne[ne.length-1].id)+1:ie++}else if(C.position==="below"){const ne=(Oe,ut)=>{let ke=[];return ut.filter(Fe=>Fe.parent===Oe).forEach(Fe=>{ke.push(Fe.id),ke=[...ke,...ne(Fe.id,ut)]}),ke},ce=ne(M.id,G);ce.length>0?ie=G.findIndex(Oe=>Oe.id===ce[ce.length-1])+1:ie++}const ye={tasks:[...d],links:[...g]};G.splice(ie,0,...ae),D(G),E("task_update",ye,{tasks:G,links:g})}}}Z(null),v(null),r(null),document.body.classList.remove("gantt-dragging")},Jt=w=>{if(z){const M=he.rowHeight||44,Y=Ce.current?.querySelector(".gantt-grid-body");if(!Y)return;const J=Y.getBoundingClientRect(),re=w.clientY-J.top;let H=Math.floor(re/M);H=Math.max(0,Math.min(H,$.length-1));const ae=$[H];if(ae){const G=re-H*M;let ie="above";ae.type==="project"?G<M*.3?ie="above":G>M*.7?ie="below":ie="inside":ie=G<M/2?"above":"below",ae.id!==z.id?r({taskId:ae.id,position:ie}):r(null)}v(G=>G?{...G,currentY:w.clientY}:null)}},lt=()=>{z&&Vt()},Xt=w=>{const M={...w,id:`task-${Date.now()}`};f(M),s&&s(M)},Be=w=>{F(w),a&&a(w)},ct=w=>{b(w),p&&p(w)},dt=(w,M,Y,J)=>{const re={id:`link-${Date.now()}`,source:w,target:M,type:Y,lag:J};u([...g,re]),c&&c(re)},qt=w=>{const M=g.filter(Y=>Y.id!==w);u(M),l&&l(w)},Zt=()=>{if(!K&&de.size===0){const w=nt(d);R(w),ue(!0)}else ue(!K)};return S.useEffect(()=>{const w=M=>{(M.ctrlKey||M.metaKey)&&(M.key==="z"&&!M.shiftKey?(M.preventDefault(),h()):(M.key==="y"||M.key==="z"&&M.shiftKey)&&(M.preventDefault(),j()))};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[h,j]),e.jsxs("div",{className:`gantt-page-wrapper theme-${me}`,children:[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:"Iris Gantt"})})}),e.jsxs("div",{className:`gantt-container theme-${he.theme}`,children:[e.jsx(Xe,{zoomLevel:P,setZoomLevel:V,onBaselineToggle:Zt,showBaselines:K,onExport:w=>{w==="csv"&&st(d),w==="excel"&&rt(d),w==="json"&&it(d,g),w==="pdf"&&ot(d)},onFilterChange:w=>Le(w),owners:Rt||[],onAddTask:()=>W(!0)}),e.jsxs("div",{className:"gantt-layout",ref:_t,onMouseMove:Jt,onMouseUp:lt,onMouseLeave:lt,children:[e.jsx(Pe,{ref:Ce,tasks:$,columns:he.columns||[],selectedTask:B,onTaskClick:Ht,onTaskContextMenu:Wt,onTaskUpdate:Be,onTaskDragStart:Gt,onAddTask:()=>W(!0),onAddDependency:dt,onDependencyClick:w=>{const M=d.find(Y=>Y.id===w);M&&(te(M),_(!0))},links:g,allTasks:d,dropIndicator:C,reorderTask:z}),e.jsx(Ie,{ref:Ot,tasks:$,links:g,range:zt,scales:he.scales,config:he,selectedTask:B,draggedTask:se,onTaskClick:()=>{},onTaskDragStart:()=>{},onTaskDragEnd:()=>{},onTaskUpdate:(w,M)=>{const Y=d.find(J=>J.id===w);Y&&Be({...Y,...M})},zoomLevel:P,baselines:K?de:new Map})]}),O&&e.jsx(qe,{onCreateTask:Xt,onClose:()=>W(!1)}),ee&&e.jsx(Ze,{task:ee,onUpdate:Be,onDelete:ct,onClose:()=>m(null)}),U&&oe&&e.jsx(Qe,{task:oe,allTasks:d,links:g,onAddDependency:dt,onRemoveDependency:qt,onClose:()=>{_(!1),te(null)}}),y&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"gantt-context-menu-overlay",onClick:()=>k(null),onContextMenu:w=>{w.preventDefault(),k(null)}}),e.jsx(Ft,{x:y.x,y:y.y,task:y.task,onEdit:()=>{y.task&&m(y.task)},onDelete:()=>{y.task&&ct(y.task.id)},onCopy:Ut,onDependencies:()=>{y.task&&(te(y.task),_(!0))},onConvertToMilestone:()=>Ye("milestone"),onConvertToTask:()=>Ye("task"),onConvertToProject:()=>Ye("project"),onClose:()=>k(null),onAutoSchedule:()=>{const w=tt(d,g,{mode:"forward"});D(w),k(null)}})]}),z&&e.jsx("div",{className:"gantt-grid-row ghost-row",style:{height:he.rowHeight,top:z.currentY-(he.rowHeight||48)/2,left:Ce.current?.getBoundingClientRect().left,position:"fixed",pointerEvents:"none",opacity:.8,zIndex:9999,width:Ce.current?.offsetWidth,backgroundColor:"#ffffff",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",border:"1px solid #2196F3",display:"flex"},children:he.columns?.map(w=>e.jsx("div",{className:"gantt-grid-cell",style:{width:w.width,textAlign:w.align||"left"},children:(()=>{const M=d.find(Y=>Y.id===z.id);if(!M)return null;if(w.template)return w.template(M);switch(w.name){case"text":return e.jsxs("div",{className:"gantt-grid-cell-text",children:[e.jsx(I.FontAwesomeIcon,{icon:A.faGripVertical,style:{marginRight:8,color:"#adb5bd"}}),e.jsxs("span",{className:"gantt-task-name-text",children:[M.text,z.descendantIds.length>0&&e.jsxs("span",{children:[" +",z.descendantIds.length," subtasks"]})]})]});case"start":return Q(M.start,"DD MMM YYYY");case"duration":return`${M.duration}`;default:return M[w.name]||""}})()},`ghost-${w.name}`))})]})]})},Bt=Object.freeze(Object.defineProperty({__proto__:null,calculateCriticalPath:(t,n)=>{const i=new Set,a=new Map,s=new Map,p=new Map;t.forEach(u=>{s.set(u.id,[]),p.set(u.id,[])}),n.forEach(u=>{u.type==="e2s"&&(s.get(u.source)?.push(u.target),p.get(u.target)?.push(u.source))});const c=new Map,l=new Map,x=(u,h=new Set)=>{if(h.has(u))return;h.add(u);const j=t.find(f=>f.id===u);if(!j)return;const F=p.get(u)||[];if(F.length===0)c.set(u,0),l.set(u,j.duration);else{let f=0;F.forEach(b=>{x(b,h);const E=l.get(b)||0;f=Math.max(f,E)}),c.set(u,f),l.set(u,f+j.duration)}};t.forEach(u=>x(u.id));const T=new Map,d=new Map,g=Math.max(...Array.from(l.values())),D=(u,h=new Set)=>{if(h.has(u))return;h.add(u);const j=t.find(f=>f.id===u);if(!j)return;const F=s.get(u)||[];if(F.length===0)d.set(u,g),T.set(u,g-j.duration);else{let f=1/0;F.forEach(b=>{D(b,h);const E=T.get(b)||0;f=Math.min(f,E)}),d.set(u,f),T.set(u,f-j.duration)}};return t.forEach(u=>D(u.id)),t.forEach(u=>{const h=c.get(u.id)||0,F=(T.get(u.id)||0)-h;a.set(u.id,F),Math.abs(F)<.01&&i.add(u.id)}),{criticalTasks:i,taskFloats:a,projectDuration:g}},getTaskFloat:(t,n)=>n.taskFloats.get(t)||0,isCriticalTask:(t,n)=>n.criticalTasks.has(t)},Symbol.toStringTag,{value:"Module"}));N.AutoScheduler=Nt,N.Chart=Ie,N.CriticalPath=Bt,N.DependencyEditor=Qe,N.ExportUtils=It,N.FilterSearch=Ve,N.Gantt=at,N.Grid=Pe,N.TaskBar=Ge,N.TaskCreator=qe,N.TaskEditor=Ze,N.Timeline=Ae,N.Toolbar=Xe,N.addToDate=q,N.applyFilters=Je,N.calculateDuration=xt,N.createBaseline=nt,N.default=at,N.formatDate=Q,N.getDaysBetween=be,N.getEndOfDay=mt,N.getHoursBetween=We,N.getStartOfDay=Se,N.isHoliday=$e,N.isWeekend=Ee,N.useUndoRedo=et,Object.defineProperties(N,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
31
+ `.trim();st(a,"gantt-report.txt","text/plain"),alert("PDF export is a simplified text version. For full PDF with charts, a PDF library would be needed.")},xr=(n,a,s="png")=>{if(!document.getElementById(n)){alert("Could not find Gantt chart element to export");return}if(s==="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=(n,a,s)=>{const o=new Blob([n],{type:s}),t=URL.createObjectURL(o);yr(t,a),URL.revokeObjectURL(t)},yr=(n,a)=>{const s=document.createElement("a");s.href=n,s.download=a,document.body.appendChild(s),s.click(),document.body.removeChild(s)},gr=Object.freeze(Object.defineProperty({__proto__:null,exportToCSV:Ht,exportToExcel:Ut,exportToImage:xr,exportToJSON:Vt,exportToPDF:qt,importFromJSON:n=>new Promise((a,s)=>{const o=new FileReader;o.onload=t=>{try{const g=t.target?.result,y=JSON.parse(g),i=y.tasks.map(c=>({...c,start:new Date(c.start),end:new Date(c.end)}));a({tasks:i,links:y.links||[]})}catch{s(new Error("Invalid JSON file"))}},o.onerror=()=>s(new Error("Failed to read file")),o.readAsText(n)})},Symbol.toStringTag,{value:"Module"})),wr=n=>[{name:"index",label:"",width:40,align:"center"},{name:"text",label:n?.columnLabels?.name||"Name",width:250,align:"left",resize:!0},{name:"predecessors",label:n?.columnLabels?.dependsOn||"Depends on",width:120,align:"left"},{name:"duration",label:n?.columnLabels?.duration||"Duration",width:110,align:"left"},{name:"start",label:n?.columnLabels?.start||"Start",width:130,align:"left"},{name:"add",label:"",width:50,align:"center"}],jr=[{unit:"month",step:1,format:"MMM"},{unit:"day",step:1,format:"D"}],br={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"},vr=({tasks:n=[],links:a=[],config:s={},uiConfig:o={},styleConfig:t={},iconConfig:g={},onTaskUpdate:y,onTaskCreate:i,onTaskDelete:c,onLinkCreate:v,onLinkDelete:h})=>{const b={...br,...o},k=j.useMemo(()=>{const d={};return t.primary&&(d["--wx-gantt-primary"]=t.primary),t.primarySelected&&(d["--wx-gantt-primary-selected"]=t.primarySelected),t.success&&(d["--wx-gantt-success"]=t.success),t.warning&&(d["--wx-gantt-warning"]=t.warning),t.danger&&(d["--wx-gantt-danger"]=t.danger),t.background&&(d["--wx-gantt-background"]=t.background),t.backgroundAlt&&(d["--wx-gantt-background-alt"]=t.backgroundAlt),t.backgroundHover&&(d["--wx-gantt-background-hover"]=t.backgroundHover),t.selectColor&&(d["--wx-gantt-select-color"]=t.selectColor),t.taskColor&&(d["--wx-gantt-task-color"]=t.taskColor),t.taskFillColor&&(d["--wx-gantt-task-fill-color"]=t.taskFillColor),t.projectColor&&(d["--wx-gantt-project-color"]=t.projectColor),t.milestoneColor&&(d["--wx-gantt-milestone-color"]=t.milestoneColor),t.fontColor&&(d["--wx-gantt-font-color"]=t.fontColor),t.fontColorAlt&&(d["--wx-gantt-font-color-alt"]=t.fontColorAlt),t.iconColor&&(d["--wx-gantt-icon-color"]=t.iconColor),t.borderColor&&(d["--wx-gantt-border-color"]=t.borderColor),t.fontFamily&&(d["--wx-gantt-font-family"]=t.fontFamily),t.fontMono&&(d["--wx-gantt-font-mono"]=t.fontMono),t.fontSize&&(d["--wx-gantt-font-size"]=t.fontSize),t.fontWeight&&(d["--wx-gantt-font-weight"]=String(t.fontWeight)),t.lineHeight&&(d["--wx-gantt-line-height"]=String(t.lineHeight)),t.spacingXS&&(d["--gantt-spacing-xs"]=t.spacingXS),t.spacingSM&&(d["--gantt-spacing-sm"]=t.spacingSM),t.spacingMD&&(d["--gantt-spacing-md"]=t.spacingMD),t.spacingLG&&(d["--gantt-spacing-lg"]=t.spacingLG),t.customCSSVariables&&Object.entries(t.customCSSVariables).forEach(([T,C])=>{d[T.startsWith("--")?T:`--${T}`]=C}),d},[t]),x=Array.isArray(n)?n:[],p=Array.isArray(a)?a:[],{tasks:u,links:P,setTasks:L,setLinks:f,undo:M,redo:A,updateTask:R,createTask:O,deleteTask:re,saveState:ye}=zt(x,p),[w,H]=j.useState(u),[Q,ne]=j.useState(null),[U,V]=j.useState(null),[ce,de]=j.useState(!1),[me,Se]=j.useState(void 0),[oe,Te]=j.useState(void 0),[Ce,ke]=j.useState(!1),[Me,S]=j.useState(null),[E,N]=j.useState(null),[$,K]=j.useState(null),[X,ee]=j.useState(null),[se,ge]=j.useState(null),[Ae,Ye]=j.useState(1),[$e,Le]=j.useState(()=>x.length>0?gt(x):new Map),Ue=!0,[Qe]=j.useState(s.theme||"light"),[Re,wt]=j.useState({searchText:"",status:"all",priority:"all",owner:""}),at=j.useRef(null),Oe=j.useRef(null),jt=j.useRef(null),Ie=j.useRef(!1),De=j.useRef(null),we={columns:s.columns||wr(o),scales:jr,readonly:!1,editable:!0,taskHeight:28,rowHeight:44,scaleHeight:28,columnWidth:80,minColumnWidth:60,autoSchedule:!1,criticalPath:!1,baselines:!0,weekends:!0,holidays:[],theme:Qe,locale:"en",showTodayLine:s.showTodayLine!==!1,todayLineColor:s.todayLineColor||"#ff4d4f",todayLineLabel:s.todayLineLabel,todayLineWidth:s.todayLineWidth||1,todayLineStyle:s.todayLineStyle||"solid",todayLineOpacity:s.todayLineOpacity!==void 0?s.todayLineOpacity:1,todayLineLabelStyle:s.todayLineLabelStyle,showProjectStartLine:s.showProjectStartLine!==!1,projectStartDate:s.projectStartDate,projectStartLineColor:s.projectStartLineColor||"#40a9ff",projectStartLineLabel:s.projectStartLineLabel,projectStartLineWidth:s.projectStartLineWidth||1,projectStartLineStyle:s.projectStartLineStyle||"solid",projectStartLineOpacity:s.projectStartLineOpacity!==void 0?s.projectStartLineOpacity:1,projectStartLineLabelStyle:s.projectStartLineLabelStyle,...s};j.useEffect(()=>{const d=At(u,Re);H((C=>{const G=[],ue=q=>{if(!q)return!1;const he=C.find(Z=>Z.id===q);return he&&!he.open&&he.type==="project"?!0:ue(he?.parent)};return C.forEach(q=>{ue(q.parent)||G.push(q)}),G})(d))},[u,Re]);const ot=j.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]),it=(()=>{const d=w.length>0?w:u;if(d.length===0){const q=new Date;return{start:Be(le(q,-30,"day")),end:Be(le(q,60,"day"))}}const T=d.map(q=>q.start.getTime()),C=d.map(q=>q.end.getTime()),G=new Date(Math.min(...T)),ue=new Date(Math.max(...C));return{start:Be(le(G,-7,"day")),end:Be(ue)}})(),lt=d=>{ne(d)},bt=(d,T)=>{if(we.readonly)return;d.preventDefault();const C=u.find(G=>G.id===T);C&&ge({x:d.clientX,y:d.clientY,task:C})},vt=()=>{if(!se?.task)return;const d=se.task,T={...d,id:`task-${Date.now()}`,text:`${d.text} (Copy)`,start:le(d.start,7,"day"),end:le(d.end,7,"day")};O(T),i&&i(T)},et=d=>{if(!se?.task)return;const T={...se.task,type:d};R(T),y&&y(T)},St=(d,T,C,G)=>{if(!we.readonly)if(G==="reorder"){const ue=w.findIndex(Z=>Z.id===d),q=(Z,pe)=>{let _e=[];return pe.filter(r=>r.parent===Z).forEach(r=>{_e.push(r.id),_e=[..._e,...q(r.id,pe)]}),_e},he=q(d,u);K({id:d,initialIndex:ue,currentY:C,descendantIds:he}),document.body.classList.add("gantt-dragging")}else N(d)},Tt=()=>{if($&&X){const d=u.find(C=>C.id===$.id),T=u.find(C=>C.id===X.taskId);if(d&&T&&d.id!==T.id){const C=[d.id,...$.descendantIds];if(!C.includes(T.id)){const G=[...u];let ue=X.position==="inside"?T.id:T.parent;const q=G.findIndex(ie=>ie.id===d.id);q!==-1&&(G[q]={...G[q],parent:ue});const he=G.filter(ie=>C.includes(ie.id)),Z=G.filter(ie=>!C.includes(ie.id));let pe=Z.findIndex(ie=>ie.id===T.id);if(X.position==="inside"){const ie=Z.filter(r=>r.parent===T.id);ie.length>0?pe=Z.findIndex(r=>r.id===ie[ie.length-1].id)+1:pe++}else if(X.position==="below"){const ie=(m,D)=>{let F=[];return D.filter(z=>z.parent===m).forEach(z=>{F.push(z.id),F=[...F,...ie(z.id,D)]}),F},r=ie(T.id,Z);r.length>0?pe=Z.findIndex(m=>m.id===r[r.length-1])+1:pe++}const _e={tasks:[...u],links:[...P]};Z.splice(pe,0,...he),L(Z),ye("task_update",_e,{tasks:Z,links:P})}}}N(null),K(null),ee(null),document.body.classList.remove("gantt-dragging")},tt=j.useRef(null),Dt=j.useCallback(d=>{$&&(tt.current&&cancelAnimationFrame(tt.current),tt.current=requestAnimationFrame(()=>{const T=we.rowHeight||44,C=Oe.current?.querySelector(".gantt-grid-body");if(!C)return;const G=C.getBoundingClientRect(),ue=d.clientY-G.top;let q=Math.floor(ue/T);q=Math.max(0,Math.min(q,w.length-1));const he=w[q];if(he){const Z=ue-q*T;let pe="above";he.type==="project"?Z<T*.3?pe="above":Z>T*.7?pe="below":pe="inside":pe=Z<T/2?"above":"below",he.id!==$.id?ee({taskId:he.id,position:pe}):ee(null)}K(Z=>Z?{...Z,currentY:d.clientY}:null)}))},[$,w,we.rowHeight]),Ve=()=>{$&&Tt()},ct=(d,T)=>{const C={...d,id:`task-${Date.now()}`,parent:T};O(C),i&&i(C)},Ee=d=>{R(d),y&&y(d)},qe=d=>{re(d),c&&c(d)},Je=(d,T,C,G)=>{const ue={id:`link-${Date.now()}`,source:d,target:T,type:C,lag:G};f([...P,ue]),v&&v(ue)},dt=d=>{const T=P.filter(C=>C.id!==d);f(T),h&&h(d)};j.useEffect(()=>{if(u.length>0){const d=gt(u);Le(d)}else Le(new Map)},[u]),j.useEffect(()=>{const d=T=>{(T.ctrlKey||T.metaKey)&&(T.key==="z"&&!T.shiftKey?(T.preventDefault(),M()):(T.key==="y"||T.key==="z"&&T.shiftKey)&&(T.preventDefault(),A()))};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[M,A]),j.useEffect(()=>{const d=Oe.current?.querySelector(".gantt-grid-body"),T=at.current?.querySelector(".gantt-timeline-body");if(!d||!T)return;const C=()=>{Ie.current||(Ie.current=!0,T.scrollTop=d.scrollTop,De.current&&clearTimeout(De.current),De.current=window.setTimeout(()=>{Ie.current=!1},150))},G=()=>{Ie.current||(Ie.current=!0,d.scrollTop=T.scrollTop,De.current&&clearTimeout(De.current),De.current=window.setTimeout(()=>{Ie.current=!1},150))};return d.addEventListener("scroll",C,{passive:!0}),T.addEventListener("scroll",G,{passive:!0}),()=>{d.removeEventListener("scroll",C),T.removeEventListener("scroll",G),De.current&&clearTimeout(De.current)}},[w]);const kt={height:s.containerHeight||"100%",minHeight:s.containerMinHeight||"400px"},ut=s.gridWidth?{"--gantt-grid-width":s.gridWidth}:{};return e.jsxs("div",{className:`gantt-page-wrapper theme-${Qe}`,style:{...kt,...k},children:[b.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:b.headerTitle})})}),e.jsxs("div",{className:`gantt-container theme-${we.theme}`,style:ut,children:[e.jsx(It,{zoomLevel:Ae,setZoomLevel:Ye,onBaselineToggle:()=>{},showBaselines:Ue,onExport:d=>{d==="csv"&&Ht(u),d==="excel"&&Ut(u),d==="json"&&Vt(u,P),d==="pdf"&&qt(u)},onFilterChange:d=>wt(d),owners:ot||[],onAddTask:d=>{if(d){const T=u.find(C=>C.id===d);Se(d),Te(T?.text)}else Se(void 0),Te(void 0);de(!0)},uiConfig:b,iconConfig:g}),e.jsxs("div",{className:"gantt-layout",ref:jt,onMouseMove:Dt,onMouseUp:Ve,onMouseLeave:Ve,children:[e.jsx(mt,{ref:Oe,tasks:w,columns:we.columns||[],selectedTask:Q,onTaskClick:lt,onTaskContextMenu:bt,onTaskUpdate:Ee,onTaskDragStart:St,onAddTask:d=>{if(d){const T=u.find(C=>C.id===d);Se(d),Te(T?.text)}else Se(void 0),Te(void 0);de(!0)},onAddDependency:Je,onDependencyClick:d=>{const T=u.find(C=>C.id===d);T&&(S(T),ke(!0))},links:P,allTasks:u,dropIndicator:X,reorderTask:$,iconConfig:g}),e.jsx(yt,{ref:at,tasks:w,links:P,range:it,scales:we.scales,config:we,selectedTask:Q,draggedTask:E,onTaskClick:()=>{},onTaskDragStart:()=>{},onTaskDragEnd:()=>{},onTaskUpdate:(d,T)=>{const C=u.find(G=>G.id===d);C&&Ee({...C,...T})},zoomLevel:Ae,baselines:$e})]}),ce&&e.jsx(_t,{onCreateTask:ct,onClose:()=>{de(!1),Se(void 0),Te(void 0)},uiConfig:b,parentId:me,parentTaskName:oe}),U&&e.jsx(Bt,{task:U,onUpdate:Ee,onDelete:qe,onClose:()=>V(null),uiConfig:b}),Ce&&Me&&e.jsx(Rt,{task:Me,allTasks:u,links:P,onAddDependency:Je,onRemoveDependency:dt,onClose:()=>{ke(!1),S(null)}}),se&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"gantt-context-menu-overlay",onClick:()=>ge(null),onContextMenu:d=>{d.preventDefault(),ge(null)}}),e.jsx(hr,{x:se.x,y:se.y,task:se.task,onEdit:()=>{se.task&&V(se.task)},onDelete:()=>{se.task&&qe(se.task.id)},onCopy:vt,onDependencies:()=>{se.task&&(S(se.task),ke(!0))},onConvertToMilestone:()=>et("milestone"),onConvertToTask:()=>et("task"),onConvertToProject:()=>et("project"),onClose:()=>ge(null),onAutoSchedule:()=>{const d=Wt(u,P,{mode:"forward"});L(d),ge(null)},iconConfig:g})]}),$&&e.jsx("div",{className:"gantt-grid-row ghost-row",style:{height:we.rowHeight,top:$.currentY-(we.rowHeight||48)/2,left:Oe.current?.getBoundingClientRect().left,position:"fixed",pointerEvents:"none",opacity:.8,zIndex:9999,width:Oe.current?.offsetWidth,backgroundColor:"#ffffff",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",border:"1px solid #2196F3",display:"flex"},children:we.columns?.map(d=>e.jsx("div",{className:"gantt-grid-cell",style:{width:d.width,textAlign:d.align||"left"},children:(()=>{const T=u.find(C=>C.id===$.id);if(!T)return null;if(d.template)return d.template(T);switch(d.name){case"text":return e.jsxs("div",{className:"gantt-grid-cell-text",children:[e.jsx(J.FontAwesomeIcon,{icon:Y.faGripVertical,style:{marginRight:8,color:"#adb5bd"}}),e.jsxs("span",{className:"gantt-task-name-text",children:[T.text,$.descendantIds.length>0&&e.jsxs("span",{children:[" +",$.descendantIds.length," subtasks"]})]})]});case"start":return fe(T.start,"DD MMM YYYY");case"duration":return`${T.duration}`;default:return T[d.name]||""}})()},`ghost-${d.name}`))})]})]})},Sr=Object.freeze(Object.defineProperty({__proto__:null,calculateCriticalPath:(n,a)=>{const s=new Set,o=new Map,t=new Map,g=new Map;n.forEach(x=>{t.set(x.id,[]),g.set(x.id,[])}),a.forEach(x=>{x.type==="e2s"&&(t.get(x.source)?.push(x.target),g.get(x.target)?.push(x.source))});const y=new Map,i=new Map,c=(x,p=new Set)=>{if(p.has(x))return;p.add(x);const u=n.find(L=>L.id===x);if(!u)return;const P=g.get(x)||[];if(P.length===0)y.set(x,0),i.set(x,u.duration);else{let L=0;P.forEach(f=>{c(f,p);const M=i.get(f)||0;L=Math.max(L,M)}),y.set(x,L),i.set(x,L+u.duration)}};n.forEach(x=>c(x.id));const v=new Map,h=new Map,b=Math.max(...Array.from(i.values())),k=(x,p=new Set)=>{if(p.has(x))return;p.add(x);const u=n.find(L=>L.id===x);if(!u)return;const P=t.get(x)||[];if(P.length===0)h.set(x,b),v.set(x,b-u.duration);else{let L=1/0;P.forEach(f=>{k(f,p);const M=v.get(f)||0;L=Math.min(L,M)}),h.set(x,L),v.set(x,L-u.duration)}};return n.forEach(x=>k(x.id)),n.forEach(x=>{const p=y.get(x.id)||0,P=(v.get(x.id)||0)-p;o.set(x.id,P),Math.abs(P)<.01&&s.add(x.id)}),{criticalTasks:s,taskFloats:o,projectDuration:b}},getTaskFloat:(n,a)=>a.taskFloats.get(n)||0,isCriticalTask:(n,a)=>a.criticalTasks.has(n)},Symbol.toStringTag,{value:"Module"}));_.AutoScheduler=mr,_.Chart=yt,_.CriticalPath=Sr,_.DependencyEditor=Rt,_.ExportUtils=gr,_.FilterSearch=Nt,_.Gantt=vr,_.Grid=mt,_.TaskBar=Ot,_.TaskCreator=_t,_.TaskEditor=Bt,_.Timeline=xt,_.Toolbar=It,_.addToDate=le,_.applyFilters=At,_.calculateDuration=Qt,_.createBaseline=gt,_.formatDate=fe,_.getDaysBetween=Ze,_.getEndOfDay=Zt,_.getHoursBetween=Ct,_.getStartOfDay=Be,_.isHoliday=pt,_.isWeekend=ht,_.useUndoRedo=zt,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iris-gantt",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "A comprehensive, production-ready Gantt chart component built with React and TypeScript. Easy to install, simple to use.",
5
5
  "keywords": [
6
6
  "gantt",
@@ -31,16 +31,26 @@
31
31
  "require": {
32
32
  "types": "./dist/index.d.ts",
33
33
  "default": "./dist/iris-gantt.umd.cjs"
34
- }
34
+ },
35
+ "types": "./dist/index.d.ts"
35
36
  },
36
37
  "./gantt.css": {
38
+ "import": "./dist/gantt.css",
39
+ "require": "./dist/gantt.css",
40
+ "default": "./dist/gantt.css"
41
+ },
42
+ "./dist/gantt.css": {
43
+ "import": "./dist/gantt.css",
44
+ "require": "./dist/gantt.css",
37
45
  "default": "./dist/gantt.css"
38
46
  }
39
47
  },
40
48
  "files": [
41
49
  "dist",
42
50
  "README.md",
43
- "USAGE.md"
51
+ "USAGE.md",
52
+ "QUICK_START.md",
53
+ "PACKAGE_SETUP.md"
44
54
  ],
45
55
  "scripts": {
46
56
  "dev": "vite",
@@ -53,13 +63,13 @@
53
63
  "build-storybook": "storybook build"
54
64
  },
55
65
  "peerDependencies": {
56
- "react": "^18.3.1",
57
- "react-dom": "^18.3.1",
66
+ "@fortawesome/fontawesome-svg-core": "^7.1.0",
67
+ "@fortawesome/free-solid-svg-icons": "^7.1.0",
68
+ "@fortawesome/react-fontawesome": "^3.1.0",
58
69
  "antd": "^5.29.3",
59
70
  "dayjs": "^1.11.0",
60
- "@fortawesome/react-fontawesome": "^3.1.0",
61
- "@fortawesome/fontawesome-svg-core": "^7.1.0",
62
- "@fortawesome/free-solid-svg-icons": "^7.1.0"
71
+ "react": "^18.3.1",
72
+ "react-dom": "^18.3.1"
63
73
  },
64
74
  "dependencies": {
65
75
  "@ant-design/icons": "^6.1.0",
@@ -77,8 +87,6 @@
77
87
  "@types/node": "^24.10.1",
78
88
  "@types/react": "^18.3.0",
79
89
  "@types/react-dom": "^18.3.0",
80
- "react": "^18.3.1",
81
- "react-dom": "^18.3.1",
82
90
  "@vitejs/plugin-react": "^5.1.1",
83
91
  "@vitest/browser-playwright": "^4.0.17",
84
92
  "@vitest/coverage-v8": "^4.0.17",
@@ -87,6 +95,8 @@
87
95
  "eslint-plugin-react-refresh": "^0.4.24",
88
96
  "globals": "^16.5.0",
89
97
  "playwright": "^1.57.0",
98
+ "react": "^18.3.1",
99
+ "react-dom": "^18.3.1",
90
100
  "storybook": "^10.1.11",
91
101
  "typescript": "~5.9.3",
92
102
  "typescript-eslint": "^8.46.4",