jordium-gantt-vue3 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var CE=Object.defineProperty;var EE=(A,t,e)=>t in A?CE(A,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):A[t]=e;var kr=(A,t,e)=>EE(A,typeof t!="symbol"?t+"":t,e);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue"),gc={"zh-CN":{dateNotSet:"未设置",taskName:"任务名称",predecessor:"前置任务",assignee:"分配人",startDate:"开始日期",endDate:"结束日期",estimatedHours:"预计工时(hr)",actualHours:"实际工时(hr)",progress:"进度",type:"类型",description:"描述",csvHeaders:{id:"ID",taskName:"任务名称",predecessor:"前置任务",assignee:"分配人",startDate:"开始日期",endDate:"结束日期",estimatedHours:"预计工时(hr)",actualHours:"实际工时(hr)",progress:"进度(%)",type:"类型",description:"描述"},yearMonthFormat:(A,t)=>`${A}年${String(t).padStart(2,"0")}月`,monthFormat:A=>`${A}月`,monthNames:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],weekDays:["日","一","二","三","四","五","六"],milestone:"里程碑",targetDate:"目标日期",today:"今天",milestoneDetails:"里程碑详情",milestoneName:"里程碑名称",milestoneDate:"里程碑日期",milestoneIcon:"里程碑图标",diamond:"菱形",rocket:"火箭",enterMilestoneName:"请输入里程碑名称",enterAssignee:"请输入负责人",enterDescription:"请输入描述信息",milestoneNameRequired:"里程碑名称为必填项",milestoneDateRequired:"里程碑日期为必填项",save:"保存",close:"关闭",confirm:"确认",delete:"删除",confirmDelete:"确定要删除这个里程碑吗?",addTask:"新增需求/任务",addMilestone:"新增里程碑",todayLocate:"今日",todayLocateTooltip:"定位到今天",exportCsv:"导出 CSV",exportPdf:"导出 PDF",expandAll:"全部展开",collapseAll:"全部折叠",language:"中文",languageTooltip:"选择语言",lightMode:"明亮模式",darkMode:"暗黑模式",fullscreen:"全屏",exitFullscreen:"退出全屏",githubDocs:"查看Github文档",giteeDocs:"查看Gitee文档",timeScaleHour:"时",timeScaleDay:"日",timeScaleWeek:"周",timeScaleMonth:"月",timeScaleQuarter:"季",timeScaleYear:"年",timeScaleTooltip:"切换时间刻度",halfYearFirst:"上半年",halfYearSecond:"下半年",confirmDialogMessage:"是否需要保留该设置?",newTask:"新建任务",taskNamePlaceholder:"请输入任务名称",assigneePlaceholder:"请输入负责人",progressPlaceholder:"0-100",hoursPlaceholder:"工时",descriptionPlaceholder:"请输入任务描述...",hours:"小时",create:"创建",taskNameRequired:"任务名称不能为空",startDateRequired:"开始日期不能为空",endDateRequired:"结束日期不能为空",endDateInvalid:"结束日期不能早于开始日期",newMilestone:"新建里程碑",editMilestone:"编辑里程碑",cancel:"取消",startTimer:"开始计时",stopTimer:"停止计时",timerStarted:"任务计时已开始",timerStopped:"任务计时已停止",addPredecessor:"添加前置任务",addSuccessor:"添加后置任务",pdfExportLoading:"正在生成PDF,请稍候...",pdfExportTitle:"甘特图导出",pdfExportDate:"导出日期",milestoneGroup:"里程碑",collapseTaskList:"收起任务列表",expandTaskList:"展开任务列表",taskType:"任务类型",taskTypeRequired:"请选择任务类型",taskTypeMap:{task:"任务",milestone:"里程碑",story:"需求",epic:"史诗",bug:"缺陷"},editTask:"编辑任务",parentTask:"上级任务",time:"时间",selectTime:"选择时间",hour:"时",minute:"分",noParentTask:"无上级任务",update:"更新",taskNameTooLong:"任务名称不能超过50个字符",predecessorPlaceholder:"请选择前置任务",selectPredecessor:"选择前置任务",removePredecessor:"移除前置任务",deleteLinks:"删除链接",noLinks:"无链接",predecessorLink:"前置: {name}",successorLink:"后置: {name}",operationFailed:"操作失败,请重试",taskUpdateSuccess:"任务更新成功",taskCreateSuccess:"任务创建成功",confirmDeleteTask:'确定要删除任务"{name}"吗?此操作不可撤销。',taskDeleteFailed:"删除失败,请重试",confirmDeleteStory:"是否删除该需求{name}及其所有的子任务?该操作不可撤回",storyDeleteYes:"是, 继续",storyDeleteNo:"不,仅删除需求",storyDeleteAllSuccess:"已删除需求【{name}】及其所有子任务",storyDeleteOnlySuccess:"已删除需求【{name}】,{count}个子任务已升级保留",storyNotFound:"未找到要删除的需求,ID:{id}",milestoneDeleteSuccess:"里程碑删除成功",taskDeletedSuccess:"已删除任务",selectAssignee:"请选择负责人",customCsvExportCalled:"自定义CSV导出被调用",languageSwitchedTo:"语言切换到:{language}",themeSwitchedTo:"主题切换到:{theme}",lightModeText:"明亮模式",darkModeText:"暗黑模式",taskNotFound:"未找到要更新的任务,ID:{id}",newParentTaskNotFound:"未找到新父任务,ID:{parentId},将作为顶级任务添加",inPlaceUpdateFailed:"就地更新失败,未找到任务,ID:{id}",taskToDeleteNotFound:"未找到要删除的任务,ID:{id}",milestoneIconUpdateNotFound:"未找到要更新图标的里程碑,ID:{id}",overtime:"超",overdue:"逾期",days:"天",timerConfirmPrefix:"即将为任务",timerConfirmSuffix:"计时,若有特殊说明请完善下面的描述",timerConfirmPlaceholder:"请输入计时说明",configDemo:"配置演示",taskListConfig:{title:"TaskList 配置",columns:{title:"列显示(默认渲染模式下生效)",renderMode:"渲染模式",renderModeDefault:"默认(通过 TaskListColumnConfig 设置)",renderModeDeclarative:"声明式(使用 TaskListColumn 设置可见列)"},width:{title:"宽度设置",defaultWidth:"默认宽度",minWidth:"最小宽度",maxWidth:"最大宽度",pixelsModel:"像素 (px)",percentageModel:"百分比 (%)"}},taskBarConfig:{title:"TaskBar 配置",display:{title:"显示选项",showAvatar:"显示头像 (Avatar)",showTitle:"显示标题 (Title)",showProgress:"显示进度 (Progress)"},mistouch:{title:"防误触配置",dragThreshold:"拖拽阈值 (px)",dragThresholdHint:"移动超过此距离才触发拖拽",resizeHandleWidth:"拉伸手柄宽度 (px)",resizeHandleWidthHint:"调整手柄的可点击宽度 (5-15px)",enableDragDelay:"启用拖拽延迟",enableDragDelayHint:"按住一段时间后才能拖拽",dragDelayTime:"延迟时间 (ms)",dragDelayTimeHint:"延迟启动拖拽的时间",allowDragOnClick:"允许拖拽和拉伸 TaskBar 和 Milestone",allowDragOnClickHint:"控制是否允许拖拽 TaskBar 和 Milestone,以及拉伸 TaskBar 的长度"}},disableTaskbarFocusMode:"关闭聚焦功能",dataSourceAlreadyLoaded:"{name} 已是当前数据源",dataSourceLoadSuccess:"已加载 {name}",dataSourceLoadFailed:"{name} 加载失败",dataSourceSwitch:{title:"数据源切换",subtitle:"对比常规与超大数据集的初始化体验",loading:"数据加载中,请稍候...",alreadyLoaded:"{name} 已是当前数据源",loadSuccess:"已加载 {name}",loadFailed:"{name} 加载失败",sources:{normal:{label:"常规数据源",description:"data.json · 含完整前/后置依赖,适合功能演示",badge:"data.json"},large:{label:"超大数据源",description:"data-large-1m.json · 百万级任务,验证虚拟渲染性能",badge:"data-large-1m.json"}}}},"en-US":{dateNotSet:"Not set",taskName:"Task Name",predecessor:"Predecessor",assignee:"Assignee",startDate:"Start Date",endDate:"End Date",estimatedHours:"Est. Hours",actualHours:"Act. Hours",progress:"Progress",type:"Type",csvHeaders:{id:"ID",taskName:"Task Name",predecessor:"Predecessor",assignee:"Assignee",startDate:"Start Date",endDate:"End Date",estimatedHours:"Est. Hours",actualHours:"Act. Hours",progress:"Progress (%)",type:"Type",description:"Description"},yearMonthFormat:(A,t)=>`${A}/${String(t).padStart(2,"0")}`,monthFormat:A=>`${String(A).padStart(2,"0")}`,monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],milestone:"Milestone",today:"Today",targetDate:"Target Date",milestoneDetails:"Milestone Details",milestoneName:"Milestone Name",milestoneDate:"Milestone Date",milestoneIcon:"Milestone Icon",diamond:"Diamond",rocket:"Rocket",enterMilestoneName:"Enter milestone name",enterAssignee:"Enter assignee",enterDescription:"Enter description",milestoneNameRequired:"Milestone name is required",milestoneDateRequired:"Milestone date is required",save:"Save",close:"Close",confirm:"Confirm",description:"Description",delete:"Delete",confirmDelete:"Are you sure you want to delete this milestone?",addTask:"Add Requirement/Task",addMilestone:"Add Milestone",todayLocate:"Today",todayLocateTooltip:"Locate to today",exportCsv:"Export CSV",exportPdf:"Export PDF",expandAll:"Expand All",collapseAll:"Collapse All",language:"English",languageTooltip:"Select language",lightMode:"Light Mode",darkMode:"Dark Mode",fullscreen:"Fullscreen",exitFullscreen:"Exit Fullscreen",githubDocs:"GitHub Docs",giteeDocs:"Gitee Docs",timeScaleHour:"Hour",timeScaleDay:"Day",timeScaleWeek:"Week",timeScaleMonth:"Month",timeScaleQuarter:"Quarter",timeScaleYear:"Year",timeScaleTooltip:"Switch Time Scale",halfYearFirst:"First Half",halfYearSecond:"Second Half",confirmDialogMessage:"Do you want to save this setting?",taskNamePlaceholder:"Enter task name",assigneePlaceholder:"Enter assignee",progressPlaceholder:"0-100",hoursPlaceholder:"Hours",descriptionPlaceholder:"Enter task description...",hours:"Hours",create:"Create",taskNameRequired:"Task name is required",startDateRequired:"Start date is required",endDateRequired:"End date is required",endDateInvalid:"End date cannot be earlier than start date",newMilestone:"New Milestone",editMilestone:"Edit Milestone",cancel:"Cancel",timerStarted:"Timer Started",timerStopped:"Timer Stopped",startTimer:"Start Timer",stopTimer:"Stop Timer",addPredecessor:"Add Predecessor",addSuccessor:"Add Successor",pdfExportLoading:"Generating PDF, please wait...",pdfExportTitle:"Gantt Chart Export",pdfExportDate:"Export Date",milestoneGroup:"Milestone",collapseTaskList:"Collapse Task List",expandTaskList:"Expand Task List",taskType:"Task Type",taskTypeRequired:"Please select task type",taskTypeMap:{task:"Task",milestone:"Milestone",story:"Story",epic:"Epic",bug:"Bug"},editTask:"Edit Task",newTask:"New Task",parentTask:"Parent Task",time:"Time",selectTime:"Select Time",hour:"Hour",minute:"Minute",noParentTask:"No Parent Task",update:"Update",taskNameTooLong:"Task name cannot exceed 50 characters",predecessorPlaceholder:"Select predecessor",selectPredecessor:"Select Predecessor",removePredecessor:"Remove Predecessor",deleteLinks:"Delete Links",noLinks:"No Links",predecessorLink:"Predecessor: {name}",successorLink:"Successor: {name}",operationFailed:"Operation failed, please try again",taskUpdateSuccess:"Task updated successfully",taskCreateSuccess:"Task created successfully",confirmDeleteTask:'Are you sure you want to delete task "{name}"? This action cannot be undone.',taskDeleteFailed:"Delete failed, please try again",confirmDeleteStory:"Do you want to delete the requirement {name} and all its subtasks? This action cannot be undone",storyDeleteYes:"Yes, Continue",storyDeleteNo:"No, Delete Requirement Only",storyDeleteAllSuccess:"Deleted requirement [{name}] and all its subtasks",storyDeleteOnlySuccess:"Deleted requirement [{name}], {count} subtasks have been promoted",storyNotFound:"Requirement not found, ID: {id}",milestoneDeleteSuccess:"Milestone deleted successfully",taskDeletedSuccess:"Task deleted",selectAssignee:"Select assignee",customCsvExportCalled:"Custom CSV export called",languageSwitchedTo:"Language switched to: {language}",themeSwitchedTo:"Theme switched to: {theme}",lightModeText:"Light Mode",darkModeText:"Dark Mode",taskNotFound:"Task not found for update, ID: {id}",newParentTaskNotFound:"New parent task not found, ID: {parentId}, will be added as top-level task",inPlaceUpdateFailed:"In-place update failed, task not found, ID: {id}",taskToDeleteNotFound:"Task to delete not found, ID: {id}",milestoneIconUpdateNotFound:"Milestone not found for icon update, ID: {id}",overtime:"Over",overdue:"Overdue",days:" days",timerConfirmPrefix:"About to start timing for",timerConfirmSuffix:". If there are special notes, please complete the description below.",timerConfirmPlaceholder:"Please enter timer description",configDemo:"Configuration Demo",taskListConfig:{title:"TaskList Configuration",columns:{title:"Columns(默effective in default render mode)",renderMode:"Render Mode",renderModeDefault:"Default (via TaskListColumnConfig)",renderModeDeclarative:"Declarative (via TaskListColumn)"},width:{title:"Width Settings",defaultWidth:"Default Width",minWidth:"Min Width",maxWidth:"Max Width",pixelsModel:"pixels (px)",percentageModel:"percentage (%)"}},taskBarConfig:{title:"TaskBar Configuration",display:{title:"Display Options",showAvatar:"Show Avatar",showTitle:"Show Title",showProgress:"Show Progress"},mistouch:{title:"Mistouch Prevention",dragThreshold:"Drag Threshold (px)",dragThresholdHint:"Distance to trigger dragging",resizeHandleWidth:"Resize Handle Width (px)",resizeHandleWidthHint:"Clickable width of resize handle (5-15px)",enableDragDelay:"Enable Drag Delay",enableDragDelayHint:"Hold to drag after a delay",dragDelayTime:"Delay Time (ms)",dragDelayTimeHint:"Delay time before dragging starts",allowDragOnClick:"Allow dragging and resizing of TaskBars and Milestones",allowDragOnClickHint:"Controls whether to allow dragging of TaskBars and Milestones, as well as resizing the length of TaskBars"}},disableTaskbarFocusMode:"Disable Focus Mode",dataSourceAlreadyLoaded:"{name} is already active",dataSourceLoadSuccess:"{name} loaded successfully",dataSourceLoadFailed:"{name} failed to load",dataSourceSwitch:{title:"Data Sources",subtitle:"Compare default vs. mega dataset initialization",loading:"Loading data, please wait…",alreadyLoaded:"{name} is already active",loadSuccess:"{name} loaded successfully",loadFailed:"{name} failed to load",sources:{normal:{label:"Standard Dataset",description:"data.json · Full predecessor graph for feature demos",badge:"data.json"},large:{label:"Massive Dataset",description:"data-large-1m.json · Million-level tasks to stress virtual rendering",badge:"data-large-1m.json"}}}}};function Vv(A,t){gc[A]&&(gc[A]={...gc[A],...t},pc.value===A&&window.dispatchEvent(new CustomEvent("locale-changed",{detail:{locale:A}})))}const FE="gantt-locale",kE=()=>{if(typeof window<"u"){const A=localStorage.getItem(FE);if(A&&(A==="zh-CN"||A==="en-US"))return A}return"zh-CN"},pc=i.ref(kE());function ga(){const A=i.computed(()=>gc[pc.value]),t=s=>{const l=A.value[s];return typeof l=="string"?l:s},e=(s,l)=>{let c=t(s);return Object.keys(l).forEach(u=>{c=c.replace(new RegExp(`{${u}}`,"g"),String(l[u]))}),c},r=s=>{pc.value=s,window.dispatchEvent(new CustomEvent("locale-changed",{detail:{locale:s}}))},n=i.computed(()=>pc.value);return{t:A,getTranslation:t,formatTranslation:e,locale:n,setLocale:r,formatYearMonth:(s,l)=>A.value.yearMonthFormat(s,l),formatMonth:s=>A.value.monthFormat(s)}}function xE(A){if(!A)return null;const[t,e,r]=A.split("-").map(Number);return new Date(t,e-1,r)}function la(A){return A?Array.isArray(A)&&typeof A[0]=="number"?A:Array.isArray(A)?A.filter(t=>t&&t.toString().trim()).map(t=>Number(t.toString().trim())).filter(t=>!isNaN(t)):A.split(",").map(t=>t.trim()).filter(t=>t).map(t=>Number(t)).filter(t=>!isNaN(t)):[]}function pg(A){const t=la(A);return t.length>0?t.join(", "):"-"}const SE={class:"confirm-timer-dialog-overlay"},TE={class:"confirm-timer-dialog"},UE={class:"dialog-message"},DE={class:"task-name-highlight"},QE=["placeholder"],LE={class:"dialog-actions"},IE=i.defineComponent({__name:"ConfirmTimerDialog",props:{visible:Boolean,title:{type:String,default:"确认开始计时"},message:{type:String,default:""},defaultDesc:{type:String,default:""},placeholder:{type:String,default:"请输入计时说明"}},emits:["confirm","cancel"],setup(A,{emit:t}){const e=A,r=t,{getTranslation:n}=ga(),a=i.ref(e.defaultDesc);i.watch(()=>e.visible,l=>{l&&(a.value=e.defaultDesc)});const o=()=>r("confirm",a.value),s=i.computed(()=>{if(e.message){const l=e.message.match(/任务([\S\s]+?)计时|Task ([\S\s]+?) timing/);if(l&&(l[1]||l[2]))return l[1]||l[2]}return e.defaultDesc});return(l,c)=>(i.openBlock(),i.createElementBlock("div",SE,[i.createElementVNode("div",TE,[i.createElementVNode("div",UE,[i.createElementVNode("span",null,i.toDisplayString(i.unref(n)("timerConfirmPrefix")),1),i.createElementVNode("span",DE,i.toDisplayString(s.value),1),i.createElementVNode("span",null,i.toDisplayString(i.unref(n)("timerConfirmSuffix")),1)]),i.withDirectives(i.createElementVNode("textarea",{"onUpdate:modelValue":c[0]||(c[0]=u=>a.value=u),class:"dialog-textarea",placeholder:i.unref(n)("timerConfirmPlaceholder"),rows:"3"},null,8,QE),[[i.vModelText,a.value]]),i.createElementVNode("div",LE,[i.createElementVNode("button",{class:"gantt-btn gantt-btn-default",onClick:c[1]||(c[1]=u=>l.$emit("cancel"))},i.toDisplayString(i.unref(n)("cancel")),1),i.createElementVNode("button",{class:"gantt-btn gantt-btn-confirm",onClick:o},i.toDisplayString(i.unref(n)("startTimer")),1)])])]))}}),sn=(A,t)=>{const e=A.__vccOpts||A;for(const[r,n]of t)e[r]=n;return e},ry=sn(IE,[["__scopeId","data-v-c362ca3d"]]),NE={class:"gantt-confirm-header"},_E={class:"gantt-confirm-title"},ME={class:"gantt-confirm-content"},OE={class:"gantt-confirm-footer"},RE={class:"gantt-confirm-footer-right"},HE=i.defineComponent({__name:"GanttConfirmDialog",props:{visible:Boolean,title:{type:String,default:"确认"},message:{type:String,default:""},confirmText:{type:String,default:"确认"},cancelText:{type:String,default:"取消"},yesText:{type:String,default:"是"},noText:{type:String,default:"否"},type:{type:String,default:"confirm-cancel"}},emits:["confirm","cancel","yes","no"],setup(A,{emit:t}){const e=A,r=t,n=()=>r("confirm"),a=()=>r("cancel"),o=()=>r("yes"),s=()=>r("no");return(l,c)=>A.visible?(i.openBlock(),i.createElementBlock("div",{key:0,class:"gantt-confirm-overlay",onClick:a},[i.createElementVNode("div",{class:"gantt-confirm-dialog",onClick:c[0]||(c[0]=i.withModifiers(()=>{},["stop"]))},[i.createElementVNode("div",NE,[i.createElementVNode("h4",_E,i.toDisplayString(e.title),1)]),i.createElementVNode("div",ME,[i.createElementVNode("p",null,i.toDisplayString(e.message),1)]),i.createElementVNode("div",OE,[e.type==="yes-no-cancel"?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createElementVNode("button",{type:"button",class:"gantt-btn gantt-btn-default",onClick:a},i.toDisplayString(e.cancelText),1),i.createElementVNode("div",RE,[i.createElementVNode("button",{type:"button",class:"gantt-btn gantt-btn-warning",onClick:s},i.toDisplayString(e.noText),1),i.createElementVNode("button",{type:"button",class:"gantt-btn gantt-btn-danger",onClick:o},i.toDisplayString(e.yesText),1)])],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createElementVNode("button",{type:"button",class:"gantt-btn gantt-btn-default",onClick:a},i.toDisplayString(e.cancelText),1),c[1]||(c[1]=i.createTextVNode(" ")),i.createElementVNode("button",{type:"button",class:"gantt-btn gantt-btn-danger",onClick:n},i.toDisplayString(e.confirmText),1)],64))])])])):i.createCommentVNode("",!0)}}),gp=sn(HE,[["__scopeId","data-v-4a27f0b2"]]),PE={class:"icon-wrapper"},VE=["onClick"],KE=["innerHTML"],qE=i.defineComponent({__name:"TaskContextMenu",props:{visible:{type:Boolean},position:{},task:{},allTasks:{}},emits:["start-timer","stop-timer","add-predecessor","add-successor","delete","delete-link","close"],setup(A,{emit:t}){const e=A,r=t,{t:n}=ga(),a=i.ref(null),o=i.ref({x:0,y:0}),s=i.ref({display:"none",left:"50%",top:"-8px",transform:"rotate(0deg)"}),l=i.ref(!1),c=i.ref(""),u=i.ref(!1),g=i.computed(()=>{var X;return((X=e.task)==null?void 0:X.type)==="story"?"yes-no-cancel":"confirm-cancel"}),p=i.computed(()=>{var X,re,se;return((X=e.task)==null?void 0:X.type)==="story"?n.value.confirmDeleteStory.replace("{name}",((re=e.task)==null?void 0:re.name)||""):n.value.confirmDeleteTask.replace("{name}",((se=e.task)==null?void 0:se.name)||"")});function f(){var X;c.value=((X=e.task)==null?void 0:X.name)||"",l.value=!0}function v(){l.value=!1}function w(X){if(l.value=!1,e.task&&typeof e.task=="object"){r("close");const re=Date.now();Object.assign(e.task,{timerStartDesc:X||"",isTimerRunning:!0,timerStartTime:re,timerElapsedTime:0}),r("start-timer",e.task)}}function b(){u.value=!0}const B=()=>{u.value=!1,e.task&&(r("delete",e.task),r("close"))},F=()=>{u.value=!1},E=()=>{u.value=!1,e.task&&(r("delete",e.task,!0),R())},k=()=>{u.value=!1,e.task&&(r("delete",e.task,!1),R())},P=i.computed(()=>{var X;return((X=e.task)==null?void 0:X.type)!=="story"}),j=i.ref(!1);let M=null;const O=i.computed(()=>{const X=[];if(!e.task||!e.allTasks)return X;if(e.task.predecessor){const re=la(e.task.predecessor);for(const se of re){const x=e.allTasks.find(I=>I.id===se);x&&X.push({type:"predecessor",taskId:se,taskName:x.name||`任务 ${se}`})}}for(const re of e.allTasks)re.predecessor&&re.id!==e.task.id&&la(re.predecessor).includes(e.task.id)&&X.push({type:"successor",taskId:re.id,taskName:re.name||`任务 ${re.id}`});return X}),L=i.computed(()=>O.value.length>0);i.watch([()=>e.visible,()=>e.position],([X,re])=>{X&&re&&i.nextTick(()=>{if(a.value){const se=window.innerWidth,x=window.innerHeight,I=a.value.offsetWidth,W=a.value.offsetHeight;let z=re.x-I/2,Ae=re.y+10,he="50%",fe="-8px",ce="rotate(0deg)";if(z+I>se){const Fe=z+I-se+5;z-=Fe,he=`calc(50% + ${Fe}px)`}if(z<5){const Fe=5-z;z=5,he=`calc(50% - ${Fe}px)`}Ae+W>x&&(Ae=re.y-W-10,fe="100%",ce="rotate(180deg)"),o.value={x:z,y:Ae},s.value={display:"block",left:he,top:fe,transform:ce}}})},{immediate:!0,deep:!0});const R=()=>{r("close")},S=()=>{var X;(X=e.task)!=null&&X.isTimerRunning?(r("close"),Object.assign(e.task,{isTimerRunning:!1,timerEndTime:Date.now(),timerElapsedTime:(e.task.timerElapsedTime||0)+(Date.now()-(e.task.timerStartTime||Date.now()))}),r("stop-timer",e.task)):f()},T=()=>{e.task&&(r("close"),i.nextTick(()=>{r("add-predecessor",e.task)}))},G=()=>{e.task&&(r("close"),i.nextTick(()=>{r("add-successor",e.task)}))},N=X=>{M&&(clearTimeout(M),M=null),j.value=!1,r("delete-link",{sourceTaskId:X.type==="predecessor"?X.taskId:e.task.id,targetTaskId:X.type==="predecessor"?e.task.id:X.taskId}),r("close")},oe=()=>{M&&(clearTimeout(M),M=null),j.value=!0},le=()=>{M=window.setTimeout(()=>{j.value=!1},200)},Z=X=>{a.value&&!a.value.contains(X.target)&&R()},ee=X=>{X.key==="Escape"&&R()};return i.onMounted(()=>{document.addEventListener("mousedown",Z),document.addEventListener("keydown",ee)}),i.onUnmounted(()=>{document.removeEventListener("mousedown",Z),document.removeEventListener("keydown",ee),M&&clearTimeout(M)}),(X,re)=>{var se,x,I,W;return i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[X.visible?(i.openBlock(),i.createElementBlock("div",{key:0,ref_key:"menuRef",ref:a,class:"task-context-menu",style:i.normalizeStyle({left:`${o.value.x}px`,top:`${o.value.y}px`,zIndex:1e4,position:"fixed"})},[i.createElementVNode("div",{class:"menu-arrow",style:i.normalizeStyle({display:s.value.display,left:s.value.left,top:s.value.top,transform:s.value.transform})},null,4),P.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"menu-item",onClick:S},[i.createElementVNode("div",PE,[i.createElementVNode("i",{class:i.normalizeClass(["menu-icon",(se=e.task)!=null&&se.isTimerRunning?"stop-icon":"timer-icon"])},null,2)]),i.createTextVNode(" "+i.toDisplayString((x=e.task)!=null&&x.isTimerRunning?i.unref(n).stopTimer:i.unref(n).startTimer),1)])):i.createCommentVNode("",!0),i.createElementVNode("div",{class:"menu-item",onClick:T},[re[0]||(re[0]=i.createElementVNode("div",{class:"icon-wrapper"},[i.createElementVNode("i",{class:"menu-icon predecessor-icon"})],-1)),i.createTextVNode(" "+i.toDisplayString(i.unref(n).addPredecessor),1)]),i.createElementVNode("div",{class:"menu-item",onClick:G},[re[1]||(re[1]=i.createElementVNode("div",{class:"icon-wrapper"},[i.createElementVNode("i",{class:"menu-icon successor-icon"})],-1)),i.createTextVNode(" "+i.toDisplayString(i.unref(n).addSuccessor),1)]),L.value?(i.openBlock(),i.createElementBlock("div",{key:1,class:"menu-item menu-item-with-submenu",onMouseenter:oe,onMouseleave:le},[re[2]||(re[2]=i.createElementVNode("div",{class:"icon-wrapper"},[i.createElementVNode("i",{class:"menu-icon link-delete-icon"})],-1)),i.createTextVNode(" "+i.toDisplayString(i.unref(n).deleteLinks)+" ",1),re[3]||(re[3]=i.createElementVNode("i",{class:"submenu-arrow"},"›",-1)),j.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"submenu",onMouseenter:oe,onMouseleave:le},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(O.value,z=>(i.openBlock(),i.createElementBlock("div",{key:`${z.type}-${z.taskId}`,class:"menu-item submenu-item",onClick:i.withModifiers(Ae=>N(z),["stop"])},[i.createElementVNode("span",{innerHTML:z.type==="predecessor"?i.unref(n).predecessorLink.replace("{name}",z.taskName):i.unref(n).successorLink.replace("{name}",z.taskName)},null,8,KE)],8,VE))),128))],32)):i.createCommentVNode("",!0)],32)):i.createCommentVNode("",!0),re[5]||(re[5]=i.createElementVNode("div",{class:"menu-divider"},null,-1)),i.createElementVNode("div",{class:"menu-item menu-item-danger",onClick:b},[re[4]||(re[4]=i.createElementVNode("div",{class:"icon-wrapper"},[i.createElementVNode("i",{class:"menu-icon delete-icon"})],-1)),i.createTextVNode(" "+i.toDisplayString(i.unref(n).delete),1)]),i.createVNode(gp,{visible:u.value,title:i.unref(n).delete,type:g.value,message:p.value,"confirm-text":i.unref(n).confirm,"cancel-text":i.unref(n).cancel,"yes-text":i.unref(n).storyDeleteYes,"no-text":i.unref(n).storyDeleteNo,onConfirm:B,onYes:E,onNo:k,onCancel:F},null,8,["visible","title","type","message","confirm-text","cancel-text","yes-text","no-text"]),l.value?(i.openBlock(),i.createBlock(ry,{key:2,visible:l.value,title:"确认开始计时",message:`即将为任务${(I=e.task)==null?void 0:I.name}计时,若有特殊说明请完善下面的描述`,"default-desc":((W=e.task)==null?void 0:W.name)||"",onConfirm:w,onCancel:v},null,8,["visible","message","default-desc"])):i.createCommentVNode("",!0)],4)):i.createCommentVNode("",!0)])}}}),Ay=sn(qE,[["__scopeId","data-v-604bf4d7"]]),jE=["data-task-id"],WE={width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},GE={key:0,points:"9,18 15,12 9,6"},YE={key:1,points:"18,15 12,9 6,15"},zE={key:1,class:"milestone-spacer"},$E={key:2,class:"leaf-spacer"},XE={width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},JE={key:0,points:"9,18 15,12 9,6"},ZE={key:1,points:"18,15 12,9 6,15"},e4={key:1,class:"milestone-spacer"},t4={key:2,class:"leaf-spacer"},r4={key:0,class:"task-icon"},A4={key:0,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:"milestone-group-icon"},n4={key:1,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},a4={key:2,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},i4=["title"],s4={key:0,class:"timer-dot"},o4={key:1,class:"status-badge overtime"},l4={key:2,class:"status-badge overdue"},c4={key:0,class:"task-icon"},u4={key:0,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:"milestone-group-icon"},f4={key:1,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},d4={key:2,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},h4=["title"],g4={key:0,class:"timer-dot"},p4={key:1,class:"status-badge overtime"},v4={key:2,class:"status-badge overdue"},m4={key:0,class:"milestone-empty-col"},w4={key:3,class:"assignee-info"},B4={class:"avatar"},y4={class:"assignee-name"},b4=10,C4=i.defineComponent({__name:"TaskRow",props:{task:{},level:{},rowIndex:{},isHovered:{type:Boolean},hoveredTaskId:{},onHover:{},columns:{},declarativeColumns:{},renderMode:{default:"default"},getColumnWidthStyle:{},disableChildrenRender:{type:Boolean},showTaskIcon:{type:Boolean},enableDrag:{type:Boolean},dragStart:{},dragOver:{},taskListRowClassName:{},taskListRowStyle:{type:[Boolean,null,String,Object,Array,Function]}},emits:["toggle","dblclick","contextmenu","start-timer","stop-timer","add-predecessor","add-successor","delete"],setup(A,{emit:t}){const e=A,r=t,{t:n}=ga(),a=i.computed(()=>{var Q;return((Q=n.value)==null?void 0:Q.overtime)??""}),o=i.computed(()=>{var Q;return((Q=n.value)==null?void 0:Q.overdue)??""}),s=i.computed(()=>{var Q;return((Q=n.value)==null?void 0:Q.days)??""}),l=i.useSlots(),c=i.computed(()=>!!l["custom-task-content"]),u=i.inject("gantt-column-slots",{}),g=Q=>{const De=`column-${Q}`;return!!u[De]},p=(Q,De)=>{const pe=`column-${Q}`,ge=u[pe];return ge?ge(De):null},f=i.computed(()=>e.renderMode==="declarative"&&e.declarativeColumns?e.declarativeColumns:e.columns),v=Q=>Q===0,w=Q=>({justifyContent:Q.align==="center"?"center":Q.align==="right"?"flex-end":"flex-start",textAlign:Q.align||"left"}),b=(Q,De)=>{if(v(De)){const pe=Q.prop?e.task[Q.prop]:e.task.name;return Q.defaultSlot?i.h("div",{class:"task-name-content"},[i.h("span",{class:["task-name-text",{"parent-task":j.value}],title:pe},[Q.defaultSlot({row:e.task,$index:De})])]):i.h("div",{class:"task-name-content"},[e.showTaskIcon!==!1?i.h("span",{class:"task-icon"},k.value?i.h("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,class:"milestone-group-icon"},i.h("polygon",{points:"12,2 22,12 12,22 2,12"})):E.value||F.value?i.h("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2},i.h("path",{d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-5l-2-2H5a2 2 0 00-2 2z"})):i.h("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2},[i.h("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),i.h("polyline",{points:"14,2 14,8 20,8"}),i.h("line",{x1:16,y1:13,x2:8,y2:13}),i.h("line",{x1:16,y1:17,x2:8,y2:17}),i.h("polyline",{points:"10,9 9,9 8,9"})])):null,i.h("span",{class:["task-name-text",{"parent-task":j.value}],title:pe},pe||"-")])}if(Q.defaultSlot)return Q.defaultSlot({row:e.task,$index:De});if(Q.prop){const pe=e.task[Q.prop];return pe??"-"}return"-"},B=i.computed(()=>`${b4+e.level*20}px`),F=i.computed(()=>!!(e.task.children&&e.task.children.length>0)),E=i.computed(()=>e.task.type==="story"),k=i.computed(()=>e.task.type==="milestone-group"),P=i.computed(()=>e.task.type==="milestone"),j=i.computed(()=>E.value||F.value||k.value),M=i.computed(()=>e.taskListRowClassName?typeof e.taskListRowClassName=="function"?e.taskListRowClassName(e.task,e.rowIndex??0):e.taskListRowClassName:""),O=i.computed(()=>e.taskListRowStyle?typeof e.taskListRowStyle=="function"?e.taskListRowStyle(e.task,e.rowIndex??0):e.taskListRowStyle:{});function L(){r("toggle",e.task)}function R(){(E.value||F.value)&&!k.value&&r("toggle",e.task)}const S=Q=>{Q.stopPropagation(),r("dblclick",e.task)},T=()=>{Z.value||e.onHover&&e.onHover(e.task.id)},G=()=>{Z.value||e.onHover&&e.onHover(null)};function N(){const Q=e.task.progress||0,De=new Date,pe=e.task.endDate?new Date(e.task.endDate):null;return pe&&De>pe&&Q<100?"progress-danger":Q>=100?"progress-success":Q>0?"progress-warning":""}function oe(){return e.task.actualHours&&e.task.estimatedHours&&e.task.actualHours>e.task.estimatedHours}function le(){const Q=new Date,De=e.task.endDate?new Date(e.task.endDate):null,pe=e.task.progress||0;if(De&&Q>De&&pe<100){const ge=new Date(Q.getFullYear(),Q.getMonth(),Q.getDate()),Ee=new Date(De.getFullYear(),De.getMonth(),De.getDate());return Math.floor((ge.getTime()-Ee.getTime())/(1e3*60*60*24))}return 0}const Z=i.ref(!1),ee=()=>{Z.value=!0},X=()=>{Z.value=!1},re=i.ref(0),se=i.ref(null),x=i.computed(()=>{const Q=Math.floor(re.value/1e3),De=Math.floor(Q/3600),pe=Math.floor(Q%3600/60),ge=Q%60;return`${String(De).padStart(2,"0")}:${String(pe).padStart(2,"0")}:${String(ge).padStart(2,"0")}`}),I=()=>{if(e.task.isTimerRunning&&e.task.timerStartTime){const Q=e.task.timerElapsedTime||0;re.value=Date.now()-e.task.timerStartTime+Q}else e.task.timerElapsedTime?re.value=e.task.timerElapsedTime:re.value=0};i.watch(()=>[e.task.isTimerRunning,e.task.timerStartTime,e.task.timerElapsedTime],()=>{se.value&&(clearInterval(se.value),se.value=null),e.task.isTimerRunning?(I(),se.value=window.setInterval(I,1e3)):I()},{immediate:!0});const W=i.ref(!1),z=i.ref({x:0,y:0}),Ae=i.computed(()=>e.task);function he(Q){if(window.dispatchEvent(new CustomEvent("close-all-taskbar-menus")),e.task.type!=="task"&&e.task.type!=="story"){Q.preventDefault(),W.value=!1;return}Q.preventDefault(),W.value=!0,z.value={x:Q.clientX,y:Q.clientY}}function fe(){W.value=!1}const ce=(Q,De)=>{r("delete",Q,De),fe()},Fe=i.computed(()=>N()),Pe=i.computed(()=>({isRowContent:!0,task:e.task,level:e.level,indent:B.value,isHovered:e.isHovered??!1,hoveredTaskId:e.hoveredTaskId??null,isParent:j.value,hasChildren:F.value,collapsed:!!e.task.collapsed,formattedTimer:x.value,timerRunning:!!e.task.isTimerRunning,timerElapsed:re.value,isOvertime:oe(),overdueDays:le(),overtimeText:a.value,overdueText:o.value,daysText:s.value,progressClass:Fe.value})),Ze=i.ref(null),tt=Q=>{if(!e.enableDrag)return;const De=Q.target;De.tagName==="BUTTON"||De.tagName==="INPUT"||De.tagName==="SELECT"||De.tagName==="TEXTAREA"||De.closest(".collapse-btn")||De.closest(".task-context-menu")||Ze.value&&e.dragStart&&e.dragStart(e.task,Ze.value,Q)},lt=Q=>{if(!e.enableDrag||!Ze.value||!e.dragOver)return;const{taskId:De,event:pe}=Q.detail;De===e.task.id&&e.dragOver(e.task,Ze.value,pe)};return i.onMounted(()=>{window.addEventListener("splitter-drag-start",ee),window.addEventListener("splitter-drag-end",X),window.addEventListener("close-all-taskbar-menus",fe),window.addEventListener("task-row-drag-over",lt)}),i.onUnmounted(()=>{window.removeEventListener("splitter-drag-start",ee),window.removeEventListener("splitter-drag-end",X),window.removeEventListener("close-all-taskbar-menus",fe),window.removeEventListener("task-row-drag-over",lt),se.value&&clearInterval(se.value)}),(Q,De)=>{const pe=i.resolveComponent("TaskRow",!0);return i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",{ref_key:"taskRowRef",ref:Ze,class:i.normalizeClass(["task-row",{"task-row-hovered":Q.isHovered,"parent-task":j.value,"milestone-group-row":k.value,"task-type-story":E.value,"task-type-task":e.task.type==="task","task-type-milestone":P.value,[M.value]:M.value}]),"data-task-id":e.task.id,style:i.normalizeStyle(O.value),onClick:R,onDblclick:S,onMousedown:tt,onMouseenter:T,onMouseleave:G,onContextmenu:he},[Q.renderMode==="declarative"&&Q.declarativeColumns?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList(f.value,(ge,Ee)=>(i.openBlock(),i.createElementBlock("div",{key:Ee,class:i.normalizeClass(["col",[ge.cssClass,{"col-name":v(Ee)}]]),style:i.normalizeStyle([Q.getColumnWidthStyle?Q.getColumnWidthStyle(ge):{},w(ge)])},[v(Ee)?(i.openBlock(),i.createElementBlock("div",{key:0,style:i.normalizeStyle({paddingLeft:B.value}),class:"first-col-wrapper"},[(E.value||F.value)&&!k.value?(i.openBlock(),i.createElementBlock("span",{key:0,class:"collapse-btn",onClick:i.withModifiers(L,["stop"])},[(i.openBlock(),i.createElementBlock("svg",WE,[e.task.collapsed?(i.openBlock(),i.createElementBlock("polyline",GE)):(i.openBlock(),i.createElementBlock("polyline",YE))]))])):i.createCommentVNode("",!0),k.value?(i.openBlock(),i.createElementBlock("span",zE)):i.createCommentVNode("",!0),!j.value&&!k.value&&Q.showTaskIcon===!1?(i.openBlock(),i.createElementBlock("span",$E)):i.createCommentVNode("",!0),(i.openBlock(),i.createBlock(i.resolveDynamicComponent(()=>b(ge,Ee))))],4)):(i.openBlock(),i.createBlock(i.resolveDynamicComponent(()=>b(ge,Ee)),{key:1}))],6))),128)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createElementVNode("div",{class:"col col-name",style:i.normalizeStyle({paddingLeft:B.value})},[(E.value||F.value)&&!k.value?(i.openBlock(),i.createElementBlock("span",{key:0,class:"collapse-btn",onClick:i.withModifiers(L,["stop"])},[(i.openBlock(),i.createElementBlock("svg",XE,[e.task.collapsed?(i.openBlock(),i.createElementBlock("polyline",JE)):(i.openBlock(),i.createElementBlock("polyline",ZE))]))])):i.createCommentVNode("",!0),k.value?(i.openBlock(),i.createElementBlock("span",e4)):i.createCommentVNode("",!0),!j.value&&!k.value&&Q.showTaskIcon===!1?(i.openBlock(),i.createElementBlock("span",t4)):i.createCommentVNode("",!0),g("name")?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(()=>p("name",{task:e.task,column:{key:"name"},value:e.task.name,isParentTask:j.value,hasChildren:F.value,isStoryTask:E.value,isMilestoneGroup:k.value,isMilestoneTask:P.value,showTaskIcon:e.showTaskIcon,formattedTimer:x.value,isOvertime:oe(),overdueDays:le(),overtimeText:a.value,overdueText:o.value,daysText:s.value})),{key:3})):c.value?(i.openBlock(),i.createElementBlock(i.Fragment,{key:4},[Q.showTaskIcon!==!1?(i.openBlock(),i.createElementBlock("span",r4,[k.value?(i.openBlock(),i.createElementBlock("svg",A4,De[10]||(De[10]=[i.createElementVNode("polygon",{points:"12,2 22,12 12,22 2,12"},null,-1)]))):E.value||F.value?(i.openBlock(),i.createElementBlock("svg",n4,De[11]||(De[11]=[i.createElementVNode("path",{d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-5l-2-2H5a2 2 0 00-2 2z"},null,-1)]))):(i.openBlock(),i.createElementBlock("svg",a4,De[12]||(De[12]=[i.createStaticVNode('<path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z" data-v-2bc6791b></path><polyline points="14,2 14,8 20,8" data-v-2bc6791b></polyline><line x1="16" y1="13" x2="8" y2="13" data-v-2bc6791b></line><line x1="16" y1="17" x2="8" y2="17" data-v-2bc6791b></line><polyline points="10,9 9,9 8,9" data-v-2bc6791b></polyline>',5)])))])):i.createCommentVNode("",!0),i.createElementVNode("span",{class:i.normalizeClass(["task-name-text",{"parent-task":j.value}]),title:e.task.name},[i.renderSlot(Q.$slots,"custom-task-content",i.mergeProps(Pe.value,{type:"task-row"}),void 0,!0),e.task.isTimerRunning||e.task.timerElapsedTime?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass(["timer-badge",{"timer-active":e.task.isTimerRunning}])},[e.task.isTimerRunning?(i.openBlock(),i.createElementBlock("span",s4)):i.createCommentVNode("",!0),i.createTextVNode(" "+i.toDisplayString(x.value),1)],2)):i.createCommentVNode("",!0),oe()?(i.openBlock(),i.createElementBlock("span",o4,i.toDisplayString(a.value),1)):i.createCommentVNode("",!0),le()>0?(i.openBlock(),i.createElementBlock("span",l4,i.toDisplayString(o.value)+i.toDisplayString(le()>0?le()+s.value:""),1)):i.createCommentVNode("",!0)],10,i4)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:5},[Q.showTaskIcon!==!1?(i.openBlock(),i.createElementBlock("span",c4,[k.value?(i.openBlock(),i.createElementBlock("svg",u4,De[13]||(De[13]=[i.createElementVNode("polygon",{points:"12,2 22,12 12,22 2,12"},null,-1)]))):E.value||F.value?(i.openBlock(),i.createElementBlock("svg",f4,De[14]||(De[14]=[i.createElementVNode("path",{d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-5l-2-2H5a2 2 0 00-2 2z"},null,-1)]))):(i.openBlock(),i.createElementBlock("svg",d4,De[15]||(De[15]=[i.createStaticVNode('<path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z" data-v-2bc6791b></path><polyline points="14,2 14,8 20,8" data-v-2bc6791b></polyline><line x1="16" y1="13" x2="8" y2="13" data-v-2bc6791b></line><line x1="16" y1="17" x2="8" y2="17" data-v-2bc6791b></line><polyline points="10,9 9,9 8,9" data-v-2bc6791b></polyline>',5)])))])):i.createCommentVNode("",!0),i.createElementVNode("span",{class:i.normalizeClass(["task-name-text",{"parent-task":j.value}]),title:e.task.name},[i.createTextVNode(i.toDisplayString(e.task.name)+" ",1),e.task.isTimerRunning||e.task.timerElapsedTime?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass(["timer-badge",{"timer-active":e.task.isTimerRunning}])},[e.task.isTimerRunning?(i.openBlock(),i.createElementBlock("span",g4)):i.createCommentVNode("",!0),i.createTextVNode(" "+i.toDisplayString(x.value),1)],2)):i.createCommentVNode("",!0),oe()?(i.openBlock(),i.createElementBlock("span",p4,i.toDisplayString(a.value),1)):i.createCommentVNode("",!0),le()>0?(i.openBlock(),i.createElementBlock("span",v4,i.toDisplayString(o.value)+i.toDisplayString(le()>0?le()+s.value:""),1)):i.createCommentVNode("",!0)],10,h4)],64))],4),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(Q.columns,ge=>(i.openBlock(),i.createElementBlock("div",{key:ge.key,class:i.normalizeClass(["col",ge.cssClass||`col-${ge.key}`]),style:i.normalizeStyle(Q.getColumnWidthStyle?Q.getColumnWidthStyle(ge):void 0)},[k.value?(i.openBlock(),i.createElementBlock("div",m4)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[g(ge.key)?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(()=>p(ge.key,{task:e.task,column:ge,value:e.task[ge.key]})),{key:0})):ge.formatter?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(ge.formatter(e.task,ge)),1)],64)):ge.key==="predecessor"?(i.openBlock(),i.createElementBlock(i.Fragment,{key:2},[i.createTextVNode(i.toDisplayString(i.unref(pg)(e.task.predecessor)),1)],64)):ge.key==="assignee"?(i.openBlock(),i.createElementBlock("div",w4,[i.createElementVNode("div",B4,i.toDisplayString(e.task.assignee?e.task.assignee.charAt(0):"-"),1),i.createElementVNode("span",y4,i.toDisplayString(e.task.assignee||"-"),1)])):ge.key==="startDate"?(i.openBlock(),i.createElementBlock(i.Fragment,{key:4},[i.createTextVNode(i.toDisplayString(e.task.startDate||"-"),1)],64)):ge.key==="endDate"?(i.openBlock(),i.createElementBlock(i.Fragment,{key:5},[i.createTextVNode(i.toDisplayString(e.task.endDate||"-"),1)],64)):ge.key==="estimatedHours"?(i.openBlock(),i.createElementBlock(i.Fragment,{key:6},[i.createTextVNode(i.toDisplayString(e.task.estimatedHours||"-"),1)],64)):ge.key==="actualHours"?(i.openBlock(),i.createElementBlock(i.Fragment,{key:7},[i.createTextVNode(i.toDisplayString(e.task.actualHours||"-"),1)],64)):ge.key==="progress"?(i.openBlock(),i.createElementBlock("span",{key:8,class:i.normalizeClass(["progress-value",Fe.value])},i.toDisplayString(e.task.progress!=null?e.task.progress+"%":"-"),3)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:9},[i.createTextVNode(i.toDisplayString(e.task[ge.key]||"-"),1)],64))],64))],6))),128))],64))],46,jE),!e.disableChildrenRender&&F.value&&!e.task.collapsed&&!k.value?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList(e.task.children,ge=>(i.openBlock(),i.createBlock(pe,{key:ge.id,task:ge,level:e.level+1,"is-hovered":e.hoveredTaskId===ge.id,"hovered-task-id":e.hoveredTaskId,"on-hover":e.onHover,columns:e.columns,"declarative-columns":e.declarativeColumns,"render-mode":e.renderMode,"get-column-width-style":e.getColumnWidthStyle,"disable-children-render":e.disableChildrenRender,"show-task-icon":e.showTaskIcon,"enable-drag":e.enableDrag,"drag-start":e.dragStart,"drag-over":e.dragOver,onToggle:De[0]||(De[0]=Ee=>r("toggle",Ee)),onDblclick:De[1]||(De[1]=Ee=>r("dblclick",Ee)),onStartTimer:De[2]||(De[2]=Ee=>r("start-timer",Ee)),onStopTimer:De[3]||(De[3]=Ee=>r("stop-timer",Ee)),onAddPredecessor:De[4]||(De[4]=Ee=>r("add-predecessor",Ee)),onAddSuccessor:De[5]||(De[5]=Ee=>r("add-successor",Ee)),onDelete:ce},i.createSlots({_:2},[c.value?{name:"custom-task-content",fn:i.withCtx(Ee=>[i.renderSlot(Q.$slots,"custom-task-content",i.mergeProps({ref_for:!0},Ee),void 0,!0)]),key:"0"}:void 0]),1032,["task","level","is-hovered","hovered-task-id","on-hover","columns","declarative-columns","render-mode","get-column-width-style","disable-children-render","show-task-icon","enable-drag","drag-start","drag-over"]))),128)):i.createCommentVNode("",!0),i.createVNode(Ay,{visible:W.value,task:Ae.value,position:z.value,onClose:fe,onStartTimer:De[6]||(De[6]=ge=>Q.$emit("start-timer",e.task)),onStopTimer:De[7]||(De[7]=ge=>Q.$emit("stop-timer",e.task)),onAddPredecessor:De[8]||(De[8]=ge=>Q.$emit("add-predecessor",e.task)),onAddSuccessor:De[9]||(De[9]=ge=>Q.$emit("add-successor",e.task)),onDelete:ce},null,8,["visible","task","position"])])}}}),ny=sn(C4,[["__scopeId","data-v-2bc6791b"]]),E4=320,Kv=280,F4=1160;function Nu(A,t,e){if(A==null)return e;if(typeof A=="number")return A;if(typeof A=="string"){const r=A.trim();if(r.endsWith("%")){const a=parseFloat(r);if(!isNaN(a))return Math.round(t*a/100)}const n=parseFloat(r);if(!isNaN(n))return n}return e}const _u=[{type:"name",key:"taskName",label:"任务名称",cssClass:"col-name",visible:!0},{type:"predecessor",key:"predecessor",label:"前置任务",cssClass:"col-pre",visible:!0},{type:"assignee",key:"assignee",label:"负责人",cssClass:"col-assignee",visible:!0},{type:"startDate",key:"startDate",label:"开始日期",cssClass:"col-date",visible:!0},{type:"endDate",key:"endDate",label:"结束日期",cssClass:"col-date",visible:!0},{type:"estimatedHours",key:"estimatedHours",label:"预估工时",cssClass:"col-hours",visible:!0},{type:"actualHours",key:"actualHours",label:"实际工时",cssClass:"col-hours",visible:!0},{type:"progress",key:"progress",label:"进度",cssClass:"col-progress",visible:!0}];function k4(A){const t=A.dragThreshold??5,e=i.ref({isDragging:!1,isPreparing:!1,draggedTask:null,draggedElement:null,ghostElement:null,dropTargetTask:null,dropPosition:null,startX:0,startY:0}),r=(p,f,v)=>{A.enabled&&(p.type==="milestone-group"||p.type==="milestone"||(v.preventDefault(),v.stopPropagation(),e.value.isPreparing=!0,e.value.draggedTask=p,e.value.draggedElement=f,e.value.startX=v.clientX,e.value.startY=v.clientY))},n=p=>{if(!e.value.isPreparing||e.value.isDragging)return;const f=e.value.draggedTask,v=e.value.draggedElement;e.value.isDragging=!0,e.value.isPreparing=!1;const w=v.cloneNode(!0);w.style.position="fixed",w.style.left="-9999px",w.style.top="-9999px",w.style.width=`${v.offsetWidth}px`,w.style.height=`${v.offsetHeight}px`,w.style.opacity="0.6",w.style.pointerEvents="none",w.style.zIndex="999999",w.style.boxShadow="0 8px 24px rgba(0, 0, 0, 0.3)",w.classList.add("task-row-dragging"),(document.querySelector(".gantt-fullscreen")||document.body).appendChild(w),e.value.ghostElement=w,v.style.opacity="0.4",document.body.style.userSelect="none",document.body.style.webkitUserSelect="none",document.body.style.cursor="move",window.dispatchEvent(new CustomEvent("task-row-drag-start",{detail:{task:f}})),A.onDragStart&&A.onDragStart(f),a(p)},a=p=>{if(e.value.ghostElement){const f=e.value.ghostElement;f.style.left=`${p.clientX+10}px`,f.style.top=`${p.clientY-25}px`}},o=(p,f,v)=>{if(!e.value.isDragging||!e.value.draggedTask)return;if(p.id===e.value.draggedTask.id){s();return}if(g(e.value.draggedTask,p)){s();return}v.preventDefault(),v.stopPropagation();const b=p.children&&p.children.length>0?"child":"after";e.value.dropTargetTask=p,e.value.dropPosition=b,document.querySelectorAll(".task-row-drop-target").forEach(B=>{B.classList.remove("task-row-drop-target","drop-after","drop-child")}),f.classList.add("task-row-drop-target"),b==="after"?f.classList.add("drop-after"):f.classList.add("drop-child"),A.onDragOver&&A.onDragOver(p,b)},s=()=>{e.value.dropTargetTask=null,e.value.dropPosition=null,document.querySelectorAll(".task-row-drop-target").forEach(p=>{p.classList.remove("task-row-drop-target","drop-after","drop-child")})},l=()=>{if(e.value.isPreparing&&!e.value.isDragging){e.value.isPreparing=!1,e.value.draggedTask=null,e.value.draggedElement=null;return}if(!e.value.isDragging)return;const p=e.value.draggedTask,f=e.value.dropTargetTask,v=e.value.dropPosition;e.value.draggedElement&&(e.value.draggedElement.style.opacity=""),e.value.ghostElement&&e.value.ghostElement.parentElement&&e.value.ghostElement.parentElement.removeChild(e.value.ghostElement),s(),document.body.style.userSelect="",document.body.style.webkitUserSelect="",document.body.style.cursor="",window.dispatchEvent(new CustomEvent("task-row-drag-end")),p&&f&&v&&A.onDrop&&A.onDrop(p,f,v),e.value={isDragging:!1,isPreparing:!1,draggedTask:null,draggedElement:null,ghostElement:null,dropTargetTask:null,dropPosition:null,startX:0,startY:0}},c=p=>{if(e.value.isPreparing&&!e.value.isDragging){const f=Math.abs(p.clientX-e.value.startX),v=Math.abs(p.clientY-e.value.startY);Math.sqrt(f*f+v*v)>t&&n(p);return}if(e.value.isDragging){a(p);const f=e.value.ghostElement;f&&(f.style.display="none");const v=document.elementFromPoint(p.clientX,p.clientY);if(f&&(f.style.display=""),v){const w=v.closest(".task-row");if(w&&w.dataset.taskId){const b=Number(w.dataset.taskId);window.dispatchEvent(new CustomEvent("task-row-drag-over",{detail:{taskId:b,event:p}}))}}}},u=()=>{(e.value.isDragging||e.value.isPreparing)&&l()},g=(p,f)=>{if(!p.children)return!1;for(const v of p.children)if(v.id===f.id||g(v,f))return!0;return!1};return i.onMounted(()=>{document.addEventListener("mousemove",c),document.addEventListener("mouseup",u)}),i.onUnmounted(()=>{document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",u),e.value.ghostElement&&e.value.ghostElement.parentElement&&e.value.ghostElement.parentElement.removeChild(e.value.ghostElement)}),{dragState:e,startDrag:r,handleDragOver:o,endDrag:l}}function x4(A){let t=!1;if(typeof A.type=="object"){const o=A.type;t=o.name==="TaskListColumn"||o.__name==="TaskListColumn"||o.__file&&o.__file.includes("TaskListColumn")}if(!t)return null;const e=A.props||{},r=A.children,n=r==null?void 0:r.header,a=r==null?void 0:r.default;return{prop:e.prop,label:e.label,width:e.width,align:e.align||"left",cssClass:e.cssClass,headerSlot:n,defaultSlot:a}}function S4(A){var n;const t=(n=A.default)==null?void 0:n.call(A);if(!t||!Array.isArray(t))return[];const e=[],r=a=>{for(const o of a){if(!o)continue;if(typeof o.type=="symbol"){o.children&&Array.isArray(o.children)&&r(o.children);continue}const s=x4(o);s&&e.push(s),o.children&&Array.isArray(o.children)&&r(o.children)}};return r(t),e}function T4(A,t,e){const r=i.computed(()=>A!=="declarative"?[]:S4(t)),n=i.computed(()=>A==="declarative"?r.value:e||[]);return{declarativeColumns:r,finalColumns:n,getColumnWidthStyle:(s,l)=>{if(!s.width)return{};let c;if(typeof s.width=="string"&&s.width.includes("%"))if(l&&l>0){const u=parseFloat(s.width)/100;c=`${Math.floor(l*u)}px`}else return{};else typeof s.width=="number"?c=`${s.width}px`:typeof s.width=="string"?/\d+(px|rem|em|%)/.test(s.width)?c=s.width:c=`${s.width}px`:c=String(s.width);return{flex:`0 0 ${c}`,minWidth:c,maxWidth:c}},getColumnAlignStyle:s=>!s||s==="left"?{}:{justifyContent:s==="center"?"center":"flex-end",textAlign:s}}}const U4={class:"task-list-header"},D4={class:"col col-name"},Bo=51,qv=5,Q4=i.defineComponent({__name:"TaskList",props:{tasks:{},useDefaultDrawer:{type:Boolean},taskListConfig:{},taskListColumnRenderMode:{default:"default"},enableTaskRowMove:{type:Boolean},taskListRowClassName:{},taskListRowStyle:{type:[Boolean,null,String,Object,Array,Function]}},emits:["task-collapse-change","start-timer","stop-timer","add-predecessor","add-successor","delete","task-row-moved"],setup(A,{emit:t}){var Ee;const e=A,r=t,n=i.useSlots(),a=i.computed(()=>!!n["custom-task-content"]),o=i.inject("gantt-column-slots",{}),{t:s}=ga(),{declarativeColumns:l,getColumnWidthStyle:c}=T4(e.taskListColumnRenderMode||"default",n,((Ee=e.taskListConfig)==null?void 0:Ee.columns)||_u),u=i.computed(()=>{var Qe;return e.taskListColumnRenderMode==="declarative"?l.value:(((Qe=e.taskListConfig)==null?void 0:Qe.columns)||_u).filter(Oe=>Oe.visible!==!1)}),g=i.ref(null),p=i.ref(null),f=i.ref(0);let v=null,w=null;const b=i.ref(0),B=i.ref(0),F=xe=>{if(e.taskListColumnRenderMode==="declarative")return c(xe,f.value);if(!xe.width)return{};let Qe;if(typeof xe.width=="string"&&xe.width.includes("%")){const Oe=f.value||0;if(Oe>0){const Ve=parseFloat(xe.width)/100;Qe=`${Math.floor(Oe*Ve)}px`}else return{}}else Qe=`${xe.width}px`;return{flex:`0 0 ${Qe}`,minWidth:Qe,maxWidth:Qe}},E=i.computed(()=>{var Qe;return e.taskListColumnRenderMode==="declarative"?[]:(((Qe=e.taskListConfig)==null?void 0:Qe.columns)||_u).filter(Oe=>Oe.visible!==!1)}),k=i.computed(()=>e.tasks||[]),P=i.ref(null),j=i.ref(!1),M=()=>{j.value=!0},O=()=>{if(j.value=!1,g.value){const xe=g.value.offsetWidth;Math.abs(xe-f.value)>1&&(f.value=xe)}},L=xe=>{j.value||(P.value=xe,window.dispatchEvent(new CustomEvent("task-list-hover",{detail:xe})))},R=xe=>{P.value=xe.detail},S=xe=>{xe.type==="milestone"||xe.type==="milestone-group"||window.dispatchEvent(new CustomEvent("task-row-double-click",{detail:xe}))},T=xe=>{if(!xe.children||xe.children.length===0)return{progress:xe.progress||0,startDate:xe.startDate||"",endDate:xe.endDate||""};const Qe=[],Oe=Bt=>{Bt.forEach(pt=>{Qe.push(pt),pt.children&&pt.children.length>0&&Oe(pt.children)})};Oe(xe.children);const Ve=Qe.reduce((Bt,pt)=>Bt+(pt.progress||0),0),Re=Qe.length>0?Math.round(Ve/Qe.length):0,$e=Qe.filter(Bt=>Bt.startDate&&Bt.endDate);if($e.length===0)return{progress:Re,startDate:xe.startDate||"",endDate:xe.endDate||""};const at=$e.map(Bt=>new Date(Bt.startDate)),gt=$e.map(Bt=>new Date(Bt.endDate)),mt=new Date(Math.min(...at.map(Bt=>Bt.getTime()))),ht=new Date(Math.max(...gt.map(Bt=>Bt.getTime())));return{progress:Re,startDate:mt.toISOString().split("T")[0],endDate:ht.toISOString().split("T")[0]}},G=()=>{if(!e.tasks)return;const xe=Qe=>{Qe.forEach(Oe=>{if(Oe.children&&Oe.children.length>0){xe(Oe.children);const Ve=T(Oe);Oe.progress=Ve.progress,Oe.startDate=Ve.startDate,Oe.endDate=Ve.endDate}})};xe(e.tasks)},N=xe=>{const Qe=[],Oe=Ve=>{Ve.forEach(Re=>{Qe.push(Re),Re.children&&Re.children.length>0&&Oe(Re.children)})};return Oe(xe),Qe},oe=(xe,Qe=0)=>{const Oe=[];for(const Ve of xe)Oe.push({task:Ve,level:Qe}),!(Ve.type==="milestone-group")&&Ve.children&&Ve.children.length>0&&!Ve.collapsed&&Oe.push(...oe(Ve.children,Qe+1));return Oe},le=i.computed(()=>oe(k.value)),Z=i.computed(()=>{const xe=b.value,Qe=B.value||600,Oe=Math.floor(xe/Bo)-qv,Ve=Math.ceil((xe+Qe)/Bo)+qv,Re=le.value.length,$e=Math.min(Math.max(0,Oe),Re),at=Math.min(Re,Math.max($e+1,Ve));return{startIndex:$e,endIndex:at}}),ee=i.computed(()=>{const{startIndex:xe,endIndex:Qe}=Z.value;return le.value.slice(xe,Qe).map((Ve,Re)=>({...Ve,rowIndex:xe+Re}))}),X=i.computed(()=>le.value.length*Bo),re=i.computed(()=>Z.value.startIndex*Bo),se=i.computed(()=>{const xe=ee.value.length*Bo;return Math.max(0,X.value-re.value-xe)});function x(xe){xe.collapsed=!xe.collapsed,r("task-collapse-change",xe)}const I=xe=>{if(!e.tasks)return;const Qe=Oe=>{for(const Ve of Oe){if(Ve.id===xe.id)return Object.assign(Ve,xe),xe.children,!0;if(Ve.children&&Qe(Ve.children))return!0}return!1};Qe(e.tasks),G()},W=xe=>{const Qe=xe.detail;I(Qe)},z=xe=>{const Qe=xe.detail;e.tasks&&e.tasks.push(Qe),G()},Ae=()=>{const xe=N(k.value);window.dispatchEvent(new CustomEvent("task-list-updated",{detail:xe}))},he=xe=>{const{milestoneId:Qe,icon:Oe}=xe.detail,Ve=Re=>{for(const $e of Re){if($e.type==="milestone-group"&&$e.children){const at=$e.children.find(gt=>gt.id===Qe);if(at)return at.icon=Oe,!0}if($e.children&&Ve($e.children))return!0}return!1};Ve(k.value)},fe=xe=>{const Qe=xe.target;if(!Qe)return;const Oe=Qe.scrollTop;b.value=Oe,window.dispatchEvent(new CustomEvent("task-list-vertical-scroll",{detail:{scrollTop:Oe}}))},ce=xe=>{const{scrollTop:Qe}=xe.detail,Oe=p.value;b.value=Qe,Oe&&Math.abs(Oe.scrollTop-Qe)>1&&(Oe.scrollTop=Qe)},Fe=xe=>{try{window.dispatchEvent(new CustomEvent("context-menu",{detail:xe}))}catch(Qe){console.error("TaskList - Failed to dispatch context-menu event",Qe)}},Pe=xe=>{r("start-timer",xe)},Ze=xe=>{r("stop-timer",xe)},tt=xe=>{r("add-predecessor",xe)},lt=xe=>{r("add-successor",xe)},Q=(xe,Qe)=>{r("delete",xe,Qe)},De=xe=>{const{draggedTask:Qe,targetTask:Oe,position:Ve}=xe;e.tasks&&r("task-row-moved",{draggedTask:Qe,targetTask:Oe,position:Ve,oldParent:null,newParent:null})},{startDrag:pe,handleDragOver:ge}=k4({enabled:e.enableTaskRowMove??!1,onDrop:(xe,Qe,Oe)=>{De({draggedTask:xe,targetTask:Qe,position:Oe})}});return i.onMounted(async()=>{g.value&&(v=new ResizeObserver(xe=>{if(!j.value)for(const Qe of xe)f.value=Qe.contentRect.width}),v.observe(g.value)),p.value&&(B.value=p.value.clientHeight,b.value=p.value.scrollTop,w=new ResizeObserver(xe=>{for(const Qe of xe)B.value=Qe.contentRect.height}),w.observe(p.value)),window.addEventListener("task-updated",W),window.addEventListener("task-added",z),window.addEventListener("request-task-list",Ae),window.addEventListener("timeline-task-hover",R),window.addEventListener("timeline-vertical-scroll",ce),window.addEventListener("milestone-icon-changed",he),window.addEventListener("splitter-drag-start",M),window.addEventListener("splitter-drag-end",O),G()}),i.onUnmounted(()=>{v&&(v.disconnect(),v=null),w&&(w.disconnect(),w=null),window.removeEventListener("task-updated",W),window.removeEventListener("task-added",z),window.removeEventListener("request-task-list",Ae),window.removeEventListener("timeline-task-hover",R),window.removeEventListener("timeline-vertical-scroll",ce),window.removeEventListener("milestone-icon-changed",he),window.removeEventListener("splitter-drag-start",M),window.removeEventListener("splitter-drag-end",O)}),(xe,Qe)=>(i.openBlock(),i.createElementBlock("div",{ref_key:"taskListRef",ref:g,class:"task-list"},[i.createElementVNode("div",U4,[xe.taskListColumnRenderMode==="declarative"?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList(u.value,(Oe,Ve)=>(i.openBlock(),i.createElementBlock("div",{key:Ve,class:i.normalizeClass(["col",Oe.cssClass]),style:i.normalizeStyle({...F(Oe),justifyContent:Oe.align==="center"?"center":Oe.align==="right"?"flex-end":"flex-start",textAlign:Oe.align||"left"})},[Oe.headerSlot?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(Oe.headerSlot),{key:0})):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(Oe.label),1)],64))],6))),128)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createElementVNode("div",D4,[i.unref(o)["header-name"]?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(i.unref(o)["header-name"]),{key:0})):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(i.unref(s).taskName||"任务名称"),1)],64))]),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(E.value,Oe=>(i.openBlock(),i.createElementBlock("div",{key:Oe.key,class:i.normalizeClass(["col",Oe.cssClass||`col-${Oe.key}`]),style:i.normalizeStyle(F(Oe))},[i.unref(o)[`header-${Oe.key}`]?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(i.unref(o)[`header-${Oe.key}`]),{key:0})):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(i.unref(s)[Oe.key]||Oe.label),1)],64))],6))),128))],64))]),i.createElementVNode("div",{ref_key:"taskListBodyRef",ref:p,class:"task-list-body",onScroll:fe},[i.createElementVNode("div",{class:"task-list-body-spacer",style:i.normalizeStyle({height:`${re.value}px`})},null,4),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(ee.value,({task:Oe,level:Ve,rowIndex:Re})=>{var $e;return i.openBlock(),i.createBlock(ny,{key:Oe.id,task:Oe,level:Ve,"row-index":Re,"is-hovered":P.value===Oe.id,"hovered-task-id":P.value,"on-hover":L,columns:xe.taskListColumnRenderMode==="declarative"?[]:E.value,"declarative-columns":xe.taskListColumnRenderMode==="declarative"?u.value:void 0,"render-mode":xe.taskListColumnRenderMode,"get-column-width-style":F,"disable-children-render":!0,"show-task-icon":($e=e.taskListConfig)==null?void 0:$e.showTaskIcon,"enable-drag":e.enableTaskRowMove,"drag-start":i.unref(pe),"drag-over":i.unref(ge),"task-list-row-class-name":e.taskListRowClassName,"task-list-row-style":e.taskListRowStyle,onToggle:x,onDblclick:S,onContextmenu:Fe,onStartTimer:Pe,onStopTimer:Ze,onAddPredecessor:tt,onAddSuccessor:lt,onDelete:Q},i.createSlots({_:2},[a.value?{name:"custom-task-content",fn:i.withCtx(at=>[i.renderSlot(xe.$slots,"custom-task-content",i.mergeProps({ref_for:!0},at),void 0,!0)]),key:"0"}:void 0]),1032,["task","level","row-index","is-hovered","hovered-task-id","columns","declarative-columns","render-mode","show-task-icon","enable-drag","drag-start","drag-over","task-list-row-class-name","task-list-row-style"])}),128)),i.createElementVNode("div",{class:"task-list-body-spacer",style:i.normalizeStyle({height:`${se.value}px`})},null,4)],544)],512))}}),ay=sn(Q4,[["__scopeId","data-v-f0f868e5"]]),qe={HOUR:"hour",DAY:"day",WEEK:"week",MONTH:"month",QUARTER:"quarter",YEAR:"year"},L4={hour:{scale:qe.HOUR,cellWidth:40,headerLevels:2,formatters:{primary:"yyyy年MM月dd日",secondary:"HH:mm"}},day:{scale:qe.DAY,cellWidth:30,headerLevels:2,formatters:{primary:"yyyy年MM月",secondary:"dd"}},week:{scale:qe.WEEK,cellWidth:120,headerLevels:2,formatters:{primary:"yyyy年MM月",secondary:"W周"}},month:{scale:qe.MONTH,cellWidth:180,headerLevels:2,formatters:{primary:"yyyy年",secondary:"MM月"}},quarter:{scale:qe.QUARTER,cellWidth:60,headerLevels:2,formatters:{primary:"yyyy年",secondary:"Q季度"}},year:{scale:qe.YEAR,cellWidth:180,headerLevels:2,formatters:{primary:"yyyy年",secondary:"上半年|下半年"}}},I4={key:0,class:"anchor-tooltip"},N4=i.defineComponent({__name:"LinkAnchor",props:{type:{},taskId:{},visible:{type:Boolean,default:!1},isDragSource:{type:Boolean,default:!1},isDragTarget:{type:Boolean,default:!1},isValidTarget:{type:Boolean,default:!0},enabled:{type:Boolean,default:!0},globalDragging:{type:Boolean,default:!1}},emits:["drag-start","drag-move","drag-end"],setup(A,{emit:t}){const e=A,r=t,n=i.ref(!1),a=i.computed(()=>e.visible||e.globalDragging||e.isDragSource||e.isDragTarget||n.value);let o=null,s=null,l=!1;function c(f){e.enabled&&(f.stopPropagation(),f.preventDefault(),l=!0,r("drag-start",{taskId:e.taskId,type:e.type,x:f.clientX,y:f.clientY}),o=v=>{l&&r("drag-move",{x:v.clientX,y:v.clientY})},s=()=>{l&&(r("drag-end",{taskId:e.taskId,type:e.type}),p())},document.addEventListener("mousemove",o),document.addEventListener("mouseup",s))}function u(){e.enabled&&(n.value=!0)}function g(){e.enabled&&(n.value=!1)}function p(){l=!1,o&&(document.removeEventListener("mousemove",o),o=null),s&&(document.removeEventListener("mouseup",s),s=null)}return i.onUnmounted(()=>{p()}),(f,v)=>f.enabled&&a.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["link-anchor",{"anchor-predecessor":f.type==="predecessor","anchor-successor":f.type==="successor","drag-source":f.isDragSource,"drag-target":f.isDragTarget,"valid-target":f.isDragTarget&&f.isValidTarget,"invalid-target":f.isDragTarget&&!f.isValidTarget,visible:a.value}]),onMousedown:c,onMouseenter:u,onMouseleave:g},[!f.isDragSource&&!f.isDragTarget&&!f.globalDragging?(i.openBlock(),i.createElementBlock("div",I4,i.toDisplayString(f.type==="predecessor"?"添加前置任务":"添加后置任务"),1)):i.createCommentVNode("",!0)],34)):i.createCommentVNode("",!0)}}),jv=sn(N4,[["__scopeId","data-v-fa084d7b"]]),_4={showAvatar:!0,showTitle:!0,showProgress:!0,dragThreshold:5,resizeHandleWidth:5,enableDragDelay:!1,dragDelayTime:150},M4=["data-task-id"],O4={key:0,class:"parent-label"},R4=["src","alt"],H4={key:1,class:"avatar-text"},P4={key:2,class:"avatar-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},V4={key:1,class:"task-name"},K4={class:"tooltip-title"},q4={class:"tooltip-content"},j4={class:"tooltip-row"},W4={class:"tooltip-label"},G4={class:"tooltip-value"},Y4={class:"tooltip-row"},z4={class:"tooltip-label"},$4={class:"tooltip-value"},X4={class:"tooltip-row"},J4={class:"tooltip-label"},Z4={class:"tooltip-value"},eF={class:"tooltip-row"},tF={class:"tooltip-label"},rF={class:"tooltip-value"},AF={class:"tooltip-row"},nF={class:"tooltip-label"},aF={class:"tooltip-value"},iF={class:"drag-tooltip-content"},sF={class:"tooltip-row"},oF={class:"tooltip-label"},lF={class:"tooltip-value"},cF={class:"tooltip-row"},uF={class:"tooltip-label"},fF={class:"tooltip-value"},dF=1e3,hF=100,gF=250,pF=i.defineComponent({__name:"TaskBar",props:{task:{},rowHeight:{},dayWidth:{},startDate:{},isParent:{type:Boolean},onClick:{type:Function},scrollLeft:{},containerWidth:{},hideBubbles:{type:Boolean},timelineData:{},currentTimeScale:{},taskBarConfig:{},allowDragAndResize:{type:Boolean},isHighlighted:{type:Boolean},isPrimaryHighlight:{type:Boolean},isInHighlightMode:{type:Boolean},dragLinkMode:{},isLinkDragSource:{type:Boolean},isValidLinkTarget:{type:Boolean},isInvalidLinkTarget:{type:Boolean},allTasks:{}},emits:["update:task","bar-mounted","click","dblclick","drag-end","resize-end","scroll-to-position","start-timer","stop-timer","add-predecessor","add-successor","delete","delete-link","context-menu","long-press","link-drag-start","link-drag-move","link-drag-end"],setup(A,{emit:t}){const e=A,r=t,n=i.useSlots(),{getTranslation:a}=ga(),o=q=>a(q),s=i.computed(()=>!!n["custom-task-content"]),l=i.computed(()=>({..._4,...e.taskBarConfig})),c=q=>{if(!q)return null;if(q instanceof Date)return q;if(typeof q=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(q)){const[Ce,Te,ze]=q.split("-").map(Number);return new Date(Ce,Te-1,ze)}if(typeof q=="string"&&/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(q)){const[Ce,Te]=q.split(" "),[ze,Ie,Xe]=Ce.split("-").map(Number),[Ye,st]=Te.split(":").map(Number);return new Date(ze,Ie-1,Xe,Ye,st)}const me=new Date(q);return isNaN(me.getTime())?null:me},u=()=>{const q=new Date;return new Date(q.getFullYear(),q.getMonth(),q.getDate())},g=i.ref(u());let p=null;i.onMounted(()=>{p=window.setInterval(()=>{g.value=u()},6e4)}),i.onUnmounted(()=>{p!==null&&(clearInterval(p),p=null)});const f=q=>{const me=q.getFullYear(),Ce=String(q.getMonth()+1).padStart(2,"0"),Te=String(q.getDate()).padStart(2,"0");if(e.currentTimeScale===qe.HOUR){const ze=String(q.getHours()).padStart(2,"0"),Ie=String(q.getMinutes()).padStart(2,"0");return`${me}-${Ce}-${Te} ${ze}:${Ie}`}return`${me}-${Ce}-${Te}`},v=(q,me)=>{const Ce=new Date(q);return Ce.setDate(Ce.getDate()+me),Ce},w=(q,me)=>{const Ce=new Date(q);return Ce.setMinutes(Ce.getMinutes()+me),Ce},b=(q,me)=>Math.round((me.getTime()-q.getTime())/(1e3*60)),B=i.computed(()=>e.task.isEditable===!1?!0:e.currentTimeScale===qe.YEAR),F=i.ref(!1),E=i.ref(!1),k=i.ref(!1),P=i.ref(!1),j=i.ref(0),M=i.ref(0),O=i.ref(0),L=i.ref(0),R=i.ref(0),S=i.ref(0),T=i.ref(null),G=i.ref(!1),N=i.ref(!1),oe=i.computed(()=>l.value.dragThreshold??5),le=i.ref(!1),Z=i.ref(null),ee=i.ref(null),X=i.ref(!1),re=i.ref(0),se=i.ref(null),x=i.ref(null),I=i.ref(null),W=i.ref(null),z=i.ref(0),Ae=i.computed(()=>{var qt,tr;if(x.value&&e.currentTimeScale===qe.QUARTER)return{left:`${x.value.left??0}px`,width:`${x.value.width??100}px`,height:`${e.rowHeight-10}px`,top:"4px"};const q=((qt=se.value)==null?void 0:qt.startDate)||e.task.startDate,me=((tr=se.value)==null?void 0:tr.endDate)||e.task.endDate,Ce=c(q),Te=c(me),ze=ce.value;if(!Ce&&!Te)return{left:"0px",width:"0px",height:`${e.rowHeight-10}px`,top:"4px"};const Ie=Ce||Te,Xe=Te||Ce,Ye=ze;if(!Ie||!Xe||!Ye)return{left:"0px",width:"0px",height:`${e.rowHeight-10}px`,top:"4px"};let st=0,vt=0;if(e.currentTimeScale===qe.HOUR){const nr=new Date(Ye);nr.setHours(0,0,0,0);let Kt=Ie,Gt=Xe;const Rt=q||e.task.startDate,pr=me||e.task.endDate;typeof Rt=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(Rt.trim())&&(Kt=new Date(Ie),Kt.setHours(0,0,0,0)),typeof pr=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(pr.trim())&&(Gt=new Date(Xe),Gt.setDate(Gt.getDate()+1),Gt.setHours(0,0,0,0));const dr=b(nr,Kt),yr=b(nr,Gt),$t=40/60;st=Math.max(0,dr*$t),vt=Math.max(4,(yr-dr)*$t)}else{const nr=new Date(Ie.getFullYear(),Ie.getMonth(),Ie.getDate()),Kt=new Date(Xe.getFullYear(),Xe.getMonth(),Xe.getDate()),Gt=new Date(Ye.getFullYear(),Ye.getMonth(),Ye.getDate());if(e.timelineData&&e.currentTimeScale&&(e.currentTimeScale===qe.WEEK||e.currentTimeScale===qe.MONTH||e.currentTimeScale===qe.QUARTER||e.currentTimeScale===qe.YEAR)){const Rt=Er(nr,e.timelineData,e.currentTimeScale),pr=new Date(Kt);pr.setDate(pr.getDate()+1);let dr=Er(pr,e.timelineData,e.currentTimeScale);if(dr===Rt){let yr=2;e.currentTimeScale===qe.WEEK?yr=60/7:e.currentTimeScale===qe.QUARTER?yr=60/90:e.currentTimeScale===qe.YEAR&&(yr=180/182),dr=Er(Kt,e.timelineData,e.currentTimeScale)+yr}st=Rt,vt=Math.max(dr-Rt,4)}else if(e.timelineData&&e.currentTimeScale===qe.DAY){const Rt=Er(nr,e.timelineData,e.currentTimeScale),pr=new Date(Kt);pr.setDate(pr.getDate()+1);let dr=Er(pr,e.timelineData,e.currentTimeScale);dr===Rt&&(dr=Er(Kt,e.timelineData,e.currentTimeScale)+30),st=Rt,vt=Math.max(dr-Rt,4)}else{const Rt=Math.floor((nr.getTime()-Gt.getTime())/864e5),pr=Kt.getTime()-nr.getTime(),dr=Math.round(pr/(1e3*60*60*24)),yr=dr===0?1:dr+1;st=Rt*e.dayWidth,vt=yr*e.dayWidth}}return{left:`${st}px`,width:`${vt}px`,height:`${e.rowHeight-10}px`,top:"4px"}}),he=i.ref({left:0,top:0,width:0,height:0,timestamp:0}),fe=i.computed(()=>c(e.task.endDate||"")),ce=i.computed(()=>c(e.startDate)),Fe=i.computed(()=>{var Ce,Te;const q=((Ce=se.value)==null?void 0:Ce.startDate)||e.task.startDate,me=((Te=se.value)==null?void 0:Te.endDate)||e.task.endDate;return!!(q||me)}),Pe=i.computed(()=>{if(e.isParent)return{type:"parent",color:"#409eff",bgColor:"#409eff",borderColor:"#409eff"};const q=g.value,me=fe.value,Ce=e.task.progress||0;return Ce>=100?{type:"completed",color:"#909399",bgColor:"#f4f4f5",borderColor:"#d3d4d6"}:me&&me<q&&Ce<100?{type:"delayed",color:"#f56c6c",bgColor:"#fef0f0",borderColor:"#fbc4c4"}:me&&me>=q&&Ce>0?{type:"in-progress",color:"#e6a23c",bgColor:"#fdf6ec",borderColor:"#f5dab1"}:{type:"not-started",color:"#409eff",bgColor:"#ecf5ff",borderColor:"#b3d8ff"}}),Ze=i.computed(()=>({type:"task-bar",task:e.task,status:Pe.value,statusType:Pe.value.type,isParent:e.isParent??!1,progress:e.task.progress||0,currentTimeScale:e.currentTimeScale,rowHeight:e.rowHeight,dayWidth:e.dayWidth})),tt=i.computed(()=>(e.task.progress||0)>=100),lt=i.computed(()=>e.isInHighlightMode&&!e.isHighlighted&&!e.isPrimaryHighlight),Q=i.computed(()=>{const q=e.task.progress||0,me=parseInt(Ae.value.width);return`${q/100*me}px`}),De=i.computed(()=>e.dayWidth<=9),pe=i.computed(()=>parseFloat(Ae.value.width||"0")<80),ge=i.computed(()=>De.value&&pe.value),Ee=(q,me)=>{if(e.isHighlighted||e.isPrimaryHighlight||e.allowDragAndResize===!1||tt.value||e.isParent||B.value||(q.preventDefault(),q.stopPropagation(),se.value=null,le.value=!1,X.value=!1,Z.value=me,G.value=!1,T.value&&(clearTimeout(T.value),T.value=null),me==="drag"&&(T.value=window.setTimeout(()=>{!le.value&&!F.value&&!E.value&&!k.value&&(G.value=!0,r("long-press",e.task.id)),T.value=null},dF)),l.value.enableDragDelay&&l.value.dragDelayTime?ee.value=window.setTimeout(()=>{X.value=!0,ee.value=null},l.value.dragDelayTime):X.value=!0,!document.querySelector(".timeline")||!I.value))return;const Te=I.value.getBoundingClientRect();re.value=q.clientX-Te.left,j.value=q.clientX,M.value=parseInt(Ae.value.left),O.value=parseInt(Ae.value.width),(me==="resize-left"||me==="resize-right")&&(L.value=q.clientX,R.value=parseInt(Ae.value.width),S.value=parseInt(Ae.value.left)),window.addEventListener("timeline-auto-scroll",xe),document.addEventListener("mousemove",at),document.addEventListener("mouseup",gt)},xe=q=>{const{scrollDelta:me}=q.detail;F.value?j.value-=me:(E.value||k.value)&&(L.value-=me)};let Qe=!1;function Oe(){Qe||(Qe=!0,requestAnimationFrame(()=>{if(Qe=!1,!I.value)return;const q=Date.now();if(q-he.value.timestamp<hF){r("bar-mounted",{id:e.task.id,left:he.value.left,top:he.value.top,width:he.value.width,height:he.value.height});return}const me=I.value.getBoundingClientRect(),Ce={left:me.left,top:me.top,width:me.width,height:me.height};he.value={...Ce,timestamp:q},r("bar-mounted",{id:e.task.id,...Ce})}))}const Ve=i.ref(!1),Re=i.ref({x:0,y:0}),$e=i.ref({startDate:"",endDate:""}),at=q=>{if(!(e.isHighlighted||e.isPrimaryHighlight)&&!(l.value.enableDragDelay&&!X.value)){if(!le.value){if(Math.abs(q.clientX-j.value)<oe.value)return;le.value=!0,Z.value==="drag"?F.value=!0:Z.value==="resize-left"?E.value=!0:Z.value==="resize-right"&&(k.value=!0)}if(le.value){if(window.dispatchEvent(new CustomEvent("drag-boundary-check",{detail:{mouseX:q.clientX,isDragging:F.value||E.value||k.value}})),(F.value||E.value||k.value)&&(Ve.value=!0,Re.value={x:q.clientX+15,y:q.clientY-60}),F.value){const me=q.clientX-j.value;if(e.currentTimeScale===qe.HOUR){const Ce=.6666666666666666,Te=Ce*15,ze=Math.max(0,M.value+me),Ie=Math.round(ze/Te)*Te,Xe=Math.round(Ie/Ce),Ye=new Date(e.startDate);Ye.setHours(0,0,0,0);const st=w(Ye,Xe),vt=c(e.task.startDate)||e.startDate,qt=c(e.task.endDate)||e.startDate;let tr;if(e.task.startDate&&!e.task.startDate.includes(" ")){const Kt=qt.getTime()-vt.getTime();tr=Math.max(1,Math.round(Kt/(1e3*60*60*24))+1)*24*60}else tr=b(vt,qt);const nr=w(st,tr);se.value={startDate:f(st),endDate:f(nr)},$e.value={startDate:f(st),endDate:f(nr)}}else if(e.currentTimeScale===qe.QUARTER){const Ce=Math.max(0,M.value+me);x.value={left:Ce,width:O.value};const Ie=60/90,Xe=Math.round(me/Ie),Ye=c(e.task.startDate)||e.startDate,st=c(e.task.endDate)||e.startDate,vt=new Date(Ye);vt.setDate(vt.getDate()+Xe);const qt=st.getTime()-Ye.getTime(),tr=Math.ceil(qt/(1e3*60*60*24)),nr=new Date(vt);nr.setDate(nr.getDate()+Math.max(0,tr)),se.value={startDate:f(vt),endDate:f(nr)},$e.value={startDate:f(vt),endDate:f(nr)}}else{const Ce=Math.max(0,M.value+me);if((e.currentTimeScale===qe.DAY||e.currentTimeScale===qe.MONTH||e.currentTimeScale===qe.QUARTER||e.currentTimeScale===qe.YEAR)&&e.timelineData){const Te=gA(Ce,e.timelineData,e.currentTimeScale);if(Te){const ze=c(e.task.startDate)||e.startDate,Xe=(c(e.task.endDate)||e.startDate).getTime()-ze.getTime(),Ye=Math.ceil(Xe/(1e3*60*60*24)),st=new Date(Te);st.setDate(st.getDate()+Math.max(0,Ye)),se.value={startDate:f(Te),endDate:f(st)},$e.value={startDate:f(Te),endDate:f(st)}}}else{const Te=v(e.startDate,Ce/e.dayWidth),ze=O.value/e.dayWidth,Ie=v(Te,ze-1);se.value={startDate:f(Te),endDate:f(Ie)},$e.value={startDate:f(Te),endDate:f(Ie)}}}}else if(E.value){const me=q.clientX-L.value;if(e.currentTimeScale===qe.HOUR){const Ce=.6666666666666666,Te=Ce*15,ze=Math.max(0,S.value+me),Ie=Math.round(ze/Te)*Te,Xe=Math.round(Ie/Ce),Ye=new Date(e.startDate);Ye.setHours(0,0,0,0);const st=w(Ye,Xe);se.value={startDate:f(st),endDate:e.task.endDate},$e.value={startDate:f(st),endDate:e.task.endDate||""}}else if(e.currentTimeScale===qe.QUARTER){const Ce=Math.max(0,S.value+me),Te=Math.max(10,R.value-me);x.value={left:Ce,width:Te};const Xe=60/90,Ye=Math.round(me/Xe),st=c(e.task.startDate)||e.startDate,vt=new Date(st);vt.setDate(vt.getDate()+Ye),se.value={startDate:f(vt),endDate:e.task.endDate},$e.value={startDate:f(vt),endDate:e.task.endDate||""}}else{const Ce=Math.max(0,S.value+me);if((e.currentTimeScale===qe.DAY||e.currentTimeScale===qe.MONTH||e.currentTimeScale===qe.QUARTER||e.currentTimeScale===qe.YEAR)&&e.timelineData){const Te=gA(Ce,e.timelineData,e.currentTimeScale);Te&&(se.value={startDate:f(Te),endDate:e.task.endDate},$e.value={startDate:f(Te),endDate:e.task.endDate||""})}else{const Te=v(e.startDate,Ce/e.dayWidth);se.value={startDate:f(Te),endDate:e.task.endDate},$e.value={startDate:f(Te),endDate:e.task.endDate||""}}}}else if(k.value){const me=q.clientX-L.value;if(e.currentTimeScale===qe.HOUR){const Ce=.6666666666666666,Te=Ce*15,ze=Math.max(Te,R.value+me),Ie=Math.round(ze/Te)*Te,Xe=Math.round(Ie/Ce),Ye=c(e.task.startDate)||e.startDate,st=w(Ye,Xe);se.value={startDate:e.task.startDate,endDate:f(st)},$e.value={startDate:e.task.startDate||"",endDate:f(st)}}else if(e.currentTimeScale===qe.QUARTER){const Ce=Math.max(10,R.value+me);x.value={left:S.value,width:Ce};const Ie=60/90,Xe=Math.round(me/Ie),Ye=c(e.task.endDate)||e.startDate,st=new Date(Ye);st.setDate(st.getDate()+Xe),se.value={startDate:e.task.startDate,endDate:f(st)},$e.value={startDate:e.task.startDate||"",endDate:f(st)}}else{const Ce=Math.max(e.dayWidth,R.value+me);if((e.currentTimeScale===qe.DAY||e.currentTimeScale===qe.MONTH||e.currentTimeScale===qe.QUARTER||e.currentTimeScale===qe.YEAR)&&e.timelineData){const Te=S.value+Ce,ze=gA(Te,e.timelineData,e.currentTimeScale);ze&&(se.value={startDate:e.task.startDate,endDate:f(ze)},$e.value={startDate:e.task.startDate||"",endDate:f(ze)})}else{const Te=Ce/e.dayWidth,ze=v(e.startDate,S.value/e.dayWidth+Te-1);se.value={startDate:e.task.startDate,endDate:f(ze)},$e.value={startDate:e.task.startDate||"",endDate:f(ze)}}}}}}},gt=()=>{if(ee.value!==null&&(window.clearTimeout(ee.value),ee.value=null),T.value!==null&&(clearTimeout(T.value),T.value=null),Ve.value=!1,x.value=null,window.dispatchEvent(new CustomEvent("drag-boundary-check",{detail:{mouseX:0,isDragging:!1}})),le.value&&se.value){const q={...e.task,...se.value};F.value?r("drag-end",q):(E.value||k.value)&&r("resize-end",q),r("update:task",q),se.value=null,i.nextTick(()=>{Oe()})}window.removeEventListener("timeline-auto-scroll",xe),(F.value||E.value||k.value)&&(P.value=!0,setTimeout(()=>{P.value=!1},200)),F.value=!1,E.value=!1,k.value=!1,le.value=!1,X.value=!1,Z.value=null,document.removeEventListener("mousemove",at),document.removeEventListener("mouseup",gt)};let mt=null;i.onMounted(()=>{i.nextTick(()=>{Oe(),W.value&&(mt=new ResizeObserver(Ce=>{for(const Te of Ce)z.value=Te.contentRect.width}),mt.observe(W.value))});const q=()=>{i.nextTick(()=>{Oe()})},me=()=>{i.nextTick(()=>{setTimeout(()=>{Oe()},10)})};window.addEventListener("timeline-scale-updated",q),window.addEventListener("timeline-force-recalculate",me),window.addEventListener("close-all-taskbar-menus",Rr),i.onUnmounted(()=>{mt&&(mt.disconnect(),mt=null),window.removeEventListener("timeline-scale-updated",q),window.removeEventListener("timeline-force-recalculate",me),window.removeEventListener("close-all-taskbar-menus",Rr),T.value!==null&&(clearTimeout(T.value),T.value=null)})}),i.watch(()=>[e.task.startDate,e.task.endDate],()=>{i.nextTick(()=>{Oe()})},{deep:!0}),i.watch(()=>[e.isHighlighted,e.isPrimaryHighlight],([q,me])=>{(q||me)&&(F.value=!1,E.value=!1,k.value=!1,le.value=!1,X.value=!1,Z.value=null,Ve.value=!1,document.removeEventListener("mousemove",at),document.removeEventListener("mouseup",gt),window.removeEventListener("timeline-auto-scroll",xe),T.value&&(clearTimeout(T.value),T.value=null),ee.value&&(clearTimeout(ee.value),ee.value=null),window.dispatchEvent(new CustomEvent("taskbar-highlighted",{detail:{taskId:e.task.id}})))});let ht=null;const Bt=q=>{if(!(F.value||E.value||k.value||P.value)){if(G.value){G.value=!1;return}ht===null&&(ht=window.setTimeout(()=>{ht=null,e.onClick&&typeof e.onClick=="function"?e.onClick(e.task,q):r("click",e.task,q)},gF))}},pt=q=>{q.stopPropagation(),q.preventDefault(),ht!==null&&(clearTimeout(ht),ht=null),F.value=!1,E.value=!1,k.value=!1,se.value=null,document.removeEventListener("mousemove",at),document.removeEventListener("mouseup",gt),r("dblclick",e.task,q)},zt=i.computed(()=>{const q=e.scrollLeft||0,me=e.containerWidth||0;if(!q&&!me)return{nameLeft:"",namePosition:"",nameTop:"",progressLeft:"",progressPosition:"",progressTop:"",avatarLeft:"",avatarPosition:""};const Ce=parseInt(Ae.value.left),Te=parseInt(Ae.value.width),ze=Ce+Te,Ie=Ce+Te/2,Xe=q,Ye=q+me;let st="",vt="",qt="",tr="",nr="",Kt="",Gt="",Rt="";const pr=Math.max(z.value,40),dr=35,yr=22,$t=Cr.value,RA=$t+3,cn=Ce+RA,Ln=Ce+RA+yr,bn=cn<Xe&&ze>Xe||Ie<Xe&&ze>Xe,Qr=Math.max(pr,dr),ur=Ln+Qr+15>Ye&&Ce<Ye;let Kr=0;if(bn)Gt=`${Xe-Ce+$t+3}px`,Rt="absolute",Kr=yr+8;else if(ur){const mA=Math.max(pr,dr);Gt=`${Ye-Ce-mA-$t-3-yr-15}px`,Rt="absolute",Kr=-37}const Lr=Ie-pr/2,$r=Ie+pr/2,XA=l.value.showAvatar;let ea=!1;if(XA){const mA=Lr,dn=yr+15;ea=mA<Xe+dn&&ze>Xe}else ea=Lr<Xe&&ze>Xe&&Ie<Xe;const Vn=$r>Ye&&Ce<Ye&&Ie>Ye;if(ea){const mA=Xe-Ce,dn=bn?Kr:0;st=`${mA+$t+3+dn}px`,vt="absolute",qt="2px"}else Vn&&(st=`${Ye-Ce-pr-$t-10}px`,vt="absolute",qt="2px");const un=Ie-dr/2,ta=Ie+dr/2;let kA=!1;if(XA){const mA=un,dn=yr+15;kA=mA<Xe+dn&&ze>Xe}else kA=un<Xe&&ze>Xe&&Ie<Xe;const fn=ta>Ye&&Ce<Ye&&Ie>Ye;if(kA){const mA=Xe-Ce,dn=bn?Kr:0;tr=`${mA+$t+3+dn}px`,nr="absolute",Kt="18px"}else fn&&(tr=`${Ye-Ce-dr-$t-3}px`,nr="absolute",Kt="18px");return{nameLeft:st,namePosition:vt,nameTop:qt,progressLeft:tr,progressPosition:nr,progressTop:Kt,avatarLeft:Gt,avatarPosition:Rt}}),_t=i.computed(()=>{const q=e.scrollLeft||0,me=e.containerWidth||0;if(!me||me<=0)return{show:!1,left:"0px",side:"left",color:"#409eff",animationType:"none"};if(St.value||He.value||e.hideBubbles)return{show:!1,left:"0px",side:"left",color:Pe.value.color,animationType:"none"};const Ce=parseInt(Ae.value.left),Te=parseInt(Ae.value.width),ze=Ce+Te,Ie=q,Xe=q+me,Ye=ze<=Ie,st=Ce>=Xe;return Ye?{show:!0,left:`${Ie-Ce-4}px`,side:"left",color:Pe.value.color,animationType:"morphToSemiCircle"}:st?{show:!0,left:`${Xe-Ce-8}px`,side:"right",color:Pe.value.color,animationType:"morphToSemiCircle"}:{show:!1,left:"0px",side:"left",color:Pe.value.color,animationType:"none"}}),Ut=i.ref(!1),Lt=i.ref({x:0,y:0}),Xt=i.ref(!1),Et=i.ref(null),rr=i.ref(!1),St=i.ref(!0),ye=i.ref(!1),He=i.ref(!1),_e=q=>{q.stopPropagation(),q.preventDefault();const me=e.scrollLeft||0,Ce=e.containerWidth||0;if(!me&&!Ce)return;const Te=parseInt(Ae.value.left),ze=parseInt(Ae.value.width),Xe=Te+ze/2-Ce/2;ye.value=!0,He.value=!0,Ut.value=!1,r("scroll-to-position",Xe)};i.watch(()=>[e.scrollLeft,e.containerWidth],(q,me)=>{const[Ce,Te]=q,[ze,Ie]=me||[0,0],Xe=Ce||0,Ye=Te||0,st=ze||0,vt=Ie||0;if(Math.abs(Ye-vt)>1&&vt>0){rr.value=!0,i.nextTick(()=>{}),St.value&&setTimeout(()=>{St.value=!1},300),setTimeout(()=>{rr.value=!1},500);return}St.value&&Xe>=0&&Ye>0&&setTimeout(()=>{St.value=!1},1e3),Xe!==st&&!rr.value&&(Xt.value=!0,Et.value&&clearTimeout(Et.value),Et.value=setTimeout(()=>{Xt.value=!1,ye.value&&(ye.value=!1,setTimeout(()=>{He.value=!1},300))},200))},{immediate:!0}),i.watch(()=>e.hideBubbles,(q,me)=>{me&&!q&&i.nextTick(()=>{})}),i.watch(()=>_t.value.show,()=>{});const je=()=>{rr.value=!0,i.nextTick(()=>{}),setTimeout(()=>{rr.value=!1},300)};i.onMounted(()=>{window.addEventListener("resize",je),window.addEventListener("zoom",je)}),i.onUnmounted(()=>{document.removeEventListener("mousemove",at),document.removeEventListener("mouseup",gt),window.removeEventListener("resize",je),window.removeEventListener("zoom",je)});const wt=q=>{q.stopPropagation(),Ut.value=!0;const Ce=_t.value.side==="right"?-180:15;Lt.value={x:q.clientX+Ce,y:q.clientY-10}},Qt=q=>{q.stopPropagation(),Ut.value=!1},Tt=q=>{q.stopPropagation(),Ut.value=!1},gr=q=>{if(!q)return o("dateNotSet");const me=c(q);if(!me)return o("dateNotSet");const Ce=me.getFullYear(),Te=String(me.getMonth()+1).padStart(2,"0"),ze=String(me.getDate()).padStart(2,"0");return`${Ce}-${Te}-${ze}`},Or=i.computed(()=>{const q=c(e.task.startDate),me=c(e.task.endDate);let Ce=0;if(q&&me){const Ie=Math.abs(me.getTime()-q.getTime());Ce=Math.ceil(Ie/(1e3*60*60*24))*8}const Te=e.task.progress||0,ze=Math.round(Ce*Te/100);return{total:Ce,used:ze}}),Ft=i.computed(()=>!0),hA=()=>{const q=zt.value,me={};return q.nameLeft&&(me.left=q.nameLeft),q.namePosition&&(me.position=q.namePosition),q.nameTop&&(me.top=q.nameTop),me},lA=()=>{const q=zt.value,me={};return q.progressLeft&&(me.left=q.progressLeft),q.progressPosition&&(me.position=q.progressPosition),q.progressTop&&(me.top=q.progressTop),me},cA=()=>{const q=zt.value,me={};return q.avatarLeft&&(me.left=q.avatarLeft),q.avatarPosition&&(me.position=q.avatarPosition),me},xr=i.computed(()=>parseInt(Ae.value.width)-10<22),fr=i.computed(()=>({width:`${Math.min(l.value.resizeHandleWidth??5,15)}px`})),Cr=i.computed(()=>Math.min(l.value.resizeHandleWidth??5,15)),Er=(q,me,Ce)=>{var ze;let Te=0;for(const Ie of me)if(Ce===qe.DAY){const Xe=Ie.days||[];for(let Ye=0;Ye<Xe.length;Ye++){const st=Xe[Ye],vt=new Date(st.date);if(vt.getFullYear()===q.getFullYear()&&vt.getMonth()===q.getMonth()&&vt.getDate()===q.getDate())return Te+Ye*30}Te+=Xe.length*30}else if(Ce===qe.QUARTER){const Xe=Ie.quarters||[];for(const Ye of Xe){const st=new Date(Ye.startDate),vt=new Date(Ye.endDate);if(q>=st&&q<=vt){const nr=60/Math.ceil((vt.getTime()-st.getTime())/864e5),Kt=Math.ceil((q.getTime()-st.getTime())/(1e3*60*60*24));return Te+Kt*nr}Te+=60}}else if(Ce===qe.WEEK){const Xe=Ie.weeks||[];for(const Ye of Xe){const st=new Date(Ye.weekStart),vt=new Date(Ye.weekEnd);if(q>=st&&q<=vt){const tr=Ye.subDays||[],nr=60/7;for(let Gt=0;Gt<tr.length;Gt++){const Rt=tr[Gt],pr=new Date(Rt.date);if(pr.getFullYear()===q.getFullYear()&&pr.getMonth()===q.getMonth()&&pr.getDate()===q.getDate())return Te+Gt*nr}const Kt=q.getDay();return Te+Kt*nr}Te+=60}}else if(Ce===qe.MONTH){const Xe=new Date(Ie.startDate),Ye=new Date(Ie.endDate);if(q>=Xe&&q<=Ye){const qt=60/(((ze=Ie.monthData)==null?void 0:ze.dayCount)||30),tr=q.getDate();return Te+(tr-1)*qt}Te+=60}else if(Ce===qe.YEAR){const Xe=Ie.halfYears||[];for(const Ye of Xe){const st=new Date(Ye.startDate),vt=new Date(Ye.endDate);if(q>=st&&q<=vt){const nr=180/Math.ceil((vt.getTime()-st.getTime())/864e5),Kt=Math.ceil((q.getTime()-st.getTime())/(1e3*60*60*24));return Te+Kt*nr}Te+=180}}return Ce===qe.WEEK?(console.warn("[Gantt Debug] 周视图定位失败,任务日期未找到 week 匹配,返回 -1",{targetDate:q}),-1):Te},gA=(q,me,Ce)=>{var ze;if(!me)return null;let Te=0;if(Ce===qe.DAY)for(const Ie of me){const Xe=Ie.days||[],Ye=Xe.length*30;if(q>=Te&&q<Te+Ye){const st=q-Te,vt=Math.floor(st/30);if(vt>=0&&vt<Xe.length)return new Date(Xe[vt].date)}Te+=Ye}else if(Ce===qe.MONTH)for(const Ie of me){if(q>=Te&&q<Te+60){const Ye=q-Te,st=((ze=Ie.monthData)==null?void 0:ze.dayCount)||30,vt=60/st,qt=Math.floor(Ye/vt),tr=Math.min(qt+1,st);return new Date(Ie.year,Ie.month-1,tr)}Te+=60}else if(Ce===qe.QUARTER)for(const Ie of me){const Xe=Ie.quarters||[];for(const Ye of Xe){const st=new Date(Ye.startDate),vt=new Date(Ye.endDate),qt=60;if(q>=Te&&q<Te+qt){const tr=q-Te,nr=Math.ceil((vt.getTime()-st.getTime())/(1e3*60*60*24)),Kt=qt/nr,Gt=Math.floor(tr/Kt),Rt=new Date(st);return Rt.setDate(Rt.getDate()+Gt),Rt}Te+=qt}}else if(Ce===qe.YEAR)for(const Ie of me){const Xe=Ie.halfYears||[];for(const Ye of Xe){const st=new Date(Ye.startDate),vt=new Date(Ye.endDate),qt=180;if(q>=Te&&q<Te+qt){const tr=q-Te,nr=Math.ceil((vt.getTime()-st.getTime())/(1e3*60*60*24)),Kt=qt/nr,Gt=Math.floor(tr/Kt),Rt=new Date(st);return Rt.setDate(Rt.getDate()+Gt),Rt}Te+=qt}}return null},uA=i.ref(!1),Br=i.ref({x:0,y:0}),tA=i.computed(()=>e.task);function pA(q){if(e.isHighlighted||e.isPrimaryHighlight){q.preventDefault();return}if(window.dispatchEvent(new CustomEvent("close-all-taskbar-menus")),e.task.type!=="task"&&e.task.type!=="story"){q.preventDefault(),uA.value=!1;return}q.preventDefault(),uA.value=!0,Br.value={x:q.clientX,y:q.clientY}}function Rr(){uA.value=!1}const vA=(q,me)=>{r("delete",q,me),Rr()},ln=q=>{r("delete-link",q),Rr()},Ct=q=>{r("link-drag-start",q)},Be=q=>{r("link-drag-move",q)},$=q=>{r("link-drag-end",q)},de=q=>{const me={clientX:q.x,clientY:q.y};Ct({task:e.task,type:q.type,mouseEvent:me})},Ke=q=>{Be({mouseX:q.x,mouseY:q.y})},rt=q=>{$({task:e.task,type:q.type})};return i.onMounted(()=>{window.addEventListener("close-all-taskbar-menus",Rr)}),i.onUnmounted(()=>{window.removeEventListener("close-all-taskbar-menus",Rr),ht!==null&&(clearTimeout(ht),ht=null)}),(q,me)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[Fe.value?(i.openBlock(),i.createElementBlock("div",{key:0,ref_key:"barRef",ref:I,class:i.normalizeClass(["task-bar",{dragging:F.value,resizing:E.value||k.value,completed:tt.value,"parent-task":q.isParent,"week-view":De.value,"short-task-bar":pe.value,"overflow-effect":ge.value,highlighted:q.isHighlighted,"primary-highlight":q.isPrimaryHighlight,dimmed:lt.value}]),"data-task-id":q.task.id,style:i.normalizeStyle({...Ae.value,backgroundColor:Pe.value.bgColor,borderColor:Pe.value.borderColor,color:Pe.value.color,cursor:tt.value||q.isParent?"default":"move","--row-height":`${q.rowHeight}px`,"--handle-width":`${Cr.value}px`}),onClick:Bt,onContextmenu:pA,onDblclick:pt,onMouseenter:me[7]||(me[7]=Ce=>N.value=!0),onMouseleave:me[8]||(me[8]=Ce=>N.value=!1)},[q.isParent?(i.openBlock(),i.createElementBlock("div",O4,[s.value?i.renderSlot(q.$slots,"custom-task-content",i.normalizeProps(i.mergeProps({key:0},Ze.value)),void 0,!0):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(q.task.name)+" ("+i.toDisplayString(q.task.progress||0)+"%) ",1)],64))])):i.createCommentVNode("",!0),!q.isParent&&q.task.progress&&q.task.progress>0?(i.openBlock(),i.createElementBlock("div",{key:1,class:"progress-bar",style:i.normalizeStyle({width:Q.value,backgroundColor:Pe.value.color})},null,4)):i.createCommentVNode("",!0),!tt.value&&!q.isParent&&!B.value&&e.allowDragAndResize!==!1&&!q.isHighlighted&&!q.isPrimaryHighlight?(i.openBlock(),i.createElementBlock("div",{key:2,class:"resize-handle resize-handle-left",style:i.normalizeStyle(fr.value),onMousedown:me[0]||(me[0]=Ce=>Ee(Ce,"resize-left"))},null,36)):i.createCommentVNode("",!0),q.isParent?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",{key:3,class:"task-bar-content",style:i.normalizeStyle({cursor:B.value||e.allowDragAndResize===!1||q.isHighlighted||q.isPrimaryHighlight?"grab":"move"}),onMousedown:me[1]||(me[1]=Ce=>{q.isHighlighted||q.isPrimaryHighlight||B.value||e.allowDragAndResize===!1||Ee(Ce,"drag")})},[l.value.showAvatar?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["task-avatar",{"avatar-outside":xr.value,"avatar-default":!q.task.avatar}]),style:i.normalizeStyle(cA())},[q.task.avatar?(i.openBlock(),i.createElementBlock("img",{key:0,src:q.task.avatar,alt:q.task.assignee||"avatar"},null,8,R4)):q.task.assigneeName?(i.openBlock(),i.createElementBlock("span",H4,i.toDisplayString(q.task.assigneeName.charAt(0).toUpperCase()),1)):(i.openBlock(),i.createElementBlock("svg",P4,me[9]||(me[9]=[i.createElementVNode("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z",fill:"currentColor"},null,-1)])))],6)):i.createCommentVNode("",!0),l.value.showTitle?(i.openBlock(),i.createElementBlock("div",{key:1,ref_key:"taskBarNameRef",ref:W,style:i.normalizeStyle(hA())},[s.value?i.renderSlot(q.$slots,"custom-task-content",i.normalizeProps(i.mergeProps({key:0},Ze.value)),void 0,!0):(i.openBlock(),i.createElementBlock("div",V4,i.toDisplayString(q.task.name),1))],4)):i.createCommentVNode("",!0),l.value.showProgress&&Ft.value?(i.openBlock(),i.createElementBlock("div",{key:2,class:"task-progress",style:i.normalizeStyle(lA())},i.toDisplayString(q.task.progress||0)+"% ",5)):i.createCommentVNode("",!0)],36)),!tt.value&&!q.isParent&&!B.value&&e.allowDragAndResize!==!1&&!q.isHighlighted&&!q.isPrimaryHighlight?(i.openBlock(),i.createElementBlock("div",{key:4,class:"resize-handle resize-handle-right",style:i.normalizeStyle(fr.value),onMousedown:me[2]||(me[2]=Ce=>Ee(Ce,"resize-right"))},null,36)):i.createCommentVNode("",!0),!q.isParent&&!q.isInHighlightMode?(i.openBlock(),i.createBlock(jv,{key:5,type:"predecessor","task-id":q.task.id,visible:N.value,"is-drag-source":q.isLinkDragSource&&q.dragLinkMode==="predecessor","is-drag-target":q.isValidLinkTarget||q.isInvalidLinkTarget,"is-valid-target":q.isValidLinkTarget,"global-dragging":!!q.dragLinkMode,onDragStart:de,onDragMove:Ke,onDragEnd:rt},null,8,["task-id","visible","is-drag-source","is-drag-target","is-valid-target","global-dragging"])):i.createCommentVNode("",!0),!q.isParent&&!q.isInHighlightMode?(i.openBlock(),i.createBlock(jv,{key:6,type:"successor","task-id":q.task.id,visible:N.value,"is-drag-source":q.isLinkDragSource&&q.dragLinkMode==="successor","is-drag-target":q.isValidLinkTarget||q.isInvalidLinkTarget,"is-valid-target":q.isValidLinkTarget,"global-dragging":!!q.dragLinkMode,onDragStart:de,onDragMove:Ke,onDragEnd:rt},null,8,["task-id","visible","is-drag-source","is-drag-target","is-valid-target","global-dragging"])):i.createCommentVNode("",!0),_t.value.show&&!q.isParent?(i.openBlock(),i.createElementBlock("div",{key:7,class:i.normalizeClass(["bubble-indicator",[`bubble-${_t.value.side}`,`bubble-animation-${_t.value.animationType}`]]),style:i.normalizeStyle({left:_t.value.left,backgroundColor:_t.value.color,borderColor:_t.value.color}),onMouseenter:i.withModifiers(wt,["stop"]),onMouseleave:i.withModifiers(Qt,["stop"]),onMousedown:i.withModifiers(Tt,["stop"]),onClick:i.withModifiers(_e,["stop"])},null,38)):i.createCommentVNode("",!0),i.createVNode(Ay,{visible:uA.value,task:tA.value,position:Br.value,"all-tasks":q.allTasks,onClose:Rr,onStartTimer:me[3]||(me[3]=Ce=>q.$emit("start-timer",e.task)),onStopTimer:me[4]||(me[4]=Ce=>q.$emit("stop-timer",e.task)),onAddPredecessor:me[5]||(me[5]=Ce=>q.$emit("add-predecessor",e.task)),onAddSuccessor:me[6]||(me[6]=Ce=>q.$emit("add-successor",e.task)),onDelete:vA,onDeleteLink:ln},null,8,["visible","task","position","all-tasks"])],46,M4)):i.createCommentVNode("",!0),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[Ut.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"task-tooltip",style:i.normalizeStyle({left:`${Lt.value.x}px`,top:`${Lt.value.y}px`})},[me[10]||(me[10]=i.createElementVNode("div",{class:"tooltip-arrow"},null,-1)),i.createElementVNode("div",K4,i.toDisplayString(q.task.name),1),i.createElementVNode("div",q4,[i.createElementVNode("div",j4,[i.createElementVNode("span",W4,i.toDisplayString(o("startDate"))+":",1),i.createElementVNode("span",G4,i.toDisplayString(gr(q.task.startDate)),1)]),i.createElementVNode("div",Y4,[i.createElementVNode("span",z4,i.toDisplayString(o("endDate"))+":",1),i.createElementVNode("span",$4,i.toDisplayString(gr(q.task.endDate)),1)]),i.createElementVNode("div",X4,[i.createElementVNode("span",J4,i.toDisplayString(o("estimatedHours"))+":",1),i.createElementVNode("span",Z4,i.toDisplayString(Or.value.total)+"h",1)]),i.createElementVNode("div",eF,[i.createElementVNode("span",tF,i.toDisplayString(o("actualHours"))+":",1),i.createElementVNode("span",rF,i.toDisplayString(Or.value.used)+"h",1)]),i.createElementVNode("div",AF,[i.createElementVNode("span",nF,i.toDisplayString(o("progress"))+":",1),i.createElementVNode("span",aF,i.toDisplayString(q.task.progress||0)+"%",1)])])],4)):i.createCommentVNode("",!0)])),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[Ve.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"drag-tooltip",style:i.normalizeStyle({left:`${Re.value.x}px`,top:`${Re.value.y}px`})},[i.createElementVNode("div",iF,[i.createElementVNode("div",sF,[i.createElementVNode("span",oF,i.toDisplayString(o("startDate"))+":",1),i.createElementVNode("span",lF,i.toDisplayString(gr($e.value.startDate)),1)]),i.createElementVNode("div",cF,[i.createElementVNode("span",uF,i.toDisplayString(o("endDate"))+":",1),i.createElementVNode("span",fF,i.toDisplayString(gr($e.value.endDate)),1)])])],4)):i.createCommentVNode("",!0)]))],64))}}),iy=sn(pF,[["__scopeId","data-v-d1be80c8"]]),vF=["title"],mF={key:0,transform:"rotate(45 16 16)"},wF=["fill","stroke"],BF={key:1},yF={key:2,transform:"rotate(45 16 16)"},bF=["fill","stroke"],CF={key:1,class:"milestone-label milestone-label-right"},EF={class:"tooltip-content"},FF=i.defineComponent({__name:"MilestonePoint",props:{date:{},milestone:{},name:{},rowHeight:{},dayWidth:{},startDate:{},timelineStart:{},timelineEnd:{},scrollLeft:{},containerWidth:{},milestoneId:{},otherMilestones:{},currentTimeScale:{},timelineData:{},periodWidth:{},isInHighlightMode:{type:Boolean},allowDragAndResize:{type:Boolean}},emits:["milestone-double-click","update:milestone","drag-end"],setup(A,{emit:t}){const e=A,r=t,{getTranslation:n}=ga(),a=Z=>n(Z),o=i.ref(!1),s=i.ref(0),l=i.ref(0),c=i.ref(null),u=Z=>{if(Z.preventDefault(),Z.stopPropagation(),!(O.value.isSticky||O.value.isPushedOut||!O.value.showIcon))if(o.value=!1,c.value=null,document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",B),e.milestone)r("milestone-double-click",e.milestone);else{const ee={name:e.name||"里程碑",startDate:e.date,type:"milestone"};r("milestone-double-click",ee)}},g=(Z,ee)=>{const X=new Date(Z);return X.setDate(X.getDate()+ee),X},p=Z=>{const ee=Z.getFullYear(),X=String(Z.getMonth()+1).padStart(2,"0"),re=String(Z.getDate()).padStart(2,"0");return`${ee}-${X}-${re}`},f=(Z,ee,X)=>{var se;if(!ee)return null;let re=0;if(X===qe.DAY)for(const x of ee){const I=x.days||[],W=I.length*30;if(Z>=re&&Z<re+W){const z=Z-re,Ae=Math.floor(z/30);if(Ae>=0&&Ae<I.length)return new Date(I[Ae].date)}re+=W}else if(X===qe.MONTH)for(const x of ee){if(Z>=re&&Z<re+60){const W=Z-re,z=((se=x.monthData)==null?void 0:se.dayCount)||30,Ae=60/z,he=Math.floor(W/Ae),fe=Math.min(he+1,z);return new Date(x.year,x.month-1,fe)}re+=60}else if(X===qe.QUARTER)for(const x of ee){const I=x.quarters||[];for(const W of I){const z=new Date(W.startDate),Ae=new Date(W.endDate),he=60;if(Z>=re&&Z<re+he){const fe=Z-re,ce=Math.ceil((Ae.getTime()-z.getTime())/(1e3*60*60*24)),Fe=he/ce,Pe=Math.floor(fe/Fe),Ze=new Date(z);return Ze.setDate(Ze.getDate()+Pe),Ze}re+=he}}return null},v=Z=>{e.allowDragAndResize===!1||e.currentTimeScale===qe.YEAR||O.value.isSticky||O.value.isPushedOut||!O.value.showIcon||(Z.preventDefault(),Z.stopPropagation(),!document.querySelector(".timeline"))||(s.value=Z.clientX,l.value=parseInt(k.value.left),c.value=null,window.addEventListener("timeline-auto-scroll",w),document.addEventListener("mousemove",b),document.addEventListener("mouseup",B))},w=Z=>{const{scrollDelta:ee}=Z.detail;o.value&&(s.value-=ee)},b=Z=>{window.dispatchEvent(new CustomEvent("drag-boundary-check",{detail:{mouseX:Z.clientX,isDragging:o.value}}));const ee=Z.clientX-s.value;if(Math.abs(ee)>3){o.value=!0;const X=Math.max(0,l.value+ee);let re;if(e.currentTimeScale===qe.MONTH||e.currentTimeScale===qe.QUARTER||e.currentTimeScale===qe.DAY)if(e.timelineData&&e.currentTimeScale){const se=f(X,e.timelineData,e.currentTimeScale);se?re=se:re=g(e.startDate,X/e.dayWidth)}else re=g(e.startDate,X/e.dayWidth);else re=g(e.startDate,X/e.dayWidth);c.value={startDate:p(re)}}},B=()=>{if(window.dispatchEvent(new CustomEvent("drag-boundary-check",{detail:{mouseX:0,isDragging:!1}})),o.value&&c.value&&e.milestone){const Z={...e.milestone,...c.value};r("update:milestone",Z),r("drag-end",Z)}window.removeEventListener("timeline-auto-scroll",w),o.value=!1,c.value=null,document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",B)},F=Z=>{if(Z.preventDefault(),Z.stopPropagation(),o.value||O.value.isPushedOut||!O.value.showIcon||O.value.isFullyVisible)return;const ee=e.containerWidth||0,X=parseInt(k.value.left)+12;if(ee>0){const re=Math.max(0,X-ee/2);window.dispatchEvent(new CustomEvent("milestone-click-locate",{detail:{scrollLeft:re,smooth:!0}}))}},E=i.computed(()=>e.isInHighlightMode===!0),k=i.computed(()=>{var se;const Z=((se=c.value)==null?void 0:se.startDate)||e.date,ee=xE(Z);if(!e.startDate||!ee||isNaN(ee.getTime()))return{left:"0px",top:"0px",width:"auto",height:"auto"};let X=0,re=24;return e.currentTimeScale===qe.YEAR||e.currentTimeScale===qe.QUARTER?re=Math.min(e.rowHeight,24):e.currentTimeScale===qe.MONTH?re=Math.min(e.rowHeight,20):e.currentTimeScale===qe.WEEK?re=Math.min(e.rowHeight,Math.max(e.dayWidth*.8,16),24):re=Math.min(e.rowHeight,e.dayWidth*1.2,24),e.currentTimeScale===qe.HOUR?X=oe(ee,e.startDate)-re/2:e.timelineData&&e.currentTimeScale&&(e.currentTimeScale===qe.WEEK||e.currentTimeScale===qe.MONTH||e.currentTimeScale===qe.DAY||e.currentTimeScale===qe.QUARTER||e.currentTimeScale===qe.YEAR)?X=le(ee,e.timelineData,e.currentTimeScale)-re/2:X=Math.floor((ee.getTime()-e.startDate.getTime())/864e5)*e.dayWidth+e.dayWidth/2-re/2,{left:`${X}px`,top:`${(e.rowHeight-re)/2}px`,width:"auto",height:"auto"}}),P=i.computed(()=>"var(--gantt-danger, #f56c6c)"),j=i.computed(()=>"var(--gantt-danger-light, #fab6b6)"),M=i.computed(()=>{var Z;return((Z=e.milestone)==null?void 0:Z.icon)||"diamond"}),O=i.computed(()=>{const Z=e.scrollLeft||0,ee=e.containerWidth||0;if(!ee||ee<=0)return{showIcon:!0,showLabel:!0,isSticky:!1,stickyPosition:"none",iconLeft:"0px",isPushedOut:!1,clipPath:"none",isFullyVisible:!0};const X=parseInt(k.value.left)+12,re=Z,se=Z+ee,x=24,I=X-x/2,W=X+x/2,z=e.milestoneId,Ae=I>=re&&W<=se,he=e.otherMilestones||[];if(W<=re+x/2){const fe=he.filter(ce=>ce.id!==z&&ce.stickyPosition==="left"&&ce.isSticky);if(fe.length>0){const ce=parseInt(k.value.left)+12;if(fe.some(Pe=>Pe.originalLeft>ce))return{showIcon:!1,showLabel:!1,isSticky:!1,stickyPosition:"none",iconLeft:"0px",isPushedOut:!0,clipPath:"none",isFullyVisible:!1}}return{showIcon:!0,showLabel:!1,isSticky:!0,stickyPosition:"left",iconLeft:`${re-parseInt(k.value.left)-x/2}px`,isPushedOut:!1,clipPath:"polygon(50% 0%, 100% 0%, 100% 100%, 50% 100%)",isFullyVisible:!1}}if(I>=se-x/2){const fe=he.filter(ce=>ce.id!==z&&ce.stickyPosition==="right"&&ce.isSticky);if(fe.length>0){const ce=parseInt(k.value.left)+12;if(fe.some(Pe=>Pe.originalLeft<ce))return{showIcon:!1,showLabel:!1,isSticky:!1,stickyPosition:"none",iconLeft:"0px",isPushedOut:!0,clipPath:"none",isFullyVisible:!1}}return{showIcon:!0,showLabel:!1,isSticky:!0,stickyPosition:"right",iconLeft:`${se-parseInt(k.value.left)-x/2}px`,isPushedOut:!1,clipPath:"polygon(0% 0%, 50% 0%, 50% 100%, 0% 100%)",isFullyVisible:!1}}return{showIcon:!0,showLabel:!0,isSticky:!1,stickyPosition:"none",iconLeft:"0px",isPushedOut:!1,clipPath:"none",isFullyVisible:Ae}}),L=i.ref(!1),R=i.ref({x:0,y:0}),S=Z=>{var ee;if(O.value.isSticky&&O.value.showIcon&&!O.value.isPushedOut){L.value=!0;const X=!e.milestone||((ee=e.milestone)==null?void 0:ee.icon)==="diamond"?-300:-270,re=O.value.stickyPosition==="left"?10:X;R.value={x:Z.clientX+re,y:Z.clientY-10}}},T=()=>{L.value=!1},G=Z=>{if(!Z)return a("dateNotSet");try{const ee=new Date(Z);if(isNaN(ee.getTime()))return a("dateNotSet");const X=ee.getFullYear(),re=String(ee.getMonth()+1).padStart(2,"0"),se=String(ee.getDate()).padStart(2,"0");return`${X}-${re}-${se}`}catch{return a("dateNotSet")}},N=i.computed(()=>{var X,re;const Z=e.name||((X=e.milestone)==null?void 0:X.name)||a("milestone"),ee=G(e.date||((re=e.milestone)==null?void 0:re.startDate)||"");return`${a("milestone")}:${Z} - ${a("targetDate")}:${ee}`});i.onUnmounted(()=>{o.value=!1,c.value=null,document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",B)});const oe=(Z,ee)=>{const X=new Date(Z.getFullYear(),Z.getMonth(),Z.getDate()),re=new Date(ee.getFullYear(),ee.getMonth(),ee.getDate()),se=X.getTime()-re.getTime(),W=Math.floor(se/(1e3*60*60*24))*960,Ae=Z.getHours()*40,fe=Z.getMinutes()/60*40;return W+Ae+fe},le=(Z,ee,X)=>{var se;let re=0;for(const x of ee)if(X===qe.DAY){const I="days"in x&&x.days?x.days:[];for(let W=0;W<I.length;W++){const z=I[W],Ae=new Date(z.date);if(Ae.getFullYear()===Z.getFullYear()&&Ae.getMonth()===Z.getMonth()&&Ae.getDate()===Z.getDate())return re+W*30+15}re+=I.length*30}else if(X===qe.QUARTER){const I="quarters"in x&&x.quarters?x.quarters:[];for(const W of I){const z=new Date(W.startDate),Ae=new Date(W.endDate);if(Z>=z&&Z<=Ae){const ce=60/Math.ceil((Ae.getTime()-z.getTime())/864e5),Fe=Math.ceil((Z.getTime()-z.getTime())/(1e3*60*60*24));return re+Fe*ce+ce/2}re+=60}}else if(X===qe.YEAR){const I="halfYears"in x&&x.halfYears?x.halfYears:[];for(const W of I){const z=new Date(W.startDate),Ae=new Date(W.endDate);if(Z>=z&&Z<=Ae){const ce=180/Math.ceil((Ae.getTime()-z.getTime())/864e5),Fe=Math.ceil((Z.getTime()-z.getTime())/(1e3*60*60*24));return re+Fe*ce+ce/2}re+=180}}else if(X===qe.WEEK){const I="weeks"in x&&x.weeks?x.weeks:[];for(const W of I){const z=new Date(W.weekStart),Ae=new Date(W.weekEnd);if(Z>=z&&Z<=Ae){const fe=W.subDays||[],ce=60/7;for(let Ze=0;Ze<fe.length;Ze++){const tt=fe[Ze],lt=new Date(tt.date);if(lt.getFullYear()===Z.getFullYear()&<.getMonth()===Z.getMonth()&<.getDate()===Z.getDate())return re+Ze*ce+ce/2}const Fe=Z.getDay(),Pe=Fe===0?6:Fe-1;return re+Pe*ce+ce/2}re+=60}}else if(X===qe.MONTH){if(!("startDate"in x)||!("endDate"in x))continue;const I=new Date(x.startDate),W=new Date(x.endDate);if(Z>=I&&Z<=W){const he=60/("monthData"in x&&((se=x.monthData)==null?void 0:se.dayCount)||30),fe=Z.getDate();return re+(fe-1)*he+he/2}re+=60}return re};return(Z,ee)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createElementVNode("div",{class:i.normalizeClass(["milestone",{dragging:o.value,"milestone-sticky":O.value.isSticky,"milestone-sticky-left":O.value.stickyPosition==="left","milestone-sticky-right":O.value.stickyPosition==="right","milestone-pushed-out":O.value.isPushedOut,dimmed:E.value}]),style:i.normalizeStyle(k.value),title:O.value.isSticky?"":e.name||"里程碑",onClick:i.withModifiers(F,["stop"])},[O.value.showIcon?(i.openBlock(),i.createElementBlock("svg",{key:0,width:24,height:24,viewBox:"0 0 24 24",style:i.normalizeStyle([{position:O.value.isSticky?"relative":"static",left:O.value.isSticky?O.value.iconLeft:"0px",clipPath:O.value.clipPath,zIndex:O.value.isSticky?200:120},{cursor:"pointer"}]),onMouseenter:S,onMouseleave:T,onClick:i.withModifiers(F,["stop"]),onDblclick:i.withModifiers(u,["stop"]),onMousedown:i.withModifiers(v,["stop"])},[M.value==="diamond"?(i.openBlock(),i.createElementBlock("g",mF,[i.createElementVNode("rect",{x:"4",y:"8",width:"15",height:"15",rx:"6",ry:"6",fill:P.value,stroke:j.value,"stroke-width":"2"},null,8,wF)])):M.value==="rocket"?(i.openBlock(),i.createElementBlock("g",BF,ee[0]||(ee[0]=[i.createElementVNode("foreignObject",{x:"0",y:"0",width:"24",height:"24"},[i.createElementVNode("div",{class:"rocket-emoji"},"🚀")],-1)]))):(i.openBlock(),i.createElementBlock("g",yF,[i.createElementVNode("rect",{x:"4",y:"8",width:"15",height:"15",rx:"6",ry:"6",fill:P.value,stroke:j.value,"stroke-width":"2"},null,8,bF)]))],36)):i.createCommentVNode("",!0),e.name&&O.value.showLabel?(i.openBlock(),i.createElementBlock("span",CF,i.toDisplayString(e.name),1)):i.createCommentVNode("",!0)],14,vF),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[L.value&&O.value.isSticky?(i.openBlock(),i.createElementBlock("div",{key:0,class:"milestone-tooltip",style:i.normalizeStyle({left:`${R.value.x}px`,top:`${R.value.y}px`})},[i.createElementVNode("div",EF,i.toDisplayString(N.value),1)],4)):i.createCommentVNode("",!0)]))],64))}}),vg=sn(FF,[["__scopeId","data-v-0427278d"]]);class sy{constructor(){kr(this,"cachedCtx",null);kr(this,"cachedWidth",0);kr(this,"cachedHeight",0);kr(this,"isUniApp",!1);this.isUniApp=typeof window<"u"&&!!window.uni}get isUniAppEnvironment(){return this.isUniApp}getContext(t){const{canvas:e,canvasId:r,width:n,height:a,contextOptions:o}=t;if(!this.cachedCtx||this.cachedWidth!==n||this.cachedHeight!==a){let s=null;if(this.isUniApp&&window.uni)s=window.uni.createCanvasContext(r);else{if(!e)return null;const l=window.devicePixelRatio||1;if(s=e.getContext("2d",o||{alpha:!0}),!s)return null;const c=n*l,u=a*l;e.width=c,e.height=u,s.scale(l,l)}if(!s)return null;this.cachedCtx=s,this.cachedWidth=n,this.cachedHeight=a}return this.cachedCtx}clear(t,e){this.cachedCtx&&this.cachedCtx.clearRect(0,0,t,e)}draw(){var t;this.isUniApp&&((t=this.cachedCtx)!=null&&t.draw)&&this.cachedCtx.draw()}reset(){this.cachedCtx=null,this.cachedWidth=0,this.cachedHeight=0}}const kF=i.defineComponent({__name:"GanttLinks",props:{tasks:{},taskBarPositions:{},width:{},height:{},offsetLeft:{default:0},offsetTop:{default:0},highlightedTaskId:{},highlightedTaskIds:{},hoveredTaskId:{},verticalLines:{default:()=>[]},showVerticalLines:{type:Boolean,default:!0}},setup(A,{expose:t}){const e=A,r=i.ref(null),n=new sy;let a=null,o=!1,s=null;const l=i.ref(document.documentElement.getAttribute("data-theme")==="dark"),c=()=>{l.value=document.documentElement.getAttribute("data-theme")==="dark",p()},u=()=>{const f=n.getContext({canvas:r.value,canvasId:"gantt-link-canvas",width:e.width,height:e.height,contextOptions:{alpha:!0}});if(!f){console.error("❌ Canvas context 获取失败,可能是尺寸超限");return}const v=e.width,w=e.height;if(f.clearRect(0,0,v,w),e.showVerticalLines&&e.verticalLines&&e.verticalLines.length>0){f.save();const R=l.value?"#66b1ff":"#409eff";f.strokeStyle=R,f.lineWidth=1,f.beginPath();for(const S of e.verticalLines){const T=S.left-e.offsetLeft;T>=0&&T<=v&&(f.moveTo(T,0),f.lineTo(T,w))}f.stroke(),f.restore()}const b=new Set;for(const R of e.tasks)b.add(R.id);const B=e.highlightedTaskId!==null,F=e.offsetLeft,E=e.offsetLeft+v,k=e.offsetTop,P=e.offsetTop+w,j=[],M=[],O=[],L=[];for(const R of e.tasks){if(!R.predecessor||!e.taskBarPositions[R.id])continue;const S=la(R.predecessor);for(const T of S){const G=e.taskBarPositions[T],N=e.taskBarPositions[R.id];if(!G||!N||!b.has(T))continue;const oe=e.highlightedTaskId===T,le=e.highlightedTaskId===R.id,Z=e.highlightedTaskIds.has(T),ee=e.highlightedTaskIds.has(R.id),X=Z&&ee,re=e.hoveredTaskId===T,se=e.hoveredTaskId===R.id,x=re||se,I=oe?-8:Z?-5:0,W=le?-8:ee?-5:0,z=G.left+G.width,Ae=G.top+G.height/2+I,he=N.left,fe=N.top+N.height/2+W,ce=Math.min(z,he),Fe=Math.max(z,he),Pe=Math.min(Ae,fe),Ze=Math.max(Ae,fe);if(Fe<F||ce>E||Ze<k||Pe>P)continue;const tt=z-e.offsetLeft,lt=Ae-e.offsetTop,Q=he-e.offsetLeft,De=fe-e.offsetTop,pe=Q-tt,ge=De-lt,Ee=Math.sqrt(pe*pe+ge*ge),xe=G.width,Qe=G.height,Oe=Math.abs(pe)/(Ee+1),Ve=20;let Re=Qe/2+Ve;Oe<.3?Re=Math.max(Qe/2+25,45):Oe<.6?Re=Qe/2+Ve:Re=xe/3+10;let $e=0;if(Math.abs(ge)>0){const Lt=Qe/2+12,Xt=Math.abs(ge)-Qe,Et=Math.min(Xt*.5,100);$e=Math.max(Lt,Et)}else $e=0;const gt=Oe<.3?.4:.8,mt=tt+Re,ht=lt+(ge>0?$e:-$e)*gt,Bt=Q-Re,pt=De-(ge>0?$e:-$e)*gt,zt=Math.atan2(De-pt,Q-Bt),_t={x1:tt,y1:lt,x2:Q,y2:De,c1x:mt,c1y:ht,c2x:Bt,c2y:pt,arrowAngle:zt};X?j.push(_t):x?M.push(_t):B?L.push(_t):O.push(_t)}}if(f.setLineDash([6,4]),j.length>0){f.strokeStyle="#409eff",f.fillStyle="#409eff",f.lineWidth=4,f.globalAlpha=1,f.beginPath();for(const R of j)f.moveTo(R.x1,R.y1),f.bezierCurveTo(R.c1x,R.c1y,R.c2x,R.c2y,R.x2,R.y2);f.stroke();for(const R of j)g(f,R.x2,R.y2,R.arrowAngle)}if(M.length>0){f.strokeStyle="#67c23a",f.fillStyle="#67c23a",f.lineWidth=3,f.globalAlpha=1,f.beginPath();for(const R of M)f.moveTo(R.x1,R.y1),f.bezierCurveTo(R.c1x,R.c1y,R.c2x,R.c2y,R.x2,R.y2);f.stroke();for(const R of M)g(f,R.x2,R.y2,R.arrowAngle)}if(O.length>0){f.strokeStyle="#c0c4cc",f.fillStyle="#c0c4cc",f.lineWidth=2,f.globalAlpha=1,f.beginPath();for(const R of O)f.moveTo(R.x1,R.y1),f.bezierCurveTo(R.c1x,R.c1y,R.c2x,R.c2y,R.x2,R.y2);f.stroke();for(const R of O)g(f,R.x2,R.y2,R.arrowAngle)}if(L.length>0){f.strokeStyle="#c0c4cc",f.fillStyle="#c0c4cc",f.lineWidth=2,f.globalAlpha=.2,f.beginPath();for(const R of L)f.moveTo(R.x1,R.y1),f.bezierCurveTo(R.c1x,R.c1y,R.c2x,R.c2y,R.x2,R.y2);f.stroke();for(const R of L)g(f,R.x2,R.y2,R.arrowAngle);f.globalAlpha=1}n.draw()},g=(f,v,w,b)=>{f.beginPath(),f.moveTo(v,w),f.lineTo(v-8*Math.cos(b)-4*Math.sin(b),w-8*Math.sin(b)+4*Math.cos(b)),f.lineTo(v-8*Math.cos(b)+4*Math.sin(b),w-8*Math.sin(b)-4*Math.cos(b)),f.closePath(),f.fill()},p=()=>{o||(o=!0,a!==null&&cancelAnimationFrame(a),a=requestAnimationFrame(()=>{o=!1,a=null,u()}))};return i.watch([()=>e.taskBarPositions,()=>e.tasks,()=>e.highlightedTaskId,()=>e.highlightedTaskIds,()=>e.hoveredTaskId,()=>e.width,()=>e.height,()=>e.verticalLines,()=>e.showVerticalLines,()=>e.offsetLeft,()=>e.offsetTop],()=>{p()},{deep:!1}),i.onMounted(()=>{s=new MutationObserver(f=>{for(const v of f)if(v.attributeName==="data-theme"){c();break}}),s.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),i.nextTick(()=>{u()})}),i.onUnmounted(()=>{s&&(s.disconnect(),s=null),a!==null&&(cancelAnimationFrame(a),a=null)}),t({redraw:u}),(f,v)=>(i.openBlock(),i.createElementBlock("canvas",{ref_key:"canvasRef",ref:r,"canvas-id":"gantt-link-canvas",class:"gantt-links-canvas",type:"2d",hidpi:!0,style:i.normalizeStyle({position:"absolute",left:`${f.offsetLeft}px`,top:`${f.offsetTop}px`,width:`${f.width}px`,height:`${f.height}px`,zIndex:f.highlightedTaskId!==null?1001:25,pointerEvents:"none"})},null,4))}}),xF=sn(kF,[["__scopeId","data-v-3f872d3f"]]),SF=i.defineComponent({__name:"LinkDragGuide",props:{active:{type:Boolean},width:{},height:{},offsetLeft:{default:0},offsetTop:{default:0}},setup(A,{expose:t}){const e=A,r=i.ref(null),n=new sy,a=()=>n.getContext({canvas:r.value,canvasId:"link-drag-guide-canvas",width:e.width,height:e.height,contextOptions:{alpha:!0,willReadFrequently:!1}}),o=(l,c,u,g,p=!0,f="")=>{const v=a();if(!v){console.error("[LinkDragGuide] initCanvas returned null");return}const w=e.width,b=e.height;v.clearRect(0,0,w,b);const B=l-e.offsetLeft,F=c-e.offsetTop,E=u-e.offsetLeft,k=g-e.offsetTop,P=100;if(!((B>=-P||E>=-P)&&(B<=w+P||E<=w+P)&&(F>=-P||k>=-P)&&(F<=b+P||k<=b+P)))return;v.save();const M=p?"#67c23a":"#f56c6c";v.strokeStyle=M,v.lineWidth=3,v.globalAlpha=.8,v.beginPath(),v.moveTo(B,F),v.lineTo(E,k),v.stroke();const O=Math.atan2(k-F,E-B),L=8,R=4;if(v.fillStyle=M,v.globalAlpha=1,v.beginPath(),v.moveTo(E,k),v.lineTo(E-L*Math.cos(O)-R*Math.sin(O),k-L*Math.sin(O)+R*Math.cos(O)),v.lineTo(E-L*Math.cos(O)+R*Math.sin(O),k-L*Math.sin(O)-R*Math.cos(O)),v.closePath(),v.fill(),!p&&f){const S=(B+E)/2,T=(F+k)/2-10;v.font="12px Arial, sans-serif";const N=v.measureText(f).width,oe=8;v.fillStyle="rgba(0, 0, 0, 0.75)",v.fillRect(S-N/2-oe,T-12,N+oe*2,24),v.fillStyle="#ffffff",v.textAlign="center",v.textBaseline="middle",v.fillText(f,S,T)}v.restore(),n.draw()},s=()=>{n.clear(e.width,e.height)};return i.watch([()=>e.width,()=>e.height],()=>{n.reset()}),i.watch(()=>e.active,l=>{l||n.reset()}),i.onUnmounted(()=>{n.reset()}),t({draw:o,clear:s}),(l,c)=>l.active?(i.openBlock(),i.createElementBlock("canvas",{key:0,ref_key:"canvasRef",ref:r,"canvas-id":"link-drag-guide-canvas",class:"link-drag-guide-canvas",type:"2d",hidpi:!0,style:i.normalizeStyle({position:"absolute",left:`${l.offsetLeft}px`,top:`${l.offsetTop}px`,width:`${l.width}px`,height:`${l.height}px`,zIndex:1002,pointerEvents:"none"})},null,4)):i.createCommentVNode("",!0)}}),TF=sn(SF,[["__scopeId","data-v-06dab396"]]);performance.now();const UF={class:"timeline-header"},DF={class:"timeline-header-row year-row"},QF={class:"year-label"},LF={class:"timeline-header-row half-years-row"},IF={class:"half-year-label"},NF={class:"timeline-header-row year-row"},_F={class:"year-label"},MF={class:"timeline-header-row months-row"},OF={class:"month-label"},RF={class:"timeline-header-row year-row"},HF={class:"year-label"},PF={class:"timeline-header-row quarters-row"},VF={class:"quarter-label"},KF={class:"timeline-header-row date-row"},qF={class:"date-label"},jF={class:"timeline-header-row hours-row"},WF={class:"hour-label"},GF={class:"timeline-header-row year-month-row"},YF={class:"year-month-label"},zF={class:"flag-content"},$F={class:"timeline-header-row days-row"},XF={class:"week-label"},JF={class:"day-label"},ZF=["onMouseenter"],ek=200,tk=8,rk=4,Mu=40,Wv=10,Gv=51,Yv=5,Ul=5e3,Ak=5e3,zv=50,$v=5,nk=i.defineComponent({__name:"Timeline",props:{tasks:{default:()=>[]},milestones:{default:()=>[]},startDate:{},endDate:{},useDefaultDrawer:{type:Boolean,default:!0},useDefaultMilestoneDialog:{type:Boolean,default:!0},onTaskDelete:{type:Function,default:void 0},onTaskUpdate:{type:Function,default:void 0},onMilestoneDelete:{type:Function,default:void 0},onMilestoneUpdate:{type:Function,default:void 0},onMilestoneSave:{type:Function,default:void 0},workingHours:{default:()=>({morning:{start:8,end:11},afternoon:{start:13,end:17}})},taskBarConfig:{default:void 0},allowDragAndResize:{type:Boolean,default:!0}},emits:["timeline-scale-changed","click-task","edit-task","milestone-double-click","start-timer","stop-timer","add-predecessor","add-successor","predecessor-added","successor-added","delete","link-deleted"],setup(A,{expose:t,emit:e}){const r=A,n=e,{formatYearMonth:a,formatMonth:o,getTranslation:s}=ga(),l=H=>s(H),c=(()=>{const H=new Date,te=new Date(H.getFullYear(),H.getMonth()-6,1),K=new Date(H.getFullYear(),H.getMonth()+6+1,0);return{startDate:te,endDate:K}})(),u=()=>c,g=i.computed(()=>r.startDate?new Date(r.startDate):u().startDate),p=i.computed(()=>r.endDate?new Date(r.endDate):u().endDate),f=i.ref({startDate:g.value,endDate:p.value,zoomLevel:1}),v=i.ref(qe.DAY);i.watch([g,p],([H,te])=>{(r.startDate||r.endDate)&&(Rt||(f.value.startDate=H,f.value.endDate=te))});const w=[],b=i.computed(()=>r.tasks??w),B=i.ref(null),F=i.ref(null),E=i.computed(()=>v.value===qe.HOUR?960:v.value===qe.WEEK?60/7:v.value===qe.MONTH?2:v.value===qe.QUARTER?60/90:v.value===qe.YEAR?360/365:30);let k=null;const P=()=>{k=null},j=()=>{if(!b.value||b.value.length===0)return null;const H=[],te=we=>{if(we.startDate&&H.push(new Date(we.startDate)),we.endDate&&H.push(new Date(we.endDate)),we.children&&we.children.length>0)for(const Ue of we.children)te(Ue)};for(const we of b.value)te(we);if(H.length===0)return null;let K=1/0,ue=-1/0;for(const we of H){const Ue=we.getTime();isNaN(Ue)||(Ue<K&&(K=Ue),Ue>ue&&(ue=Ue))}return K===1/0||ue===-1/0?null:{minDate:new Date(K),maxDate:new Date(ue)}},M=()=>k||(k=j(),k),O=()=>{const H=M(),te=je.value||1200,K=40;if(!H){const kt=new Date;kt.setHours(0,0,0,0);const bt=new Date(kt);bt.setDate(bt.getDate()-1);const ut=new Date(kt);return ut.setDate(ut.getDate()+1),ut.setHours(23,59,59,999),{startDate:bt,endDate:ut}}const{minDate:ue,maxDate:we}=H,Ue=new Date(ue);Ue.setHours(0,0,0,0),Ue.setDate(Ue.getDate()-1);const Ge=new Date(we);Ge.setHours(23,59,59,999),Ge.setDate(Ge.getDate()+1);const We=Math.ceil((Ge.getTime()-Ue.getTime())/(1e3*60*60));if(We*K<te){const kt=Math.ceil(te/K),bt=Math.ceil((kt-We)/2),ut=Math.ceil(bt/24);Ue.setDate(Ue.getDate()-ut),Ge.setDate(Ge.getDate()+ut)}return{startDate:Ue,endDate:Ge}},L=()=>{const H=M(),te=je.value||1200,K=30;if(!H){const kt=new Date,bt=Math.max(Math.ceil(te/K),60),ut=new Date(kt);ut.setDate(ut.getDate()-Math.floor(bt/2));const Mt=new Date(kt);return Mt.setDate(Mt.getDate()+Math.ceil(bt/2)),{startDate:ut,endDate:Mt}}const{minDate:ue,maxDate:we}=H;let Ue=new Date(ue);Ue.setDate(Ue.getDate()-30);let Ge=new Date(we);Ge.setDate(Ge.getDate()+30);const We=Math.ceil((Ge.getTime()-Ue.getTime())/(1e3*60*60*24));if(We*K<te){const kt=Math.ceil(te/K),bt=Math.ceil((kt-We)/2),ut=new Date(Ue);ut.setDate(ut.getDate()-bt),Ue=ut;const Mt=new Date(Ge);Mt.setDate(Mt.getDate()+bt),Ge=Mt}return{startDate:Ue,endDate:Ge}},R=()=>{const H=M(),te=je.value||1200,K=60;if(!H){const qr=new Date,Ir=Math.max(Math.ceil(te/K),20),Ur=new Date(qr);Ur.setDate(Ur.getDate()-Math.floor(Ir/2)*7);const jr=new Date(qr);return jr.setDate(jr.getDate()+Math.ceil(Ir/2)*7),{startDate:Ur,endDate:jr}}const{minDate:ue,maxDate:we}=H;function Ue(qr){const Ir=new Date(qr),Ur=Ir.getDay()||7;return Ir.setDate(Ir.getDate()-(Ur-1)),Ir}function Ge(qr,Ir){let Ur=1;for(;Ur<=31;){const jr=new Date(qr,Ir,Ur);if(jr.getMonth()!==Ir)break;const en=Ue(jr);if(en.getMonth()===Ir)return en;Ur++}return new Date(qr,Ir,1)}function We(qr,Ir){const Ur=new Date(qr,Ir+1,0).getDate();for(let jr=Ur;jr>=1;jr--){const en=new Date(qr,Ir,jr),GA=Ue(en);if(GA.getMonth()===Ir)return GA}return new Date(qr,Ir,1)}function ft(qr,Ir){const Ur=[],jr=Ge(qr,Ir),en=We(qr,Ir),GA=new Date(jr);for(;GA<=en;)Ur.push(new Date(GA)),GA.setDate(GA.getDate()+7);return Ur}const kt=Ue(ue),bt=kt.getFullYear(),ut=kt.getMonth(),Mt=ut===0?11:ut-1,Sr=ut===0?bt-1:bt,Tr=ft(Sr,Mt),jA=Ue(we),aA=jA.getFullYear(),fA=jA.getMonth(),wA=fA===11?0:fA+1,Hr=fA===11?aA+1:aA,Cn=ft(Hr,wA);let Xr=[];Xr.push(...Tr);let qn=bt,WA=ut;for(;qn<aA||qn===aA&&WA<=fA;){const qr=ft(qn,WA);Xr.push(...qr),WA++,WA>11&&(WA=0,qn++)}Xr.push(...Cn);let Aa=Xr.length*K;for(;Aa<te;){const qr=Xr[0],Ir=qr.getFullYear(),Ur=qr.getMonth(),jr=Ur===0?11:Ur-1,en=Ur===0?Ir-1:Ir;if(Xr=[...ft(en,jr),...Xr],Aa=Xr.length*K,Aa>=te)break;const Ba=Xr[Xr.length-1],yi=Ba.getFullYear(),Ra=Ba.getMonth(),dA=Ra===11?0:Ra+1,Qs=Ra===11?yi+1:yi,na=ft(Qs,dA);Xr=[...Xr,...na],Aa=Xr.length*K}const Xi=new Date(Xr[0]),Xa=new Date(Xr[Xr.length-1]);return Xa.setDate(Xa.getDate()+6),{startDate:Xi,endDate:Xa}},S=()=>{const H=M();if(!H){const bt=new Date,ut=new Date(bt.getFullYear()-1,0,1),Mt=new Date(bt.getFullYear()+1,11,31);return{startDate:ut,endDate:Mt}}const{minDate:te,maxDate:K}=H,ue=je.value||1200;let we=new Date(te.getFullYear()-1,0,1),Ue=new Date(K.getFullYear()+1,11,31);const We=(Ue.getFullYear()-we.getFullYear())*12+(Ue.getMonth()-we.getMonth()),ft=60;if(We*ft<ue){const bt=Math.ceil(ue/ft),ut=Math.ceil((bt-We)/2),Mt=new Date(we);Mt.setMonth(Mt.getMonth()-ut),we=new Date(Mt.getFullYear(),Mt.getMonth(),1);const Sr=new Date(Ue);Sr.setMonth(Sr.getMonth()+ut),Ue=new Date(Sr.getFullYear(),Sr.getMonth()+1,0)}return{startDate:we,endDate:Ue}},T=()=>{const H=M();if(!H){const We=new Date,ft=je.value||1200;let kt=3;v.value===qe.QUARTER?kt=Math.max(Math.ceil(ft/240)+1,5):v.value===qe.YEAR&&(kt=Math.max(Math.ceil(ft/360)+1,5));const bt=We.getFullYear()-Math.floor(kt/2),ut=bt+kt-1,Mt=new Date(bt,0,1),Sr=new Date(ut,11,31);return{startDate:Mt,endDate:Sr}}const{minDate:te,maxDate:K}=H,ue=je.value||1200;let we=new Date(te.getFullYear()-1,0,1),Ue=new Date(K.getFullYear()+1,11,31);const Ge=Ue.getFullYear()-we.getFullYear()+1;if(v.value===qe.QUARTER){if(Ge*240<ue){const bt=Math.ceil(ue/240),ut=Math.ceil((bt-Ge)/2);we=new Date(we.getFullYear()-ut,0,1),Ue=new Date(Ue.getFullYear()+ut,11,31)}}else if(v.value===qe.YEAR&&Ge*360<ue){const kt=Math.ceil(ue/360),bt=Math.ceil((kt-Ge)/2);we=new Date(we.getFullYear()-bt,0,1),Ue=new Date(Ue.getFullYear()+bt,11,31)}return{startDate:we,endDate:Ue}},G=i.ref(null),N=i.ref(null),oe=i.ref(new Set),le=i.computed(()=>N.value!==null),Z=()=>{N.value=null,oe.value.clear()},ee=H=>{N.value=H,oe.value.clear(),oe.value.add(H);const te=b.value.find(K=>K.id===H);if(te){if(te.predecessor){const K=la(te.predecessor);for(const ue of K)oe.value.add(ue)}for(const K of b.value)K.predecessor&&la(K.predecessor).includes(H)&&oe.value.add(K.id)}},X=i.ref(null),re=i.shallowRef(null),se=i.shallowRef(null),x=i.ref(!1),I=i.ref(""),W=i.ref(null);let z=!1,Ae="";const he=new Map,fe=H=>{X.value=H.type,re.value=H.task,Qe(H.mouseEvent.clientX,H.mouseEvent.clientY),se.value=null,x.value=!1,I.value="",at=null,z=!1,Ae="",pt(),document.addEventListener("mousemove",Q),document.addEventListener("mouseup",De)};let ce=null,Fe=0,Pe=0,Ze=0,tt=0;const lt=()=>{ce=null,Qe(Fe,Pe),gt(Fe,Pe),$r.value&&re.value&&$r.value.draw(Ut(),Lt(),Ze,tt,z,Ae)},Q=H=>{X.value&&(Fe=H.clientX,Pe=H.clientY,ce===null&&(ce=requestAnimationFrame(lt)))},De=()=>{X.value&&(ce!==null&&(cancelAnimationFrame(ce),ce=null),re.value&&Ve({task:re.value,type:X.value}))};let pe=null,ge=0,Ee=!1;const xe=(H,te)=>{if(!Lr.value){Ze=H,tt=te;return}const K=Date.now();(!pe||Ee||K-ge>ek)&&(pe=Lr.value.getBoundingClientRect(),ge=K,Ee=!1),Ze=H-pe.left,tt=te-pe.top},Qe=(H,te)=>{xe(H,te)},Oe=H=>{Fe=H.mouseX,Pe=H.mouseY,ce===null&&(ce=requestAnimationFrame(lt))},Ve=H=>{var te;pe=null,document.removeEventListener("mousemove",Q),document.removeEventListener("mouseup",De),zt(),(te=$r.value)==null||te.clear(),se.value&&x.value&&Bt(H.task,se.value,H.type),X.value=null,re.value=null,se.value=null,x.value=!1},Re=(H,te)=>{pe||(pe=Lr.value.getBoundingClientRect(),ge=Date.now());const K=H-pe.left,ue=te-pe.top,we=(tk+rk)/2,Ue=we+10;for(const Ge in ur.value){const We=ur.value[Ge],ft=Number(Ge);if(ue<We.top-Ue||ue>We.top+We.height+Ue)continue;const kt=We.top+We.height/2,bt=We.left;if(K>=bt-we&&K<=bt+we&&ue>=kt-we&&ue<=kt+we)return{taskId:ft,anchorType:"left"};const ut=We.left+We.width;if(K>=ut-we&&K<=ut+we&&ue>=kt-we&&ue<=kt+we)return{taskId:ft,anchorType:"right"}}return null},$e=(H,te)=>{const K=(at==null?void 0:at.id)??null,ue=(H==null?void 0:H.id)??null;if(K!==ue)if(at=H,H&&re.value){const we=mt(re.value,H,X.value,te);z=we.valid,Ae=we.error||"",x.value=we.valid,se.value=H}else z=!1,Ae="",x.value=!1,se.value=null};let at=null;const gt=(H,te)=>{if(!re.value||!Lr.value)return;const K=Re(H,te),ue=K!==null&&he.get(K.taskId)||null,we=K==null?void 0:K.anchorType;$e(ue,we)},mt=(H,te,K,ue)=>{if(ue){if(K==="predecessor"&&ue!=="right")return{valid:!1,error:"前置任务应连接到右侧触点"};if(K==="successor"&&ue!=="left")return{valid:!1,error:"后置任务应连接到左侧触点"}}if(H.id===te.id)return{valid:!1,error:"不能连接到自己"};if(te.isParent||te.type==="milestone")return{valid:!1,error:"不能连接到父级任务或里程碑"};if(K==="predecessor"){if(ht(te.id,H.id))return{valid:!1,error:"会产生循环依赖"}}else if(ht(H.id,te.id))return{valid:!1,error:"会产生循环依赖"};if(K==="predecessor"){if(H.predecessor&&la(H.predecessor).includes(te.id))return{valid:!1,error:"关系已存在"}}else if(te.predecessor&&la(te.predecessor).includes(H.id))return{valid:!1,error:"关系已存在"};return{valid:!0}},ht=(H,te)=>{const K=new Set,ue=[H];for(;ue.length>0;){const we=ue.shift();if(we===te)return!0;if(K.has(we))continue;K.add(we);const Ue=b.value.find(Ge=>Ge.id===we);if(Ue&&Ue.predecessor){const Ge=la(Ue.predecessor);ue.push(...Ge)}}return!1},Bt=(H,te,K)=>{if(console.log("----> hello:",{mode:K,sourceTask:H,targetTask:te}),K==="predecessor"){const ue=H.predecessor?la(H.predecessor):[];ue.includes(te.id)||(ue.push(te.id),H.predecessor=ue,Ln(H),n("predecessor-added",{targetTask:H,newTask:te}))}else{const ue=te.predecessor?la(te.predecessor):[];ue.includes(H.id)||(ue.push(H.id),te.predecessor=ue,Ln(te),n("successor-added",{targetTask:te,newTask:H}))}},pt=()=>{W.value=window.setInterval(()=>{if(!B.value||!Lr.value)return;const H=B.value,te=In.value;if(!te)return;const K=H.getBoundingClientRect(),ue=80,we=15,Ue=Fe,Ge=Pe;let We=!1;if(Ue<K.left+ue&&H.scrollLeft>0)H.scrollLeft-=we,We=!0;else if(Ue>K.right-ue){const ft=H.scrollWidth-H.clientWidth;H.scrollLeft<ft&&(H.scrollLeft+=we,We=!0)}if(Ge<K.top+ue&&te.scrollTop>0)te.scrollTop-=we,We=!0;else if(Ge>K.bottom-ue){const ft=te.scrollHeight-te.clientHeight;te.scrollTop<ft&&(te.scrollTop+=we,We=!0)}We&&(Ee=!0,gt(Ue,Ge),$r.value&&re.value&&$r.value.draw(Ut(),Lt(),Ze,tt,z,Ae))},30)},zt=()=>{W.value!==null&&(clearInterval(W.value),W.value=null)},_t=()=>{var H;zt(),pe=null,ce!==null&&(cancelAnimationFrame(ce),ce=null),(H=$r.value)==null||H.clear(),document.removeEventListener("mousemove",Q),document.removeEventListener("mouseup",De),X.value=null,re.value=null,se.value=null,x.value=!1},Ut=()=>{if(!re.value)return 0;const H=ur.value[re.value.id];return H?X.value==="predecessor"?H.left:H.left+H.width:0},Lt=()=>{if(!re.value)return 0;const H=ur.value[re.value.id];return H?H.top+H.height/2:0},Xt=i.ref(!1),Et=i.ref(!1),rr=i.ref(!1),St=i.ref(0),ye=i.ref(!1);let He=null;const _e=i.ref(0),je=i.ref(0),wt=i.ref(!0),Qt=i.ref(!0);let Tt=null;const gr=i.ref(0),Or=new Map,Ft=i.ref(!0),hA=i.computed(()=>{if(v.value!==qe.HOUR)return{startHour:0,endHour:0};const H=_e.value,te=je.value;if(Ft.value&&H===0)return{startHour:0,endHour:168};if(Ft.value){const we=new Date,Ue=f.value.startDate,Ge=Math.floor((we.getTime()-Ue.getTime())/(1e3*60*60));return{startHour:Math.max(0,Ge-168),endHour:Ge+168}}const K=Math.floor(H/Mu)-Wv,ue=Math.ceil((H+te)/Mu)+Wv;return{startHour:Math.max(0,K),endHour:Math.max(K+1,ue)}}),lA=i.computed(()=>{const H=gr.value,te=Br.value||600,K=Math.floor(H/Gv)-Yv,ue=Math.ceil((H+te)/Gv)+Yv;return{startIndex:Math.max(0,K),endIndex:Math.min(b.value.length,Math.max(K+1,ue))}}),cA=i.computed(()=>{const{startIndex:H,endIndex:te}=lA.value;return b.value.slice(H,te).map((K,ue)=>({task:K,originalIndex:H+ue}))}),xr=(H,te)=>{let K=null;return((...ue)=>{const we=()=>{K=null,H(...ue)};K&&clearTimeout(K),K=window.setTimeout(we,te)})},fr=xr(()=>{Rr()},200),Cr=xr(()=>{fn()},200),Er=()=>{const H=v.value,te=f.value.startDate.getTime(),K=f.value.endDate.getTime(),ue=`${H}-${te}-${K}`;if(!Or.has(ue)){let we;H===qe.HOUR?we=Ye():H===qe.WEEK?we=st():H===qe.MONTH?we=It():H===qe.QUARTER?we=Ht():H===qe.YEAR?we=Ar():we=Ie(),Or.set(ue,we)}return Or.get(ue)},gA=i.computed(()=>{const H=Er();if(v.value===qe.HOUR&&Array.isArray(H)){const{startHour:te,endHour:K}=hA.value,ue=[],we=new Date(f.value.startDate);we.setHours(0,0,0,0);const Ue=we.getTime(),Ge=1e3*60*60*24;for(const We of H){const ft=new Date(We.year,We.month-1,We.day);ft.setHours(0,0,0,0);const bt=Math.floor((ft.getTime()-Ue)/Ge)*24,ut=Math.max(0,te-bt),Mt=Math.min(We.hours.length,K-bt);ut<Mt&&ue.push({...We,hours:We.hours.slice(ut,Mt),hourOffset:bt+ut,visibleHourStart:ut,_debug:{totalHourOffset:bt,dayStartHour:ut,dayEndHour:Mt,visibleRange:{startHour:te,endHour:K}}})}return ue}return H}),uA=i.computed(()=>{var ue,we;const H=Er();if(!Array.isArray(H))return 0;const te=v.value;if(te===qe.HOUR){let Ue=0;for(const Ge of H)Ue+=Ge.hours.length;return Ue*Mu}if(te===qe.QUARTER){let Ue=0;for(const Ge of H)Ue+=Ge.quarters.length;return Ue*60}if(te===qe.WEEK){let Ue=0;for(const Ge of H)Ue+=((ue=Ge.weeks)==null?void 0:ue.length)||0;return Ue*60}if(te===qe.MONTH)return H.length*60;if(te===qe.YEAR)return H.length*360;let K=0;for(const Ue of H)K+=((we=Ue.days)==null?void 0:we.length)||0;return K*30}),Br=i.ref(0);let tA=null;const pA=i.ref(new Map),Rr=()=>{const H=new Map,te=f.value.startDate.getTime(),K=_e.value,ue=K+je.value;for(const we of b.value)if(we.type==="milestone-group"&&we.children)for(const Ue of we.children){const Ge=new Date(Ue.startDate||"");if(!isNaN(Ge.getTime())){const ft=Math.floor((Ge.getTime()-te)/864e5)*30+15-12,kt=ft-12,bt=ft+12;let ut=!1,Mt="none";bt<=K+12?(ut=!0,Mt="left"):kt>=ue-12&&(ut=!0,Mt="right"),H.set(Ue.id,{left:ft,originalLeft:ft,isSticky:ut,stickyPosition:Mt})}}else if(we.type==="milestone"){const Ue=new Date(we.startDate||"");if(!isNaN(Ue.getTime())){const Ge=(Ue.getTime()-te)/864e5,ft=Math.floor(Ge)*30+15-12,kt=ft-12,bt=ft+12;let ut=!1,Mt="none";bt<=K+12?(ut=!0,Mt="left"):kt>=ue-12&&(ut=!0,Mt="right"),H.set(we.id,{left:ft,originalLeft:ft,isSticky:ut,stickyPosition:Mt})}}pA.value=H},vA=H=>{const te=[];return pA.value.forEach((K,ue)=>{ue!==H&&te.push({id:ue,left:K.left,originalLeft:K.originalLeft,isSticky:K.isSticky,stickyPosition:K.stickyPosition,priority:K.originalLeft})}),te},ln=()=>{Xt.value=!0},Ct=()=>{if(Xt.value=!1,B.value){const H=B.value.clientWidth;Math.abs(H-je.value)>1&&(je.value=H)}wt.value=!0,setTimeout(()=>{wt.value=!1},300)},Be=()=>{wt.value=!0,ur.value={},Kr.value++,Tt&&clearTimeout(Tt),Tt=setTimeout(()=>{wt.value=!1,Tt=null,fn()},300)},$=H=>{Xt.value||JA.value||(G.value=H,window.dispatchEvent(new CustomEvent("timeline-task-hover",{detail:H})))},de=i.computed(()=>{const K=b.value.length*51;return Math.max(K,400,Br.value)}),Ke=H=>{JA.value||(G.value=H.detail)},rt=H=>{const te=H.detail;bn(te)},q=()=>{Gt.value=Te()},me=H=>{le.value||n("milestone-double-click",H)},Ce=H=>{r.onMilestoneSave&&typeof r.onMilestoneSave=="function"&&r.onMilestoneSave(H),window.dispatchEvent(new CustomEvent("milestone-data-updated",{detail:{milestone:H}}))},Te=()=>Er(),ze=()=>{Or.clear()},Ie=()=>{const H=[],te=new Date(f.value.startDate);for(;te<=f.value.endDate;){const K=te.getFullYear(),ue=te.getMonth()+1,we=[],Ue=new Date(K,ue,0).getDate();for(let Ge=1;Ge<=Ue;Ge++){const We=new Date(K,ue-1,Ge),ft=We.getDay(),kt=ft===0||ft===6;we.push({day:Ge,date:We,label:String(Ge).padStart(2,"0"),isToday:Kt(We),isWeekend:kt})}H.push({year:K,month:ue,yearMonthLabel:a(K,ue),startDate:new Date(te),endDate:new Date(K,ue,0),days:we}),te.setMonth(te.getMonth()+1)}return H},Xe=(H,te)=>{if(te===0||te===6)return!1;const K=r.workingHours;if(!K)return!1;if(K.morning){const{start:ue,end:we}=K.morning;if(H>=ue&&H<=we)return!0}if(K.afternoon){const{start:ue,end:we}=K.afternoon;if(H>=ue&&H<=we)return!0}return!1},Ye=()=>{const H=[],te=new Date(f.value.startDate);for(;te<=f.value.endDate;){const K=te.getFullYear(),ue=te.getMonth()+1,we=te.getDate(),Ue=[],Ge=te.getDay();for(let We=0;We<24;We++){const ft=new Date(K,ue-1,we,We);Ue.push({hour:We,label:`${String(We).padStart(2,"0")}:00`,shortLabel:String(We).padStart(2,"0"),date:ft,isToday:Kt(ft)&&We===new Date().getHours(),isWorkingHour:Xe(We,Ge),isWeekend:Ge===0||Ge===6})}H.push({year:K,month:ue,day:we,date:new Date(te),dateLabel:`${K}/${String(ue).padStart(2,"0")}/${String(we).padStart(2,"0")}`,isToday:Kt(te),hours:Ue}),te.setDate(te.getDate()+1)}return H},st=()=>{const H=[],te=new Date(f.value.startDate),K=new Date(f.value.endDate),ue=new Date(te),we=ue.getDay()||7;ue.setDate(ue.getDate()-(we-1));const Ue=new Date(ue);for(;Ue<=K;){const ft=new Date(Ue);ft.setDate(ft.getDate()+6),H.push({weekStart:new Date(Ue),weekEnd:new Date(ft),label:`${Ue.getDate()}`,isToday:qt(Ue,ft),subDays:vt(Ue),belongsToYear:Ue.getFullYear(),belongsToMonth:Ue.getMonth()+1}),Ue.setDate(Ue.getDate()+7)}const Ge=new Map;for(const ft of H){const kt=ft,bt=kt.belongsToYear,ut=kt.belongsToMonth,Mt=`${bt}-${ut}`;Ge.has(Mt)||Ge.set(Mt,{year:bt,month:ut,yearMonthLabel:a(bt,ut),startDate:new Date(bt,ut-1,1),endDate:new Date(bt,ut,0),weeks:[],isWeekView:!0}),Ge.get(Mt).weeks.push(ft)}return Array.from(Ge.values()).sort((ft,kt)=>ft.year!==kt.year?ft.year-kt.year:ft.month-kt.month)},vt=H=>{const te=[];for(let K=0;K<7;K++){const ue=new Date(H);ue.setDate(ue.getDate()+K),te.push({date:new Date(ue),dayOfWeek:ue.getDay()})}return te},qt=(H,te)=>{const K=new Date;return K.setHours(0,0,0,0),K>=H&&K<=te},tr=(H,te)=>{let K=0;for(let ue=0;ue<H;ue++){const we=Gt.value[ue];we&&we.isWeekView&&we.weeks?K+=we.weeks.length*60:we&&we.days&&(K+=we.days.length*30)}return K+=te*60,K},nr=H=>{if(v.value=H,Ft.value=!0,ze(),H===qe.HOUR){const te=O();Rt=!0,f.value={...f.value,startDate:te.startDate,endDate:te.endDate},Rt=!1}else if(H===qe.DAY){const te=L();Rt=!0,f.value={...f.value,startDate:te.startDate,endDate:te.endDate},Rt=!1}if(H===qe.WEEK){const te=R();Rt=!0,f.value={...f.value,startDate:te.startDate,endDate:te.endDate},Rt=!1}if(H===qe.MONTH){const te=S();Rt=!0,f.value={...f.value,startDate:te.startDate,endDate:te.endDate},Rt=!1}if(H===qe.QUARTER){const te=T();Rt=!0,f.value={...f.value,startDate:te.startDate,endDate:te.endDate},Rt=!1}if(H===qe.YEAR){const te=T();Rt=!0,f.value={...f.value,startDate:te.startDate,endDate:te.endDate},Rt=!1}Gt.value=Te(),i.nextTick(()=>{n("timeline-scale-changed",H),window.dispatchEvent(new CustomEvent("timeline-scale-updated")),setTimeout(()=>{window.dispatchEvent(new CustomEvent("timeline-force-recalculate")),setTimeout(()=>{dr()},100)},50)})},Kt=H=>{const te=new Date;return H.getDate()===te.getDate()&&H.getMonth()===te.getMonth()&&H.getFullYear()===te.getFullYear()},Gt=i.shallowRef(Te());let Rt=!1;i.watch(()=>[f.value.startDate,f.value.endDate],()=>{Rt||(ze(),Gt.value=Te())});let pr=!1;i.watch(()=>[Gt.value,f.value.startDate,f.value.endDate],()=>{pr||i.nextTick(()=>{dr(),pr=!0})});const dr=(H=0)=>{wt.value=!0,Qt.value=!0;const te=new Date,K=f.value.startDate,ue=new Date(te.getFullYear(),te.getMonth(),te.getDate());let we;if(v.value===qe.YEAR||v.value===qe.QUARTER){const ut=T();we=new Date(ut.startDate.getFullYear(),ut.startDate.getMonth(),ut.startDate.getDate())}else if(v.value===qe.MONTH){const ut=S();we=new Date(ut.startDate.getFullYear(),ut.startDate.getMonth(),ut.startDate.getDate())}else we=new Date(K.getFullYear(),K.getMonth(),K.getDate());const Ue=ue.getTime()-we.getTime(),Ge=Math.floor(Ue/(1e3*60*60*24));let We;if(v.value===qe.HOUR){const ut=te.getHours(),Mt=te.getMinutes(),Sr=Ge*E.value,Tr=ut*40,jA=Mt/60*40;We=Sr+Tr+jA}else if(v.value===qe.QUARTER){const ut=ue.getFullYear(),Mt=we.getFullYear(),Sr=240,Tr=60;We=(ut-Mt)*Sr;const aA=ue.getMonth()+1;let fA=1;aA>=1&&aA<=3||(aA>=4&&aA<=6?fA=2:aA>=7&&aA<=9?fA=3:fA=4),We+=(fA-1)*Tr;let wA,Hr;fA===1?(wA=new Date(ut,0,1),Hr=new Date(ut,2,31)):fA===2?(wA=new Date(ut,3,1),Hr=new Date(ut,5,30)):fA===3?(wA=new Date(ut,6,1),Hr=new Date(ut,8,30)):(wA=new Date(ut,9,1),Hr=new Date(ut,11,31));const Cn=Math.floor((ue.getTime()-wA.getTime())/(1e3*60*60*24)),Xr=Math.floor((Hr.getTime()-wA.getTime())/(1e3*60*60*24))+1,qn=Cn/Xr*Tr;We+=qn}else if(v.value===qe.MONTH){const ut=ue.getFullYear(),Mt=ue.getMonth()+1,Sr=we.getFullYear(),Tr=we.getMonth()+1,jA=(ut-Sr)*12+(Mt-Tr),aA=60;We=jA*aA;const fA=ue.getDate(),wA=new Date(ut,Mt,0).getDate(),Hr=fA/wA*aA;We+=Hr}else if(v.value===qe.YEAR){const ut=Gt.value;let Mt=0;const Sr=180;let Tr=!1;for(const jA of ut){const aA=jA.halfYears||[];for(const fA of aA){const wA=new Date(fA.startDate),Hr=new Date(fA.endDate);if(wA.setHours(0,0,0,0),Hr.setHours(0,0,0,0),ue<wA){Tr=!0;break}if(ue>=wA&&ue<=Hr){const Cn=Hr.getTime()-wA.getTime(),qn=(ue.getTime()-wA.getTime())/Cn;Mt+=qn*Sr,Tr=!0;break}Mt+=Sr}if(Tr)break}We=Mt}else We=Ge*E.value;const ft=B.value;if(!ft){H<10&&setTimeout(()=>dr(H+1),60);return}const kt=ft.clientWidth;if(kt===0&&H<10){setTimeout(()=>dr(H+1),60);return}const bt=We-kt/2+15;typeof ft.scrollTo=="function"?ft.scrollTo({left:Math.max(0,bt),behavior:"smooth"}):ft.scrollLeft=Math.max(0,bt),setTimeout(()=>{Qt.value=!1,v.value===qe.HOUR&&(Ft.value=!1),setTimeout(()=>{wt.value=!1},300)},1500)},yr=i.computed(()=>{if(v.value!==qe.YEAR)return-1;const H=new Date;H.setHours(0,0,0,0);const te=Gt.value;if(!te||te.length===0)return-1;let K=0;const ue=180;for(const we of te){const Ue=we.halfYears||[];for(const Ge of Ue){const We=new Date(Ge.startDate),ft=new Date(Ge.endDate);if(We.setHours(0,0,0,0),ft.setHours(0,0,0,0),H<We)return K;if(H>=We&&H<=ft){const kt=ft.getTime()-We.getTime(),ut=(H.getTime()-We.getTime())/kt;return K+ut*ue}K+=ue}}return K}),$t=i.computed(()=>{if(v.value!==qe.YEAR)return!1;const H=new Date,te=new Date(H.getFullYear(),H.getMonth(),H.getDate()),K=T(),ue=K.startDate,we=K.endDate;return te>=ue&&te<=we}),RA=()=>{if(b.value.length===0){cn();return}const H=[];for(const bt of b.value)bt.startDate&&H.push(new Date(bt.startDate));if(H.length===0){cn();return}let te=1/0;for(const bt of H){const ut=bt.getTime();ut<te&&(te=ut)}const K=new Date(te),ue=K.getFullYear(),we=K.getMonth(),Ue=K.getDate();let Ge=0;for(let bt=0;bt<we;bt++)Ge+=new Date(ue,bt+1,0).getDate();Ge+=Ue;const We=F.value,ft=We==null?void 0:We.clientWidth,kt=(Ge-1)*30-(ft?ft/2:200);B.value&&(B.value.scrollLeft=Math.max(0,kt))},cn=()=>{const H=new Date,te=f.value.startDate,K=new Date(H.getFullYear(),H.getMonth(),H.getDate()),ue=new Date(te.getFullYear(),te.getMonth(),te.getDate()),we=K.getTime()-ue.getTime(),Ue=Math.floor(we/(1e3*60*60*24));if(Ue<0||K>f.value.endDate)return;const Ge=Ue*30,We=B.value;if(!We)return;const ft=We.clientWidth,kt=Ge-ft/2+15;We.scrollTo({left:Math.max(0,kt),behavior:"smooth"}),setTimeout(()=>{const bt=document.querySelectorAll(".day-column.today");for(const ut of bt)ut.classList.add("today-highlight"),setTimeout(()=>{ut.classList.remove("today-highlight")},2e3)},500)},Ln=H=>{window.dispatchEvent(new CustomEvent("task-updated",{detail:H}))},bn=H=>{le.value||n("edit-task",H)},Qr=(H,te)=>{le.value||n("click-task",H,te)},ur=i.shallowRef({}),Kr=i.ref(0),Lr=i.ref(null),$r=i.ref(null),XA=i.ref(0),ea=i.ref(0),Vn=i.ref(0),un=i.ref(0),ta=i.ref(0),kA=i.ref(0);function fn(){if(Lr.value){const H=Lr.value.offsetWidth,te=de.value,K=_e.value,ue=gr.value;Vn.value=Ul;const we=Ul/3;let Ue=Math.max(0,K-we);if(H<=Ul)Ue=0;else{const kt=H-Ul;Ue=Math.min(Ue,kt)}ta.value=Ue;const Ge=Math.min(te,Ak);un.value=Ge,XA.value=Vn.value,ea.value=Ge;const We=Ge/3;let ft=Math.max(0,ue-We);if(te<=Ge)ft=0;else{const kt=te-Ge;ft=Math.min(ft,kt)}kA.value=ft}}function mA(H){if(!Lr.value)return;const te=Lr.value.getBoundingClientRect();ur.value={...ur.value,[H.id]:{left:H.left-te.left,top:H.top-te.top,width:H.width,height:H.height}},setTimeout(()=>{fn()},200)}const dn=H=>{window.dispatchEvent(new CustomEvent("taskbar-drag-end",{detail:H}))},Cs=H=>{window.dispatchEvent(new CustomEvent("taskbar-resize-end",{detail:H}))},Zt=H=>{window.dispatchEvent(new CustomEvent("context-menu",{detail:H}))},so=H=>{if(or.value){wt.value=!0;const te=or.value.scrollWidth-or.value.clientWidth,K=Math.max(0,Math.min(H,te));or.value.scrollTo({left:K,behavior:"smooth"}),setTimeout(()=>{wt.value=!1},1e3)}},Es=H=>{window.dispatchEvent(new CustomEvent("milestone-drag-end",{detail:H}))};i.onMounted(()=>{i.nextTick(()=>{setTimeout(()=>{dr()},60)}),window.addEventListener("task-row-double-click",rt),window.addEventListener("task-list-hover",Ke),window.addEventListener("task-list-vertical-scroll",Fs),window.addEventListener("locale-changed",q),window.addEventListener("splitter-drag-start",ln),window.addEventListener("splitter-drag-end",Ct),window.addEventListener("timeline-container-resized",Be),window.addEventListener("milestone-click-locate",it),window.addEventListener("drag-boundary-check",Bi),window.addEventListener("taskbar-highlighted",$i),i.nextTick(()=>{const H=document.querySelector(".timeline-body"),te=document.querySelector(".timeline"),K=document.querySelector(".gantt-panel-right");if(In.value=H,B.value=te,F.value=K,H&&(Br.value=H.clientHeight,tA=new ResizeObserver(ue=>{for(const we of ue)Br.value=we.contentRect.height}),tA.observe(H)),te){_e.value=te.scrollLeft,je.value=te.clientWidth;const ue=new ResizeObserver(we=>{for(const Ue of we){const Ge=Ue.contentRect.width;Math.abs(Ge-je.value)>1&&(je.value=Ge,wt.value=!0,Tt&&clearTimeout(Tt),Tt=setTimeout(()=>{wt.value=!1,Tt=null},300))}});ue.observe(te),tA||(tA=ue)}}),setTimeout(()=>{dr(),fn()},200),window.addEventListener("resize",fn)});const Fs=H=>{const{scrollTop:te}=H.detail;gr.value=te,Cr(),In.value&&Math.abs(In.value.scrollTop-te)>1&&(In.value.scrollTop=te)},va=H=>{const te=H.target;if(!te)return;const K=te.scrollTop;gr.value=K,Ee=!0,Cr(),!JA.value&&K>=0&&window.dispatchEvent(new CustomEvent("timeline-vertical-scroll",{detail:{scrollTop:K}}))};i.watch(()=>b.value.length,()=>{i.nextTick(()=>{fn()})},{immediate:!0}),i.watch(b,H=>{he.clear();const te=K=>{he.set(K.id,K),K.children&&K.children.length>0&&K.children.forEach(te)};H.forEach(te)},{immediate:!0});const JA=i.ref(!1),zi=i.ref(0),ks=i.ref(0),_a=i.ref(0),pi=i.ref(0),or=i.ref(null),In=i.ref(null);let ZA=null;const vi=i.ref(!1);let Ma=null;const $i=()=>{const H=te=>{var K;te.buttons===1&&(JA.value=!0,zi.value=te.pageX,_a.value=((K=or.value)==null?void 0:K.scrollLeft)||0,or.value&&(or.value.style.cursor="grabbing",or.value.style.userSelect="none"),document.addEventListener("mousemove",Nn),document.addEventListener("mouseup",Oa)),document.removeEventListener("mousemove",H)};document.addEventListener("mousemove",H),setTimeout(()=>{document.removeEventListener("mousemove",H)},5e3)},xs=H=>{var we,Ue;const te=H.target,K=te.closest(".timeline-header"),ue=te.closest(".timeline-body");if(!(!K&&!ue)){if(ue){const Ge=te.closest(".task-bar");if(Ge){const We=Ge.classList.contains("highlighted"),ft=Ge.classList.contains("primary-highlight");if(!We&&!ft)return}else if([".milestone","button","input","select","textarea",".custom-task-content",".progress-bar",".task-name",".task-controls"].some(kt=>te.closest(kt)))return}JA.value=!0,zi.value=H.pageX,ks.value=H.pageY,_a.value=((we=or.value)==null?void 0:we.scrollLeft)||0,!In.value&&or.value&&(In.value=or.value.querySelector(".timeline-body")),pi.value=((Ue=In.value)==null?void 0:Ue.scrollTop)||0,or.value&&(or.value.style.cursor="grabbing",or.value.style.userSelect="none"),H.preventDefault(),document.addEventListener("mousemove",Nn),document.addEventListener("mouseup",Oa)}},Nn=H=>{!JA.value||!or.value||(H.preventDefault(),ZA!==null&&cancelAnimationFrame(ZA),ZA=requestAnimationFrame(()=>{if(!or.value)return;const te=H.pageX,K=H.pageY,ue=(te-zi.value)*1.5,we=(K-ks.value)*1.5;if(or.value.scrollLeft=_a.value-ue,In.value){const Ue=pi.value-we;In.value.scrollTop=Ue;const Ge=document.querySelector(".task-list-body");Ge&&(Ge.scrollTop=Ue)}ZA=null}))},Oa=()=>{JA.value=!1,ZA!==null&&(cancelAnimationFrame(ZA),ZA=null),or.value&&(or.value.style.cursor="grab",or.value.style.userSelect="auto"),G.value=null,document.removeEventListener("mousemove",Nn),document.removeEventListener("mouseup",Oa)},mi=H=>{var Ge;const te=H.target;if(!te)return;const K=te.scrollLeft;if(_e.value=K,Ee=!0,je.value===0&&(je.value=te.clientWidth),Ft.value&&K>0&&(Ft.value=!1),Cr(),v.value===qe.HOUR){ye.value=!0,He&&clearTimeout(He),He=setTimeout(()=>{ye.value=!1},200);return}const ue=te.scrollWidth,we=te.clientWidth,Ue=ue-we;St.value=Ue>0?K/Ue:0,Et.value=K>20,rr.value=K<Ue-20,ye.value=!0,(Ge=te.classList)==null||Ge.add("scrolling"),fr(),He&&clearTimeout(He),He=setTimeout(()=>{var We;ye.value=!1,(We=te.classList)==null||We.remove("scrolling")},500)},wi=H=>{if(vi.value||!or.value)return;vi.value=!0;const te=()=>{if(!or.value||!vi.value)return;const K=or.value.scrollLeft,ue=or.value.scrollWidth-or.value.clientWidth;let we;if(H==="left"?we=Math.max(0,K-$v):we=Math.min(ue,K+$v),we===K){ra();return}or.value.scrollLeft=we,window.dispatchEvent(new CustomEvent("timeline-auto-scroll",{detail:{scrollDelta:we-K}})),Ma=window.setTimeout(te,16)};te()},ra=()=>{vi.value=!1,Ma&&(clearTimeout(Ma),Ma=null)},Bi=H=>{const{mouseX:te,isDragging:K}=H.detail;if(!K||!or.value){ra();return}const ue=or.value.getBoundingClientRect(),we=te-ue.left;we<=zv&&or.value.scrollLeft>0?wi("left"):we>=ue.width-zv&&or.value.scrollLeft<or.value.scrollWidth-or.value.clientWidth?wi("right"):ra()};i.onUnmounted(()=>{ra(),_t(),window.removeEventListener("task-row-double-click",rt),window.removeEventListener("task-list-hover",Ke),window.removeEventListener("task-list-vertical-scroll",Fs),window.removeEventListener("locale-changed",q),window.removeEventListener("splitter-drag-start",ln),window.removeEventListener("splitter-drag-end",Ct),window.removeEventListener("timeline-container-resized",Be),window.removeEventListener("milestone-click-locate",it),window.removeEventListener("drag-boundary-check",Bi),tA&&(tA.disconnect(),tA=null),window.removeEventListener("resize",fn),document.removeEventListener("mousemove",Nn),document.removeEventListener("mouseup",Oa)});const Ss=(H,te)=>{n("delete",H,te)},Ts=H=>{const te=b.value.find(Ue=>Ue.id===H.targetTaskId);if(!te||!te.predecessor)return;const ue=la(te.predecessor).filter(Ue=>Ue!==H.sourceTaskId),we={...te,predecessor:ue.length>0?ue:void 0};n("link-deleted",{sourceTaskId:H.sourceTaskId,targetTaskId:H.targetTaskId,updatedTask:we}),Ln(we),ze()},ma=i.computed(()=>{if(v.value!==qe.MONTH)return{};const H={},te=Gt.value;for(const K of te){const we=K.year;H[we]||(H[we]=[]),H[we].push(K)}return H}),wa=i.computed(()=>{if(v.value!==qe.WEEK)return[];const H=[],te=Gt.value;for(let K=0;K<te.length;K++){const ue=te[K];if(!(!ue.isWeekView||!ue.weeks))for(let we=0;we<ue.weeks.length;we++){const Ge=ue.weeks[we].subDays||[];for(let We=0;We<Ge.length;We++){const ft=Ge[We];ft.date&&ft.date.getDate()===1&&H.push({left:tr(K,we)+We*(60/7),date:ft.date.getDate()})}}}return H}),Us=i.computed(()=>{if(v.value!==qe.WEEK)return[];const H=[],te=Gt.value;for(let K=0;K<te.length;K++){const ue=te[K];if(!(!ue.isWeekView||!ue.weeks))for(let we=0;we<ue.weeks.length;we++){const Ge=ue.weeks[we].subDays||[];for(let We=0;We<Ge.length;We++){const ft=Ge[We];ft.date&&ft.date.getDate()===1&&H.push({left:tr(K,we)+We*(60/7)})}}}return H}),Kn=i.computed(()=>{if(v.value!==qe.YEAR)return[];try{const H=Ar();return Array.isArray(H)?H:[]}catch{return[]}});t({scrollToTasks:RA,scrollToToday:cn,scrollToTodayCenter:dr,timelineConfig:f,updateTimeScale:nr,highlightedTaskId:N,clearHighlight:Z});const Ds=H=>{n("start-timer",H)},m=H=>{n("stop-timer",H)},U=H=>{const te=H.startDate||H.endDate||"";return{...H,type:"milestone",startDate:te,endDate:H.startDate||H.endDate}};i.watch(()=>b.value.length,()=>{P(),Rr()},{immediate:!0});let ne=null;const ve=(H=50)=>{ne&&clearTimeout(ne),ne=setTimeout(()=>{Se(),ne=null},H)},Se=()=>{let H=null;v.value===qe.HOUR?H=O():v.value===qe.DAY?H=L():v.value===qe.WEEK?H=R():v.value===qe.MONTH?H=S():(v.value===qe.QUARTER||v.value===qe.YEAR)&&(H=T()),H&&(ze(),Rt=!0,f.value.startDate=H.startDate,f.value.endDate=H.endDate,Rt=!1,Gt.value=Te())};i.watch(()=>{var H;return(H=b.value)==null?void 0:H.length},(H,te)=>{H!==te&&P(),te===0&&H>0&&ve(50)}),i.watch(je,(H,te)=>{Xt.value||(!te||te===0||Math.abs(H-te)>50)&&H>0&&ve(100)},{immediate:!0});let et=null;i.watch([Gt,je],()=>{Xt.value||(et&&clearTimeout(et),et=setTimeout(()=>{ur.value={},Kr.value++,i.nextTick(()=>{setTimeout(()=>{fn()},200)}),et=null},100))}),i.watch(()=>b.value,H=>{P();const te=new Set;for(const ue of H)te.add(ue.id);const K={};for(const ue in ur.value){const we=parseInt(ue);te.has(we)&&(K[we]=ur.value[we])}ur.value=K},{deep:!0});const it=H=>{const{scrollLeft:te,smooth:K}=H.detail,ue=document.querySelector(".timeline"),we=document.querySelector(".timeline-body");let Ue=null;if(ue&&ue.scrollWidth>ue.clientWidth?Ue=ue:we&&we.scrollWidth>we.clientWidth&&(Ue=we),Ue){const Ge=Ue.scrollWidth-Ue.clientWidth,We=Math.min(Math.max(0,te),Ge);K?Ue.scrollTo({left:We,behavior:"smooth"}):Ue.scrollLeft=We}},It=()=>{let H,te;if(v.value===qe.MONTH){const Ge=S();H=Ge.startDate,te=Ge.endDate}else H=new Date(f.value.startDate),te=new Date(f.value.endDate);const K={},ue=new Date(H);for(ue.setDate(1);ue<=te;){const Ge=ue.getFullYear(),We=ue.getMonth()+1,kt=new Date(Ge,We,0).getDate(),bt=new Date,ut=Ge===bt.getFullYear()&&We===bt.getMonth()+1;K[Ge]||(K[Ge]={year:Ge,yearLabel:`${Ge}年`,months:[]}),K[Ge].months.push({year:Ge,month:We,monthLabel:o(We),startDate:new Date(Ge,We-1,1),endDate:new Date(Ge,We,0),isToday:ut,dayCount:kt}),ue.setMonth(ue.getMonth()+1)}const we=[];let Ue=0;for(const Ge of Object.values(K))for(const We of Ge.months){const ft=[];for(let Mt=1;Mt<=We.dayCount;Mt++){const Sr=new Date(We.year,We.month-1,Mt);ft.push({day:Mt,date:new Date(Sr),dayOfWeek:Sr.getDay(),isToday:Kt(Sr),isWeekend:Sr.getDay()===0||Sr.getDay()===6})}const kt=60,bt=Ue,ut=Ue+kt;we.push({year:We.year,month:We.month,yearMonthLabel:a(We.year,We.month),startDate:We.startDate,endDate:We.endDate,isMonthView:!0,monthData:{monthLabel:We.monthLabel,isToday:We.isToday,dayCount:We.dayCount},subDays:ft,days:ft.map(Mt=>({day:Mt.day,date:Mt.date,label:String(Mt.day).padStart(2,"0"),isToday:Mt.isToday,isWeekend:Mt.isWeekend})),_debugInfo:{monthStartPosition:bt,monthEndPosition:ut,monthWidth:kt}}),Ue+=kt}return we},Ht=()=>{const H=f.value.startDate,te=f.value.endDate,K=[],ue=H.getFullYear(),we=te.getFullYear();for(let Ue=ue;Ue<=we;Ue++){const Ge=[];for(let We=1;We<=4;We++){const ft=(We-1)*3,kt=new Date(Ue,ft,1),bt=ft+2,ut=new Date(Ue,bt+1,0);Ge.push({quarter:We,label:`Q${We}`,fullLabel:`${Ue}年第${We}季度`,startDate:kt,endDate:ut,isToday:Jt(kt,ut),year:Ue})}K.push({year:Ue,yearLabel:String(Ue),startDate:new Date(Ue,0,1),endDate:new Date(Ue,11,31),quarters:Ge})}return K},Jt=(H,te)=>{const K=new Date;return K.setHours(0,0,0,0),K>=H&&K<=te},Ar=()=>{const H=f.value.startDate,te=f.value.endDate,K=[],ue=H.getFullYear(),we=te.getFullYear();for(let Ue=ue;Ue<=we;Ue++){const Ge=[{label:l("halfYearFirst"),startDate:new Date(Ue,0,1),endDate:new Date(Ue,6,0),width:180},{label:l("halfYearSecond"),startDate:new Date(Ue,6,1),endDate:new Date(Ue,11,31),width:180}];K.push({year:Ue,startDate:new Date(Ue,0,1),endDate:new Date(Ue,11,31),halfYears:Ge,width:360})}return K},mr=H=>{n("add-predecessor",H)},rA=H=>{n("add-successor",H)};return(H,te)=>(i.openBlock(),i.createElementBlock("div",{ref_key:"timelineContainer",ref:or,class:"timeline",onMousedown:xs,onScroll:mi},[i.createElementVNode("div",UF,[v.value===i.unref(qe).YEAR&&Kn.value&&Kn.value.length>0?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createElementVNode("div",DF,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(Kn.value,K=>(i.openBlock(),i.createElementBlock("div",{key:`year-${K.year}`,class:"timeline-year",style:{width:"360px"}},[i.createElementVNode("div",QF,i.toDisplayString(K.year),1)]))),128))]),i.createElementVNode("div",LF,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(Kn.value,K=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:`halfyear-${K.year}`},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(K.halfYears||[],ue=>(i.openBlock(),i.createElementBlock("div",{key:`halfyear-${K.year}-${ue.label}`,class:"timeline-half-year-item",style:{width:"180px"}},[i.createElementVNode("div",IF,i.toDisplayString(ue.label),1)]))),128))],64))),128))])],64)):v.value===i.unref(qe).MONTH?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createElementVNode("div",NF,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(ma.value,(K,ue)=>(i.openBlock(),i.createElementBlock("div",{key:`year-${ue}`,class:"timeline-year",style:{width:"720px"}},[i.createElementVNode("div",_F,i.toDisplayString(ue),1)]))),128))]),i.createElementVNode("div",MF,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(Gt.value,K=>{var ue,we;return i.openBlock(),i.createElementBlock("div",{key:`month-${K.year}-${K.month}`,class:i.normalizeClass(["timeline-month-item",{today:(ue=K.monthData)==null?void 0:ue.isToday}]),style:{width:"59px"}},[i.createElementVNode("div",OF,i.toDisplayString((we=K.monthData)==null?void 0:we.monthLabel),1)],2)}),128))])],64)):v.value===i.unref(qe).QUARTER?(i.openBlock(),i.createElementBlock(i.Fragment,{key:2},[i.createElementVNode("div",RF,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(Gt.value,K=>(i.openBlock(),i.createElementBlock("div",{key:`year-${K.year}`,class:"timeline-year",style:{width:"240px"}},[i.createElementVNode("div",HF,i.toDisplayString(K.yearLabel),1)]))),128))]),i.createElementVNode("div",PF,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(Gt.value,K=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:`quarters-${K.year}`},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(K.quarters,ue=>(i.openBlock(),i.createElementBlock("div",{key:`quarter-${K.year}-${ue.quarter}`,class:i.normalizeClass(["timeline-quarter-item",{today:ue.isToday}]),style:{width:"60px"}},[i.createElementVNode("div",VF,i.toDisplayString(ue.label),1)],2))),128))],64))),128))])],64)):v.value===i.unref(qe).HOUR?(i.openBlock(),i.createElementBlock("div",{key:3,class:"hour-header-container",style:i.normalizeStyle({width:`${uA.value}px`})},[i.createElementVNode("div",KF,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(gA.value,K=>(i.openBlock(),i.createElementBlock("div",{key:`date-${K.year}-${K.month}-${K.day}`,class:"timeline-day-item",style:i.normalizeStyle({position:"absolute",width:`${K.hours.length*40}px`,left:`${(K.hourOffset||0)*40}px`})},[i.createElementVNode("div",qF,i.toDisplayString(K.dateLabel),1)],4))),128))]),i.createElementVNode("div",jF,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(gA.value,K=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:`hours-${K.year}-${K.month}-${K.day}`},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(K.hours,(ue,we)=>(i.openBlock(),i.createElementBlock("div",{key:`hour-${K.year}-${K.month}-${K.day}-${ue.hour}`,class:i.normalizeClass(["timeline-hour-item",{today:ue.isToday,"non-working-hour":!ue.isWorkingHour}]),style:i.normalizeStyle({position:"absolute",width:"40px",left:`${(K.hourOffset+we)*40}px`})},[i.createElementVNode("div",WF,i.toDisplayString(ue.shortLabel),1)],6))),128))],64))),128))])],4)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:4},[i.createElementVNode("div",GF,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(Gt.value,K=>(i.openBlock(),i.createElementBlock("div",{key:`year-month-${K.year}-${K.month}`,class:"timeline-month",style:i.normalizeStyle({width:K.isWeekView?`${(K.weeks||[]).length*60}px`:`${(K.days||[]).length*30}px`})},[i.createElementVNode("div",YF,i.toDisplayString(K.yearMonthLabel),1)],4))),128)),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(wa.value,(K,ue)=>(i.openBlock(),i.createElementBlock("div",{key:`flag-${ue}`,class:"month-first-flag",style:i.normalizeStyle({left:`${K.left}px`,transform:"translateX(-50%)"})},[te[1]||(te[1]=i.createElementVNode("div",{class:"flag-pole"},null,-1)),i.createElementVNode("div",zF,i.toDisplayString(K.date),1)],4))),128))]),i.createElementVNode("div",$F,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(Gt.value,K=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:`timeline-${K.year}-${K.month}`},[K.isWeekView&&K.weeks?(i.openBlock(),i.createElementBlock("div",{key:0,class:"timeline-month-weeks",style:i.normalizeStyle({width:`${(K.weeks||[]).length*60}px`})},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(K.weeks||[],ue=>(i.openBlock(),i.createElementBlock("div",{key:`week-${K.year}-${K.month}-${ue.label}`,class:i.normalizeClass(["timeline-week",{today:ue.isToday}])},[i.createElementVNode("div",XF,i.toDisplayString(ue.label),1),te[2]||(te[2]=i.createElementVNode("div",{class:"week-sub-days"},null,-1))],2))),128))],4)):(i.openBlock(),i.createElementBlock("div",{key:1,class:"timeline-month-days",style:i.normalizeStyle({width:`${K.days.length*30}px`})},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(K.days,ue=>(i.openBlock(),i.createElementBlock("div",{key:`day-${K.year}-${K.month}-${ue.day}`,class:i.normalizeClass(["timeline-day",{today:ue.isToday,weekend:ue.isWeekend&&!ue.isToday}])},[i.createElementVNode("div",JF,i.toDisplayString(ue.label),1)],2))),128))],4))],64))),128))])],64))]),i.createElementVNode("div",{class:"timeline-body",onScroll:va},[i.createElementVNode("div",{ref_key:"bodyContentRef",ref:Lr,class:"timeline-body-content"},[i.createVNode(xF,{tasks:b.value,"task-bar-positions":ur.value,width:Vn.value,height:un.value,"offset-left":ta.value,"offset-top":kA.value,"highlighted-task-id":N.value,"highlighted-task-ids":oe.value,"hovered-task-id":G.value,"vertical-lines":Us.value,"show-vertical-lines":v.value===i.unref(qe).WEEK},null,8,["tasks","task-bar-positions","width","height","offset-left","offset-top","highlighted-task-id","highlighted-task-ids","hovered-task-id","vertical-lines","show-vertical-lines"]),i.createVNode(TF,{ref_key:"linkDragGuideRef",ref:$r,active:!!X.value&&!!re.value,width:Vn.value,height:un.value,"offset-left":ta.value,"offset-top":kA.value},null,8,["active","width","height","offset-left","offset-top"]),$t.value&&yr.value>=0?(i.openBlock(),i.createElementBlock("div",{key:0,class:"today-line-year-view",style:i.normalizeStyle({left:`${yr.value}px`,height:`${de.value}px`})},null,4)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:"day-columns",style:i.normalizeStyle({height:`${de.value}px`})},[v.value===i.unref(qe).HOUR?(i.openBlock(),i.createElementBlock("div",{key:0,class:"hour-columns-container",style:i.normalizeStyle({width:`${uA.value}px`,height:`${de.value}px`,position:"relative"})},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(gA.value,K=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:`day-col-${K.year}-${K.month}-${K.day}`},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(K.hours,(ue,we)=>(i.openBlock(),i.createElementBlock("div",{key:`hour-col-${K.year}-${K.month}-${K.day}-${ue.hour}`,class:i.normalizeClass(["hour-column",{today:ue.isToday,weekend:ue.isWeekend,"working-hour":ue.isWorkingHour,"rest-hour":!ue.isWorkingHour&&!ue.isWeekend}]),style:i.normalizeStyle({position:"absolute",width:"40px",height:`${de.value}px`,left:`${(K.hourOffset+we)*40}px`})},te[3]||(te[3]=[i.createElementVNode("div",{class:"quarter-hour-lines"},[i.createElementVNode("div",{class:"quarter-line",style:{left:"10px"}}),i.createElementVNode("div",{class:"quarter-line",style:{left:"20px"}}),i.createElementVNode("div",{class:"quarter-line",style:{left:"30px"}})],-1)]),6))),128))],64))),128))],4)):i.createCommentVNode("",!0),v.value===i.unref(qe).YEAR?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:1},i.renderList(Kn.value,K=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:`year-col-${K.year}`},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(K.halfYears||[],ue=>(i.openBlock(),i.createElementBlock("div",{key:`halfyear-col-${K.year}-${ue.label}`,class:"half-year-column",style:i.normalizeStyle({width:"180px",height:`${de.value}px`})},null,4))),128))],64))),128)):i.createCommentVNode("",!0),v.value===i.unref(qe).QUARTER?(i.openBlock(),i.createElementBlock("div",{key:2,class:"quarter-columns-container",style:i.normalizeStyle({width:`${uA.value}px`,height:`${de.value}px`,position:"relative"})},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(Gt.value,(K,ue)=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:`quarter-col-${K.year}`},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(K.quarters,(we,Ue)=>(i.openBlock(),i.createElementBlock("div",{key:`quarter-col-${K.year}-${we.quarter}`,class:i.normalizeClass(["quarter-column",{today:we.isToday}]),style:i.normalizeStyle({position:"absolute",width:"60px",height:`${de.value}px`,left:`${ue*240+Ue*60}px`})},null,6))),128))],64))),128))],4)):v.value!==i.unref(qe).HOUR&&v.value!==i.unref(qe).YEAR&&v.value!==i.unref(qe).QUARTER?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:3},i.renderList(Gt.value,K=>{var ue;return i.openBlock(),i.createElementBlock(i.Fragment,{key:`day-col-${K.year}-${K.month}`},[K.isMonthView?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["month-column",{today:(ue=K.monthData)==null?void 0:ue.isToday}]),style:i.normalizeStyle({width:"59px",height:`${de.value}px`})},null,6)):K.isWeekView&&K.weeks?(i.openBlock(),i.createElementBlock("div",{key:1,class:"month-week-columns",style:i.normalizeStyle({width:`${(K.weeks||[]).length*60}px`,height:`${de.value}px`})},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(K.weeks||[],we=>(i.openBlock(),i.createElementBlock("div",{key:`week-col-${K.year}-${K.month}-${we.label}`,class:i.normalizeClass(["week-column",{today:we.isToday}]),style:i.normalizeStyle({height:`${de.value}px`,width:"60px"})},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(we.subDays||[],(Ue,Ge)=>(i.openBlock(),i.createElementBlock("div",{key:`subday-col-${Ge}`,class:i.normalizeClass(["sub-day-column",{weekend:Ue.dayOfWeek===0||Ue.dayOfWeek===6,today:Kt(Ue.date)}]),style:i.normalizeStyle({height:`${de.value}px`,width:`${E.value}px`})},null,6))),128))],6))),128))],4)):(i.openBlock(),i.createElementBlock("div",{key:2,class:"month-day-columns",style:i.normalizeStyle({width:`${(K.days||[]).length*30}px`,height:`${de.value}px`})},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(K.days||[],we=>(i.openBlock(),i.createElementBlock("div",{key:`day-col-${K.year}-${K.month}-${we.day}`,class:i.normalizeClass(["day-column",{weekend:we.isWeekend,today:we.isToday}]),style:i.normalizeStyle({height:`${de.value}px`})},null,6))),128))],4))],64)}),128)):i.createCommentVNode("",!0)],4),i.createElementVNode("div",{class:"task-bar-container",style:i.normalizeStyle({height:`${de.value}px`})},[i.createElementVNode("div",{class:"task-rows",style:i.normalizeStyle({height:`${de.value}px`})},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(cA.value,({task:K,originalIndex:ue})=>{var we,Ue,Ge;return i.openBlock(),i.createElementBlock("div",{key:K.id,class:i.normalizeClass(["task-row",{"task-row-hovered":G.value===K.id}]),style:i.normalizeStyle({top:`${ue*51}px`}),onMouseenter:We=>$(K.id),onMouseleave:te[0]||(te[0]=We=>$(null))},[K.type==="milestone-group"&&K.children?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList(K.children,We=>(i.openBlock(),i.createBlock(vg,{key:We.id,date:We.startDate||"","row-height":50,"day-width":E.value,"start-date":v.value===i.unref(qe).YEAR||v.value===i.unref(qe).QUARTER?T().startDate:v.value===i.unref(qe).MONTH?S().startDate:f.value.startDate,"timeline-start":f.value.startDate,"timeline-end":f.value.endDate,"period-width":E.value,name:We.name,milestone:U(We),"scroll-left":_e.value,"container-width":je.value,"milestone-id":We.id,"other-milestones":vA(We.id),"timeline-data":Gt.value,"current-time-scale":v.value,"allow-drag-and-resize":r.allowDragAndResize&&!le.value,"is-in-highlight-mode":le.value,onMilestoneDoubleClick:me,"onUpdate:milestone":Ce,onDragEnd:Es},null,8,["date","day-width","start-date","timeline-start","timeline-end","period-width","name","milestone","scroll-left","container-width","milestone-id","other-milestones","timeline-data","current-time-scale","allow-drag-and-resize","is-in-highlight-mode"]))),128)):K.type==="milestone"?(i.openBlock(),i.createBlock(vg,{key:K.id,date:K.startDate||"","row-height":50,"day-width":E.value,"start-date":v.value===i.unref(qe).YEAR||v.value===i.unref(qe).QUARTER?T().startDate:v.value===i.unref(qe).MONTH?S().startDate:f.value.startDate,"timeline-start":f.value.startDate,"timeline-end":f.value.endDate,"period-width":E.value,name:K.name,milestone:U(K),"scroll-left":_e.value,"container-width":je.value,"milestone-id":K.id,"other-milestones":vA(K.id),"timeline-data":Gt.value,"current-time-scale":v.value,"allow-drag-and-resize":r.allowDragAndResize&&!le.value,"is-in-highlight-mode":le.value,onMilestoneDoubleClick:me,"onUpdate:milestone":Ce,onDragEnd:Es},null,8,["date","day-width","start-date","timeline-start","timeline-end","period-width","name","milestone","scroll-left","container-width","milestone-id","other-milestones","timeline-data","current-time-scale","allow-drag-and-resize","is-in-highlight-mode"])):K.type!=="milestone-group"&&K.type!=="milestone"?(i.openBlock(),i.createBlock(iy,{key:`taskbar-${K.id}-${Kr.value}`,task:K,"row-height":50,"day-width":E.value,"start-date":v.value===i.unref(qe).YEAR?T().startDate:v.value===i.unref(qe).MONTH?S().startDate:f.value.startDate,"is-parent":K.isParent,"scroll-left":_e.value,"container-width":je.value,"hide-bubbles":wt.value,"timeline-data":v.value===i.unref(qe).HOUR?gA.value:Gt.value,"current-time-scale":v.value,"task-bar-config":r.taskBarConfig,"allow-drag-and-resize":r.allowDragAndResize&&!le.value,"is-highlighted":oe.value.has(K.id),"is-primary-highlight":N.value===K.id,"is-in-highlight-mode":le.value,"drag-link-mode":X.value,"is-link-drag-source":((we=re.value)==null?void 0:we.id)===K.id,"is-valid-link-target":((Ue=se.value)==null?void 0:Ue.id)===K.id&&x.value===!0,"is-invalid-link-target":((Ge=se.value)==null?void 0:Ge.id)===K.id&&x.value===!1,"all-tasks":b.value,"onUpdate:task":Ln,onBarMounted:mA,onClick:We=>Qr(K,We),onDblclick:We=>bn(K),onDragEnd:dn,onResizeEnd:Cs,onScrollToPosition:so,onContextMenu:Zt,onStartTimer:Ds,onStopTimer:m,onAddPredecessor:mr,onAddSuccessor:rA,onDelete:Ss,onDeleteLink:Ts,onLongPress:ee,onLinkDragStart:fe,onLinkDragMove:Oe,onLinkDragEnd:Ve},i.createSlots({_:2},[H.$slots["custom-task-content"]?{name:"custom-task-content",fn:i.withCtx(We=>[i.renderSlot(H.$slots,"custom-task-content",i.mergeProps({ref_for:!0},We),void 0,!0)]),key:"0"}:void 0]),1032,["task","day-width","start-date","is-parent","scroll-left","container-width","hide-bubbles","timeline-data","current-time-scale","task-bar-config","allow-drag-and-resize","is-highlighted","is-primary-highlight","is-in-highlight-mode","drag-link-mode","is-link-drag-source","is-valid-link-target","is-invalid-link-target","all-tasks","onClick","onDblclick"])):i.createCommentVNode("",!0)],46,ZF)}),128))],4)],4)],512)],32)],544))}}),oy=sn(nk,[["__scopeId","data-v-7a809cc7"]]),ak={class:"gantt-toolbar"},ik={class:"toolbar-left"},sk={key:0,class:"gantt-btn-group gantt-add-btn-group"},ok=["title"],lk=["title"],ck={key:1,class:"gantt-btn-group gantt-expand-collapse-btn-group"},uk=["title"],fk=["title"],dk={key:2,class:"gantt-btn-group"},hk=["title"],gk=["title"],pk={class:"toolbar-right"},vk={key:0,class:"segmented-control time-scale-segmented"},mk={class:"segmented-track"},wk=["title","onClick"],Bk={key:1,class:"language-dropdown"},yk=["title"],bk={class:"lang-text"},Ck={key:0,class:"language-menu"},Ek=["onClick"],Fk={class:"option-text"},kk={key:0,class:"check-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},xk=["title"],Sk=["title"],Tk={key:0,class:"gantt-btn-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Uk={key:1,class:"gantt-btn-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Dk={class:"icon-fallback"},Qk=["title"],Lk={key:0,class:"gantt-btn-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Ik={key:1,class:"gantt-btn-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Nk={class:"icon-fallback"},_k={key:0,class:"confirm-dialog"},Mk={class:"dialog-content"},Ok={class:"dialog-message"},Rk={class:"dialog-actions"},Ou="gantt-theme",Hk="gantt-locale",Pk=i.defineComponent({__name:"GanttToolbar",props:{config:{default:()=>({})},onAddTask:{type:Function,default:void 0},onAddMilestone:{type:Function,default:void 0},onTodayLocate:{type:Function,default:void 0},onExportCsv:{type:Function,default:void 0},onExportPdf:{type:Function,default:void 0},onLanguageChange:{type:Function,default:void 0},onThemeChange:{type:Function,default:void 0},onFullscreenChange:{type:Function,default:void 0},onTimeScaleChange:{type:Function,default:void 0},onExpandAll:{type:Function,default:void 0},onCollapseAll:{type:Function,default:void 0},onSettingsConfirm:{type:Function,default:void 0}},emits:["add-task","add-milestone","today-locate","export-csv","export-pdf","language-change","theme-change","fullscreen-change","time-scale-change","expand-all","collapse-all"],setup(A,{emit:t}){const e=A,r=t,n={zh:"zh-CN",en:"en-US"},a=()=>{if(typeof window<"u"){const fe=localStorage.getItem(Ou);return fe!==null?fe==="dark":window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}return!1},{locale:o,setLocale:s,getTranslation:l}=ga(),c=i.ref("zh"),u=i.ref(a()),g=i.ref(!1),p=i.ref(!1),f=i.ref(qe.DAY),v=fe=>l(fe),w=i.computed(()=>v("language")),b=i.ref(!1),B=i.ref(null),F=i.ref(null),E=()=>{e.onAddTask&&typeof e.onAddTask=="function"?e.onAddTask():r("add-task")},k=()=>{e.onAddMilestone&&typeof e.onAddMilestone=="function"?e.onAddMilestone():r("add-milestone")},P=()=>{e.onTodayLocate&&typeof e.onTodayLocate=="function"?e.onTodayLocate():r("today-locate")},j=()=>{e.onExportCsv&&typeof e.onExportCsv=="function"?e.onExportCsv():r("export-csv")},M=()=>{e.onExportPdf&&typeof e.onExportPdf=="function"?e.onExportPdf():r("export-pdf")},O=()=>{e.onExpandAll&&typeof e.onExpandAll=="function"?e.onExpandAll():r("expand-all")},L=()=>{e.onCollapseAll&&typeof e.onCollapseAll=="function"?e.onCollapseAll():r("collapse-all")},R=()=>{p.value=!p.value},S=fe=>{c.value=fe,p.value=!1;const ce=n[c.value];s(ce),e.onLanguageChange&&typeof e.onLanguageChange=="function"?e.onLanguageChange(ce):r("language-change",ce),F.value=ce,B.value="language",b.value=!0},T=async()=>{if(!B.value||F.value===null){le();return}if(e.onSettingsConfirm&&typeof e.onSettingsConfirm=="function")try{if(!await e.onSettingsConfirm(B.value,F.value)){le();return}}catch{le();return}B.value==="theme"?G():B.value==="language"&&N(),le()},G=()=>{typeof window<"u"&&typeof F.value=="boolean"&&localStorage.setItem(Ou,F.value?"dark":"light")},N=()=>{typeof window<"u"&&typeof F.value=="string"&&localStorage.setItem(Hk,F.value)},oe=()=>{le()},le=()=>{b.value=!1,B.value=null,F.value=null},Z=()=>{const fe=!u.value;u.value=fe,document.documentElement.setAttribute("data-theme",fe?"dark":"light"),e.onThemeChange&&typeof e.onThemeChange=="function"?e.onThemeChange(fe):r("theme-change",fe),F.value=fe,B.value="theme",b.value=!0},ee=()=>{g.value=!g.value,window.dispatchEvent(new CustomEvent("fullscreen-toggle",{detail:g.value})),e.onFullscreenChange&&typeof e.onFullscreenChange=="function"?e.onFullscreenChange(g.value):r("fullscreen-change",g.value)},X={hour:{value:qe.HOUR,label:()=>v("timeScaleHour")},day:{value:qe.DAY,label:()=>v("timeScaleDay")},week:{value:qe.WEEK,label:()=>v("timeScaleWeek")},month:{value:qe.MONTH,label:()=>v("timeScaleMonth")},quarter:{value:qe.QUARTER,label:()=>v("timeScaleQuarter")},year:{value:qe.YEAR,label:()=>v("timeScaleYear")}},re=["hour","day","week","month","year"],se=i.computed(()=>{var Fe;const ce=(((Fe=e.config)==null?void 0:Fe.timeScaleDimensions)??re).filter(Pe=>Pe in X);return ce.length>0?ce:[...re]}),x=i.computed(()=>{var Fe;const fe=se.value,ce=(Fe=e.config)==null?void 0:Fe.defaultTimeScale;return ce&&fe.includes(ce)?ce:fe.includes("day")?"day":fe[0]??"day"}),I=fe=>{f.value=fe,e.onTimeScaleChange&&typeof e.onTimeScaleChange=="function"?e.onTimeScaleChange(fe):r("time-scale-change",fe)};let W=!1;i.watch(()=>x.value,fe=>{const ce=X[fe].value;(f.value!==ce||!W)&&(W=!0,I(ce))},{immediate:!0});const z=i.computed(()=>se.value.find(ce=>X[ce].value===f.value)??x.value),Ae=()=>{const fe=se.value.findIndex(Ze=>Ze===z.value),ce=se.value.length;if(ce===0||fe<0)return{transform:"translateX(0%)",width:`${100/ce||25}%`};const Fe=100/ce;return{transform:`translateX(${fe*100}%)`,width:`${Fe}%`}},he=fe=>{!fe.target.closest(".language-dropdown")&&p.value&&(p.value=!1)};return i.onMounted(()=>{const fe=o.value;c.value=fe==="zh-CN"?"zh":"en",document.documentElement.setAttribute("data-theme",u.value?"dark":"light"),document.addEventListener("click",he),window.matchMedia&&typeof window<"u"&&!localStorage.getItem(Ou)&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",ce=>{u.value=ce.matches,document.documentElement.setAttribute("data-theme",ce.matches?"dark":"light")})}),i.onUnmounted(()=>{document.removeEventListener("click",he)}),(fe,ce)=>(i.openBlock(),i.createElementBlock("div",ak,[i.createElementVNode("div",ik,[fe.config.showAddTask!==!1||fe.config.showAddMilestone!==!1?(i.openBlock(),i.createElementBlock("div",sk,[fe.config.showAddTask!==!1?(i.openBlock(),i.createElementBlock("button",{key:0,class:"gantt-btn-group-item",title:v("addTask"),onClick:E},[ce[0]||(ce[0]=i.createElementVNode("svg",{class:"gantt-btn-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[i.createElementVNode("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),i.createElementVNode("line",{x1:"5",y1:"12",x2:"19",y2:"12"})],-1)),i.createTextVNode(" "+i.toDisplayString(v("addTask")),1)],8,ok)):i.createCommentVNode("",!0),fe.config.showAddMilestone!==!1?(i.openBlock(),i.createElementBlock("button",{key:1,class:"gantt-btn-group-item",title:v("addMilestone"),onClick:k},[ce[1]||(ce[1]=i.createStaticVNode('<svg class="gantt-btn-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-ed3a47c3><g transform="rotate(45 12 12)" data-v-ed3a47c3><rect x="4" y="4" width="16" height="16" rx="4" ry="4" fill="none" stroke="currentColor" data-v-ed3a47c3></rect></g><line x1="12" y1="8" x2="12" y2="16" data-v-ed3a47c3></line><line x1="8" y1="12" x2="16" y2="12" data-v-ed3a47c3></line></svg>',1)),i.createTextVNode(" "+i.toDisplayString(v("addMilestone")),1)],8,lk)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),fe.config.showExpandCollapse!==!1?(i.openBlock(),i.createElementBlock("div",ck,[i.createElementVNode("button",{class:"gantt-btn-group-item",title:v("expandAll"),onClick:O},[ce[2]||(ce[2]=i.createElementVNode("svg",{class:"gantt-btn-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[i.createElementVNode("polyline",{points:"6 9 12 15 18 9"})],-1)),i.createTextVNode(" "+i.toDisplayString(v("expandAll")),1)],8,uk),i.createElementVNode("button",{class:"gantt-btn-group-item",title:v("collapseAll"),onClick:L},[ce[3]||(ce[3]=i.createElementVNode("svg",{class:"gantt-btn-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[i.createElementVNode("polyline",{points:"18 15 12 9 6 15"})],-1)),i.createTextVNode(" "+i.toDisplayString(v("collapseAll")),1)],8,fk)])):i.createCommentVNode("",!0),fe.config.showExportCsv!==!1||fe.config.showExportPdf!==!1?(i.openBlock(),i.createElementBlock("div",dk,[fe.config.showExportCsv!==!1?(i.openBlock(),i.createElementBlock("button",{key:0,class:"gantt-btn-group-item",title:v("exportCsv"),onClick:j},[ce[4]||(ce[4]=i.createStaticVNode('<svg class="gantt-btn-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-ed3a47c3><path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z" data-v-ed3a47c3></path><polyline points="14,2 14,8 20,8" data-v-ed3a47c3></polyline><line x1="16" y1="13" x2="8" y2="13" data-v-ed3a47c3></line><line x1="16" y1="17" x2="8" y2="17" data-v-ed3a47c3></line><polyline points="10,9 9,9 8,9" data-v-ed3a47c3></polyline></svg>',1)),i.createTextVNode(" "+i.toDisplayString(v("exportCsv")),1)],8,hk)):i.createCommentVNode("",!0),fe.config.showExportPdf!==!1?(i.openBlock(),i.createElementBlock("button",{key:1,class:"gantt-btn-group-item",title:v("exportPdf"),onClick:M},[ce[5]||(ce[5]=i.createStaticVNode('<svg class="gantt-btn-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-ed3a47c3><path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z" data-v-ed3a47c3></path><polyline points="14,2 14,8 20,8" data-v-ed3a47c3></polyline><line x1="16" y1="13" x2="8" y2="13" data-v-ed3a47c3></line><line x1="16" y1="17" x2="8" y2="17" data-v-ed3a47c3></line><line x1="12" y1="13" x2="12" y2="17" data-v-ed3a47c3></line></svg>',1)),i.createTextVNode(" "+i.toDisplayString(v("exportPdf")),1)],8,gk)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),i.createElementVNode("div",pk,[fe.config.showTimeScale!==!1?(i.openBlock(),i.createElementBlock("div",vk,[i.createElementVNode("div",mk,[i.createElementVNode("div",{class:"segmented-thumb",style:i.normalizeStyle(Ae())},null,4)]),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(se.value,Fe=>(i.openBlock(),i.createElementBlock("button",{key:Fe,class:i.normalizeClass(["segmented-item",{active:z.value===Fe}]),title:v("timeScaleTooltip"),onClick:Pe=>I(X[Fe].value)},i.toDisplayString(X[Fe].label()),11,wk))),128))])):i.createCommentVNode("",!0),fe.config.showLanguage!==!1?(i.openBlock(),i.createElementBlock("div",Bk,[i.createElementVNode("button",{class:"toolbar-lang-btn",title:v("languageTooltip"),onClick:R},[ce[6]||(ce[6]=i.createElementVNode("svg",{class:"gantt-btn-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[i.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),i.createElementVNode("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),i.createElementVNode("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})],-1)),i.createElementVNode("span",bk,i.toDisplayString(w.value),1),ce[7]||(ce[7]=i.createElementVNode("svg",{class:"dropdown-arrow",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[i.createElementVNode("polyline",{points:"6,9 12,15 18,9"})],-1))],8,yk),p.value?(i.openBlock(),i.createElementBlock("div",Ck,[(i.openBlock(),i.createElementBlock(i.Fragment,null,i.renderList(["zh","en"],Fe=>i.createElementVNode("div",{key:Fe,class:i.normalizeClass(["language-option",{active:c.value===Fe}]),onClick:Pe=>S(Fe)},[i.createElementVNode("span",Fk,i.toDisplayString(Fe==="zh"?"中文":"English"),1),c.value===Fe?(i.openBlock(),i.createElementBlock("svg",kk,ce[8]||(ce[8]=[i.createElementVNode("polyline",{points:"20,6 9,17 4,12"},null,-1)]))):i.createCommentVNode("",!0)],10,Ek)),64))])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),fe.config.showTodayLocate!==!1?(i.openBlock(),i.createElementBlock("button",{key:2,class:"toolbar-icon-btn today-locate-btn",title:v("todayLocateTooltip"),onClick:P},ce[9]||(ce[9]=[i.createStaticVNode('<svg class="gantt-btn-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-ed3a47c3><rect x="3" y="4" width="18" height="18" rx="2" ry="2" data-v-ed3a47c3></rect><line x1="16" y1="2" x2="16" y2="6" data-v-ed3a47c3></line><line x1="8" y1="2" x2="8" y2="6" data-v-ed3a47c3></line><line x1="3" y1="10" x2="21" y2="10" data-v-ed3a47c3></line><circle cx="12" cy="16" r="1" data-v-ed3a47c3></circle></svg>',1)]),8,xk)):i.createCommentVNode("",!0),fe.config.showTheme!==!1?(i.openBlock(),i.createElementBlock("button",{key:3,class:"toolbar-icon-btn",title:v(u.value?"lightMode":"darkMode"),onClick:Z},[u.value?(i.openBlock(),i.createElementBlock("svg",Tk,ce[10]||(ce[10]=[i.createStaticVNode('<circle cx="12" cy="12" r="5" data-v-ed3a47c3></circle><line x1="12" y1="1" x2="12" y2="3" data-v-ed3a47c3></line><line x1="12" y1="21" x2="12" y2="23" data-v-ed3a47c3></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64" data-v-ed3a47c3></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78" data-v-ed3a47c3></line><line x1="1" y1="12" x2="3" y2="12" data-v-ed3a47c3></line><line x1="21" y1="12" x2="23" y2="12" data-v-ed3a47c3></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36" data-v-ed3a47c3></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22" data-v-ed3a47c3></line>',9)]))):(i.openBlock(),i.createElementBlock("svg",Uk,ce[11]||(ce[11]=[i.createElementVNode("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"},null,-1)]))),i.createElementVNode("span",Dk,i.toDisplayString(u.value?"☀️":"🌙"),1)],8,Sk)):i.createCommentVNode("",!0),fe.config.showFullscreen!==!1?(i.openBlock(),i.createElementBlock("button",{key:4,class:"toolbar-icon-btn",title:v(g.value?"exitFullscreen":"fullscreen"),onClick:ee},[g.value?(i.openBlock(),i.createElementBlock("svg",Lk,ce[12]||(ce[12]=[i.createElementVNode("path",{d:"M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3"},null,-1)]))):(i.openBlock(),i.createElementBlock("svg",Ik,ce[13]||(ce[13]=[i.createElementVNode("path",{d:"M8 3H5a2 2 0 00-2 2v3m18 0V5a2 2 0 00-2-2h-3m0 18h3a2 2 0 002-2v-3M3 16v3a2 2 0 002 2h3"},null,-1)]))),i.createElementVNode("span",Nk,i.toDisplayString(g.value?"⇲":"⇱"),1)],8,Qk)):i.createCommentVNode("",!0)]),b.value?(i.openBlock(),i.createElementBlock("div",_k,[i.createElementVNode("div",Mk,[i.createElementVNode("p",Ok,i.toDisplayString(v("confirmDialogMessage")),1),i.createElementVNode("div",Rk,[i.createElementVNode("button",{class:"gantt-btn gantt-btn-default",onClick:oe},i.toDisplayString(v("cancel")),1),i.createElementVNode("button",{class:"gantt-btn gantt-btn-primary",onClick:T},i.toDisplayString(v("confirm")),1)])])])):i.createCommentVNode("",!0)]))}}),Vk=sn(Pk,[["__scopeId","data-v-ed3a47c3"]]),Kk={success:"#67c23a",warning:"#e6a23c",error:"#f56c6c",info:"#909399"};let ns=null;function qk(){return ns||(ns=document.createElement("div"),ns.className="message-container",ns.style.cssText=`
|
|
1
|
+
"use strict";var CE=Object.defineProperty;var EE=(A,t,e)=>t in A?CE(A,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):A[t]=e;var kr=(A,t,e)=>EE(A,typeof t!="symbol"?t+"":t,e);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue"),gc={"zh-CN":{dateNotSet:"未设置",taskName:"任务名称",predecessor:"前置任务",assignee:"分配人",startDate:"开始日期",endDate:"结束日期",estimatedHours:"预计工时(hr)",actualHours:"实际工时(hr)",progress:"进度",type:"类型",description:"描述",csvHeaders:{id:"ID",taskName:"任务名称",predecessor:"前置任务",assignee:"分配人",startDate:"开始日期",endDate:"结束日期",estimatedHours:"预计工时(hr)",actualHours:"实际工时(hr)",progress:"进度(%)",type:"类型",description:"描述"},yearMonthFormat:(A,t)=>`${A}年${String(t).padStart(2,"0")}月`,monthFormat:A=>`${A}月`,monthNames:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],weekDays:["日","一","二","三","四","五","六"],milestone:"里程碑",targetDate:"目标日期",today:"今天",milestoneDetails:"里程碑详情",milestoneName:"里程碑名称",milestoneDate:"里程碑日期",milestoneIcon:"里程碑图标",diamond:"菱形",rocket:"火箭",enterMilestoneName:"请输入里程碑名称",enterAssignee:"请输入负责人",enterDescription:"请输入描述信息",milestoneNameRequired:"里程碑名称为必填项",milestoneDateRequired:"里程碑日期为必填项",save:"保存",close:"关闭",confirm:"确认",delete:"删除",confirmDelete:"确定要删除这个里程碑吗?",addTask:"新增需求/任务",addMilestone:"新增里程碑",todayLocate:"今日",todayLocateTooltip:"定位到今天",exportCsv:"导出 CSV",exportPdf:"导出 PDF",expandAll:"全部展开",collapseAll:"全部折叠",language:"中文",languageTooltip:"选择语言",lightMode:"明亮模式",darkMode:"暗黑模式",fullscreen:"全屏",exitFullscreen:"退出全屏",githubDocs:"查看Github文档",giteeDocs:"查看Gitee文档",timeScaleHour:"时",timeScaleDay:"日",timeScaleWeek:"周",timeScaleMonth:"月",timeScaleQuarter:"季",timeScaleYear:"年",timeScaleTooltip:"切换时间刻度",halfYearFirst:"上半年",halfYearSecond:"下半年",confirmDialogMessage:"是否需要保留该设置?",newTask:"新建任务",taskNamePlaceholder:"请输入任务名称",assigneePlaceholder:"请输入负责人",progressPlaceholder:"0-100",hoursPlaceholder:"工时",descriptionPlaceholder:"请输入任务描述...",hours:"小时",create:"创建",taskNameRequired:"任务名称不能为空",startDateRequired:"开始日期不能为空",endDateRequired:"结束日期不能为空",endDateInvalid:"结束日期不能早于开始日期",newMilestone:"新建里程碑",editMilestone:"编辑里程碑",cancel:"取消",startTimer:"开始计时",stopTimer:"停止计时",timerStarted:"任务计时已开始",timerStopped:"任务计时已停止",addPredecessor:"添加前置任务",addSuccessor:"添加后置任务",pdfExportLoading:"正在生成PDF,请稍候...",pdfExportTitle:"甘特图导出",pdfExportDate:"导出日期",milestoneGroup:"里程碑",collapseTaskList:"收起任务列表",expandTaskList:"展开任务列表",taskType:"任务类型",taskTypeRequired:"请选择任务类型",taskTypeMap:{task:"任务",milestone:"里程碑",story:"需求",epic:"史诗",bug:"缺陷"},editTask:"编辑任务",parentTask:"上级任务",time:"时间",selectTime:"选择时间",hour:"时",minute:"分",noParentTask:"无上级任务",update:"更新",taskNameTooLong:"任务名称不能超过50个字符",predecessorPlaceholder:"请选择前置任务",selectPredecessor:"选择前置任务",removePredecessor:"移除前置任务",deleteLinks:"删除链接",noLinks:"无链接",predecessorLink:"前置: {name}",successorLink:"后置: {name}",operationFailed:"操作失败,请重试",taskUpdateSuccess:"任务更新成功",taskCreateSuccess:"任务创建成功",confirmDeleteTask:'确定要删除任务"{name}"吗?此操作不可撤销。',taskDeleteFailed:"删除失败,请重试",confirmDeleteStory:"是否删除该需求{name}及其所有的子任务?该操作不可撤回",storyDeleteYes:"是, 继续",storyDeleteNo:"不,仅删除需求",storyDeleteAllSuccess:"已删除需求【{name}】及其所有子任务",storyDeleteOnlySuccess:"已删除需求【{name}】,{count}个子任务已升级保留",storyNotFound:"未找到要删除的需求,ID:{id}",milestoneDeleteSuccess:"里程碑删除成功",taskDeletedSuccess:"已删除任务",selectAssignee:"请选择负责人",customCsvExportCalled:"自定义CSV导出被调用",languageSwitchedTo:"语言切换到:{language}",themeSwitchedTo:"主题切换到:{theme}",lightModeText:"明亮模式",darkModeText:"暗黑模式",taskNotFound:"未找到要更新的任务,ID:{id}",newParentTaskNotFound:"未找到新父任务,ID:{parentId},将作为顶级任务添加",inPlaceUpdateFailed:"就地更新失败,未找到任务,ID:{id}",taskToDeleteNotFound:"未找到要删除的任务,ID:{id}",milestoneIconUpdateNotFound:"未找到要更新图标的里程碑,ID:{id}",overtime:"超",overdue:"逾期",days:"天",timerConfirmPrefix:"即将为任务",timerConfirmSuffix:"计时,若有特殊说明请完善下面的描述",timerConfirmPlaceholder:"请输入计时说明",configDemo:"配置演示",taskListConfig:{title:"TaskList 配置",columns:{title:"列显示(默认渲染模式下生效)",renderMode:"渲染模式",renderModeDefault:"默认(通过 TaskListColumnConfig 设置)",renderModeDeclarative:"声明式(使用 TaskListColumn 设置可见列)"},width:{title:"宽度设置",defaultWidth:"默认宽度",minWidth:"最小宽度",maxWidth:"最大宽度",pixelsModel:"像素 (px)",percentageModel:"百分比 (%)"}},taskBarConfig:{title:"TaskBar 配置",display:{title:"显示选项",showAvatar:"显示头像 (Avatar)",showTitle:"显示标题 (Title)",showProgress:"显示进度 (Progress)"},mistouch:{title:"防误触配置",dragThreshold:"拖拽阈值 (px)",dragThresholdHint:"移动超过此距离才触发拖拽",resizeHandleWidth:"拉伸手柄宽度 (px)",resizeHandleWidthHint:"调整手柄的可点击宽度 (5-15px)",enableDragDelay:"启用拖拽延迟",enableDragDelayHint:"按住一段时间后才能拖拽",dragDelayTime:"延迟时间 (ms)",dragDelayTimeHint:"延迟启动拖拽的时间",allowDragOnClick:"允许拖拽和拉伸 TaskBar 和 Milestone",allowDragOnClickHint:"控制是否允许拖拽 TaskBar 和 Milestone,以及拉伸 TaskBar 的长度"}},disableTaskbarFocusMode:"关闭聚焦功能",dataSourceAlreadyLoaded:"{name} 已是当前数据源",dataSourceLoadSuccess:"已加载 {name}",dataSourceLoadFailed:"{name} 加载失败",dataSourceSwitch:{title:"数据源切换",subtitle:"对比常规与超大数据集的初始化体验",loading:"数据加载中,请稍候...",alreadyLoaded:"{name} 已是当前数据源",loadSuccess:"已加载 {name}",loadFailed:"{name} 加载失败",sources:{normal:{label:"常规数据源",description:"data.json · 含完整前/后置依赖,适合功能演示",badge:"data.json"},large:{label:"超大数据源",description:"data-large-1m.json · 百万级任务,验证虚拟渲染性能",badge:"data-large-1m.json"}}}},"en-US":{dateNotSet:"Not set",taskName:"Task Name",predecessor:"Predecessor",assignee:"Assignee",startDate:"Start Date",endDate:"End Date",estimatedHours:"Est. Hours",actualHours:"Act. Hours",progress:"Progress",type:"Type",csvHeaders:{id:"ID",taskName:"Task Name",predecessor:"Predecessor",assignee:"Assignee",startDate:"Start Date",endDate:"End Date",estimatedHours:"Est. Hours",actualHours:"Act. Hours",progress:"Progress (%)",type:"Type",description:"Description"},yearMonthFormat:(A,t)=>`${A}/${String(t).padStart(2,"0")}`,monthFormat:A=>`${String(A).padStart(2,"0")}`,monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],milestone:"Milestone",today:"Today",targetDate:"Target Date",milestoneDetails:"Milestone Details",milestoneName:"Milestone Name",milestoneDate:"Milestone Date",milestoneIcon:"Milestone Icon",diamond:"Diamond",rocket:"Rocket",enterMilestoneName:"Enter milestone name",enterAssignee:"Enter assignee",enterDescription:"Enter description",milestoneNameRequired:"Milestone name is required",milestoneDateRequired:"Milestone date is required",save:"Save",close:"Close",confirm:"Confirm",description:"Description",delete:"Delete",confirmDelete:"Are you sure you want to delete this milestone?",addTask:"Add Requirement/Task",addMilestone:"Add Milestone",todayLocate:"Today",todayLocateTooltip:"Locate to today",exportCsv:"Export CSV",exportPdf:"Export PDF",expandAll:"Expand All",collapseAll:"Collapse All",language:"English",languageTooltip:"Select language",lightMode:"Light Mode",darkMode:"Dark Mode",fullscreen:"Fullscreen",exitFullscreen:"Exit Fullscreen",githubDocs:"GitHub Docs",giteeDocs:"Gitee Docs",timeScaleHour:"Hour",timeScaleDay:"Day",timeScaleWeek:"Week",timeScaleMonth:"Month",timeScaleQuarter:"Quarter",timeScaleYear:"Year",timeScaleTooltip:"Switch Time Scale",halfYearFirst:"First Half",halfYearSecond:"Second Half",confirmDialogMessage:"Do you want to save this setting?",taskNamePlaceholder:"Enter task name",assigneePlaceholder:"Enter assignee",progressPlaceholder:"0-100",hoursPlaceholder:"Hours",descriptionPlaceholder:"Enter task description...",hours:"Hours",create:"Create",taskNameRequired:"Task name is required",startDateRequired:"Start date is required",endDateRequired:"End date is required",endDateInvalid:"End date cannot be earlier than start date",newMilestone:"New Milestone",editMilestone:"Edit Milestone",cancel:"Cancel",timerStarted:"Timer Started",timerStopped:"Timer Stopped",startTimer:"Start Timer",stopTimer:"Stop Timer",addPredecessor:"Add Predecessor",addSuccessor:"Add Successor",pdfExportLoading:"Generating PDF, please wait...",pdfExportTitle:"Gantt Chart Export",pdfExportDate:"Export Date",milestoneGroup:"Milestone",collapseTaskList:"Collapse Task List",expandTaskList:"Expand Task List",taskType:"Task Type",taskTypeRequired:"Please select task type",taskTypeMap:{task:"Task",milestone:"Milestone",story:"Story",epic:"Epic",bug:"Bug"},editTask:"Edit Task",newTask:"New Task",parentTask:"Parent Task",time:"Time",selectTime:"Select Time",hour:"Hour",minute:"Minute",noParentTask:"No Parent Task",update:"Update",taskNameTooLong:"Task name cannot exceed 50 characters",predecessorPlaceholder:"Select predecessor",selectPredecessor:"Select Predecessor",removePredecessor:"Remove Predecessor",deleteLinks:"Delete Links",noLinks:"No Links",predecessorLink:"Predecessor: {name}",successorLink:"Successor: {name}",operationFailed:"Operation failed, please try again",taskUpdateSuccess:"Task updated successfully",taskCreateSuccess:"Task created successfully",confirmDeleteTask:'Are you sure you want to delete task "{name}"? This action cannot be undone.',taskDeleteFailed:"Delete failed, please try again",confirmDeleteStory:"Do you want to delete the requirement {name} and all its subtasks? This action cannot be undone",storyDeleteYes:"Yes, Continue",storyDeleteNo:"No, Delete Requirement Only",storyDeleteAllSuccess:"Deleted requirement [{name}] and all its subtasks",storyDeleteOnlySuccess:"Deleted requirement [{name}], {count} subtasks have been promoted",storyNotFound:"Requirement not found, ID: {id}",milestoneDeleteSuccess:"Milestone deleted successfully",taskDeletedSuccess:"Task deleted",selectAssignee:"Select assignee",customCsvExportCalled:"Custom CSV export called",languageSwitchedTo:"Language switched to: {language}",themeSwitchedTo:"Theme switched to: {theme}",lightModeText:"Light Mode",darkModeText:"Dark Mode",taskNotFound:"Task not found for update, ID: {id}",newParentTaskNotFound:"New parent task not found, ID: {parentId}, will be added as top-level task",inPlaceUpdateFailed:"In-place update failed, task not found, ID: {id}",taskToDeleteNotFound:"Task to delete not found, ID: {id}",milestoneIconUpdateNotFound:"Milestone not found for icon update, ID: {id}",overtime:"Over",overdue:"Overdue",days:" days",timerConfirmPrefix:"About to start timing for",timerConfirmSuffix:". If there are special notes, please complete the description below.",timerConfirmPlaceholder:"Please enter timer description",configDemo:"Configuration Demo",taskListConfig:{title:"TaskList Configuration",columns:{title:"Columns(默effective in default render mode)",renderMode:"Render Mode",renderModeDefault:"Default (via TaskListColumnConfig)",renderModeDeclarative:"Declarative (via TaskListColumn)"},width:{title:"Width Settings",defaultWidth:"Default Width",minWidth:"Min Width",maxWidth:"Max Width",pixelsModel:"pixels (px)",percentageModel:"percentage (%)"}},taskBarConfig:{title:"TaskBar Configuration",display:{title:"Display Options",showAvatar:"Show Avatar",showTitle:"Show Title",showProgress:"Show Progress"},mistouch:{title:"Mistouch Prevention",dragThreshold:"Drag Threshold (px)",dragThresholdHint:"Distance to trigger dragging",resizeHandleWidth:"Resize Handle Width (px)",resizeHandleWidthHint:"Clickable width of resize handle (5-15px)",enableDragDelay:"Enable Drag Delay",enableDragDelayHint:"Hold to drag after a delay",dragDelayTime:"Delay Time (ms)",dragDelayTimeHint:"Delay time before dragging starts",allowDragOnClick:"Allow dragging and resizing of TaskBars and Milestones",allowDragOnClickHint:"Controls whether to allow dragging of TaskBars and Milestones, as well as resizing the length of TaskBars"}},disableTaskbarFocusMode:"Disable Focus Mode",dataSourceAlreadyLoaded:"{name} is already active",dataSourceLoadSuccess:"{name} loaded successfully",dataSourceLoadFailed:"{name} failed to load",dataSourceSwitch:{title:"Data Sources",subtitle:"Compare default vs. mega dataset initialization",loading:"Loading data, please wait…",alreadyLoaded:"{name} is already active",loadSuccess:"{name} loaded successfully",loadFailed:"{name} failed to load",sources:{normal:{label:"Standard Dataset",description:"data.json · Full predecessor graph for feature demos",badge:"data.json"},large:{label:"Massive Dataset",description:"data-large-1m.json · Million-level tasks to stress virtual rendering",badge:"data-large-1m.json"}}}}};function Vv(A,t){gc[A]&&(gc[A]={...gc[A],...t},pc.value===A&&window.dispatchEvent(new CustomEvent("locale-changed",{detail:{locale:A}})))}const FE="gantt-locale",kE=()=>{if(typeof window<"u"){const A=localStorage.getItem(FE);if(A&&(A==="zh-CN"||A==="en-US"))return A}return"zh-CN"},pc=i.ref(kE());function ga(){const A=i.computed(()=>gc[pc.value]),t=s=>{const l=A.value[s];return typeof l=="string"?l:s},e=(s,l)=>{let c=t(s);return Object.keys(l).forEach(u=>{c=c.replace(new RegExp(`{${u}}`,"g"),String(l[u]))}),c},r=s=>{pc.value=s,window.dispatchEvent(new CustomEvent("locale-changed",{detail:{locale:s}}))},n=i.computed(()=>pc.value);return{t:A,getTranslation:t,formatTranslation:e,locale:n,setLocale:r,formatYearMonth:(s,l)=>A.value.yearMonthFormat(s,l),formatMonth:s=>A.value.monthFormat(s)}}function xE(A){if(!A)return null;const[t,e,r]=A.split("-").map(Number);return new Date(t,e-1,r)}function la(A){return A?Array.isArray(A)&&typeof A[0]=="number"?A:Array.isArray(A)?A.filter(t=>t&&t.toString().trim()).map(t=>Number(t.toString().trim())).filter(t=>!isNaN(t)):A.split(",").map(t=>t.trim()).filter(t=>t).map(t=>Number(t)).filter(t=>!isNaN(t)):[]}function pg(A){const t=la(A);return t.length>0?t.join(", "):"-"}const SE={class:"confirm-timer-dialog-overlay"},TE={class:"confirm-timer-dialog"},UE={class:"dialog-message"},DE={class:"task-name-highlight"},QE=["placeholder"],LE={class:"dialog-actions"},IE=i.defineComponent({__name:"ConfirmTimerDialog",props:{visible:Boolean,title:{type:String,default:"确认开始计时"},message:{type:String,default:""},defaultDesc:{type:String,default:""},placeholder:{type:String,default:"请输入计时说明"}},emits:["confirm","cancel"],setup(A,{emit:t}){const e=A,r=t,{getTranslation:n}=ga(),a=i.ref(e.defaultDesc);i.watch(()=>e.visible,l=>{l&&(a.value=e.defaultDesc)});const o=()=>r("confirm",a.value),s=i.computed(()=>{if(e.message){const l=e.message.match(/任务([\S\s]+?)计时|Task ([\S\s]+?) timing/);if(l&&(l[1]||l[2]))return l[1]||l[2]}return e.defaultDesc});return(l,c)=>(i.openBlock(),i.createElementBlock("div",SE,[i.createElementVNode("div",TE,[i.createElementVNode("div",UE,[i.createElementVNode("span",null,i.toDisplayString(i.unref(n)("timerConfirmPrefix")),1),i.createElementVNode("span",DE,i.toDisplayString(s.value),1),i.createElementVNode("span",null,i.toDisplayString(i.unref(n)("timerConfirmSuffix")),1)]),i.withDirectives(i.createElementVNode("textarea",{"onUpdate:modelValue":c[0]||(c[0]=u=>a.value=u),class:"dialog-textarea",placeholder:i.unref(n)("timerConfirmPlaceholder"),rows:"3"},null,8,QE),[[i.vModelText,a.value]]),i.createElementVNode("div",LE,[i.createElementVNode("button",{class:"gantt-btn gantt-btn-default",onClick:c[1]||(c[1]=u=>l.$emit("cancel"))},i.toDisplayString(i.unref(n)("cancel")),1),i.createElementVNode("button",{class:"gantt-btn gantt-btn-confirm",onClick:o},i.toDisplayString(i.unref(n)("startTimer")),1)])])]))}}),sn=(A,t)=>{const e=A.__vccOpts||A;for(const[r,n]of t)e[r]=n;return e},ry=sn(IE,[["__scopeId","data-v-c362ca3d"]]),NE={class:"gantt-confirm-header"},_E={class:"gantt-confirm-title"},ME={class:"gantt-confirm-content"},OE={class:"gantt-confirm-footer"},RE={class:"gantt-confirm-footer-right"},HE=i.defineComponent({__name:"GanttConfirmDialog",props:{visible:Boolean,title:{type:String,default:"确认"},message:{type:String,default:""},confirmText:{type:String,default:"确认"},cancelText:{type:String,default:"取消"},yesText:{type:String,default:"是"},noText:{type:String,default:"否"},type:{type:String,default:"confirm-cancel"}},emits:["confirm","cancel","yes","no"],setup(A,{emit:t}){const e=A,r=t,n=()=>r("confirm"),a=()=>r("cancel"),o=()=>r("yes"),s=()=>r("no");return(l,c)=>A.visible?(i.openBlock(),i.createElementBlock("div",{key:0,class:"gantt-confirm-overlay",onClick:a},[i.createElementVNode("div",{class:"gantt-confirm-dialog",onClick:c[0]||(c[0]=i.withModifiers(()=>{},["stop"]))},[i.createElementVNode("div",NE,[i.createElementVNode("h4",_E,i.toDisplayString(e.title),1)]),i.createElementVNode("div",ME,[i.createElementVNode("p",null,i.toDisplayString(e.message),1)]),i.createElementVNode("div",OE,[e.type==="yes-no-cancel"?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createElementVNode("button",{type:"button",class:"gantt-btn gantt-btn-default",onClick:a},i.toDisplayString(e.cancelText),1),i.createElementVNode("div",RE,[i.createElementVNode("button",{type:"button",class:"gantt-btn gantt-btn-warning",onClick:s},i.toDisplayString(e.noText),1),i.createElementVNode("button",{type:"button",class:"gantt-btn gantt-btn-danger",onClick:o},i.toDisplayString(e.yesText),1)])],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createElementVNode("button",{type:"button",class:"gantt-btn gantt-btn-default",onClick:a},i.toDisplayString(e.cancelText),1),c[1]||(c[1]=i.createTextVNode(" ")),i.createElementVNode("button",{type:"button",class:"gantt-btn gantt-btn-danger",onClick:n},i.toDisplayString(e.confirmText),1)],64))])])])):i.createCommentVNode("",!0)}}),gp=sn(HE,[["__scopeId","data-v-4a27f0b2"]]),PE={class:"icon-wrapper"},VE=["onClick"],KE=["innerHTML"],qE=i.defineComponent({__name:"TaskContextMenu",props:{visible:{type:Boolean},position:{},task:{},allTasks:{}},emits:["start-timer","stop-timer","add-predecessor","add-successor","delete","delete-link","close"],setup(A,{emit:t}){const e=A,r=t,{t:n}=ga(),a=i.ref(null),o=i.ref({x:0,y:0}),s=i.ref({display:"none",left:"50%",top:"-8px",transform:"rotate(0deg)"}),l=i.ref(!1),c=i.ref(""),u=i.ref(!1),g=i.computed(()=>{var X;return((X=e.task)==null?void 0:X.type)==="story"?"yes-no-cancel":"confirm-cancel"}),p=i.computed(()=>{var X,re,se;return((X=e.task)==null?void 0:X.type)==="story"?n.value.confirmDeleteStory.replace("{name}",((re=e.task)==null?void 0:re.name)||""):n.value.confirmDeleteTask.replace("{name}",((se=e.task)==null?void 0:se.name)||"")});function f(){var X;c.value=((X=e.task)==null?void 0:X.name)||"",l.value=!0}function v(){l.value=!1}function w(X){if(l.value=!1,e.task&&typeof e.task=="object"){r("close");const re=Date.now();Object.assign(e.task,{timerStartDesc:X||"",isTimerRunning:!0,timerStartTime:re,timerElapsedTime:0}),r("start-timer",e.task)}}function b(){u.value=!0}const B=()=>{u.value=!1,e.task&&(r("delete",e.task),r("close"))},F=()=>{u.value=!1},E=()=>{u.value=!1,e.task&&(r("delete",e.task,!0),R())},k=()=>{u.value=!1,e.task&&(r("delete",e.task,!1),R())},P=i.computed(()=>{var X;return((X=e.task)==null?void 0:X.type)!=="story"}),j=i.ref(!1);let M=null;const O=i.computed(()=>{const X=[];if(!e.task||!e.allTasks)return X;if(e.task.predecessor){const re=la(e.task.predecessor);for(const se of re){const x=e.allTasks.find(I=>I.id===se);x&&X.push({type:"predecessor",taskId:se,taskName:x.name||`任务 ${se}`})}}for(const re of e.allTasks)re.predecessor&&re.id!==e.task.id&&la(re.predecessor).includes(e.task.id)&&X.push({type:"successor",taskId:re.id,taskName:re.name||`任务 ${re.id}`});return X}),L=i.computed(()=>O.value.length>0);i.watch([()=>e.visible,()=>e.position],([X,re])=>{X&&re&&i.nextTick(()=>{if(a.value){const se=window.innerWidth,x=window.innerHeight,I=a.value.offsetWidth,W=a.value.offsetHeight;let z=re.x-I/2,Ae=re.y+10,he="50%",fe="-8px",ce="rotate(0deg)";if(z+I>se){const Fe=z+I-se+5;z-=Fe,he=`calc(50% + ${Fe}px)`}if(z<5){const Fe=5-z;z=5,he=`calc(50% - ${Fe}px)`}Ae+W>x&&(Ae=re.y-W-10,fe="100%",ce="rotate(180deg)"),o.value={x:z,y:Ae},s.value={display:"block",left:he,top:fe,transform:ce}}})},{immediate:!0,deep:!0});const R=()=>{r("close")},S=()=>{var X;(X=e.task)!=null&&X.isTimerRunning?(r("close"),Object.assign(e.task,{isTimerRunning:!1,timerEndTime:Date.now(),timerElapsedTime:(e.task.timerElapsedTime||0)+(Date.now()-(e.task.timerStartTime||Date.now()))}),r("stop-timer",e.task)):f()},T=()=>{e.task&&(r("close"),i.nextTick(()=>{r("add-predecessor",e.task)}))},G=()=>{e.task&&(r("close"),i.nextTick(()=>{r("add-successor",e.task)}))},N=X=>{M&&(clearTimeout(M),M=null),j.value=!1,r("delete-link",{sourceTaskId:X.type==="predecessor"?X.taskId:e.task.id,targetTaskId:X.type==="predecessor"?e.task.id:X.taskId}),r("close")},oe=()=>{M&&(clearTimeout(M),M=null),j.value=!0},le=()=>{M=window.setTimeout(()=>{j.value=!1},200)},Z=X=>{a.value&&!a.value.contains(X.target)&&R()},ee=X=>{X.key==="Escape"&&R()};return i.onMounted(()=>{document.addEventListener("mousedown",Z),document.addEventListener("keydown",ee)}),i.onUnmounted(()=>{document.removeEventListener("mousedown",Z),document.removeEventListener("keydown",ee),M&&clearTimeout(M)}),(X,re)=>{var se,x,I,W;return i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[X.visible?(i.openBlock(),i.createElementBlock("div",{key:0,ref_key:"menuRef",ref:a,class:"task-context-menu",style:i.normalizeStyle({left:`${o.value.x}px`,top:`${o.value.y}px`,zIndex:1e4,position:"fixed"})},[i.createElementVNode("div",{class:"menu-arrow",style:i.normalizeStyle({display:s.value.display,left:s.value.left,top:s.value.top,transform:s.value.transform})},null,4),P.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"menu-item",onClick:S},[i.createElementVNode("div",PE,[i.createElementVNode("i",{class:i.normalizeClass(["menu-icon",(se=e.task)!=null&&se.isTimerRunning?"stop-icon":"timer-icon"])},null,2)]),i.createTextVNode(" "+i.toDisplayString((x=e.task)!=null&&x.isTimerRunning?i.unref(n).stopTimer:i.unref(n).startTimer),1)])):i.createCommentVNode("",!0),i.createElementVNode("div",{class:"menu-item",onClick:T},[re[0]||(re[0]=i.createElementVNode("div",{class:"icon-wrapper"},[i.createElementVNode("i",{class:"menu-icon predecessor-icon"})],-1)),i.createTextVNode(" "+i.toDisplayString(i.unref(n).addPredecessor),1)]),i.createElementVNode("div",{class:"menu-item",onClick:G},[re[1]||(re[1]=i.createElementVNode("div",{class:"icon-wrapper"},[i.createElementVNode("i",{class:"menu-icon successor-icon"})],-1)),i.createTextVNode(" "+i.toDisplayString(i.unref(n).addSuccessor),1)]),L.value?(i.openBlock(),i.createElementBlock("div",{key:1,class:"menu-item menu-item-with-submenu",onMouseenter:oe,onMouseleave:le},[re[2]||(re[2]=i.createElementVNode("div",{class:"icon-wrapper"},[i.createElementVNode("i",{class:"menu-icon link-delete-icon"})],-1)),i.createTextVNode(" "+i.toDisplayString(i.unref(n).deleteLinks)+" ",1),re[3]||(re[3]=i.createElementVNode("i",{class:"submenu-arrow"},"›",-1)),j.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"submenu",onMouseenter:oe,onMouseleave:le},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(O.value,z=>(i.openBlock(),i.createElementBlock("div",{key:`${z.type}-${z.taskId}`,class:"menu-item submenu-item",onClick:i.withModifiers(Ae=>N(z),["stop"])},[i.createElementVNode("span",{innerHTML:z.type==="predecessor"?i.unref(n).predecessorLink.replace("{name}",z.taskName):i.unref(n).successorLink.replace("{name}",z.taskName)},null,8,KE)],8,VE))),128))],32)):i.createCommentVNode("",!0)],32)):i.createCommentVNode("",!0),re[5]||(re[5]=i.createElementVNode("div",{class:"menu-divider"},null,-1)),i.createElementVNode("div",{class:"menu-item menu-item-danger",onClick:b},[re[4]||(re[4]=i.createElementVNode("div",{class:"icon-wrapper"},[i.createElementVNode("i",{class:"menu-icon delete-icon"})],-1)),i.createTextVNode(" "+i.toDisplayString(i.unref(n).delete),1)]),i.createVNode(gp,{visible:u.value,title:i.unref(n).delete,type:g.value,message:p.value,"confirm-text":i.unref(n).confirm,"cancel-text":i.unref(n).cancel,"yes-text":i.unref(n).storyDeleteYes,"no-text":i.unref(n).storyDeleteNo,onConfirm:B,onYes:E,onNo:k,onCancel:F},null,8,["visible","title","type","message","confirm-text","cancel-text","yes-text","no-text"]),l.value?(i.openBlock(),i.createBlock(ry,{key:2,visible:l.value,title:"确认开始计时",message:`即将为任务${(I=e.task)==null?void 0:I.name}计时,若有特殊说明请完善下面的描述`,"default-desc":((W=e.task)==null?void 0:W.name)||"",onConfirm:w,onCancel:v},null,8,["visible","message","default-desc"])):i.createCommentVNode("",!0)],4)):i.createCommentVNode("",!0)])}}}),Ay=sn(qE,[["__scopeId","data-v-604bf4d7"]]),jE=["data-task-id"],WE={width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},GE={key:0,points:"9,18 15,12 9,6"},YE={key:1,points:"18,15 12,9 6,15"},zE={key:1,class:"milestone-spacer"},$E={key:2,class:"leaf-spacer"},XE={width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},JE={key:0,points:"9,18 15,12 9,6"},ZE={key:1,points:"18,15 12,9 6,15"},e4={key:1,class:"milestone-spacer"},t4={key:2,class:"leaf-spacer"},r4={key:0,class:"task-icon"},A4={key:0,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:"milestone-group-icon"},n4={key:1,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},a4={key:2,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},i4=["title"],s4={key:0,class:"timer-dot"},o4={key:1,class:"status-badge overtime"},l4={key:2,class:"status-badge overdue"},c4={key:0,class:"task-icon"},u4={key:0,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:"milestone-group-icon"},f4={key:1,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},d4={key:2,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},h4=["title"],g4={key:0,class:"timer-dot"},p4={key:1,class:"status-badge overtime"},v4={key:2,class:"status-badge overdue"},m4={key:0,class:"milestone-empty-col"},w4={key:3,class:"assignee-info"},B4={class:"avatar"},y4={class:"assignee-name"},b4=10,C4=i.defineComponent({__name:"TaskRow",props:{task:{},level:{},rowIndex:{},isHovered:{type:Boolean},hoveredTaskId:{},onHover:{},columns:{},declarativeColumns:{},renderMode:{default:"default"},getColumnWidthStyle:{},disableChildrenRender:{type:Boolean},showTaskIcon:{type:Boolean},enableDrag:{type:Boolean},dragStart:{},dragOver:{},taskListRowClassName:{},taskListRowStyle:{type:[Boolean,null,String,Object,Array,Function]}},emits:["toggle","dblclick","contextmenu","start-timer","stop-timer","add-predecessor","add-successor","delete"],setup(A,{emit:t}){const e=A,r=t,{t:n}=ga(),a=i.computed(()=>{var Q;return((Q=n.value)==null?void 0:Q.overtime)??""}),o=i.computed(()=>{var Q;return((Q=n.value)==null?void 0:Q.overdue)??""}),s=i.computed(()=>{var Q;return((Q=n.value)==null?void 0:Q.days)??""}),l=i.useSlots(),c=i.computed(()=>!!l["custom-task-content"]),u=i.inject("gantt-column-slots",{}),g=Q=>{const De=`column-${Q}`;return!!u[De]},p=(Q,De)=>{const pe=`column-${Q}`,ge=u[pe];return ge?ge(De):null},f=i.computed(()=>e.renderMode==="declarative"&&e.declarativeColumns?e.declarativeColumns:e.columns),v=Q=>Q===0,w=Q=>({justifyContent:Q.align==="center"?"center":Q.align==="right"?"flex-end":"flex-start",textAlign:Q.align||"left"}),b=(Q,De)=>{if(v(De)){const pe=Q.prop?e.task[Q.prop]:e.task.name;return Q.defaultSlot?i.h("div",{class:"task-name-content"},[i.h("span",{class:["task-name-text",{"parent-task":j.value}],title:pe},[Q.defaultSlot({row:e.task,$index:De})])]):i.h("div",{class:"task-name-content"},[e.showTaskIcon!==!1?i.h("span",{class:"task-icon"},k.value?i.h("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,class:"milestone-group-icon"},i.h("polygon",{points:"12,2 22,12 12,22 2,12"})):E.value||F.value?i.h("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2},i.h("path",{d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-5l-2-2H5a2 2 0 00-2 2z"})):i.h("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2},[i.h("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),i.h("polyline",{points:"14,2 14,8 20,8"}),i.h("line",{x1:16,y1:13,x2:8,y2:13}),i.h("line",{x1:16,y1:17,x2:8,y2:17}),i.h("polyline",{points:"10,9 9,9 8,9"})])):null,i.h("span",{class:["task-name-text",{"parent-task":j.value}],title:pe},pe||"-")])}if(Q.defaultSlot)return Q.defaultSlot({row:e.task,$index:De});if(Q.prop){const pe=e.task[Q.prop];return pe??"-"}return"-"},B=i.computed(()=>`${b4+e.level*20}px`),F=i.computed(()=>!!(e.task.children&&e.task.children.length>0)),E=i.computed(()=>e.task.type==="story"),k=i.computed(()=>e.task.type==="milestone-group"),P=i.computed(()=>e.task.type==="milestone"),j=i.computed(()=>E.value||F.value||k.value),M=i.computed(()=>e.taskListRowClassName?typeof e.taskListRowClassName=="function"?e.taskListRowClassName(e.task,e.rowIndex??0):e.taskListRowClassName:""),O=i.computed(()=>e.taskListRowStyle?typeof e.taskListRowStyle=="function"?e.taskListRowStyle(e.task,e.rowIndex??0):e.taskListRowStyle:{});function L(){r("toggle",e.task)}function R(){(E.value||F.value)&&!k.value&&r("toggle",e.task)}const S=Q=>{Q.stopPropagation(),r("dblclick",e.task)},T=()=>{Z.value||e.onHover&&e.onHover(e.task.id)},G=()=>{Z.value||e.onHover&&e.onHover(null)};function N(){const Q=e.task.progress||0,De=new Date,pe=e.task.endDate?new Date(e.task.endDate):null;return pe&&De>pe&&Q<100?"progress-danger":Q>=100?"progress-success":Q>0?"progress-warning":""}function oe(){return e.task.actualHours&&e.task.estimatedHours&&e.task.actualHours>e.task.estimatedHours}function le(){const Q=new Date,De=e.task.endDate?new Date(e.task.endDate):null,pe=e.task.progress||0;if(De&&Q>De&&pe<100){const ge=new Date(Q.getFullYear(),Q.getMonth(),Q.getDate()),Ee=new Date(De.getFullYear(),De.getMonth(),De.getDate());return Math.floor((ge.getTime()-Ee.getTime())/(1e3*60*60*24))}return 0}const Z=i.ref(!1),ee=()=>{Z.value=!0},X=()=>{Z.value=!1},re=i.ref(0),se=i.ref(null),x=i.computed(()=>{const Q=Math.floor(re.value/1e3),De=Math.floor(Q/3600),pe=Math.floor(Q%3600/60),ge=Q%60;return`${String(De).padStart(2,"0")}:${String(pe).padStart(2,"0")}:${String(ge).padStart(2,"0")}`}),I=()=>{if(e.task.isTimerRunning&&e.task.timerStartTime){const Q=e.task.timerElapsedTime||0;re.value=Date.now()-e.task.timerStartTime+Q}else e.task.timerElapsedTime?re.value=e.task.timerElapsedTime:re.value=0};i.watch(()=>[e.task.isTimerRunning,e.task.timerStartTime,e.task.timerElapsedTime],()=>{se.value&&(clearInterval(se.value),se.value=null),e.task.isTimerRunning?(I(),se.value=window.setInterval(I,1e3)):I()},{immediate:!0});const W=i.ref(!1),z=i.ref({x:0,y:0}),Ae=i.computed(()=>e.task);function he(Q){if(window.dispatchEvent(new CustomEvent("close-all-taskbar-menus")),e.task.type!=="task"&&e.task.type!=="story"){Q.preventDefault(),W.value=!1;return}Q.preventDefault(),W.value=!0,z.value={x:Q.clientX,y:Q.clientY}}function fe(){W.value=!1}const ce=(Q,De)=>{r("delete",Q,De),fe()},Fe=i.computed(()=>N()),Pe=i.computed(()=>({isRowContent:!0,task:e.task,level:e.level,indent:B.value,isHovered:e.isHovered??!1,hoveredTaskId:e.hoveredTaskId??null,isParent:j.value,hasChildren:F.value,collapsed:!!e.task.collapsed,formattedTimer:x.value,timerRunning:!!e.task.isTimerRunning,timerElapsed:re.value,isOvertime:oe(),overdueDays:le(),overtimeText:a.value,overdueText:o.value,daysText:s.value,progressClass:Fe.value})),Ze=i.ref(null),tt=Q=>{if(!e.enableDrag)return;const De=Q.target;De.tagName==="BUTTON"||De.tagName==="INPUT"||De.tagName==="SELECT"||De.tagName==="TEXTAREA"||De.closest(".collapse-btn")||De.closest(".task-context-menu")||Ze.value&&e.dragStart&&e.dragStart(e.task,Ze.value,Q)},lt=Q=>{if(!e.enableDrag||!Ze.value||!e.dragOver)return;const{taskId:De,event:pe}=Q.detail;De===e.task.id&&e.dragOver(e.task,Ze.value,pe)};return i.onMounted(()=>{window.addEventListener("splitter-drag-start",ee),window.addEventListener("splitter-drag-end",X),window.addEventListener("close-all-taskbar-menus",fe),window.addEventListener("task-row-drag-over",lt)}),i.onUnmounted(()=>{window.removeEventListener("splitter-drag-start",ee),window.removeEventListener("splitter-drag-end",X),window.removeEventListener("close-all-taskbar-menus",fe),window.removeEventListener("task-row-drag-over",lt),se.value&&clearInterval(se.value)}),(Q,De)=>{const pe=i.resolveComponent("TaskRow",!0);return i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",{ref_key:"taskRowRef",ref:Ze,class:i.normalizeClass(["task-row",{"task-row-hovered":Q.isHovered,"parent-task":j.value,"milestone-group-row":k.value,"task-type-story":E.value,"task-type-task":e.task.type==="task","task-type-milestone":P.value,[M.value]:M.value}]),"data-task-id":e.task.id,style:i.normalizeStyle(O.value),onClick:R,onDblclick:S,onMousedown:tt,onMouseenter:T,onMouseleave:G,onContextmenu:he},[Q.renderMode==="declarative"&&Q.declarativeColumns?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList(f.value,(ge,Ee)=>(i.openBlock(),i.createElementBlock("div",{key:Ee,class:i.normalizeClass(["col",[ge.cssClass,{"col-name":v(Ee)}]]),style:i.normalizeStyle([Q.getColumnWidthStyle?Q.getColumnWidthStyle(ge):{},w(ge)])},[v(Ee)?(i.openBlock(),i.createElementBlock("div",{key:0,style:i.normalizeStyle({paddingLeft:B.value}),class:"first-col-wrapper"},[(E.value||F.value)&&!k.value?(i.openBlock(),i.createElementBlock("span",{key:0,class:"collapse-btn",onClick:i.withModifiers(L,["stop"])},[(i.openBlock(),i.createElementBlock("svg",WE,[e.task.collapsed?(i.openBlock(),i.createElementBlock("polyline",GE)):(i.openBlock(),i.createElementBlock("polyline",YE))]))])):i.createCommentVNode("",!0),k.value?(i.openBlock(),i.createElementBlock("span",zE)):i.createCommentVNode("",!0),!j.value&&!k.value&&Q.showTaskIcon===!1?(i.openBlock(),i.createElementBlock("span",$E)):i.createCommentVNode("",!0),(i.openBlock(),i.createBlock(i.resolveDynamicComponent(()=>b(ge,Ee))))],4)):(i.openBlock(),i.createBlock(i.resolveDynamicComponent(()=>b(ge,Ee)),{key:1}))],6))),128)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createElementVNode("div",{class:"col col-name",style:i.normalizeStyle({paddingLeft:B.value})},[(E.value||F.value)&&!k.value?(i.openBlock(),i.createElementBlock("span",{key:0,class:"collapse-btn",onClick:i.withModifiers(L,["stop"])},[(i.openBlock(),i.createElementBlock("svg",XE,[e.task.collapsed?(i.openBlock(),i.createElementBlock("polyline",JE)):(i.openBlock(),i.createElementBlock("polyline",ZE))]))])):i.createCommentVNode("",!0),k.value?(i.openBlock(),i.createElementBlock("span",e4)):i.createCommentVNode("",!0),!j.value&&!k.value&&Q.showTaskIcon===!1?(i.openBlock(),i.createElementBlock("span",t4)):i.createCommentVNode("",!0),g("name")?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(()=>p("name",{task:e.task,column:{key:"name"},value:e.task.name,isParentTask:j.value,hasChildren:F.value,isStoryTask:E.value,isMilestoneGroup:k.value,isMilestoneTask:P.value,showTaskIcon:e.showTaskIcon,formattedTimer:x.value,isOvertime:oe(),overdueDays:le(),overtimeText:a.value,overdueText:o.value,daysText:s.value})),{key:3})):c.value?(i.openBlock(),i.createElementBlock(i.Fragment,{key:4},[Q.showTaskIcon!==!1?(i.openBlock(),i.createElementBlock("span",r4,[k.value?(i.openBlock(),i.createElementBlock("svg",A4,De[10]||(De[10]=[i.createElementVNode("polygon",{points:"12,2 22,12 12,22 2,12"},null,-1)]))):E.value||F.value?(i.openBlock(),i.createElementBlock("svg",n4,De[11]||(De[11]=[i.createElementVNode("path",{d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-5l-2-2H5a2 2 0 00-2 2z"},null,-1)]))):(i.openBlock(),i.createElementBlock("svg",a4,De[12]||(De[12]=[i.createStaticVNode('<path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z" data-v-2bc6791b></path><polyline points="14,2 14,8 20,8" data-v-2bc6791b></polyline><line x1="16" y1="13" x2="8" y2="13" data-v-2bc6791b></line><line x1="16" y1="17" x2="8" y2="17" data-v-2bc6791b></line><polyline points="10,9 9,9 8,9" data-v-2bc6791b></polyline>',5)])))])):i.createCommentVNode("",!0),i.createElementVNode("span",{class:i.normalizeClass(["task-name-text",{"parent-task":j.value}]),title:e.task.name},[i.renderSlot(Q.$slots,"custom-task-content",i.mergeProps(Pe.value,{type:"task-row"}),void 0,!0),e.task.isTimerRunning||e.task.timerElapsedTime?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass(["timer-badge",{"timer-active":e.task.isTimerRunning}])},[e.task.isTimerRunning?(i.openBlock(),i.createElementBlock("span",s4)):i.createCommentVNode("",!0),i.createTextVNode(" "+i.toDisplayString(x.value),1)],2)):i.createCommentVNode("",!0),oe()?(i.openBlock(),i.createElementBlock("span",o4,i.toDisplayString(a.value),1)):i.createCommentVNode("",!0),le()>0?(i.openBlock(),i.createElementBlock("span",l4,i.toDisplayString(o.value)+i.toDisplayString(le()>0?le()+s.value:""),1)):i.createCommentVNode("",!0)],10,i4)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:5},[Q.showTaskIcon!==!1?(i.openBlock(),i.createElementBlock("span",c4,[k.value?(i.openBlock(),i.createElementBlock("svg",u4,De[13]||(De[13]=[i.createElementVNode("polygon",{points:"12,2 22,12 12,22 2,12"},null,-1)]))):E.value||F.value?(i.openBlock(),i.createElementBlock("svg",f4,De[14]||(De[14]=[i.createElementVNode("path",{d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-5l-2-2H5a2 2 0 00-2 2z"},null,-1)]))):(i.openBlock(),i.createElementBlock("svg",d4,De[15]||(De[15]=[i.createStaticVNode('<path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z" data-v-2bc6791b></path><polyline points="14,2 14,8 20,8" data-v-2bc6791b></polyline><line x1="16" y1="13" x2="8" y2="13" data-v-2bc6791b></line><line x1="16" y1="17" x2="8" y2="17" data-v-2bc6791b></line><polyline points="10,9 9,9 8,9" data-v-2bc6791b></polyline>',5)])))])):i.createCommentVNode("",!0),i.createElementVNode("span",{class:i.normalizeClass(["task-name-text",{"parent-task":j.value}]),title:e.task.name},[i.createTextVNode(i.toDisplayString(e.task.name)+" ",1),e.task.isTimerRunning||e.task.timerElapsedTime?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass(["timer-badge",{"timer-active":e.task.isTimerRunning}])},[e.task.isTimerRunning?(i.openBlock(),i.createElementBlock("span",g4)):i.createCommentVNode("",!0),i.createTextVNode(" "+i.toDisplayString(x.value),1)],2)):i.createCommentVNode("",!0),oe()?(i.openBlock(),i.createElementBlock("span",p4,i.toDisplayString(a.value),1)):i.createCommentVNode("",!0),le()>0?(i.openBlock(),i.createElementBlock("span",v4,i.toDisplayString(o.value)+i.toDisplayString(le()>0?le()+s.value:""),1)):i.createCommentVNode("",!0)],10,h4)],64))],4),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(Q.columns,ge=>(i.openBlock(),i.createElementBlock("div",{key:ge.key,class:i.normalizeClass(["col",ge.cssClass||`col-${ge.key}`]),style:i.normalizeStyle(Q.getColumnWidthStyle?Q.getColumnWidthStyle(ge):void 0)},[k.value?(i.openBlock(),i.createElementBlock("div",m4)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[g(ge.key)?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(()=>p(ge.key,{task:e.task,column:ge,value:e.task[ge.key]})),{key:0})):ge.formatter?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(ge.formatter(e.task,ge)),1)],64)):ge.key==="predecessor"?(i.openBlock(),i.createElementBlock(i.Fragment,{key:2},[i.createTextVNode(i.toDisplayString(i.unref(pg)(e.task.predecessor)),1)],64)):ge.key==="assignee"?(i.openBlock(),i.createElementBlock("div",w4,[i.createElementVNode("div",B4,i.toDisplayString(e.task.assignee?e.task.assignee.charAt(0):"-"),1),i.createElementVNode("span",y4,i.toDisplayString(e.task.assignee||"-"),1)])):ge.key==="startDate"?(i.openBlock(),i.createElementBlock(i.Fragment,{key:4},[i.createTextVNode(i.toDisplayString(e.task.startDate||"-"),1)],64)):ge.key==="endDate"?(i.openBlock(),i.createElementBlock(i.Fragment,{key:5},[i.createTextVNode(i.toDisplayString(e.task.endDate||"-"),1)],64)):ge.key==="estimatedHours"?(i.openBlock(),i.createElementBlock(i.Fragment,{key:6},[i.createTextVNode(i.toDisplayString(e.task.estimatedHours||"-"),1)],64)):ge.key==="actualHours"?(i.openBlock(),i.createElementBlock(i.Fragment,{key:7},[i.createTextVNode(i.toDisplayString(e.task.actualHours||"-"),1)],64)):ge.key==="progress"?(i.openBlock(),i.createElementBlock("span",{key:8,class:i.normalizeClass(["progress-value",Fe.value])},i.toDisplayString(e.task.progress!=null?e.task.progress+"%":"-"),3)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:9},[i.createTextVNode(i.toDisplayString(e.task[ge.key]||"-"),1)],64))],64))],6))),128))],64))],46,jE),!e.disableChildrenRender&&F.value&&!e.task.collapsed&&!k.value?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList(e.task.children,ge=>(i.openBlock(),i.createBlock(pe,{key:ge.id,task:ge,level:e.level+1,"is-hovered":e.hoveredTaskId===ge.id,"hovered-task-id":e.hoveredTaskId,"on-hover":e.onHover,columns:e.columns,"declarative-columns":e.declarativeColumns,"render-mode":e.renderMode,"get-column-width-style":e.getColumnWidthStyle,"disable-children-render":e.disableChildrenRender,"show-task-icon":e.showTaskIcon,"enable-drag":e.enableDrag,"drag-start":e.dragStart,"drag-over":e.dragOver,onToggle:De[0]||(De[0]=Ee=>r("toggle",Ee)),onDblclick:De[1]||(De[1]=Ee=>r("dblclick",Ee)),onStartTimer:De[2]||(De[2]=Ee=>r("start-timer",Ee)),onStopTimer:De[3]||(De[3]=Ee=>r("stop-timer",Ee)),onAddPredecessor:De[4]||(De[4]=Ee=>r("add-predecessor",Ee)),onAddSuccessor:De[5]||(De[5]=Ee=>r("add-successor",Ee)),onDelete:ce},i.createSlots({_:2},[c.value?{name:"custom-task-content",fn:i.withCtx(Ee=>[i.renderSlot(Q.$slots,"custom-task-content",i.mergeProps({ref_for:!0},Ee),void 0,!0)]),key:"0"}:void 0]),1032,["task","level","is-hovered","hovered-task-id","on-hover","columns","declarative-columns","render-mode","get-column-width-style","disable-children-render","show-task-icon","enable-drag","drag-start","drag-over"]))),128)):i.createCommentVNode("",!0),i.createVNode(Ay,{visible:W.value,task:Ae.value,position:z.value,onClose:fe,onStartTimer:De[6]||(De[6]=ge=>Q.$emit("start-timer",e.task)),onStopTimer:De[7]||(De[7]=ge=>Q.$emit("stop-timer",e.task)),onAddPredecessor:De[8]||(De[8]=ge=>Q.$emit("add-predecessor",e.task)),onAddSuccessor:De[9]||(De[9]=ge=>Q.$emit("add-successor",e.task)),onDelete:ce},null,8,["visible","task","position"])])}}}),ny=sn(C4,[["__scopeId","data-v-2bc6791b"]]),E4=320,Kv=280,F4=1160;function Nu(A,t,e){if(A==null)return e;if(typeof A=="number")return A;if(typeof A=="string"){const r=A.trim();if(r.endsWith("%")){const a=parseFloat(r);if(!isNaN(a))return Math.round(t*a/100)}const n=parseFloat(r);if(!isNaN(n))return n}return e}const _u=[{type:"name",key:"taskName",label:"任务名称",cssClass:"col-name",visible:!0},{type:"predecessor",key:"predecessor",label:"前置任务",cssClass:"col-pre",visible:!0},{type:"assignee",key:"assignee",label:"负责人",cssClass:"col-assignee",visible:!0},{type:"startDate",key:"startDate",label:"开始日期",cssClass:"col-date",visible:!0},{type:"endDate",key:"endDate",label:"结束日期",cssClass:"col-date",visible:!0},{type:"estimatedHours",key:"estimatedHours",label:"预估工时",cssClass:"col-hours",visible:!0},{type:"actualHours",key:"actualHours",label:"实际工时",cssClass:"col-hours",visible:!0},{type:"progress",key:"progress",label:"进度",cssClass:"col-progress",visible:!0}];function k4(A){const t=A.dragThreshold??5,e=i.ref({isDragging:!1,isPreparing:!1,draggedTask:null,draggedElement:null,ghostElement:null,dropTargetTask:null,dropPosition:null,startX:0,startY:0}),r=(p,f,v)=>{A.enabled&&(p.type==="milestone-group"||p.type==="milestone"||(v.preventDefault(),v.stopPropagation(),e.value.isPreparing=!0,e.value.draggedTask=p,e.value.draggedElement=f,e.value.startX=v.clientX,e.value.startY=v.clientY))},n=p=>{if(!e.value.isPreparing||e.value.isDragging)return;const f=e.value.draggedTask,v=e.value.draggedElement;e.value.isDragging=!0,e.value.isPreparing=!1;const w=v.cloneNode(!0);w.style.position="fixed",w.style.left="-9999px",w.style.top="-9999px",w.style.width=`${v.offsetWidth}px`,w.style.height=`${v.offsetHeight}px`,w.style.opacity="0.6",w.style.pointerEvents="none",w.style.zIndex="999999",w.style.boxShadow="0 8px 24px rgba(0, 0, 0, 0.3)",w.classList.add("task-row-dragging"),(document.querySelector(".gantt-fullscreen")||document.body).appendChild(w),e.value.ghostElement=w,v.style.opacity="0.4",document.body.style.userSelect="none",document.body.style.webkitUserSelect="none",document.body.style.cursor="move",window.dispatchEvent(new CustomEvent("task-row-drag-start",{detail:{task:f}})),A.onDragStart&&A.onDragStart(f),a(p)},a=p=>{if(e.value.ghostElement){const f=e.value.ghostElement;f.style.left=`${p.clientX+10}px`,f.style.top=`${p.clientY-25}px`}},o=(p,f,v)=>{if(!e.value.isDragging||!e.value.draggedTask)return;if(p.id===e.value.draggedTask.id){s();return}if(g(e.value.draggedTask,p)){s();return}v.preventDefault(),v.stopPropagation();const b=p.children&&p.children.length>0?"child":"after";e.value.dropTargetTask=p,e.value.dropPosition=b,document.querySelectorAll(".task-row-drop-target").forEach(B=>{B.classList.remove("task-row-drop-target","drop-after","drop-child")}),f.classList.add("task-row-drop-target"),b==="after"?f.classList.add("drop-after"):f.classList.add("drop-child"),A.onDragOver&&A.onDragOver(p,b)},s=()=>{e.value.dropTargetTask=null,e.value.dropPosition=null,document.querySelectorAll(".task-row-drop-target").forEach(p=>{p.classList.remove("task-row-drop-target","drop-after","drop-child")})},l=()=>{if(e.value.isPreparing&&!e.value.isDragging){e.value.isPreparing=!1,e.value.draggedTask=null,e.value.draggedElement=null;return}if(!e.value.isDragging)return;const p=e.value.draggedTask,f=e.value.dropTargetTask,v=e.value.dropPosition;e.value.draggedElement&&(e.value.draggedElement.style.opacity=""),e.value.ghostElement&&e.value.ghostElement.parentElement&&e.value.ghostElement.parentElement.removeChild(e.value.ghostElement),s(),document.body.style.userSelect="",document.body.style.webkitUserSelect="",document.body.style.cursor="",window.dispatchEvent(new CustomEvent("task-row-drag-end")),p&&f&&v&&A.onDrop&&A.onDrop(p,f,v),e.value={isDragging:!1,isPreparing:!1,draggedTask:null,draggedElement:null,ghostElement:null,dropTargetTask:null,dropPosition:null,startX:0,startY:0}},c=p=>{if(e.value.isPreparing&&!e.value.isDragging){const f=Math.abs(p.clientX-e.value.startX),v=Math.abs(p.clientY-e.value.startY);Math.sqrt(f*f+v*v)>t&&n(p);return}if(e.value.isDragging){a(p);const f=e.value.ghostElement;f&&(f.style.display="none");const v=document.elementFromPoint(p.clientX,p.clientY);if(f&&(f.style.display=""),v){const w=v.closest(".task-row");if(w&&w.dataset.taskId){const b=Number(w.dataset.taskId);window.dispatchEvent(new CustomEvent("task-row-drag-over",{detail:{taskId:b,event:p}}))}}}},u=()=>{(e.value.isDragging||e.value.isPreparing)&&l()},g=(p,f)=>{if(!p.children)return!1;for(const v of p.children)if(v.id===f.id||g(v,f))return!0;return!1};return i.onMounted(()=>{document.addEventListener("mousemove",c),document.addEventListener("mouseup",u)}),i.onUnmounted(()=>{document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",u),e.value.ghostElement&&e.value.ghostElement.parentElement&&e.value.ghostElement.parentElement.removeChild(e.value.ghostElement)}),{dragState:e,startDrag:r,handleDragOver:o,endDrag:l}}function x4(A){let t=!1;if(typeof A.type=="object"){const o=A.type;t=o.name==="TaskListColumn"||o.__name==="TaskListColumn"||o.__file&&o.__file.includes("TaskListColumn")}if(!t)return null;const e=A.props||{},r=A.children,n=r==null?void 0:r.header,a=r==null?void 0:r.default;return{prop:e.prop,label:e.label,width:e.width,align:e.align||"left",cssClass:e.cssClass,headerSlot:n,defaultSlot:a}}function S4(A){var n;const t=(n=A.default)==null?void 0:n.call(A);if(!t||!Array.isArray(t))return[];const e=[],r=a=>{for(const o of a){if(!o)continue;if(typeof o.type=="symbol"){o.children&&Array.isArray(o.children)&&r(o.children);continue}const s=x4(o);s&&e.push(s),o.children&&Array.isArray(o.children)&&r(o.children)}};return r(t),e}function T4(A,t,e){const r=i.computed(()=>(typeof A=="string"?A:A.value)!=="declarative"?[]:S4(t)),n=i.computed(()=>(typeof A=="string"?A:A.value)==="declarative"?r.value:e||[]);return{declarativeColumns:r,finalColumns:n,getColumnWidthStyle:(s,l)=>{if(!s.width)return{};let c;if(typeof s.width=="string"&&s.width.includes("%"))if(l&&l>0){const u=parseFloat(s.width)/100;c=`${Math.floor(l*u)}px`}else return{};else typeof s.width=="number"?c=`${s.width}px`:typeof s.width=="string"?/\d+(px|rem|em|%)/.test(s.width)?c=s.width:c=`${s.width}px`:c=String(s.width);return{flex:`0 0 ${c}`,minWidth:c,maxWidth:c}},getColumnAlignStyle:s=>!s||s==="left"?{}:{justifyContent:s==="center"?"center":"flex-end",textAlign:s}}}const U4={class:"task-list-header"},D4={class:"col col-name"},Bo=51,qv=5,Q4=i.defineComponent({__name:"TaskList",props:{tasks:{},useDefaultDrawer:{type:Boolean},taskListConfig:{},taskListColumnRenderMode:{default:"default"},enableTaskRowMove:{type:Boolean},taskListRowClassName:{},taskListRowStyle:{type:[Boolean,null,String,Object,Array,Function]}},emits:["task-collapse-change","start-timer","stop-timer","add-predecessor","add-successor","delete","task-row-moved"],setup(A,{emit:t}){var Ee;const e=A,r=t,n=i.useSlots(),a=i.computed(()=>!!n["custom-task-content"]),o=i.inject("gantt-column-slots",{}),{t:s}=ga(),{declarativeColumns:l,getColumnWidthStyle:c}=T4(i.computed(()=>e.taskListColumnRenderMode||"default"),n,((Ee=e.taskListConfig)==null?void 0:Ee.columns)||_u),u=i.computed(()=>{var Qe;return e.taskListColumnRenderMode==="declarative"?l.value:(((Qe=e.taskListConfig)==null?void 0:Qe.columns)||_u).filter(Oe=>Oe.visible!==!1)}),g=i.ref(null),p=i.ref(null),f=i.ref(0);let v=null,w=null;const b=i.ref(0),B=i.ref(0),F=xe=>{if(e.taskListColumnRenderMode==="declarative")return c(xe,f.value);if(!xe.width)return{};let Qe;if(typeof xe.width=="string"&&xe.width.includes("%")){const Oe=f.value||0;if(Oe>0){const Ve=parseFloat(xe.width)/100;Qe=`${Math.floor(Oe*Ve)}px`}else return{}}else Qe=`${xe.width}px`;return{flex:`0 0 ${Qe}`,minWidth:Qe,maxWidth:Qe}},E=i.computed(()=>{var Qe;return e.taskListColumnRenderMode==="declarative"?[]:(((Qe=e.taskListConfig)==null?void 0:Qe.columns)||_u).filter(Oe=>Oe.visible!==!1)}),k=i.computed(()=>e.tasks||[]),P=i.ref(null),j=i.ref(!1),M=()=>{j.value=!0},O=()=>{if(j.value=!1,g.value){const xe=g.value.offsetWidth;Math.abs(xe-f.value)>1&&(f.value=xe)}},L=xe=>{j.value||(P.value=xe,window.dispatchEvent(new CustomEvent("task-list-hover",{detail:xe})))},R=xe=>{P.value=xe.detail},S=xe=>{xe.type==="milestone"||xe.type==="milestone-group"||window.dispatchEvent(new CustomEvent("task-row-double-click",{detail:xe}))},T=xe=>{if(!xe.children||xe.children.length===0)return{progress:xe.progress||0,startDate:xe.startDate||"",endDate:xe.endDate||""};const Qe=[],Oe=Bt=>{Bt.forEach(pt=>{Qe.push(pt),pt.children&&pt.children.length>0&&Oe(pt.children)})};Oe(xe.children);const Ve=Qe.reduce((Bt,pt)=>Bt+(pt.progress||0),0),Re=Qe.length>0?Math.round(Ve/Qe.length):0,$e=Qe.filter(Bt=>Bt.startDate&&Bt.endDate);if($e.length===0)return{progress:Re,startDate:xe.startDate||"",endDate:xe.endDate||""};const at=$e.map(Bt=>new Date(Bt.startDate)),gt=$e.map(Bt=>new Date(Bt.endDate)),mt=new Date(Math.min(...at.map(Bt=>Bt.getTime()))),ht=new Date(Math.max(...gt.map(Bt=>Bt.getTime())));return{progress:Re,startDate:mt.toISOString().split("T")[0],endDate:ht.toISOString().split("T")[0]}},G=()=>{if(!e.tasks)return;const xe=Qe=>{Qe.forEach(Oe=>{if(Oe.children&&Oe.children.length>0){xe(Oe.children);const Ve=T(Oe);Oe.progress=Ve.progress,Oe.startDate=Ve.startDate,Oe.endDate=Ve.endDate}})};xe(e.tasks)},N=xe=>{const Qe=[],Oe=Ve=>{Ve.forEach(Re=>{Qe.push(Re),Re.children&&Re.children.length>0&&Oe(Re.children)})};return Oe(xe),Qe},oe=(xe,Qe=0)=>{const Oe=[];for(const Ve of xe)Oe.push({task:Ve,level:Qe}),!(Ve.type==="milestone-group")&&Ve.children&&Ve.children.length>0&&!Ve.collapsed&&Oe.push(...oe(Ve.children,Qe+1));return Oe},le=i.computed(()=>oe(k.value)),Z=i.computed(()=>{const xe=b.value,Qe=B.value||600,Oe=Math.floor(xe/Bo)-qv,Ve=Math.ceil((xe+Qe)/Bo)+qv,Re=le.value.length,$e=Math.min(Math.max(0,Oe),Re),at=Math.min(Re,Math.max($e+1,Ve));return{startIndex:$e,endIndex:at}}),ee=i.computed(()=>{const{startIndex:xe,endIndex:Qe}=Z.value;return le.value.slice(xe,Qe).map((Ve,Re)=>({...Ve,rowIndex:xe+Re}))}),X=i.computed(()=>le.value.length*Bo),re=i.computed(()=>Z.value.startIndex*Bo),se=i.computed(()=>{const xe=ee.value.length*Bo;return Math.max(0,X.value-re.value-xe)});function x(xe){xe.collapsed=!xe.collapsed,r("task-collapse-change",xe)}const I=xe=>{if(!e.tasks)return;const Qe=Oe=>{for(const Ve of Oe){if(Ve.id===xe.id)return Object.assign(Ve,xe),xe.children,!0;if(Ve.children&&Qe(Ve.children))return!0}return!1};Qe(e.tasks),G()},W=xe=>{const Qe=xe.detail;I(Qe)},z=xe=>{const Qe=xe.detail;e.tasks&&e.tasks.push(Qe),G()},Ae=()=>{const xe=N(k.value);window.dispatchEvent(new CustomEvent("task-list-updated",{detail:xe}))},he=xe=>{const{milestoneId:Qe,icon:Oe}=xe.detail,Ve=Re=>{for(const $e of Re){if($e.type==="milestone-group"&&$e.children){const at=$e.children.find(gt=>gt.id===Qe);if(at)return at.icon=Oe,!0}if($e.children&&Ve($e.children))return!0}return!1};Ve(k.value)},fe=xe=>{const Qe=xe.target;if(!Qe)return;const Oe=Qe.scrollTop;b.value=Oe,window.dispatchEvent(new CustomEvent("task-list-vertical-scroll",{detail:{scrollTop:Oe}}))},ce=xe=>{const{scrollTop:Qe}=xe.detail,Oe=p.value;b.value=Qe,Oe&&Math.abs(Oe.scrollTop-Qe)>1&&(Oe.scrollTop=Qe)},Fe=xe=>{try{window.dispatchEvent(new CustomEvent("context-menu",{detail:xe}))}catch(Qe){console.error("TaskList - Failed to dispatch context-menu event",Qe)}},Pe=xe=>{r("start-timer",xe)},Ze=xe=>{r("stop-timer",xe)},tt=xe=>{r("add-predecessor",xe)},lt=xe=>{r("add-successor",xe)},Q=(xe,Qe)=>{r("delete",xe,Qe)},De=xe=>{const{draggedTask:Qe,targetTask:Oe,position:Ve}=xe;e.tasks&&r("task-row-moved",{draggedTask:Qe,targetTask:Oe,position:Ve,oldParent:null,newParent:null})},{startDrag:pe,handleDragOver:ge}=k4({enabled:e.enableTaskRowMove??!1,onDrop:(xe,Qe,Oe)=>{De({draggedTask:xe,targetTask:Qe,position:Oe})}});return i.onMounted(async()=>{g.value&&(v=new ResizeObserver(xe=>{if(!j.value)for(const Qe of xe)f.value=Qe.contentRect.width}),v.observe(g.value)),p.value&&(B.value=p.value.clientHeight,b.value=p.value.scrollTop,w=new ResizeObserver(xe=>{for(const Qe of xe)B.value=Qe.contentRect.height}),w.observe(p.value)),window.addEventListener("task-updated",W),window.addEventListener("task-added",z),window.addEventListener("request-task-list",Ae),window.addEventListener("timeline-task-hover",R),window.addEventListener("timeline-vertical-scroll",ce),window.addEventListener("milestone-icon-changed",he),window.addEventListener("splitter-drag-start",M),window.addEventListener("splitter-drag-end",O),G()}),i.onUnmounted(()=>{v&&(v.disconnect(),v=null),w&&(w.disconnect(),w=null),window.removeEventListener("task-updated",W),window.removeEventListener("task-added",z),window.removeEventListener("request-task-list",Ae),window.removeEventListener("timeline-task-hover",R),window.removeEventListener("timeline-vertical-scroll",ce),window.removeEventListener("milestone-icon-changed",he),window.removeEventListener("splitter-drag-start",M),window.removeEventListener("splitter-drag-end",O)}),(xe,Qe)=>(i.openBlock(),i.createElementBlock("div",{ref_key:"taskListRef",ref:g,class:"task-list"},[i.createElementVNode("div",U4,[xe.taskListColumnRenderMode==="declarative"?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList(u.value,(Oe,Ve)=>(i.openBlock(),i.createElementBlock("div",{key:Ve,class:i.normalizeClass(["col",Oe.cssClass]),style:i.normalizeStyle({...F(Oe),justifyContent:Oe.align==="center"?"center":Oe.align==="right"?"flex-end":"flex-start",textAlign:Oe.align||"left"})},[Oe.headerSlot?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(Oe.headerSlot),{key:0})):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(Oe.label),1)],64))],6))),128)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createElementVNode("div",D4,[i.unref(o)["header-name"]?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(i.unref(o)["header-name"]),{key:0})):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(i.unref(s).taskName||"任务名称"),1)],64))]),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(E.value,Oe=>(i.openBlock(),i.createElementBlock("div",{key:Oe.key,class:i.normalizeClass(["col",Oe.cssClass||`col-${Oe.key}`]),style:i.normalizeStyle(F(Oe))},[i.unref(o)[`header-${Oe.key}`]?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(i.unref(o)[`header-${Oe.key}`]),{key:0})):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(i.unref(s)[Oe.key]||Oe.label),1)],64))],6))),128))],64))]),i.createElementVNode("div",{ref_key:"taskListBodyRef",ref:p,class:"task-list-body",onScroll:fe},[i.createElementVNode("div",{class:"task-list-body-spacer",style:i.normalizeStyle({height:`${re.value}px`})},null,4),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(ee.value,({task:Oe,level:Ve,rowIndex:Re})=>{var $e;return i.openBlock(),i.createBlock(ny,{key:Oe.id,task:Oe,level:Ve,"row-index":Re,"is-hovered":P.value===Oe.id,"hovered-task-id":P.value,"on-hover":L,columns:xe.taskListColumnRenderMode==="declarative"?[]:E.value,"declarative-columns":xe.taskListColumnRenderMode==="declarative"?u.value:void 0,"render-mode":xe.taskListColumnRenderMode,"get-column-width-style":F,"disable-children-render":!0,"show-task-icon":($e=e.taskListConfig)==null?void 0:$e.showTaskIcon,"enable-drag":e.enableTaskRowMove,"drag-start":i.unref(pe),"drag-over":i.unref(ge),"task-list-row-class-name":e.taskListRowClassName,"task-list-row-style":e.taskListRowStyle,onToggle:x,onDblclick:S,onContextmenu:Fe,onStartTimer:Pe,onStopTimer:Ze,onAddPredecessor:tt,onAddSuccessor:lt,onDelete:Q},i.createSlots({_:2},[a.value?{name:"custom-task-content",fn:i.withCtx(at=>[i.renderSlot(xe.$slots,"custom-task-content",i.mergeProps({ref_for:!0},at),void 0,!0)]),key:"0"}:void 0]),1032,["task","level","row-index","is-hovered","hovered-task-id","columns","declarative-columns","render-mode","show-task-icon","enable-drag","drag-start","drag-over","task-list-row-class-name","task-list-row-style"])}),128)),i.createElementVNode("div",{class:"task-list-body-spacer",style:i.normalizeStyle({height:`${se.value}px`})},null,4)],544)],512))}}),ay=sn(Q4,[["__scopeId","data-v-0d310224"]]),qe={HOUR:"hour",DAY:"day",WEEK:"week",MONTH:"month",QUARTER:"quarter",YEAR:"year"},L4={hour:{scale:qe.HOUR,cellWidth:40,headerLevels:2,formatters:{primary:"yyyy年MM月dd日",secondary:"HH:mm"}},day:{scale:qe.DAY,cellWidth:30,headerLevels:2,formatters:{primary:"yyyy年MM月",secondary:"dd"}},week:{scale:qe.WEEK,cellWidth:120,headerLevels:2,formatters:{primary:"yyyy年MM月",secondary:"W周"}},month:{scale:qe.MONTH,cellWidth:180,headerLevels:2,formatters:{primary:"yyyy年",secondary:"MM月"}},quarter:{scale:qe.QUARTER,cellWidth:60,headerLevels:2,formatters:{primary:"yyyy年",secondary:"Q季度"}},year:{scale:qe.YEAR,cellWidth:180,headerLevels:2,formatters:{primary:"yyyy年",secondary:"上半年|下半年"}}},I4={key:0,class:"anchor-tooltip"},N4=i.defineComponent({__name:"LinkAnchor",props:{type:{},taskId:{},visible:{type:Boolean,default:!1},isDragSource:{type:Boolean,default:!1},isDragTarget:{type:Boolean,default:!1},isValidTarget:{type:Boolean,default:!0},enabled:{type:Boolean,default:!0},globalDragging:{type:Boolean,default:!1}},emits:["drag-start","drag-move","drag-end"],setup(A,{emit:t}){const e=A,r=t,n=i.ref(!1),a=i.computed(()=>e.visible||e.globalDragging||e.isDragSource||e.isDragTarget||n.value);let o=null,s=null,l=!1;function c(f){e.enabled&&(f.stopPropagation(),f.preventDefault(),l=!0,r("drag-start",{taskId:e.taskId,type:e.type,x:f.clientX,y:f.clientY}),o=v=>{l&&r("drag-move",{x:v.clientX,y:v.clientY})},s=()=>{l&&(r("drag-end",{taskId:e.taskId,type:e.type}),p())},document.addEventListener("mousemove",o),document.addEventListener("mouseup",s))}function u(){e.enabled&&(n.value=!0)}function g(){e.enabled&&(n.value=!1)}function p(){l=!1,o&&(document.removeEventListener("mousemove",o),o=null),s&&(document.removeEventListener("mouseup",s),s=null)}return i.onUnmounted(()=>{p()}),(f,v)=>f.enabled&&a.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["link-anchor",{"anchor-predecessor":f.type==="predecessor","anchor-successor":f.type==="successor","drag-source":f.isDragSource,"drag-target":f.isDragTarget,"valid-target":f.isDragTarget&&f.isValidTarget,"invalid-target":f.isDragTarget&&!f.isValidTarget,visible:a.value}]),onMousedown:c,onMouseenter:u,onMouseleave:g},[!f.isDragSource&&!f.isDragTarget&&!f.globalDragging?(i.openBlock(),i.createElementBlock("div",I4,i.toDisplayString(f.type==="predecessor"?"添加前置任务":"添加后置任务"),1)):i.createCommentVNode("",!0)],34)):i.createCommentVNode("",!0)}}),jv=sn(N4,[["__scopeId","data-v-fa084d7b"]]),_4={showAvatar:!0,showTitle:!0,showProgress:!0,dragThreshold:5,resizeHandleWidth:5,enableDragDelay:!1,dragDelayTime:150},M4=["data-task-id"],O4={key:0,class:"parent-label"},R4=["src","alt"],H4={key:1,class:"avatar-text"},P4={key:2,class:"avatar-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},V4={key:1,class:"task-name"},K4={class:"tooltip-title"},q4={class:"tooltip-content"},j4={class:"tooltip-row"},W4={class:"tooltip-label"},G4={class:"tooltip-value"},Y4={class:"tooltip-row"},z4={class:"tooltip-label"},$4={class:"tooltip-value"},X4={class:"tooltip-row"},J4={class:"tooltip-label"},Z4={class:"tooltip-value"},eF={class:"tooltip-row"},tF={class:"tooltip-label"},rF={class:"tooltip-value"},AF={class:"tooltip-row"},nF={class:"tooltip-label"},aF={class:"tooltip-value"},iF={class:"drag-tooltip-content"},sF={class:"tooltip-row"},oF={class:"tooltip-label"},lF={class:"tooltip-value"},cF={class:"tooltip-row"},uF={class:"tooltip-label"},fF={class:"tooltip-value"},dF=1e3,hF=100,gF=250,pF=i.defineComponent({__name:"TaskBar",props:{task:{},rowHeight:{},dayWidth:{},startDate:{},isParent:{type:Boolean},onClick:{type:Function},scrollLeft:{},containerWidth:{},hideBubbles:{type:Boolean},timelineData:{},currentTimeScale:{},taskBarConfig:{},allowDragAndResize:{type:Boolean},isHighlighted:{type:Boolean},isPrimaryHighlight:{type:Boolean},isInHighlightMode:{type:Boolean},dragLinkMode:{},isLinkDragSource:{type:Boolean},isValidLinkTarget:{type:Boolean},isInvalidLinkTarget:{type:Boolean},allTasks:{}},emits:["update:task","bar-mounted","click","dblclick","drag-end","resize-end","scroll-to-position","start-timer","stop-timer","add-predecessor","add-successor","delete","delete-link","context-menu","long-press","link-drag-start","link-drag-move","link-drag-end"],setup(A,{emit:t}){const e=A,r=t,n=i.useSlots(),{getTranslation:a}=ga(),o=q=>a(q),s=i.computed(()=>!!n["custom-task-content"]),l=i.computed(()=>({..._4,...e.taskBarConfig})),c=q=>{if(!q)return null;if(q instanceof Date)return q;if(typeof q=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(q)){const[Ce,Te,ze]=q.split("-").map(Number);return new Date(Ce,Te-1,ze)}if(typeof q=="string"&&/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(q)){const[Ce,Te]=q.split(" "),[ze,Ie,Xe]=Ce.split("-").map(Number),[Ye,st]=Te.split(":").map(Number);return new Date(ze,Ie-1,Xe,Ye,st)}const me=new Date(q);return isNaN(me.getTime())?null:me},u=()=>{const q=new Date;return new Date(q.getFullYear(),q.getMonth(),q.getDate())},g=i.ref(u());let p=null;i.onMounted(()=>{p=window.setInterval(()=>{g.value=u()},6e4)}),i.onUnmounted(()=>{p!==null&&(clearInterval(p),p=null)});const f=q=>{const me=q.getFullYear(),Ce=String(q.getMonth()+1).padStart(2,"0"),Te=String(q.getDate()).padStart(2,"0");if(e.currentTimeScale===qe.HOUR){const ze=String(q.getHours()).padStart(2,"0"),Ie=String(q.getMinutes()).padStart(2,"0");return`${me}-${Ce}-${Te} ${ze}:${Ie}`}return`${me}-${Ce}-${Te}`},v=(q,me)=>{const Ce=new Date(q);return Ce.setDate(Ce.getDate()+me),Ce},w=(q,me)=>{const Ce=new Date(q);return Ce.setMinutes(Ce.getMinutes()+me),Ce},b=(q,me)=>Math.round((me.getTime()-q.getTime())/(1e3*60)),B=i.computed(()=>e.task.isEditable===!1?!0:e.currentTimeScale===qe.YEAR),F=i.ref(!1),E=i.ref(!1),k=i.ref(!1),P=i.ref(!1),j=i.ref(0),M=i.ref(0),O=i.ref(0),L=i.ref(0),R=i.ref(0),S=i.ref(0),T=i.ref(null),G=i.ref(!1),N=i.ref(!1),oe=i.computed(()=>l.value.dragThreshold??5),le=i.ref(!1),Z=i.ref(null),ee=i.ref(null),X=i.ref(!1),re=i.ref(0),se=i.ref(null),x=i.ref(null),I=i.ref(null),W=i.ref(null),z=i.ref(0),Ae=i.computed(()=>{var qt,tr;if(x.value&&e.currentTimeScale===qe.QUARTER)return{left:`${x.value.left??0}px`,width:`${x.value.width??100}px`,height:`${e.rowHeight-10}px`,top:"4px"};const q=((qt=se.value)==null?void 0:qt.startDate)||e.task.startDate,me=((tr=se.value)==null?void 0:tr.endDate)||e.task.endDate,Ce=c(q),Te=c(me),ze=ce.value;if(!Ce&&!Te)return{left:"0px",width:"0px",height:`${e.rowHeight-10}px`,top:"4px"};const Ie=Ce||Te,Xe=Te||Ce,Ye=ze;if(!Ie||!Xe||!Ye)return{left:"0px",width:"0px",height:`${e.rowHeight-10}px`,top:"4px"};let st=0,vt=0;if(e.currentTimeScale===qe.HOUR){const nr=new Date(Ye);nr.setHours(0,0,0,0);let Kt=Ie,Gt=Xe;const Rt=q||e.task.startDate,pr=me||e.task.endDate;typeof Rt=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(Rt.trim())&&(Kt=new Date(Ie),Kt.setHours(0,0,0,0)),typeof pr=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(pr.trim())&&(Gt=new Date(Xe),Gt.setDate(Gt.getDate()+1),Gt.setHours(0,0,0,0));const dr=b(nr,Kt),yr=b(nr,Gt),$t=40/60;st=Math.max(0,dr*$t),vt=Math.max(4,(yr-dr)*$t)}else{const nr=new Date(Ie.getFullYear(),Ie.getMonth(),Ie.getDate()),Kt=new Date(Xe.getFullYear(),Xe.getMonth(),Xe.getDate()),Gt=new Date(Ye.getFullYear(),Ye.getMonth(),Ye.getDate());if(e.timelineData&&e.currentTimeScale&&(e.currentTimeScale===qe.WEEK||e.currentTimeScale===qe.MONTH||e.currentTimeScale===qe.QUARTER||e.currentTimeScale===qe.YEAR)){const Rt=Er(nr,e.timelineData,e.currentTimeScale),pr=new Date(Kt);pr.setDate(pr.getDate()+1);let dr=Er(pr,e.timelineData,e.currentTimeScale);if(dr===Rt){let yr=2;e.currentTimeScale===qe.WEEK?yr=60/7:e.currentTimeScale===qe.QUARTER?yr=60/90:e.currentTimeScale===qe.YEAR&&(yr=180/182),dr=Er(Kt,e.timelineData,e.currentTimeScale)+yr}st=Rt,vt=Math.max(dr-Rt,4)}else if(e.timelineData&&e.currentTimeScale===qe.DAY){const Rt=Er(nr,e.timelineData,e.currentTimeScale),pr=new Date(Kt);pr.setDate(pr.getDate()+1);let dr=Er(pr,e.timelineData,e.currentTimeScale);dr===Rt&&(dr=Er(Kt,e.timelineData,e.currentTimeScale)+30),st=Rt,vt=Math.max(dr-Rt,4)}else{const Rt=Math.floor((nr.getTime()-Gt.getTime())/864e5),pr=Kt.getTime()-nr.getTime(),dr=Math.round(pr/(1e3*60*60*24)),yr=dr===0?1:dr+1;st=Rt*e.dayWidth,vt=yr*e.dayWidth}}return{left:`${st}px`,width:`${vt}px`,height:`${e.rowHeight-10}px`,top:"4px"}}),he=i.ref({left:0,top:0,width:0,height:0,timestamp:0}),fe=i.computed(()=>c(e.task.endDate||"")),ce=i.computed(()=>c(e.startDate)),Fe=i.computed(()=>{var Ce,Te;const q=((Ce=se.value)==null?void 0:Ce.startDate)||e.task.startDate,me=((Te=se.value)==null?void 0:Te.endDate)||e.task.endDate;return!!(q||me)}),Pe=i.computed(()=>{if(e.isParent)return{type:"parent",color:"#409eff",bgColor:"#409eff",borderColor:"#409eff"};const q=g.value,me=fe.value,Ce=e.task.progress||0;return Ce>=100?{type:"completed",color:"#909399",bgColor:"#f4f4f5",borderColor:"#d3d4d6"}:me&&me<q&&Ce<100?{type:"delayed",color:"#f56c6c",bgColor:"#fef0f0",borderColor:"#fbc4c4"}:me&&me>=q&&Ce>0?{type:"in-progress",color:"#e6a23c",bgColor:"#fdf6ec",borderColor:"#f5dab1"}:{type:"not-started",color:"#409eff",bgColor:"#ecf5ff",borderColor:"#b3d8ff"}}),Ze=i.computed(()=>({type:"task-bar",task:e.task,status:Pe.value,statusType:Pe.value.type,isParent:e.isParent??!1,progress:e.task.progress||0,currentTimeScale:e.currentTimeScale,rowHeight:e.rowHeight,dayWidth:e.dayWidth})),tt=i.computed(()=>(e.task.progress||0)>=100),lt=i.computed(()=>e.isInHighlightMode&&!e.isHighlighted&&!e.isPrimaryHighlight),Q=i.computed(()=>{const q=e.task.progress||0,me=parseInt(Ae.value.width);return`${q/100*me}px`}),De=i.computed(()=>e.dayWidth<=9),pe=i.computed(()=>parseFloat(Ae.value.width||"0")<80),ge=i.computed(()=>De.value&&pe.value),Ee=(q,me)=>{if(e.isHighlighted||e.isPrimaryHighlight||e.allowDragAndResize===!1||tt.value||e.isParent||B.value||(q.preventDefault(),q.stopPropagation(),se.value=null,le.value=!1,X.value=!1,Z.value=me,G.value=!1,T.value&&(clearTimeout(T.value),T.value=null),me==="drag"&&(T.value=window.setTimeout(()=>{!le.value&&!F.value&&!E.value&&!k.value&&(G.value=!0,r("long-press",e.task.id)),T.value=null},dF)),l.value.enableDragDelay&&l.value.dragDelayTime?ee.value=window.setTimeout(()=>{X.value=!0,ee.value=null},l.value.dragDelayTime):X.value=!0,!document.querySelector(".timeline")||!I.value))return;const Te=I.value.getBoundingClientRect();re.value=q.clientX-Te.left,j.value=q.clientX,M.value=parseInt(Ae.value.left),O.value=parseInt(Ae.value.width),(me==="resize-left"||me==="resize-right")&&(L.value=q.clientX,R.value=parseInt(Ae.value.width),S.value=parseInt(Ae.value.left)),window.addEventListener("timeline-auto-scroll",xe),document.addEventListener("mousemove",at),document.addEventListener("mouseup",gt)},xe=q=>{const{scrollDelta:me}=q.detail;F.value?j.value-=me:(E.value||k.value)&&(L.value-=me)};let Qe=!1;function Oe(){Qe||(Qe=!0,requestAnimationFrame(()=>{if(Qe=!1,!I.value)return;const q=Date.now();if(q-he.value.timestamp<hF){r("bar-mounted",{id:e.task.id,left:he.value.left,top:he.value.top,width:he.value.width,height:he.value.height});return}const me=I.value.getBoundingClientRect(),Ce={left:me.left,top:me.top,width:me.width,height:me.height};he.value={...Ce,timestamp:q},r("bar-mounted",{id:e.task.id,...Ce})}))}const Ve=i.ref(!1),Re=i.ref({x:0,y:0}),$e=i.ref({startDate:"",endDate:""}),at=q=>{if(!(e.isHighlighted||e.isPrimaryHighlight)&&!(l.value.enableDragDelay&&!X.value)){if(!le.value){if(Math.abs(q.clientX-j.value)<oe.value)return;le.value=!0,Z.value==="drag"?F.value=!0:Z.value==="resize-left"?E.value=!0:Z.value==="resize-right"&&(k.value=!0)}if(le.value){if(window.dispatchEvent(new CustomEvent("drag-boundary-check",{detail:{mouseX:q.clientX,isDragging:F.value||E.value||k.value}})),(F.value||E.value||k.value)&&(Ve.value=!0,Re.value={x:q.clientX+15,y:q.clientY-60}),F.value){const me=q.clientX-j.value;if(e.currentTimeScale===qe.HOUR){const Ce=.6666666666666666,Te=Ce*15,ze=Math.max(0,M.value+me),Ie=Math.round(ze/Te)*Te,Xe=Math.round(Ie/Ce),Ye=new Date(e.startDate);Ye.setHours(0,0,0,0);const st=w(Ye,Xe),vt=c(e.task.startDate)||e.startDate,qt=c(e.task.endDate)||e.startDate;let tr;if(e.task.startDate&&!e.task.startDate.includes(" ")){const Kt=qt.getTime()-vt.getTime();tr=Math.max(1,Math.round(Kt/(1e3*60*60*24))+1)*24*60}else tr=b(vt,qt);const nr=w(st,tr);se.value={startDate:f(st),endDate:f(nr)},$e.value={startDate:f(st),endDate:f(nr)}}else if(e.currentTimeScale===qe.QUARTER){const Ce=Math.max(0,M.value+me);x.value={left:Ce,width:O.value};const Ie=60/90,Xe=Math.round(me/Ie),Ye=c(e.task.startDate)||e.startDate,st=c(e.task.endDate)||e.startDate,vt=new Date(Ye);vt.setDate(vt.getDate()+Xe);const qt=st.getTime()-Ye.getTime(),tr=Math.ceil(qt/(1e3*60*60*24)),nr=new Date(vt);nr.setDate(nr.getDate()+Math.max(0,tr)),se.value={startDate:f(vt),endDate:f(nr)},$e.value={startDate:f(vt),endDate:f(nr)}}else{const Ce=Math.max(0,M.value+me);if((e.currentTimeScale===qe.DAY||e.currentTimeScale===qe.MONTH||e.currentTimeScale===qe.QUARTER||e.currentTimeScale===qe.YEAR)&&e.timelineData){const Te=gA(Ce,e.timelineData,e.currentTimeScale);if(Te){const ze=c(e.task.startDate)||e.startDate,Xe=(c(e.task.endDate)||e.startDate).getTime()-ze.getTime(),Ye=Math.ceil(Xe/(1e3*60*60*24)),st=new Date(Te);st.setDate(st.getDate()+Math.max(0,Ye)),se.value={startDate:f(Te),endDate:f(st)},$e.value={startDate:f(Te),endDate:f(st)}}}else{const Te=v(e.startDate,Ce/e.dayWidth),ze=O.value/e.dayWidth,Ie=v(Te,ze-1);se.value={startDate:f(Te),endDate:f(Ie)},$e.value={startDate:f(Te),endDate:f(Ie)}}}}else if(E.value){const me=q.clientX-L.value;if(e.currentTimeScale===qe.HOUR){const Ce=.6666666666666666,Te=Ce*15,ze=Math.max(0,S.value+me),Ie=Math.round(ze/Te)*Te,Xe=Math.round(Ie/Ce),Ye=new Date(e.startDate);Ye.setHours(0,0,0,0);const st=w(Ye,Xe);se.value={startDate:f(st),endDate:e.task.endDate},$e.value={startDate:f(st),endDate:e.task.endDate||""}}else if(e.currentTimeScale===qe.QUARTER){const Ce=Math.max(0,S.value+me),Te=Math.max(10,R.value-me);x.value={left:Ce,width:Te};const Xe=60/90,Ye=Math.round(me/Xe),st=c(e.task.startDate)||e.startDate,vt=new Date(st);vt.setDate(vt.getDate()+Ye),se.value={startDate:f(vt),endDate:e.task.endDate},$e.value={startDate:f(vt),endDate:e.task.endDate||""}}else{const Ce=Math.max(0,S.value+me);if((e.currentTimeScale===qe.DAY||e.currentTimeScale===qe.MONTH||e.currentTimeScale===qe.QUARTER||e.currentTimeScale===qe.YEAR)&&e.timelineData){const Te=gA(Ce,e.timelineData,e.currentTimeScale);Te&&(se.value={startDate:f(Te),endDate:e.task.endDate},$e.value={startDate:f(Te),endDate:e.task.endDate||""})}else{const Te=v(e.startDate,Ce/e.dayWidth);se.value={startDate:f(Te),endDate:e.task.endDate},$e.value={startDate:f(Te),endDate:e.task.endDate||""}}}}else if(k.value){const me=q.clientX-L.value;if(e.currentTimeScale===qe.HOUR){const Ce=.6666666666666666,Te=Ce*15,ze=Math.max(Te,R.value+me),Ie=Math.round(ze/Te)*Te,Xe=Math.round(Ie/Ce),Ye=c(e.task.startDate)||e.startDate,st=w(Ye,Xe);se.value={startDate:e.task.startDate,endDate:f(st)},$e.value={startDate:e.task.startDate||"",endDate:f(st)}}else if(e.currentTimeScale===qe.QUARTER){const Ce=Math.max(10,R.value+me);x.value={left:S.value,width:Ce};const Ie=60/90,Xe=Math.round(me/Ie),Ye=c(e.task.endDate)||e.startDate,st=new Date(Ye);st.setDate(st.getDate()+Xe),se.value={startDate:e.task.startDate,endDate:f(st)},$e.value={startDate:e.task.startDate||"",endDate:f(st)}}else{const Ce=Math.max(e.dayWidth,R.value+me);if((e.currentTimeScale===qe.DAY||e.currentTimeScale===qe.MONTH||e.currentTimeScale===qe.QUARTER||e.currentTimeScale===qe.YEAR)&&e.timelineData){const Te=S.value+Ce,ze=gA(Te,e.timelineData,e.currentTimeScale);ze&&(se.value={startDate:e.task.startDate,endDate:f(ze)},$e.value={startDate:e.task.startDate||"",endDate:f(ze)})}else{const Te=Ce/e.dayWidth,ze=v(e.startDate,S.value/e.dayWidth+Te-1);se.value={startDate:e.task.startDate,endDate:f(ze)},$e.value={startDate:e.task.startDate||"",endDate:f(ze)}}}}}}},gt=()=>{if(ee.value!==null&&(window.clearTimeout(ee.value),ee.value=null),T.value!==null&&(clearTimeout(T.value),T.value=null),Ve.value=!1,x.value=null,window.dispatchEvent(new CustomEvent("drag-boundary-check",{detail:{mouseX:0,isDragging:!1}})),le.value&&se.value){const q={...e.task,...se.value};F.value?r("drag-end",q):(E.value||k.value)&&r("resize-end",q),r("update:task",q),se.value=null,i.nextTick(()=>{Oe()})}window.removeEventListener("timeline-auto-scroll",xe),(F.value||E.value||k.value)&&(P.value=!0,setTimeout(()=>{P.value=!1},200)),F.value=!1,E.value=!1,k.value=!1,le.value=!1,X.value=!1,Z.value=null,document.removeEventListener("mousemove",at),document.removeEventListener("mouseup",gt)};let mt=null;i.onMounted(()=>{i.nextTick(()=>{Oe(),W.value&&(mt=new ResizeObserver(Ce=>{for(const Te of Ce)z.value=Te.contentRect.width}),mt.observe(W.value))});const q=()=>{i.nextTick(()=>{Oe()})},me=()=>{i.nextTick(()=>{setTimeout(()=>{Oe()},10)})};window.addEventListener("timeline-scale-updated",q),window.addEventListener("timeline-force-recalculate",me),window.addEventListener("close-all-taskbar-menus",Rr),i.onUnmounted(()=>{mt&&(mt.disconnect(),mt=null),window.removeEventListener("timeline-scale-updated",q),window.removeEventListener("timeline-force-recalculate",me),window.removeEventListener("close-all-taskbar-menus",Rr),T.value!==null&&(clearTimeout(T.value),T.value=null)})}),i.watch(()=>[e.task.startDate,e.task.endDate],()=>{i.nextTick(()=>{Oe()})},{deep:!0}),i.watch(()=>[e.isHighlighted,e.isPrimaryHighlight],([q,me])=>{(q||me)&&(F.value=!1,E.value=!1,k.value=!1,le.value=!1,X.value=!1,Z.value=null,Ve.value=!1,document.removeEventListener("mousemove",at),document.removeEventListener("mouseup",gt),window.removeEventListener("timeline-auto-scroll",xe),T.value&&(clearTimeout(T.value),T.value=null),ee.value&&(clearTimeout(ee.value),ee.value=null),window.dispatchEvent(new CustomEvent("taskbar-highlighted",{detail:{taskId:e.task.id}})))});let ht=null;const Bt=q=>{if(!(F.value||E.value||k.value||P.value)){if(G.value){G.value=!1;return}ht===null&&(ht=window.setTimeout(()=>{ht=null,e.onClick&&typeof e.onClick=="function"?e.onClick(e.task,q):r("click",e.task,q)},gF))}},pt=q=>{q.stopPropagation(),q.preventDefault(),ht!==null&&(clearTimeout(ht),ht=null),F.value=!1,E.value=!1,k.value=!1,se.value=null,document.removeEventListener("mousemove",at),document.removeEventListener("mouseup",gt),r("dblclick",e.task,q)},zt=i.computed(()=>{const q=e.scrollLeft||0,me=e.containerWidth||0;if(!q&&!me)return{nameLeft:"",namePosition:"",nameTop:"",progressLeft:"",progressPosition:"",progressTop:"",avatarLeft:"",avatarPosition:""};const Ce=parseInt(Ae.value.left),Te=parseInt(Ae.value.width),ze=Ce+Te,Ie=Ce+Te/2,Xe=q,Ye=q+me;let st="",vt="",qt="",tr="",nr="",Kt="",Gt="",Rt="";const pr=Math.max(z.value,40),dr=35,yr=22,$t=Cr.value,RA=$t+3,cn=Ce+RA,Ln=Ce+RA+yr,bn=cn<Xe&&ze>Xe||Ie<Xe&&ze>Xe,Qr=Math.max(pr,dr),ur=Ln+Qr+15>Ye&&Ce<Ye;let Kr=0;if(bn)Gt=`${Xe-Ce+$t+3}px`,Rt="absolute",Kr=yr+8;else if(ur){const mA=Math.max(pr,dr);Gt=`${Ye-Ce-mA-$t-3-yr-15}px`,Rt="absolute",Kr=-37}const Lr=Ie-pr/2,$r=Ie+pr/2,XA=l.value.showAvatar;let ea=!1;if(XA){const mA=Lr,dn=yr+15;ea=mA<Xe+dn&&ze>Xe}else ea=Lr<Xe&&ze>Xe&&Ie<Xe;const Vn=$r>Ye&&Ce<Ye&&Ie>Ye;if(ea){const mA=Xe-Ce,dn=bn?Kr:0;st=`${mA+$t+3+dn}px`,vt="absolute",qt="2px"}else Vn&&(st=`${Ye-Ce-pr-$t-10}px`,vt="absolute",qt="2px");const un=Ie-dr/2,ta=Ie+dr/2;let kA=!1;if(XA){const mA=un,dn=yr+15;kA=mA<Xe+dn&&ze>Xe}else kA=un<Xe&&ze>Xe&&Ie<Xe;const fn=ta>Ye&&Ce<Ye&&Ie>Ye;if(kA){const mA=Xe-Ce,dn=bn?Kr:0;tr=`${mA+$t+3+dn}px`,nr="absolute",Kt="18px"}else fn&&(tr=`${Ye-Ce-dr-$t-3}px`,nr="absolute",Kt="18px");return{nameLeft:st,namePosition:vt,nameTop:qt,progressLeft:tr,progressPosition:nr,progressTop:Kt,avatarLeft:Gt,avatarPosition:Rt}}),_t=i.computed(()=>{const q=e.scrollLeft||0,me=e.containerWidth||0;if(!me||me<=0)return{show:!1,left:"0px",side:"left",color:"#409eff",animationType:"none"};if(St.value||He.value||e.hideBubbles)return{show:!1,left:"0px",side:"left",color:Pe.value.color,animationType:"none"};const Ce=parseInt(Ae.value.left),Te=parseInt(Ae.value.width),ze=Ce+Te,Ie=q,Xe=q+me,Ye=ze<=Ie,st=Ce>=Xe;return Ye?{show:!0,left:`${Ie-Ce-4}px`,side:"left",color:Pe.value.color,animationType:"morphToSemiCircle"}:st?{show:!0,left:`${Xe-Ce-8}px`,side:"right",color:Pe.value.color,animationType:"morphToSemiCircle"}:{show:!1,left:"0px",side:"left",color:Pe.value.color,animationType:"none"}}),Ut=i.ref(!1),Lt=i.ref({x:0,y:0}),Xt=i.ref(!1),Et=i.ref(null),rr=i.ref(!1),St=i.ref(!0),ye=i.ref(!1),He=i.ref(!1),_e=q=>{q.stopPropagation(),q.preventDefault();const me=e.scrollLeft||0,Ce=e.containerWidth||0;if(!me&&!Ce)return;const Te=parseInt(Ae.value.left),ze=parseInt(Ae.value.width),Xe=Te+ze/2-Ce/2;ye.value=!0,He.value=!0,Ut.value=!1,r("scroll-to-position",Xe)};i.watch(()=>[e.scrollLeft,e.containerWidth],(q,me)=>{const[Ce,Te]=q,[ze,Ie]=me||[0,0],Xe=Ce||0,Ye=Te||0,st=ze||0,vt=Ie||0;if(Math.abs(Ye-vt)>1&&vt>0){rr.value=!0,i.nextTick(()=>{}),St.value&&setTimeout(()=>{St.value=!1},300),setTimeout(()=>{rr.value=!1},500);return}St.value&&Xe>=0&&Ye>0&&setTimeout(()=>{St.value=!1},1e3),Xe!==st&&!rr.value&&(Xt.value=!0,Et.value&&clearTimeout(Et.value),Et.value=setTimeout(()=>{Xt.value=!1,ye.value&&(ye.value=!1,setTimeout(()=>{He.value=!1},300))},200))},{immediate:!0}),i.watch(()=>e.hideBubbles,(q,me)=>{me&&!q&&i.nextTick(()=>{})}),i.watch(()=>_t.value.show,()=>{});const je=()=>{rr.value=!0,i.nextTick(()=>{}),setTimeout(()=>{rr.value=!1},300)};i.onMounted(()=>{window.addEventListener("resize",je),window.addEventListener("zoom",je)}),i.onUnmounted(()=>{document.removeEventListener("mousemove",at),document.removeEventListener("mouseup",gt),window.removeEventListener("resize",je),window.removeEventListener("zoom",je)});const wt=q=>{q.stopPropagation(),Ut.value=!0;const Ce=_t.value.side==="right"?-180:15;Lt.value={x:q.clientX+Ce,y:q.clientY-10}},Qt=q=>{q.stopPropagation(),Ut.value=!1},Tt=q=>{q.stopPropagation(),Ut.value=!1},gr=q=>{if(!q)return o("dateNotSet");const me=c(q);if(!me)return o("dateNotSet");const Ce=me.getFullYear(),Te=String(me.getMonth()+1).padStart(2,"0"),ze=String(me.getDate()).padStart(2,"0");return`${Ce}-${Te}-${ze}`},Or=i.computed(()=>{const q=c(e.task.startDate),me=c(e.task.endDate);let Ce=0;if(q&&me){const Ie=Math.abs(me.getTime()-q.getTime());Ce=Math.ceil(Ie/(1e3*60*60*24))*8}const Te=e.task.progress||0,ze=Math.round(Ce*Te/100);return{total:Ce,used:ze}}),Ft=i.computed(()=>!0),hA=()=>{const q=zt.value,me={};return q.nameLeft&&(me.left=q.nameLeft),q.namePosition&&(me.position=q.namePosition),q.nameTop&&(me.top=q.nameTop),me},lA=()=>{const q=zt.value,me={};return q.progressLeft&&(me.left=q.progressLeft),q.progressPosition&&(me.position=q.progressPosition),q.progressTop&&(me.top=q.progressTop),me},cA=()=>{const q=zt.value,me={};return q.avatarLeft&&(me.left=q.avatarLeft),q.avatarPosition&&(me.position=q.avatarPosition),me},xr=i.computed(()=>parseInt(Ae.value.width)-10<22),fr=i.computed(()=>({width:`${Math.min(l.value.resizeHandleWidth??5,15)}px`})),Cr=i.computed(()=>Math.min(l.value.resizeHandleWidth??5,15)),Er=(q,me,Ce)=>{var ze;let Te=0;for(const Ie of me)if(Ce===qe.DAY){const Xe=Ie.days||[];for(let Ye=0;Ye<Xe.length;Ye++){const st=Xe[Ye],vt=new Date(st.date);if(vt.getFullYear()===q.getFullYear()&&vt.getMonth()===q.getMonth()&&vt.getDate()===q.getDate())return Te+Ye*30}Te+=Xe.length*30}else if(Ce===qe.QUARTER){const Xe=Ie.quarters||[];for(const Ye of Xe){const st=new Date(Ye.startDate),vt=new Date(Ye.endDate);if(q>=st&&q<=vt){const nr=60/Math.ceil((vt.getTime()-st.getTime())/864e5),Kt=Math.ceil((q.getTime()-st.getTime())/(1e3*60*60*24));return Te+Kt*nr}Te+=60}}else if(Ce===qe.WEEK){const Xe=Ie.weeks||[];for(const Ye of Xe){const st=new Date(Ye.weekStart),vt=new Date(Ye.weekEnd);if(q>=st&&q<=vt){const tr=Ye.subDays||[],nr=60/7;for(let Gt=0;Gt<tr.length;Gt++){const Rt=tr[Gt],pr=new Date(Rt.date);if(pr.getFullYear()===q.getFullYear()&&pr.getMonth()===q.getMonth()&&pr.getDate()===q.getDate())return Te+Gt*nr}const Kt=q.getDay();return Te+Kt*nr}Te+=60}}else if(Ce===qe.MONTH){const Xe=new Date(Ie.startDate),Ye=new Date(Ie.endDate);if(q>=Xe&&q<=Ye){const qt=60/(((ze=Ie.monthData)==null?void 0:ze.dayCount)||30),tr=q.getDate();return Te+(tr-1)*qt}Te+=60}else if(Ce===qe.YEAR){const Xe=Ie.halfYears||[];for(const Ye of Xe){const st=new Date(Ye.startDate),vt=new Date(Ye.endDate);if(q>=st&&q<=vt){const nr=180/Math.ceil((vt.getTime()-st.getTime())/864e5),Kt=Math.ceil((q.getTime()-st.getTime())/(1e3*60*60*24));return Te+Kt*nr}Te+=180}}return Ce===qe.WEEK?(console.warn("[Gantt Debug] 周视图定位失败,任务日期未找到 week 匹配,返回 -1",{targetDate:q}),-1):Te},gA=(q,me,Ce)=>{var ze;if(!me)return null;let Te=0;if(Ce===qe.DAY)for(const Ie of me){const Xe=Ie.days||[],Ye=Xe.length*30;if(q>=Te&&q<Te+Ye){const st=q-Te,vt=Math.floor(st/30);if(vt>=0&&vt<Xe.length)return new Date(Xe[vt].date)}Te+=Ye}else if(Ce===qe.MONTH)for(const Ie of me){if(q>=Te&&q<Te+60){const Ye=q-Te,st=((ze=Ie.monthData)==null?void 0:ze.dayCount)||30,vt=60/st,qt=Math.floor(Ye/vt),tr=Math.min(qt+1,st);return new Date(Ie.year,Ie.month-1,tr)}Te+=60}else if(Ce===qe.QUARTER)for(const Ie of me){const Xe=Ie.quarters||[];for(const Ye of Xe){const st=new Date(Ye.startDate),vt=new Date(Ye.endDate),qt=60;if(q>=Te&&q<Te+qt){const tr=q-Te,nr=Math.ceil((vt.getTime()-st.getTime())/(1e3*60*60*24)),Kt=qt/nr,Gt=Math.floor(tr/Kt),Rt=new Date(st);return Rt.setDate(Rt.getDate()+Gt),Rt}Te+=qt}}else if(Ce===qe.YEAR)for(const Ie of me){const Xe=Ie.halfYears||[];for(const Ye of Xe){const st=new Date(Ye.startDate),vt=new Date(Ye.endDate),qt=180;if(q>=Te&&q<Te+qt){const tr=q-Te,nr=Math.ceil((vt.getTime()-st.getTime())/(1e3*60*60*24)),Kt=qt/nr,Gt=Math.floor(tr/Kt),Rt=new Date(st);return Rt.setDate(Rt.getDate()+Gt),Rt}Te+=qt}}return null},uA=i.ref(!1),Br=i.ref({x:0,y:0}),tA=i.computed(()=>e.task);function pA(q){if(e.isHighlighted||e.isPrimaryHighlight){q.preventDefault();return}if(window.dispatchEvent(new CustomEvent("close-all-taskbar-menus")),e.task.type!=="task"&&e.task.type!=="story"){q.preventDefault(),uA.value=!1;return}q.preventDefault(),uA.value=!0,Br.value={x:q.clientX,y:q.clientY}}function Rr(){uA.value=!1}const vA=(q,me)=>{r("delete",q,me),Rr()},ln=q=>{r("delete-link",q),Rr()},Ct=q=>{r("link-drag-start",q)},Be=q=>{r("link-drag-move",q)},$=q=>{r("link-drag-end",q)},de=q=>{const me={clientX:q.x,clientY:q.y};Ct({task:e.task,type:q.type,mouseEvent:me})},Ke=q=>{Be({mouseX:q.x,mouseY:q.y})},rt=q=>{$({task:e.task,type:q.type})};return i.onMounted(()=>{window.addEventListener("close-all-taskbar-menus",Rr)}),i.onUnmounted(()=>{window.removeEventListener("close-all-taskbar-menus",Rr),ht!==null&&(clearTimeout(ht),ht=null)}),(q,me)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[Fe.value?(i.openBlock(),i.createElementBlock("div",{key:0,ref_key:"barRef",ref:I,class:i.normalizeClass(["task-bar",{dragging:F.value,resizing:E.value||k.value,completed:tt.value,"parent-task":q.isParent,"week-view":De.value,"short-task-bar":pe.value,"overflow-effect":ge.value,highlighted:q.isHighlighted,"primary-highlight":q.isPrimaryHighlight,dimmed:lt.value}]),"data-task-id":q.task.id,style:i.normalizeStyle({...Ae.value,backgroundColor:Pe.value.bgColor,borderColor:Pe.value.borderColor,color:Pe.value.color,cursor:tt.value||q.isParent?"default":"move","--row-height":`${q.rowHeight}px`,"--handle-width":`${Cr.value}px`}),onClick:Bt,onContextmenu:pA,onDblclick:pt,onMouseenter:me[7]||(me[7]=Ce=>N.value=!0),onMouseleave:me[8]||(me[8]=Ce=>N.value=!1)},[q.isParent?(i.openBlock(),i.createElementBlock("div",O4,[s.value?i.renderSlot(q.$slots,"custom-task-content",i.normalizeProps(i.mergeProps({key:0},Ze.value)),void 0,!0):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(q.task.name)+" ("+i.toDisplayString(q.task.progress||0)+"%) ",1)],64))])):i.createCommentVNode("",!0),!q.isParent&&q.task.progress&&q.task.progress>0?(i.openBlock(),i.createElementBlock("div",{key:1,class:"progress-bar",style:i.normalizeStyle({width:Q.value,backgroundColor:Pe.value.color})},null,4)):i.createCommentVNode("",!0),!tt.value&&!q.isParent&&!B.value&&e.allowDragAndResize!==!1&&!q.isHighlighted&&!q.isPrimaryHighlight?(i.openBlock(),i.createElementBlock("div",{key:2,class:"resize-handle resize-handle-left",style:i.normalizeStyle(fr.value),onMousedown:me[0]||(me[0]=Ce=>Ee(Ce,"resize-left"))},null,36)):i.createCommentVNode("",!0),q.isParent?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",{key:3,class:"task-bar-content",style:i.normalizeStyle({cursor:B.value||e.allowDragAndResize===!1||q.isHighlighted||q.isPrimaryHighlight?"grab":"move"}),onMousedown:me[1]||(me[1]=Ce=>{q.isHighlighted||q.isPrimaryHighlight||B.value||e.allowDragAndResize===!1||Ee(Ce,"drag")})},[l.value.showAvatar?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["task-avatar",{"avatar-outside":xr.value,"avatar-default":!q.task.avatar}]),style:i.normalizeStyle(cA())},[q.task.avatar?(i.openBlock(),i.createElementBlock("img",{key:0,src:q.task.avatar,alt:q.task.assignee||"avatar"},null,8,R4)):q.task.assigneeName?(i.openBlock(),i.createElementBlock("span",H4,i.toDisplayString(q.task.assigneeName.charAt(0).toUpperCase()),1)):(i.openBlock(),i.createElementBlock("svg",P4,me[9]||(me[9]=[i.createElementVNode("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z",fill:"currentColor"},null,-1)])))],6)):i.createCommentVNode("",!0),l.value.showTitle?(i.openBlock(),i.createElementBlock("div",{key:1,ref_key:"taskBarNameRef",ref:W,style:i.normalizeStyle(hA())},[s.value?i.renderSlot(q.$slots,"custom-task-content",i.normalizeProps(i.mergeProps({key:0},Ze.value)),void 0,!0):(i.openBlock(),i.createElementBlock("div",V4,i.toDisplayString(q.task.name),1))],4)):i.createCommentVNode("",!0),l.value.showProgress&&Ft.value?(i.openBlock(),i.createElementBlock("div",{key:2,class:"task-progress",style:i.normalizeStyle(lA())},i.toDisplayString(q.task.progress||0)+"% ",5)):i.createCommentVNode("",!0)],36)),!tt.value&&!q.isParent&&!B.value&&e.allowDragAndResize!==!1&&!q.isHighlighted&&!q.isPrimaryHighlight?(i.openBlock(),i.createElementBlock("div",{key:4,class:"resize-handle resize-handle-right",style:i.normalizeStyle(fr.value),onMousedown:me[2]||(me[2]=Ce=>Ee(Ce,"resize-right"))},null,36)):i.createCommentVNode("",!0),!q.isParent&&!q.isInHighlightMode?(i.openBlock(),i.createBlock(jv,{key:5,type:"predecessor","task-id":q.task.id,visible:N.value,"is-drag-source":q.isLinkDragSource&&q.dragLinkMode==="predecessor","is-drag-target":q.isValidLinkTarget||q.isInvalidLinkTarget,"is-valid-target":q.isValidLinkTarget,"global-dragging":!!q.dragLinkMode,onDragStart:de,onDragMove:Ke,onDragEnd:rt},null,8,["task-id","visible","is-drag-source","is-drag-target","is-valid-target","global-dragging"])):i.createCommentVNode("",!0),!q.isParent&&!q.isInHighlightMode?(i.openBlock(),i.createBlock(jv,{key:6,type:"successor","task-id":q.task.id,visible:N.value,"is-drag-source":q.isLinkDragSource&&q.dragLinkMode==="successor","is-drag-target":q.isValidLinkTarget||q.isInvalidLinkTarget,"is-valid-target":q.isValidLinkTarget,"global-dragging":!!q.dragLinkMode,onDragStart:de,onDragMove:Ke,onDragEnd:rt},null,8,["task-id","visible","is-drag-source","is-drag-target","is-valid-target","global-dragging"])):i.createCommentVNode("",!0),_t.value.show&&!q.isParent?(i.openBlock(),i.createElementBlock("div",{key:7,class:i.normalizeClass(["bubble-indicator",[`bubble-${_t.value.side}`,`bubble-animation-${_t.value.animationType}`]]),style:i.normalizeStyle({left:_t.value.left,backgroundColor:_t.value.color,borderColor:_t.value.color}),onMouseenter:i.withModifiers(wt,["stop"]),onMouseleave:i.withModifiers(Qt,["stop"]),onMousedown:i.withModifiers(Tt,["stop"]),onClick:i.withModifiers(_e,["stop"])},null,38)):i.createCommentVNode("",!0),i.createVNode(Ay,{visible:uA.value,task:tA.value,position:Br.value,"all-tasks":q.allTasks,onClose:Rr,onStartTimer:me[3]||(me[3]=Ce=>q.$emit("start-timer",e.task)),onStopTimer:me[4]||(me[4]=Ce=>q.$emit("stop-timer",e.task)),onAddPredecessor:me[5]||(me[5]=Ce=>q.$emit("add-predecessor",e.task)),onAddSuccessor:me[6]||(me[6]=Ce=>q.$emit("add-successor",e.task)),onDelete:vA,onDeleteLink:ln},null,8,["visible","task","position","all-tasks"])],46,M4)):i.createCommentVNode("",!0),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[Ut.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"task-tooltip",style:i.normalizeStyle({left:`${Lt.value.x}px`,top:`${Lt.value.y}px`})},[me[10]||(me[10]=i.createElementVNode("div",{class:"tooltip-arrow"},null,-1)),i.createElementVNode("div",K4,i.toDisplayString(q.task.name),1),i.createElementVNode("div",q4,[i.createElementVNode("div",j4,[i.createElementVNode("span",W4,i.toDisplayString(o("startDate"))+":",1),i.createElementVNode("span",G4,i.toDisplayString(gr(q.task.startDate)),1)]),i.createElementVNode("div",Y4,[i.createElementVNode("span",z4,i.toDisplayString(o("endDate"))+":",1),i.createElementVNode("span",$4,i.toDisplayString(gr(q.task.endDate)),1)]),i.createElementVNode("div",X4,[i.createElementVNode("span",J4,i.toDisplayString(o("estimatedHours"))+":",1),i.createElementVNode("span",Z4,i.toDisplayString(Or.value.total)+"h",1)]),i.createElementVNode("div",eF,[i.createElementVNode("span",tF,i.toDisplayString(o("actualHours"))+":",1),i.createElementVNode("span",rF,i.toDisplayString(Or.value.used)+"h",1)]),i.createElementVNode("div",AF,[i.createElementVNode("span",nF,i.toDisplayString(o("progress"))+":",1),i.createElementVNode("span",aF,i.toDisplayString(q.task.progress||0)+"%",1)])])],4)):i.createCommentVNode("",!0)])),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[Ve.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"drag-tooltip",style:i.normalizeStyle({left:`${Re.value.x}px`,top:`${Re.value.y}px`})},[i.createElementVNode("div",iF,[i.createElementVNode("div",sF,[i.createElementVNode("span",oF,i.toDisplayString(o("startDate"))+":",1),i.createElementVNode("span",lF,i.toDisplayString(gr($e.value.startDate)),1)]),i.createElementVNode("div",cF,[i.createElementVNode("span",uF,i.toDisplayString(o("endDate"))+":",1),i.createElementVNode("span",fF,i.toDisplayString(gr($e.value.endDate)),1)])])],4)):i.createCommentVNode("",!0)]))],64))}}),iy=sn(pF,[["__scopeId","data-v-d1be80c8"]]),vF=["title"],mF={key:0,transform:"rotate(45 16 16)"},wF=["fill","stroke"],BF={key:1},yF={key:2,transform:"rotate(45 16 16)"},bF=["fill","stroke"],CF={key:1,class:"milestone-label milestone-label-right"},EF={class:"tooltip-content"},FF=i.defineComponent({__name:"MilestonePoint",props:{date:{},milestone:{},name:{},rowHeight:{},dayWidth:{},startDate:{},timelineStart:{},timelineEnd:{},scrollLeft:{},containerWidth:{},milestoneId:{},otherMilestones:{},currentTimeScale:{},timelineData:{},periodWidth:{},isInHighlightMode:{type:Boolean},allowDragAndResize:{type:Boolean}},emits:["milestone-double-click","update:milestone","drag-end"],setup(A,{emit:t}){const e=A,r=t,{getTranslation:n}=ga(),a=Z=>n(Z),o=i.ref(!1),s=i.ref(0),l=i.ref(0),c=i.ref(null),u=Z=>{if(Z.preventDefault(),Z.stopPropagation(),!(O.value.isSticky||O.value.isPushedOut||!O.value.showIcon))if(o.value=!1,c.value=null,document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",B),e.milestone)r("milestone-double-click",e.milestone);else{const ee={name:e.name||"里程碑",startDate:e.date,type:"milestone"};r("milestone-double-click",ee)}},g=(Z,ee)=>{const X=new Date(Z);return X.setDate(X.getDate()+ee),X},p=Z=>{const ee=Z.getFullYear(),X=String(Z.getMonth()+1).padStart(2,"0"),re=String(Z.getDate()).padStart(2,"0");return`${ee}-${X}-${re}`},f=(Z,ee,X)=>{var se;if(!ee)return null;let re=0;if(X===qe.DAY)for(const x of ee){const I=x.days||[],W=I.length*30;if(Z>=re&&Z<re+W){const z=Z-re,Ae=Math.floor(z/30);if(Ae>=0&&Ae<I.length)return new Date(I[Ae].date)}re+=W}else if(X===qe.MONTH)for(const x of ee){if(Z>=re&&Z<re+60){const W=Z-re,z=((se=x.monthData)==null?void 0:se.dayCount)||30,Ae=60/z,he=Math.floor(W/Ae),fe=Math.min(he+1,z);return new Date(x.year,x.month-1,fe)}re+=60}else if(X===qe.QUARTER)for(const x of ee){const I=x.quarters||[];for(const W of I){const z=new Date(W.startDate),Ae=new Date(W.endDate),he=60;if(Z>=re&&Z<re+he){const fe=Z-re,ce=Math.ceil((Ae.getTime()-z.getTime())/(1e3*60*60*24)),Fe=he/ce,Pe=Math.floor(fe/Fe),Ze=new Date(z);return Ze.setDate(Ze.getDate()+Pe),Ze}re+=he}}return null},v=Z=>{e.allowDragAndResize===!1||e.currentTimeScale===qe.YEAR||O.value.isSticky||O.value.isPushedOut||!O.value.showIcon||(Z.preventDefault(),Z.stopPropagation(),!document.querySelector(".timeline"))||(s.value=Z.clientX,l.value=parseInt(k.value.left),c.value=null,window.addEventListener("timeline-auto-scroll",w),document.addEventListener("mousemove",b),document.addEventListener("mouseup",B))},w=Z=>{const{scrollDelta:ee}=Z.detail;o.value&&(s.value-=ee)},b=Z=>{window.dispatchEvent(new CustomEvent("drag-boundary-check",{detail:{mouseX:Z.clientX,isDragging:o.value}}));const ee=Z.clientX-s.value;if(Math.abs(ee)>3){o.value=!0;const X=Math.max(0,l.value+ee);let re;if(e.currentTimeScale===qe.MONTH||e.currentTimeScale===qe.QUARTER||e.currentTimeScale===qe.DAY)if(e.timelineData&&e.currentTimeScale){const se=f(X,e.timelineData,e.currentTimeScale);se?re=se:re=g(e.startDate,X/e.dayWidth)}else re=g(e.startDate,X/e.dayWidth);else re=g(e.startDate,X/e.dayWidth);c.value={startDate:p(re)}}},B=()=>{if(window.dispatchEvent(new CustomEvent("drag-boundary-check",{detail:{mouseX:0,isDragging:!1}})),o.value&&c.value&&e.milestone){const Z={...e.milestone,...c.value};r("update:milestone",Z),r("drag-end",Z)}window.removeEventListener("timeline-auto-scroll",w),o.value=!1,c.value=null,document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",B)},F=Z=>{if(Z.preventDefault(),Z.stopPropagation(),o.value||O.value.isPushedOut||!O.value.showIcon||O.value.isFullyVisible)return;const ee=e.containerWidth||0,X=parseInt(k.value.left)+12;if(ee>0){const re=Math.max(0,X-ee/2);window.dispatchEvent(new CustomEvent("milestone-click-locate",{detail:{scrollLeft:re,smooth:!0}}))}},E=i.computed(()=>e.isInHighlightMode===!0),k=i.computed(()=>{var se;const Z=((se=c.value)==null?void 0:se.startDate)||e.date,ee=xE(Z);if(!e.startDate||!ee||isNaN(ee.getTime()))return{left:"0px",top:"0px",width:"auto",height:"auto"};let X=0,re=24;return e.currentTimeScale===qe.YEAR||e.currentTimeScale===qe.QUARTER?re=Math.min(e.rowHeight,24):e.currentTimeScale===qe.MONTH?re=Math.min(e.rowHeight,20):e.currentTimeScale===qe.WEEK?re=Math.min(e.rowHeight,Math.max(e.dayWidth*.8,16),24):re=Math.min(e.rowHeight,e.dayWidth*1.2,24),e.currentTimeScale===qe.HOUR?X=oe(ee,e.startDate)-re/2:e.timelineData&&e.currentTimeScale&&(e.currentTimeScale===qe.WEEK||e.currentTimeScale===qe.MONTH||e.currentTimeScale===qe.DAY||e.currentTimeScale===qe.QUARTER||e.currentTimeScale===qe.YEAR)?X=le(ee,e.timelineData,e.currentTimeScale)-re/2:X=Math.floor((ee.getTime()-e.startDate.getTime())/864e5)*e.dayWidth+e.dayWidth/2-re/2,{left:`${X}px`,top:`${(e.rowHeight-re)/2}px`,width:"auto",height:"auto"}}),P=i.computed(()=>"var(--gantt-danger, #f56c6c)"),j=i.computed(()=>"var(--gantt-danger-light, #fab6b6)"),M=i.computed(()=>{var Z;return((Z=e.milestone)==null?void 0:Z.icon)||"diamond"}),O=i.computed(()=>{const Z=e.scrollLeft||0,ee=e.containerWidth||0;if(!ee||ee<=0)return{showIcon:!0,showLabel:!0,isSticky:!1,stickyPosition:"none",iconLeft:"0px",isPushedOut:!1,clipPath:"none",isFullyVisible:!0};const X=parseInt(k.value.left)+12,re=Z,se=Z+ee,x=24,I=X-x/2,W=X+x/2,z=e.milestoneId,Ae=I>=re&&W<=se,he=e.otherMilestones||[];if(W<=re+x/2){const fe=he.filter(ce=>ce.id!==z&&ce.stickyPosition==="left"&&ce.isSticky);if(fe.length>0){const ce=parseInt(k.value.left)+12;if(fe.some(Pe=>Pe.originalLeft>ce))return{showIcon:!1,showLabel:!1,isSticky:!1,stickyPosition:"none",iconLeft:"0px",isPushedOut:!0,clipPath:"none",isFullyVisible:!1}}return{showIcon:!0,showLabel:!1,isSticky:!0,stickyPosition:"left",iconLeft:`${re-parseInt(k.value.left)-x/2}px`,isPushedOut:!1,clipPath:"polygon(50% 0%, 100% 0%, 100% 100%, 50% 100%)",isFullyVisible:!1}}if(I>=se-x/2){const fe=he.filter(ce=>ce.id!==z&&ce.stickyPosition==="right"&&ce.isSticky);if(fe.length>0){const ce=parseInt(k.value.left)+12;if(fe.some(Pe=>Pe.originalLeft<ce))return{showIcon:!1,showLabel:!1,isSticky:!1,stickyPosition:"none",iconLeft:"0px",isPushedOut:!0,clipPath:"none",isFullyVisible:!1}}return{showIcon:!0,showLabel:!1,isSticky:!0,stickyPosition:"right",iconLeft:`${se-parseInt(k.value.left)-x/2}px`,isPushedOut:!1,clipPath:"polygon(0% 0%, 50% 0%, 50% 100%, 0% 100%)",isFullyVisible:!1}}return{showIcon:!0,showLabel:!0,isSticky:!1,stickyPosition:"none",iconLeft:"0px",isPushedOut:!1,clipPath:"none",isFullyVisible:Ae}}),L=i.ref(!1),R=i.ref({x:0,y:0}),S=Z=>{var ee;if(O.value.isSticky&&O.value.showIcon&&!O.value.isPushedOut){L.value=!0;const X=!e.milestone||((ee=e.milestone)==null?void 0:ee.icon)==="diamond"?-300:-270,re=O.value.stickyPosition==="left"?10:X;R.value={x:Z.clientX+re,y:Z.clientY-10}}},T=()=>{L.value=!1},G=Z=>{if(!Z)return a("dateNotSet");try{const ee=new Date(Z);if(isNaN(ee.getTime()))return a("dateNotSet");const X=ee.getFullYear(),re=String(ee.getMonth()+1).padStart(2,"0"),se=String(ee.getDate()).padStart(2,"0");return`${X}-${re}-${se}`}catch{return a("dateNotSet")}},N=i.computed(()=>{var X,re;const Z=e.name||((X=e.milestone)==null?void 0:X.name)||a("milestone"),ee=G(e.date||((re=e.milestone)==null?void 0:re.startDate)||"");return`${a("milestone")}:${Z} - ${a("targetDate")}:${ee}`});i.onUnmounted(()=>{o.value=!1,c.value=null,document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",B)});const oe=(Z,ee)=>{const X=new Date(Z.getFullYear(),Z.getMonth(),Z.getDate()),re=new Date(ee.getFullYear(),ee.getMonth(),ee.getDate()),se=X.getTime()-re.getTime(),W=Math.floor(se/(1e3*60*60*24))*960,Ae=Z.getHours()*40,fe=Z.getMinutes()/60*40;return W+Ae+fe},le=(Z,ee,X)=>{var se;let re=0;for(const x of ee)if(X===qe.DAY){const I="days"in x&&x.days?x.days:[];for(let W=0;W<I.length;W++){const z=I[W],Ae=new Date(z.date);if(Ae.getFullYear()===Z.getFullYear()&&Ae.getMonth()===Z.getMonth()&&Ae.getDate()===Z.getDate())return re+W*30+15}re+=I.length*30}else if(X===qe.QUARTER){const I="quarters"in x&&x.quarters?x.quarters:[];for(const W of I){const z=new Date(W.startDate),Ae=new Date(W.endDate);if(Z>=z&&Z<=Ae){const ce=60/Math.ceil((Ae.getTime()-z.getTime())/864e5),Fe=Math.ceil((Z.getTime()-z.getTime())/(1e3*60*60*24));return re+Fe*ce+ce/2}re+=60}}else if(X===qe.YEAR){const I="halfYears"in x&&x.halfYears?x.halfYears:[];for(const W of I){const z=new Date(W.startDate),Ae=new Date(W.endDate);if(Z>=z&&Z<=Ae){const ce=180/Math.ceil((Ae.getTime()-z.getTime())/864e5),Fe=Math.ceil((Z.getTime()-z.getTime())/(1e3*60*60*24));return re+Fe*ce+ce/2}re+=180}}else if(X===qe.WEEK){const I="weeks"in x&&x.weeks?x.weeks:[];for(const W of I){const z=new Date(W.weekStart),Ae=new Date(W.weekEnd);if(Z>=z&&Z<=Ae){const fe=W.subDays||[],ce=60/7;for(let Ze=0;Ze<fe.length;Ze++){const tt=fe[Ze],lt=new Date(tt.date);if(lt.getFullYear()===Z.getFullYear()&<.getMonth()===Z.getMonth()&<.getDate()===Z.getDate())return re+Ze*ce+ce/2}const Fe=Z.getDay(),Pe=Fe===0?6:Fe-1;return re+Pe*ce+ce/2}re+=60}}else if(X===qe.MONTH){if(!("startDate"in x)||!("endDate"in x))continue;const I=new Date(x.startDate),W=new Date(x.endDate);if(Z>=I&&Z<=W){const he=60/("monthData"in x&&((se=x.monthData)==null?void 0:se.dayCount)||30),fe=Z.getDate();return re+(fe-1)*he+he/2}re+=60}return re};return(Z,ee)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createElementVNode("div",{class:i.normalizeClass(["milestone",{dragging:o.value,"milestone-sticky":O.value.isSticky,"milestone-sticky-left":O.value.stickyPosition==="left","milestone-sticky-right":O.value.stickyPosition==="right","milestone-pushed-out":O.value.isPushedOut,dimmed:E.value}]),style:i.normalizeStyle(k.value),title:O.value.isSticky?"":e.name||"里程碑",onClick:i.withModifiers(F,["stop"])},[O.value.showIcon?(i.openBlock(),i.createElementBlock("svg",{key:0,width:24,height:24,viewBox:"0 0 24 24",style:i.normalizeStyle([{position:O.value.isSticky?"relative":"static",left:O.value.isSticky?O.value.iconLeft:"0px",clipPath:O.value.clipPath,zIndex:O.value.isSticky?200:120},{cursor:"pointer"}]),onMouseenter:S,onMouseleave:T,onClick:i.withModifiers(F,["stop"]),onDblclick:i.withModifiers(u,["stop"]),onMousedown:i.withModifiers(v,["stop"])},[M.value==="diamond"?(i.openBlock(),i.createElementBlock("g",mF,[i.createElementVNode("rect",{x:"4",y:"8",width:"15",height:"15",rx:"6",ry:"6",fill:P.value,stroke:j.value,"stroke-width":"2"},null,8,wF)])):M.value==="rocket"?(i.openBlock(),i.createElementBlock("g",BF,ee[0]||(ee[0]=[i.createElementVNode("foreignObject",{x:"0",y:"0",width:"24",height:"24"},[i.createElementVNode("div",{class:"rocket-emoji"},"🚀")],-1)]))):(i.openBlock(),i.createElementBlock("g",yF,[i.createElementVNode("rect",{x:"4",y:"8",width:"15",height:"15",rx:"6",ry:"6",fill:P.value,stroke:j.value,"stroke-width":"2"},null,8,bF)]))],36)):i.createCommentVNode("",!0),e.name&&O.value.showLabel?(i.openBlock(),i.createElementBlock("span",CF,i.toDisplayString(e.name),1)):i.createCommentVNode("",!0)],14,vF),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[L.value&&O.value.isSticky?(i.openBlock(),i.createElementBlock("div",{key:0,class:"milestone-tooltip",style:i.normalizeStyle({left:`${R.value.x}px`,top:`${R.value.y}px`})},[i.createElementVNode("div",EF,i.toDisplayString(N.value),1)],4)):i.createCommentVNode("",!0)]))],64))}}),vg=sn(FF,[["__scopeId","data-v-0427278d"]]);class sy{constructor(){kr(this,"cachedCtx",null);kr(this,"cachedWidth",0);kr(this,"cachedHeight",0);kr(this,"isUniApp",!1);this.isUniApp=typeof window<"u"&&!!window.uni}get isUniAppEnvironment(){return this.isUniApp}getContext(t){const{canvas:e,canvasId:r,width:n,height:a,contextOptions:o}=t;if(!this.cachedCtx||this.cachedWidth!==n||this.cachedHeight!==a){let s=null;if(this.isUniApp&&window.uni)s=window.uni.createCanvasContext(r);else{if(!e)return null;const l=window.devicePixelRatio||1;if(s=e.getContext("2d",o||{alpha:!0}),!s)return null;const c=n*l,u=a*l;e.width=c,e.height=u,s.scale(l,l)}if(!s)return null;this.cachedCtx=s,this.cachedWidth=n,this.cachedHeight=a}return this.cachedCtx}clear(t,e){this.cachedCtx&&this.cachedCtx.clearRect(0,0,t,e)}draw(){var t;this.isUniApp&&((t=this.cachedCtx)!=null&&t.draw)&&this.cachedCtx.draw()}reset(){this.cachedCtx=null,this.cachedWidth=0,this.cachedHeight=0}}const kF=i.defineComponent({__name:"GanttLinks",props:{tasks:{},taskBarPositions:{},width:{},height:{},offsetLeft:{default:0},offsetTop:{default:0},highlightedTaskId:{},highlightedTaskIds:{},hoveredTaskId:{},verticalLines:{default:()=>[]},showVerticalLines:{type:Boolean,default:!0}},setup(A,{expose:t}){const e=A,r=i.ref(null),n=new sy;let a=null,o=!1,s=null;const l=i.ref(document.documentElement.getAttribute("data-theme")==="dark"),c=()=>{l.value=document.documentElement.getAttribute("data-theme")==="dark",p()},u=()=>{const f=n.getContext({canvas:r.value,canvasId:"gantt-link-canvas",width:e.width,height:e.height,contextOptions:{alpha:!0}});if(!f){console.error("❌ Canvas context 获取失败,可能是尺寸超限");return}const v=e.width,w=e.height;if(f.clearRect(0,0,v,w),e.showVerticalLines&&e.verticalLines&&e.verticalLines.length>0){f.save();const R=l.value?"#66b1ff":"#409eff";f.strokeStyle=R,f.lineWidth=1,f.beginPath();for(const S of e.verticalLines){const T=S.left-e.offsetLeft;T>=0&&T<=v&&(f.moveTo(T,0),f.lineTo(T,w))}f.stroke(),f.restore()}const b=new Set;for(const R of e.tasks)b.add(R.id);const B=e.highlightedTaskId!==null,F=e.offsetLeft,E=e.offsetLeft+v,k=e.offsetTop,P=e.offsetTop+w,j=[],M=[],O=[],L=[];for(const R of e.tasks){if(!R.predecessor||!e.taskBarPositions[R.id])continue;const S=la(R.predecessor);for(const T of S){const G=e.taskBarPositions[T],N=e.taskBarPositions[R.id];if(!G||!N||!b.has(T))continue;const oe=e.highlightedTaskId===T,le=e.highlightedTaskId===R.id,Z=e.highlightedTaskIds.has(T),ee=e.highlightedTaskIds.has(R.id),X=Z&&ee,re=e.hoveredTaskId===T,se=e.hoveredTaskId===R.id,x=re||se,I=oe?-8:Z?-5:0,W=le?-8:ee?-5:0,z=G.left+G.width,Ae=G.top+G.height/2+I,he=N.left,fe=N.top+N.height/2+W,ce=Math.min(z,he),Fe=Math.max(z,he),Pe=Math.min(Ae,fe),Ze=Math.max(Ae,fe);if(Fe<F||ce>E||Ze<k||Pe>P)continue;const tt=z-e.offsetLeft,lt=Ae-e.offsetTop,Q=he-e.offsetLeft,De=fe-e.offsetTop,pe=Q-tt,ge=De-lt,Ee=Math.sqrt(pe*pe+ge*ge),xe=G.width,Qe=G.height,Oe=Math.abs(pe)/(Ee+1),Ve=20;let Re=Qe/2+Ve;Oe<.3?Re=Math.max(Qe/2+25,45):Oe<.6?Re=Qe/2+Ve:Re=xe/3+10;let $e=0;if(Math.abs(ge)>0){const Lt=Qe/2+12,Xt=Math.abs(ge)-Qe,Et=Math.min(Xt*.5,100);$e=Math.max(Lt,Et)}else $e=0;const gt=Oe<.3?.4:.8,mt=tt+Re,ht=lt+(ge>0?$e:-$e)*gt,Bt=Q-Re,pt=De-(ge>0?$e:-$e)*gt,zt=Math.atan2(De-pt,Q-Bt),_t={x1:tt,y1:lt,x2:Q,y2:De,c1x:mt,c1y:ht,c2x:Bt,c2y:pt,arrowAngle:zt};X?j.push(_t):x?M.push(_t):B?L.push(_t):O.push(_t)}}if(f.setLineDash([6,4]),j.length>0){f.strokeStyle="#409eff",f.fillStyle="#409eff",f.lineWidth=4,f.globalAlpha=1,f.beginPath();for(const R of j)f.moveTo(R.x1,R.y1),f.bezierCurveTo(R.c1x,R.c1y,R.c2x,R.c2y,R.x2,R.y2);f.stroke();for(const R of j)g(f,R.x2,R.y2,R.arrowAngle)}if(M.length>0){f.strokeStyle="#67c23a",f.fillStyle="#67c23a",f.lineWidth=3,f.globalAlpha=1,f.beginPath();for(const R of M)f.moveTo(R.x1,R.y1),f.bezierCurveTo(R.c1x,R.c1y,R.c2x,R.c2y,R.x2,R.y2);f.stroke();for(const R of M)g(f,R.x2,R.y2,R.arrowAngle)}if(O.length>0){f.strokeStyle="#c0c4cc",f.fillStyle="#c0c4cc",f.lineWidth=2,f.globalAlpha=1,f.beginPath();for(const R of O)f.moveTo(R.x1,R.y1),f.bezierCurveTo(R.c1x,R.c1y,R.c2x,R.c2y,R.x2,R.y2);f.stroke();for(const R of O)g(f,R.x2,R.y2,R.arrowAngle)}if(L.length>0){f.strokeStyle="#c0c4cc",f.fillStyle="#c0c4cc",f.lineWidth=2,f.globalAlpha=.2,f.beginPath();for(const R of L)f.moveTo(R.x1,R.y1),f.bezierCurveTo(R.c1x,R.c1y,R.c2x,R.c2y,R.x2,R.y2);f.stroke();for(const R of L)g(f,R.x2,R.y2,R.arrowAngle);f.globalAlpha=1}n.draw()},g=(f,v,w,b)=>{f.beginPath(),f.moveTo(v,w),f.lineTo(v-8*Math.cos(b)-4*Math.sin(b),w-8*Math.sin(b)+4*Math.cos(b)),f.lineTo(v-8*Math.cos(b)+4*Math.sin(b),w-8*Math.sin(b)-4*Math.cos(b)),f.closePath(),f.fill()},p=()=>{o||(o=!0,a!==null&&cancelAnimationFrame(a),a=requestAnimationFrame(()=>{o=!1,a=null,u()}))};return i.watch([()=>e.taskBarPositions,()=>e.tasks,()=>e.highlightedTaskId,()=>e.highlightedTaskIds,()=>e.hoveredTaskId,()=>e.width,()=>e.height,()=>e.verticalLines,()=>e.showVerticalLines,()=>e.offsetLeft,()=>e.offsetTop],()=>{p()},{deep:!1}),i.onMounted(()=>{s=new MutationObserver(f=>{for(const v of f)if(v.attributeName==="data-theme"){c();break}}),s.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),i.nextTick(()=>{u()})}),i.onUnmounted(()=>{s&&(s.disconnect(),s=null),a!==null&&(cancelAnimationFrame(a),a=null)}),t({redraw:u}),(f,v)=>(i.openBlock(),i.createElementBlock("canvas",{ref_key:"canvasRef",ref:r,"canvas-id":"gantt-link-canvas",class:"gantt-links-canvas",type:"2d",hidpi:!0,style:i.normalizeStyle({position:"absolute",left:`${f.offsetLeft}px`,top:`${f.offsetTop}px`,width:`${f.width}px`,height:`${f.height}px`,zIndex:f.highlightedTaskId!==null?1001:25,pointerEvents:"none"})},null,4))}}),xF=sn(kF,[["__scopeId","data-v-3f872d3f"]]),SF=i.defineComponent({__name:"LinkDragGuide",props:{active:{type:Boolean},width:{},height:{},offsetLeft:{default:0},offsetTop:{default:0}},setup(A,{expose:t}){const e=A,r=i.ref(null),n=new sy,a=()=>n.getContext({canvas:r.value,canvasId:"link-drag-guide-canvas",width:e.width,height:e.height,contextOptions:{alpha:!0,willReadFrequently:!1}}),o=(l,c,u,g,p=!0,f="")=>{const v=a();if(!v){console.error("[LinkDragGuide] initCanvas returned null");return}const w=e.width,b=e.height;v.clearRect(0,0,w,b);const B=l-e.offsetLeft,F=c-e.offsetTop,E=u-e.offsetLeft,k=g-e.offsetTop,P=100;if(!((B>=-P||E>=-P)&&(B<=w+P||E<=w+P)&&(F>=-P||k>=-P)&&(F<=b+P||k<=b+P)))return;v.save();const M=p?"#67c23a":"#f56c6c";v.strokeStyle=M,v.lineWidth=3,v.globalAlpha=.8,v.beginPath(),v.moveTo(B,F),v.lineTo(E,k),v.stroke();const O=Math.atan2(k-F,E-B),L=8,R=4;if(v.fillStyle=M,v.globalAlpha=1,v.beginPath(),v.moveTo(E,k),v.lineTo(E-L*Math.cos(O)-R*Math.sin(O),k-L*Math.sin(O)+R*Math.cos(O)),v.lineTo(E-L*Math.cos(O)+R*Math.sin(O),k-L*Math.sin(O)-R*Math.cos(O)),v.closePath(),v.fill(),!p&&f){const S=(B+E)/2,T=(F+k)/2-10;v.font="12px Arial, sans-serif";const N=v.measureText(f).width,oe=8;v.fillStyle="rgba(0, 0, 0, 0.75)",v.fillRect(S-N/2-oe,T-12,N+oe*2,24),v.fillStyle="#ffffff",v.textAlign="center",v.textBaseline="middle",v.fillText(f,S,T)}v.restore(),n.draw()},s=()=>{n.clear(e.width,e.height)};return i.watch([()=>e.width,()=>e.height],()=>{n.reset()}),i.watch(()=>e.active,l=>{l||n.reset()}),i.onUnmounted(()=>{n.reset()}),t({draw:o,clear:s}),(l,c)=>l.active?(i.openBlock(),i.createElementBlock("canvas",{key:0,ref_key:"canvasRef",ref:r,"canvas-id":"link-drag-guide-canvas",class:"link-drag-guide-canvas",type:"2d",hidpi:!0,style:i.normalizeStyle({position:"absolute",left:`${l.offsetLeft}px`,top:`${l.offsetTop}px`,width:`${l.width}px`,height:`${l.height}px`,zIndex:1002,pointerEvents:"none"})},null,4)):i.createCommentVNode("",!0)}}),TF=sn(SF,[["__scopeId","data-v-06dab396"]]);performance.now();const UF={class:"timeline-header"},DF={class:"timeline-header-row year-row"},QF={class:"year-label"},LF={class:"timeline-header-row half-years-row"},IF={class:"half-year-label"},NF={class:"timeline-header-row year-row"},_F={class:"year-label"},MF={class:"timeline-header-row months-row"},OF={class:"month-label"},RF={class:"timeline-header-row year-row"},HF={class:"year-label"},PF={class:"timeline-header-row quarters-row"},VF={class:"quarter-label"},KF={class:"timeline-header-row date-row"},qF={class:"date-label"},jF={class:"timeline-header-row hours-row"},WF={class:"hour-label"},GF={class:"timeline-header-row year-month-row"},YF={class:"year-month-label"},zF={class:"flag-content"},$F={class:"timeline-header-row days-row"},XF={class:"week-label"},JF={class:"day-label"},ZF=["onMouseenter"],ek=200,tk=8,rk=4,Mu=40,Wv=10,Gv=51,Yv=5,Ul=5e3,Ak=5e3,zv=50,$v=5,nk=i.defineComponent({__name:"Timeline",props:{tasks:{default:()=>[]},milestones:{default:()=>[]},startDate:{},endDate:{},useDefaultDrawer:{type:Boolean,default:!0},useDefaultMilestoneDialog:{type:Boolean,default:!0},onTaskDelete:{type:Function,default:void 0},onTaskUpdate:{type:Function,default:void 0},onMilestoneDelete:{type:Function,default:void 0},onMilestoneUpdate:{type:Function,default:void 0},onMilestoneSave:{type:Function,default:void 0},workingHours:{default:()=>({morning:{start:8,end:11},afternoon:{start:13,end:17}})},taskBarConfig:{default:void 0},allowDragAndResize:{type:Boolean,default:!0}},emits:["timeline-scale-changed","click-task","edit-task","milestone-double-click","start-timer","stop-timer","add-predecessor","add-successor","predecessor-added","successor-added","delete","link-deleted"],setup(A,{expose:t,emit:e}){const r=A,n=e,{formatYearMonth:a,formatMonth:o,getTranslation:s}=ga(),l=H=>s(H),c=(()=>{const H=new Date,te=new Date(H.getFullYear(),H.getMonth()-6,1),K=new Date(H.getFullYear(),H.getMonth()+6+1,0);return{startDate:te,endDate:K}})(),u=()=>c,g=i.computed(()=>r.startDate?new Date(r.startDate):u().startDate),p=i.computed(()=>r.endDate?new Date(r.endDate):u().endDate),f=i.ref({startDate:g.value,endDate:p.value,zoomLevel:1}),v=i.ref(qe.DAY);i.watch([g,p],([H,te])=>{(r.startDate||r.endDate)&&(Rt||(f.value.startDate=H,f.value.endDate=te))});const w=[],b=i.computed(()=>r.tasks??w),B=i.ref(null),F=i.ref(null),E=i.computed(()=>v.value===qe.HOUR?960:v.value===qe.WEEK?60/7:v.value===qe.MONTH?2:v.value===qe.QUARTER?60/90:v.value===qe.YEAR?360/365:30);let k=null;const P=()=>{k=null},j=()=>{if(!b.value||b.value.length===0)return null;const H=[],te=we=>{if(we.startDate&&H.push(new Date(we.startDate)),we.endDate&&H.push(new Date(we.endDate)),we.children&&we.children.length>0)for(const Ue of we.children)te(Ue)};for(const we of b.value)te(we);if(H.length===0)return null;let K=1/0,ue=-1/0;for(const we of H){const Ue=we.getTime();isNaN(Ue)||(Ue<K&&(K=Ue),Ue>ue&&(ue=Ue))}return K===1/0||ue===-1/0?null:{minDate:new Date(K),maxDate:new Date(ue)}},M=()=>k||(k=j(),k),O=()=>{const H=M(),te=je.value||1200,K=40;if(!H){const kt=new Date;kt.setHours(0,0,0,0);const bt=new Date(kt);bt.setDate(bt.getDate()-1);const ut=new Date(kt);return ut.setDate(ut.getDate()+1),ut.setHours(23,59,59,999),{startDate:bt,endDate:ut}}const{minDate:ue,maxDate:we}=H,Ue=new Date(ue);Ue.setHours(0,0,0,0),Ue.setDate(Ue.getDate()-1);const Ge=new Date(we);Ge.setHours(23,59,59,999),Ge.setDate(Ge.getDate()+1);const We=Math.ceil((Ge.getTime()-Ue.getTime())/(1e3*60*60));if(We*K<te){const kt=Math.ceil(te/K),bt=Math.ceil((kt-We)/2),ut=Math.ceil(bt/24);Ue.setDate(Ue.getDate()-ut),Ge.setDate(Ge.getDate()+ut)}return{startDate:Ue,endDate:Ge}},L=()=>{const H=M(),te=je.value||1200,K=30;if(!H){const kt=new Date,bt=Math.max(Math.ceil(te/K),60),ut=new Date(kt);ut.setDate(ut.getDate()-Math.floor(bt/2));const Mt=new Date(kt);return Mt.setDate(Mt.getDate()+Math.ceil(bt/2)),{startDate:ut,endDate:Mt}}const{minDate:ue,maxDate:we}=H;let Ue=new Date(ue);Ue.setDate(Ue.getDate()-30);let Ge=new Date(we);Ge.setDate(Ge.getDate()+30);const We=Math.ceil((Ge.getTime()-Ue.getTime())/(1e3*60*60*24));if(We*K<te){const kt=Math.ceil(te/K),bt=Math.ceil((kt-We)/2),ut=new Date(Ue);ut.setDate(ut.getDate()-bt),Ue=ut;const Mt=new Date(Ge);Mt.setDate(Mt.getDate()+bt),Ge=Mt}return{startDate:Ue,endDate:Ge}},R=()=>{const H=M(),te=je.value||1200,K=60;if(!H){const qr=new Date,Ir=Math.max(Math.ceil(te/K),20),Ur=new Date(qr);Ur.setDate(Ur.getDate()-Math.floor(Ir/2)*7);const jr=new Date(qr);return jr.setDate(jr.getDate()+Math.ceil(Ir/2)*7),{startDate:Ur,endDate:jr}}const{minDate:ue,maxDate:we}=H;function Ue(qr){const Ir=new Date(qr),Ur=Ir.getDay()||7;return Ir.setDate(Ir.getDate()-(Ur-1)),Ir}function Ge(qr,Ir){let Ur=1;for(;Ur<=31;){const jr=new Date(qr,Ir,Ur);if(jr.getMonth()!==Ir)break;const en=Ue(jr);if(en.getMonth()===Ir)return en;Ur++}return new Date(qr,Ir,1)}function We(qr,Ir){const Ur=new Date(qr,Ir+1,0).getDate();for(let jr=Ur;jr>=1;jr--){const en=new Date(qr,Ir,jr),GA=Ue(en);if(GA.getMonth()===Ir)return GA}return new Date(qr,Ir,1)}function ft(qr,Ir){const Ur=[],jr=Ge(qr,Ir),en=We(qr,Ir),GA=new Date(jr);for(;GA<=en;)Ur.push(new Date(GA)),GA.setDate(GA.getDate()+7);return Ur}const kt=Ue(ue),bt=kt.getFullYear(),ut=kt.getMonth(),Mt=ut===0?11:ut-1,Sr=ut===0?bt-1:bt,Tr=ft(Sr,Mt),jA=Ue(we),aA=jA.getFullYear(),fA=jA.getMonth(),wA=fA===11?0:fA+1,Hr=fA===11?aA+1:aA,Cn=ft(Hr,wA);let Xr=[];Xr.push(...Tr);let qn=bt,WA=ut;for(;qn<aA||qn===aA&&WA<=fA;){const qr=ft(qn,WA);Xr.push(...qr),WA++,WA>11&&(WA=0,qn++)}Xr.push(...Cn);let Aa=Xr.length*K;for(;Aa<te;){const qr=Xr[0],Ir=qr.getFullYear(),Ur=qr.getMonth(),jr=Ur===0?11:Ur-1,en=Ur===0?Ir-1:Ir;if(Xr=[...ft(en,jr),...Xr],Aa=Xr.length*K,Aa>=te)break;const Ba=Xr[Xr.length-1],yi=Ba.getFullYear(),Ra=Ba.getMonth(),dA=Ra===11?0:Ra+1,Qs=Ra===11?yi+1:yi,na=ft(Qs,dA);Xr=[...Xr,...na],Aa=Xr.length*K}const Xi=new Date(Xr[0]),Xa=new Date(Xr[Xr.length-1]);return Xa.setDate(Xa.getDate()+6),{startDate:Xi,endDate:Xa}},S=()=>{const H=M();if(!H){const bt=new Date,ut=new Date(bt.getFullYear()-1,0,1),Mt=new Date(bt.getFullYear()+1,11,31);return{startDate:ut,endDate:Mt}}const{minDate:te,maxDate:K}=H,ue=je.value||1200;let we=new Date(te.getFullYear()-1,0,1),Ue=new Date(K.getFullYear()+1,11,31);const We=(Ue.getFullYear()-we.getFullYear())*12+(Ue.getMonth()-we.getMonth()),ft=60;if(We*ft<ue){const bt=Math.ceil(ue/ft),ut=Math.ceil((bt-We)/2),Mt=new Date(we);Mt.setMonth(Mt.getMonth()-ut),we=new Date(Mt.getFullYear(),Mt.getMonth(),1);const Sr=new Date(Ue);Sr.setMonth(Sr.getMonth()+ut),Ue=new Date(Sr.getFullYear(),Sr.getMonth()+1,0)}return{startDate:we,endDate:Ue}},T=()=>{const H=M();if(!H){const We=new Date,ft=je.value||1200;let kt=3;v.value===qe.QUARTER?kt=Math.max(Math.ceil(ft/240)+1,5):v.value===qe.YEAR&&(kt=Math.max(Math.ceil(ft/360)+1,5));const bt=We.getFullYear()-Math.floor(kt/2),ut=bt+kt-1,Mt=new Date(bt,0,1),Sr=new Date(ut,11,31);return{startDate:Mt,endDate:Sr}}const{minDate:te,maxDate:K}=H,ue=je.value||1200;let we=new Date(te.getFullYear()-1,0,1),Ue=new Date(K.getFullYear()+1,11,31);const Ge=Ue.getFullYear()-we.getFullYear()+1;if(v.value===qe.QUARTER){if(Ge*240<ue){const bt=Math.ceil(ue/240),ut=Math.ceil((bt-Ge)/2);we=new Date(we.getFullYear()-ut,0,1),Ue=new Date(Ue.getFullYear()+ut,11,31)}}else if(v.value===qe.YEAR&&Ge*360<ue){const kt=Math.ceil(ue/360),bt=Math.ceil((kt-Ge)/2);we=new Date(we.getFullYear()-bt,0,1),Ue=new Date(Ue.getFullYear()+bt,11,31)}return{startDate:we,endDate:Ue}},G=i.ref(null),N=i.ref(null),oe=i.ref(new Set),le=i.computed(()=>N.value!==null),Z=()=>{N.value=null,oe.value.clear()},ee=H=>{N.value=H,oe.value.clear(),oe.value.add(H);const te=b.value.find(K=>K.id===H);if(te){if(te.predecessor){const K=la(te.predecessor);for(const ue of K)oe.value.add(ue)}for(const K of b.value)K.predecessor&&la(K.predecessor).includes(H)&&oe.value.add(K.id)}},X=i.ref(null),re=i.shallowRef(null),se=i.shallowRef(null),x=i.ref(!1),I=i.ref(""),W=i.ref(null);let z=!1,Ae="";const he=new Map,fe=H=>{X.value=H.type,re.value=H.task,Qe(H.mouseEvent.clientX,H.mouseEvent.clientY),se.value=null,x.value=!1,I.value="",at=null,z=!1,Ae="",pt(),document.addEventListener("mousemove",Q),document.addEventListener("mouseup",De)};let ce=null,Fe=0,Pe=0,Ze=0,tt=0;const lt=()=>{ce=null,Qe(Fe,Pe),gt(Fe,Pe),$r.value&&re.value&&$r.value.draw(Ut(),Lt(),Ze,tt,z,Ae)},Q=H=>{X.value&&(Fe=H.clientX,Pe=H.clientY,ce===null&&(ce=requestAnimationFrame(lt)))},De=()=>{X.value&&(ce!==null&&(cancelAnimationFrame(ce),ce=null),re.value&&Ve({task:re.value,type:X.value}))};let pe=null,ge=0,Ee=!1;const xe=(H,te)=>{if(!Lr.value){Ze=H,tt=te;return}const K=Date.now();(!pe||Ee||K-ge>ek)&&(pe=Lr.value.getBoundingClientRect(),ge=K,Ee=!1),Ze=H-pe.left,tt=te-pe.top},Qe=(H,te)=>{xe(H,te)},Oe=H=>{Fe=H.mouseX,Pe=H.mouseY,ce===null&&(ce=requestAnimationFrame(lt))},Ve=H=>{var te;pe=null,document.removeEventListener("mousemove",Q),document.removeEventListener("mouseup",De),zt(),(te=$r.value)==null||te.clear(),se.value&&x.value&&Bt(H.task,se.value,H.type),X.value=null,re.value=null,se.value=null,x.value=!1},Re=(H,te)=>{pe||(pe=Lr.value.getBoundingClientRect(),ge=Date.now());const K=H-pe.left,ue=te-pe.top,we=(tk+rk)/2,Ue=we+10;for(const Ge in ur.value){const We=ur.value[Ge],ft=Number(Ge);if(ue<We.top-Ue||ue>We.top+We.height+Ue)continue;const kt=We.top+We.height/2,bt=We.left;if(K>=bt-we&&K<=bt+we&&ue>=kt-we&&ue<=kt+we)return{taskId:ft,anchorType:"left"};const ut=We.left+We.width;if(K>=ut-we&&K<=ut+we&&ue>=kt-we&&ue<=kt+we)return{taskId:ft,anchorType:"right"}}return null},$e=(H,te)=>{const K=(at==null?void 0:at.id)??null,ue=(H==null?void 0:H.id)??null;if(K!==ue)if(at=H,H&&re.value){const we=mt(re.value,H,X.value,te);z=we.valid,Ae=we.error||"",x.value=we.valid,se.value=H}else z=!1,Ae="",x.value=!1,se.value=null};let at=null;const gt=(H,te)=>{if(!re.value||!Lr.value)return;const K=Re(H,te),ue=K!==null&&he.get(K.taskId)||null,we=K==null?void 0:K.anchorType;$e(ue,we)},mt=(H,te,K,ue)=>{if(ue){if(K==="predecessor"&&ue!=="right")return{valid:!1,error:"前置任务应连接到右侧触点"};if(K==="successor"&&ue!=="left")return{valid:!1,error:"后置任务应连接到左侧触点"}}if(H.id===te.id)return{valid:!1,error:"不能连接到自己"};if(te.isParent||te.type==="milestone")return{valid:!1,error:"不能连接到父级任务或里程碑"};if(K==="predecessor"){if(ht(te.id,H.id))return{valid:!1,error:"会产生循环依赖"}}else if(ht(H.id,te.id))return{valid:!1,error:"会产生循环依赖"};if(K==="predecessor"){if(H.predecessor&&la(H.predecessor).includes(te.id))return{valid:!1,error:"关系已存在"}}else if(te.predecessor&&la(te.predecessor).includes(H.id))return{valid:!1,error:"关系已存在"};return{valid:!0}},ht=(H,te)=>{const K=new Set,ue=[H];for(;ue.length>0;){const we=ue.shift();if(we===te)return!0;if(K.has(we))continue;K.add(we);const Ue=b.value.find(Ge=>Ge.id===we);if(Ue&&Ue.predecessor){const Ge=la(Ue.predecessor);ue.push(...Ge)}}return!1},Bt=(H,te,K)=>{if(console.log("----> hello:",{mode:K,sourceTask:H,targetTask:te}),K==="predecessor"){const ue=H.predecessor?la(H.predecessor):[];ue.includes(te.id)||(ue.push(te.id),H.predecessor=ue,Ln(H),n("predecessor-added",{targetTask:H,newTask:te}))}else{const ue=te.predecessor?la(te.predecessor):[];ue.includes(H.id)||(ue.push(H.id),te.predecessor=ue,Ln(te),n("successor-added",{targetTask:te,newTask:H}))}},pt=()=>{W.value=window.setInterval(()=>{if(!B.value||!Lr.value)return;const H=B.value,te=In.value;if(!te)return;const K=H.getBoundingClientRect(),ue=80,we=15,Ue=Fe,Ge=Pe;let We=!1;if(Ue<K.left+ue&&H.scrollLeft>0)H.scrollLeft-=we,We=!0;else if(Ue>K.right-ue){const ft=H.scrollWidth-H.clientWidth;H.scrollLeft<ft&&(H.scrollLeft+=we,We=!0)}if(Ge<K.top+ue&&te.scrollTop>0)te.scrollTop-=we,We=!0;else if(Ge>K.bottom-ue){const ft=te.scrollHeight-te.clientHeight;te.scrollTop<ft&&(te.scrollTop+=we,We=!0)}We&&(Ee=!0,gt(Ue,Ge),$r.value&&re.value&&$r.value.draw(Ut(),Lt(),Ze,tt,z,Ae))},30)},zt=()=>{W.value!==null&&(clearInterval(W.value),W.value=null)},_t=()=>{var H;zt(),pe=null,ce!==null&&(cancelAnimationFrame(ce),ce=null),(H=$r.value)==null||H.clear(),document.removeEventListener("mousemove",Q),document.removeEventListener("mouseup",De),X.value=null,re.value=null,se.value=null,x.value=!1},Ut=()=>{if(!re.value)return 0;const H=ur.value[re.value.id];return H?X.value==="predecessor"?H.left:H.left+H.width:0},Lt=()=>{if(!re.value)return 0;const H=ur.value[re.value.id];return H?H.top+H.height/2:0},Xt=i.ref(!1),Et=i.ref(!1),rr=i.ref(!1),St=i.ref(0),ye=i.ref(!1);let He=null;const _e=i.ref(0),je=i.ref(0),wt=i.ref(!0),Qt=i.ref(!0);let Tt=null;const gr=i.ref(0),Or=new Map,Ft=i.ref(!0),hA=i.computed(()=>{if(v.value!==qe.HOUR)return{startHour:0,endHour:0};const H=_e.value,te=je.value;if(Ft.value&&H===0)return{startHour:0,endHour:168};if(Ft.value){const we=new Date,Ue=f.value.startDate,Ge=Math.floor((we.getTime()-Ue.getTime())/(1e3*60*60));return{startHour:Math.max(0,Ge-168),endHour:Ge+168}}const K=Math.floor(H/Mu)-Wv,ue=Math.ceil((H+te)/Mu)+Wv;return{startHour:Math.max(0,K),endHour:Math.max(K+1,ue)}}),lA=i.computed(()=>{const H=gr.value,te=Br.value||600,K=Math.floor(H/Gv)-Yv,ue=Math.ceil((H+te)/Gv)+Yv;return{startIndex:Math.max(0,K),endIndex:Math.min(b.value.length,Math.max(K+1,ue))}}),cA=i.computed(()=>{const{startIndex:H,endIndex:te}=lA.value;return b.value.slice(H,te).map((K,ue)=>({task:K,originalIndex:H+ue}))}),xr=(H,te)=>{let K=null;return((...ue)=>{const we=()=>{K=null,H(...ue)};K&&clearTimeout(K),K=window.setTimeout(we,te)})},fr=xr(()=>{Rr()},200),Cr=xr(()=>{fn()},200),Er=()=>{const H=v.value,te=f.value.startDate.getTime(),K=f.value.endDate.getTime(),ue=`${H}-${te}-${K}`;if(!Or.has(ue)){let we;H===qe.HOUR?we=Ye():H===qe.WEEK?we=st():H===qe.MONTH?we=It():H===qe.QUARTER?we=Ht():H===qe.YEAR?we=Ar():we=Ie(),Or.set(ue,we)}return Or.get(ue)},gA=i.computed(()=>{const H=Er();if(v.value===qe.HOUR&&Array.isArray(H)){const{startHour:te,endHour:K}=hA.value,ue=[],we=new Date(f.value.startDate);we.setHours(0,0,0,0);const Ue=we.getTime(),Ge=1e3*60*60*24;for(const We of H){const ft=new Date(We.year,We.month-1,We.day);ft.setHours(0,0,0,0);const bt=Math.floor((ft.getTime()-Ue)/Ge)*24,ut=Math.max(0,te-bt),Mt=Math.min(We.hours.length,K-bt);ut<Mt&&ue.push({...We,hours:We.hours.slice(ut,Mt),hourOffset:bt+ut,visibleHourStart:ut,_debug:{totalHourOffset:bt,dayStartHour:ut,dayEndHour:Mt,visibleRange:{startHour:te,endHour:K}}})}return ue}return H}),uA=i.computed(()=>{var ue,we;const H=Er();if(!Array.isArray(H))return 0;const te=v.value;if(te===qe.HOUR){let Ue=0;for(const Ge of H)Ue+=Ge.hours.length;return Ue*Mu}if(te===qe.QUARTER){let Ue=0;for(const Ge of H)Ue+=Ge.quarters.length;return Ue*60}if(te===qe.WEEK){let Ue=0;for(const Ge of H)Ue+=((ue=Ge.weeks)==null?void 0:ue.length)||0;return Ue*60}if(te===qe.MONTH)return H.length*60;if(te===qe.YEAR)return H.length*360;let K=0;for(const Ue of H)K+=((we=Ue.days)==null?void 0:we.length)||0;return K*30}),Br=i.ref(0);let tA=null;const pA=i.ref(new Map),Rr=()=>{const H=new Map,te=f.value.startDate.getTime(),K=_e.value,ue=K+je.value;for(const we of b.value)if(we.type==="milestone-group"&&we.children)for(const Ue of we.children){const Ge=new Date(Ue.startDate||"");if(!isNaN(Ge.getTime())){const ft=Math.floor((Ge.getTime()-te)/864e5)*30+15-12,kt=ft-12,bt=ft+12;let ut=!1,Mt="none";bt<=K+12?(ut=!0,Mt="left"):kt>=ue-12&&(ut=!0,Mt="right"),H.set(Ue.id,{left:ft,originalLeft:ft,isSticky:ut,stickyPosition:Mt})}}else if(we.type==="milestone"){const Ue=new Date(we.startDate||"");if(!isNaN(Ue.getTime())){const Ge=(Ue.getTime()-te)/864e5,ft=Math.floor(Ge)*30+15-12,kt=ft-12,bt=ft+12;let ut=!1,Mt="none";bt<=K+12?(ut=!0,Mt="left"):kt>=ue-12&&(ut=!0,Mt="right"),H.set(we.id,{left:ft,originalLeft:ft,isSticky:ut,stickyPosition:Mt})}}pA.value=H},vA=H=>{const te=[];return pA.value.forEach((K,ue)=>{ue!==H&&te.push({id:ue,left:K.left,originalLeft:K.originalLeft,isSticky:K.isSticky,stickyPosition:K.stickyPosition,priority:K.originalLeft})}),te},ln=()=>{Xt.value=!0},Ct=()=>{if(Xt.value=!1,B.value){const H=B.value.clientWidth;Math.abs(H-je.value)>1&&(je.value=H)}wt.value=!0,setTimeout(()=>{wt.value=!1},300)},Be=()=>{wt.value=!0,ur.value={},Kr.value++,Tt&&clearTimeout(Tt),Tt=setTimeout(()=>{wt.value=!1,Tt=null,fn()},300)},$=H=>{Xt.value||JA.value||(G.value=H,window.dispatchEvent(new CustomEvent("timeline-task-hover",{detail:H})))},de=i.computed(()=>{const K=b.value.length*51;return Math.max(K,400,Br.value)}),Ke=H=>{JA.value||(G.value=H.detail)},rt=H=>{const te=H.detail;bn(te)},q=()=>{Gt.value=Te()},me=H=>{le.value||n("milestone-double-click",H)},Ce=H=>{r.onMilestoneSave&&typeof r.onMilestoneSave=="function"&&r.onMilestoneSave(H),window.dispatchEvent(new CustomEvent("milestone-data-updated",{detail:{milestone:H}}))},Te=()=>Er(),ze=()=>{Or.clear()},Ie=()=>{const H=[],te=new Date(f.value.startDate);for(;te<=f.value.endDate;){const K=te.getFullYear(),ue=te.getMonth()+1,we=[],Ue=new Date(K,ue,0).getDate();for(let Ge=1;Ge<=Ue;Ge++){const We=new Date(K,ue-1,Ge),ft=We.getDay(),kt=ft===0||ft===6;we.push({day:Ge,date:We,label:String(Ge).padStart(2,"0"),isToday:Kt(We),isWeekend:kt})}H.push({year:K,month:ue,yearMonthLabel:a(K,ue),startDate:new Date(te),endDate:new Date(K,ue,0),days:we}),te.setMonth(te.getMonth()+1)}return H},Xe=(H,te)=>{if(te===0||te===6)return!1;const K=r.workingHours;if(!K)return!1;if(K.morning){const{start:ue,end:we}=K.morning;if(H>=ue&&H<=we)return!0}if(K.afternoon){const{start:ue,end:we}=K.afternoon;if(H>=ue&&H<=we)return!0}return!1},Ye=()=>{const H=[],te=new Date(f.value.startDate);for(;te<=f.value.endDate;){const K=te.getFullYear(),ue=te.getMonth()+1,we=te.getDate(),Ue=[],Ge=te.getDay();for(let We=0;We<24;We++){const ft=new Date(K,ue-1,we,We);Ue.push({hour:We,label:`${String(We).padStart(2,"0")}:00`,shortLabel:String(We).padStart(2,"0"),date:ft,isToday:Kt(ft)&&We===new Date().getHours(),isWorkingHour:Xe(We,Ge),isWeekend:Ge===0||Ge===6})}H.push({year:K,month:ue,day:we,date:new Date(te),dateLabel:`${K}/${String(ue).padStart(2,"0")}/${String(we).padStart(2,"0")}`,isToday:Kt(te),hours:Ue}),te.setDate(te.getDate()+1)}return H},st=()=>{const H=[],te=new Date(f.value.startDate),K=new Date(f.value.endDate),ue=new Date(te),we=ue.getDay()||7;ue.setDate(ue.getDate()-(we-1));const Ue=new Date(ue);for(;Ue<=K;){const ft=new Date(Ue);ft.setDate(ft.getDate()+6),H.push({weekStart:new Date(Ue),weekEnd:new Date(ft),label:`${Ue.getDate()}`,isToday:qt(Ue,ft),subDays:vt(Ue),belongsToYear:Ue.getFullYear(),belongsToMonth:Ue.getMonth()+1}),Ue.setDate(Ue.getDate()+7)}const Ge=new Map;for(const ft of H){const kt=ft,bt=kt.belongsToYear,ut=kt.belongsToMonth,Mt=`${bt}-${ut}`;Ge.has(Mt)||Ge.set(Mt,{year:bt,month:ut,yearMonthLabel:a(bt,ut),startDate:new Date(bt,ut-1,1),endDate:new Date(bt,ut,0),weeks:[],isWeekView:!0}),Ge.get(Mt).weeks.push(ft)}return Array.from(Ge.values()).sort((ft,kt)=>ft.year!==kt.year?ft.year-kt.year:ft.month-kt.month)},vt=H=>{const te=[];for(let K=0;K<7;K++){const ue=new Date(H);ue.setDate(ue.getDate()+K),te.push({date:new Date(ue),dayOfWeek:ue.getDay()})}return te},qt=(H,te)=>{const K=new Date;return K.setHours(0,0,0,0),K>=H&&K<=te},tr=(H,te)=>{let K=0;for(let ue=0;ue<H;ue++){const we=Gt.value[ue];we&&we.isWeekView&&we.weeks?K+=we.weeks.length*60:we&&we.days&&(K+=we.days.length*30)}return K+=te*60,K},nr=H=>{if(v.value=H,Ft.value=!0,ze(),H===qe.HOUR){const te=O();Rt=!0,f.value={...f.value,startDate:te.startDate,endDate:te.endDate},Rt=!1}else if(H===qe.DAY){const te=L();Rt=!0,f.value={...f.value,startDate:te.startDate,endDate:te.endDate},Rt=!1}if(H===qe.WEEK){const te=R();Rt=!0,f.value={...f.value,startDate:te.startDate,endDate:te.endDate},Rt=!1}if(H===qe.MONTH){const te=S();Rt=!0,f.value={...f.value,startDate:te.startDate,endDate:te.endDate},Rt=!1}if(H===qe.QUARTER){const te=T();Rt=!0,f.value={...f.value,startDate:te.startDate,endDate:te.endDate},Rt=!1}if(H===qe.YEAR){const te=T();Rt=!0,f.value={...f.value,startDate:te.startDate,endDate:te.endDate},Rt=!1}Gt.value=Te(),i.nextTick(()=>{n("timeline-scale-changed",H),window.dispatchEvent(new CustomEvent("timeline-scale-updated")),setTimeout(()=>{window.dispatchEvent(new CustomEvent("timeline-force-recalculate")),setTimeout(()=>{dr()},100)},50)})},Kt=H=>{const te=new Date;return H.getDate()===te.getDate()&&H.getMonth()===te.getMonth()&&H.getFullYear()===te.getFullYear()},Gt=i.shallowRef(Te());let Rt=!1;i.watch(()=>[f.value.startDate,f.value.endDate],()=>{Rt||(ze(),Gt.value=Te())});let pr=!1;i.watch(()=>[Gt.value,f.value.startDate,f.value.endDate],()=>{pr||i.nextTick(()=>{dr(),pr=!0})});const dr=(H=0)=>{wt.value=!0,Qt.value=!0;const te=new Date,K=f.value.startDate,ue=new Date(te.getFullYear(),te.getMonth(),te.getDate());let we;if(v.value===qe.YEAR||v.value===qe.QUARTER){const ut=T();we=new Date(ut.startDate.getFullYear(),ut.startDate.getMonth(),ut.startDate.getDate())}else if(v.value===qe.MONTH){const ut=S();we=new Date(ut.startDate.getFullYear(),ut.startDate.getMonth(),ut.startDate.getDate())}else we=new Date(K.getFullYear(),K.getMonth(),K.getDate());const Ue=ue.getTime()-we.getTime(),Ge=Math.floor(Ue/(1e3*60*60*24));let We;if(v.value===qe.HOUR){const ut=te.getHours(),Mt=te.getMinutes(),Sr=Ge*E.value,Tr=ut*40,jA=Mt/60*40;We=Sr+Tr+jA}else if(v.value===qe.QUARTER){const ut=ue.getFullYear(),Mt=we.getFullYear(),Sr=240,Tr=60;We=(ut-Mt)*Sr;const aA=ue.getMonth()+1;let fA=1;aA>=1&&aA<=3||(aA>=4&&aA<=6?fA=2:aA>=7&&aA<=9?fA=3:fA=4),We+=(fA-1)*Tr;let wA,Hr;fA===1?(wA=new Date(ut,0,1),Hr=new Date(ut,2,31)):fA===2?(wA=new Date(ut,3,1),Hr=new Date(ut,5,30)):fA===3?(wA=new Date(ut,6,1),Hr=new Date(ut,8,30)):(wA=new Date(ut,9,1),Hr=new Date(ut,11,31));const Cn=Math.floor((ue.getTime()-wA.getTime())/(1e3*60*60*24)),Xr=Math.floor((Hr.getTime()-wA.getTime())/(1e3*60*60*24))+1,qn=Cn/Xr*Tr;We+=qn}else if(v.value===qe.MONTH){const ut=ue.getFullYear(),Mt=ue.getMonth()+1,Sr=we.getFullYear(),Tr=we.getMonth()+1,jA=(ut-Sr)*12+(Mt-Tr),aA=60;We=jA*aA;const fA=ue.getDate(),wA=new Date(ut,Mt,0).getDate(),Hr=fA/wA*aA;We+=Hr}else if(v.value===qe.YEAR){const ut=Gt.value;let Mt=0;const Sr=180;let Tr=!1;for(const jA of ut){const aA=jA.halfYears||[];for(const fA of aA){const wA=new Date(fA.startDate),Hr=new Date(fA.endDate);if(wA.setHours(0,0,0,0),Hr.setHours(0,0,0,0),ue<wA){Tr=!0;break}if(ue>=wA&&ue<=Hr){const Cn=Hr.getTime()-wA.getTime(),qn=(ue.getTime()-wA.getTime())/Cn;Mt+=qn*Sr,Tr=!0;break}Mt+=Sr}if(Tr)break}We=Mt}else We=Ge*E.value;const ft=B.value;if(!ft){H<10&&setTimeout(()=>dr(H+1),60);return}const kt=ft.clientWidth;if(kt===0&&H<10){setTimeout(()=>dr(H+1),60);return}const bt=We-kt/2+15;typeof ft.scrollTo=="function"?ft.scrollTo({left:Math.max(0,bt),behavior:"smooth"}):ft.scrollLeft=Math.max(0,bt),setTimeout(()=>{Qt.value=!1,v.value===qe.HOUR&&(Ft.value=!1),setTimeout(()=>{wt.value=!1},300)},1500)},yr=i.computed(()=>{if(v.value!==qe.YEAR)return-1;const H=new Date;H.setHours(0,0,0,0);const te=Gt.value;if(!te||te.length===0)return-1;let K=0;const ue=180;for(const we of te){const Ue=we.halfYears||[];for(const Ge of Ue){const We=new Date(Ge.startDate),ft=new Date(Ge.endDate);if(We.setHours(0,0,0,0),ft.setHours(0,0,0,0),H<We)return K;if(H>=We&&H<=ft){const kt=ft.getTime()-We.getTime(),ut=(H.getTime()-We.getTime())/kt;return K+ut*ue}K+=ue}}return K}),$t=i.computed(()=>{if(v.value!==qe.YEAR)return!1;const H=new Date,te=new Date(H.getFullYear(),H.getMonth(),H.getDate()),K=T(),ue=K.startDate,we=K.endDate;return te>=ue&&te<=we}),RA=()=>{if(b.value.length===0){cn();return}const H=[];for(const bt of b.value)bt.startDate&&H.push(new Date(bt.startDate));if(H.length===0){cn();return}let te=1/0;for(const bt of H){const ut=bt.getTime();ut<te&&(te=ut)}const K=new Date(te),ue=K.getFullYear(),we=K.getMonth(),Ue=K.getDate();let Ge=0;for(let bt=0;bt<we;bt++)Ge+=new Date(ue,bt+1,0).getDate();Ge+=Ue;const We=F.value,ft=We==null?void 0:We.clientWidth,kt=(Ge-1)*30-(ft?ft/2:200);B.value&&(B.value.scrollLeft=Math.max(0,kt))},cn=()=>{const H=new Date,te=f.value.startDate,K=new Date(H.getFullYear(),H.getMonth(),H.getDate()),ue=new Date(te.getFullYear(),te.getMonth(),te.getDate()),we=K.getTime()-ue.getTime(),Ue=Math.floor(we/(1e3*60*60*24));if(Ue<0||K>f.value.endDate)return;const Ge=Ue*30,We=B.value;if(!We)return;const ft=We.clientWidth,kt=Ge-ft/2+15;We.scrollTo({left:Math.max(0,kt),behavior:"smooth"}),setTimeout(()=>{const bt=document.querySelectorAll(".day-column.today");for(const ut of bt)ut.classList.add("today-highlight"),setTimeout(()=>{ut.classList.remove("today-highlight")},2e3)},500)},Ln=H=>{window.dispatchEvent(new CustomEvent("task-updated",{detail:H}))},bn=H=>{le.value||n("edit-task",H)},Qr=(H,te)=>{le.value||n("click-task",H,te)},ur=i.shallowRef({}),Kr=i.ref(0),Lr=i.ref(null),$r=i.ref(null),XA=i.ref(0),ea=i.ref(0),Vn=i.ref(0),un=i.ref(0),ta=i.ref(0),kA=i.ref(0);function fn(){if(Lr.value){const H=Lr.value.offsetWidth,te=de.value,K=_e.value,ue=gr.value;Vn.value=Ul;const we=Ul/3;let Ue=Math.max(0,K-we);if(H<=Ul)Ue=0;else{const kt=H-Ul;Ue=Math.min(Ue,kt)}ta.value=Ue;const Ge=Math.min(te,Ak);un.value=Ge,XA.value=Vn.value,ea.value=Ge;const We=Ge/3;let ft=Math.max(0,ue-We);if(te<=Ge)ft=0;else{const kt=te-Ge;ft=Math.min(ft,kt)}kA.value=ft}}function mA(H){if(!Lr.value)return;const te=Lr.value.getBoundingClientRect();ur.value={...ur.value,[H.id]:{left:H.left-te.left,top:H.top-te.top,width:H.width,height:H.height}},setTimeout(()=>{fn()},200)}const dn=H=>{window.dispatchEvent(new CustomEvent("taskbar-drag-end",{detail:H}))},Cs=H=>{window.dispatchEvent(new CustomEvent("taskbar-resize-end",{detail:H}))},Zt=H=>{window.dispatchEvent(new CustomEvent("context-menu",{detail:H}))},so=H=>{if(or.value){wt.value=!0;const te=or.value.scrollWidth-or.value.clientWidth,K=Math.max(0,Math.min(H,te));or.value.scrollTo({left:K,behavior:"smooth"}),setTimeout(()=>{wt.value=!1},1e3)}},Es=H=>{window.dispatchEvent(new CustomEvent("milestone-drag-end",{detail:H}))};i.onMounted(()=>{i.nextTick(()=>{setTimeout(()=>{dr()},60)}),window.addEventListener("task-row-double-click",rt),window.addEventListener("task-list-hover",Ke),window.addEventListener("task-list-vertical-scroll",Fs),window.addEventListener("locale-changed",q),window.addEventListener("splitter-drag-start",ln),window.addEventListener("splitter-drag-end",Ct),window.addEventListener("timeline-container-resized",Be),window.addEventListener("milestone-click-locate",it),window.addEventListener("drag-boundary-check",Bi),window.addEventListener("taskbar-highlighted",$i),i.nextTick(()=>{const H=document.querySelector(".timeline-body"),te=document.querySelector(".timeline"),K=document.querySelector(".gantt-panel-right");if(In.value=H,B.value=te,F.value=K,H&&(Br.value=H.clientHeight,tA=new ResizeObserver(ue=>{for(const we of ue)Br.value=we.contentRect.height}),tA.observe(H)),te){_e.value=te.scrollLeft,je.value=te.clientWidth;const ue=new ResizeObserver(we=>{for(const Ue of we){const Ge=Ue.contentRect.width;Math.abs(Ge-je.value)>1&&(je.value=Ge,wt.value=!0,Tt&&clearTimeout(Tt),Tt=setTimeout(()=>{wt.value=!1,Tt=null},300))}});ue.observe(te),tA||(tA=ue)}}),setTimeout(()=>{dr(),fn()},200),window.addEventListener("resize",fn)});const Fs=H=>{const{scrollTop:te}=H.detail;gr.value=te,Cr(),In.value&&Math.abs(In.value.scrollTop-te)>1&&(In.value.scrollTop=te)},va=H=>{const te=H.target;if(!te)return;const K=te.scrollTop;gr.value=K,Ee=!0,Cr(),!JA.value&&K>=0&&window.dispatchEvent(new CustomEvent("timeline-vertical-scroll",{detail:{scrollTop:K}}))};i.watch(()=>b.value.length,()=>{i.nextTick(()=>{fn()})},{immediate:!0}),i.watch(b,H=>{he.clear();const te=K=>{he.set(K.id,K),K.children&&K.children.length>0&&K.children.forEach(te)};H.forEach(te)},{immediate:!0});const JA=i.ref(!1),zi=i.ref(0),ks=i.ref(0),_a=i.ref(0),pi=i.ref(0),or=i.ref(null),In=i.ref(null);let ZA=null;const vi=i.ref(!1);let Ma=null;const $i=()=>{const H=te=>{var K;te.buttons===1&&(JA.value=!0,zi.value=te.pageX,_a.value=((K=or.value)==null?void 0:K.scrollLeft)||0,or.value&&(or.value.style.cursor="grabbing",or.value.style.userSelect="none"),document.addEventListener("mousemove",Nn),document.addEventListener("mouseup",Oa)),document.removeEventListener("mousemove",H)};document.addEventListener("mousemove",H),setTimeout(()=>{document.removeEventListener("mousemove",H)},5e3)},xs=H=>{var we,Ue;const te=H.target,K=te.closest(".timeline-header"),ue=te.closest(".timeline-body");if(!(!K&&!ue)){if(ue){const Ge=te.closest(".task-bar");if(Ge){const We=Ge.classList.contains("highlighted"),ft=Ge.classList.contains("primary-highlight");if(!We&&!ft)return}else if([".milestone","button","input","select","textarea",".custom-task-content",".progress-bar",".task-name",".task-controls"].some(kt=>te.closest(kt)))return}JA.value=!0,zi.value=H.pageX,ks.value=H.pageY,_a.value=((we=or.value)==null?void 0:we.scrollLeft)||0,!In.value&&or.value&&(In.value=or.value.querySelector(".timeline-body")),pi.value=((Ue=In.value)==null?void 0:Ue.scrollTop)||0,or.value&&(or.value.style.cursor="grabbing",or.value.style.userSelect="none"),H.preventDefault(),document.addEventListener("mousemove",Nn),document.addEventListener("mouseup",Oa)}},Nn=H=>{!JA.value||!or.value||(H.preventDefault(),ZA!==null&&cancelAnimationFrame(ZA),ZA=requestAnimationFrame(()=>{if(!or.value)return;const te=H.pageX,K=H.pageY,ue=(te-zi.value)*1.5,we=(K-ks.value)*1.5;if(or.value.scrollLeft=_a.value-ue,In.value){const Ue=pi.value-we;In.value.scrollTop=Ue;const Ge=document.querySelector(".task-list-body");Ge&&(Ge.scrollTop=Ue)}ZA=null}))},Oa=()=>{JA.value=!1,ZA!==null&&(cancelAnimationFrame(ZA),ZA=null),or.value&&(or.value.style.cursor="grab",or.value.style.userSelect="auto"),G.value=null,document.removeEventListener("mousemove",Nn),document.removeEventListener("mouseup",Oa)},mi=H=>{var Ge;const te=H.target;if(!te)return;const K=te.scrollLeft;if(_e.value=K,Ee=!0,je.value===0&&(je.value=te.clientWidth),Ft.value&&K>0&&(Ft.value=!1),Cr(),v.value===qe.HOUR){ye.value=!0,He&&clearTimeout(He),He=setTimeout(()=>{ye.value=!1},200);return}const ue=te.scrollWidth,we=te.clientWidth,Ue=ue-we;St.value=Ue>0?K/Ue:0,Et.value=K>20,rr.value=K<Ue-20,ye.value=!0,(Ge=te.classList)==null||Ge.add("scrolling"),fr(),He&&clearTimeout(He),He=setTimeout(()=>{var We;ye.value=!1,(We=te.classList)==null||We.remove("scrolling")},500)},wi=H=>{if(vi.value||!or.value)return;vi.value=!0;const te=()=>{if(!or.value||!vi.value)return;const K=or.value.scrollLeft,ue=or.value.scrollWidth-or.value.clientWidth;let we;if(H==="left"?we=Math.max(0,K-$v):we=Math.min(ue,K+$v),we===K){ra();return}or.value.scrollLeft=we,window.dispatchEvent(new CustomEvent("timeline-auto-scroll",{detail:{scrollDelta:we-K}})),Ma=window.setTimeout(te,16)};te()},ra=()=>{vi.value=!1,Ma&&(clearTimeout(Ma),Ma=null)},Bi=H=>{const{mouseX:te,isDragging:K}=H.detail;if(!K||!or.value){ra();return}const ue=or.value.getBoundingClientRect(),we=te-ue.left;we<=zv&&or.value.scrollLeft>0?wi("left"):we>=ue.width-zv&&or.value.scrollLeft<or.value.scrollWidth-or.value.clientWidth?wi("right"):ra()};i.onUnmounted(()=>{ra(),_t(),window.removeEventListener("task-row-double-click",rt),window.removeEventListener("task-list-hover",Ke),window.removeEventListener("task-list-vertical-scroll",Fs),window.removeEventListener("locale-changed",q),window.removeEventListener("splitter-drag-start",ln),window.removeEventListener("splitter-drag-end",Ct),window.removeEventListener("timeline-container-resized",Be),window.removeEventListener("milestone-click-locate",it),window.removeEventListener("drag-boundary-check",Bi),tA&&(tA.disconnect(),tA=null),window.removeEventListener("resize",fn),document.removeEventListener("mousemove",Nn),document.removeEventListener("mouseup",Oa)});const Ss=(H,te)=>{n("delete",H,te)},Ts=H=>{const te=b.value.find(Ue=>Ue.id===H.targetTaskId);if(!te||!te.predecessor)return;const ue=la(te.predecessor).filter(Ue=>Ue!==H.sourceTaskId),we={...te,predecessor:ue.length>0?ue:void 0};n("link-deleted",{sourceTaskId:H.sourceTaskId,targetTaskId:H.targetTaskId,updatedTask:we}),Ln(we),ze()},ma=i.computed(()=>{if(v.value!==qe.MONTH)return{};const H={},te=Gt.value;for(const K of te){const we=K.year;H[we]||(H[we]=[]),H[we].push(K)}return H}),wa=i.computed(()=>{if(v.value!==qe.WEEK)return[];const H=[],te=Gt.value;for(let K=0;K<te.length;K++){const ue=te[K];if(!(!ue.isWeekView||!ue.weeks))for(let we=0;we<ue.weeks.length;we++){const Ge=ue.weeks[we].subDays||[];for(let We=0;We<Ge.length;We++){const ft=Ge[We];ft.date&&ft.date.getDate()===1&&H.push({left:tr(K,we)+We*(60/7),date:ft.date.getDate()})}}}return H}),Us=i.computed(()=>{if(v.value!==qe.WEEK)return[];const H=[],te=Gt.value;for(let K=0;K<te.length;K++){const ue=te[K];if(!(!ue.isWeekView||!ue.weeks))for(let we=0;we<ue.weeks.length;we++){const Ge=ue.weeks[we].subDays||[];for(let We=0;We<Ge.length;We++){const ft=Ge[We];ft.date&&ft.date.getDate()===1&&H.push({left:tr(K,we)+We*(60/7)})}}}return H}),Kn=i.computed(()=>{if(v.value!==qe.YEAR)return[];try{const H=Ar();return Array.isArray(H)?H:[]}catch{return[]}});t({scrollToTasks:RA,scrollToToday:cn,scrollToTodayCenter:dr,timelineConfig:f,updateTimeScale:nr,highlightedTaskId:N,clearHighlight:Z});const Ds=H=>{n("start-timer",H)},m=H=>{n("stop-timer",H)},U=H=>{const te=H.startDate||H.endDate||"";return{...H,type:"milestone",startDate:te,endDate:H.startDate||H.endDate}};i.watch(()=>b.value.length,()=>{P(),Rr()},{immediate:!0});let ne=null;const ve=(H=50)=>{ne&&clearTimeout(ne),ne=setTimeout(()=>{Se(),ne=null},H)},Se=()=>{let H=null;v.value===qe.HOUR?H=O():v.value===qe.DAY?H=L():v.value===qe.WEEK?H=R():v.value===qe.MONTH?H=S():(v.value===qe.QUARTER||v.value===qe.YEAR)&&(H=T()),H&&(ze(),Rt=!0,f.value.startDate=H.startDate,f.value.endDate=H.endDate,Rt=!1,Gt.value=Te())};i.watch(()=>{var H;return(H=b.value)==null?void 0:H.length},(H,te)=>{H!==te&&P(),te===0&&H>0&&ve(50)}),i.watch(je,(H,te)=>{Xt.value||(!te||te===0||Math.abs(H-te)>50)&&H>0&&ve(100)},{immediate:!0});let et=null;i.watch([Gt,je],()=>{Xt.value||(et&&clearTimeout(et),et=setTimeout(()=>{ur.value={},Kr.value++,i.nextTick(()=>{setTimeout(()=>{fn()},200)}),et=null},100))}),i.watch(()=>b.value,H=>{P();const te=new Set;for(const ue of H)te.add(ue.id);const K={};for(const ue in ur.value){const we=parseInt(ue);te.has(we)&&(K[we]=ur.value[we])}ur.value=K},{deep:!0});const it=H=>{const{scrollLeft:te,smooth:K}=H.detail,ue=document.querySelector(".timeline"),we=document.querySelector(".timeline-body");let Ue=null;if(ue&&ue.scrollWidth>ue.clientWidth?Ue=ue:we&&we.scrollWidth>we.clientWidth&&(Ue=we),Ue){const Ge=Ue.scrollWidth-Ue.clientWidth,We=Math.min(Math.max(0,te),Ge);K?Ue.scrollTo({left:We,behavior:"smooth"}):Ue.scrollLeft=We}},It=()=>{let H,te;if(v.value===qe.MONTH){const Ge=S();H=Ge.startDate,te=Ge.endDate}else H=new Date(f.value.startDate),te=new Date(f.value.endDate);const K={},ue=new Date(H);for(ue.setDate(1);ue<=te;){const Ge=ue.getFullYear(),We=ue.getMonth()+1,kt=new Date(Ge,We,0).getDate(),bt=new Date,ut=Ge===bt.getFullYear()&&We===bt.getMonth()+1;K[Ge]||(K[Ge]={year:Ge,yearLabel:`${Ge}年`,months:[]}),K[Ge].months.push({year:Ge,month:We,monthLabel:o(We),startDate:new Date(Ge,We-1,1),endDate:new Date(Ge,We,0),isToday:ut,dayCount:kt}),ue.setMonth(ue.getMonth()+1)}const we=[];let Ue=0;for(const Ge of Object.values(K))for(const We of Ge.months){const ft=[];for(let Mt=1;Mt<=We.dayCount;Mt++){const Sr=new Date(We.year,We.month-1,Mt);ft.push({day:Mt,date:new Date(Sr),dayOfWeek:Sr.getDay(),isToday:Kt(Sr),isWeekend:Sr.getDay()===0||Sr.getDay()===6})}const kt=60,bt=Ue,ut=Ue+kt;we.push({year:We.year,month:We.month,yearMonthLabel:a(We.year,We.month),startDate:We.startDate,endDate:We.endDate,isMonthView:!0,monthData:{monthLabel:We.monthLabel,isToday:We.isToday,dayCount:We.dayCount},subDays:ft,days:ft.map(Mt=>({day:Mt.day,date:Mt.date,label:String(Mt.day).padStart(2,"0"),isToday:Mt.isToday,isWeekend:Mt.isWeekend})),_debugInfo:{monthStartPosition:bt,monthEndPosition:ut,monthWidth:kt}}),Ue+=kt}return we},Ht=()=>{const H=f.value.startDate,te=f.value.endDate,K=[],ue=H.getFullYear(),we=te.getFullYear();for(let Ue=ue;Ue<=we;Ue++){const Ge=[];for(let We=1;We<=4;We++){const ft=(We-1)*3,kt=new Date(Ue,ft,1),bt=ft+2,ut=new Date(Ue,bt+1,0);Ge.push({quarter:We,label:`Q${We}`,fullLabel:`${Ue}年第${We}季度`,startDate:kt,endDate:ut,isToday:Jt(kt,ut),year:Ue})}K.push({year:Ue,yearLabel:String(Ue),startDate:new Date(Ue,0,1),endDate:new Date(Ue,11,31),quarters:Ge})}return K},Jt=(H,te)=>{const K=new Date;return K.setHours(0,0,0,0),K>=H&&K<=te},Ar=()=>{const H=f.value.startDate,te=f.value.endDate,K=[],ue=H.getFullYear(),we=te.getFullYear();for(let Ue=ue;Ue<=we;Ue++){const Ge=[{label:l("halfYearFirst"),startDate:new Date(Ue,0,1),endDate:new Date(Ue,6,0),width:180},{label:l("halfYearSecond"),startDate:new Date(Ue,6,1),endDate:new Date(Ue,11,31),width:180}];K.push({year:Ue,startDate:new Date(Ue,0,1),endDate:new Date(Ue,11,31),halfYears:Ge,width:360})}return K},mr=H=>{n("add-predecessor",H)},rA=H=>{n("add-successor",H)};return(H,te)=>(i.openBlock(),i.createElementBlock("div",{ref_key:"timelineContainer",ref:or,class:"timeline",onMousedown:xs,onScroll:mi},[i.createElementVNode("div",UF,[v.value===i.unref(qe).YEAR&&Kn.value&&Kn.value.length>0?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createElementVNode("div",DF,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(Kn.value,K=>(i.openBlock(),i.createElementBlock("div",{key:`year-${K.year}`,class:"timeline-year",style:{width:"360px"}},[i.createElementVNode("div",QF,i.toDisplayString(K.year),1)]))),128))]),i.createElementVNode("div",LF,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(Kn.value,K=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:`halfyear-${K.year}`},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(K.halfYears||[],ue=>(i.openBlock(),i.createElementBlock("div",{key:`halfyear-${K.year}-${ue.label}`,class:"timeline-half-year-item",style:{width:"180px"}},[i.createElementVNode("div",IF,i.toDisplayString(ue.label),1)]))),128))],64))),128))])],64)):v.value===i.unref(qe).MONTH?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createElementVNode("div",NF,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(ma.value,(K,ue)=>(i.openBlock(),i.createElementBlock("div",{key:`year-${ue}`,class:"timeline-year",style:{width:"720px"}},[i.createElementVNode("div",_F,i.toDisplayString(ue),1)]))),128))]),i.createElementVNode("div",MF,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(Gt.value,K=>{var ue,we;return i.openBlock(),i.createElementBlock("div",{key:`month-${K.year}-${K.month}`,class:i.normalizeClass(["timeline-month-item",{today:(ue=K.monthData)==null?void 0:ue.isToday}]),style:{width:"59px"}},[i.createElementVNode("div",OF,i.toDisplayString((we=K.monthData)==null?void 0:we.monthLabel),1)],2)}),128))])],64)):v.value===i.unref(qe).QUARTER?(i.openBlock(),i.createElementBlock(i.Fragment,{key:2},[i.createElementVNode("div",RF,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(Gt.value,K=>(i.openBlock(),i.createElementBlock("div",{key:`year-${K.year}`,class:"timeline-year",style:{width:"240px"}},[i.createElementVNode("div",HF,i.toDisplayString(K.yearLabel),1)]))),128))]),i.createElementVNode("div",PF,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(Gt.value,K=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:`quarters-${K.year}`},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(K.quarters,ue=>(i.openBlock(),i.createElementBlock("div",{key:`quarter-${K.year}-${ue.quarter}`,class:i.normalizeClass(["timeline-quarter-item",{today:ue.isToday}]),style:{width:"60px"}},[i.createElementVNode("div",VF,i.toDisplayString(ue.label),1)],2))),128))],64))),128))])],64)):v.value===i.unref(qe).HOUR?(i.openBlock(),i.createElementBlock("div",{key:3,class:"hour-header-container",style:i.normalizeStyle({width:`${uA.value}px`})},[i.createElementVNode("div",KF,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(gA.value,K=>(i.openBlock(),i.createElementBlock("div",{key:`date-${K.year}-${K.month}-${K.day}`,class:"timeline-day-item",style:i.normalizeStyle({position:"absolute",width:`${K.hours.length*40}px`,left:`${(K.hourOffset||0)*40}px`})},[i.createElementVNode("div",qF,i.toDisplayString(K.dateLabel),1)],4))),128))]),i.createElementVNode("div",jF,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(gA.value,K=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:`hours-${K.year}-${K.month}-${K.day}`},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(K.hours,(ue,we)=>(i.openBlock(),i.createElementBlock("div",{key:`hour-${K.year}-${K.month}-${K.day}-${ue.hour}`,class:i.normalizeClass(["timeline-hour-item",{today:ue.isToday,"non-working-hour":!ue.isWorkingHour}]),style:i.normalizeStyle({position:"absolute",width:"40px",left:`${(K.hourOffset+we)*40}px`})},[i.createElementVNode("div",WF,i.toDisplayString(ue.shortLabel),1)],6))),128))],64))),128))])],4)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:4},[i.createElementVNode("div",GF,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(Gt.value,K=>(i.openBlock(),i.createElementBlock("div",{key:`year-month-${K.year}-${K.month}`,class:"timeline-month",style:i.normalizeStyle({width:K.isWeekView?`${(K.weeks||[]).length*60}px`:`${(K.days||[]).length*30}px`})},[i.createElementVNode("div",YF,i.toDisplayString(K.yearMonthLabel),1)],4))),128)),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(wa.value,(K,ue)=>(i.openBlock(),i.createElementBlock("div",{key:`flag-${ue}`,class:"month-first-flag",style:i.normalizeStyle({left:`${K.left}px`,transform:"translateX(-50%)"})},[te[1]||(te[1]=i.createElementVNode("div",{class:"flag-pole"},null,-1)),i.createElementVNode("div",zF,i.toDisplayString(K.date),1)],4))),128))]),i.createElementVNode("div",$F,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(Gt.value,K=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:`timeline-${K.year}-${K.month}`},[K.isWeekView&&K.weeks?(i.openBlock(),i.createElementBlock("div",{key:0,class:"timeline-month-weeks",style:i.normalizeStyle({width:`${(K.weeks||[]).length*60}px`})},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(K.weeks||[],ue=>(i.openBlock(),i.createElementBlock("div",{key:`week-${K.year}-${K.month}-${ue.label}`,class:i.normalizeClass(["timeline-week",{today:ue.isToday}])},[i.createElementVNode("div",XF,i.toDisplayString(ue.label),1),te[2]||(te[2]=i.createElementVNode("div",{class:"week-sub-days"},null,-1))],2))),128))],4)):(i.openBlock(),i.createElementBlock("div",{key:1,class:"timeline-month-days",style:i.normalizeStyle({width:`${K.days.length*30}px`})},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(K.days,ue=>(i.openBlock(),i.createElementBlock("div",{key:`day-${K.year}-${K.month}-${ue.day}`,class:i.normalizeClass(["timeline-day",{today:ue.isToday,weekend:ue.isWeekend&&!ue.isToday}])},[i.createElementVNode("div",JF,i.toDisplayString(ue.label),1)],2))),128))],4))],64))),128))])],64))]),i.createElementVNode("div",{class:"timeline-body",onScroll:va},[i.createElementVNode("div",{ref_key:"bodyContentRef",ref:Lr,class:"timeline-body-content"},[i.createVNode(xF,{tasks:b.value,"task-bar-positions":ur.value,width:Vn.value,height:un.value,"offset-left":ta.value,"offset-top":kA.value,"highlighted-task-id":N.value,"highlighted-task-ids":oe.value,"hovered-task-id":G.value,"vertical-lines":Us.value,"show-vertical-lines":v.value===i.unref(qe).WEEK},null,8,["tasks","task-bar-positions","width","height","offset-left","offset-top","highlighted-task-id","highlighted-task-ids","hovered-task-id","vertical-lines","show-vertical-lines"]),i.createVNode(TF,{ref_key:"linkDragGuideRef",ref:$r,active:!!X.value&&!!re.value,width:Vn.value,height:un.value,"offset-left":ta.value,"offset-top":kA.value},null,8,["active","width","height","offset-left","offset-top"]),$t.value&&yr.value>=0?(i.openBlock(),i.createElementBlock("div",{key:0,class:"today-line-year-view",style:i.normalizeStyle({left:`${yr.value}px`,height:`${de.value}px`})},null,4)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:"day-columns",style:i.normalizeStyle({height:`${de.value}px`})},[v.value===i.unref(qe).HOUR?(i.openBlock(),i.createElementBlock("div",{key:0,class:"hour-columns-container",style:i.normalizeStyle({width:`${uA.value}px`,height:`${de.value}px`,position:"relative"})},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(gA.value,K=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:`day-col-${K.year}-${K.month}-${K.day}`},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(K.hours,(ue,we)=>(i.openBlock(),i.createElementBlock("div",{key:`hour-col-${K.year}-${K.month}-${K.day}-${ue.hour}`,class:i.normalizeClass(["hour-column",{today:ue.isToday,weekend:ue.isWeekend,"working-hour":ue.isWorkingHour,"rest-hour":!ue.isWorkingHour&&!ue.isWeekend}]),style:i.normalizeStyle({position:"absolute",width:"40px",height:`${de.value}px`,left:`${(K.hourOffset+we)*40}px`})},te[3]||(te[3]=[i.createElementVNode("div",{class:"quarter-hour-lines"},[i.createElementVNode("div",{class:"quarter-line",style:{left:"10px"}}),i.createElementVNode("div",{class:"quarter-line",style:{left:"20px"}}),i.createElementVNode("div",{class:"quarter-line",style:{left:"30px"}})],-1)]),6))),128))],64))),128))],4)):i.createCommentVNode("",!0),v.value===i.unref(qe).YEAR?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:1},i.renderList(Kn.value,K=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:`year-col-${K.year}`},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(K.halfYears||[],ue=>(i.openBlock(),i.createElementBlock("div",{key:`halfyear-col-${K.year}-${ue.label}`,class:"half-year-column",style:i.normalizeStyle({width:"180px",height:`${de.value}px`})},null,4))),128))],64))),128)):i.createCommentVNode("",!0),v.value===i.unref(qe).QUARTER?(i.openBlock(),i.createElementBlock("div",{key:2,class:"quarter-columns-container",style:i.normalizeStyle({width:`${uA.value}px`,height:`${de.value}px`,position:"relative"})},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(Gt.value,(K,ue)=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:`quarter-col-${K.year}`},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(K.quarters,(we,Ue)=>(i.openBlock(),i.createElementBlock("div",{key:`quarter-col-${K.year}-${we.quarter}`,class:i.normalizeClass(["quarter-column",{today:we.isToday}]),style:i.normalizeStyle({position:"absolute",width:"60px",height:`${de.value}px`,left:`${ue*240+Ue*60}px`})},null,6))),128))],64))),128))],4)):v.value!==i.unref(qe).HOUR&&v.value!==i.unref(qe).YEAR&&v.value!==i.unref(qe).QUARTER?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:3},i.renderList(Gt.value,K=>{var ue;return i.openBlock(),i.createElementBlock(i.Fragment,{key:`day-col-${K.year}-${K.month}`},[K.isMonthView?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["month-column",{today:(ue=K.monthData)==null?void 0:ue.isToday}]),style:i.normalizeStyle({width:"59px",height:`${de.value}px`})},null,6)):K.isWeekView&&K.weeks?(i.openBlock(),i.createElementBlock("div",{key:1,class:"month-week-columns",style:i.normalizeStyle({width:`${(K.weeks||[]).length*60}px`,height:`${de.value}px`})},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(K.weeks||[],we=>(i.openBlock(),i.createElementBlock("div",{key:`week-col-${K.year}-${K.month}-${we.label}`,class:i.normalizeClass(["week-column",{today:we.isToday}]),style:i.normalizeStyle({height:`${de.value}px`,width:"60px"})},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(we.subDays||[],(Ue,Ge)=>(i.openBlock(),i.createElementBlock("div",{key:`subday-col-${Ge}`,class:i.normalizeClass(["sub-day-column",{weekend:Ue.dayOfWeek===0||Ue.dayOfWeek===6,today:Kt(Ue.date)}]),style:i.normalizeStyle({height:`${de.value}px`,width:`${E.value}px`})},null,6))),128))],6))),128))],4)):(i.openBlock(),i.createElementBlock("div",{key:2,class:"month-day-columns",style:i.normalizeStyle({width:`${(K.days||[]).length*30}px`,height:`${de.value}px`})},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(K.days||[],we=>(i.openBlock(),i.createElementBlock("div",{key:`day-col-${K.year}-${K.month}-${we.day}`,class:i.normalizeClass(["day-column",{weekend:we.isWeekend,today:we.isToday}]),style:i.normalizeStyle({height:`${de.value}px`})},null,6))),128))],4))],64)}),128)):i.createCommentVNode("",!0)],4),i.createElementVNode("div",{class:"task-bar-container",style:i.normalizeStyle({height:`${de.value}px`})},[i.createElementVNode("div",{class:"task-rows",style:i.normalizeStyle({height:`${de.value}px`})},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(cA.value,({task:K,originalIndex:ue})=>{var we,Ue,Ge;return i.openBlock(),i.createElementBlock("div",{key:K.id,class:i.normalizeClass(["task-row",{"task-row-hovered":G.value===K.id}]),style:i.normalizeStyle({top:`${ue*51}px`}),onMouseenter:We=>$(K.id),onMouseleave:te[0]||(te[0]=We=>$(null))},[K.type==="milestone-group"&&K.children?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList(K.children,We=>(i.openBlock(),i.createBlock(vg,{key:We.id,date:We.startDate||"","row-height":50,"day-width":E.value,"start-date":v.value===i.unref(qe).YEAR||v.value===i.unref(qe).QUARTER?T().startDate:v.value===i.unref(qe).MONTH?S().startDate:f.value.startDate,"timeline-start":f.value.startDate,"timeline-end":f.value.endDate,"period-width":E.value,name:We.name,milestone:U(We),"scroll-left":_e.value,"container-width":je.value,"milestone-id":We.id,"other-milestones":vA(We.id),"timeline-data":Gt.value,"current-time-scale":v.value,"allow-drag-and-resize":r.allowDragAndResize&&!le.value,"is-in-highlight-mode":le.value,onMilestoneDoubleClick:me,"onUpdate:milestone":Ce,onDragEnd:Es},null,8,["date","day-width","start-date","timeline-start","timeline-end","period-width","name","milestone","scroll-left","container-width","milestone-id","other-milestones","timeline-data","current-time-scale","allow-drag-and-resize","is-in-highlight-mode"]))),128)):K.type==="milestone"?(i.openBlock(),i.createBlock(vg,{key:K.id,date:K.startDate||"","row-height":50,"day-width":E.value,"start-date":v.value===i.unref(qe).YEAR||v.value===i.unref(qe).QUARTER?T().startDate:v.value===i.unref(qe).MONTH?S().startDate:f.value.startDate,"timeline-start":f.value.startDate,"timeline-end":f.value.endDate,"period-width":E.value,name:K.name,milestone:U(K),"scroll-left":_e.value,"container-width":je.value,"milestone-id":K.id,"other-milestones":vA(K.id),"timeline-data":Gt.value,"current-time-scale":v.value,"allow-drag-and-resize":r.allowDragAndResize&&!le.value,"is-in-highlight-mode":le.value,onMilestoneDoubleClick:me,"onUpdate:milestone":Ce,onDragEnd:Es},null,8,["date","day-width","start-date","timeline-start","timeline-end","period-width","name","milestone","scroll-left","container-width","milestone-id","other-milestones","timeline-data","current-time-scale","allow-drag-and-resize","is-in-highlight-mode"])):K.type!=="milestone-group"&&K.type!=="milestone"?(i.openBlock(),i.createBlock(iy,{key:`taskbar-${K.id}-${Kr.value}`,task:K,"row-height":50,"day-width":E.value,"start-date":v.value===i.unref(qe).YEAR?T().startDate:v.value===i.unref(qe).MONTH?S().startDate:f.value.startDate,"is-parent":K.isParent,"scroll-left":_e.value,"container-width":je.value,"hide-bubbles":wt.value,"timeline-data":v.value===i.unref(qe).HOUR?gA.value:Gt.value,"current-time-scale":v.value,"task-bar-config":r.taskBarConfig,"allow-drag-and-resize":r.allowDragAndResize&&!le.value,"is-highlighted":oe.value.has(K.id),"is-primary-highlight":N.value===K.id,"is-in-highlight-mode":le.value,"drag-link-mode":X.value,"is-link-drag-source":((we=re.value)==null?void 0:we.id)===K.id,"is-valid-link-target":((Ue=se.value)==null?void 0:Ue.id)===K.id&&x.value===!0,"is-invalid-link-target":((Ge=se.value)==null?void 0:Ge.id)===K.id&&x.value===!1,"all-tasks":b.value,"onUpdate:task":Ln,onBarMounted:mA,onClick:We=>Qr(K,We),onDblclick:We=>bn(K),onDragEnd:dn,onResizeEnd:Cs,onScrollToPosition:so,onContextMenu:Zt,onStartTimer:Ds,onStopTimer:m,onAddPredecessor:mr,onAddSuccessor:rA,onDelete:Ss,onDeleteLink:Ts,onLongPress:ee,onLinkDragStart:fe,onLinkDragMove:Oe,onLinkDragEnd:Ve},i.createSlots({_:2},[H.$slots["custom-task-content"]?{name:"custom-task-content",fn:i.withCtx(We=>[i.renderSlot(H.$slots,"custom-task-content",i.mergeProps({ref_for:!0},We),void 0,!0)]),key:"0"}:void 0]),1032,["task","day-width","start-date","is-parent","scroll-left","container-width","hide-bubbles","timeline-data","current-time-scale","task-bar-config","allow-drag-and-resize","is-highlighted","is-primary-highlight","is-in-highlight-mode","drag-link-mode","is-link-drag-source","is-valid-link-target","is-invalid-link-target","all-tasks","onClick","onDblclick"])):i.createCommentVNode("",!0)],46,ZF)}),128))],4)],4)],512)],32)],544))}}),oy=sn(nk,[["__scopeId","data-v-7a809cc7"]]),ak={class:"gantt-toolbar"},ik={class:"toolbar-left"},sk={key:0,class:"gantt-btn-group gantt-add-btn-group"},ok=["title"],lk=["title"],ck={key:1,class:"gantt-btn-group gantt-expand-collapse-btn-group"},uk=["title"],fk=["title"],dk={key:2,class:"gantt-btn-group"},hk=["title"],gk=["title"],pk={class:"toolbar-right"},vk={key:0,class:"segmented-control time-scale-segmented"},mk={class:"segmented-track"},wk=["title","onClick"],Bk={key:1,class:"language-dropdown"},yk=["title"],bk={class:"lang-text"},Ck={key:0,class:"language-menu"},Ek=["onClick"],Fk={class:"option-text"},kk={key:0,class:"check-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},xk=["title"],Sk=["title"],Tk={key:0,class:"gantt-btn-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Uk={key:1,class:"gantt-btn-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Dk={class:"icon-fallback"},Qk=["title"],Lk={key:0,class:"gantt-btn-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Ik={key:1,class:"gantt-btn-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Nk={class:"icon-fallback"},_k={key:0,class:"confirm-dialog"},Mk={class:"dialog-content"},Ok={class:"dialog-message"},Rk={class:"dialog-actions"},Ou="gantt-theme",Hk="gantt-locale",Pk=i.defineComponent({__name:"GanttToolbar",props:{config:{default:()=>({})},onAddTask:{type:Function,default:void 0},onAddMilestone:{type:Function,default:void 0},onTodayLocate:{type:Function,default:void 0},onExportCsv:{type:Function,default:void 0},onExportPdf:{type:Function,default:void 0},onLanguageChange:{type:Function,default:void 0},onThemeChange:{type:Function,default:void 0},onFullscreenChange:{type:Function,default:void 0},onTimeScaleChange:{type:Function,default:void 0},onExpandAll:{type:Function,default:void 0},onCollapseAll:{type:Function,default:void 0},onSettingsConfirm:{type:Function,default:void 0}},emits:["add-task","add-milestone","today-locate","export-csv","export-pdf","language-change","theme-change","fullscreen-change","time-scale-change","expand-all","collapse-all"],setup(A,{emit:t}){const e=A,r=t,n={zh:"zh-CN",en:"en-US"},a=()=>{if(typeof window<"u"){const fe=localStorage.getItem(Ou);return fe!==null?fe==="dark":window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}return!1},{locale:o,setLocale:s,getTranslation:l}=ga(),c=i.ref("zh"),u=i.ref(a()),g=i.ref(!1),p=i.ref(!1),f=i.ref(qe.DAY),v=fe=>l(fe),w=i.computed(()=>v("language")),b=i.ref(!1),B=i.ref(null),F=i.ref(null),E=()=>{e.onAddTask&&typeof e.onAddTask=="function"?e.onAddTask():r("add-task")},k=()=>{e.onAddMilestone&&typeof e.onAddMilestone=="function"?e.onAddMilestone():r("add-milestone")},P=()=>{e.onTodayLocate&&typeof e.onTodayLocate=="function"?e.onTodayLocate():r("today-locate")},j=()=>{e.onExportCsv&&typeof e.onExportCsv=="function"?e.onExportCsv():r("export-csv")},M=()=>{e.onExportPdf&&typeof e.onExportPdf=="function"?e.onExportPdf():r("export-pdf")},O=()=>{e.onExpandAll&&typeof e.onExpandAll=="function"?e.onExpandAll():r("expand-all")},L=()=>{e.onCollapseAll&&typeof e.onCollapseAll=="function"?e.onCollapseAll():r("collapse-all")},R=()=>{p.value=!p.value},S=fe=>{c.value=fe,p.value=!1;const ce=n[c.value];s(ce),e.onLanguageChange&&typeof e.onLanguageChange=="function"?e.onLanguageChange(ce):r("language-change",ce),F.value=ce,B.value="language",b.value=!0},T=async()=>{if(!B.value||F.value===null){le();return}if(e.onSettingsConfirm&&typeof e.onSettingsConfirm=="function")try{if(!await e.onSettingsConfirm(B.value,F.value)){le();return}}catch{le();return}B.value==="theme"?G():B.value==="language"&&N(),le()},G=()=>{typeof window<"u"&&typeof F.value=="boolean"&&localStorage.setItem(Ou,F.value?"dark":"light")},N=()=>{typeof window<"u"&&typeof F.value=="string"&&localStorage.setItem(Hk,F.value)},oe=()=>{le()},le=()=>{b.value=!1,B.value=null,F.value=null},Z=()=>{const fe=!u.value;u.value=fe,document.documentElement.setAttribute("data-theme",fe?"dark":"light"),e.onThemeChange&&typeof e.onThemeChange=="function"?e.onThemeChange(fe):r("theme-change",fe),F.value=fe,B.value="theme",b.value=!0},ee=()=>{g.value=!g.value,window.dispatchEvent(new CustomEvent("fullscreen-toggle",{detail:g.value})),e.onFullscreenChange&&typeof e.onFullscreenChange=="function"?e.onFullscreenChange(g.value):r("fullscreen-change",g.value)},X={hour:{value:qe.HOUR,label:()=>v("timeScaleHour")},day:{value:qe.DAY,label:()=>v("timeScaleDay")},week:{value:qe.WEEK,label:()=>v("timeScaleWeek")},month:{value:qe.MONTH,label:()=>v("timeScaleMonth")},quarter:{value:qe.QUARTER,label:()=>v("timeScaleQuarter")},year:{value:qe.YEAR,label:()=>v("timeScaleYear")}},re=["hour","day","week","month","year"],se=i.computed(()=>{var Fe;const ce=(((Fe=e.config)==null?void 0:Fe.timeScaleDimensions)??re).filter(Pe=>Pe in X);return ce.length>0?ce:[...re]}),x=i.computed(()=>{var Fe;const fe=se.value,ce=(Fe=e.config)==null?void 0:Fe.defaultTimeScale;return ce&&fe.includes(ce)?ce:fe.includes("day")?"day":fe[0]??"day"}),I=fe=>{f.value=fe,e.onTimeScaleChange&&typeof e.onTimeScaleChange=="function"?e.onTimeScaleChange(fe):r("time-scale-change",fe)};let W=!1;i.watch(()=>x.value,fe=>{const ce=X[fe].value;(f.value!==ce||!W)&&(W=!0,I(ce))},{immediate:!0});const z=i.computed(()=>se.value.find(ce=>X[ce].value===f.value)??x.value),Ae=()=>{const fe=se.value.findIndex(Ze=>Ze===z.value),ce=se.value.length;if(ce===0||fe<0)return{transform:"translateX(0%)",width:`${100/ce||25}%`};const Fe=100/ce;return{transform:`translateX(${fe*100}%)`,width:`${Fe}%`}},he=fe=>{!fe.target.closest(".language-dropdown")&&p.value&&(p.value=!1)};return i.onMounted(()=>{const fe=o.value;c.value=fe==="zh-CN"?"zh":"en",document.documentElement.setAttribute("data-theme",u.value?"dark":"light"),document.addEventListener("click",he),window.matchMedia&&typeof window<"u"&&!localStorage.getItem(Ou)&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",ce=>{u.value=ce.matches,document.documentElement.setAttribute("data-theme",ce.matches?"dark":"light")})}),i.onUnmounted(()=>{document.removeEventListener("click",he)}),(fe,ce)=>(i.openBlock(),i.createElementBlock("div",ak,[i.createElementVNode("div",ik,[fe.config.showAddTask!==!1||fe.config.showAddMilestone!==!1?(i.openBlock(),i.createElementBlock("div",sk,[fe.config.showAddTask!==!1?(i.openBlock(),i.createElementBlock("button",{key:0,class:"gantt-btn-group-item",title:v("addTask"),onClick:E},[ce[0]||(ce[0]=i.createElementVNode("svg",{class:"gantt-btn-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[i.createElementVNode("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),i.createElementVNode("line",{x1:"5",y1:"12",x2:"19",y2:"12"})],-1)),i.createTextVNode(" "+i.toDisplayString(v("addTask")),1)],8,ok)):i.createCommentVNode("",!0),fe.config.showAddMilestone!==!1?(i.openBlock(),i.createElementBlock("button",{key:1,class:"gantt-btn-group-item",title:v("addMilestone"),onClick:k},[ce[1]||(ce[1]=i.createStaticVNode('<svg class="gantt-btn-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-ed3a47c3><g transform="rotate(45 12 12)" data-v-ed3a47c3><rect x="4" y="4" width="16" height="16" rx="4" ry="4" fill="none" stroke="currentColor" data-v-ed3a47c3></rect></g><line x1="12" y1="8" x2="12" y2="16" data-v-ed3a47c3></line><line x1="8" y1="12" x2="16" y2="12" data-v-ed3a47c3></line></svg>',1)),i.createTextVNode(" "+i.toDisplayString(v("addMilestone")),1)],8,lk)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),fe.config.showExpandCollapse!==!1?(i.openBlock(),i.createElementBlock("div",ck,[i.createElementVNode("button",{class:"gantt-btn-group-item",title:v("expandAll"),onClick:O},[ce[2]||(ce[2]=i.createElementVNode("svg",{class:"gantt-btn-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[i.createElementVNode("polyline",{points:"6 9 12 15 18 9"})],-1)),i.createTextVNode(" "+i.toDisplayString(v("expandAll")),1)],8,uk),i.createElementVNode("button",{class:"gantt-btn-group-item",title:v("collapseAll"),onClick:L},[ce[3]||(ce[3]=i.createElementVNode("svg",{class:"gantt-btn-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[i.createElementVNode("polyline",{points:"18 15 12 9 6 15"})],-1)),i.createTextVNode(" "+i.toDisplayString(v("collapseAll")),1)],8,fk)])):i.createCommentVNode("",!0),fe.config.showExportCsv!==!1||fe.config.showExportPdf!==!1?(i.openBlock(),i.createElementBlock("div",dk,[fe.config.showExportCsv!==!1?(i.openBlock(),i.createElementBlock("button",{key:0,class:"gantt-btn-group-item",title:v("exportCsv"),onClick:j},[ce[4]||(ce[4]=i.createStaticVNode('<svg class="gantt-btn-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-ed3a47c3><path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z" data-v-ed3a47c3></path><polyline points="14,2 14,8 20,8" data-v-ed3a47c3></polyline><line x1="16" y1="13" x2="8" y2="13" data-v-ed3a47c3></line><line x1="16" y1="17" x2="8" y2="17" data-v-ed3a47c3></line><polyline points="10,9 9,9 8,9" data-v-ed3a47c3></polyline></svg>',1)),i.createTextVNode(" "+i.toDisplayString(v("exportCsv")),1)],8,hk)):i.createCommentVNode("",!0),fe.config.showExportPdf!==!1?(i.openBlock(),i.createElementBlock("button",{key:1,class:"gantt-btn-group-item",title:v("exportPdf"),onClick:M},[ce[5]||(ce[5]=i.createStaticVNode('<svg class="gantt-btn-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-ed3a47c3><path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z" data-v-ed3a47c3></path><polyline points="14,2 14,8 20,8" data-v-ed3a47c3></polyline><line x1="16" y1="13" x2="8" y2="13" data-v-ed3a47c3></line><line x1="16" y1="17" x2="8" y2="17" data-v-ed3a47c3></line><line x1="12" y1="13" x2="12" y2="17" data-v-ed3a47c3></line></svg>',1)),i.createTextVNode(" "+i.toDisplayString(v("exportPdf")),1)],8,gk)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),i.createElementVNode("div",pk,[fe.config.showTimeScale!==!1?(i.openBlock(),i.createElementBlock("div",vk,[i.createElementVNode("div",mk,[i.createElementVNode("div",{class:"segmented-thumb",style:i.normalizeStyle(Ae())},null,4)]),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(se.value,Fe=>(i.openBlock(),i.createElementBlock("button",{key:Fe,class:i.normalizeClass(["segmented-item",{active:z.value===Fe}]),title:v("timeScaleTooltip"),onClick:Pe=>I(X[Fe].value)},i.toDisplayString(X[Fe].label()),11,wk))),128))])):i.createCommentVNode("",!0),fe.config.showLanguage!==!1?(i.openBlock(),i.createElementBlock("div",Bk,[i.createElementVNode("button",{class:"toolbar-lang-btn",title:v("languageTooltip"),onClick:R},[ce[6]||(ce[6]=i.createElementVNode("svg",{class:"gantt-btn-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[i.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),i.createElementVNode("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),i.createElementVNode("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})],-1)),i.createElementVNode("span",bk,i.toDisplayString(w.value),1),ce[7]||(ce[7]=i.createElementVNode("svg",{class:"dropdown-arrow",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[i.createElementVNode("polyline",{points:"6,9 12,15 18,9"})],-1))],8,yk),p.value?(i.openBlock(),i.createElementBlock("div",Ck,[(i.openBlock(),i.createElementBlock(i.Fragment,null,i.renderList(["zh","en"],Fe=>i.createElementVNode("div",{key:Fe,class:i.normalizeClass(["language-option",{active:c.value===Fe}]),onClick:Pe=>S(Fe)},[i.createElementVNode("span",Fk,i.toDisplayString(Fe==="zh"?"中文":"English"),1),c.value===Fe?(i.openBlock(),i.createElementBlock("svg",kk,ce[8]||(ce[8]=[i.createElementVNode("polyline",{points:"20,6 9,17 4,12"},null,-1)]))):i.createCommentVNode("",!0)],10,Ek)),64))])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),fe.config.showTodayLocate!==!1?(i.openBlock(),i.createElementBlock("button",{key:2,class:"toolbar-icon-btn today-locate-btn",title:v("todayLocateTooltip"),onClick:P},ce[9]||(ce[9]=[i.createStaticVNode('<svg class="gantt-btn-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-ed3a47c3><rect x="3" y="4" width="18" height="18" rx="2" ry="2" data-v-ed3a47c3></rect><line x1="16" y1="2" x2="16" y2="6" data-v-ed3a47c3></line><line x1="8" y1="2" x2="8" y2="6" data-v-ed3a47c3></line><line x1="3" y1="10" x2="21" y2="10" data-v-ed3a47c3></line><circle cx="12" cy="16" r="1" data-v-ed3a47c3></circle></svg>',1)]),8,xk)):i.createCommentVNode("",!0),fe.config.showTheme!==!1?(i.openBlock(),i.createElementBlock("button",{key:3,class:"toolbar-icon-btn",title:v(u.value?"lightMode":"darkMode"),onClick:Z},[u.value?(i.openBlock(),i.createElementBlock("svg",Tk,ce[10]||(ce[10]=[i.createStaticVNode('<circle cx="12" cy="12" r="5" data-v-ed3a47c3></circle><line x1="12" y1="1" x2="12" y2="3" data-v-ed3a47c3></line><line x1="12" y1="21" x2="12" y2="23" data-v-ed3a47c3></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64" data-v-ed3a47c3></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78" data-v-ed3a47c3></line><line x1="1" y1="12" x2="3" y2="12" data-v-ed3a47c3></line><line x1="21" y1="12" x2="23" y2="12" data-v-ed3a47c3></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36" data-v-ed3a47c3></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22" data-v-ed3a47c3></line>',9)]))):(i.openBlock(),i.createElementBlock("svg",Uk,ce[11]||(ce[11]=[i.createElementVNode("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"},null,-1)]))),i.createElementVNode("span",Dk,i.toDisplayString(u.value?"☀️":"🌙"),1)],8,Sk)):i.createCommentVNode("",!0),fe.config.showFullscreen!==!1?(i.openBlock(),i.createElementBlock("button",{key:4,class:"toolbar-icon-btn",title:v(g.value?"exitFullscreen":"fullscreen"),onClick:ee},[g.value?(i.openBlock(),i.createElementBlock("svg",Lk,ce[12]||(ce[12]=[i.createElementVNode("path",{d:"M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3"},null,-1)]))):(i.openBlock(),i.createElementBlock("svg",Ik,ce[13]||(ce[13]=[i.createElementVNode("path",{d:"M8 3H5a2 2 0 00-2 2v3m18 0V5a2 2 0 00-2-2h-3m0 18h3a2 2 0 002-2v-3M3 16v3a2 2 0 002 2h3"},null,-1)]))),i.createElementVNode("span",Nk,i.toDisplayString(g.value?"⇲":"⇱"),1)],8,Qk)):i.createCommentVNode("",!0)]),b.value?(i.openBlock(),i.createElementBlock("div",_k,[i.createElementVNode("div",Mk,[i.createElementVNode("p",Ok,i.toDisplayString(v("confirmDialogMessage")),1),i.createElementVNode("div",Rk,[i.createElementVNode("button",{class:"gantt-btn gantt-btn-default",onClick:oe},i.toDisplayString(v("cancel")),1),i.createElementVNode("button",{class:"gantt-btn gantt-btn-primary",onClick:T},i.toDisplayString(v("confirm")),1)])])])):i.createCommentVNode("",!0)]))}}),Vk=sn(Pk,[["__scopeId","data-v-ed3a47c3"]]),Kk={success:"#67c23a",warning:"#e6a23c",error:"#f56c6c",info:"#909399"};let ns=null;function qk(){return ns||(ns=document.createElement("div"),ns.className="message-container",ns.style.cssText=`
|
|
2
2
|
position: fixed;
|
|
3
3
|
top: 20px;
|
|
4
4
|
right: 20px;
|