@jaeungkim/gantt-chart 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +60 -101
  3. package/dist/components/GanttBar.d.ts +23 -0
  4. package/dist/components/GanttChartHeader.d.ts +17 -0
  5. package/dist/components/GanttDependencyArrows.d.ts +15 -0
  6. package/dist/components/GanttDragGuides.d.ts +9 -0
  7. package/dist/components/GanttGridSplitter.d.ts +14 -0
  8. package/dist/components/GanttMarkers.d.ts +18 -0
  9. package/dist/components/GanttTaskGrid.d.ts +42 -0
  10. package/dist/components/ScaleSelector.d.ts +11 -0
  11. package/dist/constants/gantt.d.ts +47 -0
  12. package/dist/core/calendar.d.ts +45 -0
  13. package/dist/core/criticalPath.d.ts +67 -0
  14. package/dist/core/dates.d.ts +32 -0
  15. package/dist/core/index.d.ts +16 -0
  16. package/dist/core/scheduling.d.ts +104 -0
  17. package/dist/core/tree.d.ts +42 -0
  18. package/dist/core/types.d.ts +76 -0
  19. package/dist/gantt-chart.css +1 -1
  20. package/dist/hooks/useGanttBarDrag.d.ts +35 -0
  21. package/dist/hooks/useGanttDrawCreate.d.ts +31 -0
  22. package/dist/hooks/useGanttExportApi.d.ts +30 -0
  23. package/dist/hooks/useGanttHistoryApi.d.ts +28 -0
  24. package/dist/hooks/useGanttLinkDrag.d.ts +31 -0
  25. package/dist/hooks/useGanttProgressDrag.d.ts +16 -0
  26. package/dist/hooks/useGanttRowDrag.d.ts +33 -0
  27. package/dist/hooks/useGanttScrollApi.d.ts +63 -0
  28. package/dist/hooks/useGanttSelectors.d.ts +23 -0
  29. package/dist/hooks/useGanttVirtualization.d.ts +32 -0
  30. package/dist/hooks/useResolvedTheme.d.ts +15 -0
  31. package/dist/index.cjs +4 -0
  32. package/dist/index.d.cts +13 -0
  33. package/dist/index.d.ts +13 -51
  34. package/dist/index.js +5819 -0
  35. package/dist/pages/Gantt.d.ts +306 -0
  36. package/dist/stores/context.d.ts +10 -0
  37. package/dist/stores/store.d.ts +118 -0
  38. package/dist/types/gantt.d.ts +283 -0
  39. package/dist/types/task.d.ts +111 -0
  40. package/dist/utils/a11y.d.ts +141 -0
  41. package/dist/utils/arrowPath.d.ts +66 -0
  42. package/dist/utils/dependency.d.ts +42 -0
  43. package/dist/utils/grouping.d.ts +81 -0
  44. package/dist/utils/headerUtils.d.ts +6 -0
  45. package/dist/utils/history.d.ts +56 -0
  46. package/dist/utils/i18n.d.ts +16 -0
  47. package/dist/utils/mutation.d.ts +47 -0
  48. package/dist/utils/pngExport.d.ts +67 -0
  49. package/dist/utils/pointerGesture.d.ts +31 -0
  50. package/dist/utils/rowDrag.d.ts +69 -0
  51. package/dist/utils/timeline.d.ts +161 -0
  52. package/dist/utils/transformData.d.ts +15 -0
  53. package/dist/utils/viewport.d.ts +95 -0
  54. package/package.json +47 -32
  55. package/dist/index.cjs.js +0 -4
  56. package/dist/index.es.js +0 -2394
  57. package/dist/readmeImg.png +0 -0
package/package.json CHANGED
@@ -1,18 +1,24 @@
1
1
  {
2
2
  "name": "@jaeungkim/gantt-chart",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "private": false,
5
5
  "type": "module",
6
- "main": "dist/index.cjs.js",
7
- "module": "dist/index.es.js",
8
- "types": "dist/index.d.ts",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
- "types": "./dist/index.d.ts",
12
- "import": "./dist/index.es.js",
13
- "require": "./dist/index.cjs.js"
11
+ "import": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.cts",
17
+ "default": "./dist/index.cjs"
18
+ }
14
19
  },
15
- "./style.css": "./dist/gantt-chart.css"
20
+ "./style.css": "./dist/gantt-chart.css",
21
+ "./package.json": "./package.json"
16
22
  },
17
23
  "files": [
18
24
  "dist",
@@ -30,48 +36,57 @@
30
36
  "license": "MIT",
31
37
  "repository": {
32
38
  "type": "git",
33
- "url": "https://github.com/jaeungkim/gantt-chart.git"
39
+ "url": "git+https://github.com/jaeungkim/gantt-chart.git"
34
40
  },
35
- "homepage": "https://github.com/jaeungkim/gantt-chart#readme",
41
+ "homepage": "https://jaeungkim.com/gantt-chart",
36
42
  "bugs": {
37
43
  "url": "https://github.com/jaeungkim/gantt-chart/issues"
38
44
  },
39
45
  "scripts": {
40
46
  "dev": "vite",
41
- "build": "vite build",
47
+ "build": "vite build && node -e \"require('fs').copyFileSync('dist/index.d.ts','dist/index.d.cts')\"",
42
48
  "preview": "vite preview",
43
49
  "lint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
44
50
  "lint:fix": "eslint --fix \"src/**/*.{js,jsx,ts,tsx}\"",
45
- "type-check": "tsc --noEmit"
51
+ "type-check": "tsc --noEmit",
52
+ "test": "vitest run"
46
53
  },
47
54
  "peerDependencies": {
48
55
  "react": "^18.0.0 || ^19.0.0",
49
56
  "react-dom": "^18.0.0 || ^19.0.0"
50
57
  },
51
58
  "dependencies": {
52
- "@tanstack/react-virtual": "^3.13.6",
53
- "dayjs": "^1.11.13",
54
- "zustand": "^5.0.3"
59
+ "@tanstack/react-virtual": "^3.14.10",
60
+ "dayjs": "^1.11.23",
61
+ "zustand": "^5.0.15"
55
62
  },
56
63
  "devDependencies": {
57
- "@eslint/js": "^9.21.0",
58
- "@types/node": "^22.13.7",
59
- "@types/react": "^19.0.10",
60
- "@types/react-dom": "^19.0.4",
61
- "@vitejs/plugin-react": "^4.3.4",
62
- "eslint": "^9.21.0",
64
+ "@eslint/js": "^9.39.5",
65
+ "@types/node": "^22.20.1",
66
+ "@types/react": "^19.2.18",
67
+ "@types/react-dom": "^19.2.5",
68
+ "@vitejs/plugin-react": "^4.7.0",
69
+ "agentation": "^3.0.2",
70
+ "eslint": "^9.39.5",
63
71
  "eslint-plugin-react": "^7.37.5",
64
- "eslint-plugin-react-hooks": "^5.1.0",
65
- "eslint-plugin-react-refresh": "^0.4.19",
72
+ "eslint-plugin-react-hooks": "^7.1.1",
73
+ "eslint-plugin-react-refresh": "^0.5.5",
66
74
  "globals": "^15.15.0",
67
- "react": "^19.1.1",
68
- "react-dom": "^19.1.1",
69
- "typescript": "~5.7.2",
70
- "typescript-eslint": "^8.24.1",
71
- "vite": "^6.2.3",
72
- "vite-plugin-dts": "^4.5.4",
73
- "vite-plugin-svgr": "^4.3.0",
74
- "vite-tsconfig-paths": "^5.1.4"
75
+ "react": "^19.2.8",
76
+ "react-dom": "^19.2.8",
77
+ "typescript": "~5.7.3",
78
+ "typescript-eslint": "^8.69.0",
79
+ "vite": "^6.4.3",
80
+ "vite-plugin-dts": "^5.1.0",
81
+ "vite-tsconfig-paths": "^6.1.1",
82
+ "vitest": "^4.1.11"
75
83
  },
76
- "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
84
+ "packageManager": "pnpm@10.30.3",
85
+ "pnpm": {
86
+ "overrides": {
87
+ "@rushstack/node-core-library>ajv": ">=8.18.0",
88
+ "@microsoft/api-extractor>lodash": ">=4.18.0",
89
+ "@microsoft/api-extractor>minimatch": ">=10.2.3"
90
+ }
91
+ }
77
92
  }
