zegantt 0.2.8 → 1.0.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.
package/README.md CHANGED
@@ -1,73 +1,260 @@
1
- # React + TypeScript + Vite
1
+ # ZeGantt
2
2
 
3
- This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
3
+ ZeGantt is a React Gantt chart library focused on construction and project planning workflows.
4
4
 
5
- Currently, two official plugins are available:
5
+ ## Highlights
6
6
 
7
- - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
8
- - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
7
+ - Virtualized rows and day-columns for large datasets (thousands of tasks)
8
+ - Drag, resize and dependency creation with mouse and touch support
9
+ - Keyboard navigation and accessibility attributes for enterprise use
10
+ - Theme tokens via CSS variables
11
+ - i18n with robust English fallback
12
+ - ESM + CJS builds with TypeScript declarations
9
13
 
10
- ## React Compiler
14
+ ## Install
11
15
 
12
- The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
16
+ ```bash
17
+ npm install zegantt
18
+ ```
19
+
20
+ ### Required peer dependencies
21
+
22
+ ```bash
23
+ npm install react react-dom lucide-react
24
+ ```
13
25
 
14
- ## Expanding the ESLint configuration
26
+ ## Minimal usage
15
27
 
16
- If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
28
+ ```tsx
29
+ import { ProjectGantt, ptBR, type GanttStep } from 'zegantt';
30
+ import 'zegantt/style.css';
17
31
 
18
- ```js
19
- export default defineConfig([
20
- globalIgnores(['dist']),
32
+ const steps: GanttStep[] = [
21
33
  {
22
- files: ['**/*.{ts,tsx}'],
23
- extends: [
24
- // Other configs...
25
-
26
- // Remove tseslint.configs.recommended and replace with this
27
- tseslint.configs.recommendedTypeChecked,
28
- // Alternatively, use this for stricter rules
29
- tseslint.configs.strictTypeChecked,
30
- // Optionally, add this for stylistic rules
31
- tseslint.configs.stylisticTypeChecked,
32
-
33
- // Other configs...
34
- ],
35
- languageOptions: {
36
- parserOptions: {
37
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
38
- tsconfigRootDir: import.meta.dirname,
39
- },
40
- // other options...
41
- },
34
+ id: 's1',
35
+ name: 'Foundation',
36
+ startDate: '2026-01-10',
37
+ finishDate: '2026-01-20',
38
+ conclusionPercent: 45,
39
+ projectId: 'p1',
40
+ projectTitle: 'Residential Tower',
42
41
  },
43
- ])
42
+ ];
43
+
44
+ export function Example() {
45
+ return (
46
+ <ProjectGantt
47
+ steps={steps}
48
+ locale="pt-BR"
49
+ translations={ptBR}
50
+ groupByProject
51
+ onTaskChange={(task) => console.log('Task updated', task)}
52
+ />
53
+ );
54
+ }
44
55
  ```
45
56
 
46
- You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
57
+ ## Data contracts
47
58
 
48
- ```js
49
- // eslint.config.js
50
- import reactX from 'eslint-plugin-react-x'
51
- import reactDom from 'eslint-plugin-react-dom'
59
+ ### Steps
52
60
 
53
- export default defineConfig([
54
- globalIgnores(['dist']),
55
- {
56
- files: ['**/*.{ts,tsx}'],
57
- extends: [
58
- // Other configs...
59
- // Enable lint rules for React
60
- reactX.configs['recommended-typescript'],
61
- // Enable lint rules for React DOM
62
- reactDom.configs.recommended,
63
- ],
64
- languageOptions: {
65
- parserOptions: {
66
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
67
- tsconfigRootDir: import.meta.dirname,
68
- },
69
- // other options...
70
- },
71
- },
72
- ])
61
+ ```ts
62
+ interface GanttStep {
63
+ id: string;
64
+ name: string;
65
+ startDate?: Date | string;
66
+ finishDate?: Date | string;
67
+ previsionStartDate?: Date | string;
68
+ previsionFinishDate?: Date | string;
69
+ conclusionPercent?: number | string;
70
+ projectId?: string;
71
+ projectTitle?: string;
72
+ }
73
+ ```
74
+
75
+ ### Milestones
76
+
77
+ ```ts
78
+ interface GanttMilestone {
79
+ id: string;
80
+ name: string;
81
+ date?: Date | string;
82
+ finished?: boolean;
83
+ projectId?: string;
84
+ projectTitle?: string;
85
+ }
86
+ ```
87
+
88
+ ### Events
89
+
90
+ ```ts
91
+ interface GanttEvent {
92
+ id: string;
93
+ title: string;
94
+ date?: Date | string;
95
+ finished?: boolean;
96
+ projectId?: string;
97
+ projectTitle?: string;
98
+ }
99
+ ```
100
+
101
+ ### Notes
102
+
103
+ ```ts
104
+ interface GanttNote {
105
+ id: string;
106
+ title: string;
107
+ targetId?: string;
108
+ predecessorId?: string;
109
+ description?: string;
110
+ author?: string;
111
+ date?: Date | string;
112
+ color?: string;
113
+ filesCount?: number;
114
+ projectId?: string;
115
+ projectTitle?: string;
116
+ }
117
+ ```
118
+
119
+ ### Dependencies
120
+
121
+ ```ts
122
+ type PredecessorType = 'STEP' | 'MILESTONE';
123
+ type DependencyType = 'FS' | 'SS' | 'FF' | 'SF';
124
+
125
+ interface GanttDependency {
126
+ id: string;
127
+ predecessorId: string;
128
+ predecessorType: PredecessorType;
129
+ successorId: string;
130
+ successorType: PredecessorType;
131
+ type: DependencyType;
132
+ lag: number;
133
+ }
134
+ ```
135
+
136
+ ## Main props
137
+
138
+ ```ts
139
+ interface ProjectGanttProps {
140
+ steps: GanttStep[];
141
+ milestones?: GanttMilestone[];
142
+ events?: GanttEvent[];
143
+ notes?: GanttNote[];
144
+ dependencies?: GanttDependency[];
145
+
146
+ loading?: boolean;
147
+ locale?: string;
148
+ groupByProject?: boolean;
149
+ translations?: Record<string, string> | ((key: string, fallback?: string) => string);
150
+
151
+ onTaskChange?: (task: GanttTask) => void;
152
+ onTaskClick?: (task: GanttTask) => void;
153
+ onCreateDependency?: (params: CreateDependencyParams) => Promise<void>;
154
+ onDeleteDependency?: (dependencyId: string) => Promise<void>;
155
+ onDependencyError?: (error: DependencyValidationError) => void;
156
+
157
+ onAddNewStage?: (date?: Date, projectId?: string) => void;
158
+ onAddMilestone?: (date?: Date, projectId?: string) => void;
159
+ onAddEvent?: (date?: Date, projectId?: string) => void;
160
+ onAddNote?: (date?: Date, projectId?: string) => void;
161
+ }
162
+ ```
163
+
164
+ ## Dependency cycle protection
165
+
166
+ ZeGantt blocks creation of circular dependencies (for example A -> B -> C -> A).
167
+
168
+ - If `onDependencyError` is provided, it receives a `CYCLIC_DEPENDENCY` error payload.
169
+ - If not provided, ZeGantt shows a default alert message.
170
+
171
+ ## Accessibility and keyboard
172
+
173
+ - Interactive rows include semantic roles and keyboard handling
174
+ - Row navigation with arrow keys
175
+ - `Enter` opens task details (when callback exists)
176
+ - Focus-visible ring is provided by default CSS
177
+
178
+ ## Mobile and touch
179
+
180
+ The library supports touch interactions for:
181
+
182
+ - Bar dragging
183
+ - Bar resizing
184
+ - Dependency connection handles
185
+ - Timeline panning
186
+
187
+ ## Theming
188
+
189
+ ZeGantt exposes CSS variables that can be overridden globally or in a wrapper:
190
+
191
+ ```css
192
+ .my-gantt-theme {
193
+ --zg-surface: #ffffff;
194
+ --zg-surface-alt: #f4f7f6;
195
+ --zg-header-bg: #e9efec;
196
+ --zg-border: #c9d2ce;
197
+ --zg-border-light: #dbe3df;
198
+ --zg-primary-color: #0f3d2f;
199
+ --zg-note-color: #ffd44d;
200
+ --zg-shadow-panel: 0 10px 30px rgba(0, 0, 0, 0.08);
201
+ }
202
+ ```
203
+
204
+ Apply theme:
205
+
206
+ ```tsx
207
+ <div className="my-gantt-theme">
208
+ <ProjectGantt steps={steps} />
209
+ </div>
210
+ ```
211
+
212
+ ## i18n
213
+
214
+ - Use `locale` (BCP 47, ex: `en-US`, `pt-BR`) to format dates and month labels.
215
+ - Provide `translations` as object or function.
216
+ - Missing keys fall back to English automatically.
217
+
218
+ Built-in helper export:
219
+
220
+ ```ts
221
+ import { ptBR } from 'zegantt';
222
+ ```
223
+
224
+ ## Testing
225
+
226
+ Included scripts:
227
+
228
+ ```bash
229
+ npm run test
230
+ npm run test:watch
73
231
  ```
