super-time-tracker-ui 0.1.42 → 0.1.45

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.
Files changed (102) hide show
  1. package/dist/standalone/next-output/BUILD_ID +1 -1
  2. package/dist/standalone/next-output/build-manifest.json +3 -3
  3. package/dist/standalone/next-output/server/app/_global-error.html +1 -1
  4. package/dist/standalone/next-output/server/app/_global-error.rsc +1 -1
  5. package/dist/standalone/next-output/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  6. package/dist/standalone/next-output/server/app/_global-error.segments/_full.segment.rsc +1 -1
  7. package/dist/standalone/next-output/server/app/_global-error.segments/_head.segment.rsc +1 -1
  8. package/dist/standalone/next-output/server/app/_global-error.segments/_index.segment.rsc +1 -1
  9. package/dist/standalone/next-output/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  10. package/dist/standalone/next-output/server/app/_not-found/page/react-loadable-manifest.json +1 -1
  11. package/dist/standalone/next-output/server/app/_not-found/page.js.nft.json +1 -1
  12. package/dist/standalone/next-output/server/app/_not-found/page_client-reference-manifest.js +1 -1
  13. package/dist/standalone/next-output/server/app/login/page/react-loadable-manifest.json +1 -1
  14. package/dist/standalone/next-output/server/app/login/page.js.nft.json +1 -1
  15. package/dist/standalone/next-output/server/app/login/page_client-reference-manifest.js +1 -1
  16. package/dist/standalone/next-output/server/app/offline/page/react-loadable-manifest.json +1 -1
  17. package/dist/standalone/next-output/server/app/offline/page.js.nft.json +1 -1
  18. package/dist/standalone/next-output/server/app/offline/page_client-reference-manifest.js +1 -1
  19. package/dist/standalone/next-output/server/app/page/react-loadable-manifest.json +2 -2
  20. package/dist/standalone/next-output/server/app/page.js.nft.json +1 -1
  21. package/dist/standalone/next-output/server/app/page_client-reference-manifest.js +1 -1
  22. package/dist/standalone/next-output/server/app/pomodoro/page/react-loadable-manifest.json +1 -1
  23. package/dist/standalone/next-output/server/app/pomodoro/page.js.nft.json +1 -1
  24. package/dist/standalone/next-output/server/app/pomodoro/page_client-reference-manifest.js +1 -1
  25. package/dist/standalone/next-output/server/app/register/page/react-loadable-manifest.json +1 -1
  26. package/dist/standalone/next-output/server/app/register/page.js.nft.json +1 -1
  27. package/dist/standalone/next-output/server/app/register/page_client-reference-manifest.js +1 -1
  28. package/dist/standalone/next-output/server/app/reporting/page/react-loadable-manifest.json +1 -1
  29. package/dist/standalone/next-output/server/app/reporting/page.js.nft.json +1 -1
  30. package/dist/standalone/next-output/server/app/reporting/page_client-reference-manifest.js +1 -1
  31. package/dist/standalone/next-output/server/app/review/page/react-loadable-manifest.json +1 -1
  32. package/dist/standalone/next-output/server/app/review/page.js.nft.json +1 -1
  33. package/dist/standalone/next-output/server/app/review/page_client-reference-manifest.js +1 -1
  34. package/dist/standalone/next-output/server/app/search/page/react-loadable-manifest.json +1 -1
  35. package/dist/standalone/next-output/server/app/search/page.js.nft.json +1 -1
  36. package/dist/standalone/next-output/server/app/search/page_client-reference-manifest.js +1 -1
  37. package/dist/standalone/next-output/server/app/settings/ai-suggestions/page/react-loadable-manifest.json +1 -1
  38. package/dist/standalone/next-output/server/app/settings/ai-suggestions/page.js.nft.json +1 -1
  39. package/dist/standalone/next-output/server/app/settings/ai-suggestions/page_client-reference-manifest.js +1 -1
  40. package/dist/standalone/next-output/server/app/settings/cloud-sync/page/react-loadable-manifest.json +1 -1
  41. package/dist/standalone/next-output/server/app/settings/cloud-sync/page.js.nft.json +1 -1
  42. package/dist/standalone/next-output/server/app/settings/cloud-sync/page_client-reference-manifest.js +1 -1
  43. package/dist/standalone/next-output/server/app/settings/data/page/react-loadable-manifest.json +1 -1
  44. package/dist/standalone/next-output/server/app/settings/data/page.js.nft.json +1 -1
  45. package/dist/standalone/next-output/server/app/settings/data/page_client-reference-manifest.js +1 -1
  46. package/dist/standalone/next-output/server/app/settings/display/page/react-loadable-manifest.json +1 -1
  47. package/dist/standalone/next-output/server/app/settings/display/page.js.nft.json +1 -1
  48. package/dist/standalone/next-output/server/app/settings/display/page_client-reference-manifest.js +1 -1
  49. package/dist/standalone/next-output/server/app/settings/goals/page/react-loadable-manifest.json +1 -1
  50. package/dist/standalone/next-output/server/app/settings/goals/page.js.nft.json +1 -1
  51. package/dist/standalone/next-output/server/app/settings/goals/page_client-reference-manifest.js +1 -1
  52. package/dist/standalone/next-output/server/app/settings/notifications/page/react-loadable-manifest.json +1 -1
  53. package/dist/standalone/next-output/server/app/settings/notifications/page.js.nft.json +1 -1
  54. package/dist/standalone/next-output/server/app/settings/notifications/page_client-reference-manifest.js +1 -1
  55. package/dist/standalone/next-output/server/app/settings/page/react-loadable-manifest.json +1 -1
  56. package/dist/standalone/next-output/server/app/settings/page.js.nft.json +1 -1
  57. package/dist/standalone/next-output/server/app/settings/page_client-reference-manifest.js +1 -1
  58. package/dist/standalone/next-output/server/app/settings/pomodoro/page/react-loadable-manifest.json +1 -1
  59. package/dist/standalone/next-output/server/app/settings/pomodoro/page.js.nft.json +1 -1
  60. package/dist/standalone/next-output/server/app/settings/pomodoro/page_client-reference-manifest.js +1 -1
  61. package/dist/standalone/next-output/server/app/settings/quick-actions/page/react-loadable-manifest.json +1 -1
  62. package/dist/standalone/next-output/server/app/settings/quick-actions/page.js.nft.json +1 -1
  63. package/dist/standalone/next-output/server/app/settings/quick-actions/page_client-reference-manifest.js +1 -1
  64. package/dist/standalone/next-output/server/app/settings/tags/page/react-loadable-manifest.json +1 -1
  65. package/dist/standalone/next-output/server/app/settings/tags/page.js.nft.json +1 -1
  66. package/dist/standalone/next-output/server/app/settings/tags/page_client-reference-manifest.js +1 -1
  67. package/dist/standalone/next-output/server/app/sheets/page/react-loadable-manifest.json +1 -1
  68. package/dist/standalone/next-output/server/app/sheets/page.js.nft.json +1 -1
  69. package/dist/standalone/next-output/server/app/sheets/page_client-reference-manifest.js +1 -1
  70. package/dist/standalone/next-output/server/app/templates/page/react-loadable-manifest.json +1 -1
  71. package/dist/standalone/next-output/server/app/templates/page.js.nft.json +1 -1
  72. package/dist/standalone/next-output/server/app/templates/page_client-reference-manifest.js +1 -1
  73. package/dist/standalone/next-output/server/app/today/page/react-loadable-manifest.json +1 -1
  74. package/dist/standalone/next-output/server/app/today/page.js.nft.json +1 -1
  75. package/dist/standalone/next-output/server/app/today/page_client-reference-manifest.js +1 -1
  76. package/dist/standalone/next-output/server/chunks/ssr/[root-of-the-server]__0sx0ra6._.js +1 -1
  77. package/dist/standalone/next-output/server/chunks/ssr/_0-4oz91._.js +1 -1
  78. package/dist/standalone/next-output/server/chunks/ssr/{_05ydjrh._.js → _0d1s~8c._.js} +2 -2
  79. package/dist/standalone/next-output/server/chunks/ssr/_0ja6w18._.js +3 -0
  80. package/dist/standalone/next-output/server/chunks/ssr/{_10utgt7._.js → _0rhx88g._.js} +2 -2
  81. package/dist/standalone/next-output/server/chunks/ssr/_0sic8ed._.js +1 -1
  82. package/dist/standalone/next-output/server/chunks/ssr/components_end-of-day-review-view_tsx_0t6snsb._.js +1 -1
  83. package/dist/standalone/next-output/server/chunks/ssr/components_reporting-view_tsx_0-0ofcv._.js +1 -1
  84. package/dist/standalone/next-output/server/middleware-build-manifest.js +3 -3
  85. package/dist/standalone/next-output/server/pages/500.html +1 -1
  86. package/dist/standalone/next-output/static/chunks/0-niex.k_xqnu.js +1 -0
  87. package/dist/standalone/next-output/static/chunks/01_obgfd_d0-5.js +1 -0
  88. package/dist/standalone/next-output/static/chunks/{141j1htu_qj-p.js → 0feo1c5hcq~fw.js} +1 -1
  89. package/dist/standalone/next-output/static/chunks/{0io.jffavun5t.js → 0lbfeprw3roep.js} +1 -1
  90. package/dist/standalone/next-output/static/chunks/{0t3hajznk~j44.js → 0q_cw2e3uj20q.js} +1 -1
  91. package/dist/standalone/next-output/static/chunks/0wd.8~gqkz5cp.css +3 -0
  92. package/dist/standalone/next-output/static/chunks/{09lddf9c4kn~5.js → 0ya1a.o~xsixd.js} +1 -1
  93. package/dist/standalone/next-output/static/chunks/{0gv5y9hez6j.f.js → 11~k89a6fiu2w.js} +1 -1
  94. package/dist/standalone/package.json +1 -1
  95. package/package.json +1 -1
  96. package/dist/standalone/next-output/server/chunks/ssr/_02l2ykc._.js +0 -3
  97. package/dist/standalone/next-output/static/chunks/01op4gs840x6z.js +0 -1
  98. package/dist/standalone/next-output/static/chunks/05m~ilvrxjj14.css +0 -3
  99. package/dist/standalone/next-output/static/chunks/0yc_so6bvu6on.js +0 -1
  100. /package/dist/standalone/next-output/static/{l_mfwvHxStSDpzw8cKLu3 → y7QrkWDtEEq8SX6iBgDNU}/_buildManifest.js +0 -0
  101. /package/dist/standalone/next-output/static/{l_mfwvHxStSDpzw8cKLu3 → y7QrkWDtEEq8SX6iBgDNU}/_clientMiddlewareManifest.js +0 -0
  102. /package/dist/standalone/next-output/static/{l_mfwvHxStSDpzw8cKLu3 → y7QrkWDtEEq8SX6iBgDNU}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,68120,e=>{"use strict";var t=e.i(8063),a=e.i(48042),s=e.i(51268),r=e.i(32584),n=e.i(56812);let l=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],o=[0,6,12,18];function i({heatmap:e,duration_format:a,week_starts_on:r}){let l=(0,n.week_starts_on_to_index)(r),m=(0,s.useMemo)(()=>Array.from({length:7},(e,t)=>(l+t)%7),[l]),x=(0,s.useMemo)(()=>{let t=new Map;for(let a of e)t.set(`${a.weekdayIndex}-${a.hourIndex}`,a.totalMs);return t},[e]),f=(0,s.useMemo)(()=>e.reduce((e,t)=>Math.max(e,t.totalMs),0),[e]),h=(0,s.useMemo)(()=>e.reduce((e,t)=>e+t.totalMs,0),[e]);return(0,t.jsxs)("section",{className:"flex w-full flex-col gap-3 rounded-md border border-panel-border bg-panel p-4 shadow-sm",children:[(0,t.jsxs)("header",{className:"flex flex-col gap-0.5",children:[(0,t.jsx)("h3",{className:"m-0 text-[0.95rem] font-semibold",children:"Activity heatmap"}),(0,t.jsx)("p",{className:"m-0 text-[0.78rem] text-muted",children:"When during the week you usually track time."})]}),0===h?(0,t.jsx)("p",{className:"m-0 py-6 text-center text-[0.85rem] text-muted",children:"Once you start logging time, your weekly rhythm appears here."}):(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsx)("div",{className:"min-w-[420px] pb-1",children:(0,t.jsxs)("div",{className:"grid grid-cols-[2rem_1fr] gap-x-2",children:[(0,t.jsx)("div",{}),(0,t.jsx)("div",{className:"relative h-3.5 w-full",children:o.map(e=>(0,t.jsx)("span",{className:"absolute -translate-x-1/2 text-[0.65rem] font-medium uppercase tracking-[0.06em] text-muted",style:{left:`${e/24*100}%`},children:c(e)},e))}),m.map(e=>(0,t.jsx)(d,{weekday_index:e,cell_lookup:x,max_cell_ms:f,duration_format:a},e))]})})}),(0,t.jsxs)("footer",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1 text-[0.72rem] text-muted",children:[(0,t.jsx)("span",{children:"Less"}),(0,t.jsx)("div",{className:"flex items-center gap-1",children:[.15,.35,.6,.85,1].map(e=>(0,t.jsx)("span",{className:"inline-block h-3 w-4 rounded-sm",style:{backgroundColor:u(e)}},e))}),(0,t.jsx)("span",{children:"More"})]})]})}function d({weekday_index:e,cell_lookup:a,max_cell_ms:s,duration_format:n}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"self-center text-[0.7rem] font-medium uppercase tracking-[0.06em] text-muted",children:l[e]}),(0,t.jsx)("div",{className:"grid gap-[2px]",style:{gridTemplateColumns:"repeat(24, minmax(0, 1fr))"},children:Array.from({length:24},(o,i)=>{let d=a.get(`${e}-${i}`)??0;return(0,t.jsx)("span",{className:"block aspect-square min-h-[14px] rounded-[3px]",style:{backgroundColor:u(s>0?d/s:0)},title:`${l[e]} ${c(i)}: ${(0,r.format_duration)(d,n)}`},i)})})]})}function c(e){return 0===e?"12a":12===e?"12p":e<12?`${e}a`:`${e-12}p`}function u(e){if(e<=0)return"color-mix(in srgb, var(--surface-raised) 80%, transparent)";let t=Math.min(100,Math.round(90*e)+10);return`color-mix(in srgb, var(--accent) ${t}%, transparent)`}function m(e){return Math.round(100*e)/100}function x({daily_buckets:e,duration_format:a,title:n="Time over days",subtitle:l}){let o=(0,s.useMemo)(()=>e.slice(-60),[e]),i=(0,s.useMemo)(()=>o.reduce((e,t)=>Math.max(e,t.totalMs),0),[o]),d=(0,s.useMemo)(()=>o.reduce((e,t)=>e+t.totalMs,0),[o]),c=(0,s.useMemo)(()=>{let e=o.filter(e=>e.totalMs>0).length;return 0===e?0:d/e},[o,d]),u=l??(0===o.length?"No data in this period.":`${o.length} day${1===o.length?"":"s"} \xb7 avg ${(0,r.format_duration)(c,a)} on active days`);return(0,t.jsxs)("section",{className:"flex w-full flex-col gap-3 rounded-md border border-panel-border bg-panel p-4 shadow-sm",children:[(0,t.jsxs)("header",{className:"flex flex-col gap-0.5",children:[(0,t.jsx)("h3",{className:"m-0 text-[0.95rem] font-semibold",children:n}),(0,t.jsx)("p",{className:"m-0 text-[0.78rem] text-muted",children:u})]}),0===o.length?(0,t.jsx)("p",{className:"m-0 py-6 text-center text-[0.85rem] text-muted",children:"Track time to populate this chart."}):(0,t.jsx)("div",{className:"flex h-44 items-end gap-[3px] overflow-x-auto pb-2",children:o.map(e=>{let s=i>0?m(e.totalMs/i*100):0,n=0===e.weekdayIndex||6===e.weekdayIndex,l=e.totalMs>0;return(0,t.jsx)("div",{className:"flex h-full min-w-[6px] flex-1 flex-col justify-end",title:`${e.dateLabel} \xb7 ${(0,r.format_duration)(e.totalMs,a)}`,role:"img","aria-label":`${e.dateLabel}: ${(0,r.format_duration)(e.totalMs,a)}`,children:(0,t.jsx)("div",{className:`w-full rounded-t-sm transition-all ${l?n?"bg-accent/60":"bg-accent":"bg-surface-raised"}`,style:{height:l?`${Math.max(2,s)}%`:"2px"}})},e.dateMs)})}),(0,t.jsxs)("footer",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1 text-[0.72rem] text-muted",children:[(0,t.jsx)("span",{children:o.length>0?`${o[0].dateLabel} → ${o[o.length-1].dateLabel}`:""}),(0,t.jsxs)("span",{children:["Total ",(0,r.format_duration)(d,a)," · Peak"," ",(0,r.format_duration)(i,a)]})]})]})}var f=e.i(55437);function h({insights:e,duration_format:a}){return(0,t.jsxs)("section",{className:"flex w-full flex-col gap-4 rounded-md border border-panel-border bg-panel p-4 shadow-sm",children:[(0,t.jsxs)("header",{className:"flex flex-col gap-0.5",children:[(0,t.jsx)("h3",{className:"m-0 text-[0.95rem] font-semibold",children:"Focus pattern insights"}),(0,t.jsx)("p",{className:"m-0 text-[0.78rem] text-muted",children:"Heuristics from starts, gaps, sheet changes, and long focus blocks."})]}),0===e.activeDayCount?(0,t.jsx)("p",{className:"m-0 py-4 text-center text-[0.85rem] text-muted",children:"No tracked time in this period."}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-3",children:[(0,t.jsx)(g,{label:"Interruptions",value:String(e.interruptionCount),detail:`${y(e.interruptionFrequencyPerDay)} / active day`}),(0,t.jsx)(g,{label:"Context switches",value:String(e.contextSwitchCount),detail:`${y(e.contextSwitchesPerDay)} / active day`}),(0,t.jsx)(g,{label:"Deep-work streak",value:e.longestDeepWorkStreakMs>0?(0,r.format_duration)(e.longestDeepWorkStreakMs,a):"None",detail:e.longestDeepWorkStreakEntryCount>0?`${e.longestDeepWorkStreakEntryCount} focused entries`:`${(0,r.format_duration)(e.deepWorkThresholdMs,a)}+ entries`})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-3 lg:grid-cols-2",children:[(0,t.jsx)(p,{title:"Best focus hours",children:0===e.bestFocusHours.length?(0,t.jsx)(M,{label:"No strong focus hour yet."}):e.bestFocusHours.map(e=>(0,t.jsx)(b,{label:e.hourLabel,value:(0,r.format_duration)(e.totalMs,a),detail:`${e.entryCount} touched entries`},e.hourIndex))}),(0,t.jsx)(p,{title:"Recurring idle windows",children:0===e.recurringIdleWindows.length?(0,t.jsx)(M,{label:"No recurring idle window found."}):e.recurringIdleWindows.map(e=>(0,t.jsx)(b,{label:e.hourLabel,value:`${e.dayCount} days`,detail:`${(0,r.format_duration)(e.totalIdleMs,a)} idle`},e.hourIndex))})]}),(0,t.jsx)(p,{title:"Usual project starts",children:0===e.sheetStartSuggestions.length?(0,t.jsx)(M,{label:"Not enough repeated project starts yet."}):e.sheetStartSuggestions.map(e=>(0,t.jsx)(b,{label:`You usually start ${e.sheetName} around ${e.hourLabel}`,value:`${Math.round(100*e.confidence)}%`,detail:`${e.startCount} starts in this hour`},`${e.sheetName}-${e.hourIndex}`))})]})]})}function g({label:e,value:a,detail:s}){return(0,t.jsxs)("article",{className:"rounded-md border border-panel-border bg-background p-3",children:[(0,t.jsx)("p",{className:"m-0 text-[0.68rem] font-semibold uppercase tracking-[0.06em] text-muted",children:e}),(0,t.jsx)("p",{className:"m-0 mt-1 font-mono text-[1.05rem] font-semibold text-accent",children:a}),(0,t.jsx)("p",{className:"m-0 mt-1 text-[0.78rem] text-muted",children:s})]})}function p({title:e,children:a}){return(0,t.jsxs)("section",{className:"rounded-md border border-panel-border bg-background p-3",children:[(0,t.jsx)("h4",{className:"m-0 text-[0.82rem] font-semibold",children:e}),(0,t.jsx)("ul",{className:"m-0 mt-2 flex list-none flex-col gap-2 p-0",children:a})]})}function b({label:e,value:a,detail:s}){return(0,t.jsxs)("li",{className:"flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1 text-[0.82rem]",children:[(0,t.jsx)("span",{className:"min-w-0 font-medium",children:e}),(0,t.jsx)("span",{className:"font-mono font-semibold text-accent",children:a}),(0,t.jsx)("span",{className:"basis-full text-[0.76rem] text-muted",children:s})]})}function M({label:e}){return(0,t.jsx)("li",{className:"text-[0.82rem] text-muted",children:e})}function y(e){return 0===e?"0":e<10?e.toFixed(1):e.toFixed(0)}function j({stats:e,duration_format:a}){let s=Math.round(100*(e.daysInMonth>0?e.trackedDays/e.daysInMonth:0));return(0,t.jsxs)("section",{className:"flex w-full flex-col gap-5 rounded-md border border-panel-border bg-panel p-5 shadow-sm","aria-label":"Month in review",style:{backgroundImage:"linear-gradient(135deg, color-mix(in srgb, var(--accent-soft) 60%, transparent) 0%, transparent 70%)"},children:[(0,t.jsxs)("header",{className:"flex flex-col gap-1",children:[(0,t.jsx)("span",{className:"text-[0.7rem] font-semibold uppercase tracking-[0.08em] text-accent",children:"Month in review"}),(0,t.jsx)("h2",{className:"m-0 text-[1.25rem] font-[650] tracking-tight",children:e.monthLabel}),(0,t.jsx)("p",{className:"m-0 text-[0.85rem] text-muted",children:0===e.totalMs?"No time tracked this month yet — start a timer to fill this in.":`Tracked on ${e.trackedDays} of ${e.daysInMonth} days (${s}%).`})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",children:[(0,t.jsx)(w,{label:"Total this month",value:(0,r.format_duration)(e.totalMs,a),detail:0===e.totalMs?"—":`${(0,r.format_duration)(e.averageActiveDayMs,a)} per active day`}),(0,t.jsx)(w,{label:"Best day",value:0===e.bestDayMs?"—":(0,r.format_duration)(e.bestDayMs,a),detail:e.bestDayLabel??"No tracked days yet"}),(0,t.jsx)(w,{label:"Top sheet",value:e.topSheetName??"—",detail:0===e.topSheetMs?"No tracked sheets":(0,r.format_duration)(e.topSheetMs,a)}),(0,t.jsx)(w,{label:"Top tag",value:e.topTag??"—",detail:0===e.topTagMs?"Tag entries to surface":(0,r.format_duration)(e.topTagMs,a)})]}),(0,t.jsxs)("ul",{className:"m-0 grid grid-cols-1 gap-2 p-0 text-[0.85rem] sm:grid-cols-3",children:[(0,t.jsx)(N,{label:"Current streak",value:`${e.currentStreakDays} day${1===e.currentStreakDays?"":"s"}`}),(0,t.jsx)(N,{label:"Longest streak",value:`${e.longestStreakDays} day${1===e.longestStreakDays?"":"s"}`}),(0,t.jsx)(N,{label:"Longest entry",value:0===e.longestEntryMs?"—":(0,r.format_duration)(e.longestEntryMs,a)}),(0,t.jsx)(N,{label:"Entries logged",value:String(e.totalEntries)}),(0,t.jsx)(N,{label:"Tracked days",value:`${e.trackedDays} / ${e.daysInMonth}`}),(0,t.jsx)(N,{label:"Coverage",value:`${s}%`})]})]})}function w({label:e,value:a,detail:s}){return(0,t.jsxs)("div",{className:"flex flex-col gap-1 rounded-md border border-panel-border bg-surface-raised/60 p-3.5",children:[(0,t.jsx)("span",{className:"text-[0.7rem] font-semibold uppercase tracking-[0.06em] text-muted",children:e}),(0,t.jsx)("span",{className:"truncate font-mono text-[1.05rem] font-semibold",children:a}),(0,t.jsx)("span",{className:"text-[0.78rem] text-muted",children:s})]})}function N({label:e,value:a}){return(0,t.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-md border border-panel-border/60 bg-surface-raised/40 px-3 py-2",children:[(0,t.jsx)("span",{className:"text-[0.78rem] text-muted",children:e}),(0,t.jsx)("span",{className:"font-mono font-semibold",children:a})]})}var v=e.i(52663);let _=[{value:"duration",label:"Duration"},{value:"name",label:"Name"},{value:"entry_count",label:"Entries"},{value:"active_first",label:"Active first"}];function k({sort:e,on_sort_change:a}){return(0,t.jsxs)("fieldset",{className:"m-0 flex w-full max-w-2xl flex-col gap-2 border-0 p-0",children:[(0,t.jsx)("legend",{className:"mb-2 text-[0.72rem] font-semibold uppercase tracking-[0.06em] text-muted",children:"Sort by"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",role:"group","aria-label":"Sort sheets by",children:_.map(s=>{let r=e===s.value;return(0,t.jsx)("button",{type:"button",className:`${(0,v.get_button_class_name)("ghost","small")} ${r?"border-accent-border bg-accent-soft text-foreground":""}`,"aria-pressed":r,onClick:()=>a(s.value),children:s.label},s.value)})})]})}let D=["#2dd4bf","#60a5fa","#a78bfa","#f472b6","#fb923c","#facc15","#34d399","#22d3ee","#f87171","#c084fc","#fbbf24","#4ade80"];function $(e){return Math.round(100*e)/100}function S({tag_breakdown:e,duration_format:a}){let n=(0,s.useMemo)(()=>(function(e){let t=e.reduce((e,t)=>e+t.totalMs,0);if(0===t)return[];let a=[],s=0;return e.forEach((e,r)=>{var n,l,o;let i,d,c,u,m;if(e.totalMs<=0)return;let x=e.totalMs/t,f=s*Math.PI*2,h=(s+x)*Math.PI*2;s+=x,a.push({tag:e.tag,color:(n=e.tag,"Untagged"===n?"#64748b":D[r%D.length]),ratio:x,total_ms:e.totalMs,path_data:(l=f,o=h,i=C(l,70),d=C(o,70),c=C(o,38),u=C(l,38),m=+(o-l>Math.PI),`M ${i.x} ${i.y} A 70 70 0 ${m} 1 ${d.x} ${d.y} L ${c.x} ${c.y} A 38 38 0 ${m} 0 ${u.x} ${u.y} Z`)})}),a})(e),[e]),l=(0,s.useMemo)(()=>e.reduce((e,t)=>e+t.totalMs,0),[e]),o=n.slice(0,8),i=Math.max(0,n.length-8);return 0===n.length||0===l?(0,t.jsx)(T,{title:"Time by tag",subtitle:"No tagged time in this period.",children:(0,t.jsx)(I,{})}):(0,t.jsx)(T,{title:"Time by tag",subtitle:"Multi-tag entries are split evenly across their tags.",children:(0,t.jsxs)("div",{className:"flex flex-col items-center gap-4 sm:flex-row sm:items-start",children:[(0,t.jsxs)("div",{className:"relative shrink-0",children:[(0,t.jsx)("svg",{viewBox:"0 0 160 160",className:"h-40 w-40",role:"img","aria-label":"Tag time distribution",children:1===n.length?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:80,cy:80,r:70,fill:n[0].color}),(0,t.jsx)("circle",{cx:80,cy:80,r:38,fill:"var(--panel)"})]}):n.map(e=>(0,t.jsx)("path",{d:e.path_data,fill:e.color},e.tag))}),(0,t.jsxs)("div",{className:"pointer-events-none absolute inset-0 flex flex-col items-center justify-center text-center",children:[(0,t.jsx)("span",{className:"text-[0.65rem] font-semibold uppercase tracking-[0.08em] text-muted",children:"Total"}),(0,t.jsx)("span",{className:"font-mono text-[0.85rem] font-semibold",children:(0,r.format_duration)(l,a)})]})]}),(0,t.jsxs)("ul",{className:"m-0 flex w-full flex-col gap-1.5 p-0",children:[o.map(e=>(0,t.jsxs)("li",{className:"flex items-center gap-2 text-[0.82rem]",children:[(0,t.jsx)("span",{"aria-hidden":!0,className:"inline-block h-2.5 w-2.5 shrink-0 rounded-sm",style:{backgroundColor:e.color}}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate font-medium",children:e.tag}),(0,t.jsxs)("span",{className:"shrink-0 font-mono text-muted",children:[Math.round(100*e.ratio),"%"]}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-foreground",children:(0,r.format_duration)(e.total_ms,a)})]},e.tag)),i>0?(0,t.jsxs)("li",{className:"text-[0.78rem] text-muted",children:["+ ",i," more ",1===i?"tag":"tags"]}):null]})]})})}function T({title:e,subtitle:a,children:s}){return(0,t.jsxs)("section",{className:"flex w-full flex-col gap-3 rounded-md border border-panel-border bg-panel p-4 shadow-sm",children:[(0,t.jsxs)("header",{className:"flex flex-col gap-0.5",children:[(0,t.jsx)("h3",{className:"m-0 text-[0.95rem] font-semibold",children:e}),void 0!==a?(0,t.jsx)("p",{className:"m-0 text-[0.78rem] text-muted",children:a}):null]}),s]})}function I(){return(0,t.jsxs)("div",{className:"flex flex-col items-center gap-2 py-3 text-center",children:[(0,t.jsx)("svg",{viewBox:"0 0 160 160",className:"h-28 w-28 opacity-40",role:"presentation",children:(0,t.jsx)("circle",{cx:80,cy:80,r:70,fill:"none",stroke:"var(--panel-border)",strokeWidth:32})}),(0,t.jsx)("p",{className:"m-0 text-[0.82rem] text-muted",children:"Tag your entries to see time distribution here."})]})}function C(e,t){return{x:$(80+t*Math.sin(e)),y:$(80-t*Math.cos(e))}}function O({trend:e,duration_format:a,current_label:s,previous_label:n}){var l;let o=(l=e.deltaMs)>0?{symbol:"▲",badge_class:"bg-accent-soft text-accent border border-accent-border"}:l<0?{symbol:"▼",badge_class:"bg-danger-soft text-danger border border-danger-border"}:{symbol:"—",badge_class:"bg-ghost-bg text-muted border border-panel-border"},i=function(e){if(0===e.previousMs)return 0===e.currentMs?"0%":"New";let t=100*Math.abs(e.deltaRatio);return t<.5?"~0%":`${t>=100?t.toFixed(0):t.toFixed(1)}%`}(e);return(0,t.jsxs)("div",{className:"flex flex-col gap-3 rounded-md border border-panel-border bg-panel p-4 shadow-sm",children:[(0,t.jsxs)("header",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("h3",{className:"m-0 text-[0.95rem] font-semibold",children:e.label}),(0,t.jsxs)("span",{className:`shrink-0 rounded-full px-2 py-0.5 text-[0.7rem] font-semibold ${o.badge_class}`,children:[o.symbol," ",i]})]}),(0,t.jsxs)("dl",{className:"m-0 grid grid-cols-2 gap-3",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,t.jsx)("dt",{className:"m-0 text-[0.7rem] font-semibold uppercase tracking-[0.06em] text-muted",children:s}),(0,t.jsx)("dd",{className:"m-0 font-mono text-[1.05rem] font-semibold",children:(0,r.format_duration)(e.currentMs,a)})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,t.jsx)("dt",{className:"m-0 text-[0.7rem] font-semibold uppercase tracking-[0.06em] text-muted",children:n}),(0,t.jsx)("dd",{className:"m-0 font-mono text-[1.05rem] font-semibold text-muted",children:(0,r.format_duration)(e.previousMs,a)})]})]}),(0,t.jsx)("p",{className:"m-0 text-[0.78rem] text-muted",children:function(e,t){if(0===e.previousMs&&0===e.currentMs)return"No tracked time in either period.";if(0===e.previousMs)return`${(0,r.format_duration)(e.currentMs,t)} more than last period.`;if(0===e.deltaMs)return"Identical to the previous period.";let a=e.deltaMs>0?"more":"less";return`${(0,r.format_duration)(Math.abs(e.deltaMs),t)} ${a} than the previous period.`}(e,a)})]})}let E=[{value:"dashboard",label:"Dashboard"},{value:"sheets",label:"Sheets"}];function A({active_tab:e,on_change:a}){return(0,t.jsx)("div",{role:"tablist","aria-label":"Reporting view",className:"inline-flex w-full max-w-2xl items-center gap-1 self-center rounded-full border border-panel-border bg-surface-raised/50 p-1",children:E.map(s=>{let r=s.value===e;return(0,t.jsx)("button",{type:"button",role:"tab","aria-selected":r,className:`${(0,v.get_button_class_name)("ghost","small")} flex-1 rounded-full border-transparent ${r?"bg-accent text-accent-text-on":"bg-transparent text-muted"}`,onClick:()=>a(s.value),children:s.label},s.value)})})}function L({weekday_distribution:e,duration_format:a}){let n=(0,s.useMemo)(()=>e.reduce((e,t)=>Math.max(e,t.totalMs),0),[e]),l=(0,s.useMemo)(()=>e.reduce((e,t)=>e+t.totalMs,0),[e]);return(0,t.jsxs)("section",{className:"flex w-full flex-col gap-3 rounded-md border border-panel-border bg-panel p-4 shadow-sm",children:[(0,t.jsxs)("header",{className:"flex flex-col gap-0.5",children:[(0,t.jsx)("h3",{className:"m-0 text-[0.95rem] font-semibold",children:"Day of week"}),(0,t.jsx)("p",{className:"m-0 text-[0.78rem] text-muted",children:"Where your week tends to lean."})]}),0===l?(0,t.jsx)("p",{className:"m-0 py-4 text-center text-[0.85rem] text-muted",children:"No tracked time in this period."}):(0,t.jsx)("ul",{className:"m-0 flex flex-col gap-1.5 p-0",children:e.map(e=>{let s=n>0?m(e.totalMs/n*100):0;return(0,t.jsxs)("li",{className:"grid grid-cols-[2.25rem_1fr_auto] items-center gap-2 text-[0.82rem]",children:[(0,t.jsx)("span",{className:"font-mono text-[0.78rem] text-muted",children:e.weekdayLabel}),(0,t.jsx)("span",{className:"block h-2 overflow-hidden rounded-full bg-surface-raised",role:"presentation",children:(0,t.jsx)("span",{className:"block h-full rounded-full bg-accent",style:{width:`${Math.max(s,4*(e.totalMs>0))}%`}})}),(0,t.jsx)("span",{className:"font-mono text-foreground",children:(0,r.format_duration)(e.totalMs,a)})]},e.weekdayIndex)})})]})}var W=e.i(75404),F=e.i(98636),K=e.i(36519),P=e.i(19402),R=e.i(43864),B=e.i(29263);function z(e,t){return(0,B.toDate)(e,t?.in).getDay()}function H(e,t,a,s=Date.now()){let r=+e.start;return Math.max(0,Math.min(null===e.end?s:+e.end,a)-Math.max(r,t))}function U(e){let t=[];for(let a=0;a<7;a+=1)for(let s=0;s<24;s+=1){let r=`${a}-${s}`;t.push({weekdayIndex:a,hourIndex:s,totalMs:e.get(r)??0})}return t}var q=e.i(39552);function Y(e,t,a,s=Date.now()){let r=[],n=(0,K.startOfDay)(new Date(t)),l=(0,K.startOfDay)(new Date(a));if(+n>+l)return r;let o=n;for(;+o<=+l;){let t=+(0,K.startOfDay)(o),a=+(0,R.endOfDay)(o),n=0;for(let r of e)for(let e of r.entries)n+=H(e,t,a,s);r.push({dateMs:t,dateLabel:(0,q.format)(o,"MMM d"),weekdayIndex:z(o),totalMs:n}),o=(0,F.addDays)(o,1)}return r}function G(e){let t=[];for(let a=1;a<e.length;a+=1){let s=e[a-1],r=e[a];if(void 0===s||void 0===r||!V(s.endMs,r.startMs))continue;let n=r.startMs-s.endMs;n<=0||t.push({startMs:s.endMs,endMs:r.startMs,durationMs:n})}return t}function V(e,t){let a=new Date(e),s=new Date(t);return+(0,K.startOfDay)(a)==+(0,K.startOfDay)(s)}function Z(e){let t=new Date(e);return t.setMinutes(0,0,0),t.getTime()}function J(e){let t=new Date;return t.setHours(e,0,0,0),(0,q.format)(t,"haaa")}var Q=e.i(22106),X=e.i(25402),ee=e.i(61837);function et(e,t,a,s=Date.now()){let r=0;for(let n of e)for(let e of n.entries)r+=H(e,t,a,s);return r}var ea=e.i(31113);let es="Untagged";function er(e,t,a,s=Date.now()){let r=new Map,n=0;for(let l of e)for(let e of l.entries){let l=H(e,t,a,s);if(l<=0)continue;let o=[];for(let t of e.tags)try{o.push((0,ea.normalize_stored_tag)(t))}catch{continue}let i=[...new Set(o)];if(n+=l,0===i.length){r.set(es,(r.get(es)??0)+l);continue}let d=l/i.length;for(let e of i)r.set(e,(r.get(e)??0)+d)}let l=[...r.entries()].map(([e,t])=>({tag:e,totalMs:t,ratio:n>0?t/n:0}));return l.sort((e,t)=>e.tag===es?1:t.tag===es?-1:t.totalMs-e.totalMs),l}var en=e.i(67584),el=e.i(7312),eo=e.i(78194);function ei(e,t,a=new Date,s=Date.now(),r=1){var n;let l=ed(t,a,r),o="week"===t?(n=void 0,(0,F.addDays)(a,-7,n)):(0,eo.subMonths)(a,1),i=ed(t,o,r),d=et(e,l.start,l.end,s),c=et(e,i.start,i.end,s),u=d-c;return{label:"week"===t?"This week vs last week":"This month vs last month",currentMs:d,previousMs:c,deltaMs:u,deltaRatio:c>0?u/c:0}}function ed(e,t,a){return"week"===e?{start:+(0,el.startOfWeek)(t,{weekStartsOn:a}),end:+(0,en.endOfWeek)(t,{weekStartsOn:a})}:{start:+(0,ee.startOfMonth)(t),end:+(0,Q.endOfMonth)(t)}}function ec(e,t){return 0===t?0:e/t}function eu(e,t=new Date,a=1){switch(e){case"week":return{startMs:+(0,el.startOfWeek)(t,{weekStartsOn:a}),endMs:+(0,en.endOfWeek)(t,{weekStartsOn:a})};case"month":return{startMs:+(0,ee.startOfMonth)(t),endMs:+(0,Q.endOfMonth)(t)};default:return{startMs:+(0,K.startOfDay)(t),endMs:+(0,R.endOfDay)(t)}}}var em=e.i(67999);function ex(e,t){let a=new Set,s=[];for(let r of[...e,...t]){let e=`${r.timestamp.getTime()}:${r.text}`;a.has(e)||(a.add(e),s.push(r))}return s.sort((e,t)=>e.timestamp.getTime()-t.timestamp.getTime()),s}var ef=e.i(1997),eh=e.i(54873),eg=e.i(68462),ep=e.i(46748);let eb={from_date:"",to_date:""},eM=["today","yesterday","week","month","last_month","year","last_year"];function ey(e,t){let a=[...e];switch(t){case"name":a.sort((e,t)=>e.sheetName.localeCompare(t.sheetName));break;case"entry_count":a.sort((e,t)=>t.entryCount!==e.entryCount?t.entryCount-e.entryCount:t.totalMs-e.totalMs);break;case"active_first":a.sort((e,t)=>e.hasActiveEntry!==t.hasActiveEntry?e.hasActiveEntry?-1:1:t.totalMs-e.totalMs);break;default:a.sort((e,t)=>t.totalMs-e.totalMs)}return a}var ej=e.i(1800),ew=e.i(12843);let eN={from_date:"",to_date:""};function ev({children:e}){return(0,t.jsx)("div",{className:"flex w-full max-w-5xl flex-col gap-5",children:e})}function e_({children:e}){return(0,t.jsx)("div",{className:"flex w-full max-w-2xl flex-col items-center gap-4",children:e})}function ek({label:e,value:a}){return(0,t.jsxs)("div",{className:"rounded-md border border-panel-border bg-panel p-3.5 shadow-sm",children:[(0,t.jsx)("p",{className:"m-0 text-[0.72rem] font-semibold uppercase tracking-[0.06em] text-muted",children:e}),(0,t.jsx)("p",{className:"m-0 mt-1 text-[1.1rem] font-[650] tracking-tight",children:a})]})}function eD({title:e,aria_label:a,muted:s=!1,children:r}){return(0,t.jsxs)("section",{className:"flex w-full max-w-2xl flex-col gap-2",children:[(0,t.jsx)("h2",{className:`m-0 text-[0.72rem] font-semibold uppercase tracking-[0.06em] ${s?"text-muted":"text-foreground"}`,children:e}),(0,t.jsx)("ul",{className:"m-0 flex list-none flex-col gap-2 p-0","aria-label":a,children:r})]})}function e$({sheet:e,grand_total_ms:a,duration_format:s}){let n=a>0?Math.round(e.totalMs/a*100):0,l=a>0?m(e.totalMs/a*100):0;return(0,t.jsxs)("li",{className:"rounded-md border border-panel-border bg-panel p-3.5 shadow-sm",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[(0,t.jsx)("h2",{className:"m-0 min-w-0 truncate text-[1rem] font-semibold",children:e.sheetName}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-[0.95rem] font-semibold text-accent",children:(0,r.format_duration)(e.totalMs,s)})]}),(0,t.jsx)("div",{className:"mt-2.5 h-1.5 overflow-hidden rounded-full bg-surface-raised",role:"presentation",children:(0,t.jsx)("div",{className:"h-full rounded-full bg-accent",style:{width:`${l}%`}})}),(0,t.jsxs)("p",{className:"m-0 mt-2 flex flex-wrap gap-x-3 gap-y-0.5 text-[0.82rem] text-muted",children:[(0,t.jsxs)("span",{children:[n,"% of total"]}),(0,t.jsxs)("span",{children:[e.entryCount," ",1===e.entryCount?"entry":"entries"]}),(0,t.jsx)("span",{children:0===e.entryCount?"No average":`${(0,r.format_duration)(e.averageEntryMs,s)} avg`}),e.hasActiveEntry?(0,t.jsx)("span",{className:"text-accent",children:"Timer running"}):null]})]})}function eS({sheet:e,in_range:a}){let s=a?"No time in range":0===e.entryCount?"No entries":"No tracked time";return(0,t.jsxs)("li",{className:"rounded-md border border-dashed border-panel-border bg-surface-raised/60 px-3.5 py-2.5",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[(0,t.jsx)("h3",{className:"m-0 min-w-0 truncate text-[0.95rem] font-medium text-muted",children:e.sheetName}),(0,t.jsx)("span",{className:"shrink-0 text-[0.82rem] text-muted",children:s})]}),e.hasActiveEntry?(0,t.jsx)("p",{className:"m-0 mt-1.5 text-[0.82rem] text-accent",children:"Timer running"}):null]})}e.s(["ReportingView",0,function({source_sheets:e,reference_now:l}){let o=(0,a.useSearchParams)(),d=(0,ej.use_duration_format)(),c=(0,ew.use_week_starts_on)(),[u,m]=(0,s.useState)("dashboard"),[g,p]=(0,s.useState)(()=>ef.default_reporting_sort_preference.get_server_snapshot()),[b,M]=(0,s.useState)(eN),[y,w]=(0,s.useState)(l);(0,s.useEffect)(()=>{M(function(e=eg.default_reporting_range_preference.read(),t="monday"){return"none"===e?eb:(0,ep.get_reporting_date_range_shortcut_inputs)(e,new Date,(0,n.week_starts_on_to_index)(t))}(void 0,c)),p(ef.default_reporting_sort_preference.read())},[c]),(0,s.useEffect)(()=>{let e=function(e){if(null===e)return null;let t=e.trim().toLowerCase();return eM.includes(t)?t:null}(o.get("range"));null!==e&&M((0,ep.get_reporting_date_range_shortcut_inputs)(e,new Date,(0,n.week_starts_on_to_index)(c)))},[o,c]),(0,s.useEffect)(()=>{w(l)},[l]),(0,s.useEffect)(()=>{w(Date.now())},[b,e,c]);let N=(0,s.useMemo)(()=>e.map(e=>({name:e.name,activeEntryID:e.activeEntryID,entries:e.entries.map(e=>({id:e.id,start:new Date(e.start),end:null===e.end?null:new Date(e.end),description:"",tags:e.tags,notes:[]}))})),[e]),v=(0,s.useMemo)(()=>(0,eh.get_date_range_ms_from_inputs)(b.from_date,b.to_date),[b]),_=b.from_date.length>0!=b.to_date.length>0||b.from_date.length>0&&b.to_date.length>0&&null===v,D=(0,n.week_starts_on_to_index)(c),{stats:$,analytics:T}=(0,s.useMemo)(()=>({stats:function(e,t=null,a=Date.now(),s=1){let r=e.map(e=>{let s,r,n;return null===t?(s=function(e){let{activeEntryID:t,entries:a,name:s}=e;return(function(e){let t=new Map;for(let a of e){let e=t.get(a.id);if(void 0===e){t.set(a.id,a);continue}if(null===a.end&&null!==e.end){t.set(a.id,{...a,notes:ex(a.notes,e.notes)});continue}if(null===e.end&&null!==a.end){t.set(a.id,{...e,notes:ex(e.notes,a.notes)});continue}t.set(a.id,{...e,notes:ex(e.notes,a.notes)})}return[...t.values()].sort((e,t)=>e.id-t.id)})(a).map(e=>{var a;return a=t===e.id&&null===e.end,{id:e.id,description:e.description,start:e.start.toISOString(),end:null===e.end?null:e.end.toISOString(),tags:e.tags,notes:e.notes.map(({timestamp:e,text:t})=>({timestamp:e.toISOString(),text:t})),sheetName:s,durationMs:function(e,t=Date.now()){let{end:a,start:s}=e;return Math.max(0,(null===a?t:+a)-s)}(e),isActive:a,...!0===e.archived?{archived:!0}:{}}})}(e),r=e.entries.length,n=(0,em.get_serialized_entries_total_ms)(s),{sheetName:e.name,totalMs:n,entryCount:r,averageEntryMs:ec(n,r),hasActiveEntry:null!==e.activeEntryID}):function(e,t,a,s=Date.now()){let r=0,n=0,l=!1;for(let o of e.entries){let i=H(o,t,a,s);i<=0||(r+=i,n+=1,e.activeEntryID===o.id&&null===o.end&&(l=!0))}return{sheetName:e.name,totalMs:r,entryCount:n,averageEntryMs:ec(r,n),hasActiveEntry:l}}(e,t.startMs,t.endMs,a)}),{activeSheets:n,idleSheets:l}=function(e){let t=[],a=[];for(let s of e)0===s.entryCount||0===s.totalMs?a.push(s):t.push(s);return{activeSheets:t,idleSheets:a}}(r),o=r.reduce((e,t)=>e+t.totalMs,0),i=r.reduce((e,t)=>e+t.entryCount,0);return{activeSheets:n,idleSheets:l,grandTotalMs:o,totalEntryCount:i,grandAverageEntryMs:ec(o,i),periodTotals:null===t?function(e,t=new Date,a=Date.now(),s=1){let r=eu("today",t,s),n=eu("week",t,s),l=eu("month",t,s);return{todayMs:et(e,r.startMs,r.endMs,a),weekMs:et(e,n.startMs,n.endMs,a),monthMs:et(e,l.startMs,l.endMs,a)}}(e,new Date(a),a,s):{todayMs:0,weekMs:0,monthMs:0}}}(N,v,y,D),analytics:function(e,t,a=Date.now(),s=1){let r=new Date(a),n=(0,F.addDays)((0,K.startOfDay)(r),1)-1,l=+(0,K.startOfDay)((0,P.subDays)(r,29)),o=null===t?l:t.startMs,i=null===t?n:t.endMs,d=Y(e,o,i,a),c=er(e,o,i,a),u=function(e,t=1){let a=Array(7).fill(0);for(let t of e)a[t.weekdayIndex]+=t.totalMs;let s=(0,el.startOfWeek)(new Date,{weekStartsOn:t});return Array.from({length:7},(e,r)=>{let n=(0,F.addDays)(s,r),l=(t+r)%7;return{weekdayIndex:l,weekdayLabel:(0,q.format)(n,"EEE"),totalMs:a[l]}})}(d,s);return{dailyBuckets:d,tagBreakdown:c,weekdayDistribution:u,heatmap:function(e,t,a,s=Date.now()){let r=new Map,n=(0,K.startOfDay)(new Date(t)),l=(0,K.startOfDay)(new Date(a));if(+n>+l)return U(r);let o=n;for(;+o<=+l;){let t=z(o),a=+o,n=+(0,R.endOfDay)(o);for(let l=0;l<24;l+=1){let o=a+36e5*l,i=Math.min(o+36e5-1,n),d=0;for(let t of e)for(let e of t.entries)d+=H(e,o,i,s);if(d<=0)continue;let c=`${t}-${l}`;r.set(c,(r.get(c)??0)+d)}o=(0,F.addDays)(o,1)}return U(r)}(e,o,i,a),weekTrend:ei(e,"week",r,a,s),monthTrend:ei(e,"month",r,a,s),monthInReview:function(e,t=new Date,a=Date.now()){let s,r,n,l,o=(0,ee.startOfMonth)(t),i=(0,Q.endOfMonth)(t),d=(0,q.format)(o,"MMMM yyyy"),c=(r=(s=(0,B.toDate)(o,void 0)).getFullYear(),n=s.getMonth(),(l=(0,X.constructFrom)(s,0)).setFullYear(r,n+1,0),l.setHours(0,0,0,0),l.getDate()),u=Y(e,+o,+i,a),m=er(e,+o,+i,a),x=0,f=0,h=0,g=-1;u.forEach((e,t)=>{x+=e.totalMs,e.totalMs>0&&(f+=1),e.totalMs>h&&(h=e.totalMs,g=t)});let p=0,b=0,M=new Map;for(let t of e){let e=0;for(let s of t.entries){let t=H(s,+o,+i,a);!(t<=0)&&(p+=1,e+=t,t>b&&(b=t))}e>0&&M.set(t.name,e)}let y=null,j=0;for(let[e,t]of M)t>j&&(j=t,y=e);let w=null,N=0;for(let e of m)"Untagged"!==e.tag&&e.totalMs>N&&(N=e.totalMs,w=e.tag);let v=function(e,t=new Date,a=Date.now()){let s=(0,K.startOfDay)(t);0>=et(e,+s,+(0,R.endOfDay)(s),a)&&(s=(0,P.subDays)(s,1));let r=0;for(let t=0;t<3660&&!(0>=et(e,+(0,K.startOfDay)(s),+(0,R.endOfDay)(s),a));t+=1){;r+=1,s=(0,P.subDays)(s,1)}return r}(e,t,a),_=function(e){let t=0,a=0;for(let s of e)s.totalMs>0?(a+=1,t=Math.max(t,a)):a=0;return t}(u),k=-1===g?null:(0,q.format)(new Date(u[g].dateMs),"EEE, MMM d"),D=f>0?x/f:0;return{monthLabel:d,totalMs:x,trackedDays:f,daysInMonth:c,bestDayMs:h,bestDayLabel:k,longestEntryMs:b,totalEntries:p,topSheetName:y,topSheetMs:j,topTag:w,topTagMs:N,currentStreakDays:v,longestStreakDays:_,averageActiveDayMs:D}}(e,r,a),focusInsights:function(e,t,a=Date.now()){var s,r,n,l;let o=function(e,t,a){let s=[];for(let r of e)for(let e of r.entries){let n=null===e.end?a:e.end.getTime(),l=Math.max(e.start.getTime(),t.startMs),o=Math.min(n,t.endMs);o<=l||s.push({sheetName:r.name,startMs:l,endMs:o,durationMs:o-l})}return s.sort((e,t)=>e.startMs-t.startMs)}(e,t,a),i=new Set(o.map(e=>+(0,K.startOfDay)(e.startMs))).size,d=G(o).filter(e=>e.durationMs>0&&e.durationMs<=9e5),c=function(e){let t=0;for(let a=1;a<e.length;a+=1){let s=e[a-1],r=e[a];void 0!==s&&void 0!==r&&s.sheetName!==r.sheetName&&V(s.endMs,r.startMs)&&(t+=1)}return t}(o),u=function(e){let t=0,a=0,s=null,r=0,n=0;for(let l of e){if(l.durationMs<27e5){t>r&&(r=t,n=a),t=0,a=0,s=null;continue}null!==s&&l.startMs-s<=9e5&&V(s,l.startMs)||(t>r&&(r=t,n=a),t=0,a=0),t+=l.durationMs,a+=1,s=l.endMs}return t>r&&(r=t,n=a),{totalMs:r,entryCount:n}}(o);return{activeDayCount:i,bestFocusHours:function(e){let t=new Map;for(let a of e){let e=Z(a.startMs);for(;e<a.endMs;){let s=new Date(e).getHours(),r=e+36e5,n=Math.max(a.startMs,e),l=Math.max(0,Math.min(a.endMs,r)-n);if(l>0){let e=t.get(s)??{hourIndex:s,totalMs:0,entryKeys:new Set};e.totalMs+=l,e.entryKeys.add(`${a.sheetName}:${a.startMs}:${a.endMs}`),t.set(s,e)}e=r}}return Array.from(t.values()).sort((e,t)=>t.totalMs-e.totalMs).slice(0,3).map(e=>({hourIndex:e.hourIndex,hourLabel:J(e.hourIndex),totalMs:e.totalMs,entryCount:e.entryKeys.size}))}(o),interruptionCount:d.length,interruptionFrequencyPerDay:(s=d.length,(r=i)>0?s/r:0),contextSwitchCount:c,contextSwitchesPerDay:(n=c,(l=i)>0?n/l:0),longestDeepWorkStreakMs:u.totalMs,longestDeepWorkStreakEntryCount:u.entryCount,recurringIdleWindows:function(e){let t=G(e).filter(e=>e.durationMs>=18e5),a=new Map;for(let e of t){let t=Z(e.startMs);for(;t<e.endMs;){let s=new Date(t).getHours(),r=t+36e5,n=Math.max(e.startMs,t),l=Math.max(0,Math.min(e.endMs,r)-n);if(l>0){let t=a.get(s)??{hourIndex:s,dayKeys:new Set,totalIdleMs:0};t.dayKeys.add(+(0,K.startOfDay)(new Date(e.startMs))),t.totalIdleMs+=l,a.set(s,t)}t=r}}return Array.from(a.values()).filter(e=>e.dayKeys.size>=2).sort((e,t)=>t.dayKeys.size!==e.dayKeys.size?t.dayKeys.size-e.dayKeys.size:t.totalIdleMs-e.totalIdleMs).slice(0,3).map(e=>({hourIndex:e.hourIndex,hourLabel:J(e.hourIndex),dayCount:e.dayKeys.size,totalIdleMs:e.totalIdleMs}))}(o),sheetStartSuggestions:function(e){let t=new Map;for(let a of e){let e=new Date(a.startMs).getHours(),s=t.get(a.sheetName)??new Map;s.set(e,(s.get(e)??0)+1),t.set(a.sheetName,s)}let a=[];for(let[e,s]of t){let t=Array.from(s.values()).reduce((e,t)=>e+t,0);if(t<3)continue;let[r,n]=Array.from(s.entries()).sort((e,t)=>t[1]-e[1])[0]??[0,0];n<2||a.push({sheetName:e,hourIndex:r,hourLabel:J(r),startCount:n,confidence:n/t})}return a.sort((e,t)=>t.confidence!==e.confidence?t.confidence-e.confidence:t.startCount-e.startCount).slice(0,3)}(o),deepWorkThresholdMs:27e5,interruptionGapThresholdMs:9e5,idleWindowThresholdMs:18e5}}(e,{startMs:o,endMs:i},a)}}(N,v,y,D)}),[N,v,D,y]),{activeSheets:I,grandAverageEntryMs:C,grandTotalMs:E,idleSheets:ea,periodTotals:es,totalEntryCount:en}=$,eo=I.length+ea.length,ed=null===v,eT=(0,s.useMemo)(()=>ey(I,g),[I,g]),eI=(0,s.useMemo)(()=>ey(ea,g),[ea,g]),eC=null===v?"Last 30 days of activity.":`${T.dailyBuckets.length} days in the selected range.`;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(W.TrackerTopbar,{breadcrumb:{current:"Reporting"}}),(0,t.jsxs)("main",{className:"mx-auto flex w-full max-w-[1120px] flex-col items-center gap-6 px-5 pb-12 pt-6",children:[(0,t.jsxs)("header",{className:"flex w-full max-w-2xl flex-col gap-3",children:[(0,t.jsx)("h1",{className:"m-0 text-center text-[1.5rem] font-[650] tracking-tight",children:"Reporting"}),(0,t.jsx)("p",{className:"m-0 max-w-md self-center text-center text-[0.9rem] leading-relaxed text-muted",children:null===v?"A snapshot of where your time has been going.":"Metrics filtered to the selected date range."})]}),(0,t.jsx)(A,{active_tab:u,on_change:m}),(0,t.jsx)(f.ReportingDateRangePicker,{range:b,is_invalid:_,on_range_change:M,on_clear:()=>M(eN)}),(0,t.jsxs)("section",{className:"grid w-full max-w-5xl grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-4","aria-label":"Summary",children:[(0,t.jsx)(ek,{label:null===v?"Total tracked":"In range",value:(0,r.format_duration)(E,d)}),(0,t.jsx)(ek,{label:"Avg per entry",value:(0,r.format_duration)(C,d)}),(0,t.jsx)(ek,{label:"Sheets",value:String(eo)}),(0,t.jsx)(ek,{label:"Entries",value:String(en)})]}),ed?(0,t.jsxs)("section",{className:"grid w-full max-w-5xl grid-cols-1 gap-2 sm:grid-cols-3","aria-label":"Period totals",children:[(0,t.jsx)(ek,{label:"Today",value:(0,r.format_duration)(es.todayMs,d)}),(0,t.jsx)(ek,{label:"This week",value:(0,r.format_duration)(es.weekMs,d)}),(0,t.jsx)(ek,{label:"This month",value:(0,r.format_duration)(es.monthMs,d)})]}):null,0===eo?(0,t.jsx)("p",{className:"m-0 w-full max-w-2xl text-center text-[0.9rem] text-muted",children:"No sheets yet. Create a sheet on the tracker to start logging time."}):_?(0,t.jsx)("p",{className:"m-0 w-full max-w-2xl text-center text-[0.9rem] text-muted",children:"Choose both dates to filter metrics, or clear the range to see all time."}):"dashboard"===u?(0,t.jsxs)(ev,{children:[(0,t.jsx)(j,{stats:T.monthInReview,duration_format:d}),(0,t.jsxs)("div",{className:"grid w-full grid-cols-1 gap-3 lg:grid-cols-2",children:[(0,t.jsx)(O,{trend:T.weekTrend,duration_format:d,current_label:"This week",previous_label:"Last week"}),(0,t.jsx)(O,{trend:T.monthTrend,duration_format:d,current_label:"This month",previous_label:"Last month"})]}),(0,t.jsx)(x,{daily_buckets:T.dailyBuckets,duration_format:d,subtitle:eC}),(0,t.jsx)(h,{insights:T.focusInsights,duration_format:d}),(0,t.jsxs)("div",{className:"grid w-full grid-cols-1 gap-3 lg:grid-cols-2",children:[(0,t.jsx)(S,{tag_breakdown:T.tagBreakdown,duration_format:d}),(0,t.jsx)(L,{weekday_distribution:T.weekdayDistribution,duration_format:d})]}),(0,t.jsx)(i,{heatmap:T.heatmap,duration_format:d,week_starts_on:c})]}):(0,t.jsxs)(e_,{children:[(0,t.jsx)(k,{sort:g,on_sort_change:p}),0===I.length?(0,t.jsx)("p",{className:"m-0 w-full max-w-2xl text-center text-[0.9rem] text-muted",children:null===v?"No tracked time yet. Check in on a sheet to see stats here.":"No tracked time in this date range."}):(0,t.jsx)(eD,{title:"Tracked sheets",aria_label:"Tracked sheet statistics",children:eT.map(e=>(0,t.jsx)(e$,{sheet:e,grand_total_ms:E,duration_format:d},e.sheetName))}),ea.length>0?(0,t.jsx)(eD,{title:null===v?"Empty sheets":"Sheets in range",aria_label:"Sheets without time in range",muted:!0,children:eI.map(e=>(0,t.jsx)(eS,{sheet:e,in_range:null!==v},e.sheetName))}):null]})]})]})}],68120)}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,83821,60145,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.DAILY_FOCUS_TARGET_MINUTES_STORAGE_KEY,default_value:r.DAILY_FOCUS_TARGET_MINUTES_DEFAULT,is_valid:e=>{if(!/^\d+$/.test(e))return!1;let t=Number.parseInt(e,10);return t>=30&&t<=720}});e.s(["daily_focus_target_minutes_preference",0,s],83821);let a=(0,t.create_ui_preference_store)({storage_key:r.WEEKLY_FOCUS_TARGET_MINUTES_STORAGE_KEY,default_value:r.WEEKLY_FOCUS_TARGET_MINUTES_DEFAULT,is_valid:e=>{if(!/^\d+$/.test(e))return!1;let t=Number.parseInt(e,10);return t>=60&&t<=4200}});e.s(["weekly_focus_target_minutes_preference",0,a],60145)},1238,51703,74597,77130,56442,73228,e=>{"use strict";e.s(["parse_focus_goals_by_name",0,function(e){if(0===e.length)return{};try{let t=JSON.parse(e);if(null===t||"object"!=typeof t||Array.isArray(t))return{};let r={};for(let[e,s]of Object.entries(t)){if(null===s||"object"!=typeof s)continue;let t={};"string"==typeof s.daily&&s.daily.length>0&&(t.daily=s.daily),"string"==typeof s.weekly&&s.weekly.length>0&&(t.weekly=s.weekly),(void 0!==t.daily||void 0!==t.weekly)&&(r[e]=t)}return r}catch{return{}}}],1238);var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.FOCUS_GOAL_SCOPE_STORAGE_KEY,default_value:r.FOCUS_GOAL_SCOPE_DEFAULT,is_valid:e=>"global"===e||"sheet"===e||"tag"===e});e.s(["focus_goal_scope_preference",0,s],51703);let a=(0,t.create_ui_preference_store)({storage_key:r.FOCUS_GOAL_SHEET_NAME_STORAGE_KEY,default_value:r.FOCUS_GOAL_SHEET_NAME_DEFAULT,is_valid:e=>e.trim().length>0});e.s(["focus_goal_sheet_name_preference",0,a],74597);let n=(0,t.create_ui_preference_store)({storage_key:r.FOCUS_GOAL_TAG_NAME_STORAGE_KEY,default_value:r.FOCUS_GOAL_TAG_NAME_DEFAULT,is_valid:e=>e.trim().length>0});e.s(["focus_goal_tag_name_preference",0,n],77130);let l=(0,t.create_ui_preference_store)({storage_key:r.FOCUS_GOALS_PER_SHEET_STORAGE_KEY,default_value:r.FOCUS_GOALS_PER_SHEET_DEFAULT,is_valid:e=>{if(0===e.length)return!1;try{let t=JSON.parse(e);return null!==t&&"object"==typeof t&&!Array.isArray(t)}catch{return!1}}});e.s(["focus_goals_per_sheet_preference",0,l],56442);let o=(0,t.create_ui_preference_store)({storage_key:r.FOCUS_GOALS_PER_TAG_STORAGE_KEY,default_value:r.FOCUS_GOALS_PER_TAG_DEFAULT,is_valid:e=>{if(0===e.length)return!1;try{let t=JSON.parse(e);return null!==t&&"object"==typeof t&&!Array.isArray(t)}catch{return!1}}});e.s(["focus_goals_per_tag_preference",0,o],73228)},37392,e=>{"use strict";var t=e.i(8063),r=e.i(70096),s=e.i(51268),a=e.i(29539),n=e.i(32584),l=e.i(1238),o=e.i(83821),i=e.i(51703),_=e.i(74597),u=e.i(77130),c=e.i(56442),d=e.i(73228),m=e.i(56996),g=e.i(8654),f=e.i(76900),p=e.i(60145),b=e.i(26740),h=e.i(1800);function y(e){if("sheet"===e.scope&&e.sheet_name.length>0){let t=(0,l.parse_focus_goals_by_name)(e.per_sheet_json)[e.sheet_name];return void 0===t?{daily_minutes:null,weekly_minutes:null}:{daily_minutes:t.daily??e.global_daily,weekly_minutes:t.weekly??e.global_weekly}}if("tag"===e.scope&&e.tag_name.length>0){let t=(0,l.parse_focus_goals_by_name)(e.per_tag_json)[e.tag_name];return void 0===t?{daily_minutes:null,weekly_minutes:null}:{daily_minutes:t.daily??e.global_daily,weekly_minutes:t.weekly??e.global_weekly}}return{daily_minutes:e.global_daily,weekly_minutes:e.global_weekly}}function k(e,t,r){return"sheet"===e&&0===t.length||"tag"===e&&0===r.length?"global":e}function x(e,t,r,s){let a="daily"===e?"Relevant goal":"Weekly goal";return"sheet"===t&&r.length>0?`${a} \xb7 ${r}`:"tag"===t&&s.length>0?`${a} \xb7 @${s}`:a}function S({scope:e,title:s,tracked_ms:l,target_ms:o,duration_format:i,activePomodoro:_}){let u=o>0?Math.min(100,l/o*100):0,c=Math.max(0,o-l);return(0,t.jsx)("section",{className:"mb-4 rounded-md border border-panel-border bg-panel px-4 py-3 shadow-sm","aria-label":s,"aria-live":"polite",children:(0,t.jsxs)("div",{className:"flex flex-wrap items-stretch justify-between gap-3",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[(0,t.jsx)("p",{className:"m-0 text-[0.72rem] font-semibold uppercase tracking-[0.06em] text-muted",children:s}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:["daily"===e?(0,t.jsx)(r.default,{href:"/settings/goals#focus-goals-nudges",className:"inline-flex h-6 w-6 items-center justify-center rounded border border-panel-border text-muted no-underline hover:bg-surface-hover hover:text-foreground","aria-label":"Open daily focus target settings",title:"Daily focus target settings",children:(0,t.jsx)(a.SettingsIcon,{})}):null,(0,t.jsxs)("p",{className:"m-0 font-mono text-[0.78rem] font-semibold text-accent",children:[Math.round(u),"%"]})]})]}),(0,t.jsxs)("div",{className:"mt-2 flex items-baseline justify-between gap-3",children:[(0,t.jsxs)("p",{className:"m-0 font-mono text-[1.35rem] font-semibold leading-none text-foreground",children:[(0,n.format_duration)(l,i),(0,t.jsxs)("span",{className:"ml-1 text-[0.85rem] font-medium text-muted",children:["/ ",(0,n.format_duration)(o,i)]})]}),(0,t.jsxs)("p",{className:"m-0 text-[0.78rem] text-muted",children:[(0,n.format_duration)(c,i)," left"," ","daily"===e?"today":"this week"]})]}),(0,t.jsx)("progress",{className:"mt-3 h-1.5 w-full overflow-hidden rounded-full bg-accent-soft [&::-webkit-progress-bar]:rounded-full [&::-webkit-progress-bar]:bg-accent-soft [&::-webkit-progress-value]:rounded-full [&::-webkit-progress-value]:bg-accent [&::-moz-progress-bar]:rounded-full [&::-moz-progress-bar]:bg-accent",max:100,value:Math.round(u)})]}),null===_?null:(0,t.jsxs)("aside",{className:"min-w-52 rounded-md border border-panel-border bg-surface-raised px-3 py-2.5",children:[(0,t.jsx)("p",{className:"m-0 text-[0.68rem] font-semibold uppercase tracking-[0.06em] text-muted",children:"Active Pomodoro"}),(0,t.jsx)("p",{className:"m-0 mt-1 text-[0.82rem] font-semibold text-foreground",children:_.phase_label}),(0,t.jsx)("p",{className:"m-0 mt-1 font-mono text-[1.25rem] font-semibold leading-none text-accent",children:_.remaining_label})]})]})})}e.s(["FocusGoalsNudgesBanner",0,function({on_check_in_shortcut:e,has_running_timer:r=!1,initial_focus_nudges_status:a}){var l;let v=(0,h.use_duration_format)(),w=(0,s.useSyncExternalStore)(m.focus_nudges_enabled_preference.subscribe,m.focus_nudges_enabled_preference.get_snapshot,m.focus_nudges_enabled_preference.get_server_snapshot),E=(0,s.useSyncExternalStore)(o.daily_focus_target_minutes_preference.subscribe,o.daily_focus_target_minutes_preference.get_snapshot,o.daily_focus_target_minutes_preference.get_server_snapshot),T=(0,s.useSyncExternalStore)(p.weekly_focus_target_minutes_preference.subscribe,p.weekly_focus_target_minutes_preference.get_snapshot,p.weekly_focus_target_minutes_preference.get_server_snapshot),A=(0,s.useSyncExternalStore)(g.no_log_reminder_minutes_preference.subscribe,g.no_log_reminder_minutes_preference.get_snapshot,g.no_log_reminder_minutes_preference.get_server_snapshot),N=(0,s.useSyncExternalStore)(f.overwork_alert_hours_preference.subscribe,f.overwork_alert_hours_preference.get_snapshot,f.overwork_alert_hours_preference.get_server_snapshot),O=(0,s.useSyncExternalStore)(i.focus_goal_scope_preference.subscribe,i.focus_goal_scope_preference.get_snapshot,i.focus_goal_scope_preference.get_server_snapshot),j=(0,s.useSyncExternalStore)(_.focus_goal_sheet_name_preference.subscribe,_.focus_goal_sheet_name_preference.get_snapshot,_.focus_goal_sheet_name_preference.get_server_snapshot),L=(0,s.useSyncExternalStore)(u.focus_goal_tag_name_preference.subscribe,u.focus_goal_tag_name_preference.get_snapshot,u.focus_goal_tag_name_preference.get_server_snapshot),M=(0,s.useSyncExternalStore)(c.focus_goals_per_sheet_preference.subscribe,c.focus_goals_per_sheet_preference.get_snapshot,c.focus_goals_per_sheet_preference.get_server_snapshot),G=(0,s.useSyncExternalStore)(d.focus_goals_per_tag_preference.subscribe,d.focus_goals_per_tag_preference.get_snapshot,d.focus_goals_per_tag_preference.get_server_snapshot),[U,C]=(0,s.useState)(a??null),[F,D]=(0,s.useState)(null),[I,R]=(0,s.useState)(!1),[K,P]=(0,s.useState)(!1);(0,s.useEffect)(()=>{let e=()=>{try{var e;let t=globalThis.localStorage.getItem(b.POMODORO_STORAGE_KEY);if(null===t)return null;let r=JSON.parse(t).state;if(r?.status!=="running"||null==r.deadline_at_ms)return null;let s=Math.max(0,r.deadline_at_ms-Date.now()),a=Math.floor(s/6e4),n=Math.floor(s%6e4/1e3);return{phase_label:(e=r.phase,"work"===e?"Focus":"short_break"===e?"Short break":"Long break"),remaining_label:`${a.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}`}}catch{return null}},t=globalThis.setTimeout(()=>{D(e())},0),r=globalThis.setInterval(()=>{D(e())},1e3);return()=>{globalThis.clearTimeout(t),globalThis.clearInterval(r)}},[]),(0,s.useEffect)(()=>{if("true"!==w)return;let e=!1,t=async()=>{try{let t=new URLSearchParams;t.set("scope",k(O,j,L)),"sheet"===O&&j.length>0&&t.set("sheet",j),"tag"===O&&L.length>0&&t.set("tag",L);let r=await fetch(`/api/focus-nudges/status?${t.toString()}`);if(!r.ok)return;let s=await r.json();e||C(s)}catch{}};("global"!==k(O,j,L)||void 0===a)&&t();let r=globalThis.setInterval(()=>{t()},6e4);return()=>{e=!0,globalThis.clearInterval(r)}},[w,O,j,L,a]);let Y=36e5*Math.max(1,Number.parseInt(N,10)||1),$="true"===w&&null!==U&&null!==U.activeTimerDurationMs&&U.activeTimerDurationMs>=Y,B=(0,s.useMemo)(()=>{if("true"!==w||null===U)return!1;let{daily_minutes:e,weekly_minutes:t}=y({scope:O,sheet_name:j,tag_name:L,per_sheet_json:M,per_tag_json:G,global_daily:E,global_weekly:T});if(null===e||null===t)return!1;let s=6e4*Number.parseInt(e,10),a=6e4*Number.parseInt(t,10),n=Number.parseInt(A,10);return(null===U.activeTimerDurationMs||!$)&&(!!r||null===U.minutesSinceLastLog||!(U.minutesSinceLastLog>=n))&&!(U.todayTrackedMs<s)&&!(U.weekTrackedMs<a)},[E,r,w,O,j,L,M,G,A,U,T,$]);(0,s.useEffect)(()=>{$||R(!1)},[$]),(0,s.useEffect)(()=>{B||P(!1)},[B]);let H=(0,s.useMemo)(()=>{if("true"!==w||null===U)return null;let{daily_minutes:e,weekly_minutes:t}=y({scope:O,sheet_name:j,tag_name:L,per_sheet_json:M,per_tag_json:G,global_daily:E,global_weekly:T});if(null===e||null===t)return{kind:"alert",tone:"info",title:x("daily",O,j,L),detail:"No goals configured yet for this scope. Set daily and weekly targets in Goal settings."};let s=6e4*Number.parseInt(e,10),a=6e4*Number.parseInt(t,10),l=Number.parseInt(A,10);return null!==U.activeTimerDurationMs&&U.activeTimerDurationMs>=Y&&!I?{kind:"alert",tone:"warning",title:"Overwork alert",detail:`Current session is ${(0,n.format_duration)(U.activeTimerDurationMs,v)}. Consider a short break.`,show_overwork_dismiss:!0}:!r&&null!==U.minutesSinceLastLog&&U.minutesSinceLastLog>=l?{kind:"alert",tone:"warning",title:"Gentle reminder",detail:`No time logged for ${U.minutesSinceLastLog} min. Start a timer when you are back on task.`,show_check_in_shortcut:!0}:U.todayTrackedMs<s?{kind:"progress",scope:"daily",title:x("daily",O,j,L),tracked_ms:U.todayTrackedMs,target_ms:s}:U.weekTrackedMs<a?{kind:"progress",scope:"weekly",title:x("weekly",O,j,L),tracked_ms:U.weekTrackedMs,target_ms:a}:K?null:{kind:"alert",tone:"success",title:"Targets met",detail:"Daily and weekly focus goals are on track.",show_targets_met_dismiss:!0}},[E,v,w,r,O,j,L,M,G,A,U,T,I,K,Y]);if(null===H)return null;if("progress"===H.kind)return(0,t.jsx)(S,{scope:H.scope,title:H.title,tracked_ms:H.tracked_ms,target_ms:H.target_ms,duration_format:v,activePomodoro:F});let J="warning"===(l=H.tone)?"mb-4 rounded-md border border-danger-border bg-danger-soft px-3 py-2.5 text-danger-text":"success"===l?"mb-4 rounded-md border border-accent-border bg-accent-soft px-3 py-2.5 text-accent":"mb-4 rounded-md border border-panel-border bg-panel px-3 py-2.5 text-foreground",W=H.show_overwork_dismiss||H.show_targets_met_dismiss,z=H.show_overwork_dismiss?"Dismiss overwork alert":"Dismiss targets met alert";return(0,t.jsxs)("section",{className:`${J} relative pr-10`,"aria-live":"polite","aria-atomic":"true",children:[W?(0,t.jsx)("button",{type:"button",className:"absolute right-2 top-2 inline-flex h-6 w-6 cursor-pointer items-center justify-center rounded border border-current bg-transparent p-0 text-current hover:bg-black/5","aria-label":z,onClick:()=>{H.show_overwork_dismiss?R(!0):H.show_targets_met_dismiss&&P(!0)},children:(0,t.jsx)("svg",{viewBox:"0 0 16 16",className:"h-3.5 w-3.5","aria-hidden":"true",focusable:"false",children:(0,t.jsx)("path",{d:"M4 4 L12 12 M12 4 L4 12",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round"})})}):null,(0,t.jsx)("p",{className:"m-0 text-[0.85rem] font-semibold",children:H.title}),(0,t.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[(0,t.jsx)("p",{className:"m-0 text-[0.82rem] leading-relaxed",children:H.detail}),H.show_check_in_shortcut&&void 0!==e?(0,t.jsx)("button",{type:"button",className:"cursor-pointer rounded border border-current bg-transparent px-2 py-1 text-[0.75rem] font-semibold",onClick:e,children:"Check in"}):null]})]})}],37392)},11791,e=>{e.n(e.i(37392))}]);
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,37193,e=>{"use strict";e.s(["message_from_unknown_error",0,function(e,t){return e instanceof Error?e.message:"string"==typeof e?e:t}])},99997,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={formatUrl:function(){return i},formatWithValidation:function(){return c},urlObjectKeys:function(){return o}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let s=e.r(44066)._(e.r(33434)),l=/https?|ftp|gopher|file/;function i(e){let{auth:t,hostname:r}=e,n=e.protocol||"",a=e.pathname||"",i=e.hash||"",o=e.query||"",c=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?c=t+e.host:r&&(c=t+(~r.indexOf(":")?`[${r}]`:r),e.port&&(c+=":"+e.port)),o&&"object"==typeof o&&(o=String(s.urlQueryToSearchParams(o)));let u=e.search||o&&`?${o}`||"";return n&&!n.endsWith(":")&&(n+=":"),e.slashes||(!n||l.test(n))&&!1!==c?(c="//"+(c||""),a&&"/"!==a[0]&&(a="/"+a)):c||(c=""),i&&"#"!==i[0]&&(i="#"+i),u&&"?"!==u[0]&&(u="?"+u),a=a.replace(/[?#]/g,encodeURIComponent),u=u.replace("#","%23"),`${n}${c}${a}${u}${i}`}let o=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function c(e){return i(e)}},70782,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"useMergedRef",{enumerable:!0,get:function(){return a}});let n=e.r(51268);function a(e,t){let r=(0,n.useRef)(null),a=(0,n.useRef)(null);return(0,n.useCallback)(n=>{if(null===n){let e=r.current;e&&(r.current=null,e());let t=a.current;t&&(a.current=null,t())}else e&&(r.current=s(e,n)),t&&(a.current=s(t,n))},[e,t])}function s(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let r=e(t);return"function"==typeof r?r:()=>e(null)}}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},88334,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"isLocalURL",{enumerable:!0,get:function(){return s}});let n=e.r(69600),a=e.r(76636);function s(e){if(!(0,n.isAbsoluteUrl)(e))return!0;try{let t=(0,n.getLocationOrigin)(),r=new URL(e,t);return r.origin===t&&(0,a.hasBasePath)(r.pathname)}catch(e){return!1}}},20612,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"errorOnce",{enumerable:!0,get:function(){return n}});let n=e=>{}},70096,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={default:function(){return x},useLinkStatus:function(){return b}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let s=e.r(44066),l=e.r(8063),i=s._(e.r(51268)),o=e.r(99997),c=e.r(4411),u=e.r(70782),d=e.r(69600),m=e.r(31508);e.r(91946);let p=e.r(35302),h=e.r(92024),f=e.r(88334),g=e.r(44017);function x(t){var r,n;let a,s,x,[b,y]=(0,i.useOptimistic)(h.IDLE_LINK_STATUS),v=(0,i.useRef)(null),{href:j,as:w,children:N,prefetch:k=null,passHref:S,replace:C,shallow:E,scroll:T,onClick:$,onMouseEnter:R,onTouchStart:O,legacyBehavior:L=!1,onNavigate:P,transitionTypes:A,ref:M,unstable_dynamicOnHover:D,...I}=t;a=N,L&&("string"==typeof a||"number"==typeof a)&&(a=(0,l.jsx)("a",{children:a}));let U=i.default.useContext(c.AppRouterContext),q=!1!==k,F=!1!==k?null===(n=k)||"auto"===n?g.FetchStrategy.PPR:g.FetchStrategy.Full:g.FetchStrategy.PPR,B="string"==typeof(r=w||j)?r:(0,o.formatUrl)(r);if(L){if(a?.$$typeof===Symbol.for("react.lazy"))throw Object.defineProperty(Error("`<Link legacyBehavior>` received a direct child that is either a Server Component, or JSX that was loaded with React.lazy(). This is not supported. Either remove legacyBehavior, or make the direct child a Client Component that renders the Link's `<a>` tag."),"__NEXT_ERROR_CODE",{value:"E863",enumerable:!1,configurable:!0});s=i.default.Children.only(a)}let K=L?s&&"object"==typeof s&&s.ref:M,z=i.default.useCallback(e=>(null!==U&&(v.current=(0,h.mountLinkInstance)(e,B,U,F,q,y)),()=>{v.current&&((0,h.unmountLinkForCurrentNavigation)(v.current),v.current=null),(0,h.unmountPrefetchableInstance)(e)}),[q,B,U,F,y]),W={ref:(0,u.useMergedRef)(z,K),onClick(t){L||"function"!=typeof $||$(t),L&&s.props&&"function"==typeof s.props.onClick&&s.props.onClick(t),!U||t.defaultPrevented||function(t,r,n,a,s,l,o){if("u">typeof window){let c,{nodeName:u}=t.currentTarget;if("A"===u.toUpperCase()&&((c=t.currentTarget.getAttribute("target"))&&"_self"!==c||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.nativeEvent&&2===t.nativeEvent.which)||t.currentTarget.hasAttribute("download"))return;if(!(0,f.isLocalURL)(r)){a&&(t.preventDefault(),location.replace(r));return}if(t.preventDefault(),l){let e=!1;if(l({preventDefault:()=>{e=!0}}),e)return}let{dispatchNavigateAction:d}=e.r(12178);i.default.startTransition(()=>{d(r,a?"replace":"push",!1===s?p.ScrollBehavior.NoScroll:p.ScrollBehavior.Default,n.current,o)})}}(t,B,v,C,T,P,A)},onMouseEnter(e){L||"function"!=typeof R||R(e),L&&s.props&&"function"==typeof s.props.onMouseEnter&&s.props.onMouseEnter(e),U&&q&&(0,h.onNavigationIntent)(e.currentTarget,!0===D)},onTouchStart:function(e){L||"function"!=typeof O||O(e),L&&s.props&&"function"==typeof s.props.onTouchStart&&s.props.onTouchStart(e),U&&q&&(0,h.onNavigationIntent)(e.currentTarget,!0===D)}};return(0,d.isAbsoluteUrl)(B)?W.href=B:L&&!S&&("a"!==s.type||"href"in s.props)||(W.href=(0,m.addBasePath)(B)),x=L?i.default.cloneElement(s,W):(0,l.jsx)("a",{...I,...W,children:a}),(0,l.jsx)(_.Provider,{value:b,children:x})}e.r(20612);let _=(0,i.createContext)(h.IDLE_LINK_STATUS),b=()=>(0,i.useContext)(_);("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},29539,e=>{"use strict";var t=e.i(8063);e.s(["SettingsIcon",0,function(){return(0,t.jsxs)("svg",{className:"block h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),(0,t.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})}])},25204,e=>{"use strict";var t=e.i(51268),r=e.i(72074);e.s(["use_escape_to_cancel",0,function(e,n=!0){let a=(0,t.useRef)(e);a.current=e,(0,t.useEffect)(()=>{if(!n)return;let e=e=>{"Escape"!==e.key||(0,r.is_modal_dialog_open)()||(e.preventDefault(),a.current())};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[n])}])},37399,e=>{"use strict";var t=e.i(8063);e.s(["HamburgerIcon",0,function(){return(0,t.jsxs)("svg",{className:"block h-4 w-4 text-muted",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M4 7h16"}),(0,t.jsx)("path",{d:"M4 12h16"}),(0,t.jsx)("path",{d:"M4 17h16"})]})}])},77882,e=>{"use strict";var t=e.i(48042),r=e.i(51268),n=e.i(83105),a=e.i(32417),s=e.i(46549);e.s(["use_supabase_auth_session",0,function(){let e=(0,t.useRouter)(),[l,i]=(0,r.useState)(null),[o,c]=(0,r.useState)(!1),u=(0,a.is_supabase_configured)();return(0,r.useEffect)(()=>{if(!u)return;let e=(0,n.create_browser_supabase_client)();e.auth.getSession().then(({data:{session:e}})=>{i(e?.user.email??null)}).catch(()=>{i(null)});let{data:{subscription:t}}=e.auth.onAuthStateChange((e,t)=>{i(t?.user.email??null)});return()=>{t.unsubscribe()}},[u]),{is_configured:u,email:l,is_pending:o,sign_out:(0,r.useCallback)(async()=>{c(!0);try{await fetch("/api/auth/signout",{method:"POST"});let t=(0,n.create_browser_supabase_client)();await t.auth.signOut().catch(()=>{}),(0,s.notify_settings_saved)("Signed out"),e.refresh()}finally{c(!1)}},[e])}}])},90463,e=>{"use strict";e.s(["build_auth_page_href",0,function(e,t){let r="sign_in"===e?"/login":"/register",n=t.trim();return 0===n.length||"/"===n?r:`${r}?next=${encodeURIComponent(n)}`}])},75404,73205,e=>{"use strict";var t=e.i(8063),r=e.i(70096),n=e.i(48042);let a=[{href:"/",label:"Tracker",match:e=>"/"===e}];function s(){let e=(0,n.usePathname)()??"/";return(0,t.jsx)("div",{className:"scrollbar-none flex min-w-0 flex-1 items-center gap-1 overflow-x-auto whitespace-nowrap py-0.5 [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden min-[980px]:overflow-visible",children:a.map(n=>{let a=n.match(e);return(0,t.jsx)(r.default,{className:`rounded-full px-3 py-1.5 text-[0.85rem] font-semibold no-underline transition-colors duration-150 shrink-0 ${a?"bg-accent-soft text-foreground":"text-muted hover:bg-surface-hover hover:text-foreground"}`,href:n.href,"aria-current":a?"page":void 0,children:n.label},n.href)})})}function l(){return(0,t.jsx)("svg",{className:"block h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M17.5 19a4.5 4.5 0 0 0 0-9 6.5 6.5 0 0 0-12.6 1.5A4 4 0 0 0 6 19h11.5z"})})}var i=e.i(77882);function o(){let{email:e,is_configured:r}=(0,i.use_supabase_auth_session)();return r&&null!==e?(0,t.jsxs)("div",{className:"group relative flex items-center",children:[(0,t.jsx)("span",{className:"inline-flex h-8 w-8 items-center justify-center rounded-full border border-panel-border bg-ghost-bg text-accent","aria-label":`Cloud sync active for ${e}`,role:"img",children:(0,t.jsx)(l,{})}),(0,t.jsx)("div",{role:"tooltip",className:"pointer-events-none absolute right-0 top-full z-50 mt-1.5 w-max max-w-[min(18rem,calc(100vw-2.5rem))] opacity-0 transition-opacity duration-150 group-hover:opacity-100 group-focus-within:opacity-100",children:(0,t.jsxs)("div",{className:"rounded-md border border-panel-border bg-panel px-2.5 py-1.5 shadow-md",children:[(0,t.jsx)("p",{className:"m-0 text-[0.72rem] font-semibold uppercase tracking-[0.04em] text-muted",children:"Signed in as"}),(0,t.jsx)("p",{className:"m-0 max-w-[16rem] truncate text-[0.82rem] font-medium",title:e,children:e})]})})]}):null}var c=e.i(51268),u=e.i(37399),d=e.i(90463),m=e.i(46549),p=e.i(22373);let h=new Set(p.topbar_quick_action_ids),f=["today","review","templates","search","reporting","pomodoro"];function g(e){try{let t=JSON.parse(e);if(!Array.isArray(t))return f;let r=t.filter(e=>"string"==typeof e&&h.has(e));return Array.from(new Set(r))}catch{return f}}e.s(["parse_topbar_quick_actions",0,g],73205);var x=e.i(66295),_=e.i(34869),b=e.i(92629);let y=(0,_.create_ui_preference_store)({storage_key:b.CLOUD_SYNC_ENABLED_STORAGE_KEY,default_value:b.CLOUD_SYNC_ENABLED_DEFAULT,is_valid:e=>"true"===e||"false"===e});var v=e.i(32792),j=e.i(90299),w=e.i(28274);function N(){return"u"<typeof document?"dark":"light"===document.documentElement.getAttribute("data-theme")?"light":"dark"}function k(){return N()}function S(){return"dark"}var C=e.i(35434),E=e.i(17798),T=e.i(10464),$=e.i(61834),R=e.i(81553),O=e.i(25204);let L="block w-full cursor-pointer rounded-[0.45rem] border-0 bg-transparent px-2.5 py-1.5 text-left font-inherit text-[0.85rem] text-inherit no-underline hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-55",P={today:{href:"/today",label:"Today"},review:{href:"/review",label:"Review"},templates:{href:"/templates",label:"Templates"},search:{href:"/search",label:"Search"},sheets:{href:"/sheets",label:"Sheets"},reporting:{href:"/reporting",label:"Reporting"},pomodoro:{href:"/pomodoro",label:"Pomodoro"},"manage-tags":{href:"/settings/tags",label:"Manage tags"},"sync-settings":{href:"/settings/cloud-sync",label:"Sync settings"}},A=new Set(["manage-tags","pomodoro","templates","sync-settings"]);function M(){let e=(0,n.useRouter)(),a=(0,n.usePathname)()??"/",s=(0,c.useSyncExternalStore)(C.subscribe_theme,k,S),l=(0,c.useSyncExternalStore)(y.subscribe,y.get_snapshot,y.get_server_snapshot),o=(0,c.useSyncExternalStore)(j.tracker_shortcut_map_preference.subscribe,j.tracker_shortcut_map_preference.get_snapshot,j.tracker_shortcut_map_preference.get_server_snapshot),h=(0,c.useSyncExternalStore)(v.topbar_quick_actions_preference.subscribe,v.topbar_quick_actions_preference.get_snapshot,v.topbar_quick_actions_preference.get_server_snapshot),f=(0,x.parse_tracker_shortcut_map)(o),_=new Set(g(h)),b=p.topbar_quick_action_ids.filter(e=>!_.has(e)),M=Array.from(new Set([...Array.from(A),...b])),{email:D,is_configured:I,is_pending:U,sign_out:q}=(0,i.use_supabase_auth_session)(),[F,B]=(0,c.useState)(!1),K=(0,c.useRef)(null);(0,c.useEffect)(()=>{if(!F)return;let e=e=>{null===K.current||K.current.contains(e.target)||B(!1)};return document.addEventListener("pointerdown",e),()=>{document.removeEventListener("pointerdown",e)}},[F]);let z=()=>{B(!1)};return(0,O.use_escape_to_cancel)(z,F),(0,t.jsxs)("div",{className:"relative shrink-0",ref:K,children:[(0,t.jsx)("button",{type:"button",className:"inline-flex h-8 w-8 cursor-pointer items-center justify-center rounded-full border border-panel-border bg-ghost-bg text-muted hover:bg-surface-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent","aria-label":"Open menu","aria-expanded":F,"aria-haspopup":"menu",onClick:()=>B(e=>!e),children:(0,t.jsx)(u.HamburgerIcon,{})}),F?(0,t.jsxs)("ul",{className:"absolute right-0 top-full z-50 mt-1.5 min-w-56 list-none rounded-md border border-panel-border bg-panel p-1.5 shadow-md",role:"menu",children:[I&&null!==D?(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("p",{className:"m-0 truncate px-2.5 py-1 text-[0.72rem] uppercase tracking-[0.04em] text-muted",title:D,children:D})}):null,M.map(e=>{let n=P[e];return(0,t.jsx)("li",{role:"none",children:(0,t.jsx)(r.default,{href:n.href,className:L,role:"menuitem",onClick:z,children:n.label})},e)}),I?(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:L,role:"menuitemcheckbox","aria-checked":"true"===l,onClick:()=>{let e="true"===l?"false":"true";y.write(e),y.notify(),(0,m.notify_settings_saved)("true"===e?"Cloud sync enabled":"Cloud sync disabled"),"true"===e&&null!==D&&(0,w.run_tracker_db_cloud_sync)({merge_on_load:!0}).catch(()=>{})},children:(0,t.jsxs)("span",{className:"inline-flex w-full items-center justify-between gap-2",children:[(0,t.jsx)("span",{children:"true"===l?"Pause cloud sync":"Resume cloud sync"}),(0,t.jsx)("span",{className:"text-muted","aria-hidden":"true",children:"true"===l?"On":"Off"})]})})}):null,(0,t.jsx)("li",{className:"my-1 border-t border-panel-border",role:"separator","aria-hidden":"true"}),(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:L,role:"menuitem",onClick:()=>{let e;z(),e="dark"===N()?"light":"dark",(0,E.apply_theme)(e),(0,R.write_stored_theme)(e),T.theme_mode_preference.write(e),(0,$.write_document_preference_cookies)({theme_mode:e,theme:e}),T.theme_mode_preference.notify(),(0,C.notify_theme_subscribers)(),(0,m.notify_settings_saved)()},suppressHydrationWarning:!0,children:(0,t.jsxs)("span",{className:"inline-flex w-full items-center justify-between gap-2",children:[(0,t.jsxs)("span",{children:["dark"===s?"Dark":"Light"," theme"]}),(0,t.jsx)("span",{"aria-hidden":"true",children:"dark"===s?"☾":"☀"})]})})}),(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:L,role:"menuitem",onClick:()=>{let e;z(),e=f.help,document.dispatchEvent(new KeyboardEvent("keydown",{key:e,shiftKey:"?"===e,bubbles:!0}))},children:(0,t.jsxs)("span",{className:"inline-flex w-full items-center justify-between gap-2",children:[(0,t.jsx)("span",{children:"Keyboard shortcuts"}),(0,t.jsx)("span",{className:"text-muted","aria-hidden":"true",children:"(?)"})]})})}),I?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("li",{className:"my-1 border-t border-panel-border",role:"separator","aria-hidden":"true"}),null===D?(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:L,role:"menuitem",onClick:()=>{z(),e.push((0,d.build_auth_page_href)("sign_in",a))},children:"Sign in"})}):(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:`${L} text-danger`,role:"menuitem",disabled:U,onClick:()=>{z(),q()},children:U?"Signing out…":"Sign out"})})]}):null]}):null]})}let D=[{id:"today",href:"/today",label:"Today"},{id:"review",href:"/review",label:"Review"},{id:"templates",href:"/templates",label:"Templates"},{id:"search",href:"/search",label:"Search"},{id:"sheets",href:"/sheets",label:"Sheets"},{id:"reporting",href:"/reporting",label:"Reporting"},{id:"pomodoro",href:"/pomodoro",label:"Pomodoro"},{id:"manage-tags",href:"/settings/tags",label:"Tags"},{id:"sync-settings",href:"/settings/cloud-sync",label:"Sync"}];function I(){let e=(0,n.usePathname)()??"/",a=(0,c.useSyncExternalStore)(v.topbar_quick_actions_preference.subscribe,v.topbar_quick_actions_preference.get_snapshot,v.topbar_quick_actions_preference.get_server_snapshot),s=(0,c.useMemo)(()=>g(a),[a]);if(0===s.length)return null;let l=D.filter(e=>s.includes(e.id));return 0===l.length?null:(0,t.jsx)("div",{className:"hidden items-center gap-1 min-[980px]:flex",children:l.map(n=>{let a=e.startsWith(n.href);return(0,t.jsx)(r.default,{href:n.href,className:`rounded-full px-2.5 py-1 text-[0.78rem] font-semibold no-underline transition-colors duration-150 ${a?"bg-accent-soft text-foreground":"text-muted hover:bg-surface-hover hover:text-foreground"}`,"aria-current":a?"page":void 0,children:n.label},n.id)})})}var U=e.i(29539);function q(){let e=((0,n.usePathname)()??"/").startsWith("/settings");return(0,t.jsx)(r.default,{href:"/settings",className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-panel-border bg-ghost-bg text-muted no-underline hover:bg-surface-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent${e?" border-accent-border text-foreground":""}`,"aria-label":"Settings","aria-current":e?"page":void 0,children:(0,t.jsx)(U.SettingsIcon,{})})}function F({current:e,parent:n}){return(0,t.jsx)("nav",{"aria-label":"Breadcrumb",className:"min-w-0 text-left",children:(0,t.jsxs)("ol",{className:"m-0 flex min-w-0 list-none flex-wrap items-center gap-1.5 p-0 text-[0.85rem]",children:[(0,t.jsx)("li",{children:(0,t.jsx)(r.default,{className:"text-muted no-underline hover:text-foreground",href:"/",children:"Tracker"})}),void 0!==n?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("li",{className:"text-muted","aria-hidden":"true",children:"/"}),(0,t.jsx)("li",{children:void 0!==n.href?(0,t.jsx)(r.default,{className:"max-w-44 truncate text-muted no-underline hover:text-foreground sm:max-w-none",href:n.href,children:n.label}):(0,t.jsx)("span",{className:"max-w-44 truncate text-muted sm:max-w-none",children:n.label})})]}):null,(0,t.jsx)("li",{className:"text-muted","aria-hidden":"true",children:"/"}),(0,t.jsx)("li",{className:"max-w-44 truncate font-medium text-foreground sm:max-w-none","aria-current":"page",children:e})]})})}e.s(["TrackerTopbar",0,function({breadcrumb:e}={}){return(0,t.jsx)("header",{className:"relative z-1 border-b border-panel-border bg-[color-mix(in_srgb,var(--panel)_92%,var(--background))] shadow-sm backdrop-blur-[10px]",children:(0,t.jsxs)("div",{className:"mx-auto flex max-w-[1120px] min-h-13 flex-wrap items-center gap-x-4 gap-y-2 px-4 py-2 sm:px-5",children:[(0,t.jsx)("span",{className:"inline-flex min-w-0 shrink items-center font-mono text-[0.72rem] font-semibold uppercase leading-tight tracking-[0.08em] text-accent whitespace-nowrap",children:"super-time-tracker"}),void 0!==e?(0,t.jsx)("div",{className:"min-w-0 flex-1",children:(0,t.jsx)(F,{current:e.current,parent:e.parent})}):null,(0,t.jsxs)("div",{className:"flex w-full items-center justify-between gap-2 min-[980px]:ml-auto min-[980px]:w-auto min-[980px]:justify-end",children:[(0,t.jsx)(s,{}),(0,t.jsxs)("div",{className:"flex shrink-0 items-center justify-end gap-2",children:[(0,t.jsx)(I,{}),(0,t.jsx)(o,{}),(0,t.jsx)(q,{}),(0,t.jsx)(M,{})]})]})]})})}],75404)},52405,e=>{"use strict";e.s(["get_input_class_name",0,function(e="default"){let t="box-border max-w-full min-w-0 w-full rounded-[0.65rem] border border-panel-border bg-input-bg px-3 py-2.5 font-inherit text-inherit transition-[background-color,border-color] duration-200 focus:border-input-focus-border focus:outline-none";return"compact"===e?`${t} px-2.5 py-2`:t}])},18774,e=>{"use strict";e.s(["format_display_tag",0,function(e){return e.startsWith("@")?e:`@${e}`}])},31113,e=>{"use strict";e.s(["normalize_stored_tag",0,function(e){let t=e.trim().replace(/^@+/,"");if(0===t.length)throw Error("Tag name must not be empty.");if(!/^\w+$/.test(t))throw Error("Tags may only contain letters, numbers, and underscores.");return`@${t}`}])},14260,e=>{"use strict";var t=e.i(8063),r=e.i(51268),n=e.i(18774),a=e.i(52405),s=e.i(31113);e.s(["TagAutocompleteInput",0,function({id:e,value:l,known_tags:i,placeholder:o,disabled:c=!1,autoFocus:u=!1,on_change:d}){let m=(0,r.useRef)(null),p=(0,r.useRef)(null),h=(0,r.useRef)(null),[f,g]=(0,r.useState)(0),[x,_]=(0,r.useState)(0),b=function(e,t){let r=e.slice(0,t),n=r.lastIndexOf("@");if(-1===n)return null;let a=r.slice(n+1);return/\s/.test(a)?null:{query:a,start_index:n,end_index:t}}(l,f),y=null===b?[]:function(e,t,r=10){let n=t.toLowerCase();return e.filter(e=>{let t=e.replace(/^@/,"").toLowerCase();return 0===n.length||t.startsWith(n)}).slice(0,r)}(i,b.query),v=null!==b&&function(e,t){if(!/^\w+$/.test(e))return!1;let r=e.toLowerCase();return t.some(e=>{try{return(0,s.normalize_stored_tag)(e).slice(1).toLowerCase()===r}catch{return!1}})}(b.query,i),j=null!==b&&y.length>0&&!v&&!c;(0,r.useLayoutEffect)(()=>{null!==h.current&&null!==m.current&&(m.current.setSelectionRange(h.current,h.current),g(h.current),h.current=null)},[l]),(0,r.useEffect)(()=>{_(0)},[l,f,y.length]);let w=()=>{g(m.current?.selectionStart??l.length)},N=()=>{_(0)},k=e=>{let t,r,a;if(null===b)return;let{next_text:s,next_cursor:i}=(t=(0,n.format_display_tag)(e),r=l.slice(0,b.start_index),a=l.slice(b.end_index),{next_text:`${r}${t}${a}`,next_cursor:r.length+t.length});h.current=i,d(s),N()};return(0,t.jsxs)("div",{className:"relative min-w-0",children:[(0,t.jsx)("input",{ref:m,id:e,type:"text",role:"combobox",className:(0,a.get_input_class_name)(),value:l,placeholder:o,disabled:c,autoFocus:u,autoComplete:"off","aria-autocomplete":"list","aria-expanded":j,"aria-controls":j?`${e}-tag-suggestions`:void 0,onChange:e=>{d(e.target.value),g(e.target.selectionStart??e.target.value.length)},onClick:w,onKeyUp:w,onKeyDown:e=>{if(j){if("ArrowDown"===e.key){e.preventDefault(),_(e=>(e+1)%y.length);return}if("ArrowUp"===e.key){e.preventDefault(),_(e=>(e-1+y.length)%y.length);return}if("Enter"===e.key||"Tab"===e.key){e.preventDefault();let t=y[x];void 0!==t&&k(t);return}"Escape"===e.key&&(e.preventDefault(),N())}},onBlur:()=>{window.setTimeout(N,120)}}),j?(0,t.jsx)("ul",{ref:p,id:`${e}-tag-suggestions`,role:"listbox",className:"absolute left-0 right-0 top-full z-20 mt-1 max-h-48 list-none overflow-y-auto rounded-md border border-panel-border bg-panel p-1.5 shadow-md",children:y.map((e,r)=>(0,t.jsx)("li",{role:"option","aria-selected":r===x,children:(0,t.jsx)("button",{type:"button",className:`block w-full cursor-pointer rounded-[0.45rem] border-0 bg-transparent px-2.5 py-1.5 text-left font-inherit text-[0.85rem] text-inherit hover:bg-surface-hover ${r===x?"bg-surface-hover":""}`,onMouseDown:t=>{t.preventDefault(),k(e)},children:(0,n.format_display_tag)(e)})},e))}):null]})}],14260)},39474,20993,e=>{"use strict";var t=e.i(13349),r=e.i(32417),n=e.i(44171),a=e.i(28274);let s=null,l=Promise.resolve();function i(){(0,r.is_supabase_configured)()&&(0,n.is_cloud_sync_enabled)()&&(null!==s&&clearTimeout(s),s=setTimeout(()=>{s=null,l=l.then(()=>(0,a.run_tracker_db_cloud_sync)()).catch(()=>{})},400))}function o(){(0,t.is_greedy_cloud_sync_enabled)()&&i()}e.s(["schedule_tracker_db_cloud_sync",0,o],20993),e.s(["push_tracker_db_cloud_after_change",0,function(){(0,t.is_greedy_cloud_sync_enabled)()?o():i()}],39474)},97176,e=>{"use strict";var t=e.i(13349);async function r(e){let t=await fetch("/api/sheet/active",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e})});if(!t.ok)throw Error((await t.json()).error??"Failed to update active sheet in cloud")}var n=e.i(39474),a=e.i(20993);e.s(["notify_tracker_db_cloud_sync",0,function(e,s){if("/api/sheet"===e&&"object"==typeof s&&null!==s&&!0!==s.delete&&!(0,t.is_greedy_cloud_sync_enabled)()){let e=s.name?.trim()??"";e.length>0&&r(e).catch(()=>{});return}(0,t.is_greedy_cloud_sync_enabled)()?(0,a.schedule_tracker_db_cloud_sync)():(0,n.push_tracker_db_cloud_after_change)()}],97176)},44356,e=>{"use strict";var t=e.i(18774);e.s(["build_resume_description",0,function(e,r){let n=e.trim(),a=n.length>0?n:"Untitled entry",s=r.map(e=>(0,t.format_display_tag)(e)).join(" ");return s.length>0?`${a} ${s}`.trim():a}])},51229,e=>{"use strict";var t=e.i(97176);let r=new Set(["/api/note"]);async function n(e,n){let a={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},s=await fetch(e,a);if(!s.ok){var l,i;let t,n=(await s.json()).error??"Request failed";if(l=e,i=n,r.has(l)&&((t=i.toLowerCase()).includes("duplicate key")||t.includes("unique constraint"))){if(await new Promise(e=>{setTimeout(e,25)}),!(s=await fetch(e,a)).ok)throw Error((await s.json()).error??n)}else throw Error(n)}let o=await s.json();return(0,t.notify_tracker_db_cloud_sync)(e,n),o}e.s(["post_tracker_action",0,n])},36178,e=>{"use strict";e.s(["build_check_out_request_payload",0,function(e,t){let r={sheetName:e},n=t?.at?.trim(),a=t?.note?.trim();return void 0!==n&&n.length>0&&(r.at=n),void 0!==a&&a.length>0&&(r.note=a),r}])},75899,35923,e=>{"use strict";var t=e.i(39552);e.s(["format_time",0,function(e,r="12h"){return(0,t.format)(new Date(e),"24h"===r?"HH:mm":"h:mm a")}],75899);var r=e.i(51268),n=e.i(97891);e.s(["use_time_format",0,function(){return(0,r.useSyncExternalStore)(n.time_format_preference.subscribe,n.time_format_preference.get_snapshot,n.time_format_preference.get_server_snapshot)}],35923)},69837,e=>{"use strict";var t=e.i(39552);e.s(["format_datetime_hint",0,function(e){return(0,t.format)(new Date(e),"MMM d, h:mm a")}])},3159,e=>{"use strict";var t=e.i(97176);let r=new Set(["/api/note"]);async function n(e,n){let a={method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},s=await fetch(e,a);if(!s.ok){var l,i;let t,n=(await s.json()).error??"Request failed";if(l=e,i=n,r.has(l)&&((t=i.toLowerCase()).includes("duplicate key")||t.includes("unique constraint"))){if(await new Promise(e=>{setTimeout(e,25)}),!(s=await fetch(e,a)).ok)throw Error((await s.json()).error??n)}else throw Error(n)}let o=await s.json();return(0,t.notify_tracker_db_cloud_sync)(e,n),o}e.s(["patch_tracker_action",0,n])},52161,e=>{"use strict";var t=e.i(8063),r=e.i(51268),n=e.i(52663),a=e.i(52405),s=e.i(25204);e.s(["NoteForm",0,function({on_submit:e,on_cancel:l,is_pending:i,in_active_panel:o=!1,in_bar:c=!1,allow_at:u=!1}){let[d,m]=(0,r.useState)(""),[p,h]=(0,r.useState)("");return(0,s.use_escape_to_cancel)(()=>l?.(),void 0!==l),(0,t.jsxs)("form",{className:`flex flex-col gap-2 ${o&&!c?"border-t border-accent-border pt-4":c?"border-t border-[color-mix(in_srgb,var(--accent-border)_65%,var(--panel-border))] pt-3.5":""}`,onSubmit:t=>{t.preventDefault();let r=d.trim();if(0===r.length)return;let n=p.trim();e(r,n.length>0?n:void 0),m(""),h("")},children:[(0,t.jsx)("label",{className:"text-[0.85rem] text-muted",htmlFor:"note-text",children:"Add note"}),(0,t.jsxs)("div",{className:"grid grid-cols-[minmax(0,1fr)_auto] gap-2 max-[860px]:grid-cols-1",children:[(0,t.jsx)("input",{id:"note-text",className:(0,a.get_input_class_name)(),value:d,onChange:e=>m(e.target.value),placeholder:"Pair with alice on the widget",disabled:i,autoFocus:!0}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 max-[860px]:w-full",children:[(0,t.jsx)("button",{type:"submit",className:(0,n.get_button_class_name)("ghost"),disabled:i||0===d.trim().length,children:"Save note"}),void 0===l?null:(0,t.jsx)("button",{type:"button",className:(0,n.get_button_class_name)("ghost"),disabled:i,onClick:l,children:"Cancel"})]})]}),u?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("label",{className:"text-[0.85rem] text-muted",htmlFor:"note-at",children:["Note time"," ",(0,t.jsx)("span",{className:"font-normal opacity-85",children:"(optional, natural language)"})]}),(0,t.jsx)("input",{id:"note-at",className:(0,a.get_input_class_name)(),value:p,onChange:e=>h(e.target.value),placeholder:"e.g. 30 minutes ago",disabled:i})]}):null]})}],52161)},94287,e=>{"use strict";var t=e.i(8063),r=e.i(48042),n=e.i(51268),a=e.i(69837),s=e.i(75899),l=e.i(52161),i=e.i(14260),o=e.i(75404),c=e.i(36178),u=e.i(44356),d=e.i(18774),m=e.i(32584),p=e.i(52663),h=e.i(52405),f=e.i(37193),g=e.i(3159),x=e.i(51229),_=e.i(1800),b=e.i(35923);let y="w-full rounded-md border border-panel-border bg-panel p-4 shadow-sm";function v({label:e,value:r,tone:n="default"}){return(0,t.jsxs)("article",{className:"rounded-md border border-panel-border bg-panel p-3.5 shadow-sm",children:[(0,t.jsx)("p",{className:"m-0 text-[0.72rem] font-semibold uppercase tracking-[0.06em] text-muted",children:e}),(0,t.jsx)("p",{className:`m-0 mt-1 text-[1.1rem] font-[650] ${"accent"===n?"text-accent":"danger"===n?"text-danger":"text-foreground"}`,children:r})]})}function j({label:e,count:r,active:n,on_click:a}){return(0,t.jsxs)("button",{type:"button",className:`flex cursor-pointer items-center justify-between gap-2 rounded-md border-0 px-2.5 py-2 text-left font-inherit text-[0.86rem] ${n?"bg-accent-soft text-foreground":"bg-transparent text-muted hover:bg-surface-hover hover:text-foreground"}`,onClick:a,children:[(0,t.jsx)("span",{className:"font-semibold",children:e}),(0,t.jsx)("span",{className:"rounded-full bg-background px-2 py-0.5 text-[0.72rem] text-muted",children:r})]})}function w({entries:e,is_pending:r,on_close:n}){return(0,t.jsxs)("section",{className:y,"aria-label":"Running timers",children:[(0,t.jsx)(O,{title:"Close running timers",description:"Set an end time and optional checkout note before wrapping the day."}),0===e.length?(0,t.jsx)(L,{message:"No timers are running."}):(0,t.jsx)("ul",{className:"m-0 mt-4 flex list-none flex-col gap-3 p-0",children:e.map(e=>(0,t.jsx)(N,{entry:e,is_pending:r,on_close:n},`${e.sheetName}-${e.id}`))})]})}function N({entry:e,is_pending:r,on_close:a}){let[l,i]=(0,n.useState)(""),[o,c]=(0,n.useState)(""),u=(0,_.use_duration_format)(),d=(0,b.use_time_format)();return(0,t.jsxs)("li",{className:"rounded-md border border-panel-border bg-background p-3",children:[(0,t.jsx)(R,{entry:e,duration_ms:e.durationMs}),(0,t.jsxs)("p",{className:"m-0 mt-1 text-[0.8rem] text-muted",children:["Started ",(0,s.format_time)(e.start,d),". Running for"," ",(0,m.format_duration)(e.durationMs,u),"."]}),(0,t.jsxs)("div",{className:"mt-3 grid grid-cols-1 gap-2 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto]",children:[(0,t.jsx)("input",{className:(0,h.get_input_class_name)("compact"),value:l,disabled:r,placeholder:"End time, e.g. now or 5pm","aria-label":"Checkout time",onChange:e=>i(e.target.value)}),(0,t.jsx)("input",{className:(0,h.get_input_class_name)("compact"),value:o,disabled:r,placeholder:"Checkout note","aria-label":"Checkout note",onChange:e=>c(e.target.value)}),(0,t.jsx)("button",{type:"button",className:(0,p.get_button_class_name)("primary","small"),disabled:r,onClick:()=>a(e,l.trim().length>0?l.trim():void 0,o.trim().length>0?o.trim():void 0),children:"Close timer"})]})]})}function k({entries:e,threshold_ms:r,known_tags:n,is_pending:a,on_save:s}){let l=(0,_.use_duration_format)();return(0,t.jsxs)("section",{className:y,"aria-label":"Long entries",children:[(0,t.jsx)(O,{title:"Review suspiciously long entries",description:`Entries at or above ${(0,m.format_duration)(r,l)} are listed here for correction.`}),0===e.length?(0,t.jsx)(L,{message:"No long entries need review."}):(0,t.jsx)("ul",{className:"m-0 mt-4 flex list-none flex-col gap-3 p-0",children:e.map(e=>(0,t.jsx)(T,{entry:e,known_tags:n,is_pending:a,show_times:!0,on_save:s},`${e.sheetName}-${e.id}`))})]})}function S({gaps:e,sheet_names:r,known_tags:n,is_pending:a,on_create:s}){return(0,t.jsxs)("section",{className:y,"aria-label":"Idle gaps",children:[(0,t.jsx)(O,{title:"Fill idle gaps",description:"Create completed entries for untracked time between today's logged blocks."}),0===e.length?(0,t.jsx)(L,{message:"No idle gaps found between entries."}):(0,t.jsx)("ul",{className:"m-0 mt-4 flex list-none flex-col gap-3 p-0",children:e.map(e=>(0,t.jsx)(C,{gap:e,sheet_names:r,known_tags:n,is_pending:a,on_create:s},e.id))})]})}function C({gap:e,sheet_names:r,known_tags:a,is_pending:l,on_create:o}){let c=(0,b.use_time_format)(),u=(0,_.use_duration_format)(),d=e.previousEntry?.sheetName??r[0]??"",[f,g]=(0,n.useState)(d),[x,y]=(0,n.useState)(""),[v,j]=(0,n.useState)("");return(0,t.jsxs)("li",{className:"rounded-md border border-panel-border bg-background p-3",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[(0,t.jsxs)("p",{className:"m-0 font-semibold",children:[(0,s.format_time)(e.start,c)," to"," ",(0,s.format_time)(e.end,c)]}),(0,t.jsx)("span",{className:"font-mono text-[0.86rem] font-semibold text-accent",children:(0,m.format_duration)(e.durationMs,u)})]}),(0,t.jsxs)("p",{className:"m-0 mt-1 text-[0.8rem] text-muted",children:["Between ",e.previousEntry?.description||"the previous entry"," and"," ",e.nextEntry?.description||"the next entry","."]}),(0,t.jsxs)("div",{className:"mt-3 grid grid-cols-1 gap-2 md:grid-cols-[11rem_minmax(0,1fr)]",children:[(0,t.jsx)("select",{className:(0,h.get_input_class_name)("compact"),value:f,disabled:l,"aria-label":"Gap sheet",onChange:e=>g(e.target.value),children:r.map(e=>(0,t.jsx)("option",{value:e,children:e},e))}),(0,t.jsx)(i.TagAutocompleteInput,{id:`gap-description-${e.id}`,value:x,known_tags:a,placeholder:"What filled this gap? Add @tags",disabled:l,on_change:y}),(0,t.jsx)("input",{className:`${(0,h.get_input_class_name)("compact")} md:col-span-2`,value:v,disabled:l,placeholder:"Optional note","aria-label":"Gap note",onChange:e=>j(e.target.value)})]}),(0,t.jsx)("button",{type:"button",className:`${(0,p.get_button_class_name)("primary","small")} mt-3`,disabled:l||0===f.length||0===x.trim().length,onClick:()=>o(e,f,x.trim(),v.trim().length>0?v.trim():void 0),children:"Create entry"})]})}function E({issues:e,known_tags:r,is_pending:n,on_save:a}){return(0,t.jsxs)("section",{className:y,"aria-label":"Tag issues",children:[(0,t.jsx)(O,{title:"Normalize tags",description:"Add missing tags and clean up tag casing on today's entries."}),0===e.length?(0,t.jsx)(L,{message:"No tag cleanup needed."}):(0,t.jsx)("ul",{className:"m-0 mt-4 flex list-none flex-col gap-3 p-0",children:e.map(e=>(0,t.jsx)(T,{entry:e.entry,known_tags:r,is_pending:n,issue_label:e.kinds.map(e=>"missing_tags"===e?"Missing tags":"Tag casing differs").join(" and "),on_save:(e,t)=>{void 0!==t&&a(e,t)}},`${e.entry.sheetName}-${e.entry.id}`))})]})}function T({entry:e,known_tags:r,is_pending:s,issue_label:l,show_times:o=!1,on_save:c}){let[d,m]=(0,n.useState)((0,u.build_resume_description)(e.description,e.tags)),[f,g]=(0,n.useState)(""),[x,_]=(0,n.useState)(""),b=d.trim()!==(0,u.build_resume_description)(e.description,e.tags).trim()||f.trim().length>0||x.trim().length>0;return(0,t.jsxs)("li",{className:"rounded-md border border-panel-border bg-background p-3",children:[(0,t.jsx)(R,{entry:e,duration_ms:e.reviewDurationMs}),void 0===l?null:(0,t.jsx)("p",{className:"m-0 mt-1 text-[0.8rem] text-muted",children:l}),(0,t.jsxs)("div",{className:"mt-3 flex flex-col gap-2",children:[(0,t.jsx)(i.TagAutocompleteInput,{id:`review-entry-${e.sheetName}-${e.id}`,value:d,known_tags:r,disabled:s,placeholder:"Description with @tags",on_change:m}),o?(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,t.jsx)("input",{className:(0,h.get_input_class_name)("compact"),value:f,disabled:s,placeholder:`Start: ${(0,a.format_datetime_hint)(e.start)}`,"aria-label":"Entry start",onChange:e=>g(e.target.value)}),(0,t.jsx)("input",{className:(0,h.get_input_class_name)("compact"),value:x,disabled:s,placeholder:null===e.end?"End: still running":`End: ${(0,a.format_datetime_hint)(e.end)}`,"aria-label":"Entry end",onChange:e=>_(e.target.value)})]}):null,(0,t.jsx)("button",{type:"button",className:`${(0,p.get_button_class_name)("primary","small")} w-fit`,disabled:s||!b,onClick:()=>c(e,d.trim(),f.trim().length>0?f.trim():void 0,x.trim().length>0?x.trim():void 0),children:"Save changes"})]})]})}function $({entries:e,is_pending:r,on_add_note:n}){return(0,t.jsxs)("section",{className:y,"aria-label":"Review notes",children:[(0,t.jsx)(O,{title:"Add handoff notes",description:"Attach details to entries while the work is still fresh."}),0===e.length?(0,t.jsx)(L,{message:"No entries today."}):(0,t.jsx)("ul",{className:"m-0 mt-4 flex list-none flex-col gap-3 p-0",children:e.map(e=>(0,t.jsxs)("li",{className:"rounded-md border border-panel-border bg-background p-3",children:[(0,t.jsx)(R,{entry:e,duration_ms:e.reviewDurationMs}),e.notes.length>0?(0,t.jsxs)("p",{className:"m-0 mt-1 text-[0.8rem] text-muted",children:[e.notes.length," ",1===e.notes.length?"note":"notes"," already added."]}):null,(0,t.jsx)("div",{className:"mt-3",children:(0,t.jsx)(l.NoteForm,{is_pending:r,allow_at:!0,on_submit:(t,r)=>n(e,t,r)})})]},`${e.sheetName}-${e.id}`))})]})}function R({entry:e,duration_ms:r}){let n=(0,_.use_duration_format)();return(0,t.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("p",{className:"m-0 text-[0.72rem] font-semibold uppercase tracking-[0.04em] text-muted",children:e.sheetName}),(0,t.jsx)("p",{className:"m-0 mt-1 text-[0.95rem] font-semibold",children:e.description||"Untitled entry"}),e.tags.length>0?(0,t.jsx)("ul",{className:"m-0 mt-2 flex list-none flex-wrap gap-1.5 p-0",children:e.tags.map(e=>(0,t.jsx)("li",{className:"rounded-full bg-tag-bg px-2 py-0.5 text-xs text-tag-text",children:(0,d.format_display_tag)(e)},e))}):null]}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-[0.88rem] font-semibold text-accent",children:(0,m.format_duration)(r,n)})]})}function O({title:e,description:r}){return(0,t.jsxs)("header",{children:[(0,t.jsx)("h2",{className:"m-0 text-[1rem] font-semibold",children:e}),(0,t.jsx)("p",{className:"m-0 mt-1 text-[0.86rem] leading-relaxed text-muted",children:r})]})}function L({message:e}){return(0,t.jsx)("p",{className:"m-0 mt-4 text-[0.9rem] text-muted",children:e})}e.s(["EndOfDayReviewView",0,function({initial_data:e}){let a=(0,r.useRouter)(),[s,l]=(0,n.useState)(e),[i,u]=(0,n.useState)("running"),[d,m]=(0,n.useState)(null),[p,h]=(0,n.useState)(null),[_,b]=(0,n.useState)(!1);(0,n.useEffect)(()=>{l(e)},[e]);let y=(0,n.useMemo)(()=>[0===s.runningEntries.length,0===s.longEntries.length,0===s.idleGaps.length,0===s.tagIssues.length].filter(Boolean).length,[s]),N=async(e,t)=>{b(!0),m(null),h(null);try{await e(),h(t),a.refresh()}catch(e){m((0,f.message_from_unknown_error)(e,"Review action failed"))}finally{b(!1)}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.TrackerTopbar,{breadcrumb:{current:"Review"}}),(0,t.jsxs)("main",{className:"mx-auto flex w-full max-w-5xl flex-col gap-6 px-5 pb-12 pt-6",children:[(0,t.jsxs)("header",{className:"flex flex-col gap-2 text-center",children:[(0,t.jsx)("h1",{className:"m-0 text-[1.5rem] font-[650] tracking-tight",children:"End-of-day review"}),(0,t.jsxs)("p",{className:"m-0 text-[0.9rem] leading-relaxed text-muted",children:[s.dateLabel,". Close timers, fill gaps, normalize tags, and add handoff notes."]})]}),null===d?null:(0,t.jsx)("p",{className:"m-0 rounded-md border border-danger-border bg-danger-soft px-3 py-2 text-[0.85rem] text-danger",children:d}),null===p?null:(0,t.jsx)("p",{className:"m-0 rounded-md border border-accent-border bg-accent-soft px-3 py-2 text-[0.85rem] text-accent",children:p}),(0,t.jsxs)("section",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-4","aria-label":"Review summary",children:[(0,t.jsx)(v,{label:"Checklist",value:`${y}/4 clear`,tone:4===y?"accent":"default"}),(0,t.jsx)(v,{label:"Running",value:String(s.runningEntries.length),tone:s.runningEntries.length>0?"danger":"accent"}),(0,t.jsx)(v,{label:"Entries today",value:String(s.entries.length)}),(0,t.jsx)(v,{label:"Gaps",value:String(s.idleGaps.length),tone:s.idleGaps.length>0?"warning":"accent"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-[14rem_minmax(0,1fr)] gap-4 max-[760px]:grid-cols-1",children:[(0,t.jsxs)("nav",{className:"flex h-fit flex-col gap-1 rounded-md border border-panel-border bg-panel p-1.5 shadow-sm","aria-label":"Review sections",children:[(0,t.jsx)(j,{label:"Running timers",count:s.runningEntries.length,active:"running"===i,on_click:()=>u("running")}),(0,t.jsx)(j,{label:"Long entries",count:s.longEntries.length,active:"long"===i,on_click:()=>u("long")}),(0,t.jsx)(j,{label:"Idle gaps",count:s.idleGaps.length,active:"gaps"===i,on_click:()=>u("gaps")}),(0,t.jsx)(j,{label:"Tags",count:s.tagIssues.length,active:"tags"===i,on_click:()=>u("tags")}),(0,t.jsx)(j,{label:"Notes",count:s.entries.length,active:"notes"===i,on_click:()=>u("notes")})]}),(0,t.jsxs)("div",{className:"min-w-0",children:["running"===i?(0,t.jsx)(w,{entries:s.runningEntries,is_pending:_,on_close:(e,t,r)=>N(()=>(0,x.post_tracker_action)("/api/out",(0,c.build_check_out_request_payload)(e.sheetName,{at:t,note:r})),"Timer closed.")}):null,"long"===i?(0,t.jsx)(k,{entries:s.longEntries,threshold_ms:s.longEntryThresholdMs,known_tags:s.knownTags,is_pending:_,on_save:(e,t,r,n)=>N(()=>(0,g.patch_tracker_action)("/api/entry",{sheetName:e.sheetName,entryId:e.id,description:t,start:r,end:n}),"Entry updated.")}):null,"gaps"===i?(0,t.jsx)(S,{gaps:s.idleGaps,sheet_names:s.sheetNames,known_tags:s.knownTags,is_pending:_,on_create:(e,t,r,n)=>N(()=>(0,x.post_tracker_action)("/api/entry/completed",{sheetName:t,description:r,start:e.start,end:e.end,note:n}),"Gap filled.")}):null,"tags"===i?(0,t.jsx)(E,{issues:s.tagIssues,known_tags:s.knownTags,is_pending:_,on_save:(e,t)=>N(()=>(0,g.patch_tracker_action)("/api/entry",{sheetName:e.sheetName,entryId:e.id,description:t}),"Tags updated.")}):null,"notes"===i?(0,t.jsx)($,{entries:s.entries,is_pending:_,on_add_note:(e,t,r)=>N(()=>(0,x.post_tracker_action)("/api/note",{sheetName:e.sheetName,entryId:e.id,text:t,at:r}),"Note added.")}):null]})]})]})]})}])}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,37193,e=>{"use strict";e.s(["message_from_unknown_error",0,function(e,t){return e instanceof Error?e.message:"string"==typeof e?e:t}])},99997,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={formatUrl:function(){return i},formatWithValidation:function(){return c},urlObjectKeys:function(){return o}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let s=e.r(44066)._(e.r(33434)),l=/https?|ftp|gopher|file/;function i(e){let{auth:t,hostname:r}=e,n=e.protocol||"",a=e.pathname||"",i=e.hash||"",o=e.query||"",c=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?c=t+e.host:r&&(c=t+(~r.indexOf(":")?`[${r}]`:r),e.port&&(c+=":"+e.port)),o&&"object"==typeof o&&(o=String(s.urlQueryToSearchParams(o)));let u=e.search||o&&`?${o}`||"";return n&&!n.endsWith(":")&&(n+=":"),e.slashes||(!n||l.test(n))&&!1!==c?(c="//"+(c||""),a&&"/"!==a[0]&&(a="/"+a)):c||(c=""),i&&"#"!==i[0]&&(i="#"+i),u&&"?"!==u[0]&&(u="?"+u),a=a.replace(/[?#]/g,encodeURIComponent),u=u.replace("#","%23"),`${n}${c}${a}${u}${i}`}let o=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function c(e){return i(e)}},70782,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"useMergedRef",{enumerable:!0,get:function(){return a}});let n=e.r(51268);function a(e,t){let r=(0,n.useRef)(null),a=(0,n.useRef)(null);return(0,n.useCallback)(n=>{if(null===n){let e=r.current;e&&(r.current=null,e());let t=a.current;t&&(a.current=null,t())}else e&&(r.current=s(e,n)),t&&(a.current=s(t,n))},[e,t])}function s(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let r=e(t);return"function"==typeof r?r:()=>e(null)}}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},88334,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"isLocalURL",{enumerable:!0,get:function(){return s}});let n=e.r(69600),a=e.r(76636);function s(e){if(!(0,n.isAbsoluteUrl)(e))return!0;try{let t=(0,n.getLocationOrigin)(),r=new URL(e,t);return r.origin===t&&(0,a.hasBasePath)(r.pathname)}catch(e){return!1}}},20612,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"errorOnce",{enumerable:!0,get:function(){return n}});let n=e=>{}},70096,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={default:function(){return x},useLinkStatus:function(){return b}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let s=e.r(44066),l=e.r(8063),i=s._(e.r(51268)),o=e.r(99997),c=e.r(4411),u=e.r(70782),d=e.r(69600),m=e.r(31508);e.r(91946);let p=e.r(35302),h=e.r(92024),f=e.r(88334),g=e.r(44017);function x(t){var r,n;let a,s,x,[b,y]=(0,i.useOptimistic)(h.IDLE_LINK_STATUS),v=(0,i.useRef)(null),{href:j,as:w,children:N,prefetch:k=null,passHref:S,replace:C,shallow:E,scroll:T,onClick:$,onMouseEnter:R,onTouchStart:O,legacyBehavior:L=!1,onNavigate:P,transitionTypes:A,ref:M,unstable_dynamicOnHover:D,...I}=t;a=N,L&&("string"==typeof a||"number"==typeof a)&&(a=(0,l.jsx)("a",{children:a}));let U=i.default.useContext(c.AppRouterContext),q=!1!==k,F=!1!==k?null===(n=k)||"auto"===n?g.FetchStrategy.PPR:g.FetchStrategy.Full:g.FetchStrategy.PPR,B="string"==typeof(r=w||j)?r:(0,o.formatUrl)(r);if(L){if(a?.$$typeof===Symbol.for("react.lazy"))throw Object.defineProperty(Error("`<Link legacyBehavior>` received a direct child that is either a Server Component, or JSX that was loaded with React.lazy(). This is not supported. Either remove legacyBehavior, or make the direct child a Client Component that renders the Link's `<a>` tag."),"__NEXT_ERROR_CODE",{value:"E863",enumerable:!1,configurable:!0});s=i.default.Children.only(a)}let K=L?s&&"object"==typeof s&&s.ref:M,z=i.default.useCallback(e=>(null!==U&&(v.current=(0,h.mountLinkInstance)(e,B,U,F,q,y)),()=>{v.current&&((0,h.unmountLinkForCurrentNavigation)(v.current),v.current=null),(0,h.unmountPrefetchableInstance)(e)}),[q,B,U,F,y]),W={ref:(0,u.useMergedRef)(z,K),onClick(t){L||"function"!=typeof $||$(t),L&&s.props&&"function"==typeof s.props.onClick&&s.props.onClick(t),!U||t.defaultPrevented||function(t,r,n,a,s,l,o){if("u">typeof window){let c,{nodeName:u}=t.currentTarget;if("A"===u.toUpperCase()&&((c=t.currentTarget.getAttribute("target"))&&"_self"!==c||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.nativeEvent&&2===t.nativeEvent.which)||t.currentTarget.hasAttribute("download"))return;if(!(0,f.isLocalURL)(r)){a&&(t.preventDefault(),location.replace(r));return}if(t.preventDefault(),l){let e=!1;if(l({preventDefault:()=>{e=!0}}),e)return}let{dispatchNavigateAction:d}=e.r(12178);i.default.startTransition(()=>{d(r,a?"replace":"push",!1===s?p.ScrollBehavior.NoScroll:p.ScrollBehavior.Default,n.current,o)})}}(t,B,v,C,T,P,A)},onMouseEnter(e){L||"function"!=typeof R||R(e),L&&s.props&&"function"==typeof s.props.onMouseEnter&&s.props.onMouseEnter(e),U&&q&&(0,h.onNavigationIntent)(e.currentTarget,!0===D)},onTouchStart:function(e){L||"function"!=typeof O||O(e),L&&s.props&&"function"==typeof s.props.onTouchStart&&s.props.onTouchStart(e),U&&q&&(0,h.onNavigationIntent)(e.currentTarget,!0===D)}};return(0,d.isAbsoluteUrl)(B)?W.href=B:L&&!S&&("a"!==s.type||"href"in s.props)||(W.href=(0,m.addBasePath)(B)),x=L?i.default.cloneElement(s,W):(0,l.jsx)("a",{...I,...W,children:a}),(0,l.jsx)(_.Provider,{value:b,children:x})}e.r(20612);let _=(0,i.createContext)(h.IDLE_LINK_STATUS),b=()=>(0,i.useContext)(_);("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},29539,e=>{"use strict";var t=e.i(8063);e.s(["SettingsIcon",0,function(){return(0,t.jsxs)("svg",{className:"block h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),(0,t.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})}])},25204,e=>{"use strict";var t=e.i(51268),r=e.i(72074);e.s(["use_escape_to_cancel",0,function(e,n=!0){let a=(0,t.useRef)(e);a.current=e,(0,t.useEffect)(()=>{if(!n)return;let e=e=>{"Escape"!==e.key||(0,r.is_modal_dialog_open)()||(e.preventDefault(),a.current())};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[n])}])},37399,e=>{"use strict";var t=e.i(8063);e.s(["HamburgerIcon",0,function(){return(0,t.jsxs)("svg",{className:"block h-4 w-4 text-muted",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M4 7h16"}),(0,t.jsx)("path",{d:"M4 12h16"}),(0,t.jsx)("path",{d:"M4 17h16"})]})}])},77882,e=>{"use strict";var t=e.i(48042),r=e.i(51268),n=e.i(83105),a=e.i(32417),s=e.i(46549);e.s(["use_supabase_auth_session",0,function(){let e=(0,t.useRouter)(),[l,i]=(0,r.useState)(null),[o,c]=(0,r.useState)(!1),u=(0,a.is_supabase_configured)();return(0,r.useEffect)(()=>{if(!u)return;let e=(0,n.create_browser_supabase_client)();e.auth.getSession().then(({data:{session:e}})=>{i(e?.user.email??null)}).catch(()=>{i(null)});let{data:{subscription:t}}=e.auth.onAuthStateChange((e,t)=>{i(t?.user.email??null)});return()=>{t.unsubscribe()}},[u]),{is_configured:u,email:l,is_pending:o,sign_out:(0,r.useCallback)(async()=>{c(!0);try{await fetch("/api/auth/signout",{method:"POST"});let t=(0,n.create_browser_supabase_client)();await t.auth.signOut().catch(()=>{}),(0,s.notify_settings_saved)("Signed out"),e.refresh()}finally{c(!1)}},[e])}}])},90463,e=>{"use strict";e.s(["build_auth_page_href",0,function(e,t){let r="sign_in"===e?"/login":"/register",n=t.trim();return 0===n.length||"/"===n?r:`${r}?next=${encodeURIComponent(n)}`}])},75404,73205,e=>{"use strict";var t=e.i(8063),r=e.i(70096),n=e.i(48042);let a=[{href:"/",label:"Tracker",match:e=>"/"===e}];function s(){let e=(0,n.usePathname)()??"/";return(0,t.jsx)("div",{className:"scrollbar-none flex min-w-0 flex-1 items-center gap-1 overflow-x-auto whitespace-nowrap py-0.5 [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden min-[980px]:overflow-visible",children:a.map(n=>{let a=n.match(e);return(0,t.jsx)(r.default,{className:`rounded-full px-3 py-1.5 text-[0.85rem] font-semibold no-underline transition-colors duration-150 shrink-0 ${a?"bg-accent-soft text-foreground":"text-muted hover:bg-surface-hover hover:text-foreground"}`,href:n.href,"aria-current":a?"page":void 0,children:n.label},n.href)})})}function l(){return(0,t.jsx)("svg",{className:"block h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M17.5 19a4.5 4.5 0 0 0 0-9 6.5 6.5 0 0 0-12.6 1.5A4 4 0 0 0 6 19h11.5z"})})}var i=e.i(77882);function o(){let{email:e,is_configured:r}=(0,i.use_supabase_auth_session)();return r&&null!==e?(0,t.jsxs)("div",{className:"group relative flex items-center",children:[(0,t.jsx)("span",{className:"inline-flex h-8 w-8 items-center justify-center rounded-full border border-panel-border bg-ghost-bg text-accent","aria-label":`Cloud sync active for ${e}`,role:"img",children:(0,t.jsx)(l,{})}),(0,t.jsx)("div",{role:"tooltip",className:"pointer-events-none absolute right-0 top-full z-50 mt-1.5 w-max max-w-[min(18rem,calc(100vw-2.5rem))] opacity-0 transition-opacity duration-150 group-hover:opacity-100 group-focus-within:opacity-100",children:(0,t.jsxs)("div",{className:"rounded-md border border-panel-border bg-panel px-2.5 py-1.5 shadow-md",children:[(0,t.jsx)("p",{className:"m-0 text-[0.72rem] font-semibold uppercase tracking-[0.04em] text-muted",children:"Signed in as"}),(0,t.jsx)("p",{className:"m-0 max-w-[16rem] truncate text-[0.82rem] font-medium",title:e,children:e})]})})]}):null}var c=e.i(51268),u=e.i(37399),d=e.i(90463),m=e.i(46549),p=e.i(22373);let h=new Set(p.topbar_quick_action_ids),f=["today","review","templates","search","reporting","pomodoro"];function g(e){try{let t=JSON.parse(e);if(!Array.isArray(t))return f;let r=t.filter(e=>"string"==typeof e&&h.has(e));return Array.from(new Set(r))}catch{return f}}e.s(["parse_topbar_quick_actions",0,g],73205);var x=e.i(66295),_=e.i(34869),b=e.i(92629);let y=(0,_.create_ui_preference_store)({storage_key:b.CLOUD_SYNC_ENABLED_STORAGE_KEY,default_value:b.CLOUD_SYNC_ENABLED_DEFAULT,is_valid:e=>"true"===e||"false"===e});var v=e.i(32792),j=e.i(90299),w=e.i(28274);function N(){return"u"<typeof document?"dark":"light"===document.documentElement.getAttribute("data-theme")?"light":"dark"}function k(){return N()}function S(){return"dark"}var C=e.i(35434),E=e.i(17798),T=e.i(10464),$=e.i(61834),R=e.i(81553),O=e.i(25204);let L="block w-full cursor-pointer rounded-[0.45rem] border-0 bg-transparent px-2.5 py-1.5 text-left font-inherit text-[0.85rem] text-inherit no-underline hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-55",P={today:{href:"/today",label:"Today"},review:{href:"/review",label:"Review"},templates:{href:"/templates",label:"Templates"},search:{href:"/search",label:"Search"},sheets:{href:"/sheets",label:"Sheets"},reporting:{href:"/reporting",label:"Reporting"},pomodoro:{href:"/pomodoro",label:"Pomodoro"},"manage-tags":{href:"/settings/tags",label:"Manage tags"},"sync-settings":{href:"/settings/cloud-sync",label:"Sync settings"}},A=new Set(["manage-tags","pomodoro","templates","sync-settings"]);function M(){let e=(0,n.useRouter)(),a=(0,n.usePathname)()??"/",s=(0,c.useSyncExternalStore)(C.subscribe_theme,k,S),l=(0,c.useSyncExternalStore)(y.subscribe,y.get_snapshot,y.get_server_snapshot),o=(0,c.useSyncExternalStore)(j.tracker_shortcut_map_preference.subscribe,j.tracker_shortcut_map_preference.get_snapshot,j.tracker_shortcut_map_preference.get_server_snapshot),h=(0,c.useSyncExternalStore)(v.topbar_quick_actions_preference.subscribe,v.topbar_quick_actions_preference.get_snapshot,v.topbar_quick_actions_preference.get_server_snapshot),f=(0,x.parse_tracker_shortcut_map)(o),_=new Set(g(h)),b=p.topbar_quick_action_ids.filter(e=>!_.has(e)),M=Array.from(new Set([...Array.from(A),...b])),{email:D,is_configured:I,is_pending:U,sign_out:q}=(0,i.use_supabase_auth_session)(),[F,B]=(0,c.useState)(!1),K=(0,c.useRef)(null);(0,c.useEffect)(()=>{if(!F)return;let e=e=>{null===K.current||K.current.contains(e.target)||B(!1)};return document.addEventListener("pointerdown",e),()=>{document.removeEventListener("pointerdown",e)}},[F]);let z=()=>{B(!1)};return(0,O.use_escape_to_cancel)(z,F),(0,t.jsxs)("div",{className:"relative shrink-0",ref:K,children:[(0,t.jsx)("button",{type:"button",className:"inline-flex h-8 w-8 cursor-pointer items-center justify-center rounded-full border border-panel-border bg-ghost-bg text-muted hover:bg-surface-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent","aria-label":"Open menu","aria-expanded":F,"aria-haspopup":"menu",onClick:()=>B(e=>!e),children:(0,t.jsx)(u.HamburgerIcon,{})}),F?(0,t.jsxs)("ul",{className:"absolute right-0 top-full z-50 mt-1.5 min-w-56 list-none rounded-md border border-panel-border bg-panel p-1.5 shadow-md",role:"menu",children:[I&&null!==D?(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("p",{className:"m-0 truncate px-2.5 py-1 text-[0.72rem] uppercase tracking-[0.04em] text-muted",title:D,children:D})}):null,M.map(e=>{let n=P[e];return(0,t.jsx)("li",{role:"none",children:(0,t.jsx)(r.default,{href:n.href,className:L,role:"menuitem",onClick:z,children:n.label})},e)}),I?(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:L,role:"menuitemcheckbox","aria-checked":"true"===l,onClick:()=>{let e="true"===l?"false":"true";y.write(e),y.notify(),(0,m.notify_settings_saved)("true"===e?"Cloud sync enabled":"Cloud sync disabled"),"true"===e&&null!==D&&(0,w.run_tracker_db_cloud_sync)({merge_on_load:!0}).catch(()=>{})},children:(0,t.jsxs)("span",{className:"inline-flex w-full items-center justify-between gap-2",children:[(0,t.jsx)("span",{children:"true"===l?"Pause cloud sync":"Resume cloud sync"}),(0,t.jsx)("span",{className:"text-muted","aria-hidden":"true",children:"true"===l?"On":"Off"})]})})}):null,(0,t.jsx)("li",{className:"my-1 border-t border-panel-border",role:"separator","aria-hidden":"true"}),(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:L,role:"menuitem",onClick:()=>{let e;z(),e="dark"===N()?"light":"dark",(0,E.apply_theme)(e),(0,R.write_stored_theme)(e),T.theme_mode_preference.write(e),(0,$.write_document_preference_cookies)({theme_mode:e,theme:e}),T.theme_mode_preference.notify(),(0,C.notify_theme_subscribers)(),(0,m.notify_settings_saved)()},suppressHydrationWarning:!0,children:(0,t.jsxs)("span",{className:"inline-flex w-full items-center justify-between gap-2",children:[(0,t.jsxs)("span",{children:["dark"===s?"Dark":"Light"," theme"]}),(0,t.jsx)("span",{"aria-hidden":"true",children:"dark"===s?"☾":"☀"})]})})}),(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:L,role:"menuitem",onClick:()=>{let e;z(),e=f.help,document.dispatchEvent(new KeyboardEvent("keydown",{key:e,shiftKey:"?"===e,bubbles:!0}))},children:(0,t.jsxs)("span",{className:"inline-flex w-full items-center justify-between gap-2",children:[(0,t.jsx)("span",{children:"Keyboard shortcuts"}),(0,t.jsx)("span",{className:"text-muted","aria-hidden":"true",children:"(?)"})]})})}),I?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("li",{className:"my-1 border-t border-panel-border",role:"separator","aria-hidden":"true"}),null===D?(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:L,role:"menuitem",onClick:()=>{z(),e.push((0,d.build_auth_page_href)("sign_in",a))},children:"Sign in"})}):(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:`${L} text-danger`,role:"menuitem",disabled:U,onClick:()=>{z(),q()},children:U?"Signing out…":"Sign out"})})]}):null]}):null]})}let D=[{id:"today",href:"/today",label:"Today"},{id:"review",href:"/review",label:"Review"},{id:"templates",href:"/templates",label:"Templates"},{id:"search",href:"/search",label:"Search"},{id:"sheets",href:"/sheets",label:"Sheets"},{id:"reporting",href:"/reporting",label:"Reporting"},{id:"pomodoro",href:"/pomodoro",label:"Pomodoro"},{id:"manage-tags",href:"/settings/tags",label:"Tags"},{id:"sync-settings",href:"/settings/cloud-sync",label:"Sync"}];function I(){let e=(0,n.usePathname)()??"/",a=(0,c.useSyncExternalStore)(v.topbar_quick_actions_preference.subscribe,v.topbar_quick_actions_preference.get_snapshot,v.topbar_quick_actions_preference.get_server_snapshot),s=(0,c.useMemo)(()=>g(a),[a]);if(0===s.length)return null;let l=D.filter(e=>s.includes(e.id));return 0===l.length?null:(0,t.jsx)("div",{className:"hidden items-center gap-1 min-[980px]:flex",children:l.map(n=>{let a=e.startsWith(n.href);return(0,t.jsx)(r.default,{href:n.href,className:`rounded-full px-2.5 py-1 text-[0.78rem] font-semibold no-underline transition-colors duration-150 ${a?"bg-accent-soft text-foreground":"text-muted hover:bg-surface-hover hover:text-foreground"}`,"aria-current":a?"page":void 0,children:n.label},n.id)})})}var U=e.i(29539);function q(){let e=((0,n.usePathname)()??"/").startsWith("/settings");return(0,t.jsx)(r.default,{href:"/settings",className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-panel-border bg-ghost-bg text-muted no-underline hover:bg-surface-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent${e?" border-accent-border text-foreground":""}`,"aria-label":"Settings","aria-current":e?"page":void 0,children:(0,t.jsx)(U.SettingsIcon,{})})}function F({current:e,parent:n}){return(0,t.jsx)("nav",{"aria-label":"Breadcrumb",className:"min-w-0 text-left",children:(0,t.jsxs)("ol",{className:"m-0 flex min-w-0 list-none flex-wrap items-center gap-1.5 p-0 text-[0.85rem]",children:[(0,t.jsx)("li",{children:(0,t.jsx)(r.default,{className:"text-muted no-underline hover:text-foreground",href:"/",children:"Tracker"})}),void 0!==n?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("li",{className:"text-muted","aria-hidden":"true",children:"/"}),(0,t.jsx)("li",{children:void 0!==n.href?(0,t.jsx)(r.default,{className:"max-w-44 truncate text-muted no-underline hover:text-foreground sm:max-w-none",href:n.href,children:n.label}):(0,t.jsx)("span",{className:"max-w-44 truncate text-muted sm:max-w-none",children:n.label})})]}):null,(0,t.jsx)("li",{className:"text-muted","aria-hidden":"true",children:"/"}),(0,t.jsx)("li",{className:"max-w-44 truncate font-medium text-foreground sm:max-w-none","aria-current":"page",children:e})]})})}e.s(["TrackerTopbar",0,function({breadcrumb:e}={}){return(0,t.jsx)("header",{className:"relative z-1 border-b border-panel-border bg-[color-mix(in_srgb,var(--panel)_92%,var(--background))] shadow-sm backdrop-blur-[10px]",children:(0,t.jsxs)("div",{className:"mx-auto flex max-w-[1120px] min-h-13 flex-wrap items-center gap-x-4 gap-y-2 px-4 py-2 sm:px-5",children:[(0,t.jsx)("span",{className:"inline-flex min-w-0 shrink items-center font-mono text-[0.72rem] font-semibold uppercase leading-tight tracking-[0.08em] text-accent whitespace-nowrap",children:"super-time-tracker"}),void 0!==e?(0,t.jsx)("div",{className:"min-w-0 flex-1",children:(0,t.jsx)(F,{current:e.current,parent:e.parent})}):null,(0,t.jsxs)("div",{className:"flex w-full items-center justify-between gap-2 min-[980px]:ml-auto min-[980px]:w-auto min-[980px]:justify-end",children:[(0,t.jsx)(s,{}),(0,t.jsxs)("div",{className:"flex shrink-0 items-center justify-end gap-2",children:[(0,t.jsx)(I,{}),(0,t.jsx)(o,{}),(0,t.jsx)(q,{}),(0,t.jsx)(M,{})]})]})]})})}],75404)},52405,e=>{"use strict";e.s(["get_input_class_name",0,function(e="default"){let t="box-border max-w-full min-w-0 w-full rounded-[0.65rem] border border-panel-border bg-input-bg px-3 py-2.5 font-inherit text-inherit transition-[background-color,border-color] duration-200 focus:border-input-focus-border focus:outline-none";return"compact"===e?`${t} px-2.5 py-2`:t}])},18774,e=>{"use strict";e.s(["format_display_tag",0,function(e){return e.startsWith("@")?e:`@${e}`}])},31113,e=>{"use strict";e.s(["normalize_stored_tag",0,function(e){let t=e.trim().replace(/^@+/,"");if(0===t.length)throw Error("Tag name must not be empty.");if(!/^\w+$/.test(t))throw Error("Tags may only contain letters, numbers, and underscores.");return`@${t}`}])},14260,e=>{"use strict";var t=e.i(8063),r=e.i(51268),n=e.i(18774),a=e.i(52405),s=e.i(31113);e.s(["TagAutocompleteInput",0,function({id:e,value:l,known_tags:i,placeholder:o,disabled:c=!1,autoFocus:u=!1,on_change:d}){let m=(0,r.useRef)(null),p=(0,r.useRef)(null),h=(0,r.useRef)(null),[f,g]=(0,r.useState)(0),[x,_]=(0,r.useState)(0),b=function(e,t){let r=e.slice(0,t),n=r.lastIndexOf("@");if(-1===n)return null;let a=r.slice(n+1);return/\s/.test(a)?null:{query:a,start_index:n,end_index:t}}(l,f),y=null===b?[]:function(e,t,r=10){let n=t.toLowerCase();return e.filter(e=>{let t=e.replace(/^@/,"").toLowerCase();return 0===n.length||t.startsWith(n)}).slice(0,r)}(i,b.query),v=null!==b&&function(e,t){if(!/^\w+$/.test(e))return!1;let r=e.toLowerCase();return t.some(e=>{try{return(0,s.normalize_stored_tag)(e).slice(1).toLowerCase()===r}catch{return!1}})}(b.query,i),j=null!==b&&y.length>0&&!v&&!c;(0,r.useLayoutEffect)(()=>{null!==h.current&&null!==m.current&&(m.current.setSelectionRange(h.current,h.current),g(h.current),h.current=null)},[l]),(0,r.useEffect)(()=>{_(0)},[l,f,y.length]);let w=()=>{g(m.current?.selectionStart??l.length)},N=()=>{_(0)},k=e=>{let t,r,a;if(null===b)return;let{next_text:s,next_cursor:i}=(t=(0,n.format_display_tag)(e),r=l.slice(0,b.start_index),a=l.slice(b.end_index),{next_text:`${r}${t}${a}`,next_cursor:r.length+t.length});h.current=i,d(s),N()};return(0,t.jsxs)("div",{className:"relative min-w-0",children:[(0,t.jsx)("input",{ref:m,id:e,type:"text",role:"combobox",className:(0,a.get_input_class_name)(),value:l,placeholder:o,disabled:c,autoFocus:u,autoComplete:"off","aria-autocomplete":"list","aria-expanded":j,"aria-controls":j?`${e}-tag-suggestions`:void 0,onChange:e=>{d(e.target.value),g(e.target.selectionStart??e.target.value.length)},onClick:w,onKeyUp:w,onKeyDown:e=>{if(j){if("ArrowDown"===e.key){e.preventDefault(),_(e=>(e+1)%y.length);return}if("ArrowUp"===e.key){e.preventDefault(),_(e=>(e-1+y.length)%y.length);return}if("Enter"===e.key||"Tab"===e.key){e.preventDefault();let t=y[x];void 0!==t&&k(t);return}"Escape"===e.key&&(e.preventDefault(),N())}},onBlur:()=>{window.setTimeout(N,120)}}),j?(0,t.jsx)("ul",{ref:p,id:`${e}-tag-suggestions`,role:"listbox",className:"absolute left-0 right-0 top-full z-20 mt-1 max-h-48 list-none overflow-y-auto rounded-md border border-panel-border bg-panel p-1.5 shadow-md",children:y.map((e,r)=>(0,t.jsx)("li",{role:"option","aria-selected":r===x,children:(0,t.jsx)("button",{type:"button",className:`block w-full cursor-pointer rounded-[0.45rem] border-0 bg-transparent px-2.5 py-1.5 text-left font-inherit text-[0.85rem] text-inherit hover:bg-surface-hover ${r===x?"bg-surface-hover":""}`,onMouseDown:t=>{t.preventDefault(),k(e)},children:(0,n.format_display_tag)(e)})},e))}):null]})}],14260)},39474,20993,e=>{"use strict";var t=e.i(13349),r=e.i(32417),n=e.i(44171),a=e.i(28274);let s=null,l=Promise.resolve();function i(){(0,r.is_supabase_configured)()&&(0,n.is_cloud_sync_enabled)()&&(null!==s&&clearTimeout(s),s=setTimeout(()=>{s=null,l=l.then(()=>(0,a.run_tracker_db_cloud_sync)()).catch(()=>{})},400))}function o(){(0,t.is_greedy_cloud_sync_enabled)()&&i()}e.s(["schedule_tracker_db_cloud_sync",0,o],20993),e.s(["push_tracker_db_cloud_after_change",0,function(){(0,t.is_greedy_cloud_sync_enabled)()?o():i()}],39474)},97176,e=>{"use strict";var t=e.i(13349);async function r(e){let t=await fetch("/api/sheet/active",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e})});if(!t.ok)throw Error((await t.json()).error??"Failed to update active sheet in cloud")}var n=e.i(39474),a=e.i(20993);e.s(["notify_tracker_db_cloud_sync",0,function(e,s){if("/api/sheet"===e&&"object"==typeof s&&null!==s&&!0!==s.delete&&!(0,t.is_greedy_cloud_sync_enabled)()){let e=s.name?.trim()??"";e.length>0&&r(e).catch(()=>{});return}(0,t.is_greedy_cloud_sync_enabled)()?(0,a.schedule_tracker_db_cloud_sync)():(0,n.push_tracker_db_cloud_after_change)()}],97176)},44356,e=>{"use strict";var t=e.i(18774);e.s(["build_resume_description",0,function(e,r){let n=e.trim(),a=n.length>0?n:"Untitled entry",s=r.map(e=>(0,t.format_display_tag)(e)).join(" ");return s.length>0?`${a} ${s}`.trim():a}])},51229,e=>{"use strict";var t=e.i(97176);let r=new Set(["/api/note"]);async function n(e,n){let a={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},s=await fetch(e,a);if(!s.ok){var l,i;let t,n=(await s.json()).error??"Request failed";if(l=e,i=n,r.has(l)&&((t=i.toLowerCase()).includes("duplicate key")||t.includes("unique constraint"))){if(await new Promise(e=>{setTimeout(e,25)}),!(s=await fetch(e,a)).ok)throw Error((await s.json()).error??n)}else throw Error(n)}let o=await s.json();return(0,t.notify_tracker_db_cloud_sync)(e,n),o}e.s(["post_tracker_action",0,n])},36178,e=>{"use strict";e.s(["build_check_out_request_payload",0,function(e,t){let r={sheetName:e},n=t?.at?.trim(),a=t?.note?.trim();return void 0!==n&&n.length>0&&(r.at=n),void 0!==a&&a.length>0&&(r.note=a),r}])},75899,35923,e=>{"use strict";var t=e.i(39552);e.s(["format_time",0,function(e,r="12h"){return(0,t.format)(new Date(e),"24h"===r?"HH:mm":"h:mm a")}],75899);var r=e.i(51268),n=e.i(97891);e.s(["use_time_format",0,function(){return(0,r.useSyncExternalStore)(n.time_format_preference.subscribe,n.time_format_preference.get_snapshot,n.time_format_preference.get_server_snapshot)}],35923)},69837,e=>{"use strict";var t=e.i(39552);e.s(["format_datetime_hint",0,function(e){return(0,t.format)(new Date(e),"MMM d, h:mm a")}])},3159,e=>{"use strict";var t=e.i(97176);let r=new Set(["/api/note"]);async function n(e,n){let a={method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},s=await fetch(e,a);if(!s.ok){var l,i;let t,n=(await s.json()).error??"Request failed";if(l=e,i=n,r.has(l)&&((t=i.toLowerCase()).includes("duplicate key")||t.includes("unique constraint"))){if(await new Promise(e=>{setTimeout(e,25)}),!(s=await fetch(e,a)).ok)throw Error((await s.json()).error??n)}else throw Error(n)}let o=await s.json();return(0,t.notify_tracker_db_cloud_sync)(e,n),o}e.s(["patch_tracker_action",0,n])},52161,e=>{"use strict";var t=e.i(8063),r=e.i(51268),n=e.i(52663),a=e.i(52405),s=e.i(25204);e.s(["NoteForm",0,function({on_submit:e,on_cancel:l,is_pending:i,in_active_panel:o=!1,in_bar:c=!1,allow_at:u=!1}){let[d,m]=(0,r.useState)(""),[p,h]=(0,r.useState)("");return(0,s.use_escape_to_cancel)(()=>l?.(),void 0!==l),(0,t.jsxs)("form",{className:`flex flex-col gap-2 ${o&&!c?"border-t border-accent-border pt-4":c?"border-t border-[color-mix(in_srgb,var(--accent-border)_65%,var(--panel-border))] pt-3.5":""}`,onSubmit:t=>{t.preventDefault();let r=d.trim();if(0===r.length)return;let n=p.trim();e(r,n.length>0?n:void 0),m(""),h("")},children:[(0,t.jsx)("label",{className:"text-[0.85rem] text-muted",htmlFor:"note-text",children:"Add note"}),(0,t.jsxs)("div",{className:"grid grid-cols-[minmax(0,1fr)_auto] gap-2 max-[860px]:grid-cols-1",children:[(0,t.jsx)("input",{id:"note-text",className:(0,a.get_input_class_name)(),value:d,onChange:e=>m(e.target.value),placeholder:"Pair with alice on the widget",disabled:i,autoFocus:!0}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 max-[860px]:w-full",children:[(0,t.jsx)("button",{type:"submit",className:(0,n.get_button_class_name)("ghost"),disabled:i||0===d.trim().length,children:"Save note"}),void 0===l?null:(0,t.jsx)("button",{type:"button",className:(0,n.get_button_class_name)("ghost"),disabled:i,onClick:l,children:"Cancel"})]})]}),u?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("label",{className:"text-[0.85rem] text-muted",htmlFor:"note-at",children:["Note time"," ",(0,t.jsx)("span",{className:"font-normal opacity-85",children:"(optional, natural language)"})]}),(0,t.jsx)("input",{id:"note-at",className:(0,a.get_input_class_name)(),value:p,onChange:e=>h(e.target.value),placeholder:"e.g. 30 minutes ago",disabled:i})]}):null]})}],52161)},94287,e=>{"use strict";var t=e.i(8063),r=e.i(48042),n=e.i(51268),a=e.i(69837),s=e.i(75899),l=e.i(52161),i=e.i(14260),o=e.i(75404),c=e.i(36178),u=e.i(44356),d=e.i(18774),m=e.i(32584),p=e.i(52663),h=e.i(52405),f=e.i(37193),g=e.i(3159),x=e.i(51229),_=e.i(1800),b=e.i(35923);let y="w-full rounded-md border border-panel-border bg-panel p-4 shadow-sm";function v({label:e,value:r,tone:n="default"}){var a;let s="accent"===(a=n)?"text-accent":"danger"===a?"text-danger":"text-foreground";return(0,t.jsxs)("article",{className:"rounded-md border border-panel-border bg-panel p-3.5 shadow-sm",children:[(0,t.jsx)("p",{className:"m-0 text-[0.72rem] font-semibold uppercase tracking-[0.06em] text-muted",children:e}),(0,t.jsx)("p",{className:`m-0 mt-1 text-[1.1rem] font-[650] ${s}`,children:r})]})}function j({label:e,count:r,active:n,on_click:a}){return(0,t.jsxs)("button",{type:"button",className:`flex cursor-pointer items-center justify-between gap-2 rounded-md border-0 px-2.5 py-2 text-left font-inherit text-[0.86rem] ${n?"bg-accent-soft text-foreground":"bg-transparent text-muted hover:bg-surface-hover hover:text-foreground"}`,onClick:a,children:[(0,t.jsx)("span",{className:"font-semibold",children:e}),(0,t.jsx)("span",{className:"rounded-full bg-background px-2 py-0.5 text-[0.72rem] text-muted",children:r})]})}function w({entries:e,is_pending:r,on_close:n}){return(0,t.jsxs)("section",{className:y,"aria-label":"Running timers",children:[(0,t.jsx)(O,{title:"Close running timers",description:"Set an end time and optional checkout note before wrapping the day."}),0===e.length?(0,t.jsx)(L,{message:"No timers are running."}):(0,t.jsx)("ul",{className:"m-0 mt-4 flex list-none flex-col gap-3 p-0",children:e.map(e=>(0,t.jsx)(N,{entry:e,is_pending:r,on_close:n},`${e.sheetName}-${e.id}`))})]})}function N({entry:e,is_pending:r,on_close:a}){let[l,i]=(0,n.useState)(""),[o,c]=(0,n.useState)(""),u=(0,_.use_duration_format)(),d=(0,b.use_time_format)();return(0,t.jsxs)("li",{className:"rounded-md border border-panel-border bg-background p-3",children:[(0,t.jsx)(R,{entry:e,duration_ms:e.durationMs}),(0,t.jsxs)("p",{className:"m-0 mt-1 text-[0.8rem] text-muted",children:["Started ",(0,s.format_time)(e.start,d),". Running for"," ",(0,m.format_duration)(e.durationMs,u),"."]}),(0,t.jsxs)("div",{className:"mt-3 grid grid-cols-1 gap-2 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto]",children:[(0,t.jsx)("input",{className:(0,h.get_input_class_name)("compact"),value:l,disabled:r,placeholder:"End time, e.g. now or 5pm","aria-label":"Checkout time",onChange:e=>i(e.target.value)}),(0,t.jsx)("input",{className:(0,h.get_input_class_name)("compact"),value:o,disabled:r,placeholder:"Checkout note","aria-label":"Checkout note",onChange:e=>c(e.target.value)}),(0,t.jsx)("button",{type:"button",className:(0,p.get_button_class_name)("primary","small"),disabled:r,onClick:()=>a(e,l.trim().length>0?l.trim():void 0,o.trim().length>0?o.trim():void 0),children:"Close timer"})]})]})}function k({entries:e,threshold_ms:r,known_tags:n,is_pending:a,on_save:s}){let l=(0,_.use_duration_format)();return(0,t.jsxs)("section",{className:y,"aria-label":"Long entries",children:[(0,t.jsx)(O,{title:"Review suspiciously long entries",description:`Entries at or above ${(0,m.format_duration)(r,l)} are listed here for correction.`}),0===e.length?(0,t.jsx)(L,{message:"No long entries need review."}):(0,t.jsx)("ul",{className:"m-0 mt-4 flex list-none flex-col gap-3 p-0",children:e.map(e=>(0,t.jsx)(T,{entry:e,known_tags:n,is_pending:a,show_times:!0,on_save:s},`${e.sheetName}-${e.id}`))})]})}function S({gaps:e,sheet_names:r,known_tags:n,is_pending:a,on_create:s}){return(0,t.jsxs)("section",{className:y,"aria-label":"Idle gaps",children:[(0,t.jsx)(O,{title:"Fill idle gaps",description:"Create completed entries for untracked time between today's logged blocks."}),0===e.length?(0,t.jsx)(L,{message:"No idle gaps found between entries."}):(0,t.jsx)("ul",{className:"m-0 mt-4 flex list-none flex-col gap-3 p-0",children:e.map(e=>(0,t.jsx)(C,{gap:e,sheet_names:r,known_tags:n,is_pending:a,on_create:s},e.id))})]})}function C({gap:e,sheet_names:r,known_tags:a,is_pending:l,on_create:o}){let c=(0,b.use_time_format)(),u=(0,_.use_duration_format)(),d=e.previousEntry?.sheetName??r[0]??"",[f,g]=(0,n.useState)(d),[x,y]=(0,n.useState)(""),[v,j]=(0,n.useState)("");return(0,t.jsxs)("li",{className:"rounded-md border border-panel-border bg-background p-3",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[(0,t.jsxs)("p",{className:"m-0 font-semibold",children:[(0,s.format_time)(e.start,c)," to"," ",(0,s.format_time)(e.end,c)]}),(0,t.jsx)("span",{className:"font-mono text-[0.86rem] font-semibold text-accent",children:(0,m.format_duration)(e.durationMs,u)})]}),(0,t.jsxs)("p",{className:"m-0 mt-1 text-[0.8rem] text-muted",children:["Between ",e.previousEntry?.description||"the previous entry"," and"," ",e.nextEntry?.description||"the next entry","."]}),(0,t.jsxs)("div",{className:"mt-3 grid grid-cols-1 gap-2 md:grid-cols-[11rem_minmax(0,1fr)]",children:[(0,t.jsx)("select",{className:(0,h.get_input_class_name)("compact"),value:f,disabled:l,"aria-label":"Gap sheet",onChange:e=>g(e.target.value),children:r.map(e=>(0,t.jsx)("option",{value:e,children:e},e))}),(0,t.jsx)(i.TagAutocompleteInput,{id:`gap-description-${e.id}`,value:x,known_tags:a,placeholder:"What filled this gap? Add @tags",disabled:l,on_change:y}),(0,t.jsx)("input",{className:`${(0,h.get_input_class_name)("compact")} md:col-span-2`,value:v,disabled:l,placeholder:"Optional note","aria-label":"Gap note",onChange:e=>j(e.target.value)})]}),(0,t.jsx)("button",{type:"button",className:`${(0,p.get_button_class_name)("primary","small")} mt-3`,disabled:l||0===f.length||0===x.trim().length,onClick:()=>o(e,f,x.trim(),v.trim().length>0?v.trim():void 0),children:"Create entry"})]})}function E({issues:e,known_tags:r,is_pending:n,on_save:a}){return(0,t.jsxs)("section",{className:y,"aria-label":"Tag issues",children:[(0,t.jsx)(O,{title:"Normalize tags",description:"Add missing tags and clean up tag casing on today's entries."}),0===e.length?(0,t.jsx)(L,{message:"No tag cleanup needed."}):(0,t.jsx)("ul",{className:"m-0 mt-4 flex list-none flex-col gap-3 p-0",children:e.map(e=>(0,t.jsx)(T,{entry:e.entry,known_tags:r,is_pending:n,issue_label:e.kinds.map(e=>"missing_tags"===e?"Missing tags":"Tag casing differs").join(" and "),on_save:(e,t)=>{void 0!==t&&a(e,t)}},`${e.entry.sheetName}-${e.entry.id}`))})]})}function T({entry:e,known_tags:r,is_pending:s,issue_label:l,show_times:o=!1,on_save:c}){let[d,m]=(0,n.useState)((0,u.build_resume_description)(e.description,e.tags)),[f,g]=(0,n.useState)(""),[x,_]=(0,n.useState)(""),b=d.trim()!==(0,u.build_resume_description)(e.description,e.tags).trim()||f.trim().length>0||x.trim().length>0;return(0,t.jsxs)("li",{className:"rounded-md border border-panel-border bg-background p-3",children:[(0,t.jsx)(R,{entry:e,duration_ms:e.reviewDurationMs}),void 0===l?null:(0,t.jsx)("p",{className:"m-0 mt-1 text-[0.8rem] text-muted",children:l}),(0,t.jsxs)("div",{className:"mt-3 flex flex-col gap-2",children:[(0,t.jsx)(i.TagAutocompleteInput,{id:`review-entry-${e.sheetName}-${e.id}`,value:d,known_tags:r,disabled:s,placeholder:"Description with @tags",on_change:m}),o?(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,t.jsx)("input",{className:(0,h.get_input_class_name)("compact"),value:f,disabled:s,placeholder:`Start: ${(0,a.format_datetime_hint)(e.start)}`,"aria-label":"Entry start",onChange:e=>g(e.target.value)}),(0,t.jsx)("input",{className:(0,h.get_input_class_name)("compact"),value:x,disabled:s,placeholder:null===e.end?"End: still running":`End: ${(0,a.format_datetime_hint)(e.end)}`,"aria-label":"Entry end",onChange:e=>_(e.target.value)})]}):null,(0,t.jsx)("button",{type:"button",className:`${(0,p.get_button_class_name)("primary","small")} w-fit`,disabled:s||!b,onClick:()=>c(e,d.trim(),f.trim().length>0?f.trim():void 0,x.trim().length>0?x.trim():void 0),children:"Save changes"})]})]})}function $({entries:e,is_pending:r,on_add_note:n}){return(0,t.jsxs)("section",{className:y,"aria-label":"Review notes",children:[(0,t.jsx)(O,{title:"Add handoff notes",description:"Attach details to entries while the work is still fresh."}),0===e.length?(0,t.jsx)(L,{message:"No entries today."}):(0,t.jsx)("ul",{className:"m-0 mt-4 flex list-none flex-col gap-3 p-0",children:e.map(e=>(0,t.jsxs)("li",{className:"rounded-md border border-panel-border bg-background p-3",children:[(0,t.jsx)(R,{entry:e,duration_ms:e.reviewDurationMs}),e.notes.length>0?(0,t.jsxs)("p",{className:"m-0 mt-1 text-[0.8rem] text-muted",children:[e.notes.length," ",1===e.notes.length?"note":"notes"," already added."]}):null,(0,t.jsx)("div",{className:"mt-3",children:(0,t.jsx)(l.NoteForm,{is_pending:r,allow_at:!0,on_submit:(t,r)=>n(e,t,r)})})]},`${e.sheetName}-${e.id}`))})]})}function R({entry:e,duration_ms:r}){let n=(0,_.use_duration_format)();return(0,t.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("p",{className:"m-0 text-[0.72rem] font-semibold uppercase tracking-[0.04em] text-muted",children:e.sheetName}),(0,t.jsx)("p",{className:"m-0 mt-1 text-[0.95rem] font-semibold",children:e.description||"Untitled entry"}),e.tags.length>0?(0,t.jsx)("ul",{className:"m-0 mt-2 flex list-none flex-wrap gap-1.5 p-0",children:e.tags.map(e=>(0,t.jsx)("li",{className:"rounded-full bg-tag-bg px-2 py-0.5 text-xs text-tag-text",children:(0,d.format_display_tag)(e)},e))}):null]}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-[0.88rem] font-semibold text-accent",children:(0,m.format_duration)(r,n)})]})}function O({title:e,description:r}){return(0,t.jsxs)("header",{children:[(0,t.jsx)("h2",{className:"m-0 text-[1rem] font-semibold",children:e}),(0,t.jsx)("p",{className:"m-0 mt-1 text-[0.86rem] leading-relaxed text-muted",children:r})]})}function L({message:e}){return(0,t.jsx)("p",{className:"m-0 mt-4 text-[0.9rem] text-muted",children:e})}e.s(["EndOfDayReviewView",0,function({initial_data:e}){let a=(0,r.useRouter)(),[s,l]=(0,n.useState)(e),[i,u]=(0,n.useState)("running"),[d,m]=(0,n.useState)(null),[p,h]=(0,n.useState)(null),[_,b]=(0,n.useState)(!1);(0,n.useEffect)(()=>{l(e)},[e]);let y=(0,n.useMemo)(()=>[0===s.runningEntries.length,0===s.longEntries.length,0===s.idleGaps.length,0===s.tagIssues.length].filter(Boolean).length,[s]),N=async(e,t)=>{b(!0),m(null),h(null);try{await e(),h(t),a.refresh()}catch(e){m((0,f.message_from_unknown_error)(e,"Review action failed"))}finally{b(!1)}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.TrackerTopbar,{breadcrumb:{current:"Review"}}),(0,t.jsxs)("main",{className:"mx-auto flex w-full max-w-5xl flex-col gap-6 px-5 pb-12 pt-6",children:[(0,t.jsxs)("header",{className:"flex flex-col gap-2 text-center",children:[(0,t.jsx)("h1",{className:"m-0 text-[1.5rem] font-[650] tracking-tight",children:"End-of-day review"}),(0,t.jsxs)("p",{className:"m-0 text-[0.9rem] leading-relaxed text-muted",children:[s.dateLabel,". Close timers, fill gaps, normalize tags, and add handoff notes."]})]}),null===d?null:(0,t.jsx)("p",{className:"m-0 rounded-md border border-danger-border bg-danger-soft px-3 py-2 text-[0.85rem] text-danger",children:d}),null===p?null:(0,t.jsx)("p",{className:"m-0 rounded-md border border-accent-border bg-accent-soft px-3 py-2 text-[0.85rem] text-accent",children:p}),(0,t.jsxs)("section",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-4","aria-label":"Review summary",children:[(0,t.jsx)(v,{label:"Checklist",value:`${y}/4 clear`,tone:4===y?"accent":"default"}),(0,t.jsx)(v,{label:"Running",value:String(s.runningEntries.length),tone:s.runningEntries.length>0?"danger":"accent"}),(0,t.jsx)(v,{label:"Entries today",value:String(s.entries.length)}),(0,t.jsx)(v,{label:"Gaps",value:String(s.idleGaps.length),tone:s.idleGaps.length>0?"warning":"accent"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-[14rem_minmax(0,1fr)] gap-4 max-[760px]:grid-cols-1",children:[(0,t.jsxs)("nav",{className:"flex h-fit flex-col gap-1 rounded-md border border-panel-border bg-panel p-1.5 shadow-sm","aria-label":"Review sections",children:[(0,t.jsx)(j,{label:"Running timers",count:s.runningEntries.length,active:"running"===i,on_click:()=>u("running")}),(0,t.jsx)(j,{label:"Long entries",count:s.longEntries.length,active:"long"===i,on_click:()=>u("long")}),(0,t.jsx)(j,{label:"Idle gaps",count:s.idleGaps.length,active:"gaps"===i,on_click:()=>u("gaps")}),(0,t.jsx)(j,{label:"Tags",count:s.tagIssues.length,active:"tags"===i,on_click:()=>u("tags")}),(0,t.jsx)(j,{label:"Notes",count:s.entries.length,active:"notes"===i,on_click:()=>u("notes")})]}),(0,t.jsxs)("div",{className:"min-w-0",children:["running"===i?(0,t.jsx)(w,{entries:s.runningEntries,is_pending:_,on_close:(e,t,r)=>N(()=>(0,x.post_tracker_action)("/api/out",(0,c.build_check_out_request_payload)(e.sheetName,{at:t,note:r})),"Timer closed.")}):null,"long"===i?(0,t.jsx)(k,{entries:s.longEntries,threshold_ms:s.longEntryThresholdMs,known_tags:s.knownTags,is_pending:_,on_save:(e,t,r,n)=>N(()=>(0,g.patch_tracker_action)("/api/entry",{sheetName:e.sheetName,entryId:e.id,description:t,start:r,end:n}),"Entry updated.")}):null,"gaps"===i?(0,t.jsx)(S,{gaps:s.idleGaps,sheet_names:s.sheetNames,known_tags:s.knownTags,is_pending:_,on_create:(e,t,r,n)=>N(()=>(0,x.post_tracker_action)("/api/entry/completed",{sheetName:t,description:r,start:e.start,end:e.end,note:n}),"Gap filled.")}):null,"tags"===i?(0,t.jsx)(E,{issues:s.tagIssues,known_tags:s.knownTags,is_pending:_,on_save:(e,t)=>N(()=>(0,g.patch_tracker_action)("/api/entry",{sheetName:e.sheetName,entryId:e.id,description:t}),"Tags updated.")}):null,"notes"===i?(0,t.jsx)($,{entries:s.entries,is_pending:_,on_add_note:(e,t,r)=>N(()=>(0,x.post_tracker_action)("/api/note",{sheetName:e.sheetName,entryId:e.id,text:t,at:r}),"Note added.")}):null]})]})]})]})}])}]);
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,37193,e=>{"use strict";e.s(["message_from_unknown_error",0,function(e,t){return e instanceof Error?e.message:"string"==typeof e?e:t}])},17003,e=>{"use strict";var t=e.i(27850),r=e.i(72550);e.s(["write_active_sheet_preference",0,function(e){let n=e.trim();if(0!==n.length){try{window.localStorage.setItem(r.ACTIVE_SHEET_STORAGE_KEY,n),(0,t.schedule_ui_preferences_cloud_sync)()}catch{}try{let e=encodeURIComponent(n);document.cookie=`${r.ACTIVE_SHEET_COOKIE_NAME}=${e}; Path=/; Max-Age=31536000; SameSite=Lax`}catch{}}}])},67321,e=>{"use strict";var t=e.i(17003);e.s(["navigate_to_tracker_sheet",0,function(e){(0,t.write_active_sheet_preference)(e)}])},60812,49532,85910,92572,31363,3087,e=>{"use strict";var t=e.i(44356);e.s(["build_entry_template_description",0,function(e){return(0,t.build_resume_description)(e.description,e.tags??[])}],60812);let r=["defaultSheetName","shortcutKey","createdAt","lastUsedAt"],n=e=>"object"==typeof e&&null!==e&&"string"==typeof e.id&&"string"==typeof e.name&&"string"==typeof e.description,a=e=>{let t={id:e.id,name:e.name,description:e.description};for(let n of r){let r=e[n];"string"==typeof r&&r.trim().length>0&&(t[n]=r)}return Array.isArray(e.tags)&&(t.tags=e.tags.filter(e=>"string"==typeof e&&e.length>0)),"boolean"==typeof e.favorite&&(t.favorite=e.favorite),"boolean"==typeof e.pomodoroLinked&&(t.pomodoroLinked=e.pomodoroLinked),"number"==typeof e.useCount&&Number.isFinite(e.useCount)&&e.useCount>0&&(t.useCount=Math.round(e.useCount)),t};function s(){try{let e=window.localStorage.getItem("super-time-tracker-entry-templates");if(null===e)return[];let t=JSON.parse(e);if(!Array.isArray(t))return[];return t.filter(n).map(a)}catch{return[]}}e.s(["read_entry_templates",0,s],49532);let i=[],o=null;function l(){o=null}e.s(["EMPTY_ENTRY_TEMPLATES",0,i,"get_stable_entry_templates_snapshot",0,function(e){let t=e.map(e=>[e.id,e.name,e.description,e.defaultSheetName??"",e.tags?.join(" ")??"",!0===e.favorite?"1":"0",e.shortcutKey??"",!0===e.pomodoroLinked?"1":"0",e.createdAt??"",e.lastUsedAt??"",String(e.useCount??0)].join("\0")).join("\n");if(null!==o&&o.templates_key===t)return o.snapshot;let r=0===e.length?i:Object.freeze(e.map(e=>({...e})));return o={templates_key:t,snapshot:r},r},"reset_entry_templates_snapshot_cache",0,l],85910);let c=new Set;function u(){l(),c.forEach(e=>{e()})}function d(e){if(void 0!==globalThis.window)try{globalThis.window.localStorage.setItem("super-time-tracker-entry-templates",JSON.stringify(e)),u()}catch{}}e.s(["notify_entry_templates_changed",0,u,"subscribe_entry_templates",0,function(e){return c.add(e),()=>{c.delete(e)}}],92572),e.s(["write_entry_templates",0,d],31363),e.s(["record_entry_template_usage",0,function(e){let t=s(),r=new Date().toISOString(),n=!1,a=t.map(t=>t.id!==e?t:(n=!0,{...t,lastUsedAt:r,useCount:(t.useCount??0)+1}));n&&d(a)}],3087)},52405,e=>{"use strict";e.s(["get_input_class_name",0,function(e="default"){let t="box-border max-w-full min-w-0 w-full rounded-[0.65rem] border border-panel-border bg-input-bg px-3 py-2.5 font-inherit text-inherit transition-[background-color,border-color] duration-200 focus:border-input-focus-border focus:outline-none";return"compact"===e?`${t} px-2.5 py-2`:t}])},18774,e=>{"use strict";e.s(["format_display_tag",0,function(e){return e.startsWith("@")?e:`@${e}`}])},39474,20993,e=>{"use strict";var t=e.i(13349),r=e.i(32417),n=e.i(44171),a=e.i(28274);let s=null,i=Promise.resolve();function o(){(0,r.is_supabase_configured)()&&(0,n.is_cloud_sync_enabled)()&&(null!==s&&clearTimeout(s),s=setTimeout(()=>{s=null,i=i.then(()=>(0,a.run_tracker_db_cloud_sync)()).catch(()=>{})},400))}function l(){(0,t.is_greedy_cloud_sync_enabled)()&&o()}e.s(["schedule_tracker_db_cloud_sync",0,l],20993),e.s(["push_tracker_db_cloud_after_change",0,function(){(0,t.is_greedy_cloud_sync_enabled)()?l():o()}],39474)},97176,e=>{"use strict";var t=e.i(13349);async function r(e){let t=await fetch("/api/sheet/active",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e})});if(!t.ok)throw Error((await t.json()).error??"Failed to update active sheet in cloud")}var n=e.i(39474),a=e.i(20993);e.s(["notify_tracker_db_cloud_sync",0,function(e,s){if("/api/sheet"===e&&"object"==typeof s&&null!==s&&!0!==s.delete&&!(0,t.is_greedy_cloud_sync_enabled)()){let e=s.name?.trim()??"";e.length>0&&r(e).catch(()=>{});return}(0,t.is_greedy_cloud_sync_enabled)()?(0,a.schedule_tracker_db_cloud_sync)():(0,n.push_tracker_db_cloud_after_change)()}],97176)},44356,e=>{"use strict";var t=e.i(18774);e.s(["build_resume_description",0,function(e,r){let n=e.trim(),a=n.length>0?n:"Untitled entry",s=r.map(e=>(0,t.format_display_tag)(e)).join(" ");return s.length>0?`${a} ${s}`.trim():a}])},51229,e=>{"use strict";var t=e.i(97176);let r=new Set(["/api/note"]);async function n(e,n){let a={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},s=await fetch(e,a);if(!s.ok){var i,o;let t,n=(await s.json()).error??"Request failed";if(i=e,o=n,r.has(i)&&((t=o.toLowerCase()).includes("duplicate key")||t.includes("unique constraint"))){if(await new Promise(e=>{setTimeout(e,25)}),!(s=await fetch(e,a)).ok)throw Error((await s.json()).error??n)}else throw Error(n)}let l=await s.json();return(0,t.notify_tracker_db_cloud_sync)(e,n),l}e.s(["post_tracker_action",0,n])},87231,e=>{"use strict";e.s(["build_entry_search_href",0,function(e){let t=new URLSearchParams;e.query.trim().length>0&&t.set("q",e.query.trim()),e.sheetName.trim().length>0&&t.set("sheet",e.sheetName.trim()),e.tag.trim().length>0&&t.set("tag",e.tag.trim()),e.fromDate.trim().length>0&&t.set("from",e.fromDate.trim()),e.toDate.trim().length>0&&t.set("to",e.toDate.trim());let r=t.toString();return r.length>0?`/search?${r}`:"/search"}])},56586,e=>{"use strict";let t={query:"",sheetName:"",tag:"",fromDate:"",toDate:""};e.s(["get_empty_entry_search_filters",0,function(){return{...t}}])},17993,e=>{"use strict";var t=e.i(51268);e.s(["use_debounced_value",0,function(e,r){let[n,a]=(0,t.useState)(e);return(0,t.useEffect)(()=>{let t=window.setTimeout(()=>{a(e)},r);return()=>{window.clearTimeout(t)}},[e,r]),n}])},54286,e=>{"use strict";var t=e.i(8063),r=e.i(48042),n=e.i(51268),a=e.i(52405);function s({items:e,query:r,is_loading:i,error:o,on_query_change:l,on_select:c,on_close:u}){var d;let m=(0,n.useId)(),p=(0,n.useRef)(null),h=(0,n.useRef)(null),[f,g]=(0,n.useState)(0),_=(0,n.useMemo)(()=>(function(e){let t=new Map;for(let r of e){let e=t.get(r.group)??[];e.push(r),t.set(r.group,e)}return Array.from(t.entries()).map(([e,t])=>({label:e,items:t}))})(e),[e]),y=(0,n.useMemo)(()=>_.flatMap(e=>e.items),[_]),b=(0,n.useMemo)(()=>{let e=new Map;return y.forEach((t,r)=>{e.set(t.id,r)}),e},[y]),w=0===y.length?0:Math.min(f,y.length-1),k=(d=y.length,!i&&0===d&&null===o);(0,n.useEffect)(()=>{let e=p.current;if(null!==e&&!e.open)return e.showModal(),()=>{e.open&&e.close()}},[]),(0,n.useEffect)(()=>{h.current?.focus()},[]);let v=()=>{p.current?.close(),u()};return(0,t.jsxs)("dialog",{ref:p,"aria-labelledby":m,"data-command-palette-dialog":"true",className:"fixed inset-0 z-100 m-0 flex max-h-none w-full max-w-none items-start justify-center border-0 bg-transparent p-4 pt-[12vh] backdrop:bg-overlay open:flex sm:p-6 sm:pt-[12vh]",onCancel:e=>{e.preventDefault(),v()},children:[(0,t.jsx)("button",{type:"button",tabIndex:-1,"aria-label":"Close command palette",className:"absolute inset-0 z-0 cursor-default border-0 bg-transparent p-0",onClick:v}),(0,t.jsxs)("div",{className:"relative z-1 flex w-full max-w-xl flex-col overflow-hidden rounded-lg border border-panel-border bg-panel shadow-lg",children:[(0,t.jsx)("p",{id:m,className:"sr-only",children:"Command palette"}),(0,t.jsxs)("div",{className:"border-b border-panel-border px-3 py-3",children:[(0,t.jsx)("label",{className:"sr-only",htmlFor:`${m}-input`,"aria-label":"Search commands",children:"Search commands"}),(0,t.jsx)("input",{ref:h,id:`${m}-input`,type:"search",autoComplete:"off",spellCheck:!1,placeholder:"Search sheets, entries, templates, reporting…",className:(0,a.get_input_class_name)("compact"),value:r,onChange:e=>{var t;return t=e.target.value,void(g(0),l(t))},onKeyDown:e=>{if((e.metaKey||e.ctrlKey)&&!e.altKey&&"k"===e.key.toLowerCase()){e.preventDefault(),e.stopPropagation(),v();return}if("Escape"===e.key){e.preventDefault(),v();return}if("ArrowDown"===e.key){if(e.preventDefault(),0===y.length)return;g(e=>(e+1)%y.length);return}if("ArrowUp"===e.key){if(e.preventDefault(),0===y.length)return;g(e=>0===e?y.length-1:e-1);return}if("Enter"===e.key){e.preventDefault();let t=y[w];void 0!==t&&c(t)}}})]}),(0,t.jsxs)("div",{className:"max-h-[min(24rem,55vh)] overflow-y-auto px-2 py-2","aria-live":"polite",children:[null===o?null:(0,t.jsx)("p",{className:"m-0 px-2 py-3 text-[0.85rem] text-danger",children:o}),i&&0===y.length?(0,t.jsx)("p",{className:"m-0 px-2 py-3 text-[0.85rem] text-muted",children:"Loading…"}):null,k?(0,t.jsx)("p",{className:"m-0 px-2 py-3 text-[0.85rem] text-muted",children:"No matching commands."}):null,_.map(e=>(0,t.jsxs)("section",{className:"mb-2 last:mb-0","aria-label":e.label,children:[(0,t.jsx)("h2",{className:"m-0 px-2 py-1 text-[0.72rem] font-semibold uppercase tracking-[0.06em] text-muted",children:e.label}),(0,t.jsx)("ul",{className:"m-0 list-none p-0",children:e.items.map(e=>{let r=b.get(e.id)??0,n=r===w;return(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button",className:`flex w-full cursor-pointer flex-col gap-0.5 rounded-md border-0 px-2.5 py-2 text-left font-inherit transition-colors duration-150 ${n?"bg-accent-soft text-foreground":"bg-transparent text-inherit hover:bg-surface-hover"}`,onMouseEnter:()=>g(r),onClick:()=>c(e),children:[(0,t.jsx)("span",{className:"text-[0.9rem] font-semibold",children:e.title}),void 0===e.subtitle?null:(0,t.jsx)("span",{className:"text-[0.78rem] text-muted",children:e.subtitle})]})},e.id)})})]},e.label))]}),(0,t.jsxs)("div",{className:"border-t border-panel-border px-3 py-2 text-[0.72rem] text-muted",children:[(0,t.jsx)("span",{className:"font-mono",children:"↑↓"})," navigate ·"," ",(0,t.jsx)("span",{className:"font-mono",children:"↵"})," select ·"," ",(0,t.jsx)("span",{className:"font-mono",children:"esc"})," close ·"," ",(0,t.jsx)("span",{className:"font-mono",children:"Ctrl+P"})," toggle"]})]})]})}var i=e.i(60812),o=e.i(18774),l=e.i(49532);let c=[{id:"nav-tracker",kind:"navigate",group:"Pages",title:"Open Tracker",keywords:["home","tracker","timer"],href:"/"},{id:"nav-today",kind:"navigate",group:"Pages",title:"Open Today",keywords:["today","focus","daily"],href:"/today"},{id:"nav-review",kind:"navigate",group:"Pages",title:"Open End-of-day Review",keywords:["review","end of day","daily","cleanup","gaps"],href:"/review"},{id:"nav-templates",kind:"navigate",group:"Pages",title:"Open Template Library",keywords:["templates","library","check in","shortcuts"],href:"/templates"},{id:"nav-sheets",kind:"navigate",group:"Pages",title:"Open Sheets",keywords:["sheets","projects","hub"],href:"/sheets"},{id:"nav-reporting",kind:"navigate",group:"Pages",title:"Open Reporting",keywords:["reporting","stats","analytics"],href:"/reporting"},{id:"nav-search",kind:"navigate",group:"Pages",title:"Search entries",keywords:["search","find","entries","notes","tags"],href:"/search"},{id:"nav-pomodoro",kind:"navigate",group:"Pages",title:"Open Pomodoro",keywords:["pomodoro","focus","timer"],href:"/pomodoro"},{id:"nav-settings",kind:"navigate",group:"Pages",title:"Open Settings",keywords:["settings","preferences"],href:"/settings"}],u=[{shortcut:"today",title:"Reporting: Today",keywords:["today","reporting"]},{shortcut:"yesterday",title:"Reporting: Yesterday",keywords:["yesterday"]},{shortcut:"week",title:"Reporting: This week",keywords:["week","reporting"]},{shortcut:"month",title:"Reporting: This month",keywords:["month","reporting"]},{shortcut:"last_month",title:"Reporting: Last month",keywords:["last month","reporting"]},{shortcut:"year",title:"Reporting: This year",keywords:["year","reporting"]},{shortcut:"last_year",title:"Reporting: Last year",keywords:["last year","reporting"]}];function d(e){let t=e.tags.map(e=>(0,o.format_display_tag)(e)).join(" ");return t.length>0?`${e.sheetName} \xb7 ${t}`:e.sheetName}var m=e.i(87231),p=e.i(56586),h=e.i(44356),f=e.i(67321),g=e.i(49087),_=e.i(76709),y=e.i(51229),b=e.i(3087);async function w({item:e,pathname:t,navigate:r}){switch(e.kind){case"navigate":case"reporting_range":if(void 0===e.href)return;r(e.href);return;case"sheet":if(void 0===e.sheetName)return;await k(e.sheetName,t,r);return;case"template_check_in":{let n=e.description?.trim()??"";if(0===n.length)return;await v({description:n,sheet_name:e.sheetName,pathname:t,navigate:r}),void 0!==e.templateId&&(0,b.record_entry_template_usage)(e.templateId);return}case"resume_last":case"resume_entry":{let n=e.description??"",a=e.tags??[];await v({description:(0,h.build_resume_description)(n,a),sheet_name:e.sheetName,pathname:t,navigate:r});return}default:return}}async function k(e,t,r){(0,f.navigate_to_tracker_sheet)(e),await (0,y.post_tracker_action)("/api/sheet",{name:e}),(0,_.notify_tracker_state_sync)(),"/"!==t&&r("/")}async function v({description:e,sheet_name:t,pathname:r,navigate:n}){let a=t?.trim()??"";a.length>0&&((0,f.navigate_to_tracker_sheet)(a),await (0,y.post_tracker_action)("/api/sheet",{name:a}));try{await (0,y.post_tracker_action)("/api/in",{description:e,...a.length>0?{sheetName:a}:{}}),(0,_.notify_tracker_state_sync)(),"/"!==r&&n("/"),(0,g.notify_in_app)({title:"Checked in",body:e})}catch(e){throw(0,g.notify_in_app)({title:"Check-in failed",body:e instanceof Error?e.message:String(e)}),e}}async function x(e){let t=new URLSearchParams;e.trim().length>0&&t.set("q",e.trim());let r=t.size>0?`?${t.toString()}`:"",n=await fetch(`/api/command-palette${r}`,{method:"GET",cache:"no-store"});if(!n.ok)throw Error((await n.json().catch(()=>({}))).error??"Failed to load command palette data");return await n.json()}var N=e.i(72074),S=e.i(48054),j=e.i(37193),E=e.i(17993);let C={activeSheetName:null,sheets:[],lastCompletedEntry:null,matchingEntries:[]};e.s(["CommandPaletteProvider",0,function(){var e;let a=(0,r.useRouter)(),o=(0,r.usePathname)()??"/",[h,f]=(0,n.useState)(!1),[g,_]=(0,n.useState)(""),y=(0,E.use_debounced_value)(g,200),[b,k]=(0,n.useState)(C),[v,T]=(0,n.useState)(!1),[$,P]=(0,n.useState)(null);e=(0,n.useCallback)(()=>{f(e=>(e&&_(""),!e))},[]),(0,n.useEffect)(()=>{let t=t=>{let r=t.target,n=r instanceof HTMLElement&&null!==r.closest('[data-command-palette-dialog="true"]');if((!(0,S.should_ignore_keyboard_shortcut)(t)||n)&&(t.metaKey||t.ctrlKey)&&!t.altKey&&"p"===t.key.toLowerCase()){if(t.preventDefault(),(0,N.is_modal_dialog_open)()&&null===document.querySelector('[data-command-palette-dialog="true"]'))return;e()}};return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}},[e]),(0,n.useEffect)(()=>{if(!h)return;let e=!1;return(async()=>{T(!0),P(null);try{let t=await x(y);e||k(t)}catch(t){e||P((0,j.message_from_unknown_error)(t,"Failed to load commands"))}finally{e||T(!1)}})(),()=>{e=!0}},[h,y]);let R=(0,n.useMemo)(()=>{var e;let t,r=(e=function({snapshot:e,include_templates:t=!0}){var r,n;let a=[...c,...u.map(e=>{var t;return{id:`reporting-${e.shortcut}`,kind:"reporting_range",group:"Reporting ranges",title:e.title,keywords:e.keywords,href:(t=e.shortcut,`/reporting?range=${encodeURIComponent(t)}`),reportingRange:e.shortcut}})];if(null!==e.lastCompletedEntry&&a.push({id:"resume-last",kind:"resume_last",group:"Recent",title:"Resume last entry",subtitle:d(r=e.lastCompletedEntry),keywords:["resume","last",r.description,r.sheetName,...r.tags],sheetName:r.sheetName,entryId:r.id,description:r.description,tags:r.tags}),t&&1)for(let t of(0,l.read_entry_templates)()){let r=(0,i.build_entry_template_description)(t);a.push({id:`template-${t.id}`,kind:"template_check_in",group:!0===t.favorite?"Favorite templates":"Templates",title:`Check in: ${t.name}`,subtitle:void 0===t.defaultSheetName?r:`${t.defaultSheetName} \xb7 ${r}`,keywords:["check in","template",t.name,r,t.shortcutKey??""],description:r,sheetName:t.defaultSheetName??e.activeSheetName??void 0,templateId:t.id})}for(let t of e.sheets)a.push({id:`sheet-${t.name}`,kind:"sheet",group:"Sheets",title:`Open sheet: ${t.name}`,subtitle:t.hasActiveEntry?"Timer running":void 0,keywords:["sheet",t.name,"project"],sheetName:t.name});let s=new Set;for(let t of e.matchingEntries){let e=`${t.sheetName}:${t.id}`;s.has(e)||(s.add(e),a.push((n=t,{id:`resume-${n.sheetName}-${n.id}`,kind:"resume_entry",group:"Entries",title:`Resume: ${n.description||"Untitled entry"}`,subtitle:d(n),keywords:["resume",n.description,n.sheetName,...n.tags],sheetName:n.sheetName,entryId:n.id,description:n.description,tags:n.tags})))}return a}({snapshot:b}),0===(t=g.trim().toLowerCase()).length?e:e.filter(e=>[e.title,e.subtitle??"",...e.keywords].join(" ").toLowerCase().includes(t))),n=g.trim();return 0===n.length?r:[{id:"search-all-entries",kind:"navigate",group:"Search",title:`Search all entries for "${n}"`,subtitle:"Open search with filters",keywords:["search",n],href:(0,m.build_entry_search_href)({...(0,p.get_empty_entry_search_filters)(),query:n})},...r]},[b,g]),O=(0,n.useCallback)(async e=>{f(!1),_("");try{await w({item:e,pathname:o,navigate:e=>{a.push(e)}})}catch{}},[o,a]),A=(0,n.useCallback)(()=>{f(!1),_("")},[]);return h?(0,t.jsx)(s,{items:R,query:g,is_loading:v,error:$,on_query_change:_,on_select:e=>{O(e)},on_close:A}):null}],54286)},78331,e=>{e.n(e.i(54286))}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,37193,e=>{"use strict";e.s(["message_from_unknown_error",0,function(e,t){return e instanceof Error?e.message:"string"==typeof e?e:t}])},17003,e=>{"use strict";var t=e.i(27850),r=e.i(72550);e.s(["write_active_sheet_preference",0,function(e){let n=e.trim();if(0!==n.length){try{window.localStorage.setItem(r.ACTIVE_SHEET_STORAGE_KEY,n),(0,t.schedule_ui_preferences_cloud_sync)()}catch{}try{let e=encodeURIComponent(n);document.cookie=`${r.ACTIVE_SHEET_COOKIE_NAME}=${e}; Path=/; Max-Age=31536000; SameSite=Lax`}catch{}}}])},67321,e=>{"use strict";var t=e.i(17003);e.s(["navigate_to_tracker_sheet",0,function(e){(0,t.write_active_sheet_preference)(e)}])},60812,49532,85910,92572,31363,3087,e=>{"use strict";var t=e.i(44356);e.s(["build_entry_template_description",0,function(e){return(0,t.build_resume_description)(e.description,e.tags??[])}],60812);let r=["defaultSheetName","shortcutKey","createdAt","lastUsedAt"],n=e=>"object"==typeof e&&null!==e&&"string"==typeof e.id&&"string"==typeof e.name&&"string"==typeof e.description,a=e=>{let t={id:e.id,name:e.name,description:e.description};for(let n of r){let r=e[n];"string"==typeof r&&r.trim().length>0&&(t[n]=r)}return Array.isArray(e.tags)&&(t.tags=e.tags.filter(e=>"string"==typeof e&&e.length>0)),"boolean"==typeof e.favorite&&(t.favorite=e.favorite),"boolean"==typeof e.pomodoroLinked&&(t.pomodoroLinked=e.pomodoroLinked),"number"==typeof e.useCount&&Number.isFinite(e.useCount)&&e.useCount>0&&(t.useCount=Math.round(e.useCount)),t};function s(){try{let e=window.localStorage.getItem("super-time-tracker-entry-templates");if(null===e)return[];let t=JSON.parse(e);if(!Array.isArray(t))return[];return t.filter(n).map(a)}catch{return[]}}e.s(["read_entry_templates",0,s],49532);let i=[],o=null;function l(){o=null}e.s(["EMPTY_ENTRY_TEMPLATES",0,i,"get_stable_entry_templates_snapshot",0,function(e){let t=e.map(e=>[e.id,e.name,e.description,e.defaultSheetName??"",e.tags?.join(" ")??"",!0===e.favorite?"1":"0",e.shortcutKey??"",!0===e.pomodoroLinked?"1":"0",e.createdAt??"",e.lastUsedAt??"",String(e.useCount??0)].join("\0")).join("\n");if(null!==o&&o.templates_key===t)return o.snapshot;let r=0===e.length?i:Object.freeze(e.map(e=>({...e})));return o={templates_key:t,snapshot:r},r},"reset_entry_templates_snapshot_cache",0,l],85910);let c=new Set;function u(){l(),c.forEach(e=>{e()})}function d(e){if(void 0!==globalThis.window)try{globalThis.window.localStorage.setItem("super-time-tracker-entry-templates",JSON.stringify(e)),u()}catch{}}e.s(["notify_entry_templates_changed",0,u,"subscribe_entry_templates",0,function(e){return c.add(e),()=>{c.delete(e)}}],92572),e.s(["write_entry_templates",0,d],31363),e.s(["record_entry_template_usage",0,function(e){let t=s(),r=new Date().toISOString(),n=!1,a=t.map(t=>t.id!==e?t:(n=!0,{...t,lastUsedAt:r,useCount:(t.useCount??0)+1}));n&&d(a)}],3087)},52405,e=>{"use strict";e.s(["get_input_class_name",0,function(e="default"){let t="box-border max-w-full min-w-0 w-full rounded-[0.65rem] border border-panel-border bg-input-bg px-3 py-2.5 font-inherit text-inherit transition-[background-color,border-color] duration-200 focus:border-input-focus-border focus:outline-none";return"compact"===e?`${t} px-2.5 py-2`:t}])},18774,e=>{"use strict";e.s(["format_display_tag",0,function(e){return e.startsWith("@")?e:`@${e}`}])},39474,20993,e=>{"use strict";var t=e.i(13349),r=e.i(32417),n=e.i(44171),a=e.i(28274);let s=null,i=Promise.resolve();function o(){(0,r.is_supabase_configured)()&&(0,n.is_cloud_sync_enabled)()&&(null!==s&&clearTimeout(s),s=setTimeout(()=>{s=null,i=i.then(()=>(0,a.run_tracker_db_cloud_sync)()).catch(()=>{})},400))}function l(){(0,t.is_greedy_cloud_sync_enabled)()&&o()}e.s(["schedule_tracker_db_cloud_sync",0,l],20993),e.s(["push_tracker_db_cloud_after_change",0,function(){(0,t.is_greedy_cloud_sync_enabled)()?l():o()}],39474)},97176,e=>{"use strict";var t=e.i(13349);async function r(e){let t=await fetch("/api/sheet/active",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e})});if(!t.ok)throw Error((await t.json()).error??"Failed to update active sheet in cloud")}var n=e.i(39474),a=e.i(20993);e.s(["notify_tracker_db_cloud_sync",0,function(e,s){if("/api/sheet"===e&&"object"==typeof s&&null!==s&&!0!==s.delete&&!(0,t.is_greedy_cloud_sync_enabled)()){let e=s.name?.trim()??"";e.length>0&&r(e).catch(()=>{});return}(0,t.is_greedy_cloud_sync_enabled)()?(0,a.schedule_tracker_db_cloud_sync)():(0,n.push_tracker_db_cloud_after_change)()}],97176)},44356,e=>{"use strict";var t=e.i(18774);e.s(["build_resume_description",0,function(e,r){let n=e.trim(),a=n.length>0?n:"Untitled entry",s=r.map(e=>(0,t.format_display_tag)(e)).join(" ");return s.length>0?`${a} ${s}`.trim():a}])},51229,e=>{"use strict";var t=e.i(97176);let r=new Set(["/api/note"]);async function n(e,n){let a={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},s=await fetch(e,a);if(!s.ok){var i,o;let t,n=(await s.json()).error??"Request failed";if(i=e,o=n,r.has(i)&&((t=o.toLowerCase()).includes("duplicate key")||t.includes("unique constraint"))){if(await new Promise(e=>{setTimeout(e,25)}),!(s=await fetch(e,a)).ok)throw Error((await s.json()).error??n)}else throw Error(n)}let l=await s.json();return(0,t.notify_tracker_db_cloud_sync)(e,n),l}e.s(["post_tracker_action",0,n])},87231,e=>{"use strict";e.s(["build_entry_search_href",0,function(e){let t=new URLSearchParams;e.query.trim().length>0&&t.set("q",e.query.trim()),e.sheetName.trim().length>0&&t.set("sheet",e.sheetName.trim()),e.tag.trim().length>0&&t.set("tag",e.tag.trim()),e.fromDate.trim().length>0&&t.set("from",e.fromDate.trim()),e.toDate.trim().length>0&&t.set("to",e.toDate.trim());let r=t.toString();return r.length>0?`/search?${r}`:"/search"}])},56586,e=>{"use strict";let t={query:"",sheetName:"",tag:"",fromDate:"",toDate:""};e.s(["get_empty_entry_search_filters",0,function(){return{...t}}])},17993,e=>{"use strict";var t=e.i(51268);e.s(["use_debounced_value",0,function(e,r){let[n,a]=(0,t.useState)(e);return(0,t.useEffect)(()=>{let t=window.setTimeout(()=>{a(e)},r);return()=>{window.clearTimeout(t)}},[e,r]),n}])},54286,e=>{"use strict";var t=e.i(8063),r=e.i(48042),n=e.i(51268),a=e.i(52405);function s({items:e,query:r,is_loading:i,error:o,on_query_change:l,on_select:c,on_close:u}){var d;let m=(0,n.useId)(),p=(0,n.useRef)(null),h=(0,n.useRef)(null),[f,g]=(0,n.useState)(0),_=(0,n.useMemo)(()=>(function(e){let t=new Map;for(let r of e){let e=t.get(r.group)??[];e.push(r),t.set(r.group,e)}return Array.from(t.entries()).map(([e,t])=>({label:e,items:t}))})(e),[e]),y=(0,n.useMemo)(()=>_.flatMap(e=>e.items),[_]),b=(0,n.useMemo)(()=>{let e=new Map;return y.forEach((t,r)=>{e.set(t.id,r)}),e},[y]),w=0===y.length?0:Math.min(f,y.length-1),v=(d=y.length,!i&&0===d&&null===o);(0,n.useEffect)(()=>{let e=p.current;if(null!==e&&!e.open)return e.showModal(),()=>{e.open&&e.close()}},[]),(0,n.useEffect)(()=>{h.current?.focus()},[]);let k=()=>{p.current?.close(),u()};return(0,t.jsxs)("dialog",{ref:p,"aria-labelledby":m,"data-command-palette-dialog":"true",className:"fixed inset-0 z-100 m-0 flex max-h-none w-full max-w-none items-start justify-center border-0 bg-transparent p-4 pt-[12vh] backdrop:bg-overlay open:flex sm:p-6 sm:pt-[12vh]",onCancel:e=>{e.preventDefault(),k()},children:[(0,t.jsx)("button",{type:"button",tabIndex:-1,"aria-label":"Close command palette",className:"absolute inset-0 z-0 cursor-default border-0 bg-transparent p-0",onClick:k}),(0,t.jsxs)("div",{className:"relative z-1 flex w-full max-w-xl flex-col overflow-hidden rounded-lg border border-panel-border bg-panel shadow-lg",children:[(0,t.jsx)("p",{id:m,className:"sr-only",children:"Command palette"}),(0,t.jsxs)("div",{className:"border-b border-panel-border px-3 py-3",children:[(0,t.jsx)("label",{className:"sr-only",htmlFor:`${m}-input`,"aria-label":"Search commands",children:"Search commands"}),(0,t.jsx)("input",{ref:h,id:`${m}-input`,type:"search",autoComplete:"off",spellCheck:!1,placeholder:"Search sheets, entries, templates, reporting…",className:(0,a.get_input_class_name)("compact"),value:r,onChange:e=>{var t;return t=e.target.value,void(g(0),l(t))},onKeyDown:e=>{if((e.metaKey||e.ctrlKey)&&!e.altKey&&"k"===e.key.toLowerCase()){e.preventDefault(),e.stopPropagation(),k();return}if("Escape"===e.key){e.preventDefault(),k();return}if("ArrowDown"===e.key){if(e.preventDefault(),0===y.length)return;g(e=>(e+1)%y.length);return}if("ArrowUp"===e.key){if(e.preventDefault(),0===y.length)return;g(e=>0===e?y.length-1:e-1);return}if("Enter"===e.key){e.preventDefault();let t=y[w];void 0!==t&&c(t)}}})]}),(0,t.jsxs)("div",{className:"max-h-[min(24rem,55vh)] overflow-y-auto px-2 py-2","aria-live":"polite",children:[null===o?null:(0,t.jsx)("p",{className:"m-0 px-2 py-3 text-[0.85rem] text-danger",children:o}),i&&0===y.length?(0,t.jsx)("p",{className:"m-0 px-2 py-3 text-[0.85rem] text-muted",children:"Loading…"}):null,v?(0,t.jsx)("p",{className:"m-0 px-2 py-3 text-[0.85rem] text-muted",children:"No matching commands."}):null,_.map(e=>(0,t.jsxs)("section",{className:"mb-2 last:mb-0","aria-label":e.label,children:[(0,t.jsx)("h2",{className:"m-0 px-2 py-1 text-[0.72rem] font-semibold uppercase tracking-[0.06em] text-muted",children:e.label}),(0,t.jsx)("ul",{className:"m-0 list-none p-0",children:e.items.map(e=>{let r=b.get(e.id)??0,n=r===w;return(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button",className:`flex w-full cursor-pointer flex-col gap-0.5 rounded-md border-0 px-2.5 py-2 text-left font-inherit transition-colors duration-150 ${n?"bg-accent-soft text-foreground":"bg-transparent text-inherit hover:bg-surface-hover"}`,onMouseEnter:()=>g(r),onClick:()=>c(e),children:[(0,t.jsx)("span",{className:"text-[0.9rem] font-semibold",children:e.title}),void 0===e.subtitle?null:(0,t.jsx)("span",{className:"text-[0.78rem] text-muted",children:e.subtitle})]})},e.id)})})]},e.label))]}),(0,t.jsxs)("div",{className:"border-t border-panel-border px-3 py-2 text-[0.72rem] text-muted",children:[(0,t.jsx)("span",{className:"font-mono",children:"↑↓"})," navigate ·"," ",(0,t.jsx)("span",{className:"font-mono",children:"↵"})," select ·"," ",(0,t.jsx)("span",{className:"font-mono",children:"esc"})," close ·"," ",(0,t.jsx)("span",{className:"font-mono",children:"Ctrl+P"})," toggle"]})]})]})}var i=e.i(60812),o=e.i(18774),l=e.i(49532);let c=[{id:"nav-tracker",kind:"navigate",group:"Pages",title:"Open Tracker",keywords:["home","tracker","timer"],href:"/"},{id:"nav-today",kind:"navigate",group:"Pages",title:"Open Today",keywords:["today","focus","daily"],href:"/today"},{id:"nav-review",kind:"navigate",group:"Pages",title:"Open End-of-day Review",keywords:["review","end of day","daily","cleanup","gaps"],href:"/review"},{id:"nav-templates",kind:"navigate",group:"Pages",title:"Open Template Library",keywords:["templates","library","check in","shortcuts"],href:"/templates"},{id:"nav-sheets",kind:"navigate",group:"Pages",title:"Open Sheets",keywords:["sheets","projects","hub"],href:"/sheets"},{id:"nav-reporting",kind:"navigate",group:"Pages",title:"Open Reporting",keywords:["reporting","stats","analytics"],href:"/reporting"},{id:"nav-search",kind:"navigate",group:"Pages",title:"Search entries",keywords:["search","find","entries","notes","tags"],href:"/search"},{id:"nav-pomodoro",kind:"navigate",group:"Pages",title:"Open Pomodoro",keywords:["pomodoro","focus","timer"],href:"/pomodoro"},{id:"nav-settings",kind:"navigate",group:"Pages",title:"Open Settings",keywords:["settings","preferences"],href:"/settings"}],u=[{shortcut:"today",title:"Reporting: Today",keywords:["today","reporting"]},{shortcut:"yesterday",title:"Reporting: Yesterday",keywords:["yesterday"]},{shortcut:"week",title:"Reporting: This week",keywords:["week","reporting"]},{shortcut:"month",title:"Reporting: This month",keywords:["month","reporting"]},{shortcut:"last_month",title:"Reporting: Last month",keywords:["last month","reporting"]},{shortcut:"year",title:"Reporting: This year",keywords:["year","reporting"]},{shortcut:"last_year",title:"Reporting: Last year",keywords:["last year","reporting"]}];function d(e){let t=e.tags.map(e=>(0,o.format_display_tag)(e)).join(" ");return t.length>0?`${e.sheetName} \xb7 ${t}`:e.sheetName}var m=e.i(87231),p=e.i(56586),h=e.i(44356),f=e.i(67321),g=e.i(49087),_=e.i(76709),y=e.i(51229),b=e.i(3087);async function w({item:e,pathname:t,navigate:r}){switch(e.kind){case"navigate":case"reporting_range":if(void 0===e.href)return;r(e.href);return;case"sheet":if(void 0===e.sheetName)return;await v(e.sheetName,t,r);return;case"template_check_in":{let n=e.description?.trim()??"";if(0===n.length)return;await k({description:n,sheet_name:e.sheetName,pathname:t,navigate:r}),void 0!==e.templateId&&(0,b.record_entry_template_usage)(e.templateId);return}case"resume_last":case"resume_entry":{let n=e.description??"",a=e.tags??[];await k({description:(0,h.build_resume_description)(n,a),sheet_name:e.sheetName,pathname:t,navigate:r});return}default:return}}async function v(e,t,r){(0,f.navigate_to_tracker_sheet)(e),await (0,y.post_tracker_action)("/api/sheet",{name:e}),(0,_.notify_tracker_state_sync)(),"/"!==t&&r("/")}async function k({description:e,sheet_name:t,pathname:r,navigate:n}){let a=t?.trim()??"";a.length>0&&((0,f.navigate_to_tracker_sheet)(a),await (0,y.post_tracker_action)("/api/sheet",{name:a}));try{await (0,y.post_tracker_action)("/api/in",{description:e,...a.length>0?{sheetName:a}:{}}),(0,_.notify_tracker_state_sync)(),"/"!==r&&n("/"),(0,g.notify_in_app)({title:"Checked in",body:e})}catch(e){throw(0,g.notify_in_app)({title:"Check-in failed",body:e instanceof Error?e.message:String(e)}),e}}async function x(e){let t=new URLSearchParams;e.trim().length>0&&t.set("q",e.trim());let r=t.size>0?`?${t.toString()}`:"",n=await fetch(`/api/command-palette${r}`,{method:"GET",cache:"no-store"});if(!n.ok)throw Error((await n.json().catch(()=>({}))).error??"Failed to load command palette data");return await n.json()}var N=e.i(72074),S=e.i(48054),j=e.i(37193),E=e.i(17993);let C={activeSheetName:null,sheets:[],lastCompletedEntry:null,matchingEntries:[]};e.s(["CommandPaletteProvider",0,function(){var e;let a=(0,r.useRouter)(),o=(0,r.usePathname)()??"/",[h,f]=(0,n.useState)(!1),[g,_]=(0,n.useState)(""),y=(0,E.use_debounced_value)(g,200),[b,v]=(0,n.useState)(C),[k,T]=(0,n.useState)(!1),[$,P]=(0,n.useState)(null);e=(0,n.useCallback)(()=>{f(e=>(e&&_(""),!e))},[]),(0,n.useEffect)(()=>{let t=t=>{let r=t.target,n=r instanceof HTMLElement&&null!==r.closest('[data-command-palette-dialog="true"]');if((!(0,S.should_ignore_keyboard_shortcut)(t)||n)&&(t.metaKey||t.ctrlKey)&&!t.altKey&&"p"===t.key.toLowerCase()){if(t.preventDefault(),(0,N.is_modal_dialog_open)()&&null===document.querySelector('[data-command-palette-dialog="true"]'))return;e()}};return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}},[e]),(0,n.useEffect)(()=>{if(!h)return;let e=!1;return(async()=>{T(!0),P(null);try{let t=await x(y);e||v(t)}catch(t){e||P((0,j.message_from_unknown_error)(t,"Failed to load commands"))}finally{e||T(!1)}})(),()=>{e=!0}},[h,y]);let R=(0,n.useMemo)(()=>{var e;let t,r=(e=function({snapshot:e,include_templates:t=!0}){var r,n;let a=[...c,...u.map(e=>{var t;return{id:`reporting-${e.shortcut}`,kind:"reporting_range",group:"Reporting ranges",title:e.title,keywords:e.keywords,href:(t=e.shortcut,`/reporting?range=${encodeURIComponent(t)}`),reportingRange:e.shortcut}})];return null!==e.lastCompletedEntry&&a.push({id:"resume-last",kind:"resume_last",group:"Recent",title:"Resume last entry",subtitle:d(r=e.lastCompletedEntry),keywords:["resume","last",r.description,r.sheetName,...r.tags],sheetName:r.sheetName,entryId:r.id,description:r.description,tags:r.tags}),a.push(...(n=e,t&&void 0!==globalThis.window?(0,l.read_entry_templates)().map(e=>{let t=(0,i.build_entry_template_description)(e);return{id:`template-${e.id}`,kind:"template_check_in",group:!0===e.favorite?"Favorite templates":"Templates",title:`Check in: ${e.name}`,subtitle:void 0===e.defaultSheetName?t:`${e.defaultSheetName} \xb7 ${t}`,keywords:["check in","template",e.name,t,e.shortcutKey??""],description:t,sheetName:e.defaultSheetName??n.activeSheetName??void 0,templateId:e.id}}):[])),a.push(...e.sheets.map(e=>({id:`sheet-${e.name}`,kind:"sheet",group:"Sheets",title:`Open sheet: ${e.name}`,subtitle:e.hasActiveEntry?"Timer running":void 0,keywords:["sheet",e.name,"project"],sheetName:e.name}))),a.push(...function(e){let t=new Set,r=[];for(let a of e.matchingEntries){var n;let e=`${a.sheetName}:${a.id}`;t.has(e)||(t.add(e),r.push((n=a,{id:`resume-${n.sheetName}-${n.id}`,kind:"resume_entry",group:"Entries",title:`Resume: ${n.description||"Untitled entry"}`,subtitle:d(n),keywords:["resume",n.description,n.sheetName,...n.tags],sheetName:n.sheetName,entryId:n.id,description:n.description,tags:n.tags})))}return r}(e)),a}({snapshot:b}),0===(t=g.trim().toLowerCase()).length?e:e.filter(e=>[e.title,e.subtitle??"",...e.keywords].join(" ").toLowerCase().includes(t))),n=g.trim();return 0===n.length?r:[{id:"search-all-entries",kind:"navigate",group:"Search",title:`Search all entries for "${n}"`,subtitle:"Open search with filters",keywords:["search",n],href:(0,m.build_entry_search_href)({...(0,p.get_empty_entry_search_filters)(),query:n})},...r]},[b,g]),O=(0,n.useCallback)(async e=>{f(!1),_("");try{await w({item:e,pathname:o,navigate:e=>{a.push(e)}})}catch{}},[o,a]),A=(0,n.useCallback)(()=>{f(!1),_("")},[]);return h?(0,t.jsx)(s,{items:R,query:g,is_loading:k,error:$,on_query_change:_,on_select:e=>{O(e)},on_close:A}):null}],54286)},78331,e=>{e.n(e.i(54286))}]);