@jaeungkim/gantt-chart 0.3.0 → 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 -2357
  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.0",
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 _=require("react/jsx-runtime"),N=require("react"),Gt=require("react-dom");function Xt(r){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(a,e,n.get?n:{enumerable:!0,get:()=>r[e]})}}return a.default=r,Object.freeze(a)}const gt=Xt(N),pt=38,Zt=5,Z={day:{labelUnit:"day",tickUnit:"hour",unitPerTick:1,dragStepUnit:"hour",dragStepAmount:1,basePxPerDragStep:32,formatTickLabel:r=>r.format("hh"),formatHeaderLabel:r=>r.format("MMM D")},week:{labelUnit:"month",tickUnit:"day",unitPerTick:1,dragStepUnit:"hour",dragStepAmount:6,basePxPerDragStep:54,formatTickLabel:r=>r.format("D"),formatHeaderLabel:r=>r.format("MMM")},month:{labelUnit:"month",tickUnit:"day",unitPerTick:1,dragStepUnit:"day",dragStepAmount:1,basePxPerDragStep:32,formatTickLabel:r=>r.format("D"),formatHeaderLabel:r=>r.format("MMM YYYY")},year:{labelUnit:"month",tickUnit:"month",unitPerTick:1,dragStepUnit:"day",dragStepAmount:7,basePxPerDragStep:28,formatTickLabel:r=>r.format("D"),formatHeaderLabel:r=>r.format("MMM YYYY")}},yt=r=>Symbol.iterator in r,St=r=>"entries"in r,xt=(r,a)=>{const e=r instanceof Map?r:new Map(r.entries()),n=a instanceof Map?a:new Map(a.entries());if(e.size!==n.size)return!1;for(const[s,t]of e)if(!n.has(s)||!Object.is(t,n.get(s)))return!1;return!0},Jt=(r,a)=>{const e=r[Symbol.iterator](),n=a[Symbol.iterator]();let s=e.next(),t=n.next();for(;!s.done&&!t.done;){if(!Object.is(s.value,t.value))return!1;s=e.next(),t=n.next()}return!!s.done&&!!t.done};function Kt(r,a){return Object.is(r,a)?!0:typeof r!="object"||r===null||typeof a!="object"||a===null||Object.getPrototypeOf(r)!==Object.getPrototypeOf(a)?!1:yt(r)&&yt(a)?St(r)&&St(a)?xt(r,a):Jt(r,a):xt({entries:()=>Object.entries(r)},{entries:()=>Object.entries(a)})}function Qt(r){const a=N.useRef(void 0);return e=>{const n=r(e);return Kt(a.current,n)?a.current:a.current=n}}const bt=r=>{let a;const e=new Set,n=(c,d)=>{const l=typeof c=="function"?c(a):c;if(!Object.is(l,a)){const h=a;a=d??(typeof l!="object"||l===null)?l:Object.assign({},a,l),e.forEach(x=>x(a,h))}},s=()=>a,i={setState:n,getState:s,getInitialState:()=>u,subscribe:c=>(e.add(c),()=>e.delete(c))},u=a=r(n,s,i);return i},te=(r=>r?bt(r):bt),ee=r=>r;function ne(r,a=ee){const e=N.useSyncExternalStore(r.subscribe,N.useCallback(()=>a(r.getState()),[r,a]),N.useCallback(()=>a(r.getInitialState()),[r,a]));return N.useDebugValue(e),e}const re=r=>{const a=te(r),e=n=>ne(a,n);return Object.assign(e,a),e},se=(r=>re);function qt(r,a){let e;try{e=r()}catch{return}return{getItem:s=>{var t;const o=u=>u===null?null:JSON.parse(u,void 0),i=(t=e.getItem(s))!=null?t:null;return i instanceof Promise?i.then(o):o(i)},setItem:(s,t)=>e.setItem(s,JSON.stringify(t,void 0)),removeItem:s=>e.removeItem(s)}}const vt=r=>a=>{try{const e=r(a);return e instanceof Promise?e:{then(n){return vt(n)(e)},catch(n){return this}}}catch(e){return{then(n){return this},catch(n){return vt(n)(e)}}}},ie=(r,a)=>(e,n,s)=>{let t={storage:qt(()=>localStorage),partialize:f=>f,version:0,merge:(f,S)=>({...S,...f}),...a},o=!1;const i=new Set,u=new Set;let c=t.storage;if(!c)return r((...f)=>{console.warn(`[zustand persist middleware] Unable to update item '${t.name}', the given storage is currently unavailable.`),e(...f)},n,s);const d=()=>{const f=t.partialize({...n()});return c.setItem(t.name,{state:f,version:t.version})},l=s.setState;s.setState=(f,S)=>(l(f,S),d());const h=r((...f)=>(e(...f),d()),n,s);s.getInitialState=()=>h;let x;const y=()=>{var f,S;if(!c)return;o=!1,i.forEach(b=>{var g;return b((g=n())!=null?g:h)});const D=((S=t.onRehydrateStorage)==null?void 0:S.call(t,(f=n())!=null?f:h))||void 0;return vt(c.getItem.bind(c))(t.name).then(b=>{if(b)if(typeof b.version=="number"&&b.version!==t.version){if(t.migrate){const g=t.migrate(b.state,b.version);return g instanceof Promise?g.then(z=>[!0,z]):[!0,g]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,b.state];return[!1,void 0]}).then(b=>{var g;const[z,R]=b;if(x=t.merge(R,(g=n())!=null?g:h),e(x,!0),z)return d()}).then(()=>{D==null||D(x,void 0),x=n(),o=!0,u.forEach(b=>b(x))}).catch(b=>{D==null||D(void 0,b)})};return s.persist={setOptions:f=>{t={...t,...f},f.storage&&(c=f.storage)},clearStorage:()=>{c==null||c.removeItem(t.name)},getOptions:()=>t,rehydrate:()=>y(),hasHydrated:()=>o,onHydrate:f=>(i.add(f),()=>{i.delete(f)}),onFinishHydration:f=>(u.add(f),()=>{u.delete(f)})},t.skipHydration||y(),x||h},oe=ie,et=se()(oe((r,a)=>({rawTasks:[],transformedTasks:[],bottomRowCells:[],selectedScale:"month",currentTask:null,dragOffsets:{},setCurrentTask:e=>r({currentTask:e}),setSelectedScale:e=>r({selectedScale:e}),setRawTasks:e=>r({rawTasks:e}),setBottomRowCells:e=>r({bottomRowCells:e}),setTransformedTasks:e=>r({transformedTasks:e}),setDragOffset:(e,n)=>r(s=>({dragOffsets:{...s.dragOffsets,[e]:n}})),clearDragOffset:e=>r(n=>{const{[e]:s,...t}=n.dragOffsets;return{dragOffsets:t}}),getCurrentDragOffset:e=>a().dragOffsets[e]||null,getTotalWidth:()=>a().bottomRowCells.reduce((n,s)=>n+s.widthPx,0)}),{name:"gantt-storage",storage:qt(()=>sessionStorage),partialize:r=>({selectedScale:r.selectedScale})}));function Bt(){return et(Qt(r=>({rawTasks:r.rawTasks,transformedTasks:r.transformedTasks,bottomRowCells:r.bottomRowCells,selectedScale:r.selectedScale,currentTask:r.currentTask,dragOffsets:r.dragOffsets,setRawTasks:r.setRawTasks,setTransformedTasks:r.setTransformedTasks,setBottomRowCells:r.setBottomRowCells,setSelectedScale:r.setSelectedScale,setCurrentTask:r.setCurrentTask,setDragOffset:r.setDragOffset,clearDragOffset:r.clearDragOffset,getTotalWidth:r.getTotalWidth,getCurrentDragOffset:r.getCurrentDragOffset})))}function q(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var rt={exports:{}},ae=rt.exports,Mt;function ue(){return Mt||(Mt=1,(function(r,a){(function(e,n){r.exports=n()})(ae,(function(){var e=1e3,n=6e4,s=36e5,t="millisecond",o="second",i="minute",u="hour",c="day",d="week",l="month",h="quarter",x="year",y="date",f="Invalid Date",S=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,D=/\[([^\]]+)]|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,b={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"],M=E%100;return"["+E+(O[(M-20)%10]||O[M]||O[0])+"]"}},g=function(E,O,M){var I=String(E);return!I||I.length>=O?E:""+Array(O+1-I.length).join(M)+E},z={s:g,z:function(E){var O=-E.utcOffset(),M=Math.abs(O),I=Math.floor(M/60),w=M%60;return(O<=0?"+":"-")+g(I,2,"0")+":"+g(w,2,"0")},m:function E(O,M){if(O.date()<M.date())return-E(M,O);var I=12*(M.year()-O.year())+(M.month()-O.month()),w=O.clone().add(I,l),C=M-w<0,L=O.clone().add(I+(C?-1:1),l);return+(-(I+(M-w)/(C?w-L:L-w))||0)},a:function(E){return E<0?Math.ceil(E)||0:Math.floor(E)},p:function(E){return{M:l,y:x,w:d,d:c,D:y,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",T={};T[R]=b;var v="$isDayjsObject",p=function(E){return E instanceof P||!(!E||!E[v])},$=function E(O,M,I){var w;if(!O)return R;if(typeof O=="string"){var C=O.toLowerCase();T[C]&&(w=C),M&&(T[C]=M,w=C);var L=O.split("-");if(!w&&L.length>1)return E(L[0])}else{var j=O.name;T[j]=O,w=j}return!I&&w&&(R=w),w||!I&&R},m=function(E,O){if(p(E))return E.clone();var M=typeof O=="object"?O:{};return M.date=E,M.args=arguments,new P(M)},k=z;k.l=$,k.i=p,k.w=function(E,O){return m(E,{locale:O.$L,utc:O.$u,x:O.$x,$offset:O.$offset})};var P=(function(){function E(M){this.$L=$(M.locale,null,!0),this.parse(M),this.$x=this.$x||M.x||{},this[v]=!0}var O=E.prototype;return O.parse=function(M){this.$d=(function(I){var w=I.date,C=I.utc;if(w===null)return new Date(NaN);if(k.u(w))return new Date;if(w instanceof Date)return new Date(w);if(typeof w=="string"&&!/Z$/i.test(w)){var L=w.match(S);if(L){var j=L[2]-1||0,F=(L[7]||"0").substring(0,3);return C?new Date(Date.UTC(L[1],j,L[3]||1,L[4]||0,L[5]||0,L[6]||0,F)):new Date(L[1],j,L[3]||1,L[4]||0,L[5]||0,L[6]||0,F)}}return new Date(w)})(M),this.init()},O.init=function(){var M=this.$d;this.$y=M.getFullYear(),this.$M=M.getMonth(),this.$D=M.getDate(),this.$W=M.getDay(),this.$H=M.getHours(),this.$m=M.getMinutes(),this.$s=M.getSeconds(),this.$ms=M.getMilliseconds()},O.$utils=function(){return k},O.isValid=function(){return this.$d.toString()!==f},O.isSame=function(M,I){var w=m(M);return this.startOf(I)<=w&&w<=this.endOf(I)},O.isAfter=function(M,I){return m(M)<this.startOf(I)},O.isBefore=function(M,I){return this.endOf(I)<m(M)},O.$g=function(M,I,w){return k.u(M)?this[I]:this.set(w,M)},O.unix=function(){return Math.floor(this.valueOf()/1e3)},O.valueOf=function(){return this.$d.getTime()},O.startOf=function(M,I){var w=this,C=!!k.u(I)||I,L=k.p(M),j=function(X,U){var V=k.w(w.$u?Date.UTC(w.$y,U,X):new Date(w.$y,U,X),w);return C?V:V.endOf(c)},F=function(X,U){return k.w(w.toDate()[X].apply(w.toDate("s"),(C?[0,0,0,0]:[23,59,59,999]).slice(U)),w)},H=this.$W,Y=this.$M,B=this.$D,J="set"+(this.$u?"UTC":"");switch(L){case x:return C?j(1,0):j(31,11);case l:return C?j(1,Y):j(0,Y+1);case d:var G=this.$locale().weekStart||0,Q=(H<G?H+7:H)-G;return j(C?B-Q:B+(6-Q),Y);case c:case y:return F(J+"Hours",0);case u:return F(J+"Minutes",1);case i:return F(J+"Seconds",2);case o:return F(J+"Milliseconds",3);default:return this.clone()}},O.endOf=function(M){return this.startOf(M,!1)},O.$set=function(M,I){var w,C=k.p(M),L="set"+(this.$u?"UTC":""),j=(w={},w[c]=L+"Date",w[y]=L+"Date",w[l]=L+"Month",w[x]=L+"FullYear",w[u]=L+"Hours",w[i]=L+"Minutes",w[o]=L+"Seconds",w[t]=L+"Milliseconds",w)[C],F=C===c?this.$D+(I-this.$W):I;if(C===l||C===x){var H=this.clone().set(y,1);H.$d[j](F),H.init(),this.$d=H.set(y,Math.min(this.$D,H.daysInMonth())).$d}else j&&this.$d[j](F);return this.init(),this},O.set=function(M,I){return this.clone().$set(M,I)},O.get=function(M){return this[k.p(M)]()},O.add=function(M,I){var w,C=this;M=Number(M);var L=k.p(I),j=function(Y){var B=m(C);return k.w(B.date(B.date()+Math.round(Y*M)),C)};if(L===l)return this.set(l,this.$M+M);if(L===x)return this.set(x,this.$y+M);if(L===c)return j(1);if(L===d)return j(7);var F=(w={},w[i]=n,w[u]=s,w[o]=e,w)[L]||1,H=this.$d.getTime()+M*F;return k.w(H,this)},O.subtract=function(M,I){return this.add(-1*M,I)},O.format=function(M){var I=this,w=this.$locale();if(!this.isValid())return w.invalidDate||f;var C=M||"YYYY-MM-DDTHH:mm:ssZ",L=k.z(this),j=this.$H,F=this.$m,H=this.$M,Y=w.weekdays,B=w.months,J=w.meridiem,G=function(U,V,tt,nt){return U&&(U[V]||U(I,C))||tt[V].slice(0,nt)},Q=function(U){return k.s(j%12||12,U,"0")},X=J||function(U,V,tt){var nt=U<12?"AM":"PM";return tt?nt.toLowerCase():nt};return C.replace(D,(function(U,V){return V||(function(tt){switch(tt){case"YY":return String(I.$y).slice(-2);case"YYYY":return k.s(I.$y,4,"0");case"M":return H+1;case"MM":return k.s(H+1,2,"0");case"MMM":return G(w.monthsShort,H,B,3);case"MMMM":return G(B,H);case"D":return I.$D;case"DD":return k.s(I.$D,2,"0");case"d":return String(I.$W);case"dd":return G(w.weekdaysMin,I.$W,Y,2);case"ddd":return G(w.weekdaysShort,I.$W,Y,3);case"dddd":return Y[I.$W];case"H":return String(j);case"HH":return k.s(j,2,"0");case"h":return Q(1);case"hh":return Q(2);case"a":return X(j,F,!0);case"A":return X(j,F,!1);case"m":return String(F);case"mm":return k.s(F,2,"0");case"s":return String(I.$s);case"ss":return k.s(I.$s,2,"0");case"SSS":return k.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(M,I,w){var C,L=this,j=k.p(I),F=m(M),H=(F.utcOffset()-this.utcOffset())*n,Y=this-F,B=function(){return k.m(L,F)};switch(j){case x:C=B()/12;break;case l:C=B();break;case h:C=B()/3;break;case d:C=(Y-H)/6048e5;break;case c:C=(Y-H)/864e5;break;case u:C=Y/s;break;case i:C=Y/n;break;case o:C=Y/e;break;default:C=Y}return w?C:k.a(C)},O.daysInMonth=function(){return this.endOf(l).$D},O.$locale=function(){return T[this.$L]},O.locale=function(M,I){if(!M)return this.$L;var w=this.clone(),C=$(M,I,!0);return C&&(w.$L=C),w},O.clone=function(){return k.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})(),A=P.prototype;return m.prototype=A,[["$ms",t],["$s",o],["$m",i],["$H",u],["$W",c],["$M",l],["$y",x],["$D",y]].forEach((function(E){A[E[1]]=function(O){return this.$g(O,E[0],E[1])}})),m.extend=function(E,O){return E.$i||(E(O,P,m),E.$i=!0),m},m.locale=$,m.isDayjs=p,m.unix=function(E){return m(1e3*E)},m.en=T[R],m.Ls=T,m.p={},m}))})(rt)),rt.exports}var ce=ue();const W=q(ce);var st={exports:{}},le=st.exports,wt;function fe(){return wt||(wt=1,(function(r,a){(function(e,n){r.exports=n()})(le,(function(){var e,n,s=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,l=/^(-|\+)?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:s,milliseconds:1,weeks:6048e5},x=function(T){return T instanceof z},y=function(T,v,p){return new z(T,p,v.$l)},f=function(T){return n.p(T)+"s"},S=function(T){return T<0},D=function(T){return S(T)?Math.ceil(T):Math.floor(T)},b=function(T){return Math.abs(T)},g=function(T,v){return T?S(T)?{negative:!0,format:""+b(T)+v}:{negative:!1,format:""+T+v}:{negative:!1,format:""}},z=(function(){function T(p,$,m){var k=this;if(this.$d={},this.$l=m,p===void 0&&(this.$ms=0,this.parseFromMilliseconds()),$)return y(p*h[f($)],this);if(typeof p=="number")return this.$ms=p,this.parseFromMilliseconds(),this;if(typeof p=="object")return Object.keys(p).forEach((function(E){k.$d[f(E)]=p[E]})),this.calMilliseconds(),this;if(typeof p=="string"){var P=p.match(l);if(P){var A=P.slice(2).map((function(E){return E!=null?Number(E):0}));return this.$d.years=A[0],this.$d.months=A[1],this.$d.weeks=A[2],this.$d.days=A[3],this.$d.hours=A[4],this.$d.minutes=A[5],this.$d.seconds=A[6],this.calMilliseconds(),this}}return this}var v=T.prototype;return v.calMilliseconds=function(){var p=this;this.$ms=Object.keys(this.$d).reduce((function($,m){return $+(p.$d[m]||0)*h[m]}),0)},v.parseFromMilliseconds=function(){var p=this.$ms;this.$d.years=D(p/c),p%=c,this.$d.months=D(p/d),p%=d,this.$d.days=D(p/i),p%=i,this.$d.hours=D(p/o),p%=o,this.$d.minutes=D(p/t),p%=t,this.$d.seconds=D(p/s),p%=s,this.$d.milliseconds=p},v.toISOString=function(){var p=g(this.$d.years,"Y"),$=g(this.$d.months,"M"),m=+this.$d.days||0;this.$d.weeks&&(m+=7*this.$d.weeks);var k=g(m,"D"),P=g(this.$d.hours,"H"),A=g(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=g(E,"S"),M=p.negative||$.negative||k.negative||P.negative||A.negative||O.negative,I=P.format||A.format||O.format?"T":"",w=(M?"-":"")+"P"+p.format+$.format+k.format+I+P.format+A.format+O.format;return w==="P"||w==="-P"?"P0D":w},v.toJSON=function(){return this.toISOString()},v.format=function(p){var $=p||"YYYY-MM-DDTHH:mm:ss",m={Y:this.$d.years,YY:n.s(this.$d.years,2,"0"),YYYY:n.s(this.$d.years,4,"0"),M:this.$d.months,MM:n.s(this.$d.months,2,"0"),D:this.$d.days,DD:n.s(this.$d.days,2,"0"),H:this.$d.hours,HH:n.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:n.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:n.s(this.$d.seconds,2,"0"),SSS:n.s(this.$d.milliseconds,3,"0")};return $.replace(u,(function(k,P){return P||String(m[k])}))},v.as=function(p){return this.$ms/h[f(p)]},v.get=function(p){var $=this.$ms,m=f(p);return m==="milliseconds"?$%=1e3:$=m==="weeks"?D($/h[m]):this.$d[m],$||0},v.add=function(p,$,m){var k;return k=$?p*h[f($)]:x(p)?p.$ms:y(p,this).$ms,y(this.$ms+k*(m?-1:1),this)},v.subtract=function(p,$){return this.add(p,$,!0)},v.locale=function(p){var $=this.clone();return $.$l=p,$},v.clone=function(){return y(this.$ms,this)},v.humanize=function(p){return e().add(this.$ms,"ms").locale(this.$l).fromNow(!p)},v.valueOf=function(){return this.asMilliseconds()},v.milliseconds=function(){return this.get("milliseconds")},v.asMilliseconds=function(){return this.as("milliseconds")},v.seconds=function(){return this.get("seconds")},v.asSeconds=function(){return this.as("seconds")},v.minutes=function(){return this.get("minutes")},v.asMinutes=function(){return this.as("minutes")},v.hours=function(){return this.get("hours")},v.asHours=function(){return this.as("hours")},v.days=function(){return this.get("days")},v.asDays=function(){return this.as("days")},v.weeks=function(){return this.get("weeks")},v.asWeeks=function(){return this.as("weeks")},v.months=function(){return this.get("months")},v.asMonths=function(){return this.as("months")},v.years=function(){return this.get("years")},v.asYears=function(){return this.as("years")},T})(),R=function(T,v,p){return T.add(v.years()*p,"y").add(v.months()*p,"M").add(v.days()*p,"d").add(v.hours()*p,"h").add(v.minutes()*p,"m").add(v.seconds()*p,"s").add(v.milliseconds()*p,"ms")};return function(T,v,p){e=p,n=p().$utils(),p.duration=function(k,P){var A=p.locale();return y(k,{$l:A},P)},p.isDuration=x;var $=v.prototype.add,m=v.prototype.subtract;v.prototype.add=function(k,P){return x(k)?R(this,k,1):$.bind(this)(k,P)},v.prototype.subtract=function(k,P){return x(k)?R(this,k,-1):m.bind(this)(k,P)}}}))})(st)),st.exports}var de=fe();const he=q(de);var it={exports:{}},me=it.exports,Dt;function $e(){return Dt||(Dt=1,(function(r,a){(function(e,n){r.exports=n()})(me,(function(){return function(e,n,s){n.prototype.isBetween=function(t,o,i,u){var c=s(t),d=s(o),l=(u=u||"()")[0]==="(",h=u[1]===")";return(l?this.isAfter(c,i):!this.isBefore(c,i))&&(h?this.isBefore(d,i):!this.isAfter(d,i))||(l?this.isBefore(c,i):!this.isAfter(c,i))&&(h?this.isAfter(d,i):!this.isBefore(d,i))}}}))})(it)),it.exports}var ge=$e();const pe=q(ge);var ot={exports:{}},ve=ot.exports,Ot;function ye(){return Ot||(Ot=1,(function(r,a){(function(e,n){r.exports=n()})(ve,(function(){var e="day";return function(n,s,t){var o=function(c){return c.add(4-c.isoWeekday(),e)},i=s.prototype;i.isoWeekYear=function(){return o(this).year()},i.isoWeek=function(c){if(!this.$utils().u(c))return this.add(7*(c-this.isoWeek()),e);var d,l,h,x,y=o(this),f=(d=this.isoWeekYear(),l=this.$u,h=(l?t.utc:t)().year(d).startOf("year"),x=4-h.isoWeekday(),h.isoWeekday()>4&&(x+=7),h.add(x,e));return y.diff(f,"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 l=this.$utils(),h=!!l.u(d)||d;return l.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)}}}))})(ot)),ot.exports}var Se=ye();const xe=q(Se);var at={exports:{}},be=at.exports,kt;function Me(){return kt||(kt=1,(function(r,a){(function(e,n){r.exports=n()})(be,(function(){return function(e,n){n.prototype.isSameOrAfter=function(s,t){return this.isSame(s,t)||this.isAfter(s,t)}}}))})(at)),at.exports}var we=Me();const De=q(we);var ut={exports:{}},Oe=ut.exports,Tt;function ke(){return Tt||(Tt=1,(function(r,a){(function(e,n){r.exports=n()})(Oe,(function(){return function(e,n){n.prototype.isSameOrBefore=function(s,t){return this.isSame(s,t)||this.isBefore(s,t)}}}))})(ut)),ut.exports}var Te=ke();const Ee=q(Te);var ct={exports:{}},Ie=ct.exports,Et;function ze(){return Et||(Et=1,(function(r,a){(function(e,n){r.exports=n()})(Ie,(function(){return function(e,n,s){n.prototype.isToday=function(){var t="YYYY-MM-DD",o=s();return this.format(t)===o.format(t)}}}))})(ct)),ct.exports}var Ce=ze();const Le=q(Ce);var lt={exports:{}},Re=lt.exports,It;function _e(){return It||(It=1,(function(r,a){(function(e,n){r.exports=n()})(Re,(function(){return function(e,n,s){var t=n.prototype,o=function(l){return l&&(l.indexOf?l:l.s)},i=function(l,h,x,y,f){var S=l.name?l:l.$locale(),D=o(S[h]),b=o(S[x]),g=D||b.map((function(R){return R.slice(0,y)}));if(!f)return g;var z=S.weekStart;return g.map((function(R,T){return g[(T+(z||0))%7]}))},u=function(){return s.Ls[s.locale()]},c=function(l,h){return l.formats[h]||(function(x){return x.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(y,f,S){return f||S.slice(1)}))})(l.formats[h.toUpperCase()])},d=function(){var l=this;return{months:function(h){return h?h.format("MMMM"):i(l,"months")},monthsShort:function(h){return h?h.format("MMM"):i(l,"monthsShort","months",3)},firstDayOfWeek:function(){return l.$locale().weekStart||0},weekdays:function(h){return h?h.format("dddd"):i(l,"weekdays")},weekdaysMin:function(h){return h?h.format("dd"):i(l,"weekdaysMin","weekdays",2)},weekdaysShort:function(h){return h?h.format("ddd"):i(l,"weekdaysShort","weekdays",3)},longDateFormat:function(h){return c(l.$locale(),h)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};t.localeData=function(){return d.bind(this)()},s.localeData=function(){var l=u();return{firstDayOfWeek:function(){return l.weekStart||0},weekdays:function(){return s.weekdays()},weekdaysShort:function(){return s.weekdaysShort()},weekdaysMin:function(){return s.weekdaysMin()},months:function(){return s.months()},monthsShort:function(){return s.monthsShort()},longDateFormat:function(h){return c(l,h)},meridiem:l.meridiem,ordinal:l.ordinal}},s.months=function(){return i(u(),"months")},s.monthsShort=function(){return i(u(),"monthsShort","months",3)},s.weekdays=function(l){return i(u(),"weekdays",null,null,l)},s.weekdaysShort=function(l){return i(u(),"weekdaysShort","weekdays",3,l)},s.weekdaysMin=function(l){return i(u(),"weekdaysMin","weekdays",2,l)}}}))})(lt)),lt.exports}var je=_e();const Pe=q(je);var ft={exports:{}},We=ft.exports,zt;function Ne(){return zt||(zt=1,(function(r,a){(function(e,n){r.exports=n()})(We,(function(){return function(e,n,s){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};s.max=function(){var o=[].slice.call(arguments,0);return t("isAfter",o)},s.min=function(){var o=[].slice.call(arguments,0);return t("isBefore",o)}}}))})(ft)),ft.exports}var Fe=Ne();const He=q(Fe);var dt={exports:{}},Ae=dt.exports,Ct;function Ye(){return Ct||(Ct=1,(function(r,a){(function(e,n){r.exports=n()})(Ae,(function(){var e={year:0,month:1,day:2,hour:3,minute:4,second:5},n={};return function(s,t,o){var i,u=function(h,x,y){y===void 0&&(y={});var f=new Date(h),S=(function(D,b){b===void 0&&(b={});var g=b.timeZoneName||"short",z=D+"|"+g,R=n[z];return R||(R=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:D,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:g}),n[z]=R),R})(x,y);return S.formatToParts(f)},c=function(h,x){for(var y=u(h,x),f=[],S=0;S<y.length;S+=1){var D=y[S],b=D.type,g=D.value,z=e[b];z>=0&&(f[z]=parseInt(g,10))}var R=f[3],T=R===24?0:R,v=f[0]+"-"+f[1]+"-"+f[2]+" "+T+":"+f[4]+":"+f[5]+":000",p=+h;return(o.utc(v).valueOf()-(p-=p%1e3))/6e4},d=t.prototype;d.tz=function(h,x){h===void 0&&(h=i);var y,f=this.utcOffset(),S=this.toDate(),D=S.toLocaleString("en-US",{timeZone:h}),b=Math.round((S-new Date(D))/1e3/60),g=15*-Math.round(S.getTimezoneOffset()/15)-b;if(!Number(g))y=this.utcOffset(0,x);else if(y=o(D,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(g,!0),x){var z=y.utcOffset();y=y.add(f-z,"minute")}return y.$x.$timezone=h,y},d.offsetName=function(h){var x=this.$x.$timezone||o.tz.guess(),y=u(this.valueOf(),x,{timeZoneName:h}).find((function(f){return f.type.toLowerCase()==="timezonename"}));return y&&y.value};var l=d.startOf;d.startOf=function(h,x){if(!this.$x||!this.$x.$timezone)return l.call(this,h,x);var y=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return l.call(y,h,x).tz(this.$x.$timezone,!0)},o.tz=function(h,x,y){var f=y&&x,S=y||x||i,D=c(+o(),S);if(typeof h!="string")return o(h).tz(S);var b=(function(T,v,p){var $=T-60*v*1e3,m=c($,p);if(v===m)return[$,v];var k=c($-=60*(m-v)*1e3,p);return m===k?[$,m]:[T-60*Math.min(m,k)*1e3,Math.max(m,k)]})(o.utc(h,f).valueOf(),D,S),g=b[0],z=b[1],R=o(g).utcOffset(z);return R.$x.$timezone=S,R},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(h){i=h}}}))})(dt)),dt.exports}var Ue=Ye();const qe=q(Ue);var ht={exports:{}},Be=ht.exports,Lt;function Ve(){return Lt||(Lt=1,(function(r,a){(function(e,n){r.exports=n()})(Be,(function(){return function(e,n,s){s.updateLocale=function(t,o){var i=s.Ls[t];if(i)return(o?Object.keys(o):[]).forEach((function(u){i[u]=o[u]})),i}}}))})(ht)),ht.exports}var Ge=Ve();const Xe=q(Ge);var mt={exports:{}},Ze=mt.exports,Rt;function Je(){return Rt||(Rt=1,(function(r,a){(function(e,n){r.exports=n()})(Ze,(function(){var e="minute",n=/[+-]\d\d(?::?\d\d)?/g,s=/([+-]|\d\d)/g;return function(t,o,i){var u=o.prototype;i.utc=function(f){var S={date:f,utc:!0,args:arguments};return new o(S)},u.utc=function(f){var S=i(this.toDate(),{locale:this.$L,utc:!0});return f?S.add(this.utcOffset(),e):S},u.local=function(){return i(this.toDate(),{locale:this.$L,utc:!1})};var c=u.parse;u.parse=function(f){f.utc&&(this.$u=!0),this.$utils().u(f.$offset)||(this.$offset=f.$offset),c.call(this,f)};var d=u.init;u.init=function(){if(this.$u){var f=this.$d;this.$y=f.getUTCFullYear(),this.$M=f.getUTCMonth(),this.$D=f.getUTCDate(),this.$W=f.getUTCDay(),this.$H=f.getUTCHours(),this.$m=f.getUTCMinutes(),this.$s=f.getUTCSeconds(),this.$ms=f.getUTCMilliseconds()}else d.call(this)};var l=u.utcOffset;u.utcOffset=function(f,S){var D=this.$utils().u;if(D(f))return this.$u?0:D(this.$offset)?l.call(this):this.$offset;if(typeof f=="string"&&(f=(function(R){R===void 0&&(R="");var T=R.match(n);if(!T)return null;var v=(""+T[0]).match(s)||["-",0,0],p=v[0],$=60*+v[1]+ +v[2];return $===0?0:p==="+"?$:-$})(f),f===null))return this;var b=Math.abs(f)<=16?60*f:f;if(b===0)return this.utc(S);var g=this.clone();if(S)return g.$offset=b,g.$u=!1,g;var z=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(g=this.local().add(b+z,e)).$offset=b,g.$x.$localOffset=z,g};var h=u.format;u.format=function(f){var S=f||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,S)},u.valueOf=function(){var f=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*f},u.isUTC=function(){return!!this.$u},u.toISOString=function(){return this.toDate().toISOString()},u.toString=function(){return this.toDate().toUTCString()};var x=u.toDate;u.toDate=function(f){return f==="s"&&this.$offset?i(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():x.call(this)};var y=u.diff;u.diff=function(f,S,D){if(f&&this.$u===f.$u)return y.call(this,f,S,D);var b=this.local(),g=i(f).local();return y.call(b,g,S,D)}}}))})(mt)),mt.exports}var Ke=Je();const Qe=q(Ke);var $t={exports:{}},tn=$t.exports,_t;function en(){return _t||(_t=1,(function(r,a){(function(e,n){r.exports=n()})(tn,(function(){return function(e,n){n.prototype.weekday=function(s){var t=this.$locale().weekStart||0,o=this.$W,i=(o<t?o+7:o)-t;return this.$utils().u(s)?i:this.subtract(i,"day").add(s,"day")}}}))})($t)),$t.exports}var nn=en();const rn=q(nn);W.extend(He);W.extend(he);W.extend(rn);W.extend(Le);W.extend(Qe);W.extend(qe);W.extend(De);W.extend(Ee);W.extend(pe);W.extend(Pe);W.extend(Xe);W.extend(xe);const sn={minute:1,hour:60,day:1440,week:1440*7,month:1440*30},on=(r,a,e,n)=>a==="left"?Math.min(r,e-n):a==="right"?Math.max(r,-e+n):r,an=(r,a,e)=>a==="left"&&r<0?Math.floor(r/e)*e:a==="right"&&r>0?Math.ceil(r/e)*e:r,un=(r,a,e,n)=>{const s={offsetStartDate:e,offsetEndDate:n};switch(r){case"bar":return{...s,offsetX:a,offsetWidth:0};case"left":return{...s,offsetX:a,offsetWidth:-a};case"right":return{...s,offsetX:0,offsetWidth:a};default:return{...s,offsetX:0,offsetWidth:0}}},jt=8,cn=r=>{const e=r.currentTarget.getBoundingClientRect(),n=r.clientX-e.left;return n<=jt?"left":n>=e.width-jt?"right":"bar"};function ln(r,a){const{rawTasks:e,selectedScale:n,setCurrentTask:s,setDragOffset:t,clearDragOffset:o,setRawTasks:i}=Bt(),u=N.useRef(null),c=N.useRef(null),d=Z[n],{basePxPerDragStep:l,dragStepAmount:h,dragStepUnit:x}=d,y=h*sn[x]/l,f=b=>{const g=u.current;if(!g)return;let z=b.clientX-g.initialClientX;z=on(z,g.mode,r.barWidth,l),z=an(z,g.mode,l);const R=Math.round(z/g.basePxPerDragStep);if(R===g.dragSteps)return;g.dragSteps=R;const T=R*g.basePxPerDragStep,v=T*g.minutesPerPixel,p=g.mode==="right"?g.initialStartDate:g.initialStartDate.add(v,"minute"),$=g.mode==="left"?g.initialEndDate:g.initialEndDate.add(v,"minute");t(r.id,un(g.mode,T,p,$))},S=()=>{var T;document.removeEventListener("pointermove",f),document.removeEventListener("pointerup",S),document.removeEventListener("pointercancel",S);const b=u.current;if(!b)return;const g=v=>v.add(b.dragSteps*h,x).toISOString(),z=e.map(v=>{if(v.id!==r.id)return v;switch(b.mode){case"bar":return{...v,startDate:g(W(v.startDate)),endDate:g(W(v.endDate))};case"left":return{...v,startDate:g(W(v.startDate))};case"right":return{...v,endDate:g(W(v.endDate))};default:return v}});i(z),a==null||a(z);const R=c.current;R!==null&&((T=document.getElementById(`task-${r.id}`))==null||T.releasePointerCapture(R)),c.current=null,u.current=null,s(null),o(r.id)};return{onPointerDown:b=>{const g=cn(b);u.current={mode:g,initialClientX:b.clientX,initialStartDate:W(r.startDate),initialEndDate:W(r.endDate),dragSteps:0,basePxPerDragStep:l,minutesPerPixel:y},s(r),b.currentTarget.setPointerCapture(b.pointerId),c.current=b.pointerId,document.addEventListener("pointermove",f),document.addEventListener("pointerup",S),document.addEventListener("pointercancel",S)}}}const Pt=8,fn={day:"MMM D, h A",week:"MMM D",month:"MMM D",year:"MMM YYYY"};function dn({currentTask:r,onTasksChange:a}){const e=N.useRef(null),{onPointerDown:n}=ln(r,a),[s,t]=N.useState("grab"),o=et(D=>D.dragOffsets[r.id]),i=et(D=>{var b;return((b=D.currentTask)==null?void 0:b.id)===r.id}),u=et(D=>D.selectedScale),c=(o==null?void 0:o.offsetX)??0,d=(o==null?void 0:o.offsetWidth)??0,l=r.barLeft+c,h=r.barWidth+d,x=N.useCallback(D=>{const b=e.current;if(!b)return;const g=b.getBoundingClientRect(),z=D.clientX-g.left;z<=Pt||z>=g.width-Pt?t("ew-resize"):t("grab")},[]),y=fn[u],f=o==null?void 0:o.offsetStartDate.format(y),S=o==null?void 0:o.offsetEndDate.format(y);return _.jsxs("div",{ref:e,id:`task-${r.id}`,className:`gantt-task-bar ${i?"dragging":""}`,onPointerDown:n,onMouseMove:x,onMouseLeave:()=>t("grab"),style:{transform:`translateX(${l}px)`,width:h,height:pt/2,cursor:i?"grabbing":s},role:"button",tabIndex:0,"aria-label":`Task: ${r.name}`,children:[_.jsx("span",{className:"gantt-task-name",children:r.name}),i&&o&&_.jsxs("div",{className:"gantt-bar-tooltip",role:"status","aria-live":"polite",children:[f," → ",S]})]})}function hn(r){const a=[];for(const e of r){const n=a[a.length-1];n&&n.label===e.label?n.widthPx+=e.widthPx:a.push({...e})}return a}function mn(r){let a=0;return r.map(e=>{const n={...e,left:a};return a+=e.widthPx,n})}function $n(r){const a=hn(r);return mn(a)}function Wt(r){return r.split(".").map(Number)}function gn(r){return[...r].sort((a,e)=>{const n=Wt(a.sequence),s=Wt(e.sequence),t=Math.max(n.length,s.length);for(let o=0;o<t;o++){const i=n[o]||0,u=s[o]||0;if(i!==u)return i-u}return 0})}function pn(r){return r.split(".").length-1}function vn(r,a,e){return gn(r).map((s,t)=>{const o=pn(s.sequence),i=t+1,{barMarginLeftAmount:u,barWidthSize:c}=yn(W(s.startDate),W(s.endDate),a,e);return{...s,barLeft:u,barWidth:c,depth:o,order:i,originalOrder:i}})}function yn(r,a,e,n){if(!e.length)return{barMarginLeftAmount:0,barWidthSize:0};const s=Z[n],{tickUnit:t,unitPerTick:o}=s;let i=0,u=0,c=!1;const d=r.valueOf(),l=a.valueOf();for(const h of e){const x=h.startDate,y=x.add(o,t),f=h.widthPx,S=x.valueOf(),D=y.valueOf();if(D<=d){i+=f;continue}if(S>=l)break;const b=d>S?r:x,g=l<D?a:y,z=D-S,T=(g.valueOf()-b.valueOf())/z;if(!c&&b.valueOf()>S){const v=(b.valueOf()-S)/z;i+=v*f}u+=T*f,c=!0}return{barMarginLeftAmount:i,barWidthSize:Math.max(u,1)}}function Sn(r){let a=1/0,e=-1/0;for(const n of r){const s=W(n.startDate).valueOf(),t=W(n.endDate).valueOf();Number.isNaN(s)||(a=Math.min(a,s)),Number.isNaN(t)||(e=Math.max(e,t))}return{minDate:W(a),maxDate:W(e)}}function xn(r,a,e){const n=Z[e],{tickUnit:s,unitPerTick:t}=n,o=Zt*t;return{paddedMinDate:r.subtract(o,s),paddedMaxDate:a.add(o,s)}}function bn(r,a,e){const n=Z[e],{tickUnit:s,unitPerTick:t,basePxPerDragStep:o,dragStepUnit:i,dragStepAmount:u}=n,c=[];let d=r.startOf(s);const l=a.valueOf(),h=o/u;for(;d.valueOf()<l;){const x=d.add(t,s),f=x.diff(d,i)*h;c.push({startDate:d,widthPx:f}),d=x}return c}function Mn(r,a){const e=Z[a],{labelUnit:n,formatHeaderLabel:s}=e;if(r.length===0)return[];const t=[];let o=null;for(const i of r){const u=i.startDate.startOf(n),c=u.valueOf(),d=(s==null?void 0:s(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 wn(r,a){if(!r.length)return{bottomCells:[],transformedTasks:[]};const{minDate:e,maxDate:n}=Sn(r),{paddedMinDate:s,paddedMaxDate:t}=xn(e,n,a),o=bn(s,t,a),i=vn(r,o,a);return{bottomCells:o,transformedTasks:i}}function Dn({bottomRowCells:r,selectedScale:a,width:e,scrollRef:n}){const s=Z[a],[t,o]=N.useState(0),i=N.useMemo(()=>{const u=Mn(r,a);return $n(u)},[r,a]);return N.useEffect(()=>{const u=n.current;if(!u)return;const c=()=>{const d=u.scrollLeft;for(let l=i.length-1;l>=0;l--)if(d>=i[l].left){o(l);break}};return u.addEventListener("scroll",c),c(),()=>u.removeEventListener("scroll",c)},[i,n]),_.jsx("header",{className:"gantt-header",style:{width:`${e}px`},children:_.jsxs("div",{className:"gantt-header-content",children:[_.jsx("div",{className:"gantt-top-header",children:_.jsx("div",{className:"gantt-top-groups",children:i.map((u,c)=>{const d=c===t;return _.jsx("div",{className:`gantt-top-group ${d?"sticky":""}`,style:{width:`${u.widthPx}px`,...d&&{left:0}},children:_.jsx("p",{className:"gantt-top-group-label",children:u.label})},`${u.label}-${c}`)})})}),_.jsx("div",{className:"gantt-bottom-row",children:r.map((u,c)=>{var l;const d=((l=s.formatTickLabel)==null?void 0:l.call(s,u.startDate))||"";return _.jsx("div",{className:"gantt-bottom-cell",style:{width:`${u.widthPx}px`},children:d},`bottom-${c}`)})})]})})}function On(r,a,e,n,s){if(e<0||s<0)return`M ${a} ${e} h ${(n-a)/2}`;const t=7,o=11,i=25,u=20,c=`M ${a} ${e}`,d=n-a,l=s-e,h=Math.abs(d),x=Math.abs(l),y=s<=e,f=s>=e,S=n>=a,D=n<=a,b=h>u,g=Math.abs(d/2),z=Math.abs(l/2);function R(){function $(){return(S||D)&&f&&!b?"downSmallHorizontal":(S||D)&&y&&!b?"upSmallHorizontal":f&&D?"downLeft":f&&S?"downRight":y&&D?"upLeft":y&&S?"upRight":""}let m=c;switch($()){case"downRight":{m+=` h ${g-t}`,m+=` a ${t} ${t} 0 0 1 ${t} ${t}`,m+=` v ${l-t*2}`,m+=` a ${t} ${t} 0 0 0 ${t} ${t}`,m+=` h ${g-t}`;break}case"upRight":{m+=` h ${g-t}`,m+=` a ${t} ${t} 0 0 0 ${t} -${t}`,m+=` v -${x-t*2}`,m+=` a ${t} ${t} 0 0 1 ${t} -${t}`,m+=` h ${g-t}`;break}case"downLeft":case"downSmallHorizontal":{const P=e+l/2;m+=` h ${o}`,m+=` a ${t} ${t} 0 0 1 ${t} ${t}`,m+=` v ${P-e-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 ${P-e-t*2}`,m+=` a ${t} ${t} 0 0 0 ${t} ${t}`,m+=` h ${o}`;break}case"upLeft":case"upSmallHorizontal":{const P=e+l/2;m+=` h ${o}`,m+=` a ${t} ${t} 0 0 0 ${t} -${t}`,m+=` v -${e-P-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 -${e-P-t*2}`,m+=` a ${t} ${t} 0 0 1 ${t} -${t}`,m+=` h ${o}`;break}default:return m}return m}function T(){let $=c;return f&&D?($+=` h ${i-o}`,$+=` a ${t} ${t} 0 0 1 ${t} ${t}`,$+=` v ${l-t*2}`,$+=` a ${t} ${t} 0 0 1 -${t} ${t}`,$+=` h ${d-t*2}`):f&&S?($+=` h ${d+i-o}`,$+=` a ${t} ${t} 0 0 1 ${t} ${t}`,$+=` v ${l-t*2}`,$+=` a ${t} ${t} 0 0 1 -${t} ${t}`,$+=` h -${i-o}`):y&&D?($+=` h ${i-o}`,$+=` a ${t} ${t} 0 0 0 ${t} -${t}`,$+=` v ${l+t*2}`,$+=` a ${t} ${t} 0 0 0 -${t} -${t}`,$+=` h ${d-i+o}`):y&&S&&($+=` h ${d+i-o}`,$+=` a ${t} ${t} 0 0 0 ${t} -${t}`,$+=` v ${l+t*2}`,$+=` a ${t} ${t} 0 0 0 -${t} -${t}`,$+=` h -${i-o}`),$}function v(){function $(){return(S||D)&&f&&!b?"downSmallHorizontal":(S||D)&&y&&!b?"upSmallHorizontal":f&&D?"downLeft":f&&S?"downRight":y&&D?"upLeft":y&&S?"upRight":""}let m=c;switch($()){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 ${-g+t}`,m+=` a ${t} ${t} 0 0 0 -${t} ${t}`,m+=` v ${x-t*2}`,m+=` a ${t} ${t} 0 0 1 -${t} ${t}`,m+=` h ${-g+t}`;break}case"upLeft":{m+=` h ${-(g-t)}`,m+=` a ${t} ${t} 0 0 1 -${t} -${t}`,m+=` v ${-(x-t*2)}`,m+=` a ${t} ${t} 0 0 0 -${t} -${t}`,m+=` h ${-g+t}`;break}default:return m}return m}function p(){let $=c;return f&&D?($+=` h ${d-i}`,$+=` a ${t} ${t} 0 0 0 -${t} ${t}`,$+=` v ${l-t*2}`,$+=` a ${t} ${t} 0 0 0 ${t} ${t}`,$+=` h ${i}`):f&&S?($+=` h ${-i}`,$+=` a ${t} ${t} 0 0 0 -${t} ${t}`,$+=` v ${l-t*2}`,$+=` a ${t} ${t} 0 0 0 ${t} ${t}`,$+=` h ${d+i}`):y&&D?($+=` h ${d-i}`,$+=` a ${t} ${t} 0 0 1 -${t} -${t}`,$+=` v ${l+t*2}`,$+=` a ${t} ${t} 0 0 1 ${t} -${t}`,$+=` h ${i}`):y&&S&&($+=` h ${-i}`,$+=` a ${t} ${t} 0 0 1 -${t} -${t}`,$+=` v ${l+t*2}`,$+=` a ${t} ${t} 0 0 1 ${t} -${t}`,$+=` h ${d+i}`),$}switch(r){case"FS":return R();case"FF":return T();case"SF":return v();case"SS":return p();default:return`${c} L ${n} ${s}`}}function kn(r,a,e,n){const s=pt,t=r.order-1,i=(a.order-1)*s+s/2-4,u=t*s+s/2+4,c=a.barLeft,d=a.barLeft+a.barWidth,l=r.barLeft+e.offsetX,h=l+r.barWidth+e.offsetWidth,x={FS:[d,l],SS:[c,l],FF:[d,h],SF:[c,h]},[y,f]=x[n];return{fromX:y,fromY:i,toX:f,toY:u}}function Tn(r,a){const e=[];for(const n of r){const s=a[n.id]??{offsetX:0,offsetWidth:0};for(const t of n.dependencies??[]){const o=r.find(l=>l.id===t.targetId);if(!o)continue;const{fromX:i,fromY:u,toX:c,toY:d}=kn(n,o,s,t.type);e.push({...t,fromX:i,fromY:u,toX:c,toY:d})}}return e}function En({transformedTasks:r}){const a=et(n=>n.dragOffsets),e=Tn(r,a);return _.jsxs("svg",{className:"gantt-dependency-arrows",style:{height:`${r.length*pt}px`},children:[_.jsx("defs",{children:_.jsx("marker",{id:"arrowhead",markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto",children:_.jsx("polygon",{className:"gantt-dependency-arrow-head",points:"0 0, 8 4, 0 8"})})}),e.map((n,s)=>_.jsx("path",{className:"gantt-dependency-arrow",d:On(n.type,n.fromX,n.fromY,n.toX,n.toY),markerEnd:"url(#arrowhead)",fill:"none"},`arrow-${s}`))]})}function In({selectedScale:r,onScaleChange:a}){const e=n=>{a(n.target.value)};return _.jsx("div",{className:"gantt-scale-selector",children:_.jsx("select",{className:"gantt-scale-select",value:r,onChange:e,"aria-label":"타임라인 스케일 선택",children:Object.keys(Z).map(n=>_.jsx("option",{value:n,children:n},n))})})}function zn({bottomRowCells:r,height:a}){const e=N.useMemo(()=>{if(r.length===0)return null;const n=W();let s=0;for(let t=0;t<r.length;t++){const o=r[t],i=o.startDate,u=r[t+1],c=(u==null?void 0:u.startDate)??i.add(1,"day");if(n.isSameOrAfter(i)&&n.isBefore(c)){const d=c.diff(i),h=n.diff(i)/d;return s+h*o.widthPx}s+=o.widthPx}return null},[r]);return e===null?null:_.jsx("div",{className:"gantt-today-marker",style:{left:`${e}px`,height:`${a}px`},role:"presentation","aria-label":"Today",children:_.jsx("span",{className:"gantt-today-label",children:"Today"})})}function K(r,a,e){let n=e.initialDeps??[],s;function t(){var o,i,u,c;let d;e.key&&((o=e.debug)!=null&&o.call(e))&&(d=Date.now());const l=r();if(!(l.length!==n.length||l.some((y,f)=>n[f]!==y)))return s;n=l;let x;if(e.key&&((i=e.debug)!=null&&i.call(e))&&(x=Date.now()),s=a(...l),e.key&&((u=e.debug)!=null&&u.call(e))){const y=Math.round((Date.now()-d)*100)/100,f=Math.round((Date.now()-x)*100)/100,S=f/16,D=(b,g)=>{for(b=String(b);b.length<g;)b=" "+b;return b};console.info(`%c⏱ ${D(f,5)} /${D(y,5)} ms`,`
2
- font-size: .6rem;
3
- font-weight: bold;
4
- color: hsl(${Math.max(0,Math.min(120-120*S,120))}deg 100% 31%);`,e==null?void 0:e.key)}return(c=e==null?void 0:e.onChange)==null||c.call(e,s),s}return t.updateDeps=o=>{n=o},t}function Nt(r,a){if(r===void 0)throw new Error("Unexpected undefined");return r}const Cn=(r,a)=>Math.abs(r-a)<1.01,Ln=(r,a,e)=>{let n;return function(...s){r.clearTimeout(n),n=r.setTimeout(()=>a.apply(this,s),e)}},Ft=r=>{const{offsetWidth:a,offsetHeight:e}=r;return{width:a,height:e}},Rn=r=>r,_n=r=>{const a=Math.max(r.startIndex-r.overscan,0),e=Math.min(r.endIndex+r.overscan,r.count-1),n=[];for(let s=a;s<=e;s++)n.push(s);return n},jn=(r,a)=>{const e=r.scrollElement;if(!e)return;const n=r.targetWindow;if(!n)return;const s=o=>{const{width:i,height:u}=o;a({width:Math.round(i),height:Math.round(u)})};if(s(Ft(e)),!n.ResizeObserver)return()=>{};const t=new n.ResizeObserver(o=>{const i=()=>{const u=o[0];if(u!=null&&u.borderBoxSize){const c=u.borderBoxSize[0];if(c){s({width:c.inlineSize,height:c.blockSize});return}}s(Ft(e))};r.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()});return t.observe(e,{box:"border-box"}),()=>{t.unobserve(e)}},Ht={passive:!0},At=typeof window>"u"?!0:"onscrollend"in window,Pn=(r,a)=>{const e=r.scrollElement;if(!e)return;const n=r.targetWindow;if(!n)return;let s=0;const t=r.options.useScrollendEvent&&At?()=>{}:Ln(n,()=>{a(s,!1)},r.options.isScrollingResetDelay),o=d=>()=>{const{horizontal:l,isRtl:h}=r.options;s=l?e.scrollLeft*(h&&-1||1):e.scrollTop,t(),a(s,d)},i=o(!0),u=o(!1);u(),e.addEventListener("scroll",i,Ht);const c=r.options.useScrollendEvent&&At;return c&&e.addEventListener("scrollend",u,Ht),()=>{e.removeEventListener("scroll",i),c&&e.removeEventListener("scrollend",u)}},Wn=(r,a,e)=>{if(a!=null&&a.borderBoxSize){const n=a.borderBoxSize[0];if(n)return Math.round(n[e.options.horizontal?"inlineSize":"blockSize"])}return r[e.options.horizontal?"offsetWidth":"offsetHeight"]},Nn=(r,{adjustments:a=0,behavior:e},n)=>{var s,t;const o=r+a;(t=(s=n.scrollElement)==null?void 0:s.scrollTo)==null||t.call(s,{[n.options.horizontal?"left":"top"]:o,behavior:e})};class Fn{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 e=null;const n=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(s=>{s.forEach(t=>{const o=()=>{this._measureElement(t.target,t)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var s;(s=n())==null||s.disconnect(),e=null},observe:s=>{var t;return(t=n())==null?void 0:t.observe(s,{box:"border-box"})},unobserve:s=>{var t;return(t=n())==null?void 0:t.unobserve(s)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([n,s])=>{typeof s>"u"&&delete e[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Rn,rangeExtractor:_n,onChange:()=>{},measureElement:Wn,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,...e}},this.notify=e=>{var n,s;(s=(n=this.options).onChange)==null||s.call(n,this,e)},this.maybeNotify=K(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{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(e=>e()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((e=this.scrollElement)==null?void 0:e.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,t)=>{this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,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=(e,n)=>{const s=new Map,t=new Map;for(let o=n-1;o>=0;o--){const i=e[o];if(s.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&&s.set(i.lane,!0),s.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=K(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(e,n,s,t,o)=>(this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:n,scrollMargin:s,getItemKey:t,enabled:o}),{key:!1}),this.getMeasurements=K(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:n,scrollMargin:s,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<e;d++){const l=t(d),h=this.options.lanes===1?c[d-1]:this.getFurthestMeasurement(c,d),x=h?h.end+this.options.gap:n+s,y=i.get(l),f=typeof y=="number"?y:this.options.estimateSize(d),S=x+f,D=h?h.lane:d%this.options.lanes;c[d]={index:d,start:x,size:f,end:S,key:l,lane:D}}return this.measurementsCache=c,c},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=K(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,n,s,t)=>this.range=e.length>0&&n>0?Hn({measurements:e,outerSize:n,scrollOffset:s,lanes:t}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=K(()=>{let e=null,n=null;const s=this.calculateRange();return s&&(e=s.startIndex,n=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,n]},(e,n,s,t,o)=>t===null||o===null?[]:e({startIndex:t,endIndex:o,overscan:n,count:s}),{key:process.env.NODE_ENV!=="production"&&"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=e=>{const n=this.options.indexAttribute,s=e.getAttribute(n);return s?parseInt(s,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this._measureElement=(e,n)=>{const s=this.indexFromElement(e),t=this.measurementsCache[s];if(!t)return;const o=t.key,i=this.elementsCache.get(o);i!==e&&(i&&this.observer.unobserve(i),this.observer.observe(e),this.elementsCache.set(o,e)),e.isConnected&&this.resizeItem(s,this.options.measureElement(e,n,this))},this.resizeItem=(e,n)=>{const s=this.measurementsCache[e];if(!s)return;const t=this.itemSizeCache.get(s.key)??s.size,o=n-t;o!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(s,o,this):s.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(s.index),this.itemSizeCache=new Map(this.itemSizeCache.set(s.key,n)),this.notify(!1))},this.measureElement=e=>{if(!e){this.elementsCache.forEach((n,s)=>{n.isConnected||(this.observer.unobserve(n),this.elementsCache.delete(s))});return}this._measureElement(e,void 0)},this.getVirtualItems=K(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,n)=>{const s=[];for(let t=0,o=e.length;t<o;t++){const i=e[t],u=n[i];s.push(u)}return s},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const n=this.getMeasurements();if(n.length!==0)return Nt(n[Vt(0,n.length-1,s=>Nt(n[s]).start,e)])},this.getOffsetForAlignment=(e,n,s=0)=>{const t=this.getSize(),o=this.getScrollOffset();n==="auto"&&(n=e>=o+t?"end":"start"),n==="center"?e+=(s-t)/2:n==="end"&&(e-=t);const i=this.getTotalSize()+this.options.scrollMargin-t;return Math.max(Math.min(i,e),0)},this.getOffsetForIndex=(e,n="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const s=this.measurementsCache[e];if(!s)return;const t=this.getSize(),o=this.getScrollOffset();if(n==="auto")if(s.end>=o+t-this.options.scrollPaddingEnd)n="end";else if(s.start<=o+this.options.scrollPaddingStart)n="start";else return[o,n];const i=n==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,n,s.size),n]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(e,{align:n="start",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(e,n),{adjustments:void 0,behavior:s})},this.scrollToIndex=(e,{align:n="auto",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),e=Math.max(0,Math.min(e,this.options.count-1));let t=0;const o=10,i=c=>{if(!this.targetWindow)return;const d=this.getOffsetForIndex(e,c);if(!d){console.warn("Failed to get offset for index:",e);return}const[l,h]=d;this._scrollToOffset(l,{adjustments:void 0,behavior:s}),this.targetWindow.requestAnimationFrame(()=>{const x=this.getScrollOffset(),y=this.getOffsetForIndex(e,h);if(!y){console.warn("Failed to get offset for index:",e);return}Cn(y[0],x)||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 ${e} after ${o} attempts.`))};i(n)},this.scrollBy=(e,{behavior:n}={})=>{n==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+e,{adjustments:void 0,behavior:n})},this.getTotalSize=()=>{var e;const n=this.getMeasurements();let s;if(n.length===0)s=this.options.paddingStart;else if(this.options.lanes===1)s=((e=n[n.length-1])==null?void 0:e.end)??0;else{const t=Array(this.options.lanes).fill(null);let o=n.length-1;for(;o>=0&&t.some(i=>i===null);){const i=n[o];t[i.lane]===null&&(t[i.lane]=i.end),o--}s=Math.max(...t.filter(i=>i!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:n,behavior:s})=>{this.options.scrollToFn(e,{behavior:s,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(a)}}const Vt=(r,a,e,n)=>{for(;r<=a;){const s=(r+a)/2|0,t=e(s);if(t<n)r=s+1;else if(t>n)a=s-1;else return s}return r>0?r-1:0};function Hn({measurements:r,outerSize:a,scrollOffset:e,lanes:n}){const s=r.length-1,t=u=>r[u].start;if(r.length<=n)return{startIndex:0,endIndex:s};let o=Vt(0,s,t,e),i=o;if(n===1)for(;i<s&&r[i].end<e+a;)i++;else if(n>1){const u=Array(n).fill(0);for(;i<s&&u.some(d=>d<e+a);){const d=r[i];u[d.lane]=d.end,i++}const c=Array(n).fill(e+a);for(;o>=0&&c.some(d=>d>=e);){const d=r[o];c[d.lane]=d.start,o--}o=Math.max(0,o-o%n),i=Math.min(s,i+(n-1-i%n))}return{startIndex:o,endIndex:i}}const Yt=typeof document<"u"?gt.useLayoutEffect:gt.useEffect;function An(r){const a=gt.useReducer(()=>({}),{})[1],e={...r,onChange:(s,t)=>{var o;t?Gt.flushSync(a):a(),(o=r.onChange)==null||o.call(r,s,t)}},[n]=gt.useState(()=>new Fn(e));return n.setOptions(e),Yt(()=>n._didMount(),[]),Yt(()=>n._willUpdate()),n}function Ut(r){return An({observeElementRect:jn,observeElementOffset:Pn,scrollToFn:Nn,...r})}function Yn({transformedTasks:r,bottomRowCells:a,scrollRef:e}){var d;const n=Ut({count:r.length,getScrollElement:()=>e.current,estimateSize:()=>pt,overscan:5}),s=Ut({horizontal:!0,count:a.length,getScrollElement:()=>e.current,estimateSize:l=>{var h;return((h=a[l])==null?void 0:h.widthPx)??32},overscan:5}),t=s.getVirtualItems(),o=((d=t[0])==null?void 0:d.start)??0,i=t[t.length-1],u=i?i.start+i.size:0,c=N.useMemo(()=>(l,h)=>l+h>=o&&l<=u,[o,u]);return N.useEffect(()=>{if(!a.length)return;const l=requestAnimationFrame(()=>{s.measure()});return()=>cancelAnimationFrame(l)},[a,s]),{rowVirtualizer:n,columnVirtualizer:s,isBarVisible:c}}function Un(r,a="gantt-container"){const[e,n]=N.useState(()=>typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");N.useEffect(()=>{if(typeof window>"u")return;const i=window.matchMedia("(prefers-color-scheme: dark)"),u=c=>{n(c.matches?"dark":"light")};return i.addEventListener("change",u),()=>i.removeEventListener("change",u)},[]);const s=N.useMemo(()=>!r||r==="system"?e:r,[r,e]),t=N.useMemo(()=>{const i=[a];return r&&i.push(s),i.join(" ")},[a,r,s]);return{resolvedTheme:s,containerClassName:t,dataTheme:r?s:void 0}}const qn=600,Bn="100%",Vn="month";function Gn({tasks:r=[],onTasksChange:a,height:e=qn,width:n=Bn,theme:s,defaultScale:t=Vn,className:o}){const{rawTasks:i,transformedTasks:u,bottomRowCells:c,selectedScale:d,setRawTasks:l,setTransformedTasks:h,setBottomRowCells:x,setSelectedScale:y,getTotalWidth:f}=Bt(),S=N.useRef(null),{rowVirtualizer:D,isBarVisible:b}=Yn({transformedTasks:u,bottomRowCells:c,scrollRef:S}),{containerClassName:g,dataTheme:z}=Un(s,o?`gantt-container ${o}`:"gantt-container");N.useEffect(()=>{t&&t!==d&&y(t)},[]),N.useEffect(()=>{r.length>0&&l(r)},[r,l]),N.useEffect(()=>{if(!i.length)return;const{bottomCells:p,transformedTasks:$}=wn(i,d);x(p),h($)},[i,d,x,h]);const R=p=>{y(p)},T=f(),v={height:typeof e=="number"?`${e}px`:e,width:typeof n=="number"?`${n}px`:n};return _.jsx("section",{className:g,"data-theme":z,style:v,children:_.jsx("div",{className:"gantt-inner",children:_.jsxs("section",{className:"gantt-section",children:[_.jsx(In,{selectedScale:d,onScaleChange:R}),_.jsxs("div",{ref:S,className:"gantt-list",children:[_.jsx(Dn,{bottomRowCells:c,selectedScale:d,width:T,scrollRef:S}),_.jsxs("div",{className:"gantt-content",style:{height:`${D.getTotalSize()}px`,width:`${T}px`},children:[_.jsx(zn,{bottomRowCells:c,height:D.getTotalSize()}),_.jsx(En,{transformedTasks:u}),D.getVirtualItems().map(p=>{const $=u[p.index],m=$.barLeft??0,k=$.barWidth??0;return _.jsx("div",{className:"gantt-task-row",style:{height:`${p.size-1}px`,transform:`translateY(${p.start}px)`},children:b(m,k)&&_.jsx(dn,{currentTask:$,onTasksChange:a})},$.id)})]})]})]})})})}exports.ReactGanttChart=Gn;