232
+
233
+ Current suite includes:
234
+
235
+ - Unit tests for `utils/date.ts`, `utils/timeline.ts`, `utils/criticalPath.ts`, `utils/dependencies.ts`
236
+ - Component tests for context menu and task bar rendering behavior
237
+
238
+ ## Build and publish
239
+
240
+ Build outputs:
241
+
242
+ - ESM: `dist/zegantt.js`
243
+ - CJS: `dist/zegantt.cjs`
244
+ - Types: `dist/index.d.ts`
245
+ - Styles: `dist/zegantt.css`
246
+
247
+ Before publishing:
248
+
249
+ 1. Run `npm run test`
250
+ 2. Run `npm run build`
251
+ 3. Verify `peerDependencies` resolution in consuming projects
252
+
253
+ ## Storybook recommendation
254
+
255
+ For consumer-facing documentation, Storybook is strongly recommended to demonstrate:
256
+
257
+ - Large dataset performance scenarios
258
+ - Interaction flows (drag, resize, dependency creation)
259
+ - Theme variants
260
+ - Locale variants
package/dist/index.d.ts CHANGED
@@ -11,6 +11,16 @@ export declare interface CreateDependencyParams {
11
11
 
12
12
  export declare type DependencyType = "FS" | "SS" | "FF" | "SF";
13
13
 
14
+ export declare interface DependencyValidationError {
15
+ code: 'CYCLIC_DEPENDENCY';
16
+ message: string;
17
+ predecessorId: string;
18
+ successorId: string;
19
+ }
20
+
21
+ /** English translation strings for ZeGantt */
22
+ export declare const enUS: Record<string, string>;
23
+
14
24
  export declare interface GanttDependency {
15
25
  id: string;
16
26
  predecessorId: string;
@@ -44,6 +54,10 @@ export declare interface GanttMilestone {
44
54
  export declare interface GanttNote {
45
55
  id: string;
46
56
  title: string;
57
+ targetId?: string;
58
+ predecessorId?: string;
59
+ description?: string;
60
+ author?: string;
47
61
  date?: Date | string;
48
62
  color?: string;
49
63
  filesCount?: number;
@@ -122,6 +136,7 @@ export declare interface ProjectGanttProps {
122
136
  onDeleteStage?: (taskId: string) => void;
123
137
  onCreateDependency?: (params: CreateDependencyParams) => Promise<void>;
124
138
  onDeleteDependency?: (dependencyId: string) => Promise<void>;
139
+ onDependencyError?: (error: DependencyValidationError) => void;
125
140
  onAddMilestone?: (date?: Date, projectId?: string) => void;
126
141
  onAddEvent?: (date?: Date, projectId?: string) => void;
127
142
  onAddNote?: (date?: Date, projectId?: string) => void;
@@ -0,0 +1,4 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),b=require("react"),Y=require("lucide-react"),ut=require("react-dom");function gt(n){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const r in n)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(i,r,o.get?o:{enumerable:!0,get:()=>n[r]})}}return i.default=n,Object.freeze(i)}const $e=gt(b),nt=b.createContext(void 0);function ft({children:n,value:i}){return t.jsx(nt.Provider,{value:i,children:n})}function Se(){const n=b.useContext(nt);if(!n)throw new Error("useGanttContext must be used within a GanttProvider");return n}const e={pageBg:"var(--zg-page-bg, #F8FAFB)",surface:"var(--zg-surface, #FFFFFF)",surfaceAlt:"var(--zg-surface-alt, #F7FAF8)",surfaceFrost:"var(--zg-surface-frost, rgba(255,255,255,0.96))",headerBg:"var(--zg-header-bg, #F2F5F3)",textTitle:"var(--zg-primary-color, #1A3C30)",textPrimary:"var(--zg-text-primary, #4F4F4F)",textSecondary:"var(--zg-text-secondary, #7B7B7B)",textSecondarySoft:"var(--zg-text-secondary-soft, rgba(123,123,123,0.27))",textSecondaryMid:"var(--zg-text-secondary-mid, rgba(123,123,123,0.4))",textMuted:"var(--zg-text-muted, #D9D9D9)",group:"var(--zg-group, #1A3C30)",groupSoft:"var(--zg-group-soft, rgba(26,60,48,0.05))",groupSoftStrong:"var(--zg-group-soft-strong, rgba(26,60,48,0.12))",groupBorderWeak:"var(--zg-group-border-weak, rgba(26,60,48,0.27))",groupGlowSoft:"var(--zg-group-glow-soft, rgba(26,60,48,0.2))",groupGlow:"var(--zg-group-glow, rgba(26,60,48,0.4))",groupGlowStrong:"var(--zg-group-glow-strong, rgba(26,60,48,0.6))",groupLight:"var(--zg-group-light, #7AB7A3)",groupLightSoft:"var(--zg-group-light-soft, rgba(122,183,163,0.13))",groupLightStrong:"var(--zg-group-light-strong, rgba(122,183,163,0.6))",milestone:"var(--zg-milestone, #1A3C30)",milestoneRing:"var(--zg-milestone-ring, #A0D8A8)",milestoneRingSoft:"var(--zg-milestone-ring-soft, rgba(160,216,168,0.19))",milestonePillBg:"var(--zg-milestone-pill-bg, linear-gradient(135deg, #e8f5ee, #f0f8f4))",criticalPillBg:"var(--zg-critical-pill-bg, linear-gradient(135deg, #fee, #fff5f5))",event:"var(--zg-event, #CD6200)",eventSoft:"var(--zg-event-soft, rgba(205,98,0,0.09))",eventBorderSoft:"var(--zg-event-border-soft, rgba(205,98,0,0.33))",eventPillBg:"var(--zg-event-pill-bg, linear-gradient(135deg, #fff7ed, #ffedd5))",note:"var(--zg-note-color, #FFBB1C)",noteDefaultBg:"var(--zg-note-default-bg, #FEF08A)",noteBadgeBg:"var(--zg-note-badge-bg, #FACC15)",noteBadgeText:"var(--zg-note-badge-text, #1A3C30)",delayedTaskBg:"var(--zg-delayed-task-bg, linear-gradient(135deg, #fdd, #fee))",border:"var(--zg-border, #D9D9D9)",borderLight:"var(--zg-border-light, #ECECEC)",weekendBg:"var(--zg-weekend-bg, #F4F6F5)",today:"var(--zg-danger-color, #FF0000)",todaySoft:"var(--zg-danger-soft, rgba(255,0,0,0.13))",todayMid:"var(--zg-danger-mid, rgba(255,0,0,0.27))",todayStrong:"var(--zg-danger-strong, rgba(255,0,0,0.53))",todayBg:"var(--zg-today-bg, #FF000008)",arrow:"var(--zg-arrow, #7B7B7B)",arrowHover:"var(--zg-arrow-hover, #1A3C30)",overlaySoft:"var(--zg-overlay-soft, rgba(0,0,0,0.2))",overlayMedium:"var(--zg-overlay-medium, rgba(0,0,0,0.35))",white:"var(--zg-contrast-high, #FFFFFF)",inkStrong:"var(--zg-ink-strong, #1A1A1A)",inkMedium:"var(--zg-ink-medium, #3A3A3A)",inkSoft:"var(--zg-ink-soft, rgba(0,0,0,0.7))",inkSoft2:"var(--zg-ink-soft-2, rgba(0,0,0,0.6))",inkSoft3:"var(--zg-ink-soft-3, rgba(0,0,0,0.55))",inkSoft4:"var(--zg-ink-soft-4, rgba(0,0,0,0.45))",dangerText:"var(--zg-danger-text, #EF4444)",dangerBgSoft:"var(--zg-danger-bg-soft, #FEE2E2)",shadowTiny:"var(--zg-shadow-tiny, 0 1px 3px rgba(0,0,0,0.08))",shadowSmall:"var(--zg-shadow-small, 0 1px 3px rgba(0,0,0,0.1))",shadowSoft:"var(--zg-shadow-soft, 0 1px 3px rgba(0,0,0,0.06))",shadowLarge:"var(--zg-shadow-large, 0 4px 12px rgba(0,0,0,0.08))",shadowSticky:"var(--zg-shadow-sticky, 2px 3px 8px rgba(0,0,0,0.13))",shadowStickyHover:"var(--zg-shadow-sticky-hover, 4px 6px 18px rgba(0,0,0,0.22))",shadowStickyStrong:"var(--zg-shadow-sticky-strong, 4px 6px 16px rgba(0,0,0,0.22))",stickyTape:"var(--zg-sticky-tape, rgba(255,255,255,0.55))",connectorDotBorder:"var(--zg-connector-dot-border, #FFFFFF)"},ee=50,ze=32,xt=ze*2,mt=460,ae=26,ye=28,_e=120,yt=40,bt=3.5,le=[{bar:"#D1D8A0",barBorder:"#A0D8A8",progress:"#1A3C30"},{bar:"#A0D8C8",barBorder:"#6BBFA8",progress:"#14534A"},{bar:"#B8C9E8",barBorder:"#8AAAD6",progress:"#2C4A70"},{bar:"#E8C9A0",barBorder:"#D6AA7A",progress:"#6B4510"},{bar:"#D8A0C8",barBorder:"#C47AAE",progress:"#6B2058"},{bar:"#A0C8D8",barBorder:"#74ACBF",progress:"#1A4F60"},{bar:"#C8D8A0",barBorder:"#A8BF74",progress:"#3F5014"},{bar:"#D8B0A0",barBorder:"#C4907A",progress:"#6B3020"},{bar:"#B0A0D8",barBorder:"#937ACE",progress:"#3A2070"},{bar:"#A0D8B0",barBorder:"#70C888",progress:"#1A5030"}],He={step:"Steps",milestone:"Milestones",event:"Events",note:"Notes"};function vt(){const{props:n,t:i,viewMode:r,setViewMode:o,visibleTypes:s,setVisibleTypes:l,newActionOpen:a,setNewActionOpen:d,newActionRef:g}=Se(),{projectName:m,onAddNewStage:y,onAddMilestone:z,onAddEvent:k,onAddNote:A}=n,L=f=>{l(v=>{const M=new Set(v);return M.has(f)?M.delete(f):M.add(f),M})};return t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"20px 24px",borderBottom:`1px solid ${e.border}`,background:`linear-gradient(180deg, ${e.headerBg} 0%, ${e.surface} 100%)`},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[t.jsxs("div",{children:[t.jsx("h3",{style:{margin:0,fontSize:14,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.1em",color:e.textTitle},children:i("planning.gantt","Project Planning")}),t.jsx("div",{style:{height:2.5,width:64,marginTop:6,borderRadius:9999,background:`linear-gradient(90deg, ${e.group}, ${e.milestoneRing})`}})]}),m&&t.jsx("span",{style:{fontSize:12,fontWeight:500,padding:"4px 12px",borderRadius:9999,color:e.textSecondary,background:e.surface,border:`1px solid ${e.border}`},children:m})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[t.jsx("div",{style:{display:"flex",padding:4,borderRadius:8,background:e.groupSoftStrong,border:`1px solid ${e.borderLight}`},children:["day","month"].map(f=>t.jsx("button",{onClick:()=>o(f),style:{padding:"6px 20px",fontSize:12,fontWeight:600,borderRadius:6,transition:"all 0.2s",border:"none",cursor:"pointer",...r===f?{background:e.surface,color:e.group,boxShadow:e.shadowTiny}:{background:"transparent",color:e.textSecondary}},children:f==="day"?i("charts.gantt.month","Month"):i("charts.gantt.year","Year")},f))}),t.jsx("div",{style:{display:"flex",padding:4,borderRadius:8,gap:2,background:e.groupSoftStrong,border:`1px solid ${e.borderLight}`},children:[{type:"step",label:i("gantt.filter.steps","Steps"),icon:t.jsx("div",{style:{width:10,height:10,borderRadius:2,background:le[0].bar,border:`1px solid ${le[0].barBorder}`}})},{type:"milestone",label:i("gantt.filter.milestones","Milestones"),icon:t.jsx(Y.Flag,{size:11,style:{color:e.milestone}})},{type:"event",label:i("gantt.filter.events","Events"),icon:t.jsx(Y.Clock,{size:11,style:{color:e.event}})},{type:"note",label:i("gantt.filter.notes","Notes"),icon:t.jsx(Y.MessageCircle,{size:11,style:{color:e.note}})}].map(f=>{const v=s.has(f.type);return t.jsxs("button",{onClick:()=>L(f.type),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",fontSize:11,fontWeight:600,borderRadius:6,transition:"all 0.2s",border:"none",cursor:"pointer",...v?{background:e.surface,color:e.group,boxShadow:e.shadowTiny}:{background:"transparent",color:e.textMuted,opacity:.5}},children:[f.icon,t.jsx("span",{children:f.label})]},f.type)})}),y&&t.jsxs("div",{ref:g,style:{position:"relative"},children:[t.jsxs("button",{onClick:()=>d(f=>!f),style:{display:"flex",alignItems:"center",gap:8,padding:"10px 20px",borderRadius:8,fontSize:14,fontWeight:600,color:e.white,border:"none",cursor:"pointer",background:`linear-gradient(135deg, ${e.group}, ${e.groupGlowStrong})`,transition:"all 0.2s"},children:[t.jsx(Y.Plus,{size:16}),t.jsx("span",{children:i("charts.gantt.newAction","New Action")}),t.jsx(Y.ChevronDown,{size:14,style:{opacity:.7,transform:a?"rotate(180deg)":"none",transition:"transform 0.18s"}})]}),a&&t.jsx("div",{style:{position:"absolute",top:"calc(100% + 6px)",right:0,zIndex:99999,background:e.surface,borderRadius:10,boxShadow:"var(--zg-shadow-popover)",border:`1.5px solid ${e.borderLight}`,width:200,overflow:"hidden",padding:"5px 5px"},onClick:f=>f.stopPropagation(),children:[{label:i("gantt.newAction.step","Step"),icon:t.jsx("div",{style:{width:14,height:14,borderRadius:3,background:le[0].bar,border:`1.5px solid ${le[0].barBorder}`,flexShrink:0}}),action:()=>{y(),d(!1)}},{label:i("gantt.newAction.milestone","Milestone"),icon:t.jsx("div",{style:{width:22,height:22,borderRadius:"50%",background:e.milestoneRingSoft,border:`1.5px solid ${e.milestoneRing}`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t.jsx(Y.Flag,{size:11,style:{color:e.milestone}})}),action:()=>{z?.(),d(!1)}},{label:i("gantt.newAction.event","Event"),icon:t.jsx("div",{style:{width:22,height:22,borderRadius:"50%",background:e.eventSoft,border:`1.5px solid ${e.eventBorderSoft}`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t.jsx(Y.Clock,{size:11,style:{color:e.event}})}),action:()=>{k?.(),d(!1)}},{label:i("gantt.newAction.note","Note"),icon:t.jsx("div",{style:{width:16,height:20,background:e.note,borderRadius:2,boxShadow:e.shadowTiny,position:"relative",overflow:"visible",flexShrink:0},children:t.jsx("div",{style:{position:"absolute",top:-2,left:"50%",transform:"translateX(-50%)",width:10,height:4,background:e.stickyTape,borderRadius:1}})}),action:()=>{A?.(),d(!1)}}].map(f=>t.jsxs("button",{onClick:f.action,style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 10px",borderRadius:7,border:"none",background:"transparent",cursor:"pointer",fontSize:13,fontWeight:500,color:e.textPrimary,textAlign:"left",transition:"background 0.12s"},onMouseEnter:v=>{v.currentTarget.style.background=e.headerBg},onMouseLeave:v=>{v.currentTarget.style.background="transparent"},children:[f.icon,f.label]},f.label))})]})]})]})}function be(n,i,r){let o=r.initialDeps??[],s,l=!0;function a(){var d,g,m;let y;r.key&&((d=r.debug)!=null&&d.call(r))&&(y=Date.now());const z=n();if(!(z.length!==o.length||z.some((L,f)=>o[f]!==L)))return s;o=z;let A;if(r.key&&((g=r.debug)!=null&&g.call(r))&&(A=Date.now()),s=i(...z),r.key&&((m=r.debug)!=null&&m.call(r))){const L=Math.round((Date.now()-y)*100)/100,f=Math.round((Date.now()-A)*100)/100,v=f/16,M=(c,F)=>{for(c=String(c);c.length<F;)c=" "+c;return c};console.info(`%c⏱ ${M(f,5)} /${M(L,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%);`,r?.key)}return r?.onChange&&!(l&&r.skipInitialOnChange)&&r.onChange(s),l=!1,s}return a.updateDeps=d=>{o=d},a}function Ge(n,i){if(n===void 0)throw new Error("Unexpected undefined");return n}const St=(n,i)=>Math.abs(n-i)<1.01,wt=(n,i,r)=>{let o;return function(...s){n.clearTimeout(o),o=n.setTimeout(()=>i.apply(this,s),r)}},Ue=n=>{const{offsetWidth:i,offsetHeight:r}=n;return{width:i,height:r}},jt=n=>n,kt=n=>{const i=Math.max(n.startIndex-n.overscan,0),r=Math.min(n.endIndex+n.overscan,n.count-1),o=[];for(let s=i;s<=r;s++)o.push(s);return o},It=(n,i)=>{const r=n.scrollElement;if(!r)return;const o=n.targetWindow;if(!o)return;const s=a=>{const{width:d,height:g}=a;i({width:Math.round(d),height:Math.round(g)})};if(s(Ue(r)),!o.ResizeObserver)return()=>{};const l=new o.ResizeObserver(a=>{const d=()=>{const g=a[0];if(g?.borderBoxSize){const m=g.borderBoxSize[0];if(m){s({width:m.inlineSize,height:m.blockSize});return}}s(Ue(r))};n.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(d):d()});return l.observe(r,{box:"border-box"}),()=>{l.unobserve(r)}},qe={passive:!0},Ke=typeof window>"u"?!0:"onscrollend"in window,Mt=(n,i)=>{const r=n.scrollElement;if(!r)return;const o=n.targetWindow;if(!o)return;let s=0;const l=n.options.useScrollendEvent&&Ke?()=>{}:wt(o,()=>{i(s,!1)},n.options.isScrollingResetDelay),a=y=>()=>{const{horizontal:z,isRtl:k}=n.options;s=z?r.scrollLeft*(k&&-1||1):r.scrollTop,l(),i(s,y)},d=a(!0),g=a(!1);r.addEventListener("scroll",d,qe);const m=n.options.useScrollendEvent&&Ke;return m&&r.addEventListener("scrollend",g,qe),()=>{r.removeEventListener("scroll",d),m&&r.removeEventListener("scrollend",g)}},Tt=(n,i,r)=>{if(i?.borderBoxSize){const o=i.borderBoxSize[0];if(o)return Math.round(o[r.options.horizontal?"inlineSize":"blockSize"])}return n[r.options.horizontal?"offsetWidth":"offsetHeight"]},zt=(n,{adjustments:i=0,behavior:r},o)=>{var s,l;const a=n+i;(l=(s=o.scrollElement)==null?void 0:s.scrollTo)==null||l.call(s,{[o.options.horizontal?"left":"top"]:a,behavior:r})};class Et{constructor(i){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var r,o,s;return((s=(o=(r=this.targetWindow)==null?void 0:r.performance)==null?void 0:o.now)==null?void 0:s.call(o))??Date.now()},this.observer=(()=>{let r=null;const o=()=>r||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:r=new this.targetWindow.ResizeObserver(s=>{s.forEach(l=>{const a=()=>{const d=l.target,g=this.indexFromElement(d);if(!d.isConnected){this.observer.unobserve(d);return}this.shouldMeasureDuringScroll(g)&&this.resizeItem(g,this.options.measureElement(d,l,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var s;(s=o())==null||s.disconnect(),r=null},observe:s=>{var l;return(l=o())==null?void 0:l.observe(s,{box:"border-box"})},unobserve:s=>{var l;return(l=o())==null?void 0:l.unobserve(s)}}})(),this.range=null,this.setOptions=r=>{Object.entries(r).forEach(([o,s])=>{typeof s>"u"&&delete r[o]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:jt,rangeExtractor:kt,onChange:()=>{},measureElement:Tt,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,...r}},this.notify=r=>{var o,s;(s=(o=this.options).onChange)==null||s.call(o,this,r)},this.maybeNotify=be(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),r=>{this.notify(r)},{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(r=>r()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var r;const o=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==o){if(this.cleanup(),!o){this.maybeNotify();return}this.scrollElement=o,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((r=this.scrollElement)==null?void 0:r.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,l)=>{this.scrollAdjustments=0,this.scrollDirection=l?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=l,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,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=(r,o)=>{const s=new Map,l=new Map;for(let a=o-1;a>=0;a--){const d=r[a];if(s.has(d.lane))continue;const g=l.get(d.lane);if(g==null||d.end>g.end?l.set(d.lane,d):d.end<g.end&&s.set(d.lane,!0),s.size===this.options.lanes)break}return l.size===this.options.lanes?Array.from(l.values()).sort((a,d)=>a.end===d.end?a.index-d.index:a.end-d.end)[0]:void 0},this.getMeasurementOptions=be(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(r,o,s,l,a,d)=>(this.prevLanes!==void 0&&this.prevLanes!==d&&(this.lanesChangedFlag=!0),this.prevLanes=d,this.pendingMeasuredCacheIndexes=[],{count:r,paddingStart:o,scrollMargin:s,getItemKey:l,enabled:a,lanes:d}),{key:!1}),this.getMeasurements=be(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:r,paddingStart:o,scrollMargin:s,getItemKey:l,enabled:a,lanes:d},g)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>r)for(const k of this.laneAssignments.keys())k>=r&&this.laneAssignments.delete(k);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(k=>{this.itemSizeCache.set(k.key,k.size)}));const m=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===r&&(this.lanesSettling=!1);const y=this.measurementsCache.slice(0,m),z=new Array(d).fill(void 0);for(let k=0;k<m;k++){const A=y[k];A&&(z[A.lane]=k)}for(let k=m;k<r;k++){const A=l(k),L=this.laneAssignments.get(k);let f,v;if(L!==void 0&&this.options.lanes>1){f=L;const T=z[f],I=T!==void 0?y[T]:void 0;v=I?I.end+this.options.gap:o+s}else{const T=this.options.lanes===1?y[k-1]:this.getFurthestMeasurement(y,k);v=T?T.end+this.options.gap:o+s,f=T?T.lane:k%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(k,f)}const M=g.get(A),c=typeof M=="number"?M:this.options.estimateSize(k),F=v+c;y[k]={index:k,start:v,size:c,end:F,key:A,lane:f},z[f]=k}return this.measurementsCache=y,y},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=be(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,o,s,l)=>this.range=r.length>0&&o>0?Dt({measurements:r,outerSize:o,scrollOffset:s,lanes:l}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=be(()=>{let r=null,o=null;const s=this.calculateRange();return s&&(r=s.startIndex,o=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,r,o]),[this.options.rangeExtractor,this.options.overscan,this.options.count,r,o]},(r,o,s,l,a)=>l===null||a===null?[]:r({startIndex:l,endIndex:a,overscan:o,count:s}),{key:process.env.NODE_ENV!=="production"&&"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=r=>{const o=this.options.indexAttribute,s=r.getAttribute(o);return s?parseInt(s,10):(console.warn(`Missing attribute name '${o}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=r=>{var o;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const s=this.scrollState.index??((o=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:o.index);if(s!==void 0&&this.range){const l=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),a=Math.max(0,s-l),d=Math.min(this.options.count-1,s+l);return r>=a&&r<=d}return!0},this.measureElement=r=>{if(!r){this.elementsCache.forEach((a,d)=>{a.isConnected||(this.observer.unobserve(a),this.elementsCache.delete(d))});return}const o=this.indexFromElement(r),s=this.options.getItemKey(o),l=this.elementsCache.get(s);l!==r&&(l&&this.observer.unobserve(l),this.observer.observe(r),this.elementsCache.set(s,r)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(o)&&this.resizeItem(o,this.options.measureElement(r,void 0,this))},this.resizeItem=(r,o)=>{var s;const l=this.measurementsCache[r];if(!l)return;const a=this.itemSizeCache.get(l.key)??l.size,d=o-a;d!==0&&(((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(l,d,this):l.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",d),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=d,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(l.index),this.itemSizeCache=new Map(this.itemSizeCache.set(l.key,o)),this.notify(!1))},this.getVirtualItems=be(()=>[this.getVirtualIndexes(),this.getMeasurements()],(r,o)=>{const s=[];for(let l=0,a=r.length;l<a;l++){const d=r[l],g=o[d];s.push(g)}return s},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=r=>{const o=this.getMeasurements();if(o.length!==0)return Ge(o[ot(0,o.length-1,s=>Ge(o[s]).start,r)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const r=this.scrollElement.document.documentElement;return this.options.horizontal?r.scrollWidth-this.scrollElement.innerWidth:r.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(r,o,s=0)=>{if(!this.scrollElement)return 0;const l=this.getSize(),a=this.getScrollOffset();o==="auto"&&(o=r>=a+l?"end":"start"),o==="center"?r+=(s-l)/2:o==="end"&&(r-=l);const d=this.getMaxScrollOffset();return Math.max(Math.min(d,r),0)},this.getOffsetForIndex=(r,o="auto")=>{r=Math.max(0,Math.min(r,this.options.count-1));const s=this.getSize(),l=this.getScrollOffset(),a=this.measurementsCache[r];if(!a)return;if(o==="auto")if(a.end>=l+s-this.options.scrollPaddingEnd)o="end";else if(a.start<=l+this.options.scrollPaddingStart)o="start";else return[l,o];if(o==="end"&&r===this.options.count-1)return[this.getMaxScrollOffset(),o];const d=o==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(d,o,a.size),o]},this.scrollToOffset=(r,{align:o="start",behavior:s="auto"}={})=>{const l=this.getOffsetForAlignment(r,o),a=this.now();this.scrollState={index:null,align:o,behavior:s,startedAt:a,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToIndex=(r,{align:o="auto",behavior:s="auto"}={})=>{r=Math.max(0,Math.min(r,this.options.count-1));const l=this.getOffsetForIndex(r,o);if(!l)return;const[a,d]=l,g=this.now();this.scrollState={index:r,align:d,behavior:s,startedAt:g,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollBy=(r,{behavior:o="auto"}={})=>{const s=this.getScrollOffset()+r,l=this.now();this.scrollState={index:null,align:"start",behavior:o,startedAt:l,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var r;const o=this.getMeasurements();let s;if(o.length===0)s=this.options.paddingStart;else if(this.options.lanes===1)s=((r=o[o.length-1])==null?void 0:r.end)??0;else{const l=Array(this.options.lanes).fill(null);let a=o.length-1;for(;a>=0&&l.some(d=>d===null);){const d=o[a];l[d.lane]===null&&(l[d.lane]=d.end),a--}s=Math.max(...l.filter(d=>d!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(r,{adjustments:o,behavior:s})=>{this.options.scrollToFn(r,{behavior:s,adjustments:o},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(i)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const o=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,s=o?o[0]:this.scrollState.lastTargetOffset,l=1,a=s!==this.scrollState.lastTargetOffset;if(!a&&St(s,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=l){this.scrollState=null;return}}else this.scrollState.stableFrames=0,a&&(this.scrollState.lastTargetOffset=s,this.scrollState.behavior="auto",this._scrollToOffset(s,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const ot=(n,i,r,o)=>{for(;n<=i;){const s=(n+i)/2|0,l=r(s);if(l<o)n=s+1;else if(l>o)i=s-1;else return s}return n>0?n-1:0};function Dt({measurements:n,outerSize:i,scrollOffset:r,lanes:o}){const s=n.length-1,l=g=>n[g].start;if(n.length<=o)return{startIndex:0,endIndex:s};let a=ot(0,s,l,r),d=a;if(o===1)for(;d<s&&n[d].end<r+i;)d++;else if(o>1){const g=Array(o).fill(0);for(;d<s&&g.some(y=>y<r+i);){const y=n[d];g[y.lane]=y.end,d++}const m=Array(o).fill(r+i);for(;a>=0&&m.some(y=>y>=r);){const y=n[a];m[y.lane]=y.start,a--}a=Math.max(0,a-a%o),d=Math.min(s,d+(o-1-d%o))}return{startIndex:a,endIndex:d}}const Je=typeof document<"u"?$e.useLayoutEffect:$e.useEffect;function Ct({useFlushSync:n=!0,...i}){const r=$e.useReducer(()=>({}),{})[1],o={...i,onChange:(l,a)=>{var d;n&&a?ut.flushSync(r):r(),(d=i.onChange)==null||d.call(i,l,a)}},[s]=$e.useState(()=>new Et(o));return s.setOptions(o),Je(()=>s._didMount(),[]),Je(()=>s._willUpdate()),s}function Ve(n){return Ct({observeElementRect:It,observeElementOffset:Mt,scrollToFn:zt,...n})}const rt=864e5,se=(n,i)=>new Date(n.getTime()+i*rt),ve=(n,i)=>Math.round((i.getTime()-n.getTime())/rt),Qe=n=>new Date(n.getFullYear(),n.getMonth(),1),Xe=n=>new Date(n.getFullYear(),n.getMonth()+1,0),st=n=>{if(!n)return"en-US";try{return new Intl.DateTimeFormat(n).resolvedOptions().locale}catch{return"en-US"}},re=(n,i="en-US")=>new Intl.DateTimeFormat(st(i),{day:"2-digit",month:"2-digit",year:"numeric"}).format(n),Ze=(n,i="en")=>new Intl.DateTimeFormat(st(i),{month:"long"}).format(n).toUpperCase();function Rt(){const{props:n,t:i,displayRows:r,leftBodyRef:o,handleLeftScroll:s,toggleProject:l,toggleGroup:a,hoveredTaskId:d,setHoveredTaskId:g,selectedTaskId:m,setSelectedTaskId:y,delayedIds:z,criticalIds:k,relatedIds:A,setActivePinboardTask:L}=Se(),f=I=>({id:I.id,name:I.name,start:I.start,end:I.end,type:I.originalType==="step"?"task":"milestone",progress:I.progress}),v=Ve({count:r.length,getScrollElement:()=>o.current,estimateSize:()=>ee,overscan:12}),M=v.getVirtualItems(),c=Math.max(v.getTotalSize(),400)+80,F=b.useMemo(()=>r.filter(I=>I.kind==="task").map(I=>I.task.id),[r]),T=b.useCallback((I,u)=>{const p=F.indexOf(I);if(p<0)return;const w=Math.min(Math.max(0,p+u),F.length-1),W=F[w];W&&y(W)},[F,y]);return t.jsxs("div",{style:{width:mt,flexShrink:0,borderRight:`1px solid ${e.border}`,display:"flex",flexDirection:"column",height:"100%"},children:[t.jsxs("div",{style:{boxSizing:"border-box",display:"flex",alignItems:"center",padding:"0 16px",height:xt,background:e.headerBg,borderBottom:`1px solid ${e.border}`},children:[t.jsx("div",{style:{flex:1,fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",color:e.textSecondary},children:i("charts.gantt.stepName","STEP NAME")}),t.jsx("div",{style:{width:80,fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",textAlign:"center",color:e.textSecondary},children:i("charts.gantt.start","START")}),t.jsx("div",{style:{width:80,fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",textAlign:"center",color:e.textSecondary},children:i("charts.gantt.end","END")})]}),t.jsx("div",{ref:o,onScroll:s,className:"zg-no-scrollbar",style:{overflowY:"auto",overflowX:"hidden",flex:1},role:"grid","aria-rowcount":r.length,children:t.jsx("div",{style:{height:c,position:"relative"},children:M.map(I=>{const u=r[I.index];if(!u)return null;const p={position:"absolute",top:I.start,left:0,width:"100%",height:ee};if(u.kind==="projectHeader")return t.jsx("div",{style:{...p,boxSizing:"border-box",display:"flex",alignItems:"center",padding:"0 16px",cursor:"pointer",userSelect:"none",borderBottom:`1.5px solid ${e.groupBorderWeak}`,background:e.groupSoft},onClick:()=>l(u.projectId),onKeyDown:$=>{($.key==="Enter"||$.key===" ")&&($.preventDefault(),l(u.projectId))},role:"button",tabIndex:0,"aria-label":`Toggle project ${u.projectTitle}`,"aria-expanded":!u.collapsed,children:t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0},children:[u.collapsed?t.jsx(Y.ChevronRight,{size:15,style:{color:e.group,flexShrink:0}}):t.jsx(Y.ChevronDown,{size:15,style:{color:e.group,flexShrink:0}}),t.jsx("span",{style:{fontSize:12,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.1em",color:e.group,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.projectTitle})]})},`ph-${u.projectId}`);if(u.kind==="group"){const $=u.projectId?`${u.projectId}-${u.groupType}`:u.groupType;return t.jsx("div",{style:{...p,boxSizing:"border-box",display:"flex",alignItems:"center",padding:"0 16px",cursor:"pointer",userSelect:"none",borderBottom:`1px solid ${e.border}`,background:e.headerBg},onClick:()=>a($),onKeyDown:ne=>{(ne.key==="Enter"||ne.key===" ")&&(ne.preventDefault(),a($))},role:"button",tabIndex:0,"aria-label":`Toggle group ${u.label}`,"aria-expanded":!u.collapsed,children:t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0},children:[u.collapsed?t.jsx(Y.ChevronRight,{size:14,style:{color:e.textSecondary,flexShrink:0}}):t.jsx(Y.ChevronDown,{size:14,style:{color:e.textSecondary,flexShrink:0}}),t.jsx("span",{style:{fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",color:e.textTitle},children:i(`gantt.group.${u.groupType}`,u.label)}),t.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 6px",borderRadius:9999,background:e.groupSoftStrong,color:e.textSecondary},children:u.count})]})},`g-${$}`)}const w=u.task,W=m===w.id,O=d===w.id,q=w.originalType!=="step",h=z.has(w.id),K=k.has(w.id),R=m!==null&&w.id!==m&&!A.has(w.id),te=m!==null&&A.has(w.id),J=h?e.dangerBgSoft:W?e.groupLight:te?e.groupLightStrong:O?e.pageBg:e.surface;return t.jsxs("div",{style:{...p,boxSizing:"border-box",display:"flex",alignItems:"center",padding:"0 16px",cursor:"pointer",transition:"opacity 0.18s, background 0.15s",borderBottom:`1px solid ${e.borderLight}`,background:J,borderLeft:W?`3px solid ${e.group}`:te?`3px solid ${e.groupGlow}`:K?`3px solid ${e.today}`:void 0,opacity:R?.3:1},onClick:()=>y($=>$===w.id?null:w.id),onDoubleClick:()=>n.onTaskClick?.(f(w)),onMouseEnter:()=>g(w.id),onMouseLeave:()=>g(null),onKeyDown:$=>{if($.key==="Enter"){$.preventDefault(),n.onTaskClick?.(f(w));return}if($.key===" "){$.preventDefault(),y(ne=>ne===w.id?null:w.id);return}if($.key==="ArrowDown"){$.preventDefault(),T(w.id,1);return}$.key==="ArrowUp"&&($.preventDefault(),T(w.id,-1))},role:"button",tabIndex:0,"aria-selected":W,"aria-label":`Task ${w.name}`,children:[t.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",gap:8,minWidth:0,paddingRight:8},children:[w.originalType==="step"&&t.jsx("div",{style:{flexShrink:0,borderRadius:4,width:14,height:14,background:le[w.colorIdx??0].bar,border:`1.5px solid ${le[w.colorIdx??0].barBorder}`}}),w.originalType==="milestone"&&t.jsx("div",{style:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",width:22,height:22,background:e.milestoneRingSoft,border:`1.5px solid ${e.milestoneRing}`},children:t.jsx(Y.Flag,{size:11,style:{color:e.milestone}})}),w.originalType==="event"&&t.jsx("div",{style:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",width:22,height:22,background:e.eventSoft,border:`1.5px solid ${e.eventBorderSoft}`},children:t.jsx(Y.Clock,{size:11,style:{color:e.event}})}),t.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0},children:t.jsx("span",{style:{fontSize:13,fontWeight:500,lineHeight:1.25,color:W?e.group:h?e.today:e.textPrimary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:w.name})}),(w.attachedNotes?.length||0)>0&&t.jsxs("button",{className:"zg-note-badge-btn","aria-label":`Open ${w.attachedNotes?.length} linked notes`,style:{flexShrink:0,display:"flex",alignItems:"center",gap:4,fontSize:11,fontWeight:700,padding:"4px 10px",borderRadius:6,color:e.noteBadgeText,background:e.noteBadgeBg,border:"none",cursor:"pointer",boxShadow:e.shadowSmall,transition:"transform 0.12s ease"},onClick:$=>{$.stopPropagation(),L(w)},children:[t.jsx(Y.Paperclip,{size:12}),w.attachedNotes?.length]}),h&&t.jsx(Y.AlertTriangle,{size:12,style:{flexShrink:0,color:e.today}})]}),t.jsx("div",{style:{width:80,fontSize:11,fontWeight:500,textAlign:"center",fontVariantNumeric:"tabular-nums",color:h?e.today:e.textMuted},children:re(w.start,n.locale)}),t.jsx("div",{style:{width:80,fontSize:11,fontWeight:500,textAlign:"center",fontVariantNumeric:"tabular-nums",color:h?e.today:e.textMuted},children:q?"—":re(w.end,n.locale)})]},w.id)})})})]})}function Ft(n,i,r="en"){const o=i==="day"?yt:bt,s=(f,v)=>{const M=[],c=new Date().toDateString();let F=-1;for(let T=0;T<v;T++){const I=se(f,T),u=I.toDateString()===c;u&&(F=T),M.push({date:I,isToday:u,isWeekend:I.getDay()===0||I.getDay()===6})}return{daysArr:M,todayIndex:F}};if(n.length===0){const f=new Date,v=Qe(f),M=Xe(f),c=ve(v,M)+1,{daysArr:F,todayIndex:T}=s(v,c);return{start:v,end:M,totalDays:c,dayWidth:o,totalWidth:c*o,months:[{date:v,label:`${Ze(v,r)} ${v.getFullYear()}`,startDay:0,days:c,width:c*o}],years:[{label:v.getFullYear().toString(),width:c*o}],days:F,todayIndex:T}}let l=new Date(n[0].start),a=new Date(n[0].end);n.forEach(f=>{f.start<l&&(l=new Date(f.start)),f.end>a&&(a=new Date(f.end))});const d=Qe(se(l,-14)),g=Xe(se(a,14)),m=ve(d,g)+1,y=[];let z=new Date(d);for(;z<=g;){const f=Xe(z),v=f>g?g:f,M=ve(d,z),c=ve(z,v)+1;y.push({date:new Date(z),label:`${Ze(z,r)} ${z.getFullYear()}`,startDay:M,days:c,width:c*o}),z=new Date(z.getFullYear(),z.getMonth()+1,1)}const{daysArr:k,todayIndex:A}=s(d,m),L=[];if(i==="month"){let f="",v=0;for(const M of y){const c=M.date.getFullYear().toString();c!==f?(f&&L.push({label:f,width:v*o}),f=c,v=M.days):v+=M.days}f&&L.push({label:f,width:v*o})}return{start:d,end:g,totalDays:m,dayWidth:o,totalWidth:m*o,months:y,years:L,days:k,todayIndex:A}}function pe(n,i){return ve(i.start,n)*i.dayWidth}function At({task:n,x:i,y:r,w:o,progW:s,isHov:l,isDrag:a,isResize:d,isCritical:g,isDelayed:m,isConnectTarget:y,showDots:z,isBarDimmed:k,isBarHighlighted:A,commonEvents:L,handleResizeMouseDown:f,handleResizeTouchStart:v,handleConnectDotMouseDown:M,handleConnectDotTouchStart:c}){const{timeline:F,viewMode:T,props:I}=Se();if(n.originalType==="step"){const u=le[n.colorIdx??0],p=r+(ee-ae)/2,w=!!(n.previsionStart&&n.previsionEnd),W=w?pe(n.previsionStart,F):0,O=w?Math.max(pe(n.previsionEnd,F)-W,T==="month"?F.dayWidth:6):0,q=p+ae+3;return t.jsxs(t.Fragment,{children:[w&&t.jsx("div",{title:`Previsto: ${re(n.previsionStart,I.locale)} → ${re(n.previsionEnd,I.locale)}`,style:{position:"absolute",left:W,top:q,width:O,height:5,borderRadius:3,background:`${u.progress}33`,border:`1.5px solid ${u.progress}66`,boxShadow:`inset 0 0 0 1px ${u.progress}22`,pointerEvents:"none",zIndex:5}}),t.jsxs("div",{"data-task-id":n.id,...L,role:"button",tabIndex:0,"aria-label":`Task bar ${n.name}`,style:{position:"absolute",left:i,top:p,width:o,height:ae,borderRadius:ae/2,background:m?e.delayedTaskBg:u.bar,border:g?`2px solid ${e.today}`:m?`1.5px solid ${e.todayStrong}`:`1.5px solid ${u.barBorder}`,cursor:a||d?"grabbing":"grab",zIndex:l||y?20:10,boxShadow:y?`0 0 0 2px ${e.group}, 0 4px 16px ${e.groupGlowSoft}`:g?`0 0 0 1px ${e.todayMid}, 0 3px 12px ${e.todaySoft}`:A&&!l?`0 0 0 2px ${e.groupGlowStrong}, 0 3px 14px ${e.groupGlowSoft}`:l?`0 3px 12px ${u.progress}22`:"none",transform:l?"scaleY(1.06)":"scaleY(1)",opacity:k?.15:1,transition:a||d?"none":"box-shadow 0.2s, transform 0.15s, opacity 0.18s",overflow:"visible"},children:[t.jsxs("div",{style:{position:"absolute",left:0,top:0,width:o,height:"100%",borderRadius:ae/2,overflow:"hidden",pointerEvents:"none"},children:[t.jsx("div",{style:{position:"absolute",left:0,top:0,width:s,height:"100%",background:m?`linear-gradient(90deg, ${e.today}, ${e.todayStrong})`:`linear-gradient(90deg, ${u.progress}, ${u.progress}cc)`,borderRadius:`${ae/2}px 0 0 ${ae/2}px`,transition:a||d?"none":"width 0.3s"}}),o>50&&t.jsxs("span",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:700,letterSpacing:"0.05em",color:n.progress>50?e.white:m?e.today:u.progress,zIndex:1,pointerEvents:"none"},children:[Math.round(n.progress),"%"]})]}),t.jsx("div",{onMouseDown:h=>f(h,n,"left"),onTouchStart:h=>v(h,n,"left"),style:{position:"absolute",left:0,top:0,width:8,height:"100%",cursor:"col-resize",zIndex:2,borderRadius:`${ae/2}px 0 0 ${ae/2}px`}}),t.jsx("div",{onMouseDown:h=>f(h,n,"right"),onTouchStart:h=>v(h,n,"right"),style:{position:"absolute",right:0,top:0,width:8,height:"100%",cursor:"col-resize",zIndex:2,borderRadius:`0 ${ae/2}px ${ae/2}px 0`}}),z&&t.jsxs(t.Fragment,{children:[t.jsx("div",{"data-task-id":n.id,onMouseDown:h=>M(h,n,"left"),onTouchStart:h=>c(h,n,"left"),style:{position:"absolute",left:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:e.group,border:`2.5px solid ${e.connectorDotBorder}`,boxShadow:e.shadowLarge,cursor:"crosshair",zIndex:30}}),t.jsx("div",{"data-task-id":n.id,onMouseDown:h=>M(h,n,"right"),onTouchStart:h=>c(h,n,"right"),style:{position:"absolute",right:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:e.group,border:`2.5px solid ${e.connectorDotBorder}`,boxShadow:e.shadowLarge,cursor:"crosshair",zIndex:30}})]})]})]})}if(n.originalType==="milestone"){const u=r+(ee-ye)/2;return t.jsxs("div",{"data-task-id":n.id,...L,role:"button",tabIndex:0,"aria-label":`Milestone ${n.name}`,style:{position:"absolute",left:i-6,top:u,height:ye,minWidth:_e,borderRadius:ye/2,background:g?e.criticalPillBg:e.milestonePillBg,border:y?`2px solid ${e.group}`:g?`2px solid ${e.today}`:`1.5px solid ${e.milestoneRing}`,display:"flex",alignItems:"center",gap:6,paddingLeft:4,paddingRight:12,cursor:a?"grabbing":"grab",zIndex:l||y?20:10,boxShadow:y?`0 0 0 2px ${e.group}, 0 4px 16px ${e.groupGlowSoft}`:g?`0 0 0 1px ${e.todayMid}, 0 3px 12px ${e.todaySoft}`:A&&!l?`0 0 0 2px ${e.groupGlowStrong}, 0 3px 14px ${e.groupGlowSoft}`:l?`0 3px 12px ${e.milestoneRingSoft}`:e.shadowSoft,opacity:k?.15:1,transition:"box-shadow 0.2s, transform 0.15s, opacity 0.18s",transform:l?"translateY(-1px)":"none",whiteSpace:"nowrap",overflow:"visible"},children:[t.jsx("div",{style:{width:20,height:20,borderRadius:"50%",background:g?e.today:e.milestone,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t.jsx(Y.Flag,{size:11,color:e.white,strokeWidth:2.5})}),t.jsx("span",{style:{fontSize:11,fontWeight:600,color:g?e.today:e.milestone,overflow:"hidden",textOverflow:"ellipsis",maxWidth:130},children:n.name}),n.progress>=100&&t.jsx("span",{style:{fontSize:9,fontWeight:700,color:e.white,background:e.milestoneRing,borderRadius:6,padding:"1px 5px"},children:"✓"}),z&&t.jsxs(t.Fragment,{children:[t.jsx("div",{"data-task-id":n.id,onMouseDown:p=>M(p,n,"left"),onTouchStart:p=>c(p,n,"left"),style:{position:"absolute",left:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:e.group,border:`2.5px solid ${e.connectorDotBorder}`,boxShadow:e.shadowLarge,cursor:"crosshair",zIndex:30}}),t.jsx("div",{"data-task-id":n.id,onMouseDown:p=>M(p,n,"right"),onTouchStart:p=>c(p,n,"right"),style:{position:"absolute",right:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:e.group,border:`2.5px solid ${e.connectorDotBorder}`,boxShadow:e.shadowLarge,cursor:"crosshair",zIndex:30}})]})]})}if(n.originalType==="event"){const u=r+(ee-ye)/2;return t.jsxs("div",{"data-task-id":n.id,...L,role:"button",tabIndex:0,"aria-label":`Event ${n.name}`,style:{position:"absolute",left:i-6,top:u,height:ye,minWidth:_e,borderRadius:ye/2,background:g?e.criticalPillBg:e.eventPillBg,border:y?`2px solid ${e.group}`:g?`2px solid ${e.today}`:`1.5px solid ${e.event}`,display:"flex",alignItems:"center",gap:6,paddingLeft:4,paddingRight:12,cursor:a?"grabbing":"grab",zIndex:l||y?20:10,boxShadow:y?`0 0 0 2px ${e.group}, 0 4px 16px ${e.groupGlowSoft}`:g?`0 0 0 1px ${e.todayMid}, 0 3px 12px ${e.todaySoft}`:A&&!l?`0 0 0 2px ${e.groupGlowStrong}, 0 3px 14px ${e.groupGlowSoft}`:l?`0 3px 12px ${e.eventBorderSoft}`:e.shadowSoft,opacity:k?.15:1,transition:"box-shadow 0.2s, transform 0.15s, opacity 0.18s",transform:l?"translateY(-1px)":"none",whiteSpace:"nowrap",overflow:"visible"},children:[t.jsx("div",{style:{width:20,height:20,borderRadius:"50%",background:g?e.today:e.event,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t.jsx(Y.Clock,{size:11,color:e.white,strokeWidth:2.5})}),t.jsx("span",{style:{fontSize:11,fontWeight:600,color:g?e.today:e.event,overflow:"hidden",textOverflow:"ellipsis",maxWidth:130},children:n.name}),n.progress>=100&&t.jsx("span",{style:{fontSize:9,fontWeight:700,color:e.white,background:e.event,borderRadius:6,padding:"1px 5px"},children:"✓"}),z&&t.jsxs(t.Fragment,{children:[t.jsx("div",{"data-task-id":n.id,onMouseDown:p=>M(p,n,"left"),onTouchStart:p=>c(p,n,"left"),style:{position:"absolute",left:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:e.group,border:`2.5px solid ${e.connectorDotBorder}`,boxShadow:e.shadowLarge,cursor:"crosshair",zIndex:30}}),t.jsx("div",{"data-task-id":n.id,onMouseDown:p=>M(p,n,"right"),onTouchStart:p=>c(p,n,"right"),style:{position:"absolute",right:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:e.group,border:`2.5px solid ${e.connectorDotBorder}`,boxShadow:e.shadowLarge,cursor:"crosshair",zIndex:30}})]})]})}if(n.originalType==="note"){const p=r+4,w=n.noteColor||e.noteDefaultBg,W=n.filesCount||0;return t.jsxs("div",{"data-task-id":n.id,...L,role:"button",tabIndex:0,"aria-label":`Note ${n.name}`,style:{position:"absolute",left:i,top:p,width:148,minHeight:72,background:w,borderRadius:3,cursor:a?"grabbing":"grab",zIndex:l||y?20:10,boxShadow:y?`0 0 0 2px ${e.group}, ${e.shadowStickyStrong}`:A&&!l?`0 0 0 2px ${e.groupGlowStrong}, ${e.shadowStickyHover}`:l?e.shadowStickyHover:e.shadowSticky,opacity:k?.2:1,transition:a?"none":"box-shadow 0.2s, transform 0.15s, opacity 0.18s",transform:l?"rotate(-1.5deg) scale(1.03) translateY(-2px)":"rotate(0deg)",border:`1px solid ${e.groupSoftStrong}`,padding:"12px 10px 10px",display:"flex",flexDirection:"column",gap:2,userSelect:"none"},children:[t.jsx("div",{style:{position:"absolute",top:-6,left:"50%",transform:"translateX(-50%)",width:40,height:11,background:e.stickyTape,borderRadius:2,boxShadow:e.shadowTiny}}),t.jsx("span",{style:{fontSize:13,fontWeight:700,color:e.inkStrong,lineHeight:"1.3",wordBreak:"break-word",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:n.name}),n.projectTitle&&t.jsx("span",{style:{fontSize:10,fontWeight:400,color:e.inkSoft3,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.projectTitle}),t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:2},children:[t.jsx("span",{style:{fontSize:9,fontWeight:500,color:e.inkSoft4},children:re(n.start,I.locale)}),W>0&&t.jsxs("span",{style:{display:"flex",alignItems:"center",gap:2,fontSize:9,color:e.inkSoft4},children:[t.jsx(Y.Paperclip,{size:8})," ",W]})]}),z&&t.jsxs(t.Fragment,{children:[t.jsx("div",{"data-task-id":n.id,onMouseDown:O=>M(O,n,"left"),onTouchStart:O=>c(O,n,"left"),style:{position:"absolute",left:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:e.group,border:`2.5px solid ${e.connectorDotBorder}`,boxShadow:e.shadowLarge,cursor:"crosshair",zIndex:30}}),t.jsx("div",{"data-task-id":n.id,onMouseDown:O=>M(O,n,"right"),onTouchStart:O=>c(O,n,"right"),style:{position:"absolute",right:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:e.group,border:`2.5px solid ${e.connectorDotBorder}`,boxShadow:e.shadowLarge,cursor:"crosshair",zIndex:30}})]})]})}return null}function Bt({arrows:n}){const{arrows:i,hoveredTaskId:r,selectedTaskId:o,relatedIds:s}=Se(),l=n||i;return t.jsx(t.Fragment,{children:l.map((a,d)=>{const g=r===a.predId||r===a.succId,m=!o||a.predId===o||a.succId===o||s.has(a.predId)||s.has(a.succId),y=o!==null&&m,z=g?e.arrowHover:y?e.group:e.arrow;return t.jsxs("g",{style:{opacity:m?y?1:void 0:.08,transition:"opacity 0.18s"},children:[t.jsx("path",{d:a.path,fill:"none",stroke:z,strokeWidth:y?2.5:g?2:1.5,style:{transition:"stroke 0.2s, stroke-width 0.2s"}}),t.jsx("polygon",{points:`${a.headX},${a.headY} ${a.headX-6},${a.headY-4} ${a.headX-6},${a.headY+4}`,fill:z,style:{transition:"fill 0.2s"}})]},d)})})}const We=n=>({id:n.id,name:n.name,start:n.start,end:n.end,type:n.originalType==="step"?"task":n.originalType,progress:n.progress}),Te=(n,i)=>{switch(n){case"step":return t.jsx("div",{style:{width:12,height:12,borderRadius:2,background:le[i??0].bar,border:`1.5px solid ${le[i??0].barBorder}`,flexShrink:0}});case"milestone":return t.jsx("div",{style:{width:16,height:16,borderRadius:"50%",background:e.milestone,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t.jsx(Y.Flag,{size:8,color:e.white})});case"event":return t.jsx("div",{style:{width:16,height:16,borderRadius:"50%",background:e.event,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t.jsx(Y.Clock,{size:8,color:e.white})});case"note":return t.jsx("div",{style:{width:12,height:14,background:e.note,borderRadius:2,boxShadow:e.shadowSmall,flexShrink:0}});default:return null}};function Lt(){const{props:n,t:i,viewMode:r,timeline:o,displayRows:s,dragState:l,resizeState:a,connectState:d,pendingConnection:g,setPendingConnection:m,depModalType:y,setDepModalType:z,depModalLag:k,setDepModalLag:A,depCreating:L,deletingDepId:f,setDeletingDepId:v,chartMenu:M,setChartMenu:c,rightBodyRef:F,timeHeaderRef:T,handleChartMouseDown:I,handleChartTouchStart:u,handleChartWheel:p,openChartMenu:w,handleRightScroll:W,hoveredTaskId:O,setHoveredTaskId:q,selectedTaskId:h,setSelectedTaskId:K,tooltip:R,setTooltip:te,popupState:J,setPopupState:$,arrows:ne,criticalIds:Pe,delayedIds:Oe,relatedIds:he,handleBarMouseDown:Ne,handleBarTouchStart:we,handleResizeMouseDown:Ee,handleResizeTouchStart:je,handleConnectDotMouseDown:De,handleConnectDotTouchStart:ke,handleCreateDependency:Ce}=Se(),{onViewStage:xe,onEditStage:Re,onDeleteStage:Fe,onDeleteDependency:H,onAddNewStage:U,onAddMilestone:Ae,onAddEvent:Be,onAddNote:Le}=n,Ie=(j,_)=>Math.round((_.getTime()-j.getTime())/864e5)+1,Me=Ve({count:s.length,getScrollElement:()=>F.current,estimateSize:()=>ee,overscan:12}),ue=Me.getVirtualItems(),ge=Ve({horizontal:!0,count:o.days.length,getScrollElement:()=>F.current,estimateSize:()=>o.dayWidth,overscan:10}).getVirtualItems(),ie=Math.max(Me.getTotalSize(),400)+80,oe=b.useMemo(()=>{const j=new Set;for(const _ of ue){const P=s[_.index];P?.kind==="task"&&j.add(P.task.id)}return j},[ue,s]),fe=b.useMemo(()=>ne.filter(j=>oe.has(j.predId)||oe.has(j.succId)),[ne,oe]),me=()=>$({isOpen:!1,position:{x:0,y:0},task:null});return t.jsxs("div",{style:{flex:1,width:"100%",background:"var(--zg-surface-alt)",display:"flex",flexDirection:"column",position:"relative",overflow:"hidden",borderLeft:`1px solid ${e.borderLight}`},children:[t.jsx("div",{ref:T,style:{boxSizing:"border-box",height:ze*2,background:e.headerBg,borderBottom:`1px solid ${e.borderLight}`,overflow:"hidden",position:"relative",flexShrink:0,boxShadow:e.shadowTiny},onWheel:p,children:t.jsxs("div",{style:{width:o.totalWidth,height:"100%",position:"relative"},children:[t.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,height:ze,display:"flex"},children:[r==="day"&&o.months.map((j,_)=>t.jsx("div",{style:{width:j.width,position:"relative",height:"100%",borderRight:`1px solid ${e.borderLight}`,paddingLeft:12,display:"flex",alignItems:"flex-end",paddingBottom:6},children:t.jsx("span",{style:{fontSize:13,fontWeight:700,color:e.textTitle,letterSpacing:"0.02em"},children:j.label})},_)),r==="month"&&o.years?.map((j,_)=>t.jsx("div",{style:{width:j.width,position:"relative",height:"100%",borderRight:`1px solid ${e.borderLight}`,paddingLeft:12,display:"flex",alignItems:"flex-end",paddingBottom:6},children:t.jsx("span",{style:{fontSize:13,fontWeight:700,color:e.textTitle,letterSpacing:"0.02em"},children:j.label})},_))]}),t.jsxs("div",{style:{position:"absolute",top:ze,left:0,right:0,height:ze,display:"flex"},children:[r==="day"&&t.jsx("div",{style:{width:o.totalWidth,height:"100%",position:"relative"},children:ge.map(j=>{const _=o.days[j.index];if(!_)return null;const P=_.isToday;return t.jsx("div",{style:{position:"absolute",left:j.start,width:j.size,height:"100%",borderRight:`1px solid ${e.borderLight}`,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:t.jsx("span",{style:{fontSize:11,fontWeight:P?800:500,color:P?e.today:e.textSecondary,letterSpacing:"-0.03em"},children:_.date.getDate().toString().padStart(2,"0")})},`day-${j.index}`)})}),r==="month"&&o.months.map((j,_)=>t.jsx("div",{style:{width:j.width,position:"relative",height:"100%",borderRight:`1px solid ${e.borderLight}`,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:t.jsx("span",{style:{fontSize:11,fontWeight:600,color:e.textPrimary,textTransform:"uppercase",letterSpacing:"0.05em"},children:j.label.substring(0,3)})},_))]})]})}),t.jsx("div",{ref:F,className:"zg-no-scrollbar",style:{flex:1,overflow:"auto",background:"var(--zg-surface)",position:"relative"},onScroll:W,onMouseDown:I,onTouchStart:u,onWheel:p,onContextMenu:w,children:t.jsxs("div",{style:{width:o.totalWidth,height:ie,position:"relative"},children:[t.jsxs("svg",{width:o.totalWidth,height:ie,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[t.jsxs("defs",{children:[t.jsx("pattern",{id:"gantt-y-lines",x:"0",y:"0",width:o.dayWidth,height:ee,patternUnits:"userSpaceOnUse",children:t.jsx("line",{x1:o.dayWidth,y1:"0",x2:o.dayWidth,y2:ee,stroke:e.border,strokeWidth:"1",strokeDasharray:"4 4",opacity:"0.4"})}),t.jsx("pattern",{id:"gantt-x-lines",x:"0",y:"0",width:o.dayWidth,height:ee,patternUnits:"userSpaceOnUse",children:t.jsx("line",{x1:"0",y1:ee,x2:o.dayWidth,y2:ee,stroke:e.borderLight,strokeWidth:"1"})})]}),t.jsx("rect",{width:"100%",height:"100%",fill:"url(#gantt-x-lines)"}),t.jsx("rect",{width:"100%",height:"100%",fill:"url(#gantt-y-lines)"}),r==="day"&&ge.map(j=>o.days[j.index]?.isWeekend?t.jsx("rect",{x:j.start,y:0,width:j.size,height:ie,fill:e.weekendBg,opacity:.6},`we-${j.index}`):null),r==="month"&&ge.map(j=>o.days[j.index]?.isWeekend?t.jsx("rect",{x:j.start,y:0,width:j.size,height:ie,fill:e.weekendBg,opacity:.3},`wem-${j.index}`):null),o.todayIndex>=0&&t.jsxs("g",{children:[t.jsx("rect",{x:o.todayIndex*o.dayWidth,y:0,width:o.dayWidth,height:ie,fill:e.todayBg}),t.jsx("line",{x1:(o.todayIndex+.5)*o.dayWidth,y1:0,x2:(o.todayIndex+.5)*o.dayWidth,y2:ie,stroke:e.today,strokeWidth:2,strokeDasharray:"4 4",opacity:.3})]})]}),ue.map(j=>{const _=s[j.index];return _&&(_.kind==="group"||_.kind==="projectHeader")?t.jsx("div",{style:{boxSizing:"border-box",position:"absolute",left:0,top:j.start,width:"100%",height:ee,background:_.kind==="projectHeader"?e.headerBg:e.groupLightSoft,borderBottom:`1px solid ${e.borderLight}`,pointerEvents:"none"}},`bg-${j.index}`):null}),t.jsxs("div",{style:{position:"absolute",inset:0},children:[ue.map(j=>{const _=s[j.index];if(!_||_.kind!=="task")return null;const P=_.task,x=l?.task.id===P.id,S=a?.task.id===P.id,E=x||S&&a.edge==="left"?se(P.start,x?l.offsetDays:a.offsetDays):P.start,C=x||S&&a.edge==="right"?se(P.end,x?l.offsetDays:a.offsetDays):P.end,N=P.originalType!=="step",B=pe(E,o);let D=0,G=0;N||(D=Math.max(pe(C,o)-B,o.dayWidth),G=D*(P.progress/100));const X=O===P.id,V=h===P.id,Z=Oe.has(P.id),de=Pe.has(P.id),at=!!h&&!V&&!he.has(P.id),lt=V||!!h&&he.has(P.id),dt=d?.hoverTargetId===P.id,ct=X||V,pt=j.start,ht={onMouseEnter:Q=>{q(P.id),!l&&!a&&te({task:P,x:Q.clientX,y:Q.clientY})},onMouseMove:Q=>{O===P.id&&!l&&!a&&te({task:P,x:Q.clientX,y:Q.clientY})},onMouseLeave:()=>{q(null),te(null)},onClick:Q=>{Q.stopPropagation(),K(P.id),Q.detail===2&&xe?.(We(P)),$(!J.isOpen||J.task?.id!==P.id?{isOpen:!0,position:{x:Q.clientX,y:Q.clientY},task:P}:{isOpen:!1,position:{x:0,y:0},task:null})},onMouseDown:Q=>Ne(Q,P),onTouchStart:Q=>we(Q,P),onKeyDown:Q=>{if(Q.key==="Enter"){Q.preventDefault(),xe?.(We(P));return}Q.key===" "&&(Q.preventDefault(),K(P.id))}};return t.jsx(At,{task:P,x:B,y:pt,w:D,progW:G,isHov:X,isDrag:x,isResize:S,isCritical:de,isDelayed:Z,isConnectTarget:dt,showDots:ct,isBarDimmed:at,isBarHighlighted:lt,commonEvents:ht,handleResizeMouseDown:Ee,handleResizeTouchStart:je,handleConnectDotMouseDown:De,handleConnectDotTouchStart:ke},P.id)}),t.jsx("svg",{width:o.totalWidth,height:ie,style:{position:"absolute",inset:0,pointerEvents:"none"},children:t.jsx(Bt,{arrows:fe})}),R&&!l&&t.jsx("div",{style:{position:"fixed",left:R.x+16,top:R.y-10,zIndex:9999,pointerEvents:"none"},children:t.jsxs("div",{style:{borderRadius:12,padding:"12px 16px",minWidth:220,maxWidth:340,background:e.surfaceFrost,border:`1px solid ${e.borderLight}`,boxShadow:"var(--zg-shadow-popover)"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[Te(R.task.originalType,R.task.colorIdx),t.jsx("span",{style:{fontSize:12,fontWeight:700,color:e.textTitle,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:R.task.name})]}),t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:11,color:e.textSecondary},children:R.task.originalType==="step"?t.jsxs(t.Fragment,{children:[R.task.previsionStart&&R.task.previsionEnd&&t.jsxs("div",{style:{background:`${e.headerBg}`,borderRadius:6,padding:"4px 6px",marginBottom:2},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:4},children:[t.jsx("div",{style:{width:20,height:4,borderRadius:2,background:e.textSecondarySoft,border:`1.5px solid ${e.textSecondaryMid}`}}),t.jsx("span",{style:{fontSize:9,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:e.textSecondary},children:i("gantt.tooltip.planned","Planned")})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[t.jsxs("span",{children:[i("gantt.tooltip.start","Start"),":"]}),t.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:e.textPrimary},children:re(R.task.previsionStart,n.locale)})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[t.jsxs("span",{children:[i("gantt.tooltip.end","End"),":"]}),t.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:e.textPrimary},children:re(R.task.previsionEnd,n.locale)})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[t.jsxs("span",{children:[i("gantt.tooltip.duration","Duration"),":"]}),t.jsxs("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:e.textPrimary},children:[Ie(R.task.previsionStart,R.task.previsionEnd),"d"]})]})]}),t.jsxs("div",{style:{background:R.task.hasActualDates?e.groupLightSoft:"transparent",borderRadius:6,padding:"4px 6px"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:4},children:[t.jsx("div",{style:{width:20,height:4,borderRadius:2,background:le[R.task.colorIdx??0].progress}}),t.jsx("span",{style:{fontSize:9,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:R.task.hasActualDates?e.group:e.textSecondary},children:R.task.hasActualDates?i("gantt.tooltip.actual","Actual"):i("gantt.tooltip.plannedInUse","Planned (in use)")})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[t.jsxs("span",{children:[i("gantt.tooltip.start","Start"),":"]}),t.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:e.textPrimary},children:re(R.task.start,n.locale)})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[t.jsxs("span",{children:[i("gantt.tooltip.end","End"),":"]}),t.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:e.textPrimary},children:re(R.task.end,n.locale)})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[t.jsxs("span",{children:[i("gantt.tooltip.duration","Duration"),":"]}),t.jsxs("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:e.textPrimary},children:[Ie(R.task.start,R.task.end),"d"]})]})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16,paddingTop:4,marginTop:4,borderTop:`1px solid ${e.borderLight}`},children:[t.jsxs("span",{children:[i("charts.gantt.progress","Progress"),":"]}),t.jsxs("span",{style:{fontWeight:700,color:e.group},children:[Math.round(R.task.progress),"%"]})]})]}):R.task.originalType==="note"?t.jsxs(t.Fragment,{children:[R.task.noteProjectTitle&&t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:4},children:[t.jsx("div",{style:{width:8,height:8,borderRadius:2,background:R.task.noteColor||e.note,flexShrink:0}}),t.jsx("span",{style:{fontSize:11,fontWeight:600,color:e.textPrimary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:R.task.noteProjectTitle})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[t.jsxs("span",{children:[i("gantt.tooltip.date","Date"),":"]}),t.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:e.textPrimary},children:re(R.task.start,n.locale)})]}),(R.task.filesCount||0)>0&&t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[t.jsxs("span",{children:[i("gantt.tooltip.attachments","Attachments"),":"]}),t.jsxs("span",{style:{fontWeight:600,display:"flex",alignItems:"center",gap:4,color:e.textPrimary},children:[t.jsx(Y.Paperclip,{size:10}),R.task.filesCount]})]})]}):t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[t.jsxs("span",{children:[i("charts.gantt.start","Start"),":"]}),t.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:e.textPrimary},children:re(R.task.start,n.locale)})]})})]})})]})]})}),J.task&&J.isOpen&&(()=>{const j=J.task,_=(n.dependencies||[]).filter(C=>C.predecessorId===j.id||C.successorId===j.id),P={FS:i("gantt.depType.fs","Finish to Start"),SS:i("gantt.depType.ss","Start to Start"),FF:i("gantt.depType.ff","Finish to Finish"),SF:i("gantt.depType.sf","Start to Finish")},x=_.length>0?300:220,S=Math.min(J.position.x,window.innerWidth-x-16),E=J.position.y+8;return t.jsxs("div",{"data-popup":"gantt-action",style:{position:"fixed",left:S,top:E,zIndex:9999,background:"var(--zg-surface)",borderRadius:4,boxShadow:"var(--zg-shadow-popover)",border:`1.5px solid ${e.borderLight}`,width:x,overflow:"hidden"},onMouseDown:C=>C.stopPropagation(),children:[t.jsx("div",{style:{padding:"12px 14px 10px",borderBottom:`1px solid ${e.borderLight}`},children:t.jsx("p",{style:{fontSize:13,fontWeight:700,color:e.group,margin:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:j.name,children:j.name})}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,padding:"8px 6px"},children:[t.jsxs("button",{onClick:()=>{xe?.(We(j)),me()},className:"zg-popup-btn",style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 10px",borderRadius:7,border:"none",background:"transparent",cursor:"pointer",fontSize:13,fontWeight:500,color:e.textPrimary,textAlign:"left"},children:[t.jsx(Y.Eye,{size:15})," ",t.jsx("span",{style:{flex:1,textAlign:"left"},children:i("gantt.popup.viewDetails","View details")})]}),t.jsxs("button",{onClick:()=>{Re?.(We(j)),me()},className:"zg-popup-btn",style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 10px",borderRadius:7,border:"none",background:"transparent",cursor:"pointer",fontSize:13,fontWeight:500,color:e.textPrimary,textAlign:"left"},children:[t.jsx(Y.Edit2,{size:15})," ",t.jsx("span",{style:{flex:1,textAlign:"left"},children:i("gantt.popup.edit","Edit")})]}),t.jsxs("button",{onClick:()=>{Fe?.(j.id),me()},className:"zg-popup-btn zg-popup-btn-danger",style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 10px",borderRadius:7,border:"none",background:"transparent",cursor:"pointer",fontSize:13,fontWeight:500,color:e.dangerText,textAlign:"left"},children:[t.jsx(Y.Trash2,{size:15})," ",t.jsx("span",{style:{flex:1,textAlign:"left"},children:i("gantt.popup.delete","Delete")})]})]}),_.length>0&&t.jsxs("div",{style:{borderTop:`1px solid ${e.borderLight}`,padding:"10px 14px 12px"},children:[t.jsxs("div",{style:{fontSize:10,fontWeight:700,color:e.textSecondary,textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:8},children:[i("gantt.popup.relations","Relations")," (",_.length,")"]}),t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:5},children:_.map(C=>{const N=C.predecessorId===j.id,B=N?C.successorName:C.predecessorName,D=f===C.id;return t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:8,background:"var(--zg-surface-alt)",border:`1px solid ${e.borderLight}`},children:[t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsxs("div",{style:{fontSize:10,fontWeight:700,color:e.group,marginBottom:2},children:[t.jsx("span",{style:{background:e.groupSoftStrong,borderRadius:4,padding:"1px 5px"},children:C.type})," ",t.jsx("span",{style:{color:e.textSecondary,fontWeight:500},children:N?"→ ":"← "}),t.jsx("span",{style:{color:e.textMuted,fontWeight:400,fontSize:9},children:P[C.type]??C.type})]}),t.jsx("div",{style:{fontSize:11,color:e.textPrimary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:B,children:B})]}),H&&t.jsx("button",{disabled:!!D,onClick:async()=>{v(C.id);try{await H(C.id)}finally{v(null)}},style:{flexShrink:0,padding:"4px 6px",borderRadius:6,border:"none",background:D?e.dangerBgSoft:"transparent",cursor:D?"wait":"pointer",color:e.dangerText,fontSize:14,opacity:D?.5:1,transition:"background 0.12s"},children:D?"⟳":"🗑"})]},C.id)})})]})]})})(),M&&t.jsxs("div",{"data-menu":"chart-create",style:{position:"fixed",left:Math.min(M.x,window.innerWidth-220),top:Math.min(M.y,window.innerHeight-220),zIndex:99999,background:"var(--zg-surface)",borderRadius:10,boxShadow:"var(--zg-shadow-popover)",border:`1.5px solid ${e.borderLight}`,width:200,overflow:"hidden"},onClick:j=>j.stopPropagation(),children:[t.jsx("div",{style:{padding:"9px 13px 8px",borderBottom:`1px solid ${e.borderLight}`,background:e.headerBg},children:t.jsxs("p",{style:{margin:0,fontSize:10,fontWeight:700,color:e.textSecondary,textTransform:"uppercase",letterSpacing:"0.08em"},children:[i("gantt.chart.addOn","Add on")," ",re(M.date,n.locale)]})}),t.jsx("div",{style:{padding:"5px 5px"},children:[{label:i("gantt.newAction.step","Step"),icon:Te("step",0),action:()=>{U?.(M.date,M.projectId),c(null)}},{label:i("gantt.newAction.milestone","Milestone"),icon:Te("milestone"),action:()=>{Ae?.(M.date,M.projectId),c(null)}},{label:i("gantt.newAction.event","Event"),icon:Te("event"),action:()=>{Be?.(M.date,M.projectId),c(null)}},{label:i("gantt.newAction.note","Note"),icon:Te("note"),action:()=>{Le?.(M.date,M.projectId),c(null)}}].map(j=>t.jsxs("button",{onClick:j.action,className:"zg-popup-btn",style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 10px",borderRadius:7,border:"none",background:"transparent",cursor:"pointer",fontSize:13,fontWeight:500,color:e.textPrimary,textAlign:"left",transition:"background 0.12s"},children:[j.icon," ",j.label]},j.label))})]}),d&&t.jsxs("svg",{style:{position:"fixed",inset:0,width:"100vw",height:"100vh",pointerEvents:"none",zIndex:99999},children:[t.jsx("defs",{children:t.jsx("marker",{id:"connect-arrow",markerWidth:"8",markerHeight:"8",refX:"6",refY:"3",orient:"auto",children:t.jsx("path",{d:"M0,0 L0,6 L6,3 z",fill:e.group})})}),t.jsx("line",{x1:d.fromScreenX,y1:d.fromScreenY,x2:d.currentScreenX,y2:d.currentScreenY,stroke:e.group,strokeWidth:2.5,strokeDasharray:"8 5",markerEnd:"url(#connect-arrow)",opacity:.85,style:{animation:"zg-dash 0.5s linear infinite"}})]}),g&&t.jsx("div",{style:{position:"fixed",inset:0,background:e.overlayMedium,backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:99998},onClick:()=>m(null),children:t.jsxs("div",{style:{background:"var(--zg-surface)",borderRadius:20,padding:"32px 36px",width:420,boxShadow:"var(--zg-shadow-popover)"},onClick:j=>j.stopPropagation(),children:[t.jsxs("div",{style:{marginBottom:20},children:[t.jsx("h3",{style:{fontSize:18,fontWeight:700,color:e.textTitle,marginBottom:4},children:i("gantt.depModal.title","Relation Type")}),t.jsx("p",{style:{fontSize:13,color:e.textSecondary},children:i("gantt.depModal.subtitle","Choose how the two tasks relate")})]}),t.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10,marginBottom:20},children:[{type:"FS",label:i("gantt.depModal.fs","Finish to Start"),desc:i("gantt.depModal.fsDesc","B starts when A finishes")},{type:"SS",label:i("gantt.depModal.ss","Start to Start"),desc:i("gantt.depModal.ssDesc","A and B start together")},{type:"FF",label:i("gantt.depModal.ff","Finish to Finish"),desc:i("gantt.depModal.ffDesc","A and B finish together")},{type:"SF",label:i("gantt.depModal.sf","Start to Finish"),desc:i("gantt.depModal.sfDesc","B finishes when A starts")}].map(j=>t.jsxs("button",{onClick:()=>z(j.type),style:{border:y===j.type?`2px solid ${e.group}`:`1.5px solid ${e.borderLight}`,borderRadius:12,padding:"12px 14px",textAlign:"left",cursor:"pointer",background:y===j.type?e.groupSoft:"var(--zg-surface-alt)"},children:[t.jsx("div",{style:{fontSize:11,fontFamily:"monospace",fontWeight:700,color:e.group,marginBottom:4,background:y===j.type?e.groupSoftStrong:e.groupSoft,borderRadius:6,padding:"2px 6px",display:"inline-block"},children:j.type}),t.jsx("div",{style:{fontSize:13,fontWeight:600,color:e.textTitle,marginBottom:2},children:j.label}),t.jsx("div",{style:{fontSize:11,color:e.textSecondary},children:j.desc})]},j.type))}),t.jsxs("div",{style:{marginBottom:24},children:[t.jsx("label",{style:{display:"block",fontSize:13,fontWeight:600,color:e.textTitle,marginBottom:6},children:i("gantt.depModal.lagLabel","Lag (days)")}),t.jsx("input",{type:"number",value:k,onChange:j=>A(parseInt(j.target.value)||0),style:{width:"100%",padding:"10px 12px",border:`1.5px solid ${e.borderLight}`,borderRadius:8,fontSize:14}})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[t.jsx("button",{onClick:()=>m(null),style:{padding:"10px 16px",borderRadius:8,border:`1px solid ${e.borderLight}`,background:"var(--zg-surface)",cursor:"pointer",fontWeight:600},children:i("gantt.depModal.cancel","Cancel")}),t.jsx("button",{onClick:Ce,disabled:L,style:{padding:"10px 16px",borderRadius:8,border:"none",background:e.group,color:e.white,cursor:L?"wait":"pointer",fontWeight:600},children:L?i("gantt.depModal.saving","Saving..."):i("gantt.depModal.create","Create Dependency")})]})]})})]})}function Wt(n){const i=b.useRef(null),r=b.useRef(null),o=b.useRef(null),s=b.useRef(!1),l=b.useCallback(()=>{if(s.current)return;s.current=!0;const m=r.current;m&&i.current&&(i.current.scrollTop=m.scrollTop),m&&o.current&&(o.current.scrollLeft=m.scrollLeft),s.current=!1},[]),a=b.useCallback(()=>{s.current||(s.current=!0,i.current&&r.current&&(r.current.scrollTop=i.current.scrollTop),s.current=!1)},[]),d=b.useRef(!1);b.useEffect(()=>{if(d.current||!n.totalWidth)return;const m=r.current;if(!m)return;const y=pe(new Date,n);if(y>=0&&y<=n.totalWidth){const z=y-m.clientWidth/2;m.scrollLeft=Math.max(0,z),o.current&&(o.current.scrollLeft=m.scrollLeft),d.current=!0}},[n]);const g=b.useCallback(m=>{const y=r.current;if(y)if(m.preventDefault(),m.shiftKey||Math.abs(m.deltaX)>Math.abs(m.deltaY)){const z=m.shiftKey?m.deltaY:m.deltaX;y.scrollLeft+=z,o.current&&(o.current.scrollLeft=y.scrollLeft)}else y.scrollTop+=m.deltaY,i.current&&(i.current.scrollTop=y.scrollTop)},[]);return{leftBodyRef:i,rightBodyRef:r,timeHeaderRef:o,handleRightScroll:l,handleLeftScroll:a,handleChartWheel:g}}function $t(n,i,r,o){const s=new Map;return n.forEach(l=>s.set(l.id,l)),i.map(l=>{const a=s.get(l.predecessorId),d=s.get(l.successorId);if(!a||!d)return null;const g=o.get(a.id),m=o.get(d.id);if(g==null||m==null)return null;const y=a.originalType!=="step",z=d.originalType!=="step",k=y?pe(a.start,r)+_e:pe(a.end,r),A=g*ee+ee/2,L=z?pe(d.start,r)-10:pe(d.start,r),f=m*ee+ee/2,v=14,M=Math.max(k+v,L-v),c=A===f?`M${k},${A} L${L-6},${f}`:`M${k},${A} L${M},${A} L${M},${f} L${L-6},${f}`;return{predId:a.id,succId:d.id,path:c,headX:L-6,headY:f}}).filter(Boolean)}function Pt(n,i,r){if(i===r)return!0;const o=new Map;for(const d of n){const g=o.get(d.predecessorId)||[];g.push(d.successorId),o.set(d.predecessorId,g)}const s=o.get(i)||[];s.push(r),o.set(i,s);const l=[r],a=new Set;for(;l.length>0;){const d=l.pop();if(d===i)return!0;if(a.has(d))continue;a.add(d);const g=o.get(d)||[];for(const m of g)a.has(m)||l.push(m)}return!1}function Ot(n,i){if(n.length===0||i.length===0)return new Set;const r=new Map;n.forEach(c=>r.set(c.id,c));const o=new Set(n.map(c=>c.id)),s=i.filter(c=>o.has(c.predecessorId)&&o.has(c.successorId));if(s.length===0)return new Set;const l=new Map,a=new Map;s.forEach(c=>{l.has(c.predecessorId)||l.set(c.predecessorId,[]),l.get(c.predecessorId).push(c.successorId),a.has(c.successorId)||a.set(c.successorId,[]),a.get(c.successorId).push(c.predecessorId)});const d=c=>Math.max(1,ve(c.start,c.end)),g=new Set,m=[];function y(c){g.has(c)||(g.add(c),(l.get(c)||[]).forEach(y),m.unshift(c))}n.forEach(c=>y(c.id));const z=new Map,k=new Map;for(const c of m){const F=r.get(c),T=a.get(c)||[];let I=0;for(const p of T)I=Math.max(I,k.get(p)||0);const u=T.length>0?I:0;z.set(c,u),k.set(c,u+d(F))}let A=0;k.forEach(c=>{c>A&&(A=c)});const L=new Map,f=new Map;for(let c=m.length-1;c>=0;c--){const F=m[c],T=r.get(F),I=l.get(F)||[];let u=A;for(const p of I)u=Math.min(u,L.get(p)??A);f.set(F,I.length>0?u:A),L.set(F,(f.get(F)||0)-d(T))}const v=new Set;s.forEach(c=>{v.add(c.predecessorId),v.add(c.successorId)});const M=new Set;for(const c of m){if(!v.has(c))continue;const F=(L.get(c)||0)-(z.get(c)||0);Math.abs(F)<.5&&M.add(c)}return M}function Nt({steps:n,milestones:i,events:r,notes:o,dependencies:s,viewMode:l,locale:a,groupByProject:d,visibleTypes:g,collapsedGroups:m,collapsedProjects:y,selectedTaskId:z}){const k=b.useMemo(()=>{const T=[],I=new Map;o?.forEach(p=>{let w=p.targetId||p.predecessorId;if(!w&&s){const O=s.find(q=>q.successorId===p.id);O&&(w=O.predecessorId)}if(!w)return;const W=I.get(w)||[];I.set(w,[...W,p])});let u=0;return n.forEach(p=>{const w=!!(p.startDate&&p.finishDate),W=p.startDate||p.previsionStartDate,O=p.finishDate||p.previsionFinishDate;if(!W||!O)return;const q=new Date(W),h=new Date(O);if(isNaN(q.getTime())||isNaN(h.getTime()))return;h<=q&&h.setDate(h.getDate()+1);let K,R;if(p.previsionStartDate&&p.previsionFinishDate){const $=new Date(p.previsionStartDate),ne=new Date(p.previsionFinishDate);!isNaN($.getTime())&&!isNaN(ne.getTime())&&(K=$,R=ne<=$?se($,1):ne)}const te=s?.filter($=>$.successorId===p.id).map($=>$.predecessorId)||[],J=p.conclusionPercent!=null?Number(p.conclusionPercent):0;T.push({id:p.id,name:p.name,start:q,end:h,progress:J>1?Math.min(J,100):J*100,originalType:"step",deps:te,colorIdx:u%le.length,previsionStart:K,previsionEnd:R,hasActualDates:w,projectId:p.projectId||void 0,projectTitle:p.projectTitle||void 0,attachedNotes:I.get(p.id)}),u++}),i?.forEach(p=>{if(!p.date)return;const w=new Date(p.date);if(isNaN(w.getTime()))return;const W=s?.filter(O=>O.successorId===p.id).map(O=>O.predecessorId)||[];T.push({id:p.id,name:p.name,start:w,end:w,progress:p.finished?100:0,originalType:"milestone",deps:W,projectId:p.projectId||void 0,projectTitle:p.projectTitle||void 0,attachedNotes:I.get(p.id)})}),r?.forEach(p=>{if(!p.date)return;const w=new Date(p.date);if(isNaN(w.getTime()))return;const W=s?.filter(O=>O.successorId===p.id).map(O=>O.predecessorId)||[];T.push({id:p.id,name:p.title,start:w,end:w,progress:p.finished?100:0,originalType:"event",deps:W,projectId:p.projectId||void 0,projectTitle:p.projectTitle||void 0,attachedNotes:I.get(p.id)})}),T},[n,i,r,o,s]),A=b.useMemo(()=>Ft(k,l,a),[k,l,a]),L=b.useMemo(()=>{const T=[],I=["step","milestone","event"];if(d){const u=new Map;k.forEach(p=>{p.projectId&&!u.has(p.projectId)&&u.set(p.projectId,p.projectTitle||p.projectId)});for(const[p,w]of Array.from(u.entries())){const W=y.has(p);if(T.push({kind:"projectHeader",projectId:p,projectTitle:w,collapsed:W}),!W){const O=k.filter(q=>q.projectId===p);for(const q of I){if(!g.has(q))continue;const h=O.filter(te=>te.originalType===q);if(h.length===0)continue;const K=`${p}-${q}`,R=m.has(K);T.push({kind:"group",groupType:q,label:He[q],count:h.length,collapsed:R,projectId:p}),R||h.forEach(te=>T.push({kind:"task",task:te}))}}}}else for(const u of I){if(!g.has(u))continue;const p=k.filter(W=>W.originalType===u);if(p.length===0)continue;const w=m.has(u);T.push({kind:"group",groupType:u,label:He[u],count:p.length,collapsed:w}),w||p.forEach(W=>T.push({kind:"task",task:W}))}return T},[k,g,m,y,d]),f=b.useMemo(()=>{const T=new Map;return L.forEach((I,u)=>{I.kind==="task"&&T.set(I.task.id,u)}),T},[L]),v=b.useMemo(()=>$t(k,s||[],A,f),[k,s,A,f]),M=b.useMemo(()=>Ot(k,s||[]),[k,s]),c=b.useMemo(()=>{const T=new Set,I=new Date;return k.forEach(u=>{u.originalType==="step"&&u.end<I&&u.progress<100&&T.add(u.id)}),T},[k]),F=b.useMemo(()=>{if(!z||!s?.length)return new Set;const T=new Set,I=[z];for(;I.length;){const u=I.shift();for(const p of s)p.predecessorId===u&&!T.has(p.successorId)&&(T.add(p.successorId),I.push(p.successorId)),p.successorId===u&&!T.has(p.predecessorId)&&(T.add(p.predecessorId),I.push(p.predecessorId))}return T},[z,s]);return{tasks:k,timeline:A,displayRows:L,taskRowIndex:f,arrows:v,criticalIds:M,delayedIds:c,relatedIds:F}}function Yt(){const{props:n,activePinboardTask:i,setActivePinboardTask:r,t:o}=Se(),s=!!i,l=()=>r(null);return t.jsxs(t.Fragment,{children:[s&&t.jsx("div",{onClick:l,style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",backgroundColor:e.overlaySoft,zIndex:99,backdropFilter:"blur(2px)",transition:"opacity 0.3s ease"}}),t.jsxs("div",{style:{position:"fixed",top:0,right:s?0:-450,width:400,height:"100vh",backgroundColor:e.surface,boxShadow:"var(--zg-shadow-drawer, var(--zg-shadow-large))",borderLeft:`1px solid ${e.border}`,transition:"right 0.3s cubic-bezier(0.16, 1, 0.3, 1)",display:"flex",flexDirection:"column",zIndex:100},children:[t.jsxs("div",{style:{padding:"20px 24px",backgroundColor:e.headerBg,borderBottom:`1px solid ${e.borderLight}`,display:"flex",flexDirection:"column",gap:12},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[t.jsx("span",{style:{fontSize:10,fontWeight:700,backgroundColor:e.milestoneRing,color:e.group,padding:"2px 6px",borderRadius:4,letterSpacing:"0.5px"},children:i?.originalType?.toUpperCase()||""}),t.jsxs("span",{style:{fontSize:12,color:e.textSecondary,display:"flex",alignItems:"center",gap:4},children:[t.jsx(Y.Calendar,{size:12}),i&&re(i.start,n.locale),i?.originalType==="step"&&` - ${re(i.end,n.locale)}`]})]}),t.jsx("button",{onClick:l,style:{background:"transparent",border:"none",cursor:"pointer",padding:4,borderRadius:4},children:t.jsx(Y.X,{size:18})})]}),t.jsx("h2",{style:{margin:0,fontSize:18,fontWeight:700,color:e.textTitle},children:i?.name||""}),t.jsx("p",{style:{margin:0,fontSize:13,color:e.textSecondary},children:o("pinboard.description","Quadro de anotações e arquivos vinculados a esta etapa.")})]}),t.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"24px",display:"flex",flexDirection:"column",gap:20,backgroundColor:e.surfaceAlt},children:[i?.attachedNotes?.map((a,d)=>t.jsxs("div",{style:{background:a.color||e.note,padding:"16px",borderRadius:"2px",boxShadow:e.shadowLarge,transform:`rotate(${d%2===0?"-1deg":"1deg"})`,position:"relative"},children:[t.jsx("div",{style:{position:"absolute",top:0,left:"50%",transform:"translateX(-50%)",width:"40px",height:"12px",background:e.stickyTape,borderRadius:"0 0 4px 4px"}}),t.jsx("h3",{style:{margin:"0 0 8px 0",fontSize:14,fontWeight:700,color:e.inkSoft},children:a.title}),t.jsx("p",{style:{margin:0,fontSize:13,color:e.inkSoft2,lineHeight:1.4},children:a.description||""}),a.author&&t.jsxs("div",{style:{marginTop:12,fontSize:11,fontWeight:600,color:e.inkSoft4,textAlign:"right"},children:["— ",a.author]})]},a.id)),(!i?.attachedNotes||i.attachedNotes.length===0)&&t.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:e.textMuted,textAlign:"center",gap:12,opacity:.6},children:[t.jsx("div",{style:{width:60,height:60,borderRadius:"50%",background:e.headerBg,display:"flex",alignItems:"center",justifyContent:"center"},children:t.jsx(Y.Plus,{size:32})}),t.jsx("p",{style:{margin:0,fontSize:14},children:o("pinboard.empty","Nenhuma nota vinculada")})]})]}),t.jsx("div",{style:{padding:"16px 24px",backgroundColor:e.surface,borderTop:`1px solid ${e.borderLight}`},children:t.jsxs("button",{style:{width:"100%",padding:"12px",display:"flex",alignItems:"center",justifyContent:"center",gap:8,backgroundColor:e.group,color:e.white,border:"none",borderRadius:8,fontSize:14,fontWeight:600,cursor:"pointer"},children:[t.jsx(Y.Plus,{size:18})," ",o("pinboard.newBtn","Nova Nota nesta Etapa")]})})]})]})}const Xt={"planning.gantt":"PLANEJAMENTO DA OBRA","charts.gantt.month":"Mês","charts.gantt.year":"Ano","charts.gantt.stepName":"NOME DA ETAPA","charts.gantt.start":"INÍCIO","charts.gantt.end":"FIM","charts.gantt.newAction":"Nova Ação","charts.gantt.progress":"Progresso","gantt.filter.steps":"Etapas","gantt.filter.milestones":"Marcos","gantt.filter.events":"Eventos","gantt.filter.notes":"Notas","gantt.newAction.step":"Etapa","gantt.newAction.milestone":"Marco","gantt.newAction.event":"Evento","gantt.newAction.note":"Nota","gantt.group.step":"Etapas","gantt.group.milestone":"Marcos","gantt.group.event":"Eventos","gantt.group.note":"Notas","gantt.tooltip.planned":"Previsto","gantt.tooltip.actual":"Real","gantt.tooltip.plannedInUse":"Previsto (em uso)","gantt.tooltip.start":"Início","gantt.tooltip.end":"Fim","gantt.tooltip.duration":"Duração","gantt.tooltip.progress":"Progresso","gantt.tooltip.date":"Data","gantt.tooltip.attachments":"Anexos","gantt.popup.viewDetails":"Ver detalhes","gantt.popup.edit":"Editar","gantt.popup.delete":"Excluir","gantt.popup.relations":"Relações","gantt.chart.addOn":"Adicionar em","gantt.depType.fs":"Início após Fim","gantt.depType.ss":"Inícios simultâneos","gantt.depType.ff":"Fins simultâneos","gantt.depType.sf":"Fim após Início","gantt.depModal.title":"Tipo de Relação","gantt.depModal.subtitle":"Escolha como as duas tarefas se relacionam","gantt.depModal.fs":"Início após Fim","gantt.depModal.fsDesc":"B começa quando A termina","gantt.depModal.ss":"Inícios simultâneos","gantt.depModal.ssDesc":"A e B começam juntos","gantt.depModal.ff":"Fins simultâneos","gantt.depModal.ffDesc":"A e B terminam juntos","gantt.depModal.sf":"Fim após Início","gantt.depModal.sfDesc":"B termina quando A começa","gantt.depModal.lagLabel":"Atraso (Lag) em dias","gantt.depModal.cancel":"Cancelar","gantt.depModal.create":"Criar Dependência","gantt.depModal.saving":"Salvando...","noteModal.titlePlaceholder":"Título da nota...","noteModal.contentPlaceholder":"Escreva sua nota aqui...","noteModal.attachFiles":"Anexar arquivos","noteModal.removeFile":"Remover","noteModal.dependency":"Dependência","noteModal.none":"Nenhuma","noteModal.milestones":"Marcos","noteModal.cancel":"Cancelar","noteModal.create":"Criar Nota","noteModal.errorEmpty":"Informe o título ou conteúdo da nota.","noteModal.errorSave":"Erro ao criar nota.","noteModal.untitled":"Sem título"},it={"planning.gantt":"PROJECT PLANNING","charts.gantt.month":"Month","charts.gantt.year":"Year","charts.gantt.stepName":"STEP NAME","charts.gantt.start":"START","charts.gantt.end":"END","charts.gantt.newAction":"New Action","charts.gantt.progress":"Progress","gantt.filter.steps":"Steps","gantt.filter.milestones":"Milestones","gantt.filter.events":"Events","gantt.filter.notes":"Notes","gantt.newAction.step":"Step","gantt.newAction.milestone":"Milestone","gantt.newAction.event":"Event","gantt.newAction.note":"Note","gantt.group.step":"Steps","gantt.group.milestone":"Milestones","gantt.group.event":"Events","gantt.group.note":"Notes","gantt.tooltip.planned":"Planned","gantt.tooltip.actual":"Actual","gantt.tooltip.plannedInUse":"Planned (in use)","gantt.tooltip.start":"Start","gantt.tooltip.end":"End","gantt.tooltip.duration":"Duration","gantt.tooltip.progress":"Progress","gantt.tooltip.date":"Date","gantt.tooltip.attachments":"Attachments","gantt.popup.viewDetails":"View details","gantt.popup.edit":"Edit","gantt.popup.delete":"Delete","gantt.popup.relations":"Relations","gantt.chart.addOn":"Add on","gantt.depType.fs":"Finish to Start","gantt.depType.ss":"Start to Start","gantt.depType.ff":"Finish to Finish","gantt.depType.sf":"Start to Finish","gantt.depModal.title":"Relation Type","gantt.depModal.subtitle":"Choose how the two tasks relate","gantt.depModal.fs":"Finish to Start","gantt.depModal.fsDesc":"B starts when A finishes","gantt.depModal.ss":"Start to Start","gantt.depModal.ssDesc":"A and B start together","gantt.depModal.ff":"Finish to Finish","gantt.depModal.ffDesc":"A and B finish together","gantt.depModal.sf":"Start to Finish","gantt.depModal.sfDesc":"B finishes when A starts","gantt.depModal.lagLabel":"Lag (days)","gantt.depModal.cancel":"Cancel","gantt.depModal.create":"Create Dependency","gantt.depModal.saving":"Saving...","noteModal.titlePlaceholder":"Note title...","noteModal.contentPlaceholder":"Write your note here...","noteModal.attachFiles":"Attach files","noteModal.removeFile":"Remove","noteModal.dependency":"Dependency","noteModal.none":"None","noteModal.milestones":"Milestones","noteModal.cancel":"Cancel","noteModal.create":"Create Note","noteModal.errorEmpty":"Please provide a title or content for the note.","noteModal.errorSave":"Error creating note.","noteModal.untitled":"Untitled","pinboard.description":"Board with notes and files linked to this task.","pinboard.empty":"No linked notes","pinboard.newBtn":"New note for this task","gantt.error.circularDependency":"Circular dependency is not allowed."};function et(n,i,r){const o=it[i]||r||i;return n?typeof n=="function"?n(i,o)||o:n[i]||o:o}const ce=n=>{const i=n.touches[0]||n.changedTouches[0];return i?{clientX:i.clientX,clientY:i.clientY}:{clientX:0,clientY:0}};function _t(n){const{onTaskChange:i,onCreateDependency:r,onDependencyError:o,dependencies:s,translations:l}=n,[a,d]=b.useState("day"),[g,m]=b.useState(null),[y,z]=b.useState(null),[k,A]=b.useState(null),[L,f]=b.useState({isOpen:!1,position:{x:0,y:0},task:null}),[v,M]=b.useState(null),[c,F]=b.useState(null),[T,I]=b.useState(null),[u,p]=b.useState(null),[w,W]=b.useState("FS"),[O,q]=b.useState(0),[h,K]=b.useState(!1),[R,te]=b.useState(null),[J,$]=b.useState(null),[ne,Pe]=b.useState(!1),Oe=b.useRef(null),[he,Ne]=b.useState(null),[we,Ee]=b.useState(new Set(["step","milestone","event","note"])),[je,De]=b.useState(new Set),[ke,Ce]=b.useState(new Set),xe=b.useCallback(x=>{Ee(S=>{const E=new Set(S);return E.has(x)?E.delete(x):E.add(x),E})},[]),Re=b.useCallback(x=>{De(S=>{const E=new Set(S);return E.has(x)?E.delete(x):E.add(x),E})},[]),Fe=b.useCallback(x=>{Ce(S=>{const E=new Set(S);return E.has(x)?E.delete(x):E.add(x),E})},[]),H=Nt({steps:n.steps,milestones:n.milestones,events:n.events,notes:n.notes,dependencies:n.dependencies,viewMode:a,locale:n.locale,visibleTypes:we,collapsedGroups:je,collapsedProjects:ke,groupByProject:n.groupByProject,selectedTaskId:y||null}),U=Wt(H.timeline),Ae=b.useCallback((x,S)=>{x.preventDefault(),x.stopPropagation(),M({task:S,startMouseX:x.clientX,originalStart:new Date(S.start),originalEnd:new Date(S.end),offsetDays:0})},[]),Be=b.useCallback((x,S)=>{x.preventDefault(),x.stopPropagation();const E=ce(x);M({task:S,startMouseX:E.clientX,originalStart:new Date(S.start),originalEnd:new Date(S.end),offsetDays:0})},[]),Le=b.useCallback((x,S,E)=>{x.preventDefault(),x.stopPropagation(),F({task:S,edge:E,startMouseX:x.clientX,originalStart:new Date(S.start),originalEnd:new Date(S.end),offsetDays:0})},[]),Ie=b.useCallback((x,S,E)=>{x.preventDefault(),x.stopPropagation();const C=ce(x);F({task:S,edge:E,startMouseX:C.clientX,originalStart:new Date(S.start),originalEnd:new Date(S.end),offsetDays:0})},[]),Me=b.useCallback((x,S,E)=>{x.preventDefault(),x.stopPropagation(),I({fromTaskId:S.id,fromEdge:E,fromScreenX:x.clientX,fromScreenY:x.clientY,currentScreenX:x.clientX,currentScreenY:x.clientY,hoverTargetId:null})},[]),ue=b.useCallback((x,S,E)=>{x.preventDefault(),x.stopPropagation();const C=ce(x);I({fromTaskId:S.id,fromEdge:E,fromScreenX:C.clientX,fromScreenY:C.clientY,currentScreenX:C.clientX,currentScreenY:C.clientY,hoverTargetId:null})},[]),Ye=b.useCallback(async()=>{if(!u||!r)return;const x=new Map(H.tasks.map(D=>[D.id,D])),S=x.get(u.fromTaskId),E=x.get(u.toTaskId);if(!S||!E)return;const C=D=>D.originalType==="step"?"STEP":"MILESTONE",N=u.fromEdge==="right"?S:E,B=u.fromEdge==="right"?E:S;if(Pt(s||[],N.id,B.id)){const D=et(l,"gantt.error.circularDependency","Circular dependency is not allowed.");o?.({code:"CYCLIC_DEPENDENCY",message:D,predecessorId:N.id,successorId:B.id}),o||window.alert(D),p(null);return}K(!0);try{await r({predecessorId:N.id,predecessorType:C(N),successorId:B.id,successorType:C(B),type:w,lag:O}),p(null)}finally{K(!1)}},[u,H.tasks,r,s,l,o,w,O]);b.useEffect(()=>{if(!v)return;const x={passive:!1},S=B=>{const D=B.clientX-v.startMouseX,G=Math.round(D/H.timeline.dayWidth);G!==v.offsetDays&&M(X=>X?{...X,offsetDays:G}:null)},E=B=>{B.cancelable&&B.preventDefault();const G=ce(B).clientX-v.startMouseX,X=Math.round(G/H.timeline.dayWidth);X!==v.offsetDays&&M(V=>V?{...V,offsetDays:X}:null)},C=()=>{v.offsetDays!==0&&i&&i({id:v.task.id,name:v.task.name,start:se(v.originalStart,v.offsetDays),end:se(v.originalEnd,v.offsetDays),type:v.task.originalType==="step"?"task":"milestone",progress:v.task.progress}),M(null)},N=()=>C();return document.addEventListener("mousemove",S),document.addEventListener("mouseup",C),document.addEventListener("touchmove",E,x),document.addEventListener("touchend",N),()=>{document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",C),document.removeEventListener("touchmove",E),document.removeEventListener("touchend",N)}},[v,H.timeline.dayWidth,i]),b.useEffect(()=>{if(!c)return;const x={passive:!1},S=B=>{const D=B.clientX-c.startMouseX,G=Math.round(D/H.timeline.dayWidth);G!==c.offsetDays&&F(X=>X?{...X,offsetDays:G}:null)},E=B=>{B.cancelable&&B.preventDefault();const G=ce(B).clientX-c.startMouseX,X=Math.round(G/H.timeline.dayWidth);X!==c.offsetDays&&F(V=>V?{...V,offsetDays:X}:null)},C=()=>{if(c.offsetDays!==0&&i){const B=c.edge==="left"?se(c.originalStart,c.offsetDays):c.originalStart,D=c.edge==="right"?se(c.originalEnd,c.offsetDays):c.originalEnd;D>B&&i({id:c.task.id,name:c.task.name,start:B,end:D,type:"task",progress:c.task.progress})}F(null)},N=()=>C();return document.addEventListener("mousemove",S),document.addEventListener("mouseup",C),document.addEventListener("touchmove",E,x),document.addEventListener("touchend",N),()=>{document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",C),document.removeEventListener("touchmove",E),document.removeEventListener("touchend",N)}},[c,H.timeline.dayWidth,i]);const ge=T?.fromTaskId,ie=T?.fromEdge;b.useEffect(()=>{if(!ge||!ie)return;const x={passive:!1},S=ge,E=ie,C=G=>{let X=null;for(const V of document.elementsFromPoint(G.clientX,G.clientY)){const Z=V.dataset?.taskId;if(Z&&Z!==S){X=Z;break}}I(V=>V?{...V,currentScreenX:G.clientX,currentScreenY:G.clientY,hoverTargetId:X}:null)},N=G=>{G.cancelable&&G.preventDefault();const X=ce(G);let V=null;for(const Z of document.elementsFromPoint(X.clientX,X.clientY)){const de=Z.dataset?.taskId;if(de&&de!==S){V=de;break}}I(Z=>Z?{...Z,currentScreenX:X.clientX,currentScreenY:X.clientY,hoverTargetId:V}:null)},B=G=>{let X=null;for(const V of document.elementsFromPoint(G.clientX,G.clientY)){const Z=V.dataset?.taskId;if(Z&&Z!==S){X=Z;break}}X&&r&&(p({fromTaskId:S,fromEdge:E,toTaskId:X}),W("FS"),q(0)),I(null)},D=G=>{const X=ce(G);let V=null;for(const Z of document.elementsFromPoint(X.clientX,X.clientY)){const de=Z.dataset?.taskId;if(de&&de!==S){V=de;break}}V&&r&&(p({fromTaskId:S,fromEdge:E,toTaskId:V}),W("FS"),q(0)),I(null)};return document.addEventListener("mousemove",C),document.addEventListener("mouseup",B),document.addEventListener("touchmove",N,x),document.addEventListener("touchend",D),()=>{document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",B),document.removeEventListener("touchmove",N),document.removeEventListener("touchend",D)}},[ge,ie,r]);const[oe,fe]=b.useState(null),me=b.useCallback(x=>{if(c||v||x.button===2)return;const S=U.rightBodyRef.current;S&&(x.preventDefault(),fe({startX:x.clientX,startY:x.clientY,scrollLeft:S.scrollLeft,scrollTop:S.scrollTop}))},[c,v,U.rightBodyRef]),j=b.useCallback(x=>{if(c||v||T)return;const S=U.rightBodyRef.current;if(!S)return;const E=ce(x);fe({startX:E.clientX,startY:E.clientY,scrollLeft:S.scrollLeft,scrollTop:S.scrollTop})},[c,v,T,U.rightBodyRef]);b.useEffect(()=>{if(!oe)return;const x={passive:!1},S=B=>{const D=U.rightBodyRef.current;D&&(D.scrollLeft=oe.scrollLeft-(B.clientX-oe.startX),D.scrollTop=oe.scrollTop-(B.clientY-oe.startY),U.leftBodyRef.current&&(U.leftBodyRef.current.scrollTop=D.scrollTop),U.timeHeaderRef.current&&(U.timeHeaderRef.current.scrollLeft=D.scrollLeft))},E=B=>{B.cancelable&&B.preventDefault();const D=U.rightBodyRef.current;if(!D)return;const G=ce(B);D.scrollLeft=oe.scrollLeft-(G.clientX-oe.startX),D.scrollTop=oe.scrollTop-(G.clientY-oe.startY),U.leftBodyRef.current&&(U.leftBodyRef.current.scrollTop=D.scrollTop),U.timeHeaderRef.current&&(U.timeHeaderRef.current.scrollLeft=D.scrollLeft)},C=()=>fe(null),N=()=>fe(null);return document.addEventListener("mousemove",S),document.addEventListener("mouseup",C),document.addEventListener("touchmove",E,x),document.addEventListener("touchend",N),()=>{document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",C),document.removeEventListener("touchmove",E),document.removeEventListener("touchend",N)}},[oe,U.rightBodyRef,U.leftBodyRef,U.timeHeaderRef]);const _=b.useCallback(x=>{x.preventDefault(),x.stopPropagation();const S=C=>{const N=U.rightBodyRef.current;if(!N)return new Date;const B=N.getBoundingClientRect(),D=C-B.left+N.scrollLeft;return se(H.timeline.start,Math.max(0,Math.floor(D/H.timeline.dayWidth)))},E=C=>{if(!n.groupByProject)return;const N=U.leftBodyRef.current;if(!N)return;const B=N.getBoundingClientRect(),D=C-B.top+N.scrollTop,G=Math.max(0,Math.floor(D/50));for(let X=Math.min(G,H.displayRows.length-1);X>=0;X--){const V=H.displayRows[X];if(V.kind==="projectHeader")return V.projectId;if(V.kind==="task"&&V.task.projectId)return V.task.projectId;if(V.kind==="group"&&V.projectId)return V.projectId}};$({x:x.clientX,y:x.clientY,date:S(x.clientX),projectId:E(x.clientY)}),fe(null)},[H.timeline,H.displayRows,n.groupByProject,U.rightBodyRef,U.leftBodyRef]);b.useEffect(()=>{if(!J)return;const x=N=>{N.key==="Escape"&&$(null)},S=N=>{N.target.closest('[data-menu="chart-create"]')||$(null)},E=N=>{N.target.closest('[data-menu="chart-create"]')||$(null)},C=()=>$(null);return document.addEventListener("keydown",x),document.addEventListener("click",S),document.addEventListener("touchstart",E),window.addEventListener("scroll",C,!0),()=>{document.removeEventListener("keydown",x),document.removeEventListener("click",S),document.removeEventListener("touchstart",E),window.removeEventListener("scroll",C,!0)}},[J]);const P=b.useMemo(()=>({props:n,t:(x,S)=>et(n.translations,x,S),viewMode:a,setViewMode:d,hoveredTaskId:g,setHoveredTaskId:m,selectedTaskId:y,setSelectedTaskId:z,tooltip:k,setTooltip:A,popupState:L,setPopupState:f,dragState:v,setDragState:M,resizeState:c,setResizeState:F,connectState:T,setConnectState:I,visibleTypes:we,setVisibleTypes:Ee,toggleVisibility:xe,collapsedGroups:je,setCollapsedGroups:De,toggleGroup:Re,collapsedProjects:ke,setCollapsedProjects:Ce,toggleProject:Fe,pendingConnection:u,setPendingConnection:p,depModalType:w,setDepModalType:W,depModalLag:O,setDepModalLag:q,depCreating:h,setDepCreating:K,deletingDepId:R,setDeletingDepId:te,chartMenu:J,setChartMenu:$,newActionOpen:ne,setNewActionOpen:Pe,activePinboardTask:he,setActivePinboardTask:Ne,tasks:H.tasks,timeline:H.timeline,displayRows:H.displayRows,taskRowIndex:H.taskRowIndex||new Map,arrows:H.arrows,criticalIds:H.criticalIds,delayedIds:H.delayedIds,relatedIds:H.relatedIds,...U,newActionRef:Oe,screenXToDate:x=>{const S=U.rightBodyRef.current;if(!S)return new Date;const E=S.getBoundingClientRect(),C=x-E.left+S.scrollLeft;return se(H.timeline.start,Math.max(0,Math.floor(C/H.timeline.dayWidth)))},screenYToProjectId:x=>{if(!n.groupByProject)return;const S=U.leftBodyRef.current;if(!S)return;const E=S.getBoundingClientRect(),C=x-E.top+S.scrollTop,N=Math.max(0,Math.floor(C/50));for(let B=Math.min(N,H.displayRows.length-1);B>=0;B--){const D=H.displayRows[B];if(D.kind==="projectHeader")return D.projectId;if(D.kind==="task"&&D.task.projectId)return D.task.projectId;if(D.kind==="group"&&D.projectId)return D.projectId}},handleChartMouseDown:me,handleChartTouchStart:j,openChartMenu:_,handleBarMouseDown:Ae,handleBarTouchStart:Be,handleResizeMouseDown:Le,handleResizeTouchStart:Ie,handleConnectDotMouseDown:Me,handleConnectDotTouchStart:ue,handleCreateDependency:Ye}),[n,a,g,y,k,L,v,c,T,we,je,ke,u,w,O,h,R,J,ne,he,H,U,xe,Re,Fe,me,j,_,Ae,Be,Le,Ie,Me,ue,Ye]);return n.loading?t.jsx("div",{role:"status","aria-live":"polite",style:{padding:48,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:e.textSecondary},children:t.jsx(Y.Loader2,{size:32,style:{animation:"zg-spin 1.5s linear infinite",color:e.group}})}):t.jsx(ft,{value:P,children:t.jsxs("div",{className:"zg-root",style:{width:"100%",display:"flex",flexDirection:"column",marginLeft:"auto",marginRight:"auto",background:"var(--zg-surface)",borderRadius:12,boxShadow:"var(--zg-shadow-panel)",overflow:"hidden",height:"calc(100vh - 48px)",minHeight:600,border:`1px solid ${e.borderLight}`,opacity:he?.6:1,transition:"opacity 0.3s ease",pointerEvents:he?"none":"auto"},children:[t.jsx(vt,{}),t.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden",position:"relative",background:e.surfaceAlt},children:[t.jsx(Rt,{}),t.jsx(Lt,{})]}),t.jsx(Yt,{})]})})}const Vt=[{label:"Yellow",value:"#FEF08A"},{label:"Green",value:"#BBF7D0"},{label:"Blue",value:"#BFDBFE"},{label:"Pink",value:"#FBCFE8"},{label:"Purple",value:"#E9D5FF"},{label:"Orange",value:"#FED7AA"},{label:"White",value:"#FFFFFF"}],tt={FS:"Finish → Start (FS)",SS:"Start → Start (SS)",FF:"Finish → Finish (FF)",SF:"Start → Finish (SF)"};function Ht({isOpen:n,onClose:i,availableMilestones:r=[],initialDate:o,translations:s,onSaveNote:l}){const a=(h,K)=>s?typeof s=="function"?s(h,K):s[h]||K:K,[d,g]=b.useState(""),[m,y]=b.useState(""),[z,k]=b.useState("#FEF08A"),[A,L]=b.useState(""),[f,v]=b.useState(""),[M,c]=b.useState("FS"),[F,T]=b.useState(!1),[I,u]=b.useState([]),[p,w]=b.useState(""),W=b.useRef(null);b.useEffect(()=>{n&&(g(""),y(""),k("#FEF08A"),L(o??new Date().toISOString().split("T")[0]),v(""),c("FS"),u([]),w(""))},[n,o]);const O=[...r.map(h=>({id:h.id,name:h.name,type:"MILESTONE"}))],q=async()=>{if(!d.trim()&&!m.trim()){w(a("noteModal.errorEmpty","Please provide a title or content for the note."));return}w("");try{T(!0),await l({title:d||a("noteModal.untitled","Untitled"),description:m,color:z,date:A?`${A}T00:00:00`:new Date().toISOString(),predecessorId:f,dependencyType:M,files:I}),i()}catch(h){console.error(h),w(a("noteModal.errorSave","Error creating note."))}finally{T(!1)}};return n?t.jsx("div",{style:{position:"fixed",inset:0,background:e.overlaySoft,backdropFilter:"blur(2px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999,padding:16},onClick:i,children:t.jsxs("div",{onClick:h=>h.stopPropagation(),style:{width:400,maxHeight:"90vh",background:z||e.noteDefaultBg,borderRadius:4,boxShadow:"var(--zg-shadow-popover)",transform:"rotate(-1deg)",position:"relative",display:"flex",flexDirection:"column",fontFamily:"'Inter', sans-serif",overflow:"hidden",transition:"background 0.3s"},children:[t.jsx("div",{style:{position:"absolute",top:-6,left:"50%",transform:"translateX(-50%)",width:64,height:16,background:e.stickyTape,borderRadius:2,boxShadow:e.shadowTiny}}),t.jsx("button",{onClick:i,style:{position:"absolute",top:10,right:10,width:24,height:24,borderRadius:"50%",background:e.groupSoftStrong,border:"none",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",fontSize:14,color:e.inkMedium},onMouseEnter:h=>h.currentTarget.style.background=e.groupBorderWeak,onMouseLeave:h=>h.currentTarget.style.background=e.groupSoftStrong,children:"✕"}),t.jsxs("div",{style:{padding:"28px 24px 20px",flex:1,overflowY:"auto",display:"flex",flexDirection:"column"},children:[p&&t.jsx("div",{style:{background:e.todaySoft,color:e.dangerText,padding:"8px 12px",borderRadius:6,fontSize:12,marginBottom:12,border:`1px solid ${e.todayMid}`},children:p}),t.jsx("input",{type:"text",value:d,onChange:h=>g(h.target.value),placeholder:a("noteModal.titlePlaceholder","Note title..."),style:{width:"100%",background:"transparent",border:"none",outline:"none",fontSize:20,fontWeight:800,color:e.inkStrong,lineHeight:"1.3",padding:0,margin:0,marginBottom:14,fontFamily:"inherit"}}),t.jsx("div",{style:{width:"100%",height:1,background:e.groupSoftStrong,marginBottom:14}}),t.jsx("textarea",{value:m,onChange:h=>y(h.target.value),rows:6,placeholder:a("noteModal.contentPlaceholder","Write your note here..."),style:{width:"100%",background:"transparent",border:"none",outline:"none",fontSize:14,color:e.inkMedium,lineHeight:"1.6",resize:"vertical",padding:0,margin:0,fontFamily:"inherit",flex:1,minHeight:100}}),t.jsxs("div",{style:{marginTop:14,paddingTop:10,borderTop:`1px solid ${e.groupSoftStrong}`},children:[t.jsx("input",{ref:W,type:"file",multiple:!0,onChange:h=>{const K=h.target.files?Array.from(h.target.files):[];K.length>0&&u(R=>[...R,...K]),W.current&&(W.current.value="")},style:{display:"none"}}),t.jsxs("button",{type:"button",onClick:()=>W.current?.click(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",borderRadius:6,background:e.groupSoft,border:`1px dashed ${e.groupBorderWeak}`,cursor:"pointer",fontSize:12,color:e.inkMedium,fontWeight:500,transition:"background 0.15s",width:"100%",justifyContent:"center"},onMouseEnter:h=>h.currentTarget.style.background=e.groupSoftStrong,onMouseLeave:h=>h.currentTarget.style.background=e.groupSoft,children:[t.jsx(Y.Upload,{size:13}),a("noteModal.attachFiles","Attach files")]}),I.length>0&&t.jsx("div",{style:{marginTop:8,display:"flex",flexDirection:"column",gap:4},children:I.map((h,K)=>t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,background:e.surfaceFrost,fontSize:11,color:e.inkMedium},children:[t.jsx(Y.Paperclip,{size:10,style:{flexShrink:0}}),t.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.name}),t.jsxs("span",{style:{fontSize:9,color:e.inkSoft4,flexShrink:0},children:[(h.size/1024).toFixed(0),"KB"]}),t.jsx("button",{type:"button",onClick:()=>u(R=>R.filter((te,J)=>J!==K)),style:{background:"none",border:"none",cursor:"pointer",padding:2,display:"flex",color:e.dangerText},title:a("noteModal.removeFile","Remove"),children:t.jsx(Y.X,{size:12})})]},`file-${K}`))})]}),t.jsxs("div",{style:{marginTop:16,paddingTop:12,borderTop:`1px solid ${e.groupSoftStrong}`,display:"flex",alignItems:"center",justifyItems:"flex-start",justifyContent:"space-between",gap:12},children:[t.jsx("input",{type:"date",value:A,onChange:h=>L(h.target.value),style:{background:"transparent",border:"none",outline:"none",fontSize:12,color:e.inkSoft3,fontWeight:500,fontFamily:"inherit",padding:0,cursor:"pointer",width:"auto"}}),t.jsx("div",{style:{display:"flex",gap:6,alignItems:"center",flexWrap:"wrap",justifyContent:"flex-end"},children:Vt.map(h=>t.jsx("button",{type:"button",onClick:()=>k(h.value),style:{width:22,height:22,borderRadius:"50%",border:z===h.value?`2px solid ${e.group}`:`1.5px solid ${e.groupSoftStrong}`,backgroundColor:h.value,cursor:"pointer",padding:0,transform:z===h.value?"scale(1.15)":"scale(1)",transition:"all 0.15s",boxShadow:z===h.value?e.shadowSmall:"none"},title:h.label},h.value))})]}),O.length>0&&t.jsxs("div",{style:{marginTop:12,paddingTop:12,borderTop:`1px solid ${e.groupSoftStrong}`},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[t.jsx(Y.Link2,{size:14,style:{color:e.inkSoft3}}),t.jsx("span",{style:{fontSize:11,color:e.inkSoft3,fontWeight:600},children:a("noteModal.dependency","Dependency")})]}),t.jsxs("select",{value:f,onChange:h=>v(h.target.value),style:{width:"100%",background:e.surfaceFrost,border:`1px solid ${e.groupSoftStrong}`,borderRadius:6,fontSize:12,color:e.inkMedium,padding:"6px 8px",outline:"none",fontFamily:"inherit",cursor:"pointer"},children:[t.jsx("option",{value:"",children:a("noteModal.none","None")}),r.length>0&&t.jsx("optgroup",{label:a("noteModal.milestones","Milestones"),children:r.map(h=>t.jsx("option",{value:h.id,children:h.name},h.id))})]}),f&&t.jsx("select",{value:M,onChange:h=>c(h.target.value),style:{width:"100%",background:e.surfaceFrost,border:`1px solid ${e.groupSoftStrong}`,borderRadius:6,fontSize:12,color:e.inkMedium,padding:"6px 8px",outline:"none",fontFamily:"inherit",cursor:"pointer",marginTop:6},children:Object.keys(tt).map(h=>t.jsx("option",{value:h,children:tt[h]},h))})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:10,paddingTop:16,marginTop:12,borderTop:`1px solid ${e.groupSoftStrong}`},children:[t.jsx("button",{onClick:i,style:{padding:"8px 16px",fontSize:13,color:e.inkMedium,background:e.surfaceFrost,border:`1px solid ${e.groupSoftStrong}`,borderRadius:8,cursor:"pointer"},children:a("noteModal.cancel","Cancel")}),t.jsxs("button",{onClick:q,disabled:F,style:{padding:"8px 20px",fontSize:13,color:e.white,background:e.group,border:"none",borderRadius:8,cursor:"pointer",display:"flex",alignItems:"center",gap:6,opacity:F?.5:1},children:[F&&t.jsx(Y.Loader2,{size:16,style:{animation:"zg-spin 1s linear infinite"}}),a("noteModal.create","Create Note")]})]})]})]})}):null}exports.NoteModal=Ht;exports.ProjectGantt=_t;exports.enUS=it;exports.ptBR=Xt;