package/dist/index.cjs.js DELETED
@@ -1,4 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),j=require("react"),Xt=require("react-dom");function Zt(s){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const n in s)if(n!=="default"){const e=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(a,n,e.get?e:{enumerable:!0,get:()=>s[n]})}}return a.default=s,Object.freeze(a)}const $t=Zt(j),vt=38,Jt=5,K={day:{labelUnit:"day",tickUnit:"hour",unitPerTick:1,dragStepUnit:"hour",dragStepAmount:1,basePxPerDragStep:32,formatTickLabel:s=>s.format("hh"),formatHeaderLabel:s=>s.format("MMM D")},week:{labelUnit:"month",tickUnit:"day",unitPerTick:1,dragStepUnit:"hour",dragStepAmount:6,basePxPerDragStep:54,formatTickLabel:s=>s.format("D"),formatHeaderLabel:s=>s.format("MMM")},month:{labelUnit:"month",tickUnit:"day",unitPerTick:1,dragStepUnit:"day",dragStepAmount:1,basePxPerDragStep:32,formatTickLabel:s=>s.format("D"),formatHeaderLabel:s=>s.format("MMM YYYY")},year:{labelUnit:"month",tickUnit:"month",unitPerTick:1,dragStepUnit:"day",dragStepAmount:7,basePxPerDragStep:28,formatTickLabel:s=>s.format("D"),formatHeaderLabel:s=>s.format("MMM YYYY")}},yt=s=>{let a;const n=new Set,e=(c,d)=>{const f=typeof c=="function"?c(a):c;if(!Object.is(f,a)){const h=a;a=d??(typeof f!="object"||f===null)?f:Object.assign({},a,f),n.forEach(y=>y(a,h))}},r=()=>a,i={setState:e,getState:r,getInitialState:()=>u,subscribe:c=>(n.add(c),()=>n.delete(c))},u=a=s(e,r,i);return i},Kt=(s=>s?yt(s):yt),Qt=s=>s;function te(s,a=Qt){const n=j.useSyncExternalStore(s.subscribe,j.useCallback(()=>a(s.getState()),[s,a]),j.useCallback(()=>a(s.getInitialState()),[s,a]));return j.useDebugValue(n),n}const ee=s=>{const a=Kt(s),n=e=>te(a,e);return Object.assign(n,a),n},ne=(s=>ee);function Vt(s,a){let n;try{n=s()}catch{return}return{getItem:r=>{var t;const o=u=>u===null?null:JSON.parse(u,void 0),i=(t=n.getItem(r))!=null?t:null;return i instanceof Promise?i.then(o):o(i)},setItem:(r,t)=>n.setItem(r,JSON.stringify(t,void 0)),removeItem:r=>n.removeItem(r)}}const St=s=>a=>{try{const n=s(a);return n instanceof Promise?n:{then(e){return St(e)(n)},catch(e){return this}}}catch(n){return{then(e){return this},catch(e){return St(e)(n)}}}},re=(s,a)=>(n,e,r)=>{let t={storage:Vt(()=>localStorage),partialize:l=>l,version:0,merge:(l,v)=>({...v,...l}),...a},o=!1;const i=new Set,u=new Set;let c=t.storage;if(!c)return s((...l)=>{console.warn(`[zustand persist middleware] Unable to update item '${t.name}', the given storage is currently unavailable.`),n(...l)},e,r);const d=()=>{const l=t.partialize({...e()});return c.setItem(t.name,{state:l,version:t.version})},f=r.setState;r.setState=(l,v)=>(f(l,v),d());const h=s((...l)=>(n(...l),d()),e,r);r.getInitialState=()=>h;let y;const S=()=>{var l,v;if(!c)return;o=!1,i.forEach(D=>{var x;return D((x=e())!=null?x:h)});const p=((v=t.onRehydrateStorage)==null?void 0:v.call(t,(l=e())!=null?l:h))||void 0;return St(c.getItem.bind(c))(t.name).then(D=>{if(D)if(typeof D.version=="number"&&D.version!==t.version){if(t.migrate){const x=t.migrate(D.state,D.version);return x instanceof Promise?x.then(z=>[!0,z]):[!0,x]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,D.state];return[!1,void 0]}).then(D=>{var x;const[z,R]=D;if(y=t.merge(R,(x=e())!=null?x:h),n(y,!0),z)return d()}).then(()=>{p==null||p(y,void 0),y=e(),o=!0,u.forEach(D=>D(y))}).catch(D=>{p==null||p(void 0,D)})};return r.persist={setOptions:l=>{t={...t,...l},l.storage&&(c=l.storage)},clearStorage:()=>{c==null||c.removeItem(t.name)},getOptions:()=>t,rehydrate:()=>S(),hasHydrated:()=>o,onHydrate:l=>(i.add(l),()=>{i.delete(l)}),onFinishHydration:l=>(u.add(l),()=>{u.delete(l)})},t.skipHydration||S(),y||h},se=re,q=ne()(se((s,a)=>({rawTasks:[],transformedTasks:[],bottomRowCells:[],selectedScale:"month",currentTask:null,dragOffsets:{},setCurrentTask:n=>s({currentTask:n}),setSelectedScale:n=>s({selectedScale:n}),setRawTasks:n=>s({rawTasks:n}),setBottomRowCells:n=>s({bottomRowCells:n}),setTransformedTasks:n=>s({transformedTasks:n}),setDragOffset:(n,e)=>s(r=>({dragOffsets:{...r.dragOffsets,[n]:e}})),clearDragOffset:n=>s(e=>{const{[n]:r,...t}=e.dragOffsets;return{dragOffsets:t}}),getCurrentDragOffset:n=>a().dragOffsets[n]||null,getTotalWidth:()=>a().bottomRowCells.reduce((e,r)=>e+r.widthPx,0)}),{name:"gantt-storage",storage:Vt(()=>sessionStorage),partialize:s=>({selectedScale:s.selectedScale})}));function B(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var st={exports:{}},ie=st.exports,xt;function oe(){return xt||(xt=1,(function(s,a){(function(n,e){s.exports=e()})(ie,(function(){var n=1e3,e=6e4,r=36e5,t="millisecond",o="second",i="minute",u="hour",c="day",d="week",f="month",h="quarter",y="year",S="date",l="Invalid Date",v=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,p=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,D={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(E){var O=["th","st","nd","rd"],b=E%100;return"["+E+(O[(b-20)%10]||O[b]||O[0])+"]"}},x=function(E,O,b){var I=String(E);return!I||I.length>=O?E:""+Array(O+1-I.length).join(b)+E},z={s:x,z:function(E){var O=-E.utcOffset(),b=Math.abs(O),I=Math.floor(b/60),M=b%60;return(O<=0?"+":"-")+x(I,2,"0")+":"+x(M,2,"0")},m:function E(O,b){if(O.date()<b.date())return-E(b,O);var I=12*(b.year()-O.year())+(b.month()-O.month()),M=O.clone().add(I,f),C=b-M<0,L=O.clone().add(I+(C?-1:1),f);return+(-(I+(b-M)/(C?M-L:L-M))||0)},a:function(E){return E<0?Math.ceil(E)||0:Math.floor(E)},p:function(E){return{M:f,y,w:d,d:c,D:S,h:u,m:i,s:o,ms:t,Q:h}[E]||String(E||"").toLowerCase().replace(/s$/,"")},u:function(E){return E===void 0}},R="en",k={};k[R]=D;var w="$isDayjsObject",$=function(E){return E instanceof W||!(!E||!E[w])},g=function E(O,b,I){var M;if(!O)return R;if(typeof O=="string"){var C=O.toLowerCase();k[C]&&(M=C),b&&(k[C]=b,M=C);var L=O.split("-");if(!M&&L.length>1)return E(L[0])}else{var _=O.name;k[_]=O,M=_}return!I&&M&&(R=M),M||!I&&R},m=function(E,O){if($(E))return E.clone();var b=typeof O=="object"?O:{};return b.date=E,b.args=arguments,new W(b)},T=z;T.l=g,T.i=$,T.w=function(E,O){return m(E,{locale:O.$L,utc:O.$u,x:O.$x,$offset:O.$offset})};var W=(function(){function E(b){this.$L=g(b.locale,null,!0),this.parse(b),this.$x=this.$x||b.x||{},this[w]=!0}var O=E.prototype;return O.parse=function(b){this.$d=(function(I){var M=I.date,C=I.utc;if(M===null)return new Date(NaN);if(T.u(M))return new Date;if(M instanceof Date)return new Date(M);if(typeof M=="string"&&!/Z$/i.test(M)){var L=M.match(v);if(L){var _=L[2]-1||0,A=(L[7]||"0").substring(0,3);return C?new Date(Date.UTC(L[1],_,L[3]||1,L[4]||0,L[5]||0,L[6]||0,A)):new Date(L[1],_,L[3]||1,L[4]||0,L[5]||0,L[6]||0,A)}}return new Date(M)})(b),this.init()},O.init=function(){var b=this.$d;this.$y=b.getFullYear(),this.$M=b.getMonth(),this.$D=b.getDate(),this.$W=b.getDay(),this.$H=b.getHours(),this.$m=b.getMinutes(),this.$s=b.getSeconds(),this.$ms=b.getMilliseconds()},O.$utils=function(){return T},O.isValid=function(){return this.$d.toString()!==l},O.isSame=function(b,I){var M=m(b);return this.startOf(I)<=M&&M<=this.endOf(I)},O.isAfter=function(b,I){return m(b)<this.startOf(I)},O.isBefore=function(b,I){return this.endOf(I)<m(b)},O.$g=function(b,I,M){return T.u(b)?this[I]:this.set(M,b)},O.unix=function(){return Math.floor(this.valueOf()/1e3)},O.valueOf=function(){return this.$d.getTime()},O.startOf=function(b,I){var M=this,C=!!T.u(I)||I,L=T.p(b),_=function(Z,U){var G=T.w(M.$u?Date.UTC(M.$y,U,Z):new Date(M.$y,U,Z),M);return C?G:G.endOf(c)},A=function(Z,U){return T.w(M.toDate()[Z].apply(M.toDate("s"),(C?[0,0,0,0]:[23,59,59,999]).slice(U)),M)},F=this.$W,Y=this.$M,V=this.$D,Q="set"+(this.$u?"UTC":"");switch(L){case y:return C?_(1,0):_(31,11);case f:return C?_(1,Y):_(0,Y+1);case d:var X=this.$locale().weekStart||0,et=(F<X?F+7:F)-X;return _(C?V-et:V+(6-et),Y);case c:case S:return A(Q+"Hours",0);case u:return A(Q+"Minutes",1);case i:return A(Q+"Seconds",2);case o:return A(Q+"Milliseconds",3);default:return this.clone()}},O.endOf=function(b){return this.startOf(b,!1)},O.$set=function(b,I){var M,C=T.p(b),L="set"+(this.$u?"UTC":""),_=(M={},M[c]=L+"Date",M[S]=L+"Date",M[f]=L+"Month",M[y]=L+"FullYear",M[u]=L+"Hours",M[i]=L+"Minutes",M[o]=L+"Seconds",M[t]=L+"Milliseconds",M)[C],A=C===c?this.$D+(I-this.$W):I;if(C===f||C===y){var F=this.clone().set(S,1);F.$d[_](A),F.init(),this.$d=F.set(S,Math.min(this.$D,F.daysInMonth())).$d}else _&&this.$d[_](A);return this.init(),this},O.set=function(b,I){return this.clone().$set(b,I)},O.get=function(b){return this[T.p(b)]()},O.add=function(b,I){var M,C=this;b=Number(b);var L=T.p(I),_=function(Y){var V=m(C);return T.w(V.date(V.date()+Math.round(Y*b)),C)};if(L===f)return this.set(f,this.$M+b);if(L===y)return this.set(y,this.$y+b);if(L===c)return _(1);if(L===d)return _(7);var A=(M={},M[i]=e,M[u]=r,M[o]=n,M)[L]||1,F=this.$d.getTime()+b*A;return T.w(F,this)},O.subtract=function(b,I){return this.add(-1*b,I)},O.format=function(b){var I=this,M=this.$locale();if(!this.isValid())return M.invalidDate||l;var C=b||"YYYY-MM-DDTHH:mm:ssZ",L=T.z(this),_=this.$H,A=this.$m,F=this.$M,Y=M.weekdays,V=M.months,Q=M.meridiem,X=function(U,G,nt,rt){return U&&(U[G]||U(I,C))||nt[G].slice(0,rt)},et=function(U){return T.s(_%12||12,U,"0")},Z=Q||function(U,G,nt){var rt=U<12?"AM":"PM";return nt?rt.toLowerCase():rt};return C.replace(p,(function(U,G){return G||(function(nt){switch(nt){case"YY":return String(I.$y).slice(-2);case"YYYY":return T.s(I.$y,4,"0");case"M":return F+1;case"MM":return T.s(F+1,2,"0");case"MMM":return X(M.monthsShort,F,V,3);case"MMMM":return X(V,F);case"D":return I.$D;case"DD":return T.s(I.$D,2,"0");case"d":return String(I.$W);case"dd":return X(M.weekdaysMin,I.$W,Y,2);case"ddd":return X(M.weekdaysShort,I.$W,Y,3);case"dddd":return Y[I.$W];case"H":return String(_);case"HH":return T.s(_,2,"0");case"h":return et(1);case"hh":return et(2);case"a":return Z(_,A,!0);case"A":return Z(_,A,!1);case"m":return String(A);case"mm":return T.s(A,2,"0");case"s":return String(I.$s);case"ss":return T.s(I.$s,2,"0");case"SSS":return T.s(I.$ms,3,"0");case"Z":return L}return null})(U)||L.replace(":","")}))},O.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},O.diff=function(b,I,M){var C,L=this,_=T.p(I),A=m(b),F=(A.utcOffset()-this.utcOffset())*e,Y=this-A,V=function(){return T.m(L,A)};switch(_){case y:C=V()/12;break;case f:C=V();break;case h:C=V()/3;break;case d:C=(Y-F)/6048e5;break;case c:C=(Y-F)/864e5;break;case u:C=Y/r;break;case i:C=Y/e;break;case o:C=Y/n;break;default:C=Y}return M?C:T.a(C)},O.daysInMonth=function(){return this.endOf(f).$D},O.$locale=function(){return k[this.$L]},O.locale=function(b,I){if(!b)return this.$L;var M=this.clone(),C=g(b,I,!0);return C&&(M.$L=C),M},O.clone=function(){return T.w(this.$d,this)},O.toDate=function(){return new Date(this.valueOf())},O.toJSON=function(){return this.isValid()?this.toISOString():null},O.toISOString=function(){return this.$d.toISOString()},O.toString=function(){return this.$d.toUTCString()},E})(),H=W.prototype;return m.prototype=H,[["$ms",t],["$s",o],["$m",i],["$H",u],["$W",c],["$M",f],["$y",y],["$D",S]].forEach((function(E){H[E[1]]=function(O){return this.$g(O,E[0],E[1])}})),m.extend=function(E,O){return E.$i||(E(O,W,m),E.$i=!0),m},m.locale=g,m.isDayjs=$,m.unix=function(E){return m(1e3*E)},m.en=k[R],m.Ls=k,m.p={},m}))})(st)),st.exports}var ae=oe();const N=B(ae);var it={exports:{}},ue=it.exports,bt;function ce(){return bt||(bt=1,(function(s,a){(function(n,e){s.exports=e()})(ue,(function(){var n,e,r=1e3,t=6e4,o=36e5,i=864e5,u=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,c=31536e6,d=2628e6,f=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,h={years:c,months:d,days:i,hours:o,minutes:t,seconds:r,milliseconds:1,weeks:6048e5},y=function(k){return k instanceof z},S=function(k,w,$){return new z(k,$,w.$l)},l=function(k){return e.p(k)+"s"},v=function(k){return k<0},p=function(k){return v(k)?Math.ceil(k):Math.floor(k)},D=function(k){return Math.abs(k)},x=function(k,w){return k?v(k)?{negative:!0,format:""+D(k)+w}:{negative:!1,format:""+k+w}:{negative:!1,format:""}},z=(function(){function k($,g,m){var T=this;if(this.$d={},this.$l=m,$===void 0&&(this.$ms=0,this.parseFromMilliseconds()),g)return S($*h[l(g)],this);if(typeof $=="number")return this.$ms=$,this.parseFromMilliseconds(),this;if(typeof $=="object")return Object.keys($).forEach((function(E){T.$d[l(E)]=$[E]})),this.calMilliseconds(),this;if(typeof $=="string"){var W=$.match(f);if(W){var H=W.slice(2).map((function(E){return E!=null?Number(E):0}));return this.$d.years=H[0],this.$d.months=H[1],this.$d.weeks=H[2],this.$d.days=H[3],this.$d.hours=H[4],this.$d.minutes=H[5],this.$d.seconds=H[6],this.calMilliseconds(),this}}return this}var w=k.prototype;return w.calMilliseconds=function(){var $=this;this.$ms=Object.keys(this.$d).reduce((function(g,m){return g+($.$d[m]||0)*h[m]}),0)},w.parseFromMilliseconds=function(){var $=this.$ms;this.$d.years=p($/c),$%=c,this.$d.months=p($/d),$%=d,this.$d.days=p($/i),$%=i,this.$d.hours=p($/o),$%=o,this.$d.minutes=p($/t),$%=t,this.$d.seconds=p($/r),$%=r,this.$d.milliseconds=$},w.toISOString=function(){var $=x(this.$d.years,"Y"),g=x(this.$d.months,"M"),m=+this.$d.days||0;this.$d.weeks&&(m+=7*this.$d.weeks);var T=x(m,"D"),W=x(this.$d.hours,"H"),H=x(this.$d.minutes,"M"),E=this.$d.seconds||0;this.$d.milliseconds&&(E+=this.$d.milliseconds/1e3,E=Math.round(1e3*E)/1e3);var O=x(E,"S"),b=$.negative||g.negative||T.negative||W.negative||H.negative||O.negative,I=W.format||H.format||O.format?"T":"",M=(b?"-":"")+"P"+$.format+g.format+T.format+I+W.format+H.format+O.format;return M==="P"||M==="-P"?"P0D":M},w.toJSON=function(){return this.toISOString()},w.format=function($){var g=$||"YYYY-MM-DDTHH:mm:ss",m={Y:this.$d.years,YY:e.s(this.$d.years,2,"0"),YYYY:e.s(this.$d.years,4,"0"),M:this.$d.months,MM:e.s(this.$d.months,2,"0"),D:this.$d.days,DD:e.s(this.$d.days,2,"0"),H:this.$d.hours,HH:e.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:e.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:e.s(this.$d.seconds,2,"0"),SSS:e.s(this.$d.milliseconds,3,"0")};return g.replace(u,(function(T,W){return W||String(m[T])}))},w.as=function($){return this.$ms/h[l($)]},w.get=function($){var g=this.$ms,m=l($);return m==="milliseconds"?g%=1e3:g=m==="weeks"?p(g/h[m]):this.$d[m],g||0},w.add=function($,g,m){var T;return T=g?$*h[l(g)]:y($)?$.$ms:S($,this).$ms,S(this.$ms+T*(m?-1:1),this)},w.subtract=function($,g){return this.add($,g,!0)},w.locale=function($){var g=this.clone();return g.$l=$,g},w.clone=function(){return S(this.$ms,this)},w.humanize=function($){return n().add(this.$ms,"ms").locale(this.$l).fromNow(!$)},w.valueOf=function(){return this.asMilliseconds()},w.milliseconds=function(){return this.get("milliseconds")},w.asMilliseconds=function(){return this.as("milliseconds")},w.seconds=function(){return this.get("seconds")},w.asSeconds=function(){return this.as("seconds")},w.minutes=function(){return this.get("minutes")},w.asMinutes=function(){return this.as("minutes")},w.hours=function(){return this.get("hours")},w.asHours=function(){return this.as("hours")},w.days=function(){return this.get("days")},w.asDays=function(){return this.as("days")},w.weeks=function(){return this.get("weeks")},w.asWeeks=function(){return this.as("weeks")},w.months=function(){return this.get("months")},w.asMonths=function(){return this.as("months")},w.years=function(){return this.get("years")},w.asYears=function(){return this.as("years")},k})(),R=function(k,w,$){return k.add(w.years()*$,"y").add(w.months()*$,"M").add(w.days()*$,"d").add(w.hours()*$,"h").add(w.minutes()*$,"m").add(w.seconds()*$,"s").add(w.milliseconds()*$,"ms")};return function(k,w,$){n=$,e=$().$utils(),$.duration=function(T,W){var H=$.locale();return S(T,{$l:H},W)},$.isDuration=y;var g=w.prototype.add,m=w.prototype.subtract;w.prototype.add=function(T,W){return y(T)?R(this,T,1):g.bind(this)(T,W)},w.prototype.subtract=function(T,W){return y(T)?R(this,T,-1):m.bind(this)(T,W)}}}))})(it)),it.exports}var le=ce();const fe=B(le);var ot={exports:{}},de=ot.exports,wt;function he(){return wt||(wt=1,(function(s,a){(function(n,e){s.exports=e()})(de,(function(){return function(n,e,r){e.prototype.isBetween=function(t,o,i,u){var c=r(t),d=r(o),f=(u=u||"()")[0]==="(",h=u[1]===")";return(f?this.isAfter(c,i):!this.isBefore(c,i))&&(h?this.isBefore(d,i):!this.isAfter(d,i))||(f?this.isBefore(c,i):!this.isAfter(c,i))&&(h?this.isAfter(d,i):!this.isBefore(d,i))}}}))})(ot)),ot.exports}var me=he();const ge=B(me);var at={exports:{}},pe=at.exports,Mt;function $e(){return Mt||(Mt=1,(function(s,a){(function(n,e){s.exports=e()})(pe,(function(){var n="day";return function(e,r,t){var o=function(c){return c.add(4-c.isoWeekday(),n)},i=r.prototype;i.isoWeekYear=function(){return o(this).year()},i.isoWeek=function(c){if(!this.$utils().u(c))return this.add(7*(c-this.isoWeek()),n);var d,f,h,y,S=o(this),l=(d=this.isoWeekYear(),f=this.$u,h=(f?t.utc:t)().year(d).startOf("year"),y=4-h.isoWeekday(),h.isoWeekday()>4&&(y+=7),h.add(y,n));return S.diff(l,"week")+1},i.isoWeekday=function(c){return this.$utils().u(c)?this.day()||7:this.day(this.day()%7?c:c-7)};var u=i.startOf;i.startOf=function(c,d){var f=this.$utils(),h=!!f.u(d)||d;return f.p(c)==="isoweek"?h?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):u.bind(this)(c,d)}}}))})(at)),at.exports}var ve=$e();const Se=B(ve);var ut={exports:{}},ye=ut.exports,Dt;function xe(){return Dt||(Dt=1,(function(s,a){(function(n,e){s.exports=e()})(ye,(function(){return function(n,e){e.prototype.isSameOrAfter=function(r,t){return this.isSame(r,t)||this.isAfter(r,t)}}}))})(ut)),ut.exports}var be=xe();const we=B(be);var ct={exports:{}},Me=ct.exports,Ot;function De(){return Ot||(Ot=1,(function(s,a){(function(n,e){s.exports=e()})(Me,(function(){return function(n,e){e.prototype.isSameOrBefore=function(r,t){return this.isSame(r,t)||this.isBefore(r,t)}}}))})(ct)),ct.exports}var Oe=De();const ke=B(Oe);var lt={exports:{}},Te=lt.exports,kt;function Ee(){return kt||(kt=1,(function(s,a){(function(n,e){s.exports=e()})(Te,(function(){return function(n,e,r){e.prototype.isToday=function(){var t="YYYY-MM-DD",o=r();return this.format(t)===o.format(t)}}}))})(lt)),lt.exports}var Ie=Ee();const ze=B(Ie);var ft={exports:{}},Ce=ft.exports,Tt;function Le(){return Tt||(Tt=1,(function(s,a){(function(n,e){s.exports=e()})(Ce,(function(){return function(n,e,r){var t=e.prototype,o=function(f){return f&&(f.indexOf?f:f.s)},i=function(f,h,y,S,l){var v=f.name?f:f.$locale(),p=o(v[h]),D=o(v[y]),x=p||D.map((function(R){return R.slice(0,S)}));if(!l)return x;var z=v.weekStart;return x.map((function(R,k){return x[(k+(z||0))%7]}))},u=function(){return r.Ls[r.locale()]},c=function(f,h){return f.formats[h]||(function(y){return y.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(S,l,v){return l||v.slice(1)}))})(f.formats[h.toUpperCase()])},d=function(){var f=this;return{months:function(h){return h?h.format("MMMM"):i(f,"months")},monthsShort:function(h){return h?h.format("MMM"):i(f,"monthsShort","months",3)},firstDayOfWeek:function(){return f.$locale().weekStart||0},weekdays:function(h){return h?h.format("dddd"):i(f,"weekdays")},weekdaysMin:function(h){return h?h.format("dd"):i(f,"weekdaysMin","weekdays",2)},weekdaysShort:function(h){return h?h.format("ddd"):i(f,"weekdaysShort","weekdays",3)},longDateFormat:function(h){return c(f.$locale(),h)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};t.localeData=function(){return d.bind(this)()},r.localeData=function(){var f=u();return{firstDayOfWeek:function(){return f.weekStart||0},weekdays:function(){return r.weekdays()},weekdaysShort:function(){return r.weekdaysShort()},weekdaysMin:function(){return r.weekdaysMin()},months:function(){return r.months()},monthsShort:function(){return r.monthsShort()},longDateFormat:function(h){return c(f,h)},meridiem:f.meridiem,ordinal:f.ordinal}},r.months=function(){return i(u(),"months")},r.monthsShort=function(){return i(u(),"monthsShort","months",3)},r.weekdays=function(f){return i(u(),"weekdays",null,null,f)},r.weekdaysShort=function(f){return i(u(),"weekdaysShort","weekdays",3,f)},r.weekdaysMin=function(f){return i(u(),"weekdaysMin","weekdays",2,f)}}}))})(ft)),ft.exports}var Re=Le();const Pe=B(Re);var dt={exports:{}},_e=dt.exports,Et;function je(){return Et||(Et=1,(function(s,a){(function(n,e){s.exports=e()})(_e,(function(){return function(n,e,r){var t=function(o,i){if(!i||!i.length||i.length===1&&!i[0]||i.length===1&&Array.isArray(i[0])&&!i[0].length)return null;var u;i.length===1&&i[0].length>0&&(i=i[0]),u=(i=i.filter((function(d){return d})))[0];for(var c=1;c<i.length;c+=1)i[c].isValid()&&!i[c][o](u)||(u=i[c]);return u};r.max=function(){var o=[].slice.call(arguments,0);return t("isAfter",o)},r.min=function(){var o=[].slice.call(arguments,0);return t("isBefore",o)}}}))})(dt)),dt.exports}var We=je();const Ne=B(We);var ht={exports:{}},Ae=ht.exports,It;function Fe(){return It||(It=1,(function(s,a){(function(n,e){s.exports=e()})(Ae,(function(){var n={year:0,month:1,day:2,hour:3,minute:4,second:5},e={};return function(r,t,o){var i,u=function(h,y,S){S===void 0&&(S={});var l=new Date(h),v=(function(p,D){D===void 0&&(D={});var x=D.timeZoneName||"short",z=p+"|"+x,R=e[z];return R||(R=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:p,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:x}),e[z]=R),R})(y,S);return v.formatToParts(l)},c=function(h,y){for(var S=u(h,y),l=[],v=0;v<S.length;v+=1){var p=S[v],D=p.type,x=p.value,z=n[D];z>=0&&(l[z]=parseInt(x,10))}var R=l[3],k=R===24?0:R,w=l[0]+"-"+l[1]+"-"+l[2]+" "+k+":"+l[4]+":"+l[5]+":000",$=+h;return(o.utc(w).valueOf()-($-=$%1e3))/6e4},d=t.prototype;d.tz=function(h,y){h===void 0&&(h=i);var S,l=this.utcOffset(),v=this.toDate(),p=v.toLocaleString("en-US",{timeZone:h}),D=Math.round((v-new Date(p))/1e3/60),x=15*-Math.round(v.getTimezoneOffset()/15)-D;if(!Number(x))S=this.utcOffset(0,y);else if(S=o(p,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(x,!0),y){var z=S.utcOffset();S=S.add(l-z,"minute")}return S.$x.$timezone=h,S},d.offsetName=function(h){var y=this.$x.$timezone||o.tz.guess(),S=u(this.valueOf(),y,{timeZoneName:h}).find((function(l){return l.type.toLowerCase()==="timezonename"}));return S&&S.value};var f=d.startOf;d.startOf=function(h,y){if(!this.$x||!this.$x.$timezone)return f.call(this,h,y);var S=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return f.call(S,h,y).tz(this.$x.$timezone,!0)},o.tz=function(h,y,S){var l=S&&y,v=S||y||i,p=c(+o(),v);if(typeof h!="string")return o(h).tz(v);var D=(function(k,w,$){var g=k-60*w*1e3,m=c(g,$);if(w===m)return[g,w];var T=c(g-=60*(m-w)*1e3,$);return m===T?[g,m]:[k-60*Math.min(m,T)*1e3,Math.max(m,T)]})(o.utc(h,l).valueOf(),p,v),x=D[0],z=D[1],R=o(x).utcOffset(z);return R.$x.$timezone=v,R},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(h){i=h}}}))})(ht)),ht.exports}var He=Fe();const Ye=B(He);var mt={exports:{}},Ue=mt.exports,zt;function qe(){return zt||(zt=1,(function(s,a){(function(n,e){s.exports=e()})(Ue,(function(){return function(n,e,r){r.updateLocale=function(t,o){var i=r.Ls[t];if(i)return(o?Object.keys(o):[]).forEach((function(u){i[u]=o[u]})),i}}}))})(mt)),mt.exports}var Be=qe();const Ve=B(Be);var gt={exports:{}},Ge=gt.exports,Ct;function Xe(){return Ct||(Ct=1,(function(s,a){(function(n,e){s.exports=e()})(Ge,(function(){var n="minute",e=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(t,o,i){var u=o.prototype;i.utc=function(l){var v={date:l,utc:!0,args:arguments};return new o(v)},u.utc=function(l){var v=i(this.toDate(),{locale:this.$L,utc:!0});return l?v.add(this.utcOffset(),n):v},u.local=function(){return i(this.toDate(),{locale:this.$L,utc:!1})};var c=u.parse;u.parse=function(l){l.utc&&(this.$u=!0),this.$utils().u(l.$offset)||(this.$offset=l.$offset),c.call(this,l)};var d=u.init;u.init=function(){if(this.$u){var l=this.$d;this.$y=l.getUTCFullYear(),this.$M=l.getUTCMonth(),this.$D=l.getUTCDate(),this.$W=l.getUTCDay(),this.$H=l.getUTCHours(),this.$m=l.getUTCMinutes(),this.$s=l.getUTCSeconds(),this.$ms=l.getUTCMilliseconds()}else d.call(this)};var f=u.utcOffset;u.utcOffset=function(l,v){var p=this.$utils().u;if(p(l))return this.$u?0:p(this.$offset)?f.call(this):this.$offset;if(typeof l=="string"&&(l=(function(R){R===void 0&&(R="");var k=R.match(e);if(!k)return null;var w=(""+k[0]).match(r)||["-",0,0],$=w[0],g=60*+w[1]+ +w[2];return g===0?0:$==="+"?g:-g})(l),l===null))return this;var D=Math.abs(l)<=16?60*l:l;if(D===0)return this.utc(v);var x=this.clone();if(v)return x.$offset=D,x.$u=!1,x;var z=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(x=this.local().add(D+z,n)).$offset=D,x.$x.$localOffset=z,x};var h=u.format;u.format=function(l){var v=l||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,v)},u.valueOf=function(){var l=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*l},u.isUTC=function(){return!!this.$u},u.toISOString=function(){return this.toDate().toISOString()},u.toString=function(){return this.toDate().toUTCString()};var y=u.toDate;u.toDate=function(l){return l==="s"&&this.$offset?i(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():y.call(this)};var S=u.diff;u.diff=function(l,v,p){if(l&&this.$u===l.$u)return S.call(this,l,v,p);var D=this.local(),x=i(l).local();return S.call(D,x,v,p)}}}))})(gt)),gt.exports}var Ze=Xe();const Je=B(Ze);var pt={exports:{}},Ke=pt.exports,Lt;function Qe(){return Lt||(Lt=1,(function(s,a){(function(n,e){s.exports=e()})(Ke,(function(){return function(n,e){e.prototype.weekday=function(r){var t=this.$locale().weekStart||0,o=this.$W,i=(o<t?o+7:o)-t;return this.$utils().u(r)?i:this.subtract(i,"day").add(r,"day")}}}))})(pt)),pt.exports}var tn=Qe();const en=B(tn);N.extend(Ne);N.extend(fe);N.extend(en);N.extend(ze);N.extend(Je);N.extend(Ye);N.extend(we);N.extend(ke);N.extend(ge);N.extend(Pe);N.extend(Ve);N.extend(Se);const Rt={minute:1,hour:60,day:1440,week:1440*7,month:1440*30},Pt=10;function nn(s,a){const n=j.useRef(null),e=j.useRef(null),r=j.useRef(a);r.current=a;const t=q(h=>h.selectedScale),o=K[t],{basePxPerDragStep:i,dragStepAmount:u,dragStepUnit:c}=o,d=h=>{const y=h.currentTarget.getBoundingClientRect(),S=h.clientX-y.left;return S<=Pt?"left":S>=y.width-Pt?"right":"bar"};return{onPointerDown:h=>{const y=d(h);e.current=y,n.current={mode:y,initialClientX:h.clientX,initialStartDate:N(s.startDate),initialEndDate:N(s.endDate),initialBarWidth:s.barWidth,dragSteps:0,basePxPerDragStep:i,dragStepAmount:u,dragStepUnit:c,taskId:s.id},q.getState().setCurrentTask(s),h.currentTarget.setPointerCapture(h.pointerId);const S=v=>{const p=n.current;if(!p)return;const D=v.clientX-p.initialClientX,x=Math.round(D/p.basePxPerDragStep);if(x===p.dragSteps)return;p.dragSteps=x;const z=x*p.basePxPerDragStep,R=p.dragStepAmount*Rt[p.dragStepUnit],k=x*R;let w,$,g=0,m=0;switch(p.mode){case"bar":w=p.initialStartDate.add(k,"minute"),$=p.initialEndDate.add(k,"minute"),g=z,m=0;break;case"left":if(w=p.initialStartDate.add(k,"minute"),$=p.initialEndDate,g=z,m=-z,p.initialBarWidth+m<p.basePxPerDragStep)return;break;case"right":if(w=p.initialStartDate,$=p.initialEndDate.add(k,"minute"),g=0,m=z,p.initialBarWidth+m<p.basePxPerDragStep)return;break;default:return}const T={offsetX:g,offsetWidth:m,offsetStartDate:w,offsetEndDate:$};q.getState().setDragOffset(p.taskId,T)},l=()=>{var R;document.removeEventListener("pointermove",S),document.removeEventListener("pointerup",l),document.removeEventListener("pointercancel",l);const v=n.current;if(!v)return;if(v.dragSteps===0){n.current=null,e.current=null,q.getState().setCurrentTask(null),q.getState().clearDragOffset(v.taskId);return}const p=q.getState().rawTasks,D=v.dragStepAmount*Rt[v.dragStepUnit],x=v.dragSteps*D,z=p.map(k=>{if(k.id!==v.taskId)return k;switch(v.mode){case"bar":return{...k,startDate:N(k.startDate).add(x,"minute").toISOString(),endDate:N(k.endDate).add(x,"minute").toISOString()};case"left":return{...k,startDate:N(k.startDate).add(x,"minute").toISOString()};case"right":return{...k,endDate:N(k.endDate).add(x,"minute").toISOString()};default:return k}});q.getState().setRawTasks(z),(R=r.current)==null||R.call(r,z),n.current=null,e.current=null,q.getState().setCurrentTask(null),q.getState().clearDragOffset(v.taskId)};document.addEventListener("pointermove",S),document.addEventListener("pointerup",l),document.addEventListener("pointercancel",l)},dragMode:e.current}}const _t=8,rn={day:"MMM D, h A",week:"MMM D",month:"MMM D",year:"MMM YYYY"};function sn({currentTask:s,onTasksChange:a}){const n=j.useRef(null),{onPointerDown:e,dragMode:r}=nn(s,a),[t,o]=j.useState("grab"),i=q(p=>p.dragOffsets[s.id]),u=q(p=>{var D;return((D=p.currentTask)==null?void 0:D.id)===s.id}),c=q(p=>p.selectedScale),d=(i==null?void 0:i.offsetX)??0,f=(i==null?void 0:i.offsetWidth)??0,h=s.barLeft+d,y=s.barWidth+f,S=j.useCallback(p=>{const D=n.current;if(!D)return;const x=D.getBoundingClientRect(),z=p.clientX-x.left;z<=_t||z>=x.width-_t?o("ew-resize"):o("grab")},[]),l=rn[c],v=p=>{if(!i)return"";const D=i.offsetStartDate.format(l),x=i.offsetEndDate.format(l);switch(p){case"left":return`Start: ${D}`;case"right":return`End: ${x}`;case"bar":default:return`${D} → ${x}`}};return P.jsxs("div",{ref:n,id:`task-${s.id}`,className:`gantt-task-bar${u?" dragging":""}`,onPointerDown:e,onMouseMove:S,onMouseLeave:()=>o("grab"),style:{transform:`translateX(${h}px)`,width:y,height:vt/2,cursor:u?"grabbing":t},role:"button",tabIndex:0,"aria-label":`태스크: ${s.name}`,children:[P.jsx("span",{className:"gantt-task-name",children:s.name}),u&&i&&P.jsx("div",{className:"gantt-bar-tooltip",role:"status","aria-live":"polite",children:v(r)})]})}function on(s){const a=[];for(const n of s){const e=a[a.length-1];e&&e.label===n.label?e.widthPx+=n.widthPx:a.push({...n})}return a}function an(s){let a=0;return s.map(n=>{const e={...n,left:a};return a+=n.widthPx,e})}function un(s){const a=on(s);return an(a)}function jt(s){return s.split(".").map(Number)}function cn(s){return[...s].sort((a,n)=>{const e=jt(a.sequence),r=jt(n.sequence),t=Math.max(e.length,r.length);for(let o=0;o<t;o++){const i=e[o]||0,u=r[o]||0;if(i!==u)return i-u}return 0})}function ln(s){return s.split(".").length-1}function fn(s,a,n){return cn(s).map((r,t)=>{const o=ln(r.sequence),i=t+1,{barMarginLeftAmount:u,barWidthSize:c}=dn(N(r.startDate),N(r.endDate),a,n);return{...r,barLeft:u,barWidth:c,depth:o,order:i,originalOrder:i}})}function dn(s,a,n,e){if(!n.length)return{barMarginLeftAmount:0,barWidthSize:0};const r=K[e],{tickUnit:t,unitPerTick:o}=r;let i=0,u=0,c=!1;const d=s.valueOf(),f=a.valueOf();for(const h of n){const y=h.startDate,S=y.add(o,t),l=h.widthPx,v=y.valueOf(),p=S.valueOf();if(p<=d){i+=l;continue}if(v>=f)break;const D=d>v?s:y,x=f<p?a:S,z=p-v,k=(x.valueOf()-D.valueOf())/z;if(!c&&D.valueOf()>v){const w=(D.valueOf()-v)/z;i+=w*l}u+=k*l,c=!0}return{barMarginLeftAmount:i,barWidthSize:Math.max(u,1)}}function hn(s){let a=1/0,n=-1/0;for(const e of s){const r=N(e.startDate).valueOf(),t=N(e.endDate).valueOf();Number.isNaN(r)||(a=Math.min(a,r)),Number.isNaN(t)||(n=Math.max(n,t))}return{minDate:N(a),maxDate:N(n)}}function mn(s,a,n){const e=K[n],{tickUnit:r,unitPerTick:t}=e,o=Jt*t;return{paddedMinDate:s.subtract(o,r),paddedMaxDate:a.add(o,r)}}function gn(s,a,n){const e=K[n],{tickUnit:r,unitPerTick:t,basePxPerDragStep:o,dragStepUnit:i,dragStepAmount:u}=e,c=[];let d=s.startOf(r);const f=a.valueOf(),h=o/u;for(;d.valueOf()<f;){const y=d.add(t,r),l=y.diff(d,i)*h;c.push({startDate:d,widthPx:l}),d=y}return c}function pn(s,a){const n=K[a],{labelUnit:e,formatHeaderLabel:r}=n;if(s.length===0)return[];const t=[];let o=null;for(const i of s){const u=i.startDate.startOf(e),c=u.valueOf(),d=(r==null?void 0:r(u))??u.format();o&&o.startDate.valueOf()===c?o.widthPx+=i.widthPx:(o&&t.push(o),o={label:d,widthPx:i.widthPx,startDate:u})}return o&&t.push(o),t}function $n(s,a){if(!s.length)return{bottomCells:[],transformedTasks:[]};const{minDate:n,maxDate:e}=hn(s),{paddedMinDate:r,paddedMaxDate:t}=mn(n,e,a),o=gn(r,t,a),i=fn(s,o,a);return{bottomCells:o,transformedTasks:i}}function vn({bottomRowCells:s,selectedScale:a,width:n,scrollRef:e}){const r=K[a],[t,o]=j.useState(0),i=j.useMemo(()=>{const c=pn(s,a);return un(c)},[s,a]),u=j.useCallback(()=>{const c=e.current;if(!c)return;const d=c.scrollLeft;for(let f=i.length-1;f>=0;f--)if(d>=i[f].left){o(f);break}},[i,e]);return j.useEffect(()=>{const c=e.current;if(c)return c.addEventListener("scroll",u,{passive:!0}),u(),()=>c.removeEventListener("scroll",u)},[u,e]),P.jsx("header",{className:"gantt-header",style:{width:`${n}px`},children:P.jsxs("div",{className:"gantt-header-content",children:[P.jsx("div",{className:"gantt-top-header",children:P.jsx("div",{className:"gantt-top-groups",children:i.map((c,d)=>{const f=d===t;return P.jsx("div",{className:`gantt-top-group${f?" sticky":""}`,style:{width:`${c.widthPx}px`,...f&&{left:0}},children:P.jsx("p",{className:"gantt-top-group-label",children:c.label})},`${c.label}-${d}`)})})}),P.jsx("div",{className:"gantt-bottom-row",children:s.map((c,d)=>{var h;const f=((h=r.formatTickLabel)==null?void 0:h.call(r,c.startDate))||"";return P.jsx("div",{className:"gantt-bottom-cell",style:{width:`${c.widthPx}px`},children:f},`bottom-${d}`)})})]})})}function Sn(s,a,n,e,r){if(n<0||r<0)return`M ${a} ${n} h ${(e-a)/2}`;const t=7,o=11,i=25,u=20,c=`M ${a} ${n}`,d=e-a,f=r-n,h=Math.abs(d),y=Math.abs(f),S=r<=n,l=r>=n,v=e>=a,p=e<=a,D=h>u,x=Math.abs(d/2),z=Math.abs(f/2);function R(){function g(){return(v||p)&&l&&!D?"downSmallHorizontal":(v||p)&&S&&!D?"upSmallHorizontal":l&&p?"downLeft":l&&v?"downRight":S&&p?"upLeft":S&&v?"upRight":""}let m=c;switch(g()){case"downRight":{m+=` h ${x-t}`,m+=` a ${t} ${t} 0 0 1 ${t} ${t}`,m+=` v ${f-t*2}`,m+=` a ${t} ${t} 0 0 0 ${t} ${t}`,m+=` h ${x-t}`;break}case"upRight":{m+=` h ${x-t}`,m+=` a ${t} ${t} 0 0 0 ${t} -${t}`,m+=` v -${y-t*2}`,m+=` a ${t} ${t} 0 0 1 ${t} -${t}`,m+=` h ${x-t}`;break}case"downLeft":case"downSmallHorizontal":{const W=n+f/2;m+=` h ${o}`,m+=` a ${t} ${t} 0 0 1 ${t} ${t}`,m+=` v ${W-n-t*2}`,m+=` a ${t} ${t} 0 0 1 -${t} ${t}`,m+=` h ${d-2*o}`,m+=` a ${t} ${t} 0 0 0 -${t} ${t}`,m+=` v ${W-n-t*2}`,m+=` a ${t} ${t} 0 0 0 ${t} ${t}`,m+=` h ${o}`;break}case"upLeft":case"upSmallHorizontal":{const W=n+f/2;m+=` h ${o}`,m+=` a ${t} ${t} 0 0 0 ${t} -${t}`,m+=` v -${n-W-t*2}`,m+=` a ${t} ${t} 0 0 0 -${t} -${t}`,m+=` h ${d-2*o}`,m+=` a ${t} ${t} 0 0 1 -${t} -${t}`,m+=` v -${n-W-t*2}`,m+=` a ${t} ${t} 0 0 1 ${t} -${t}`,m+=` h ${o}`;break}default:return m}return m}function k(){let g=c;return l&&p?(g+=` h ${i-o}`,g+=` a ${t} ${t} 0 0 1 ${t} ${t}`,g+=` v ${f-t*2}`,g+=` a ${t} ${t} 0 0 1 -${t} ${t}`,g+=` h ${d-t*2}`):l&&v?(g+=` h ${d+i-o}`,g+=` a ${t} ${t} 0 0 1 ${t} ${t}`,g+=` v ${f-t*2}`,g+=` a ${t} ${t} 0 0 1 -${t} ${t}`,g+=` h -${i-o}`):S&&p?(g+=` h ${i-o}`,g+=` a ${t} ${t} 0 0 0 ${t} -${t}`,g+=` v ${f+t*2}`,g+=` a ${t} ${t} 0 0 0 -${t} -${t}`,g+=` h ${d-i+o}`):S&&v&&(g+=` h ${d+i-o}`,g+=` a ${t} ${t} 0 0 0 ${t} -${t}`,g+=` v ${f+t*2}`,g+=` a ${t} ${t} 0 0 0 -${t} -${t}`,g+=` h -${i-o}`),g}function w(){function g(){return(v||p)&&l&&!D?"downSmallHorizontal":(v||p)&&S&&!D?"upSmallHorizontal":l&&p?"downLeft":l&&v?"downRight":S&&p?"upLeft":S&&v?"upRight":""}let m=c;switch(g()){case"downRight":case"downSmallHorizontal":{m+=` h ${-o}`,m+=` a ${t} ${t} 0 0 0 -${t} ${t}`,m+=` v ${z-t*2}`,m+=` a ${t} ${t} 0 0 0 ${t} ${t}`,m+=` h ${o*2+d}`,m+=` a ${t} ${t} 0 0 1 ${t} ${t}`,m+=` v ${z-t*2}`,m+=` a ${t} ${t} 0 0 1 -${t} ${t}`,m+=` h ${-o}`;break}case"upRight":case"upSmallHorizontal":{m+=` h ${-o}`,m+=` a ${t} ${t} 0 0 1 -${t} -${t}`,m+=` v ${-(z-t*2)}`,m+=` a ${t} ${t} 0 0 1 ${t} -${t}`,m+=` h ${o*2+d}`,m+=` a ${t} ${t} 0 0 0 ${t} -${t}`,m+=` v ${-(z-t*2)}`,m+=` a ${t} ${t} 0 0 0 -${t} -${t}`,m+=` h ${-o}`;break}case"downLeft":{m+=` h ${-x+t}`,m+=` a ${t} ${t} 0 0 0 -${t} ${t}`,m+=` v ${y-t*2}`,m+=` a ${t} ${t} 0 0 1 -${t} ${t}`,m+=` h ${-x+t}`;break}case"upLeft":{m+=` h ${-(x-t)}`,m+=` a ${t} ${t} 0 0 1 -${t} -${t}`,m+=` v ${-(y-t*2)}`,m+=` a ${t} ${t} 0 0 0 -${t} -${t}`,m+=` h ${-x+t}`;break}default:return m}return m}function $(){let g=c;return l&&p?(g+=` h ${d-i}`,g+=` a ${t} ${t} 0 0 0 -${t} ${t}`,g+=` v ${f-t*2}`,g+=` a ${t} ${t} 0 0 0 ${t} ${t}`,g+=` h ${i}`):l&&v?(g+=` h ${-i}`,g+=` a ${t} ${t} 0 0 0 -${t} ${t}`,g+=` v ${f-t*2}`,g+=` a ${t} ${t} 0 0 0 ${t} ${t}`,g+=` h ${d+i}`):S&&p?(g+=` h ${d-i}`,g+=` a ${t} ${t} 0 0 1 -${t} -${t}`,g+=` v ${f+t*2}`,g+=` a ${t} ${t} 0 0 1 ${t} -${t}`,g+=` h ${i}`):S&&v&&(g+=` h ${-i}`,g+=` a ${t} ${t} 0 0 1 -${t} -${t}`,g+=` v ${f+t*2}`,g+=` a ${t} ${t} 0 0 1 ${t} -${t}`,g+=` h ${d+i}`),g}switch(s){case"FS":return R();case"FF":return k();case"SF":return w();case"SS":return $();default:return`${c} L ${e} ${r}`}}function yn(s,a,n,e){const r=vt,t=s.order-1,o=a.order-1,i=r/2,u=o*r+i,c=t*r+i,d=a.barLeft,f=a.barLeft+a.barWidth,h=s.barLeft+n.offsetX,y=h+s.barWidth+n.offsetWidth,S={FS:[f,h],SS:[d,h],FF:[f,y],SF:[d,y]},[l,v]=S[e];return{fromX:l,fromY:u,toX:v,toY:c}}function xn(s,a){const n=[];for(const e of s){const r=a[e.id]??{offsetX:0,offsetWidth:0};for(const t of e.dependencies??[]){const o=s.find(f=>f.id===t.targetId);if(!o)continue;const{fromX:i,fromY:u,toX:c,toY:d}=yn(e,o,r,t.type);n.push({...t,fromX:i,fromY:u,toX:c,toY:d})}}return n}function bn({transformedTasks:s}){const a=q(e=>e.dragOffsets),n=xn(s,a);return P.jsxs("svg",{className:"gantt-dependency-arrows",style:{height:`${s.length*vt}px`},children:[P.jsx("defs",{children:P.jsx("marker",{id:"arrowhead",markerWidth:"5",markerHeight:"5",refX:"4.5",refY:"2.5",orient:"auto",children:P.jsx("polygon",{className:"gantt-dependency-arrow-head",points:"0 0, 5 2.5, 0 5"})})}),n.map((e,r)=>P.jsx("path",{className:"gantt-dependency-arrow",d:Sn(e.type,e.fromX,e.fromY,e.toX,e.toY),markerEnd:"url(#arrowhead)",fill:"none"},`arrow-${r}`))]})}const J=Object.keys(K);function wn({selectedScale:s,onScaleChange:a}){const n=(e,r)=>{const t=J.indexOf(r);if(e.key==="ArrowRight"||e.key==="ArrowDown"){e.preventDefault();const o=(t+1)%J.length;a(J[o])}else if(e.key==="ArrowLeft"||e.key==="ArrowUp"){e.preventDefault();const o=(t-1+J.length)%J.length;a(J[o])}};return P.jsx("div",{className:"gantt-scale-selector",role:"group","aria-label":"타임라인 스케일 선택",children:P.jsx("div",{className:"gantt-scale-control",children:J.map(e=>{const r=e===s;return P.jsx("button",{type:"button",className:"gantt-scale-button","data-active":r,onClick:()=>a(e),onKeyDown:t=>n(t,e),"aria-pressed":r,tabIndex:r?0:-1,children:e},e)})})})}const Wt=s=>Symbol.iterator in s,Nt=s=>"entries"in s,At=(s,a)=>{const n=s instanceof Map?s:new Map(s.entries()),e=a instanceof Map?a:new Map(a.entries());if(n.size!==e.size)return!1;for(const[r,t]of n)if(!e.has(r)||!Object.is(t,e.get(r)))return!1;return!0},Mn=(s,a)=>{const n=s[Symbol.iterator](),e=a[Symbol.iterator]();let r=n.next(),t=e.next();for(;!r.done&&!t.done;){if(!Object.is(r.value,t.value))return!1;r=n.next(),t=e.next()}return!!r.done&&!!t.done};function Dn(s,a){return Object.is(s,a)?!0:typeof s!="object"||s===null||typeof a!="object"||a===null||Object.getPrototypeOf(s)!==Object.getPrototypeOf(a)?!1:Wt(s)&&Wt(a)?Nt(s)&&Nt(a)?At(s,a):Mn(s,a):At({entries:()=>Object.entries(s)},{entries:()=>Object.entries(a)})}function On(s){const a=j.useRef(void 0);return n=>{const e=s(n);return Dn(a.current,e)?a.current:a.current=e}}function kn(){return q(On(s=>({rawTasks:s.rawTasks,transformedTasks:s.transformedTasks,bottomRowCells:s.bottomRowCells,selectedScale:s.selectedScale,currentTask:s.currentTask,dragOffsets:s.dragOffsets,setRawTasks:s.setRawTasks,setTransformedTasks:s.setTransformedTasks,setBottomRowCells:s.setBottomRowCells,setSelectedScale:s.setSelectedScale,setCurrentTask:s.setCurrentTask,setDragOffset:s.setDragOffset,clearDragOffset:s.clearDragOffset,getTotalWidth:s.getTotalWidth,getCurrentDragOffset:s.getCurrentDragOffset})))}function tt(s,a,n){let e=n.initialDeps??[],r;function t(){var o,i,u,c;let d;n.key&&((o=n.debug)!=null&&o.call(n))&&(d=Date.now());const f=s();if(!(f.length!==e.length||f.some((S,l)=>e[l]!==S)))return r;e=f;let y;if(n.key&&((i=n.debug)!=null&&i.call(n))&&(y=Date.now()),r=a(...f),n.key&&((u=n.debug)!=null&&u.call(n))){const S=Math.round((Date.now()-d)*100)/100,l=Math.round((Date.now()-y)*100)/100,v=l/16,p=(D,x)=>{for(D=String(D);D.length<x;)D=" "+D;return D};console.info(`%c⏱ ${p(l,5)} /${p(S,5)} ms`,`
2
- font-size: .6rem;
3
- font-weight: bold;
4
- color: hsl(${Math.max(0,Math.min(120-120*v,120))}deg 100% 31%);`,n==null?void 0:n.key)}return(c=n==null?void 0:n.onChange)==null||c.call(n,r),r}return t.updateDeps=o=>{e=o},t}function Ft(s,a){if(s===void 0)throw new Error("Unexpected undefined");return s}const Tn=(s,a)=>Math.abs(s-a)<1.01,En=(s,a,n)=>{let e;return function(...r){s.clearTimeout(e),e=s.setTimeout(()=>a.apply(this,r),n)}},Ht=s=>{const{offsetWidth:a,offsetHeight:n}=s;return{width:a,height:n}},In=s=>s,zn=s=>{const a=Math.max(s.startIndex-s.overscan,0),n=Math.min(s.endIndex+s.overscan,s.count-1),e=[];for(let r=a;r<=n;r++)e.push(r);return e},Cn=(s,a)=>{const n=s.scrollElement;if(!n)return;const e=s.targetWindow;if(!e)return;const r=o=>{const{width:i,height:u}=o;a({width:Math.round(i),height:Math.round(u)})};if(r(Ht(n)),!e.ResizeObserver)return()=>{};const t=new e.ResizeObserver(o=>{const i=()=>{const u=o[0];if(u!=null&&u.borderBoxSize){const c=u.borderBoxSize[0];if(c){r({width:c.inlineSize,height:c.blockSize});return}}r(Ht(n))};s.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()});return t.observe(n,{box:"border-box"}),()=>{t.unobserve(n)}},Yt={passive:!0},Ut=typeof window>"u"?!0:"onscrollend"in window,Ln=(s,a)=>{const n=s.scrollElement;if(!n)return;const e=s.targetWindow;if(!e)return;let r=0;const t=s.options.useScrollendEvent&&Ut?()=>{}:En(e,()=>{a(r,!1)},s.options.isScrollingResetDelay),o=d=>()=>{const{horizontal:f,isRtl:h}=s.options;r=f?n.scrollLeft*(h&&-1||1):n.scrollTop,t(),a(r,d)},i=o(!0),u=o(!1);u(),n.addEventListener("scroll",i,Yt);const c=s.options.useScrollendEvent&&Ut;return c&&n.addEventListener("scrollend",u,Yt),()=>{n.removeEventListener("scroll",i),c&&n.removeEventListener("scrollend",u)}},Rn=(s,a,n)=>{if(a!=null&&a.borderBoxSize){const e=a.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?"inlineSize":"blockSize"])}return s[n.options.horizontal?"offsetWidth":"offsetHeight"]},Pn=(s,{adjustments:a=0,behavior:n},e)=>{var r,t;const o=s+a;(t=(r=e.scrollElement)==null?void 0:r.scrollTo)==null||t.call(r,{[e.options.horizontal?"left":"top"]:o,behavior:n})};class _n{constructor(a){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const e=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(r=>{r.forEach(t=>{const o=()=>{this._measureElement(t.target,t)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var r;(r=e())==null||r.disconnect(),n=null},observe:r=>{var t;return(t=e())==null?void 0:t.observe(r,{box:"border-box"})},unobserve:r=>{var t;return(t=e())==null?void 0:t.unobserve(r)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([e,r])=>{typeof r>"u"&&delete n[e]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:In,rangeExtractor:zn,onChange:()=>{},measureElement:Rn,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var e,r;(r=(e=this.options).onChange)==null||r.call(e,this,n)},this.maybeNotify=tt(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}this.scrollElement=e,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(r=>{this.observer.observe(r)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,r=>{this.scrollRect=r,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(r,t)=>{this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<r?"forward":"backward":null,this.scrollOffset=r,this.isScrolling=t,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,e)=>{const r=new Map,t=new Map;for(let o=e-1;o>=0;o--){const i=n[o];if(r.has(i.lane))continue;const u=t.get(i.lane);if(u==null||i.end>u.end?t.set(i.lane,i):i.end<u.end&&r.set(i.lane,!0),r.size===this.options.lanes)break}return t.size===this.options.lanes?Array.from(t.values()).sort((o,i)=>o.end===i.end?o.index-i.index:o.end-i.end)[0]:void 0},this.getMeasurementOptions=tt(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(n,e,r,t,o)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:e,scrollMargin:r,getItemKey:t,enabled:o}),{key:!1}),this.getMeasurements=tt(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:e,scrollMargin:r,getItemKey:t,enabled:o},i)=>{if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(d=>{this.itemSizeCache.set(d.key,d.size)}));const u=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const c=this.measurementsCache.slice(0,u);for(let d=u;d<n;d++){const f=t(d),h=this.options.lanes===1?c[d-1]:this.getFurthestMeasurement(c,d),y=h?h.end+this.options.gap:e+r,S=i.get(f),l=typeof S=="number"?S:this.options.estimateSize(d),v=y+l,p=h?h.lane:d%this.options.lanes;c[d]={index:d,start:y,size:l,end:v,key:f,lane:p}}return this.measurementsCache=c,c},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=tt(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,e,r,t)=>this.range=n.length>0&&e>0?jn({measurements:n,outerSize:e,scrollOffset:r,lanes:t}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=tt(()=>{let n=null,e=null;const r=this.calculateRange();return r&&(n=r.startIndex,e=r.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,e]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,e]},(n,e,r,t,o)=>t===null||o===null?[]:n({startIndex:t,endIndex:o,overscan:e,count:r}),{key:process.env.NODE_ENV!=="production"&&"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=n=>{const e=this.options.indexAttribute,r=n.getAttribute(e);return r?parseInt(r,10):(console.warn(`Missing attribute name '${e}={index}' on measured element.`),-1)},this._measureElement=(n,e)=>{const r=this.indexFromElement(n),t=this.measurementsCache[r];if(!t)return;const o=t.key,i=this.elementsCache.get(o);i!==n&&(i&&this.observer.unobserve(i),this.observer.observe(n),this.elementsCache.set(o,n)),n.isConnected&&this.resizeItem(r,this.options.measureElement(n,e,this))},this.resizeItem=(n,e)=>{const r=this.measurementsCache[n];if(!r)return;const t=this.itemSizeCache.get(r.key)??r.size,o=e-t;o!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(r,o,this):r.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",o),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=o,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(r.index),this.itemSizeCache=new Map(this.itemSizeCache.set(r.key,e)),this.notify(!1))},this.measureElement=n=>{if(!n){this.elementsCache.forEach((e,r)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(r))});return}this._measureElement(n,void 0)},this.getVirtualItems=tt(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,e)=>{const r=[];for(let t=0,o=n.length;t<o;t++){const i=n[t],u=e[i];r.push(u)}return r},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const e=this.getMeasurements();if(e.length!==0)return Ft(e[Gt(0,e.length-1,r=>Ft(e[r]).start,n)])},this.getOffsetForAlignment=(n,e,r=0)=>{const t=this.getSize(),o=this.getScrollOffset();e==="auto"&&(e=n>=o+t?"end":"start"),e==="center"?n+=(r-t)/2:e==="end"&&(n-=t);const i=this.getTotalSize()+this.options.scrollMargin-t;return Math.max(Math.min(i,n),0)},this.getOffsetForIndex=(n,e="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const r=this.measurementsCache[n];if(!r)return;const t=this.getSize(),o=this.getScrollOffset();if(e==="auto")if(r.end>=o+t-this.options.scrollPaddingEnd)e="end";else if(r.start<=o+this.options.scrollPaddingStart)e="start";else return[o,e];const i=e==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,e,r.size),e]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(n,{align:e="start",behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,e),{adjustments:void 0,behavior:r})},this.scrollToIndex=(n,{align:e="auto",behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),n=Math.max(0,Math.min(n,this.options.count-1));let t=0;const o=10,i=c=>{if(!this.targetWindow)return;const d=this.getOffsetForIndex(n,c);if(!d){console.warn("Failed to get offset for index:",n);return}const[f,h]=d;this._scrollToOffset(f,{adjustments:void 0,behavior:r}),this.targetWindow.requestAnimationFrame(()=>{const y=this.getScrollOffset(),S=this.getOffsetForIndex(n,h);if(!S){console.warn("Failed to get offset for index:",n);return}Tn(S[0],y)||u(h)})},u=c=>{this.targetWindow&&(t++,t<o?(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("Schedule retry",t,o),this.targetWindow.requestAnimationFrame(()=>i(c))):console.warn(`Failed to scroll to index ${n} after ${o} attempts.`))};i(e)},this.scrollBy=(n,{behavior:e}={})=>{e==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:e})},this.getTotalSize=()=>{var n;const e=this.getMeasurements();let r;if(e.length===0)r=this.options.paddingStart;else if(this.options.lanes===1)r=((n=e[e.length-1])==null?void 0:n.end)??0;else{const t=Array(this.options.lanes).fill(null);let o=e.length-1;for(;o>=0&&t.some(i=>i===null);){const i=e[o];t[i.lane]===null&&(t[i.lane]=i.end),o--}r=Math.max(...t.filter(i=>i!==null))}return Math.max(r-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:e,behavior:r})=>{this.options.scrollToFn(n,{behavior:r,adjustments:e},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(a)}}const Gt=(s,a,n,e)=>{for(;s<=a;){const r=(s+a)/2|0,t=n(r);if(t<e)s=r+1;else if(t>e)a=r-1;else return r}return s>0?s-1:0};function jn({measurements:s,outerSize:a,scrollOffset:n,lanes:e}){const r=s.length-1,t=u=>s[u].start;if(s.length<=e)return{startIndex:0,endIndex:r};let o=Gt(0,r,t,n),i=o;if(e===1)for(;i<r&&s[i].end<n+a;)i++;else if(e>1){const u=Array(e).fill(0);for(;i<r&&u.some(d=>d<n+a);){const d=s[i];u[d.lane]=d.end,i++}const c=Array(e).fill(n+a);for(;o>=0&&c.some(d=>d>=n);){const d=s[o];c[d.lane]=d.start,o--}o=Math.max(0,o-o%e),i=Math.min(r,i+(e-1-i%e))}return{startIndex:o,endIndex:i}}const qt=typeof document<"u"?$t.useLayoutEffect:$t.useEffect;function Wn(s){const a=$t.useReducer(()=>({}),{})[1],n={...s,onChange:(r,t)=>{var o;t?Xt.flushSync(a):a(),(o=s.onChange)==null||o.call(s,r,t)}},[e]=$t.useState(()=>new _n(n));return e.setOptions(n),qt(()=>e._didMount(),[]),qt(()=>e._willUpdate()),e}function Bt(s){return Wn({observeElementRect:Cn,observeElementOffset:Ln,scrollToFn:Pn,...s})}function Nn({transformedTasks:s,bottomRowCells:a,scrollRef:n}){var d;const e=Bt({count:s.length,getScrollElement:()=>n.current,estimateSize:()=>vt,overscan:5}),r=Bt({horizontal:!0,count:a.length,getScrollElement:()=>n.current,estimateSize:f=>{var h;return((h=a[f])==null?void 0:h.widthPx)??32},overscan:5}),t=r.getVirtualItems(),o=((d=t[0])==null?void 0:d.start)??0,i=t[t.length-1],u=i?i.start+i.size:0,c=j.useMemo(()=>(f,h)=>f+h>=o&&f<=u,[o,u]);return j.useEffect(()=>{if(!a.length)return;const f=requestAnimationFrame(()=>{r.measure()});return()=>cancelAnimationFrame(f)},[a,r]),{rowVirtualizer:e,columnVirtualizer:r,isBarVisible:c}}function An(s,a="gantt-container"){const[n,e]=j.useState(()=>typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");j.useEffect(()=>{if(typeof window>"u")return;const i=window.matchMedia("(prefers-color-scheme: dark)"),u=c=>{e(c.matches?"dark":"light")};return i.addEventListener("change",u),()=>i.removeEventListener("change",u)},[]);const r=j.useMemo(()=>!s||s==="system"?n:s,[s,n]),t=j.useMemo(()=>{const i=[a];return s&&i.push(r),i.join(" ")},[a,s,r]);return{resolvedTheme:r,containerClassName:t,dataTheme:s?r:void 0}}const Fn=600,Hn="100%",Yn="month";function Un({tasks:s=[],onTasksChange:a,height:n=Fn,width:e=Hn,theme:r,defaultScale:t=Yn,className:o}){const{rawTasks:i,transformedTasks:u,bottomRowCells:c,selectedScale:d,setRawTasks:f,setTransformedTasks:h,setBottomRowCells:y,setSelectedScale:S,getTotalWidth:l}=kn(),v=j.useRef(null),{rowVirtualizer:p,isBarVisible:D}=Nn({transformedTasks:u,bottomRowCells:c,scrollRef:v}),{containerClassName:x,dataTheme:z}=An(r,o?`gantt-container ${o}`:"gantt-container");j.useEffect(()=>{t&&t!==d&&S(t)},[]),j.useEffect(()=>{s.length>0&&f(s)},[s,f]),j.useEffect(()=>{if(!i.length)return;const{bottomCells:$,transformedTasks:g}=$n(i,d);y($),h(g)},[i,d,y,h]);const R=$=>{S($)},k=l(),w={height:typeof n=="number"?`${n}px`:n,width:typeof e=="number"?`${e}px`:e};return P.jsxs("section",{className:x,"data-theme":z,style:w,children:[P.jsx("div",{className:"gantt-toolbar",children:P.jsx(wn,{selectedScale:d,onScaleChange:R})}),P.jsx("div",{className:"gantt-main",children:P.jsxs("div",{ref:v,className:"gantt-scroll-container",children:[P.jsx("div",{className:"gantt-header-wrapper",style:{width:`${k}px`},children:P.jsx(vn,{bottomRowCells:c,selectedScale:d,width:k,scrollRef:v})}),P.jsxs("div",{className:"gantt-content",style:{height:`${p.getTotalSize()}px`,width:`${k}px`},children:[P.jsx("div",{className:"gantt-rows",children:p.getVirtualItems().map($=>{const g=u[$.index];return P.jsx("div",{className:"gantt-task-row",style:{height:`${$.size-1}px`,transform:`translateY(${$.start}px)`}},`row-${g.id}`)})}),P.jsx(bn,{transformedTasks:u}),p.getVirtualItems().map($=>{const g=u[$.index],m=g.barLeft??0,T=g.barWidth??0;return D(m,T)?P.jsx("div",{style:{position:"absolute",top:0,left:0,height:`${$.size-1}px`,transform:`translateY(${$.start}px)`,display:"flex",alignItems:"center"},children:P.jsx(sn,{currentTask:g,onTasksChange:a})},g.id):null})]})]})})]})}exports.ReactGanttChart=Un;