import{t as e}from"./axisEvents-Dhd0R1o7.js";function t(e=new Date){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}async function n(e){let t=new URLSearchParams({project_path:e,all_dates:`1`}),n=await fetch(`/api/today-tasks?${t.toString()}`);if(!n.ok)throw Error(`listAllTasksForProject failed: HTTP ${n.status}`);return(await n.json()).tasks??[]}async function r(){let e=new URLSearchParams({all:`1`,all_dates:`1`}),t=await fetch(`/api/today-tasks?${e.toString()}`);if(!t.ok)throw Error(`listAllTasks failed: HTTP ${t.status}`);return(await t.json()).tasks??[]}async function i(e){let t=await fetch(`/api/today-tasks`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(`createTask failed: HTTP ${t.status}`);return(await t.json()).task}async function a(e,t){let n=await fetch(`/api/today-tasks/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)throw Error(`updateTask failed: HTTP ${n.status}`);return(await n.json()).task}async function o(e){let t=await fetch(`/api/today-tasks/${encodeURIComponent(e)}`,{method:`DELETE`});if(!t.ok)throw Error(`deleteTask failed: HTTP ${t.status}`)}async function s(t){try{e(`mc:launch-task`,{taskId:t.id,projectPath:t.project_path,prompt:t.suggested_prompt||t.plan||t.title,title:t.title})}catch{}if(t.status!==`in_progress`&&t.status!==`done`)try{await a(t.id,{status:`in_progress`})}catch{}}export{n as a,r as i,o as n,t as o,s as r,a as s,i as t};