zegantt 0.1.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.
@@ -0,0 +1 @@
1
+ (function(oe,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("react/jsx-runtime"),require("react"),require("lucide-react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","lucide-react"],e):(oe=typeof globalThis<"u"?globalThis:oe||self,e(oe.ZeGantt={},oe.jsxRuntime,oe.React,oe.lucideReact))})(this,(function(oe,e,b,F){"use strict";const Ee=b.createContext(void 0);function We({children:o,value:g}){return e.jsx(Ee.Provider,{value:g,children:o})}function ce(){const o=b.useContext(Ee);if(!o)throw new Error("useGanttContext must be used within a GanttProvider");return o}const G={white:"#FFFFFF",dark_gray:"#4F4F4F",gray:"#7B7B7B",light_gray:"#D9D9D9",dark_green:"#1A3C30",water_green:"#7ab7a3",light_green:"#A0D8A8",orange:"#CD6200",yellow:"#FFBB1C",red:"#FF0000"},t={pageBg:"#F8FAFB",surface:G.white,surfaceAlt:"#F7FAF8",headerBg:"#F2F5F3",textTitle:G.dark_green,textPrimary:G.dark_gray,textSecondary:G.gray,textMuted:G.light_gray,group:G.dark_green,groupLight:G.water_green,milestone:G.dark_green,milestoneRing:G.light_green,event:G.orange,note:G.yellow,border:G.light_gray,borderLight:"#ECECEC",weekendBg:"#F4F6F5",today:G.red,todayBg:"#FF000008",arrow:G.gray,arrowHover:G.dark_green},O=50,pe=32,Fe=pe*2,ze=460,Z=26,Te=28,Ce=120,Pe=40,Ye=3.5,Q=[{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"}],Le={step:"Etapas",milestone:"Marcos",event:"Eventos",note:"Notas"};function Xe(){const{props:o,t:g,viewMode:i,setViewMode:N,visibleTypes:f,setVisibleTypes:v,newActionOpen:I,setNewActionOpen:T,newActionRef:S}=ce(),{projectName:D,onAddNewStage:C,onAddMilestone:k,onAddEvent:m,onAddNote:c}=o,u=l=>{v(a=>{const d=new Set(a);return d.has(l)?d.delete(l):d.add(l),d})};return e.jsxs("div",{className:"flex items-center justify-between px-6 py-5",style:{borderBottom:`1px solid ${t.border}`,background:`linear-gradient(180deg, ${t.headerBg} 0%, ${t.surface} 100%)`},children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-bold uppercase tracking-widest",style:{color:t.textTitle},children:g("planning.gantt","PLANEJAMENTO DA OBRA")}),e.jsx("div",{className:"h-[2.5px] w-16 mt-1.5 rounded-full",style:{background:`linear-gradient(90deg, ${t.group}, ${t.milestoneRing})`}})]}),D&&e.jsx("span",{className:"text-xs font-medium px-3 py-1 rounded-full",style:{color:t.textSecondary,background:t.surface,border:`1px solid ${t.border}`},children:D})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex p-1 rounded-lg",style:{background:"rgba(122,122,122,0.07)",border:`1px solid ${t.borderLight}`},children:["month","year"].map(l=>e.jsx("button",{onClick:()=>N(l),className:"px-5 py-1.5 text-xs font-semibold rounded-md transition-all duration-200",style:i===l?{background:t.surface,color:t.group,boxShadow:"0 1px 3px rgb(0 0 0 / 0.08)"}:{color:t.textSecondary},children:l==="month"?g("charts.gantt.month","Mês"):g("charts.gantt.year","Ano")},l))}),e.jsx("div",{className:"flex p-1 rounded-lg gap-0.5",style:{background:"rgba(122,122,122,0.07)",border:`1px solid ${t.borderLight}`},children:[{type:"step",label:"Etapas",icon:e.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{background:Q[0].bar,border:`1px solid ${Q[0].barBorder}`}})},{type:"milestone",label:"Marcos",icon:e.jsx(F.Flag,{size:11,style:{color:t.milestone}})},{type:"event",label:"Eventos",icon:e.jsx(F.Clock,{size:11,style:{color:t.event}})},{type:"note",label:"Notas",icon:e.jsx(F.MessageCircle,{size:11,style:{color:t.note}})}].map(l=>{const a=f.has(l.type);return e.jsxs("button",{onClick:()=>u(l.type),className:"flex items-center gap-1.5 px-3 py-1.5 text-[11px] font-semibold rounded-md transition-all duration-200",style:a?{background:t.surface,color:t.group,boxShadow:"0 1px 3px rgb(0 0 0 / 0.08)"}:{color:t.textMuted,opacity:.5},children:[l.icon,e.jsx("span",{children:l.label})]},l.type)})}),C&&e.jsxs("div",{ref:S,style:{position:"relative"},children:[e.jsxs("button",{onClick:()=>T(l=>!l),className:"flex items-center gap-2 px-5 py-2.5 rounded-lg text-sm font-semibold text-white transition-all duration-200 hover:shadow-lg hover:scale-[1.02] active:scale-[0.98]",style:{background:`linear-gradient(135deg, ${t.group}, ${t.group}dd)`},children:[e.jsx(F.Plus,{size:16}),e.jsx("span",{children:g("charts.gantt.newAction","Nova Ação")}),e.jsx(F.ChevronDown,{size:14,style:{opacity:.7,transform:I?"rotate(180deg)":"none",transition:"transform 0.18s"}})]}),I&&e.jsx("div",{style:{position:"absolute",top:"calc(100% + 6px)",right:0,zIndex:99999,background:"#fff",borderRadius:10,boxShadow:"0 12px 40px rgba(0,0,0,0.15), 0 3px 10px rgba(0,0,0,0.08)",border:`1.5px solid ${t.borderLight}`,width:200,overflow:"hidden",padding:"5px 5px"},onClick:l=>l.stopPropagation(),children:[{label:"Etapa",icon:e.jsx("div",{style:{width:14,height:14,borderRadius:3,background:Q[0].bar,border:`1.5px solid ${Q[0].barBorder}`,flexShrink:0}}),action:()=>{C(),T(!1)}},{label:"Marco",icon:e.jsx("div",{style:{width:22,height:22,borderRadius:"50%",background:`${t.milestoneRing}30`,border:`1.5px solid ${t.milestoneRing}`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(F.Flag,{size:11,style:{color:t.milestone}})}),action:()=>{k?.(),T(!1)}},{label:"Evento",icon:e.jsx("div",{style:{width:22,height:22,borderRadius:"50%",background:`${t.event}18`,border:`1.5px solid ${t.event}55`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(F.Clock,{size:11,style:{color:t.event}})}),action:()=>{m?.(),T(!1)}},{label:"Nota",icon:e.jsx("div",{style:{width:16,height:20,background:t.note,borderRadius:2,boxShadow:"1px 1px 3px rgba(0,0,0,0.14)",position:"relative",overflow:"visible",flexShrink:0},children:e.jsx("div",{style:{position:"absolute",top:-2,left:"50%",transform:"translateX(-50%)",width:10,height:4,background:"rgba(255,255,255,0.55)",borderRadius:1}})}),action:()=>{c?.(),T(!1)}}].map(l=>e.jsxs("button",{onClick:l.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:t.textPrimary,textAlign:"left",transition:"background 0.12s"},onMouseEnter:a=>{a.currentTarget.style.background=t.headerBg},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},children:[l.icon,l.label]},l.label))})]})]})]})}const Ne=864e5,q=(o,g)=>new Date(o.getTime()+g*Ne),ie=(o,g)=>Math.round((g.getTime()-o.getTime())/Ne),Be=o=>new Date(o.getFullYear(),o.getMonth(),1),De=o=>new Date(o.getFullYear(),o.getMonth()+1,0),R=o=>`${String(o.getDate()).padStart(2,"0")}/${String(o.getMonth()+1).padStart(2,"0")}/${o.getFullYear()}`,Ae={0:"JANEIRO",1:"FEVEREIRO",2:"MARÇO",3:"ABRIL",4:"MAIO",5:"JUNHO",6:"JULHO",7:"AGOSTO",8:"SETEMBRO",9:"OUTUBRO",10:"NOVEMBRO",11:"DEZEMBRO"};function Oe(){const{props:o,t:g,displayRows:i,leftBodyRef:N,handleLeftScroll:f,toggleProject:v,toggleGroup:I,hoveredTaskId:T,setHoveredTaskId:S,selectedTaskId:D,setSelectedTaskId:C,delayedIds:k,criticalIds:m,relatedIds:c}=ce(),u=540,l=a=>({id:a.id,name:a.name,start:a.start,end:a.end,type:a.originalType==="step"?"task":"milestone",progress:a.progress});return e.jsxs("div",{style:{width:ze,flexShrink:0,borderRight:`1px solid ${t.border}`},children:[e.jsxs("div",{className:"flex items-center px-4",style:{height:Fe,background:t.headerBg,borderBottom:`1px solid ${t.border}`},children:[e.jsx("div",{className:"flex-1 text-[11px] font-bold uppercase tracking-wider",style:{color:t.textSecondary},children:g("charts.gantt.stepName","NOME DA ETAPA")}),e.jsx("div",{className:"w-[80px] text-[11px] font-bold uppercase tracking-wider text-center",style:{color:t.textSecondary},children:g("charts.gantt.start","INÍCIO")}),e.jsx("div",{className:"w-[80px] text-[11px] font-bold uppercase tracking-wider text-center",style:{color:t.textSecondary},children:g("charts.gantt.end","FIM")})]}),e.jsx("div",{ref:N,onScroll:f,className:"overflow-y-auto overflow-x-hidden",style:{maxHeight:u,scrollbarWidth:"none"},children:i.map(a=>{if(a.kind==="projectHeader")return e.jsx("div",{className:"flex items-center px-4 cursor-pointer select-none",style:{height:O,borderBottom:`1.5px solid ${t.group}44`,background:`${t.group}0E`},onClick:()=>v(a.projectId),children:e.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[a.collapsed?e.jsx(F.ChevronRight,{size:15,style:{color:t.group,flexShrink:0}}):e.jsx(F.ChevronDown,{size:15,style:{color:t.group,flexShrink:0}}),e.jsx("span",{className:"text-[12px] font-bold uppercase tracking-widest truncate",style:{color:t.group},children:a.projectTitle})]})},`ph-${a.projectId}`);if(a.kind==="group"){const P=a.projectId?`${a.projectId}-${a.groupType}`:a.groupType;return e.jsx("div",{className:"flex items-center px-4 cursor-pointer select-none",style:{height:O,borderBottom:`1px solid ${t.border}`,background:t.headerBg},onClick:()=>I(P),children:e.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[a.collapsed?e.jsx(F.ChevronRight,{size:14,style:{color:t.textSecondary,flexShrink:0}}):e.jsx(F.ChevronDown,{size:14,style:{color:t.textSecondary,flexShrink:0}}),e.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:t.textTitle},children:a.label}),e.jsx("span",{className:"text-[10px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:"rgba(0,0,0,0.06)",color:t.textSecondary},children:a.count})]})},`g-${P}`)}const d=a.task,p=D===d.id,h=T===d.id,$=d.originalType!=="step",r=k.has(d.id),w=m.has(d.id),B=D!==null&&d.id!==D&&!c.has(d.id),A=D!==null&&c.has(d.id),z=r?"#FFF5F5":p?t.groupLight:A?`${t.groupLight}99`:h?t.pageBg:t.surface;return e.jsxs("div",{className:"flex items-center px-4 cursor-pointer transition-colors duration-150",style:{height:O,borderBottom:`1px solid ${t.borderLight}`,background:z,borderLeft:p?`3px solid ${t.group}`:A?`3px solid ${t.group}66`:w?`3px solid ${t.today}`:void 0,opacity:B?.3:1,transition:"opacity 0.18s, background 0.15s"},onClick:()=>C(P=>P===d.id?null:d.id),onDoubleClick:()=>o.onTaskClick?.(l(d)),onMouseEnter:()=>S(d.id),onMouseLeave:()=>S(null),children:[e.jsxs("div",{className:"flex-1 flex items-center gap-2 min-w-0 pr-2",children:[d.originalType==="step"&&e.jsx("div",{className:"flex-shrink-0 rounded",style:{width:14,height:14,background:Q[d.colorIdx??0].bar,border:`1.5px solid ${Q[d.colorIdx??0].barBorder}`}}),d.originalType==="milestone"&&e.jsx("div",{className:"flex-shrink-0 flex items-center justify-center rounded-full",style:{width:22,height:22,background:`${t.milestoneRing}30`,border:`1.5px solid ${t.milestoneRing}`},children:e.jsx(F.Flag,{size:11,style:{color:t.milestone}})}),d.originalType==="event"&&e.jsx("div",{className:"flex-shrink-0 flex items-center justify-center rounded-full",style:{width:22,height:22,background:`${t.event}18`,border:`1.5px solid ${t.event}55`},children:e.jsx(F.Clock,{size:11,style:{color:t.event}})}),d.originalType==="note"&&e.jsx("div",{className:"flex-shrink-0",style:{width:16,height:20,background:d.noteColor||t.note,borderRadius:2,boxShadow:"1px 1px 3px rgba(0,0,0,0.14)",position:"relative",overflow:"visible"},children:e.jsx("div",{style:{position:"absolute",top:-2,left:"50%",transform:"translateX(-50%)",width:10,height:4,background:"rgba(255,255,255,0.55)",borderRadius:1}})}),e.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[e.jsx("span",{className:"text-[13px] truncate font-medium leading-tight",style:{color:p?t.group:r?t.today:t.textPrimary},children:d.name}),d.originalType==="note"&&d.noteProjectTitle&&e.jsx("span",{className:"text-[10px] truncate",style:{color:t.textSecondary,marginTop:1},children:d.noteProjectTitle})]}),d.originalType==="note"&&(d.filesCount||0)>0&&e.jsxs("span",{className:"flex-shrink-0 flex items-center gap-0.5 text-[10px] px-1.5 py-0.5 rounded-full",style:{color:t.textSecondary,background:t.headerBg,border:`1px solid ${t.borderLight}`},children:[e.jsx(F.Paperclip,{size:9}),d.filesCount]}),r&&e.jsx(F.AlertTriangle,{size:12,className:"flex-shrink-0",style:{color:t.today}})]}),e.jsx("div",{className:"w-[80px] text-[11px] font-medium text-center tabular-nums",style:{color:r?t.today:t.textMuted},children:R(d.start)}),e.jsx("div",{className:"w-[80px] text-[11px] font-medium text-center tabular-nums",style:{color:r?t.today:t.textMuted},children:$?"—":R(d.end)})]},d.id)})})]})}function _e(o,g){const i=g==="day"?Pe:Ye,N=(u,l)=>{const a=[],d=new Date().toDateString();let p=-1;for(let h=0;h<l;h++){const $=q(u,h),r=$.toDateString()===d;r&&(p=h),a.push({date:$,isToday:r,isWeekend:$.getDay()===0||$.getDay()===6})}return{daysArr:a,todayIndex:p}};if(o.length===0){const u=new Date,l=Be(u),a=De(u),d=ie(l,a)+1,{daysArr:p,todayIndex:h}=N(l,d);return{start:l,end:a,totalDays:d,dayWidth:i,totalWidth:d*i,months:[{date:l,label:`${Ae[l.getMonth()]} DE ${l.getFullYear()}`,startDay:0,days:d,width:d*i}],years:[{label:l.getFullYear().toString(),width:d*i}],days:p,todayIndex:h}}let f=new Date(o[0].start),v=new Date(o[0].end);o.forEach(u=>{u.start<f&&(f=new Date(u.start)),u.end>v&&(v=new Date(u.end))});const I=Be(q(f,-14)),T=De(q(v,14)),S=ie(I,T)+1,D=[];let C=new Date(I);for(;C<=T;){const u=De(C),l=u>T?T:u,a=ie(I,C),d=ie(C,l)+1;D.push({date:new Date(C),label:`${Ae[C.getMonth()]} DE ${C.getFullYear()}`,startDay:a,days:d,width:d*i}),C=new Date(C.getFullYear(),C.getMonth()+1,1)}const{daysArr:k,todayIndex:m}=N(I,S),c=[];if(g==="month"){let u="",l=0;for(const a of D){const d=a.date.getFullYear().toString();d!==u?(u&&c.push({label:u,width:l*i}),u=d,l=a.days):l+=a.days}u&&c.push({label:u,width:l*i})}return{start:I,end:T,totalDays:S,dayWidth:i,totalWidth:S*i,months:D,years:c,days:k,todayIndex:m}}function re(o,g){return ie(g.start,o)*g.dayWidth}function Ge({task:o,x:g,y:i,w:N,progW:f,isHov:v,isDrag:I,isResize:T,isCritical:S,isDelayed:D,isConnectTarget:C,showDots:k,isBarDimmed:m,isBarHighlighted:c,commonEvents:u,handleResizeMouseDown:l,handleConnectDotMouseDown:a}){const{timeline:d,viewMode:p}=ce();if(o.originalType==="step"){const h=Q[o.colorIdx??0],$=i+(O-Z)/2,r=!!(o.previsionStart&&o.previsionEnd),w=r?re(o.previsionStart,d):0,B=r?Math.max(re(o.previsionEnd,d)-w,p==="month"?d.dayWidth:6):0,A=$+Z+3;return e.jsxs(e.Fragment,{children:[r&&e.jsx("div",{title:`Previsto: ${R(o.previsionStart)} → ${R(o.previsionEnd)}`,style:{position:"absolute",left:w,top:A,width:B,height:5,borderRadius:3,background:`${h.progress}33`,border:`1.5px solid ${h.progress}66`,boxShadow:`inset 0 0 0 1px ${h.progress}22`,pointerEvents:"none",zIndex:5}}),e.jsxs("div",{"data-task-id":o.id,...u,style:{position:"absolute",left:g,top:$,width:N,height:Z,borderRadius:Z/2,background:D?"linear-gradient(135deg, #fdd, #fee)":h.bar,border:S?`2px solid ${t.today}`:D?`1.5px solid ${t.today}88`:`1.5px solid ${h.barBorder}`,cursor:I||T?"grabbing":"grab",zIndex:v||C?20:10,boxShadow:C?`0 0 0 2px ${t.group}, 0 4px 16px ${t.group}33`:S?`0 0 0 1px ${t.today}44, 0 3px 12px ${t.today}22`:c&&!v?`0 0 0 2px ${t.group}99, 0 3px 14px ${t.group}33`:v?`0 3px 12px ${h.progress}22`:"none",transform:v?"scaleY(1.06)":"scaleY(1)",opacity:m?.15:1,transition:I||T?"none":"box-shadow 0.2s, transform 0.15s, opacity 0.18s",overflow:"visible"},children:[e.jsxs("div",{style:{position:"absolute",left:0,top:0,width:N,height:"100%",borderRadius:Z/2,overflow:"hidden",pointerEvents:"none"},children:[e.jsx("div",{style:{position:"absolute",left:0,top:0,width:f,height:"100%",background:D?`linear-gradient(90deg, ${t.today}cc, ${t.today}88)`:`linear-gradient(90deg, ${h.progress}, ${h.progress}cc)`,borderRadius:`${Z/2}px 0 0 ${Z/2}px`,transition:I||T?"none":"width 0.3s"}}),N>50&&e.jsxs("span",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:700,letterSpacing:"0.05em",color:o.progress>50?"#fff":D?t.today:h.progress,zIndex:1,pointerEvents:"none"},children:[Math.round(o.progress),"%"]})]}),e.jsx("div",{onMouseDown:z=>l(z,o,"left"),style:{position:"absolute",left:0,top:0,width:8,height:"100%",cursor:"col-resize",zIndex:2,borderRadius:`${Z/2}px 0 0 ${Z/2}px`}}),e.jsx("div",{onMouseDown:z=>l(z,o,"right"),style:{position:"absolute",right:0,top:0,width:8,height:"100%",cursor:"col-resize",zIndex:2,borderRadius:`0 ${Z/2}px ${Z/2}px 0`}}),k&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-task-id":o.id,onMouseDown:z=>a(z,o,"left"),style:{position:"absolute",left:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:t.group,border:"2.5px solid #fff",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",cursor:"crosshair",zIndex:30}}),e.jsx("div",{"data-task-id":o.id,onMouseDown:z=>a(z,o,"right"),style:{position:"absolute",right:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:t.group,border:"2.5px solid #fff",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",cursor:"crosshair",zIndex:30}})]})]})]})}if(o.originalType==="milestone"){const h=i+(O-Te)/2;return e.jsxs("div",{"data-task-id":o.id,...u,style:{position:"absolute",left:g-6,top:h,height:Te,minWidth:Ce,borderRadius:Te/2,background:S?"linear-gradient(135deg, #fee, #fff5f5)":"linear-gradient(135deg, #e8f5ee, #f0f8f4)",border:C?`2px solid ${t.group}`:S?`2px solid ${t.today}`:`1.5px solid ${t.milestoneRing}`,display:"flex",alignItems:"center",gap:6,paddingLeft:4,paddingRight:12,cursor:I?"grabbing":"grab",zIndex:v||C?20:10,boxShadow:C?`0 0 0 2px ${t.group}, 0 4px 16px ${t.group}33`:S?`0 0 0 1px ${t.today}44, 0 3px 12px ${t.today}22`:c&&!v?`0 0 0 2px ${t.group}99, 0 3px 14px ${t.group}33`:v?`0 3px 12px ${t.milestone}22`:"0 1px 3px rgba(0,0,0,0.06)",opacity:m?.15:1,transition:"box-shadow 0.2s, transform 0.15s, opacity 0.18s",transform:v?"translateY(-1px)":"none",whiteSpace:"nowrap",overflow:"visible"},children:[e.jsx("div",{style:{width:20,height:20,borderRadius:"50%",background:S?t.today:t.milestone,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(F.Flag,{size:11,color:"#fff",strokeWidth:2.5})}),e.jsx("span",{style:{fontSize:11,fontWeight:600,color:S?t.today:t.milestone,overflow:"hidden",textOverflow:"ellipsis",maxWidth:130},children:o.name}),o.progress>=100&&e.jsx("span",{style:{fontSize:9,fontWeight:700,color:"#fff",background:t.milestoneRing,borderRadius:6,padding:"1px 5px"},children:"✓"}),k&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-task-id":o.id,onMouseDown:$=>a($,o,"left"),style:{position:"absolute",left:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:t.group,border:"2.5px solid #fff",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",cursor:"crosshair",zIndex:30}}),e.jsx("div",{"data-task-id":o.id,onMouseDown:$=>a($,o,"right"),style:{position:"absolute",right:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:t.group,border:"2.5px solid #fff",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",cursor:"crosshair",zIndex:30}})]})]})}if(o.originalType==="event"){const $=i+(O-22)/2;return e.jsxs("div",{"data-task-id":o.id,...u,style:{position:"absolute",left:g-22/2,top:$,width:22,height:22,borderRadius:"50%",background:S?"linear-gradient(135deg, #fee, #fff5f5)":"linear-gradient(135deg, #fff7ed, #ffedd5)",border:C?`2px solid ${t.group}`:S?`2px solid ${t.today}`:`1.5px solid ${t.event}`,display:"flex",alignItems:"center",justifyContent:"center",cursor:I?"grabbing":"grab",zIndex:v||C?20:10,boxShadow:C?`0 0 0 2px ${t.group}, 0 4px 16px ${t.group}33`:S?`0 0 0 1px ${t.today}44, 0 3px 12px ${t.today}22`:c&&!v?`0 0 0 2px ${t.group}99, 0 3px 14px ${t.group}33`:v?`0 3px 12px ${t.event}33`:"0 1px 3px rgba(0,0,0,0.06)",opacity:m?.15:1,transition:"box-shadow 0.2s, transform 0.15s, opacity 0.18s",transform:v?"scale(1.15)":"none",overflow:"visible"},children:[e.jsx("div",{style:{width:14,height:14,borderRadius:"50%",background:S?t.today:t.event,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(F.Clock,{size:8,color:"#fff",strokeWidth:3})}),o.progress>=100&&e.jsx("div",{style:{position:"absolute",top:-5,right:-12,background:t.event,color:"#fff",fontSize:8,fontWeight:700,padding:"1px 4px",borderRadius:4},children:"✓"}),e.jsx("div",{style:{position:"absolute",top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:4,background:"rgba(255,255,255,0.9)",padding:"2px 6px",borderRadius:4,border:`1px solid ${t.borderLight}`,fontSize:9,fontWeight:600,color:S?t.today:t.event,whiteSpace:"nowrap",pointerEvents:"none",opacity:v?1:0,transition:"opacity 0.15s"},children:o.name}),k&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-task-id":o.id,onMouseDown:r=>a(r,o,"left"),style:{position:"absolute",left:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:t.group,border:"2.5px solid #fff",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",cursor:"crosshair",zIndex:30}}),e.jsx("div",{"data-task-id":o.id,onMouseDown:r=>a(r,o,"right"),style:{position:"absolute",right:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:t.group,border:"2.5px solid #fff",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",cursor:"crosshair",zIndex:30}})]})]})}if(o.originalType==="note"){const r=i+(O-44)/2,w=o.noteColor||t.note;return e.jsxs("div",{"data-task-id":o.id,...u,style:{position:"absolute",left:g-36/2,top:r,width:36,height:44,background:w,borderRadius:2,cursor:I?"grabbing":"grab",zIndex:v||C?20:10,boxShadow:C?`0 0 0 2px ${t.group}, 0 4px 16px ${t.group}33`:c&&!v?`0 0 0 2px ${t.group}99, 0 3px 14px ${t.group}33`:v?"3px 4px 12px rgba(0,0,0,0.2)":"1px 2px 5px rgba(0,0,0,0.15)",opacity:m?.2:1,transition:"box-shadow 0.2s, transform 0.15s, opacity 0.18s",transform:v?"rotate(-2deg) scale(1.05)":"none",overflow:"visible",display:"flex",flexDirection:"column",border:"1px solid rgba(0,0,0,0.04)"},children:[e.jsx("div",{style:{position:"absolute",top:-5,left:"50%",transform:"translateX(-50%)",width:18,height:6,background:"rgba(255,255,255,0.6)",borderRadius:1,boxShadow:"0 1px 2px rgba(0,0,0,0.05)"}}),e.jsxs("div",{style:{padding:"6px 4px 2px",flex:1,overflow:"hidden"},children:[e.jsx("div",{style:{width:"80%",height:2,background:"rgba(0,0,0,0.1)",borderRadius:1,marginBottom:3}}),e.jsx("div",{style:{width:"60%",height:2,background:"rgba(0,0,0,0.1)",borderRadius:1,marginBottom:3}}),e.jsx("div",{style:{width:"90%",height:2,background:"rgba(0,0,0,0.1)",borderRadius:1}})]}),(o.filesCount||0)>0&&e.jsx("div",{style:{position:"absolute",bottom:-5,right:-5,background:t.headerBg,color:t.textSecondary,borderRadius:"50%",border:`1px solid ${t.borderLight}`,width:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",zIndex:2},children:e.jsx(F.Paperclip,{size:8})}),e.jsx("div",{style:{position:"absolute",top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:6,background:"rgba(255,255,255,0.95)",padding:"3px 8px",borderRadius:4,border:`1px solid ${t.borderLight}`,fontSize:10,fontWeight:500,color:t.textPrimary,whiteSpace:"nowrap",pointerEvents:"none",opacity:v?1:0,transition:"opacity 0.15s",boxShadow:"0 2px 8px rgba(0,0,0,0.08)"},children:o.name}),k&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-task-id":o.id,onMouseDown:B=>a(B,o,"left"),style:{position:"absolute",left:-10,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:t.group,border:"2.5px solid #fff",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",cursor:"crosshair",zIndex:30}}),e.jsx("div",{"data-task-id":o.id,onMouseDown:B=>a(B,o,"right"),style:{position:"absolute",right:-10,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:t.group,border:"2.5px solid #fff",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",cursor:"crosshair",zIndex:30}})]})]})}return null}function He(){const{arrows:o,hoveredTaskId:g,selectedTaskId:i,relatedIds:N}=ce();return e.jsx(e.Fragment,{children:o.map((f,v)=>{const I=g===f.predId||g===f.succId,T=!i||f.predId===i||f.succId===i||N.has(f.predId)||N.has(f.succId),S=i!==null&&T,D=I?t.arrowHover:S?t.group:t.arrow;return e.jsxs("g",{style:{opacity:T?S?1:void 0:.08,transition:"opacity 0.18s"},children:[e.jsx("path",{d:f.path,fill:"none",stroke:D,strokeWidth:S?2.5:I?2:1.5,style:{transition:"stroke 0.2s, stroke-width 0.2s"}}),e.jsx("polygon",{points:`${f.headX},${f.headY} ${f.headX-6},${f.headY-4} ${f.headX-6},${f.headY+4}`,fill:D,style:{transition:"fill 0.2s"}})]},v)})})}const $e=o=>({id:o.id,name:o.name,start:o.start,end:o.end,type:o.originalType==="step"?"task":o.originalType,progress:o.progress}),he=(o,g)=>{switch(o){case"step":return e.jsx("div",{style:{width:12,height:12,borderRadius:2,background:Q[g??0].bar,border:`1.5px solid ${Q[g??0].barBorder}`,flexShrink:0}});case"milestone":return e.jsx("div",{style:{width:16,height:16,borderRadius:"50%",background:t.milestone,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(F.Flag,{size:8,color:"#fff"})});case"event":return e.jsx("div",{style:{width:16,height:16,borderRadius:"50%",background:t.event,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(F.Clock,{size:8,color:"#fff"})});case"note":return e.jsx("div",{style:{width:12,height:14,background:t.note,borderRadius:2,boxShadow:"1px 1px 2px rgba(0,0,0,0.1)",flexShrink:0}});default:return null}};function Ue(){const{props:o,viewMode:g,timeline:i,displayRows:N,dragState:f,resizeState:v,connectState:I,pendingConnection:T,setPendingConnection:S,depModalType:D,setDepModalType:C,depModalLag:k,setDepModalLag:m,depCreating:c,deletingDepId:u,setDeletingDepId:l,chartMenu:a,setChartMenu:d,rightBodyRef:p,timeHeaderRef:h,handleChartMouseDown:$,handleChartWheel:r,openChartMenu:w,hoveredTaskId:B,setHoveredTaskId:A,selectedTaskId:z,setSelectedTaskId:P,tooltip:M,setTooltip:U,popupState:H,setPopupState:_,criticalIds:se,delayedIds:ge,relatedIds:fe,handleBarMouseDown:ue,handleResizeMouseDown:be,handleConnectDotMouseDown:xe,handleCreateDependency:ve}=ce(),{translations:ne,onViewStage:ye,onEditStage:we,onDeleteStage:W,onDeleteDependency:X,onAddNewStage:me,onAddMilestone:ke,onAddEvent:Se,onAddNote:Ie}=o,J=(x,s)=>ne?typeof ne=="function"?ne(x,s):ne[x]||s:s,de=(x,s)=>Math.round((s.getTime()-x.getTime())/864e5)+1,te=Math.max(N.length*O,400),le=()=>_({isOpen:!1,position:{x:0,y:0},task:null});return e.jsxs("div",{className:"flex-1 w-full bg-[#FAFAFA] flex flex-col relative overflow-hidden",style:{borderLeft:`1px solid ${t.borderLight}`},children:[e.jsx("div",{ref:h,style:{height:pe*2,background:t.headerBg,borderBottom:`1px solid ${t.borderLight}`,overflow:"hidden",position:"relative",flexShrink:0,boxShadow:"0 1px 3px rgba(0,0,0,0.02)"},onWheel:r,children:e.jsxs("div",{style:{width:i.totalWidth,height:"100%",position:"relative"},children:[e.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,height:pe,display:"flex"},children:[g==="day"&&i.months.map((x,s)=>e.jsx("div",{style:{width:x.width,position:"relative",height:"100%",borderRight:`1px solid ${t.borderLight}`,paddingLeft:12,display:"flex",alignItems:"flex-end",paddingBottom:6},children:e.jsx("span",{style:{fontSize:13,fontWeight:700,color:t.textTitle,letterSpacing:"0.02em"},children:x.label})},s)),g==="month"&&i.years?.map((x,s)=>e.jsx("div",{style:{width:x.width,position:"relative",height:"100%",borderRight:`1px solid ${t.borderLight}`,paddingLeft:12,display:"flex",alignItems:"flex-end",paddingBottom:6},children:e.jsx("span",{style:{fontSize:13,fontWeight:700,color:t.textTitle,letterSpacing:"0.02em"},children:x.label})},s))]}),e.jsxs("div",{style:{position:"absolute",top:pe,left:0,right:0,height:pe,display:"flex"},children:[g==="day"&&i.days.map((x,s)=>{const n=x.isToday;return e.jsx("div",{style:{width:i.dayWidth,position:"relative",height:"100%",borderRight:`1px solid ${t.borderLight}`,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:e.jsx("span",{style:{fontSize:11,fontWeight:n?800:500,color:n?t.today:t.textSecondary,letterSpacing:"-0.03em"},children:x.date.getDate().toString().padStart(2,"0")})},s)}),g==="month"&&i.months.map((x,s)=>e.jsx("div",{style:{width:x.width,position:"relative",height:"100%",borderRight:`1px solid ${t.borderLight}`,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:e.jsx("span",{style:{fontSize:11,fontWeight:600,color:t.textPrimary,textTransform:"uppercase",letterSpacing:"0.05em"},children:x.label.substring(0,3)})},s))]})]})}),e.jsx("div",{ref:p,className:"flex-1 overflow-auto bg-white gantt-scroll",onMouseDown:$,onWheel:r,onContextMenu:w,style:{position:"relative"},children:e.jsxs("div",{style:{width:i.totalWidth,height:te,position:"relative"},children:[e.jsxs("svg",{width:i.totalWidth,height:te,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[e.jsxs("defs",{children:[e.jsx("pattern",{id:"gantt-y-lines",x:"0",y:"0",width:i.dayWidth,height:O,patternUnits:"userSpaceOnUse",children:e.jsx("line",{x1:i.dayWidth,y1:"0",x2:i.dayWidth,y2:O,stroke:t.border,strokeWidth:"1",strokeDasharray:"4 4",opacity:"0.4"})}),e.jsx("pattern",{id:"gantt-x-lines",x:"0",y:"0",width:i.dayWidth,height:O,patternUnits:"userSpaceOnUse",children:e.jsx("line",{x1:"0",y1:O,x2:i.dayWidth,y2:O,stroke:t.borderLight,strokeWidth:"1"})})]}),e.jsx("rect",{width:"100%",height:"100%",fill:"url(#gantt-x-lines)"}),e.jsx("rect",{width:"100%",height:"100%",fill:"url(#gantt-y-lines)"}),g==="day"&&i.days.map((x,s)=>x.isWeekend?e.jsx("rect",{x:s*i.dayWidth,y:0,width:i.dayWidth,height:te,fill:t.weekendBg,opacity:.6},`we-${s}`):null),g==="month"&&i.days.map((x,s)=>x.isWeekend?e.jsx("rect",{x:s*i.dayWidth,y:0,width:i.dayWidth,height:te,fill:t.weekendBg,opacity:.3},`wem-${s}`):null),i.todayIndex>=0&&e.jsxs("g",{children:[e.jsx("rect",{x:i.todayIndex*i.dayWidth,y:0,width:i.dayWidth,height:te,fill:t.todayBg}),e.jsx("line",{x1:(i.todayIndex+.5)*i.dayWidth,y1:0,x2:(i.todayIndex+.5)*i.dayWidth,y2:te,stroke:t.today,strokeWidth:2,strokeDasharray:"4 4",opacity:.3})]})]}),N.map((x,s)=>x.kind==="group"||x.kind==="projectHeader"?e.jsx("div",{style:{position:"absolute",left:0,top:s*O,width:"100%",height:O,background:x.kind==="projectHeader"?t.headerBg:`${t.groupLight}15`,borderBottom:`1px solid ${t.borderLight}`,pointerEvents:"none"}},`bg-${s}`):null),e.jsxs("div",{style:{position:"absolute",inset:0},children:[N.map((x,s)=>{if(x.kind!=="task")return null;const n=x.task,y=f?.task.id===n.id,L=v?.task.id===n.id,j=y||L&&v.edge==="left"?q(n.start,y?f.offsetDays:v.offsetDays):n.start,E=y||L&&v.edge==="right"?q(n.end,y?f.offsetDays:v.offsetDays):n.end,Y=n.originalType!=="step";let ae=re(j,i),V=0,ee=0;Y||(V=Math.max(re(E,i)-ae,i.dayWidth),ee=V*(n.progress/100));const je=B===n.id,Me=z===n.id,Qe=ge.has(n.id),Re=se.has(n.id),et=!!z&&!Me&&!fe.has(n.id),tt=Me||!!z&&fe.has(n.id),ot=I?.hoverTargetId===n.id,rt=je||Me,st=s*O,nt={onMouseEnter:K=>{A(n.id),!f&&!v&&U({task:n,x:K.clientX,y:K.clientY})},onMouseMove:K=>{B===n.id&&!f&&!v&&U({task:n,x:K.clientX,y:K.clientY})},onMouseLeave:()=>{A(null),U(null)},onClick:K=>{K.stopPropagation(),P(n.id),K.detail===2&&ye?.($e(n)),_(!H.isOpen||H.task?.id!==n.id?{isOpen:!0,position:{x:K.clientX,y:K.clientY},task:n}:{isOpen:!1,position:{x:0,y:0},task:null})},onMouseDown:K=>ue(K,n)};return e.jsx(Ge,{task:n,x:ae,y:st,w:V,progW:ee,isHov:je,isDrag:y,isResize:L,isCritical:Re,isDelayed:Qe,isConnectTarget:ot,showDots:rt,isBarDimmed:et,isBarHighlighted:tt,commonEvents:nt,handleResizeMouseDown:be,handleConnectDotMouseDown:xe},n.id)}),e.jsx("svg",{width:i.totalWidth,height:te,style:{position:"absolute",inset:0,pointerEvents:"none"},children:e.jsx(He,{})}),M&&!f&&e.jsx("div",{style:{position:"fixed",left:M.x+16,top:M.y-10,zIndex:9999,pointerEvents:"none"},children:e.jsxs("div",{className:"rounded-xl px-4 py-3 min-w-[220px] max-w-[340px] backdrop-blur-sm",style:{background:`${t.surface}f5`,border:`1px solid ${t.borderLight}`,boxShadow:"0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06)"},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[he(M.task.originalType,M.task.colorIdx),e.jsx("span",{className:"text-xs font-bold truncate",style:{color:t.textTitle},children:M.task.name})]}),e.jsx("div",{className:"flex flex-col gap-1 text-[11px]",style:{color:t.textSecondary},children:M.task.originalType==="step"?e.jsxs(e.Fragment,{children:[M.task.previsionStart&&M.task.previsionEnd&&e.jsxs("div",{style:{background:`${t.headerBg}`,borderRadius:6,padding:"4px 6px",marginBottom:2},children:[e.jsxs("div",{className:"flex items-center gap-1 mb-1",children:[e.jsx("div",{style:{width:20,height:4,borderRadius:2,background:`${t.textSecondary}44`,border:`1.5px solid ${t.textSecondary}66`}}),e.jsx("span",{style:{fontSize:9,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:t.textSecondary},children:"Previsto"})]}),e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("span",{children:"Início:"}),e.jsx("span",{className:"font-semibold tabular-nums",style:{color:t.textPrimary},children:R(M.task.previsionStart)})]}),e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("span",{children:"Fim:"}),e.jsx("span",{className:"font-semibold tabular-nums",style:{color:t.textPrimary},children:R(M.task.previsionEnd)})]}),e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("span",{children:"Duração:"}),e.jsxs("span",{className:"font-semibold tabular-nums",style:{color:t.textPrimary},children:[de(M.task.previsionStart,M.task.previsionEnd),"d"]})]})]}),e.jsxs("div",{style:{background:M.task.hasActualDates?`${t.groupLight}22`:"transparent",borderRadius:6,padding:"4px 6px"},children:[e.jsxs("div",{className:"flex items-center gap-1 mb-1",children:[e.jsx("div",{style:{width:20,height:4,borderRadius:2,background:Q[M.task.colorIdx??0].progress}}),e.jsx("span",{style:{fontSize:9,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:M.task.hasActualDates?t.group:t.textSecondary},children:M.task.hasActualDates?"Real":"Previsto (em uso)"})]}),e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("span",{children:"Início:"}),e.jsx("span",{className:"font-semibold tabular-nums",style:{color:t.textPrimary},children:R(M.task.start)})]}),e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("span",{children:"Fim:"}),e.jsx("span",{className:"font-semibold tabular-nums",style:{color:t.textPrimary},children:R(M.task.end)})]}),e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("span",{children:"Duração:"}),e.jsxs("span",{className:"font-semibold tabular-nums",style:{color:t.textPrimary},children:[de(M.task.start,M.task.end),"d"]})]})]}),e.jsxs("div",{className:"flex justify-between gap-4 pt-1 mt-1",style:{borderTop:`1px solid ${t.borderLight}`},children:[e.jsxs("span",{children:[J("charts.gantt.progress","Progresso"),":"]}),e.jsxs("span",{className:"font-bold",style:{color:t.group},children:[Math.round(M.task.progress),"%"]})]})]}):M.task.originalType==="note"?e.jsxs(e.Fragment,{children:[M.task.noteProjectTitle&&e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[e.jsx("div",{style:{width:8,height:8,borderRadius:2,background:M.task.noteColor||t.note,flexShrink:0}}),e.jsx("span",{className:"text-[11px] font-semibold truncate",style:{color:t.textPrimary},children:M.task.noteProjectTitle})]}),e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("span",{children:"Data:"}),e.jsx("span",{className:"font-semibold tabular-nums",style:{color:t.textPrimary},children:R(M.task.start)})]}),(M.task.filesCount||0)>0&&e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("span",{children:"Anexos:"}),e.jsxs("span",{className:"font-semibold flex items-center gap-1",style:{color:t.textPrimary},children:[e.jsx(F.Paperclip,{size:10}),M.task.filesCount]})]})]}):e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsxs("span",{children:[J("charts.gantt.start","Início"),":"]}),e.jsx("span",{className:"font-semibold tabular-nums",style:{color:t.textPrimary},children:R(M.task.start)})]})})]})})]})]})}),H.task&&H.isOpen&&(()=>{const x=H.task,s=(o.dependencies||[]).filter(E=>E.predecessorId===x.id||E.successorId===x.id),n={FS:"Início após Fim",SS:"Inícios simultâneos",FF:"Fins simultâneos",SF:"Fim após Início"},y=s.length>0?300:220,L=Math.min(H.position.x,window.innerWidth-y-16),j=H.position.y+8;return e.jsxs("div",{"data-popup":"gantt-action",style:{position:"fixed",left:L,top:j,zIndex:9999,background:"#fff",borderRadius:4,boxShadow:"0 12px 40px rgba(0,0,0,0.14), 0 3px 10px rgba(0,0,0,0.07)",border:`1.5px solid ${t.borderLight}`,width:y,overflow:"hidden"},onMouseDown:E=>E.stopPropagation(),children:[e.jsx("div",{style:{padding:"12px 14px 10px",borderBottom:`1px solid ${t.borderLight}`},children:e.jsx("p",{style:{fontSize:13,fontWeight:700,color:t.group,margin:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:x.name,children:x.name})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,padding:"8px 6px"},children:[e.jsxs("button",{onClick:()=>{ye?.($e(x)),le()},className:"gantt-popup-btn",children:[e.jsx(F.Eye,{size:15})," ",e.jsx("span",{children:J("projects.stepAction.viewDetails","Ver detalhes")})]}),e.jsxs("button",{onClick:()=>{we?.($e(x)),le()},className:"gantt-popup-btn",children:[e.jsx(F.Edit2,{size:15})," ",e.jsx("span",{children:J("projects.stepAction.edit","Editar")})]}),e.jsxs("button",{onClick:()=>{W?.(x.id),le()},className:"gantt-popup-btn text-red-500 hover:bg-red-50",children:[e.jsx(F.Trash2,{size:15})," ",e.jsx("span",{children:J("projects.stepAction.delete","Excluir")})]})]}),s.length>0&&e.jsxs("div",{style:{borderTop:`1px solid ${t.borderLight}`,padding:"10px 14px 12px"},children:[e.jsxs("div",{style:{fontSize:10,fontWeight:700,color:t.textSecondary,textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:8},children:["Relações (",s.length,")"]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:5},children:s.map(E=>{const Y=E.predecessorId===x.id,ae=Y?E.successorName:E.predecessorName,V=u===E.id;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:8,background:"#f8fafb",border:`1px solid ${t.borderLight}`},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{fontSize:10,fontWeight:700,color:t.group,marginBottom:2},children:[e.jsx("span",{style:{background:`${t.group}15`,borderRadius:4,padding:"1px 5px"},children:E.type})," ",e.jsx("span",{style:{color:t.textSecondary,fontWeight:500},children:Y?"→ ":"← "}),e.jsx("span",{style:{color:t.textMuted,fontWeight:400,fontSize:9},children:n[E.type]??E.type})]}),e.jsx("div",{style:{fontSize:11,color:t.textPrimary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:ae,children:ae})]}),X&&e.jsx("button",{disabled:!!V,onClick:async()=>{l(E.id);try{await X(E.id)}finally{l(null)}},style:{flexShrink:0,padding:"4px 6px",borderRadius:6,border:"none",background:V?"#fee2e2":"transparent",cursor:V?"wait":"pointer",color:"#ef4444",fontSize:14,opacity:V?.5:1,transition:"background 0.12s"},children:V?"⟳":"🗑"})]},E.id)})})]})]})})(),a&&e.jsxs("div",{"data-menu":"chart-create",style:{position:"fixed",left:Math.min(a.x,window.innerWidth-220),top:Math.min(a.y,window.innerHeight-220),zIndex:99999,background:"#fff",borderRadius:10,boxShadow:"0 12px 40px rgba(0,0,0,0.15), 0 3px 10px rgba(0,0,0,0.08)",border:`1.5px solid ${t.borderLight}`,width:200,overflow:"hidden"},onClick:x=>x.stopPropagation(),children:[e.jsx("div",{style:{padding:"9px 13px 8px",borderBottom:`1px solid ${t.borderLight}`,background:t.headerBg},children:e.jsxs("p",{style:{margin:0,fontSize:10,fontWeight:700,color:t.textSecondary,textTransform:"uppercase",letterSpacing:"0.08em"},children:["Adicionar em ",R(a.date)]})}),e.jsx("div",{style:{padding:"5px 5px"},children:[{label:"Etapa",icon:he("step",0),action:()=>{me?.(a.date,a.projectId),d(null)}},{label:"Marco",icon:he("milestone"),action:()=>{ke?.(a.date,a.projectId),d(null)}},{label:"Evento",icon:he("event"),action:()=>{Se?.(a.date,a.projectId),d(null)}},{label:"Nota",icon:he("note"),action:()=>{Ie?.(a.date,a.projectId),d(null)}}].map(x=>e.jsxs("button",{onClick:x.action,className:"gantt-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:t.textPrimary,textAlign:"left",transition:"background 0.12s"},children:[x.icon," ",x.label]},x.label))})]}),I&&e.jsxs("svg",{style:{position:"fixed",inset:0,width:"100vw",height:"100vh",pointerEvents:"none",zIndex:99999},children:[e.jsx("defs",{children:e.jsx("marker",{id:"connect-arrow",markerWidth:"8",markerHeight:"8",refX:"6",refY:"3",orient:"auto",children:e.jsx("path",{d:"M0,0 L0,6 L6,3 z",fill:t.group})})}),e.jsx("line",{x1:I.fromScreenX,y1:I.fromScreenY,x2:I.currentScreenX,y2:I.currentScreenY,stroke:t.group,strokeWidth:2.5,strokeDasharray:"8 5",markerEnd:"url(#connect-arrow)",opacity:.85,style:{animation:"gantt-dash 0.5s linear infinite"}}),e.jsx("style",{children:"@keyframes gantt-dash { to { stroke-dashoffset: -13; } }"})]}),T&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:99998},onClick:()=>S(null),children:e.jsxs("div",{style:{background:"#fff",borderRadius:20,padding:"32px 36px",width:420,boxShadow:"0 24px 80px rgba(0,0,0,0.18), 0 6px 24px rgba(0,0,0,0.08)"},onClick:x=>x.stopPropagation(),children:[e.jsxs("div",{style:{marginBottom:20},children:[e.jsx("h3",{style:{fontSize:18,fontWeight:700,color:t.textTitle,marginBottom:4},children:"Tipo de Relação"}),e.jsx("p",{style:{fontSize:13,color:t.textSecondary},children:"Escolha como as duas tarefas se relacionam"})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10,marginBottom:20},children:[{type:"FS",label:"Início após Fim",desc:"B começa quando A termina"},{type:"SS",label:"Inícios simultâneos",desc:"A e B começam juntos"},{type:"FF",label:"Fins simultâneos",desc:"A e B terminam juntos"},{type:"SF",label:"Fim após Início",desc:"B termina quando A começa"}].map(x=>e.jsxs("button",{onClick:()=>C(x.type),style:{border:D===x.type?`2px solid ${t.group}`:`1.5px solid ${t.borderLight}`,borderRadius:12,padding:"12px 14px",textAlign:"left",cursor:"pointer",background:D===x.type?`${t.group}0d`:"#fafafa"},children:[e.jsx("div",{style:{fontSize:11,fontFamily:"monospace",fontWeight:700,color:t.group,marginBottom:4,background:D===x.type?`${t.group}20`:`${t.group}0d`,borderRadius:6,padding:"2px 6px",display:"inline-block"},children:x.type}),e.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.textTitle,marginBottom:2},children:x.label}),e.jsx("div",{style:{fontSize:11,color:t.textSecondary},children:x.desc})]},x.type))}),e.jsxs("div",{style:{marginBottom:24},children:[e.jsx("label",{style:{display:"block",fontSize:13,fontWeight:600,color:t.textTitle,marginBottom:6},children:"Atraso (Lag) em dias"}),e.jsx("input",{type:"number",value:k,onChange:x=>m(parseInt(x.target.value)||0),style:{width:"100%",padding:"10px 12px",border:`1.5px solid ${t.borderLight}`,borderRadius:8,fontSize:14}})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[e.jsx("button",{onClick:()=>S(null),style:{padding:"10px 16px",borderRadius:8,border:`1px solid ${t.borderLight}`,background:"#fff",cursor:"pointer",fontWeight:600},children:"Cancelar"}),e.jsx("button",{onClick:ve,disabled:c,style:{padding:"10px 16px",borderRadius:8,border:"none",background:t.group,color:"#fff",cursor:c?"wait":"pointer",fontWeight:600},children:c?"Salvando...":"Criar Dependência"})]})]})})]})}function Ve(o){const g=b.useRef(null),i=b.useRef(null),N=b.useRef(null),f=b.useRef(!1),v=b.useCallback(()=>{if(f.current)return;f.current=!0;const m=i.current;m&&g.current&&(g.current.scrollTop=m.scrollTop),m&&N.current&&(N.current.scrollLeft=m.scrollLeft),f.current=!1},[]),I=b.useCallback(()=>{f.current||(f.current=!0,g.current&&i.current&&(i.current.scrollTop=g.current.scrollTop),f.current=!1)},[]),T=b.useRef(!1);b.useEffect(()=>{if(T.current||!o.totalWidth)return;const m=i.current;if(!m)return;const c=re(new Date,o);if(c>=0&&c<=o.totalWidth){const u=c-m.clientWidth/2;m.scrollLeft=Math.max(0,u),N.current&&(N.current.scrollLeft=m.scrollLeft),T.current=!0}},[o]);const[S,D]=b.useState(null),C=b.useCallback((m,c)=>{if(c||m.button===2)return;const u=i.current;u&&(m.preventDefault(),D({startX:m.clientX,startY:m.clientY,scrollLeft:u.scrollLeft,scrollTop:u.scrollTop}))},[]);b.useEffect(()=>{if(!S)return;const m=u=>{const l=i.current;if(!l)return;const a=u.clientX-S.startX,d=u.clientY-S.startY;l.scrollLeft=S.scrollLeft-a,l.scrollTop=S.scrollTop-d,g.current&&(g.current.scrollTop=l.scrollTop),N.current&&(N.current.scrollLeft=l.scrollLeft)},c=()=>D(null);return document.addEventListener("mousemove",m),document.addEventListener("mouseup",c),()=>{document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",c)}},[S]);const k=b.useCallback(m=>{const c=i.current;if(c)if(m.preventDefault(),m.shiftKey||Math.abs(m.deltaX)>Math.abs(m.deltaY)){const u=m.shiftKey?m.deltaY:m.deltaX;c.scrollLeft+=u,N.current&&(N.current.scrollLeft=c.scrollLeft)}else c.scrollTop+=m.deltaY,g.current&&(g.current.scrollTop=c.scrollTop)},[]);return{leftBodyRef:g,rightBodyRef:i,timeHeaderRef:N,handleRightScroll:v,handleLeftScroll:I,handleChartMouseDown:C,handleChartWheel:k,panState:S,setPanState:D}}function qe(o,g,i,N){const f=new Map;return o.forEach(v=>f.set(v.id,v)),g.map(v=>{const I=f.get(v.predecessorId),T=f.get(v.successorId);if(!I||!T)return null;const S=N.get(I.id),D=N.get(T.id);if(S==null||D==null)return null;const C=I.originalType!=="step",k=T.originalType!=="step",m=C?re(I.start,i)+Ce:re(I.end,i),c=S*O+O/2,u=k?re(T.start,i)-10:re(T.start,i),l=D*O+O/2,a=14,d=Math.max(m+a,u-a),p=c===l?`M${m},${c} L${u-6},${l}`:`M${m},${c} L${d},${c} L${d},${l} L${u-6},${l}`;return{predId:I.id,succId:T.id,path:p,headX:u-6,headY:l}}).filter(Boolean)}function Je(o,g){if(o.length===0||g.length===0)return new Set;const i=new Map;o.forEach(p=>i.set(p.id,p));const N=new Set(o.map(p=>p.id)),f=g.filter(p=>N.has(p.predecessorId)&&N.has(p.successorId));if(f.length===0)return new Set;const v=new Map,I=new Map;f.forEach(p=>{v.has(p.predecessorId)||v.set(p.predecessorId,[]),v.get(p.predecessorId).push(p.successorId),I.has(p.successorId)||I.set(p.successorId,[]),I.get(p.successorId).push(p.predecessorId)});const T=p=>Math.max(1,ie(p.start,p.end)),S=new Set,D=[];function C(p){S.has(p)||(S.add(p),(v.get(p)||[]).forEach(C),D.unshift(p))}o.forEach(p=>C(p.id));const k=new Map,m=new Map;for(const p of D){const h=i.get(p),$=I.get(p)||[];let r=0;for(const B of $)r=Math.max(r,m.get(B)||0);const w=$.length>0?r:0;k.set(p,w),m.set(p,w+T(h))}let c=0;m.forEach(p=>{p>c&&(c=p)});const u=new Map,l=new Map;for(let p=D.length-1;p>=0;p--){const h=D[p],$=i.get(h),r=v.get(h)||[];let w=c;for(const B of r)w=Math.min(w,u.get(B)??c);l.set(h,r.length>0?w:c),u.set(h,(l.get(h)||0)-T($))}const a=new Set;f.forEach(p=>{a.add(p.predecessorId),a.add(p.successorId)});const d=new Set;for(const p of D){if(!a.has(p))continue;const h=(u.get(p)||0)-(k.get(p)||0);Math.abs(h)<.5&&d.add(p)}return d}function Ke({steps:o,milestones:g,events:i,notes:N,dependencies:f,viewMode:v,groupByProject:I,visibleTypes:T,collapsedGroups:S,collapsedProjects:D,selectedTaskId:C}){const k=b.useMemo(()=>{const h=[];let $=0;return o.forEach(r=>{const w=!!(r.startDate&&r.finishDate),B=r.startDate||r.previsionStartDate,A=r.finishDate||r.previsionFinishDate;if(!B||!A)return;const z=new Date(B),P=new Date(A);if(isNaN(z.getTime())||isNaN(P.getTime()))return;P<=z&&P.setDate(P.getDate()+1);let M,U;if(r.previsionStartDate&&r.previsionFinishDate){const _=new Date(r.previsionStartDate),se=new Date(r.previsionFinishDate);!isNaN(_.getTime())&&!isNaN(se.getTime())&&(M=_,U=se<=_?q(_,1):se)}const H=f?.filter(_=>_.successorId===r.id).map(_=>_.predecessorId)||[];h.push({id:r.id,name:r.name,start:z,end:P,progress:r.conclusionPercent?Number(r.conclusionPercent)*100:0,originalType:"step",deps:H,colorIdx:$%Q.length,previsionStart:M,previsionEnd:U,hasActualDates:w,projectId:r.projectId||void 0,projectTitle:r.projectTitle||void 0}),$++}),g?.forEach(r=>{if(!r.date)return;const w=new Date(r.date);if(isNaN(w.getTime()))return;const B=f?.filter(A=>A.successorId===r.id).map(A=>A.predecessorId)||[];h.push({id:r.id,name:r.name,start:w,end:w,progress:r.finished?100:0,originalType:"milestone",deps:B,projectId:r.projectId||void 0,projectTitle:r.projectTitle||void 0})}),i?.forEach(r=>{if(!r.date)return;const w=new Date(r.date);if(isNaN(w.getTime()))return;const B=f?.filter(A=>A.successorId===r.id).map(A=>A.predecessorId)||[];h.push({id:r.id,name:r.title,start:w,end:w,progress:r.finished?100:0,originalType:"event",deps:B,projectId:r.projectId||void 0,projectTitle:r.projectTitle||void 0})}),N?.forEach(r=>{if(!r.date)return;const w=new Date(r.date);isNaN(w.getTime())||h.push({id:r.id,name:r.title||"Nota",start:w,end:w,progress:0,originalType:"note",deps:[],noteCount:1,noteColor:r.color||t.note,filesCount:r.filesCount||0,noteProjectTitle:r.projectTitle||void 0,projectId:r.projectId||void 0,projectTitle:r.projectTitle||void 0})}),h},[o,g,i,N,f]),m=b.useMemo(()=>_e(k,v),[k,v]),c=b.useMemo(()=>{const h=[],$=["step","milestone","event","note"];if(I){const r=new Map;k.forEach(w=>{w.projectId&&!r.has(w.projectId)&&r.set(w.projectId,w.projectTitle||w.projectId)});for(const[w,B]of Array.from(r.entries())){const A=D.has(w);if(h.push({kind:"projectHeader",projectId:w,projectTitle:B,collapsed:A}),!A){const z=k.filter(P=>P.projectId===w);for(const P of $){if(!T.has(P))continue;const M=z.filter(_=>_.originalType===P);if(M.length===0)continue;const U=`${w}-${P}`,H=S.has(U);h.push({kind:"group",groupType:P,label:Le[P],count:M.length,collapsed:H,projectId:w}),H||M.forEach(_=>h.push({kind:"task",task:_}))}}}}else for(const r of $){if(!T.has(r))continue;const w=k.filter(A=>A.originalType===r);if(w.length===0)continue;const B=S.has(r);h.push({kind:"group",groupType:r,label:Le[r],count:w.length,collapsed:B}),B||w.forEach(A=>h.push({kind:"task",task:A}))}return h},[k,T,S,D,I]),u=b.useMemo(()=>{const h=new Map;return c.forEach(($,r)=>{$.kind==="task"&&h.set($.task.id,r)}),h},[c]),l=b.useMemo(()=>qe(k,f||[],m,u),[k,f,m,u]),a=b.useMemo(()=>Je(k,f||[]),[k,f]),d=b.useMemo(()=>{const h=new Set,$=new Date;return k.forEach(r=>{r.originalType==="step"&&r.end<$&&r.progress<100&&h.add(r.id)}),h},[k]),p=b.useMemo(()=>{if(!C||!f?.length)return new Set;const h=new Set,$=[C];for(;$.length;){const r=$.shift();for(const w of f)w.predecessorId===r&&!h.has(w.successorId)&&(h.add(w.successorId),$.push(w.successorId)),w.successorId===r&&!h.has(w.predecessorId)&&(h.add(w.predecessorId),$.push(w.predecessorId))}return h},[C,f]);return{tasks:k,timeline:m,displayRows:c,taskRowIndex:u,arrows:l,criticalIds:a,delayedIds:d,relatedIds:p}}function Ze(o){const[g,i]=b.useState("day"),[N,f]=b.useState(null),[v,I]=b.useState(null),[T,S]=b.useState(null),[D,C]=b.useState({isOpen:!1,position:{x:0,y:0},task:null}),[k,m]=b.useState(null),[c,u]=b.useState(null),[l,a]=b.useState(null),[d,p]=b.useState(null),[h,$]=b.useState("FS"),[r,w]=b.useState(0),[B,A]=b.useState(!1),[z,P]=b.useState(null),[M,U]=b.useState(null),[H,_]=b.useState(!1),se=b.useRef(null),[ge,fe]=b.useState(new Set(["step","milestone","event","note"])),[ue,be]=b.useState(new Set),[xe,ve]=b.useState(new Set),ne=b.useCallback(s=>{fe(n=>{const y=new Set(n);return y.has(s)?y.delete(s):y.add(s),y})},[]),ye=b.useCallback(s=>{be(n=>{const y=new Set(n);return y.has(s)?y.delete(s):y.add(s),y})},[]),we=b.useCallback(s=>{ve(n=>{const y=new Set(n);return y.has(s)?y.delete(s):y.add(s),y})},[]),W=Ke({steps:o.steps,milestones:o.milestones,events:o.events,notes:o.notes,dependencies:o.dependencies,viewMode:g,visibleTypes:ge,collapsedGroups:ue,collapsedProjects:xe,groupByProject:o.groupByProject,selectedTaskId:v||null}),X=Ve(W.timeline),me=b.useCallback((s,n)=>{s.preventDefault(),s.stopPropagation(),m({task:n,startMouseX:s.clientX,originalStart:new Date(n.start),originalEnd:new Date(n.end),offsetDays:0})},[]),ke=b.useCallback((s,n,y)=>{s.preventDefault(),s.stopPropagation(),u({task:n,edge:y,startMouseX:s.clientX,originalStart:new Date(n.start),originalEnd:new Date(n.end),offsetDays:0})},[]),Se=b.useCallback((s,n,y)=>{s.preventDefault(),s.stopPropagation(),a({fromTaskId:n.id,fromEdge:y,fromScreenX:s.clientX,fromScreenY:s.clientY,currentScreenX:s.clientX,currentScreenY:s.clientY,hoverTargetId:null})},[]),Ie=b.useCallback(async()=>{if(!d||!o.onCreateDependency)return;const s=new Map(W.tasks.map(Y=>[Y.id,Y])),n=s.get(d.fromTaskId),y=s.get(d.toTaskId);if(!n||!y)return;const L=Y=>Y.originalType==="step"?"STEP":"MILESTONE",j=d.fromEdge==="right"?n:y,E=d.fromEdge==="right"?y:n;A(!0);try{await o.onCreateDependency({predecessorId:j.id,predecessorType:L(j),successorId:E.id,successorType:L(E),type:h,lag:r}),p(null)}finally{A(!1)}},[d,W.tasks,o.onCreateDependency,h,r]);b.useEffect(()=>{if(!k)return;const s=y=>{const L=y.clientX-k.startMouseX,j=Math.round(L/W.timeline.dayWidth);j!==k.offsetDays&&m(E=>E?{...E,offsetDays:j}:null)},n=()=>{k.offsetDays!==0&&o.onTaskChange&&o.onTaskChange({id:k.task.id,name:k.task.name,start:q(k.originalStart,k.offsetDays),end:q(k.originalEnd,k.offsetDays),type:k.task.originalType==="step"?"task":"milestone",progress:k.task.progress}),m(null)};return document.addEventListener("mousemove",s),document.addEventListener("mouseup",n),()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",n)}},[k,W.timeline.dayWidth,o.onTaskChange]),b.useEffect(()=>{if(!c)return;const s=y=>{const L=y.clientX-c.startMouseX,j=Math.round(L/W.timeline.dayWidth);j!==c.offsetDays&&u(E=>E?{...E,offsetDays:j}:null)},n=()=>{if(c.offsetDays!==0&&o.onTaskChange){const y=c.edge==="left"?q(c.originalStart,c.offsetDays):c.originalStart,L=c.edge==="right"?q(c.originalEnd,c.offsetDays):c.originalEnd;L>y&&o.onTaskChange({id:c.task.id,name:c.task.name,start:y,end:L,type:"task",progress:c.task.progress})}u(null)};return document.addEventListener("mousemove",s),document.addEventListener("mouseup",n),()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",n)}},[c,W.timeline.dayWidth,o.onTaskChange]),b.useEffect(()=>{if(!l)return;const s=y=>{let L=null;for(const j of document.elementsFromPoint(y.clientX,y.clientY)){const E=j.dataset?.taskId;if(E&&E!==l.fromTaskId){L=E;break}}a(j=>j?{...j,currentScreenX:y.clientX,currentScreenY:y.clientY,hoverTargetId:L}:null)},n=y=>{let L=null;for(const j of document.elementsFromPoint(y.clientX,y.clientY)){const E=j.dataset?.taskId;if(E&&E!==l.fromTaskId){L=E;break}}L&&o.onCreateDependency&&(p({fromTaskId:l.fromTaskId,fromEdge:l.fromEdge,toTaskId:L}),$("FS"),w(0)),a(null)};return document.addEventListener("mousemove",s),document.addEventListener("mouseup",n),()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",n)}},[l?.fromTaskId,l?.fromEdge,o.onCreateDependency]);const[J,de]=b.useState(null),te=b.useCallback(s=>{if(c||k||s.button===2)return;const n=X.rightBodyRef.current;n&&(s.preventDefault(),de({startX:s.clientX,startY:s.clientY,scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}))},[c,k,X.rightBodyRef]);b.useEffect(()=>{if(!J)return;const s=y=>{const L=X.rightBodyRef.current;L&&(L.scrollLeft=J.scrollLeft-(y.clientX-J.startX),L.scrollTop=J.scrollTop-(y.clientY-J.startY),X.leftBodyRef.current&&(X.leftBodyRef.current.scrollTop=L.scrollTop),X.timeHeaderRef.current&&(X.timeHeaderRef.current.scrollLeft=L.scrollLeft))},n=()=>de(null);return document.addEventListener("mousemove",s),document.addEventListener("mouseup",n),()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",n)}},[J,X.rightBodyRef,X.leftBodyRef,X.timeHeaderRef]);const le=b.useCallback(s=>{s.preventDefault(),s.stopPropagation();const n=L=>{const j=X.rightBodyRef.current;if(!j)return new Date;const E=j.getBoundingClientRect(),Y=L-E.left+j.scrollLeft;return q(W.timeline.start,Math.max(0,Math.floor(Y/W.timeline.dayWidth)))},y=L=>{if(!o.groupByProject)return;const j=X.leftBodyRef.current;if(!j)return;const E=j.getBoundingClientRect(),Y=L-E.top+j.scrollTop,ae=Math.max(0,Math.floor(Y/50));for(let V=Math.min(ae,W.displayRows.length-1);V>=0;V--){const ee=W.displayRows[V];if(ee.kind==="projectHeader")return ee.projectId;if(ee.kind==="task"&&ee.task.projectId)return ee.task.projectId;if(ee.kind==="group"&&ee.projectId)return ee.projectId}};U({x:s.clientX,y:s.clientY,date:n(s.clientX),projectId:y(s.clientY)}),de(null)},[W.timeline,W.displayRows,o.groupByProject,X.rightBodyRef,X.leftBodyRef]);b.useEffect(()=>{if(!M)return;const s=L=>{L.key==="Escape"&&U(null)},n=L=>{L.target.closest('[data-menu="chart-create"]')||U(null)},y=()=>U(null);return document.addEventListener("keydown",s),document.addEventListener("click",n),window.addEventListener("scroll",y,!0),()=>{document.removeEventListener("keydown",s),document.removeEventListener("click",n),window.removeEventListener("scroll",y,!0)}},[M]);const x=b.useMemo(()=>({props:o,t:(s,n)=>o.translations?typeof o.translations=="function"?o.translations(s,n):o.translations[s]||n||"":n||"",viewMode:g,setViewMode:i,hoveredTaskId:N,setHoveredTaskId:f,selectedTaskId:v,setSelectedTaskId:I,tooltip:T,setTooltip:S,popupState:D,setPopupState:C,dragState:k,setDragState:m,resizeState:c,setResizeState:u,connectState:l,setConnectState:a,visibleTypes:ge,setVisibleTypes:fe,toggleVisibility:ne,collapsedGroups:ue,setCollapsedGroups:be,toggleGroup:ye,collapsedProjects:xe,setCollapsedProjects:ve,toggleProject:we,pendingConnection:d,setPendingConnection:p,depModalType:h,setDepModalType:$,depModalLag:r,setDepModalLag:w,depCreating:B,setDepCreating:A,deletingDepId:z,setDeletingDepId:P,chartMenu:M,setChartMenu:U,newActionOpen:H,setNewActionOpen:_,tasks:W.tasks,timeline:W.timeline,displayRows:W.displayRows,taskRowIndex:W.taskRowIndex||new Map,arrows:W.arrows,criticalIds:W.criticalIds,delayedIds:W.delayedIds,relatedIds:W.relatedIds,...X,newActionRef:se,screenXToDate:s=>{const n=X.rightBodyRef.current;if(!n)return new Date;const y=n.getBoundingClientRect(),L=s-y.left+n.scrollLeft;return q(W.timeline.start,Math.max(0,Math.floor(L/W.timeline.dayWidth)))},screenYToProjectId:s=>{if(!o.groupByProject)return;const n=X.leftBodyRef.current;if(!n)return;const y=n.getBoundingClientRect(),L=s-y.top+n.scrollTop,j=Math.max(0,Math.floor(L/50));for(let E=Math.min(j,W.displayRows.length-1);E>=0;E--){const Y=W.displayRows[E];if(Y.kind==="projectHeader")return Y.projectId;if(Y.kind==="task"&&Y.task.projectId)return Y.task.projectId;if(Y.kind==="group"&&Y.projectId)return Y.projectId}},handleChartMouseDown:te,openChartMenu:le,handleBarMouseDown:me,handleResizeMouseDown:ke,handleConnectDotMouseDown:Se,handleCreateDependency:Ie}),[o,g,N,v,T,D,k,c,l,ge,ue,xe,d,h,r,B,z,M,H,W,X,ne,ye,we,te,le,me,ke,Se,Ie]);return o.loading?e.jsx("div",{style:{padding:48,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:t.textSecondary},children:e.jsx(F.Loader2,{size:32,style:{animation:"spin 1.5s linear infinite",color:t.group}})}):e.jsx(We,{value:x,children:e.jsxs("div",{className:"w-full flex flex-col mx-auto bg-white rounded-xl shadow-[0_8px_30px_rgb(0,0,0,0.06)] overflow-hidden",style:{height:"calc(100vh - 48px)",minHeight:600,border:`1px solid ${t.borderLight}`},children:[e.jsx(Xe,{}),e.jsxs("div",{className:"flex flex-1 overflow-hidden relative",style:{background:t.surfaceAlt},children:[e.jsx(Oe,{}),e.jsx(Ue,{})]})]})})}oe.ProjectGantt=Ze,Object.defineProperty(oe,Symbol.toStringTag,{value:"Module"})}));
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "zegantt",
3
+ "private": false,
4
+ "version": "0.1.0",
5
+ "type": "module",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/josev/zegantt.git"
9
+ },
10
+ "main": "./dist/zegantt.umd.cjs",
11
+ "module": "./dist/zegantt.js",
12
+ "types": "./dist/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/zegantt.js",
17
+ "require": "./dist/zegantt.umd.cjs"
18
+ },
19
+ "./style.css": "./dist/style.css"
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "scripts": {
25
+ "dev": "vite",
26
+ "build": "tsc -b && vite build",
27
+ "lint": "eslint .",
28
+ "preview": "vite preview"
29
+ },
30
+ "peerDependencies": {
31
+ "react": "^18.0.0 || ^19.0.0",
32
+ "react-dom": "^18.0.0 || ^19.0.0"
33
+ },
34
+ "dependencies": {
35
+ "lucide-react": "^0.473.0"
36
+ },
37
+ "devDependencies": {
38
+ "@eslint/js": "^9.39.1",
39
+ "@types/node": "^24.10.1",
40
+ "@types/react": "^19.2.7",
41
+ "@types/react-dom": "^19.2.3",
42
+ "@vitejs/plugin-react": "^5.1.1",
43
+ "eslint": "^9.39.1",
44
+ "eslint-plugin-react-hooks": "^7.0.1",
45
+ "eslint-plugin-react-refresh": "^0.4.24",
46
+ "globals": "^16.5.0",
47
+ "react": "^19.2.0",
48
+ "react-dom": "^19.2.0",
49
+ "typescript": "~5.9.3",
50
+ "typescript-eslint": "^8.48.0",
51
+ "vite": "^7.3.1",
52
+ "vite-plugin-dts": "^4.5.0"
53
+ }
54
+ }