"use strict";exports.id=9184,exports.ids=[9184],exports.modules={69184:(a,b,c)=>{c.d(b,{useTaskStore:()=>f});var d=c(31417),e=c(97293);let f=(0,d.v)((a,b)=>({tasks:[],selectedTaskId:null,filter:"all",showCompleted:!1,isLoading:!1,error:null,setTasks:b=>a({tasks:b}),setSelectedTaskId:b=>a({selectedTaskId:b}),setFilter:b=>a({filter:b}),setShowCompleted:b=>a({showCompleted:b}),fetchTasks:async(b,c)=>{e.Y.log("tasks","TaskStore/fetchTasks start",{calendarIds:c||"all"}),a({isLoading:!0,error:null});try{let d=await b.getCalendarTasks(c);e.Y.log("tasks","TaskStore/fetchTasks received",d.length,"tasks"),d.forEach((a,b)=>{e.Y.log("tasks",`TaskStore/fetchTasks [${b}]`,{id:a.id,uid:a.uid,"@type":a["@type"],title:a.title,due:a.due,progress:a.progress,showWithoutTime:a.showWithoutTime,calendarIds:a.calendarIds})}),a({tasks:d,isLoading:!1})}catch(b){e.Y.error("TaskStore/fetchTasks failed",b),a({isLoading:!1,error:"Failed to fetch tasks"})}},createTask:async(c,d)=>{e.Y.log("tasks","TaskStore/createTask",d);let f=await c.createCalendarTask(d);return e.Y.log("tasks","TaskStore/createTask result",{id:f.id,uid:f.uid,title:f.title}),a({tasks:[...b().tasks,f]}),f},updateTask:async(c,d,e)=>{await c.updateCalendarTask(d,e),a({tasks:b().tasks.map(a=>a.id===d?{...a,...e,updated:new Date().toISOString()}:a)})},deleteTask:async(c,d)=>{await c.deleteCalendarTask(d),a({tasks:b().tasks.filter(a=>a.id!==d),selectedTaskId:b().selectedTaskId===d?null:b().selectedTaskId})},toggleTaskComplete:async(c,d)=>{let e={progress:"completed"===d.progress?"needs-action":"completed",progressUpdated:new Date().toISOString()};await c.updateCalendarTask(d.id,e),a({tasks:b().tasks.map(a=>a.id===d.id?{...a,...e,updated:new Date().toISOString()}:a)})},clearTasks:()=>a({tasks:[],selectedTaskId:null,error:null})}))}};