forge-openclaw-plugin 0.2.100 → 0.2.101

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 (103) hide show
  1. package/dist/assets/{activity-page-5oyCFOns.js → activity-page-CpjuNSHw.js} +1 -1
  2. package/dist/assets/{ai-surface-workspace-qgk_B57-.js → ai-surface-workspace-DEAFZruS.js} +1 -1
  3. package/dist/assets/{atlas-panel-rfH2qOez.js → atlas-panel-CdVNPotj.js} +1 -1
  4. package/dist/assets/{calendar-page-Bo2iua-a.js → calendar-page-DNNt6lfz.js} +1 -1
  5. package/dist/assets/{calendar-rules-DA1g3QUk.js → calendar-rules-DNJFNsxi.js} +1 -1
  6. package/dist/assets/{calendar-week-toolbar-DU1Q4RYj.js → calendar-week-toolbar-BbPwYeN0.js} +1 -1
  7. package/dist/assets/{companion-sync-lab-page-CosNknOK.js → companion-sync-lab-page-KxEDigM6.js} +1 -1
  8. package/dist/assets/{daily-metrics-dashboard-LjuGAB3f.js → daily-metrics-dashboard-B3cqJgDt.js} +1 -1
  9. package/dist/assets/{entity-note-count-link-BmGDB572.js → entity-note-count-link-DrhjJZ4i.js} +1 -1
  10. package/dist/assets/{entity-notes-surface-DgEgicaE.js → entity-notes-surface-CkcRsKJQ.js} +1 -1
  11. package/dist/assets/{execution-board-CDRXQB85.js → execution-board-D07gOocB.js} +1 -1
  12. package/dist/assets/{faceted-token-search-CE1YauRd.js → faceted-token-search-BxRRcM3q.js} +1 -1
  13. package/dist/assets/{flagship-signal-deck-DDds90Gl.js → flagship-signal-deck-cmy82b8_.js} +1 -1
  14. package/dist/assets/{floating-action-menu-CJkI2iFy.js → floating-action-menu-Fs_ZiUMo.js} +1 -1
  15. package/dist/assets/{goal-detail-page-cJvHaLMQ.js → goal-detail-page-CqLiNz4f.js} +1 -1
  16. package/dist/assets/{goals-page-f_39hvUV.js → goals-page-BTk7mg_T.js} +1 -1
  17. package/dist/assets/{habits-page-DKb96_mj.js → habits-page-BJxagdzx.js} +1 -1
  18. package/dist/assets/{index-BHTUu_4M.js → index-CF4J4R9L.js} +2 -2
  19. package/dist/assets/{insight-flow-dialog-pzAzyayN.js → insight-flow-dialog-8f3D0GuC.js} +1 -1
  20. package/dist/assets/{insights-page-Dc9oFltJ.js → insights-page-D6rOa7uk.js} +1 -1
  21. package/dist/assets/{kanban-page-JAxerYh6.js → kanban-page-XQ7Se6dH.js} +1 -1
  22. package/dist/assets/{knowledge-graph-page-UQ3skqEi.js → knowledge-graph-page-BtAg8iv3.js} +1 -1
  23. package/dist/assets/{life-force-page-BGDbQuVh.js → life-force-page-Dy0JTS2G.js} +1 -1
  24. package/dist/assets/{life-force-workspace-B1fYSXRC.js → life-force-workspace-OfyB9HJM.js} +1 -1
  25. package/dist/assets/{metric-tile-DX6TclqM.js → metric-tile-DKpo-8xw.js} +1 -1
  26. package/dist/assets/{movement-page-6HP6nGJx.js → movement-page-Bg_T_Stx.js} +1 -1
  27. package/dist/assets/{note-markdown-DiW2-5d3.js → note-markdown-N-uxD3Xt.js} +1 -1
  28. package/dist/assets/{note-tags-input-DDLXf54U.js → note-tags-input-Cdu7wiw6.js} +1 -1
  29. package/dist/assets/{notes-page-BuguDjhz.js → notes-page-CKXnF_KU.js} +1 -1
  30. package/dist/assets/{open-in-graph-button-Cg5VrKsC.js → open-in-graph-button-IXe9SGth.js} +1 -1
  31. package/dist/assets/{orbit-map-GD05-0oS.js → orbit-map-Dzi6KliQ.js} +1 -1
  32. package/dist/assets/{overview-page-DuOs2OCB.js → overview-page-1miYqaVS.js} +1 -1
  33. package/dist/assets/{page-hero-CQWo1Mm_.js → page-hero-DRy5b2MU.js} +1 -1
  34. package/dist/assets/{pill-cluster-BJogDRDJ.js → pill-cluster-C9QczVJ2.js} +1 -1
  35. package/dist/assets/{preference-entity-handoff-button-D4WAs9pC.js → preference-entity-handoff-button-5PzUn42S.js} +1 -1
  36. package/dist/assets/{preferences-page-BaJTMU1I.js → preferences-page-DtNaF5Q3.js} +1 -1
  37. package/dist/assets/{project-collections-DvaX20q_.js → project-collections-xPz2mlRr.js} +1 -1
  38. package/dist/assets/{project-detail-page-drPIFZGb.js → project-detail-page-BXK5-4xW.js} +1 -1
  39. package/dist/assets/{project-management-hierarchy-page-BUbRXvny.js → project-management-hierarchy-page-DtRpMABw.js} +1 -1
  40. package/dist/assets/{project-management-section-nav-C2Ud8Zdd.js → project-management-section-nav-P3ixzPa-.js} +1 -1
  41. package/dist/assets/{projects-page-BGzEZUtg.js → projects-page-C5ViRuf4.js} +1 -1
  42. package/dist/assets/{psyche-behaviors-page-Dmm_Io9D.js → psyche-behaviors-page-Dco46sC4.js} +1 -1
  43. package/dist/assets/{psyche-flashcards-page-BgNKJ6QJ.js → psyche-flashcards-page-ZcoEB8gV.js} +1 -1
  44. package/dist/assets/{psyche-goal-map-page-DXJs98Vr.js → psyche-goal-map-page-CLBAQOI0.js} +1 -1
  45. package/dist/assets/{psyche-graph-CFgs_Bqc.js → psyche-graph-k4tX2tdp.js} +1 -1
  46. package/dist/assets/{psyche-metrics-page-zYTJDbyZ.js → psyche-metrics-page-CuR9oqEy.js} +1 -1
  47. package/dist/assets/{psyche-mode-guide-page-XPgRfCOf.js → psyche-mode-guide-page-hIVXcCnE.js} +1 -1
  48. package/dist/assets/{psyche-modes-page-B-GA8oRF.js → psyche-modes-page-0lYtBlhO.js} +1 -1
  49. package/dist/assets/{psyche-page--r6a3e1t.js → psyche-page-VZ9k9ISp.js} +1 -1
  50. package/dist/assets/{psyche-patterns-page-BM5-3bMm.js → psyche-patterns-page-gx5nmdGq.js} +1 -1
  51. package/dist/assets/{psyche-questionnaire-builder-page-CJshQ-mg.js → psyche-questionnaire-builder-page-Bn0TOISd.js} +1 -1
  52. package/dist/assets/{psyche-questionnaire-detail-page-USmR5G5A.js → psyche-questionnaire-detail-page-CmVzSd_s.js} +1 -1
  53. package/dist/assets/{psyche-questionnaire-run-detail-page-D7iBCmTi.js → psyche-questionnaire-run-detail-page-BsMbmXCG.js} +1 -1
  54. package/dist/assets/{psyche-questionnaire-run-page-Cpil-kDh.js → psyche-questionnaire-run-page-CgkRL2vi.js} +1 -1
  55. package/dist/assets/{psyche-questionnaires-page-C-_y3VwS.js → psyche-questionnaires-page-D7V8uLXM.js} +1 -1
  56. package/dist/assets/{psyche-report-detail-page--dkSPRaj.js → psyche-report-detail-page-OlFq57eL.js} +1 -1
  57. package/dist/assets/{psyche-reports-page-CUaOXmIN.js → psyche-reports-page-dVUZjna1.js} +1 -1
  58. package/dist/assets/{psyche-schemas-beliefs-page-BX6xaap3.js → psyche-schemas-beliefs-page-BCgc8FUd.js} +1 -1
  59. package/dist/assets/{psyche-screen-time-page-CAAI4mD7.js → psyche-screen-time-page-B_6BT_WN.js} +1 -1
  60. package/dist/assets/{psyche-self-observation-page-BZ6FLuwa.js → psyche-self-observation-page-CEG5mluK.js} +1 -1
  61. package/dist/assets/{psyche-values-page-yEV6MGt8.js → psyche-values-page-DRbRfEd6.js} +1 -1
  62. package/dist/assets/{report-chain-fields-fZ8Xd4H6.js → report-chain-fields-CALCV3V5.js} +1 -1
  63. package/dist/assets/{rewards-page-C2HQjIAf.js → rewards-page-DmC4R_Ps.js} +1 -1
  64. package/dist/assets/{scheduling-rules-editor-BHOpHOrV.js → scheduling-rules-editor-D02s70hr.js} +1 -1
  65. package/dist/assets/{schema-badge-DyKbxb51.js → schema-badge-BZO-qNhO.js} +1 -1
  66. package/dist/assets/{select-menu-BX-pZNqL.js → select-menu-fYyreSdQ.js} +1 -1
  67. package/dist/assets/{settings-agents-page-VuYXTiyc.js → settings-agents-page-C_v_hMJF.js} +1 -1
  68. package/dist/assets/{settings-bin-page-BNzvYaOk.js → settings-bin-page-DY5bg81n.js} +1 -1
  69. package/dist/assets/{settings-calendar-page-CjSFB53S.js → settings-calendar-page-D1CzE6cg.js} +1 -1
  70. package/dist/assets/{settings-data-page-CGSlryuI.js → settings-data-page-CHRQFU9H.js} +1 -1
  71. package/dist/assets/{settings-logs-page-BTK5fine.js → settings-logs-page-B04pUwEv.js} +1 -1
  72. package/dist/assets/{settings-mobile-page-CRaObOGo.js → settings-mobile-page-D9kTlYDS.js} +1 -1
  73. package/dist/assets/{settings-models-page-DFshpYF8.js → settings-models-page-D26270R2.js} +1 -1
  74. package/dist/assets/{settings-page-BP81Mb5R.js → settings-page-DYDTFlnv.js} +1 -1
  75. package/dist/assets/{settings-rewards-page-CDJ1PH2G.js → settings-rewards-page-cl4vqqO_.js} +1 -1
  76. package/dist/assets/{settings-section-nav-CCFm27r2.js → settings-section-nav-DSOuht_F.js} +1 -1
  77. package/dist/assets/{settings-users-page-TdUocFPa.js → settings-users-page-BU79JB_T.js} +1 -1
  78. package/dist/assets/{settings-wiki-page-B2zX0QQG.js → settings-wiki-page-DwAUlyA3.js} +1 -1
  79. package/dist/assets/{sleep-page-cI1GMVzk.js → sleep-page-D8NbdhyS.js} +1 -1
  80. package/dist/assets/{sports-page-06LTqp0V.js → sports-page-CV4Cnzwn.js} +1 -1
  81. package/dist/assets/{strategies-page-DXP9Kx8s.js → strategies-page-C4qvXnql.js} +1 -1
  82. package/dist/assets/{strategy-detail-page-D6mx_Mik.js → strategy-detail-page-DJLo5rfy.js} +1 -1
  83. package/dist/assets/{strategy-dialog-BvzomTaF.js → strategy-dialog-D3AuUlVz.js} +1 -1
  84. package/dist/assets/{task-detail-page-BIWIggdp.js → task-detail-page-z-9u9rF0.js} +1 -1
  85. package/dist/assets/{timebox-planning-dialog-CaCnoslG.js → timebox-planning-dialog-DB6FLqmI.js} +1 -1
  86. package/dist/assets/{today-page-DO2mRPT2.js → today-page-BKlu6gx5.js} +1 -1
  87. package/dist/assets/{training-load-page-CyZ0mlEr.js → training-load-page-CyJQqo_3.js} +1 -1
  88. package/dist/assets/{vitals-page-BQvEjTc6.js → vitals-page-qre17Nw8.js} +1 -1
  89. package/dist/assets/{weekly-review-page-Tp6Q9CRj.js → weekly-review-page-Cz4vkRcx.js} +1 -1
  90. package/dist/assets/weight-loss-page-BQrnOI0y.js +1 -0
  91. package/dist/assets/{wiki-article-markdown-DQYohmW2.js → wiki-article-markdown-DdiR2TJE.js} +1 -1
  92. package/dist/assets/{wiki-editor-page-Dem_3eZv.js → wiki-editor-page-DqwoqVFb.js} +1 -1
  93. package/dist/assets/{wiki-ingest-history-page-BxoOcCoJ.js → wiki-ingest-history-page--evBLbOw.js} +1 -1
  94. package/dist/assets/{wiki-ingest-modal-DhguKk3J.js → wiki-ingest-modal--ohzFnj2.js} +1 -1
  95. package/dist/assets/{wiki-page-BLRxVXkl.js → wiki-page-B_VJFBPA.js} +1 -1
  96. package/dist/assets/{workbench-flow-page-DqMkCCTy.js → workbench-flow-page-Du62mtJU.js} +1 -1
  97. package/dist/assets/{workbench-page-BWd02wPw.js → workbench-page-4MKr3iRm.js} +1 -1
  98. package/dist/assets/{workout-detail-page-BD8u7GyL.js → workout-detail-page-DfUbYYw1.js} +1 -1
  99. package/dist/index.html +1 -1
  100. package/dist/server/server/src/watch-mobile.js +22 -10
  101. package/openclaw.plugin.json +1 -1
  102. package/package.json +1 -1
  103. package/dist/assets/weight-loss-page-BBzlhLVV.js +0 -1
@@ -1 +1 @@
1
- import{r as u,j as e,c9 as Ae,by as ke,bG as Pe,aH as me,bU as De,cS as Me,c7 as He,bF as Te,bX as Ce,aC as Oe}from"./vendor-DHkYh85p.js";import{j as ue,i as xe,k as q}from"./state-B-4sS1xO.js";import{i as K,cS as Se,cT as U,C as w,c as J,B as ee,Z as $,O as pe}from"./index-BHTUu_4M.js";import{F as Le}from"./floating-action-menu-CJkI2iFy.js";import{A as Fe,C as _e,X as Ee,c as le,Y as Ie,T as Xe,d as ze,a as Ye,b as Be}from"./charts-P7EVhIog.js";const Y=20,ce=288,M={top:16,right:18,bottom:28,left:42},te=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function Re(t,a){return te.map((r,o)=>({weekday:o,baselineDailyAp:t.baselineDailyAp,points:t.currentCurve.map(i=>({...i,locked:o===a?i.locked:!1}))}))}function re(t){return`${Number(t.toFixed(1))} AP`}function O(t){return`${Number(t.toFixed(1))} AP/h`}function se(t){const a=new Date(2026,0,1,0,t,0,0);return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(a)}function We(t){const a=new Date(2026,0,1,0,t,0,0);return new Intl.DateTimeFormat(void 0,{hour:"numeric"}).format(a)}function C(t,a,r){return Math.min(r,Math.max(a,t))}function $e(t){if(t.length<2)return 0;let a=0;for(let r=0;r<t.length-1;r+=1){const o=t[r],i=t[r+1];a+=(o.rateApPerHour+i.rateApPerHour)/2*((i.minuteOfDay-o.minuteOfDay)/60)}return a}function de(t,a){if(t.length===0)return 0;if(a<=t[0].minuteOfDay)return t[0].rateApPerHour;for(let r=0;r<t.length-1;r+=1){const o=t[r],i=t[r+1];if(a<=i.minuteOfDay){const v=Math.max(1,i.minuteOfDay-o.minuteOfDay),y=(a-o.minuteOfDay)/v;return o.rateApPerHour+(i.rateApPerHour-o.rateApPerHour)*y}}return t[t.length-1].rateApPerHour}function qe(t,a){const r=$e(t);if(r<=0||a<=0)return t.map(i=>({...i,rateApPerHour:0}));const o=a/r;return t.map(i=>({...i,rateApPerHour:Number((i.rateApPerHour*o).toFixed(4))}))}function Ke(t,a,r){var x;if(a<=0||a>=t.length-1)return((x=t[a])==null?void 0:x.rateApPerHour)??0;const o=t[a-1],i=t[a],v=t[a+1];let y=0;for(let f=0;f<t.length-1;f+=1){if(f===a-1||f===a)continue;const n=t[f],H=t[f+1];y+=(n.rateApPerHour+H.rateApPerHour)/2*((H.minuteOfDay-n.minuteOfDay)/60)}const S=Math.max(Y/60,(i.minuteOfDay-o.minuteOfDay)/60),P=Math.max(Y/60,(v.minuteOfDay-i.minuteOfDay)/60);return Math.max(0,(2*(r-y)-o.rateApPerHour*S-v.rateApPerHour*P)/(S+P))}function Qe(t){switch(t){case"danger":return"bg-rose-400/12 text-rose-100";case"warning":return"bg-amber-400/12 text-amber-100";case"success":return"bg-emerald-400/12 text-emerald-100";case"info":default:return"bg-sky-400/12 text-sky-100"}}function Ge(t){switch(t){case"primary":return"Primary";case"secondary":return"Secondary";case"recovery":return"Recovery";case"background":default:return"Ambient"}}function he(t){return t.spentTodayAp>t.dailyBudgetAp?"Over budget":t.spentTodayAp<t.targetBandMinAp?"Below target band":"Inside target band"}function Ve(t){return t.overloadApPerHour>0||t.instantFreeApPerHour<=0?"Recovery":t.instantCapacityApPerHour>=t.currentDrainApPerHour+4?"Deep work":"Low-friction admin"}function Ze({lifeForce:t}){return e.jsxs("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-4",children:[e.jsxs(w,{className:"p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Daily AP"}),e.jsxs("div",{className:"mt-2 font-display text-4xl text-[var(--primary)]",children:[Math.round(t.spentTodayAp),e.jsxs("span",{className:"ml-2 text-lg text-white/44",children:["/ ",Math.round(t.dailyBudgetAp)]})]}),e.jsxs("div",{className:"mt-2 text-sm text-white/58",children:["Target band ",Math.round(t.targetBandMinAp),"-",Math.round(t.targetBandMaxAp)," AP"]}),e.jsx("div",{className:"mt-2 text-xs uppercase tracking-[0.14em] text-white/38",children:he(t)})]}),e.jsxs(w,{className:"p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Instant headroom"}),e.jsx("div",{className:"mt-2 font-display text-4xl text-white",children:t.instantFreeApPerHour.toFixed(1)}),e.jsxs("div",{className:"mt-2 text-sm text-white/58",children:[O(t.instantCapacityApPerHour)," capacity minus"," ",O(t.currentDrainApPerHour)," load"]}),e.jsx("div",{className:"mt-2 text-xs uppercase tracking-[0.14em] text-white/38",children:t.overloadApPerHour>0?`${O(t.overloadApPerHour)} overloaded`:"No overload right now"})]}),e.jsxs(w,{className:"p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Fatigue buffer"}),e.jsx("div",{className:"mt-2 font-display text-4xl text-white",children:t.fatigueBufferApPerHour.toFixed(1)}),e.jsx("div",{className:"mt-2 text-sm text-white/58",children:"Short-term strain rises with overlap and falls with recovery."})]}),e.jsxs(w,{className:"p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Forecast"}),e.jsx("div",{className:"mt-2 font-display text-4xl text-white",children:Math.round(t.forecastAp)}),e.jsxs("div",{className:"mt-2 text-sm text-white/58",children:["Planned remaining ",re(t.plannedRemainingAp)]}),e.jsxs("div",{className:"mt-2 text-xs uppercase tracking-[0.14em] text-white/38",children:["Remaining ",re(t.remainingAp)]})]})]})}function Ue({lifeForce:t}){return e.jsx("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-6",children:t.stats.map(a=>e.jsxs(w,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/38",children:a.label}),e.jsxs(J,{className:"bg-white/[0.08] text-white/70",children:["L",a.level]})]}),e.jsxs("div",{className:"mt-3 text-2xl font-semibold text-white",children:[Math.round(a.xp)," XP"]}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:a.key==="life_force"?`+${Math.round((a.costModifier-1)*100)}% daily resilience`:`${Math.round((1-a.costModifier)*100)}% cost relief`})]},a.key))})}function Je({lifeForce:t,weekday:a,points:r,baselineDailyAp:o,isDirty:i,isSaving:v,onChange:y,onReset:S,onSave:P,onWeekdayChange:x}){var ne,oe;const f=u.useRef(null),[n,H]=u.useState(null),[E,ae]=u.useState(720),[p,Q]=u.useState(null),L=u.useMemo(()=>new Date().getDay(),[]),F=u.useMemo(()=>{const s=new Date;return s.getHours()*60+s.getMinutes()},[]),B=u.useMemo(()=>[...r].sort((s,l)=>s.minuteOfDay-l.minuteOfDay),[r]),c=u.useMemo(()=>B.map(s=>({...s,locked:a===L?s.minuteOfDay<=F:!1})),[F,B,L,a]),b=u.useMemo(()=>{const s=Math.max(t.instantCapacityApPerHour,...c.map(l=>l.rateApPerHour),8);return Math.max(12,Math.ceil(s*1.25))},[t.instantCapacityApPerHour,c]),G=u.useMemo(()=>c.map(s=>({...s,label:se(s.minuteOfDay)})),[c]),j=u.useMemo(()=>[0,240,480,720,960,1200,1440],[]),V=u.useMemo(()=>Array.from(new Set([0,Math.max(2,Math.round(b/3)),Math.max(4,Math.round(2*b/3)),b])).sort((s,l)=>s-l),[b]),R=Math.max(E,1),_=Math.max(160,R-M.left-M.right),I=ce-M.top-M.bottom;u.useEffect(()=>{const s=()=>{var m;const l=((m=f.current)==null?void 0:m.clientWidth)??0;ae(l>0?l:720)};return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[]),u.useEffect(()=>{if(n===null||!f.current)return;const s=f.current,l=d=>{if(d.pointerId!==n.pointerId)return;d.preventDefault();const g=s.getBoundingClientRect(),A=Number.isFinite(d.clientX)?d.clientX:g.left+n.pointerX,h=Number.isFinite(d.clientY)?d.clientY:g.top+n.pointerY,D=C(A-g.left,0,g.width),X=C(h-g.top,0,g.height),W=C(A-g.left-M.left,0,_),ye=C(h-g.top-M.top,0,I);y(c.map((N,k)=>{if(k!==n.index)return{minuteOfDay:N.minuteOfDay,rateApPerHour:N.rateApPerHour,locked:N.locked};if(N.locked||k===0||k===c.length-1)return{minuteOfDay:N.minuteOfDay,rateApPerHour:N.rateApPerHour,locked:N.locked};const ve=c[k-1].minuteOfDay+Y,we=c[k+1].minuteOfDay-Y,je=Math.round(C(W/_*1440,ve,we)),z=c.map(ie=>({minuteOfDay:ie.minuteOfDay,rateApPerHour:ie.rateApPerHour,locked:ie.locked}));z[k]={...z[k],minuteOfDay:je};const be=Ke(z,k,o),Ne=C((I-ye)/I*b,0,Math.max(0,be));return z[k]={...z[k],rateApPerHour:Number(Ne.toFixed(3))},z[k]})),H(N=>N===null||N.pointerId!==d.pointerId?N:{...N,pointerX:D,pointerY:X})},m=d=>{(!d||d.pointerId===n.pointerId)&&H(null)};return window.addEventListener("pointermove",l,{passive:!1}),window.addEventListener("pointerup",m),window.addEventListener("pointercancel",m),()=>{window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",m)}},[o,n,y,I,_,c,b]);const ge=u.useMemo(()=>{if(!p)return[];const s=c[p.index]??null;return[{id:"remove-point",label:"Remove point",description:s===null?"No turn point is selected.":`Delete the turn point at ${se(s.minuteOfDay)}.`,icon:He,tone:"danger",disabled:s===null||p.index===0||p.index===c.length-1,onSelect:()=>{y(c.filter((l,m)=>m!==p.index))}},{id:"flatten-point",label:"Flatten point",description:s===null?"No turn point is selected.":"Place the handle back on the interpolated segment between its neighbors.",icon:Te,disabled:s===null||p.index===0||p.index===c.length-1,onSelect:()=>{const l=c[p.index-1],m=c[p.index+1],d=de([l,m],s.minuteOfDay);y(c.map((g,A)=>A===p.index?{...g,rateApPerHour:Number(d.toFixed(3))}:g))}}]},[p,y,c]),Z=u.useMemo(()=>c.map(s=>({...s,x:M.left+s.minuteOfDay/1440*_,y:M.top+(1-s.rateApPerHour/Math.max(1,b))*I})),[I,_,c,b]),T=n===null?null:{pointerX:n.pointerX,pointerY:n.pointerY,constrainedX:((ne=Z[n.index])==null?void 0:ne.x)??n.pointerX,constrainedY:((oe=Z[n.index])==null?void 0:oe.y)??n.pointerY};return e.jsxs(e.Fragment,{children:[e.jsxs(w,{className:"overflow-hidden p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Life Force view"}),e.jsx("div",{className:"mt-2 text-xl font-semibold text-white",children:"Instant Life Force editor"}),e.jsx("div",{className:"mt-2 max-w-3xl text-sm leading-6 text-white/56",children:"One click adds a turn point. Drag future handles. Right click a handle to remove or flatten it. The ghost handle follows your finger or cursor while the real turn point stays constrained on the curve and normalized to the baseline daily AP budget."})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[e.jsx("div",{className:"flex flex-wrap items-center gap-1 rounded-full bg-white/[0.04] p-1",children:te.map((s,l)=>e.jsx("button",{type:"button",className:$("rounded-full px-3 py-1.5 text-[11px] font-medium transition",a===l?"bg-[var(--primary)] text-slate-950":"text-white/60 hover:bg-white/[0.05] hover:text-white"),onClick:()=>x(l),children:s},s))}),e.jsx(ee,{variant:"secondary",onClick:S,children:"Reset"}),e.jsxs(ee,{onClick:P,pending:v,disabled:!i,children:[e.jsx(Ce,{className:"mr-2 size-4"}),"Save curve"]})]})]}),e.jsxs("div",{className:"mt-4 rounded-[24px] bg-[linear-gradient(180deg,rgba(192,193,255,0.08),rgba(192,193,255,0.02))] p-3",children:[e.jsxs("div",{ref:f,className:$("relative h-72 w-full overflow-hidden rounded-[20px] bg-[rgba(255,255,255,0.02)]",n!==null?"select-none touch-none":""),style:{touchAction:n===null?"pan-y":"none"},role:"img","aria-label":"Life Force capacity curve editor",onClick:s=>{if(n!==null||!f.current||s.target!==s.currentTarget)return;const l=f.current.getBoundingClientRect(),m=C(s.clientX-l.left-M.left,0,_),d=Math.round(m/_*1440),g=c.findIndex(W=>W.minuteOfDay>d);if(g<=0)return;const A=c[g-1],h=c[g];if(d-A.minuteOfDay<Y||h.minuteOfDay-d<Y)return;const D=de(c,d),X=[...c];X.splice(g,0,{minuteOfDay:d,rateApPerHour:Number(D.toFixed(3)),locked:a===L&&d<=F}),y(X)},children:[e.jsxs(Fe,{width:R,height:ce,data:G,margin:M,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"life-force-chart-fill",x1:"0",x2:"0",y1:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"rgba(192,193,255,0.24)"}),e.jsx("stop",{offset:"100%",stopColor:"rgba(192,193,255,0.02)"})]})}),e.jsx(_e,{vertical:!1,stroke:"rgba(255,255,255,0.08)",strokeDasharray:"3 4"}),e.jsx(Ee,{dataKey:"minuteOfDay",type:"number",domain:[0,1440],ticks:j,tickFormatter:We,tick:{fill:"rgba(255,255,255,0.48)",fontSize:10},tickLine:!1,axisLine:{stroke:"rgba(255,255,255,0.12)"},children:e.jsx(le,{value:"Time",position:"insideBottom",offset:-10,fill:"rgba(255,255,255,0.38)",fontSize:10})}),e.jsx(Ie,{type:"number",domain:[0,b],ticks:V,tick:{fill:"rgba(255,255,255,0.48)",fontSize:10},tickLine:!1,axisLine:{stroke:"rgba(255,255,255,0.12)"},width:34,children:e.jsx(le,{value:"AP/h",angle:-90,position:"insideLeft",fill:"rgba(255,255,255,0.38)",fontSize:10,style:{textAnchor:"middle"}})}),e.jsx(Xe,{cursor:{stroke:"rgba(255,255,255,0.18)",strokeDasharray:"3 4"},content:({active:s,payload:l})=>{var d;const m=s?(d=l==null?void 0:l[0])==null?void 0:d.payload:null;return m?e.jsxs("div",{className:"rounded-[16px] border border-white/10 bg-[rgba(10,15,27,0.95)] px-3 py-2 text-xs text-white shadow-[0_18px_50px_rgba(4,8,18,0.3)] backdrop-blur-xl",children:[e.jsx("div",{className:"font-medium text-white",children:m.label}),e.jsx("div",{className:"mt-1 text-white/60",children:O(m.rateApPerHour)})]}):null}}),a===L?e.jsx(ze,{x:F,stroke:"rgba(255,255,255,0.22)",strokeDasharray:"3 4"}):null,e.jsx(Ye,{type:"linear",dataKey:"rateApPerHour",stroke:"none",fill:"url(#life-force-chart-fill)",isAnimationActive:!1}),e.jsx(Be,{type:"linear",dataKey:"rateApPerHour",stroke:"rgba(214,215,255,0.95)",strokeWidth:1.5,dot:!1,activeDot:!1,isAnimationActive:!1})]}),T?e.jsxs("svg",{className:"pointer-events-none absolute inset-0 z-[15] h-full w-full","aria-hidden":"true",children:[e.jsx("line",{x1:T.constrainedX,y1:T.constrainedY,x2:T.pointerX,y2:T.pointerY,stroke:"rgba(214,215,255,0.38)",strokeDasharray:"4 5",strokeWidth:"1.5"}),e.jsx("circle",{cx:T.pointerX,cy:T.pointerY,r:"11",fill:"rgba(214,215,255,0.12)",stroke:"rgba(214,215,255,0.34)",strokeWidth:"1.5","data-testid":"life-force-ghost-handle"}),e.jsx("circle",{cx:T.pointerX,cy:T.pointerY,r:"3.5",fill:"rgba(255,255,255,0.44)"})]}):null,Z.map((s,l)=>{const m=l===0||l===Z.length-1,d=(n==null?void 0:n.index)===l,g=m?14:16,A=m?22:28;return e.jsx("button",{type:"button","aria-label":`Turn point at ${se(s.minuteOfDay)}`,className:$("absolute z-20 flex items-center justify-center rounded-full transition-transform duration-75",s.locked||m?"cursor-not-allowed":"cursor-grab active:cursor-grabbing",d?"scale-110":""),style:{left:s.x-A/2,top:s.y-A/2,width:A,height:A,touchAction:"none"},onPointerDown:h=>{if(h.preventDefault(),h.stopPropagation(),s.locked||m||!f.current)return;"setPointerCapture"in h.currentTarget&&h.currentTarget.setPointerCapture(h.pointerId);const D=f.current.getBoundingClientRect(),X=Number.isFinite(h.clientX)?h.clientX:D.left+s.x,W=Number.isFinite(h.clientY)?h.clientY:D.top+s.y;H({index:l,pointerId:h.pointerId,pointerX:C(X-D.left,0,D.width),pointerY:C(W-D.top,0,D.height)})},onContextMenu:h=>{h.preventDefault(),h.stopPropagation(),Q({index:l,position:{x:h.clientX+6,y:h.clientY+6}})},children:e.jsx("span",{className:$("pointer-events-none inline-flex rounded-full border border-[rgba(10,15,27,0.92)] shadow-[0_0_0_1px_rgba(255,255,255,0.08),0_10px_24px_rgba(4,8,18,0.28)]",s.locked||m?"bg-white/55":"bg-white"),style:{width:g,height:g,opacity:d?.96:1}})},`${s.minuteOfDay}-${l}`)})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-2 px-1 text-[11px] text-white/42",children:[e.jsxs("div",{children:["Editing ",te[a]," curve"]}),e.jsxs("div",{children:[Math.round(o)," AP/day baseline"]})]})]})]}),e.jsx(Le,{open:p!==null,title:"Turn point actions",subtitle:"Delete the turn point or flatten it back onto the surrounding segment.",items:ge,position:(p==null?void 0:p.position)??null,onClose:()=>Q(null)})]})}function et(){return e.jsx(w,{className:"overflow-hidden p-4",children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Life Force studio"}),e.jsx("div",{className:"mt-2 text-xl font-semibold text-white",children:"Edit weekday curves in the dedicated view"}),e.jsx("div",{className:"mt-2 max-w-3xl text-sm leading-6 text-white/56",children:"The full weekday editor, turn-point menu, and curve calibration now live in their own page so Overview can stay fast and readable."})]}),e.jsxs(Oe,{to:"/life-force",className:"inline-flex min-h-10 min-w-0 max-w-full items-center justify-center gap-2 overflow-hidden whitespace-nowrap rounded-[var(--radius-control)] border border-[var(--primary)]/14 bg-[var(--ui-accent-soft)] px-3 py-2 text-[13px] font-medium text-[var(--ui-ink-on-accent)] shadow-[var(--ui-shadow-soft)] transition hover:bg-[var(--ui-accent-soft-hover)]",children:[e.jsx(me,{className:"size-4"}),"Open Life Force studio"]})]})})}function tt({drains:t,plannedDrains:a,warnings:r,recommendations:o}){return e.jsxs("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1.15fr)_minmax(0,0.85fr)]",children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsxs(w,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Current drains"}),e.jsx("div",{className:"mt-2 text-xl font-semibold text-white",children:"What is consuming Life Force now"})]}),e.jsxs(J,{className:"bg-white/[0.08] text-white/70",children:[t.length," active"]})]}),e.jsx("div",{className:"mt-4 grid gap-3",children:t.length===0?e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4 text-sm text-white/58",children:"No current drainers are active. This is a good moment to choose your next intentional action."}):t.map(i=>e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-base font-semibold text-white",children:i.title}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:i.why})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx("div",{className:"text-base font-semibold text-[var(--primary)]",children:O(i.apPerHour)}),e.jsx("div",{className:"mt-1 text-xs uppercase tracking-[0.14em] text-white/38",children:Ge(i.role)})]})]})},i.id))})]}),e.jsxs(w,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Planned drains"}),e.jsx("div",{className:"mt-2 text-xl font-semibold text-white",children:"What the rest of today is already asking from you"})]}),e.jsxs(J,{className:"bg-white/[0.08] text-white/70",children:[a.length," planned"]})]}),e.jsx("div",{className:"mt-4 grid gap-3",children:a.length===0?e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4 text-sm text-white/58",children:"No future AP load has been forecast yet. The day is still open."}):a.slice(0,6).map(i=>e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-base font-semibold text-white",children:i.title}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:i.why})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx("div",{className:"text-base font-semibold text-[var(--primary)]",children:re(i.instantAp)}),e.jsx("div",{className:"mt-1 text-xs uppercase tracking-[0.14em] text-white/38",children:O(i.apPerHour)})]})]})},i.id))})]})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs(w,{className:"p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Warnings"}),e.jsx("div",{className:"mt-4 grid gap-3",children:r.map(i=>e.jsxs("div",{className:$("rounded-[18px] px-4 py-4",Qe(i.tone)),children:[e.jsx("div",{className:"text-sm font-semibold",children:i.title}),e.jsx("div",{className:"mt-1 text-sm leading-6 text-current/80",children:i.detail})]},i.id))})]}),e.jsxs(w,{className:"p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Recommendations"}),e.jsx("div",{className:"mt-4 grid gap-2",children:o.map((i,v)=>e.jsx("div",{className:"rounded-[16px] bg-white/[0.04] px-4 py-3 text-sm leading-6 text-white/66",children:i},`${i}-${v}`))})]})]})]})}function fe({lifeForce:t,onTired:a,onOkayAgain:r,tiredPending:o,okayPending:i,feedback:v}){return e.jsxs(w,{className:"overflow-hidden p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Life Force now"}),e.jsxs("div",{className:"mt-2 text-2xl font-semibold text-white",children:[t.instantFreeApPerHour.toFixed(1)," AP/h free"]}),e.jsxs("div",{className:"mt-2 text-sm text-white/58",children:[Math.round(t.spentTodayAp)," / ",Math.round(t.dailyBudgetAp)," AP used today"]}),e.jsx("div",{className:"mt-2 text-xs uppercase tracking-[0.14em] text-white/38",children:he(t)})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(ee,{variant:"secondary",onClick:a,pending:o,children:[e.jsx(ke,{className:"mr-2 size-4"}),"I'm getting tired"]}),e.jsxs(ee,{variant:"secondary",onClick:r,pending:i,children:[e.jsx(Pe,{className:"mr-2 size-4"}),"I'm okay again"]})]})]}),v?e.jsx("div",{className:"mt-4 rounded-[18px] bg-[var(--primary)]/10 px-4 py-3 text-sm text-white/74",children:v}):null,e.jsxs("div",{className:"mt-4 grid gap-3 md:grid-cols-3",children:[e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[e.jsx(me,{className:"size-4 text-[var(--primary)]"}),"Instant capacity"]}),e.jsx("div",{className:"mt-2 text-sm text-white/58",children:O(t.instantCapacityApPerHour)})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[e.jsx(De,{className:"size-4 text-[var(--primary)]"}),"Current load"]}),e.jsx("div",{className:"mt-2 text-sm text-white/58",children:O(t.currentDrainApPerHour)}),e.jsx("div",{className:"mt-2 text-xs uppercase tracking-[0.14em] text-white/38",children:t.overloadApPerHour>0?`${O(t.overloadApPerHour)} overload`:"Inside instant limit"})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[e.jsx(Me,{className:"size-4 text-[var(--primary)]"}),"Next move"]}),e.jsx("div",{className:"mt-2 text-sm text-white/58",children:t.recommendations[0]??"Favor the next clean, manageable action."}),e.jsx("div",{className:"mt-2 text-xs uppercase tracking-[0.14em] text-white/38",children:Ve(t)})]})]})]})}function ot({selectedUserIds:t,fallbackLifeForce:a,onRefresh:r,showEditor:o=!0}){var b,G;const i=ue(),v=new Date().getDay(),[y,S]=u.useState(v),P=xe({queryKey:["forge-life-force",...t],queryFn:()=>pe(t),initialData:a===void 0?void 0:{lifeForce:a,templates:te.map((j,V)=>({weekday:V,baselineDailyAp:a.baselineDailyAp,points:a.currentCurve.map(R=>({...R,locked:V===v?R.locked:!1}))}))}}),x=((b=P.data)==null?void 0:b.lifeForce)??a,n=(((G=P.data)==null?void 0:G.templates)??Re(x,v)).find(j=>j.weekday===y)??{weekday:y,baselineDailyAp:x.baselineDailyAp,points:x.currentCurve},[H,E]=u.useState(n.points),[ae,p]=u.useState(!1),[Q,L]=u.useState(null);u.useEffect(()=>{E(n.points),p(!1)},[n.points,n.weekday]);const F=q({mutationFn:j=>Se(n.weekday,{points:qe(j,n.baselineDailyAp)},t),onSuccess:async j=>{await i.invalidateQueries({queryKey:["forge-life-force"]}),await K(i),r&&await r(),E(j.points),p(!1)}}),B=q({mutationFn:()=>U({signalType:"tired"},t),onSuccess:async()=>{await i.invalidateQueries({queryKey:["forge-life-force"]}),await K(i),r&&await r(),L("Tiredness signal applied. Today’s Life Force now reflects the extra strain.")}}),c=q({mutationFn:()=>U({signalType:"okay_again"},t),onSuccess:async()=>{await i.invalidateQueries({queryKey:["forge-life-force"]}),await K(i),r&&await r(),L("Recovery signal applied. Instant strain has been eased for the rest of today.")}});return e.jsxs("div",{className:"grid gap-4",children:[e.jsx(Ze,{lifeForce:x}),e.jsx(Ue,{lifeForce:x}),e.jsx(fe,{lifeForce:x,onTired:()=>{B.mutateAsync()},onOkayAgain:()=>{c.mutateAsync()},tiredPending:B.isPending,okayPending:c.isPending,feedback:Q}),o?e.jsx(Je,{lifeForce:x,weekday:y,points:H,baselineDailyAp:n.baselineDailyAp,isDirty:ae,isSaving:F.isPending,onWeekdayChange:S,onChange:j=>{E(j),p(!0)},onReset:()=>{E(n.points),p(!1)},onSave:()=>{F.mutateAsync(H)}}):e.jsx(et,{}),e.jsx(tt,{drains:x.activeDrains,plannedDrains:x.plannedDrains,warnings:x.warnings,recommendations:x.recommendations}),x.topTaskIdsNeedingSplit.length>0?e.jsxs(w,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[e.jsx(Ae,{className:"size-4 text-[var(--primary)]"}),"Tasks asking to be split"]}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:x.topTaskIdsNeedingSplit.map(j=>e.jsx(J,{className:"bg-white/[0.08] text-white/74",children:j},j))})]}):null]})}function lt({selectedUserIds:t,fallbackLifeForce:a,onRefresh:r}){var n;const o=Array.isArray(t)?t:[],i=ue(),y=((n=xe({queryKey:["forge-life-force",...o],queryFn:()=>pe(o),initialData:a===void 0?void 0:{lifeForce:a,templates:[]}}).data)==null?void 0:n.lifeForce)??a;if(!y)return e.jsxs(w,{className:"p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Life Force"}),e.jsx("div",{className:"mt-2 text-lg font-semibold text-white",children:"Not calibrated yet"}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:"Today can still load without a Life Force snapshot, but the AP and instant headroom model is not available for this state yet."})]});const[S,P]=u.useState(null),x=q({mutationFn:()=>U({signalType:"tired"},o),onSuccess:async()=>{await i.invalidateQueries({queryKey:["forge-life-force"]}),await K(i),r&&await r(),P("Tiredness signal applied. Today’s headroom has been reduced.")}}),f=q({mutationFn:()=>U({signalType:"okay_again"},o),onSuccess:async()=>{await i.invalidateQueries({queryKey:["forge-life-force"]}),await K(i),r&&await r(),P("Recovery signal applied. Today’s headroom has been eased.")}});return e.jsx(fe,{lifeForce:y,onTired:()=>{x.mutateAsync()},onOkayAgain:()=>{f.mutateAsync()},tiredPending:x.isPending,okayPending:f.isPending,feedback:S})}export{ot as L,lt as a};
1
+ import{r as u,j as e,c9 as Ae,by as ke,bG as Pe,aH as me,bU as De,cS as Me,c7 as He,bF as Te,bX as Ce,aC as Oe}from"./vendor-DHkYh85p.js";import{j as ue,i as xe,k as q}from"./state-B-4sS1xO.js";import{i as K,cS as Se,cT as U,C as w,c as J,B as ee,Z as $,O as pe}from"./index-CF4J4R9L.js";import{F as Le}from"./floating-action-menu-Fs_ZiUMo.js";import{A as Fe,C as _e,X as Ee,c as le,Y as Ie,T as Xe,d as ze,a as Ye,b as Be}from"./charts-P7EVhIog.js";const Y=20,ce=288,M={top:16,right:18,bottom:28,left:42},te=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function Re(t,a){return te.map((r,o)=>({weekday:o,baselineDailyAp:t.baselineDailyAp,points:t.currentCurve.map(i=>({...i,locked:o===a?i.locked:!1}))}))}function re(t){return`${Number(t.toFixed(1))} AP`}function O(t){return`${Number(t.toFixed(1))} AP/h`}function se(t){const a=new Date(2026,0,1,0,t,0,0);return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(a)}function We(t){const a=new Date(2026,0,1,0,t,0,0);return new Intl.DateTimeFormat(void 0,{hour:"numeric"}).format(a)}function C(t,a,r){return Math.min(r,Math.max(a,t))}function $e(t){if(t.length<2)return 0;let a=0;for(let r=0;r<t.length-1;r+=1){const o=t[r],i=t[r+1];a+=(o.rateApPerHour+i.rateApPerHour)/2*((i.minuteOfDay-o.minuteOfDay)/60)}return a}function de(t,a){if(t.length===0)return 0;if(a<=t[0].minuteOfDay)return t[0].rateApPerHour;for(let r=0;r<t.length-1;r+=1){const o=t[r],i=t[r+1];if(a<=i.minuteOfDay){const v=Math.max(1,i.minuteOfDay-o.minuteOfDay),y=(a-o.minuteOfDay)/v;return o.rateApPerHour+(i.rateApPerHour-o.rateApPerHour)*y}}return t[t.length-1].rateApPerHour}function qe(t,a){const r=$e(t);if(r<=0||a<=0)return t.map(i=>({...i,rateApPerHour:0}));const o=a/r;return t.map(i=>({...i,rateApPerHour:Number((i.rateApPerHour*o).toFixed(4))}))}function Ke(t,a,r){var x;if(a<=0||a>=t.length-1)return((x=t[a])==null?void 0:x.rateApPerHour)??0;const o=t[a-1],i=t[a],v=t[a+1];let y=0;for(let f=0;f<t.length-1;f+=1){if(f===a-1||f===a)continue;const n=t[f],H=t[f+1];y+=(n.rateApPerHour+H.rateApPerHour)/2*((H.minuteOfDay-n.minuteOfDay)/60)}const S=Math.max(Y/60,(i.minuteOfDay-o.minuteOfDay)/60),P=Math.max(Y/60,(v.minuteOfDay-i.minuteOfDay)/60);return Math.max(0,(2*(r-y)-o.rateApPerHour*S-v.rateApPerHour*P)/(S+P))}function Qe(t){switch(t){case"danger":return"bg-rose-400/12 text-rose-100";case"warning":return"bg-amber-400/12 text-amber-100";case"success":return"bg-emerald-400/12 text-emerald-100";case"info":default:return"bg-sky-400/12 text-sky-100"}}function Ge(t){switch(t){case"primary":return"Primary";case"secondary":return"Secondary";case"recovery":return"Recovery";case"background":default:return"Ambient"}}function he(t){return t.spentTodayAp>t.dailyBudgetAp?"Over budget":t.spentTodayAp<t.targetBandMinAp?"Below target band":"Inside target band"}function Ve(t){return t.overloadApPerHour>0||t.instantFreeApPerHour<=0?"Recovery":t.instantCapacityApPerHour>=t.currentDrainApPerHour+4?"Deep work":"Low-friction admin"}function Ze({lifeForce:t}){return e.jsxs("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-4",children:[e.jsxs(w,{className:"p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Daily AP"}),e.jsxs("div",{className:"mt-2 font-display text-4xl text-[var(--primary)]",children:[Math.round(t.spentTodayAp),e.jsxs("span",{className:"ml-2 text-lg text-white/44",children:["/ ",Math.round(t.dailyBudgetAp)]})]}),e.jsxs("div",{className:"mt-2 text-sm text-white/58",children:["Target band ",Math.round(t.targetBandMinAp),"-",Math.round(t.targetBandMaxAp)," AP"]}),e.jsx("div",{className:"mt-2 text-xs uppercase tracking-[0.14em] text-white/38",children:he(t)})]}),e.jsxs(w,{className:"p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Instant headroom"}),e.jsx("div",{className:"mt-2 font-display text-4xl text-white",children:t.instantFreeApPerHour.toFixed(1)}),e.jsxs("div",{className:"mt-2 text-sm text-white/58",children:[O(t.instantCapacityApPerHour)," capacity minus"," ",O(t.currentDrainApPerHour)," load"]}),e.jsx("div",{className:"mt-2 text-xs uppercase tracking-[0.14em] text-white/38",children:t.overloadApPerHour>0?`${O(t.overloadApPerHour)} overloaded`:"No overload right now"})]}),e.jsxs(w,{className:"p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Fatigue buffer"}),e.jsx("div",{className:"mt-2 font-display text-4xl text-white",children:t.fatigueBufferApPerHour.toFixed(1)}),e.jsx("div",{className:"mt-2 text-sm text-white/58",children:"Short-term strain rises with overlap and falls with recovery."})]}),e.jsxs(w,{className:"p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Forecast"}),e.jsx("div",{className:"mt-2 font-display text-4xl text-white",children:Math.round(t.forecastAp)}),e.jsxs("div",{className:"mt-2 text-sm text-white/58",children:["Planned remaining ",re(t.plannedRemainingAp)]}),e.jsxs("div",{className:"mt-2 text-xs uppercase tracking-[0.14em] text-white/38",children:["Remaining ",re(t.remainingAp)]})]})]})}function Ue({lifeForce:t}){return e.jsx("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-6",children:t.stats.map(a=>e.jsxs(w,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/38",children:a.label}),e.jsxs(J,{className:"bg-white/[0.08] text-white/70",children:["L",a.level]})]}),e.jsxs("div",{className:"mt-3 text-2xl font-semibold text-white",children:[Math.round(a.xp)," XP"]}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:a.key==="life_force"?`+${Math.round((a.costModifier-1)*100)}% daily resilience`:`${Math.round((1-a.costModifier)*100)}% cost relief`})]},a.key))})}function Je({lifeForce:t,weekday:a,points:r,baselineDailyAp:o,isDirty:i,isSaving:v,onChange:y,onReset:S,onSave:P,onWeekdayChange:x}){var ne,oe;const f=u.useRef(null),[n,H]=u.useState(null),[E,ae]=u.useState(720),[p,Q]=u.useState(null),L=u.useMemo(()=>new Date().getDay(),[]),F=u.useMemo(()=>{const s=new Date;return s.getHours()*60+s.getMinutes()},[]),B=u.useMemo(()=>[...r].sort((s,l)=>s.minuteOfDay-l.minuteOfDay),[r]),c=u.useMemo(()=>B.map(s=>({...s,locked:a===L?s.minuteOfDay<=F:!1})),[F,B,L,a]),b=u.useMemo(()=>{const s=Math.max(t.instantCapacityApPerHour,...c.map(l=>l.rateApPerHour),8);return Math.max(12,Math.ceil(s*1.25))},[t.instantCapacityApPerHour,c]),G=u.useMemo(()=>c.map(s=>({...s,label:se(s.minuteOfDay)})),[c]),j=u.useMemo(()=>[0,240,480,720,960,1200,1440],[]),V=u.useMemo(()=>Array.from(new Set([0,Math.max(2,Math.round(b/3)),Math.max(4,Math.round(2*b/3)),b])).sort((s,l)=>s-l),[b]),R=Math.max(E,1),_=Math.max(160,R-M.left-M.right),I=ce-M.top-M.bottom;u.useEffect(()=>{const s=()=>{var m;const l=((m=f.current)==null?void 0:m.clientWidth)??0;ae(l>0?l:720)};return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[]),u.useEffect(()=>{if(n===null||!f.current)return;const s=f.current,l=d=>{if(d.pointerId!==n.pointerId)return;d.preventDefault();const g=s.getBoundingClientRect(),A=Number.isFinite(d.clientX)?d.clientX:g.left+n.pointerX,h=Number.isFinite(d.clientY)?d.clientY:g.top+n.pointerY,D=C(A-g.left,0,g.width),X=C(h-g.top,0,g.height),W=C(A-g.left-M.left,0,_),ye=C(h-g.top-M.top,0,I);y(c.map((N,k)=>{if(k!==n.index)return{minuteOfDay:N.minuteOfDay,rateApPerHour:N.rateApPerHour,locked:N.locked};if(N.locked||k===0||k===c.length-1)return{minuteOfDay:N.minuteOfDay,rateApPerHour:N.rateApPerHour,locked:N.locked};const ve=c[k-1].minuteOfDay+Y,we=c[k+1].minuteOfDay-Y,je=Math.round(C(W/_*1440,ve,we)),z=c.map(ie=>({minuteOfDay:ie.minuteOfDay,rateApPerHour:ie.rateApPerHour,locked:ie.locked}));z[k]={...z[k],minuteOfDay:je};const be=Ke(z,k,o),Ne=C((I-ye)/I*b,0,Math.max(0,be));return z[k]={...z[k],rateApPerHour:Number(Ne.toFixed(3))},z[k]})),H(N=>N===null||N.pointerId!==d.pointerId?N:{...N,pointerX:D,pointerY:X})},m=d=>{(!d||d.pointerId===n.pointerId)&&H(null)};return window.addEventListener("pointermove",l,{passive:!1}),window.addEventListener("pointerup",m),window.addEventListener("pointercancel",m),()=>{window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",m)}},[o,n,y,I,_,c,b]);const ge=u.useMemo(()=>{if(!p)return[];const s=c[p.index]??null;return[{id:"remove-point",label:"Remove point",description:s===null?"No turn point is selected.":`Delete the turn point at ${se(s.minuteOfDay)}.`,icon:He,tone:"danger",disabled:s===null||p.index===0||p.index===c.length-1,onSelect:()=>{y(c.filter((l,m)=>m!==p.index))}},{id:"flatten-point",label:"Flatten point",description:s===null?"No turn point is selected.":"Place the handle back on the interpolated segment between its neighbors.",icon:Te,disabled:s===null||p.index===0||p.index===c.length-1,onSelect:()=>{const l=c[p.index-1],m=c[p.index+1],d=de([l,m],s.minuteOfDay);y(c.map((g,A)=>A===p.index?{...g,rateApPerHour:Number(d.toFixed(3))}:g))}}]},[p,y,c]),Z=u.useMemo(()=>c.map(s=>({...s,x:M.left+s.minuteOfDay/1440*_,y:M.top+(1-s.rateApPerHour/Math.max(1,b))*I})),[I,_,c,b]),T=n===null?null:{pointerX:n.pointerX,pointerY:n.pointerY,constrainedX:((ne=Z[n.index])==null?void 0:ne.x)??n.pointerX,constrainedY:((oe=Z[n.index])==null?void 0:oe.y)??n.pointerY};return e.jsxs(e.Fragment,{children:[e.jsxs(w,{className:"overflow-hidden p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Life Force view"}),e.jsx("div",{className:"mt-2 text-xl font-semibold text-white",children:"Instant Life Force editor"}),e.jsx("div",{className:"mt-2 max-w-3xl text-sm leading-6 text-white/56",children:"One click adds a turn point. Drag future handles. Right click a handle to remove or flatten it. The ghost handle follows your finger or cursor while the real turn point stays constrained on the curve and normalized to the baseline daily AP budget."})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[e.jsx("div",{className:"flex flex-wrap items-center gap-1 rounded-full bg-white/[0.04] p-1",children:te.map((s,l)=>e.jsx("button",{type:"button",className:$("rounded-full px-3 py-1.5 text-[11px] font-medium transition",a===l?"bg-[var(--primary)] text-slate-950":"text-white/60 hover:bg-white/[0.05] hover:text-white"),onClick:()=>x(l),children:s},s))}),e.jsx(ee,{variant:"secondary",onClick:S,children:"Reset"}),e.jsxs(ee,{onClick:P,pending:v,disabled:!i,children:[e.jsx(Ce,{className:"mr-2 size-4"}),"Save curve"]})]})]}),e.jsxs("div",{className:"mt-4 rounded-[24px] bg-[linear-gradient(180deg,rgba(192,193,255,0.08),rgba(192,193,255,0.02))] p-3",children:[e.jsxs("div",{ref:f,className:$("relative h-72 w-full overflow-hidden rounded-[20px] bg-[rgba(255,255,255,0.02)]",n!==null?"select-none touch-none":""),style:{touchAction:n===null?"pan-y":"none"},role:"img","aria-label":"Life Force capacity curve editor",onClick:s=>{if(n!==null||!f.current||s.target!==s.currentTarget)return;const l=f.current.getBoundingClientRect(),m=C(s.clientX-l.left-M.left,0,_),d=Math.round(m/_*1440),g=c.findIndex(W=>W.minuteOfDay>d);if(g<=0)return;const A=c[g-1],h=c[g];if(d-A.minuteOfDay<Y||h.minuteOfDay-d<Y)return;const D=de(c,d),X=[...c];X.splice(g,0,{minuteOfDay:d,rateApPerHour:Number(D.toFixed(3)),locked:a===L&&d<=F}),y(X)},children:[e.jsxs(Fe,{width:R,height:ce,data:G,margin:M,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"life-force-chart-fill",x1:"0",x2:"0",y1:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"rgba(192,193,255,0.24)"}),e.jsx("stop",{offset:"100%",stopColor:"rgba(192,193,255,0.02)"})]})}),e.jsx(_e,{vertical:!1,stroke:"rgba(255,255,255,0.08)",strokeDasharray:"3 4"}),e.jsx(Ee,{dataKey:"minuteOfDay",type:"number",domain:[0,1440],ticks:j,tickFormatter:We,tick:{fill:"rgba(255,255,255,0.48)",fontSize:10},tickLine:!1,axisLine:{stroke:"rgba(255,255,255,0.12)"},children:e.jsx(le,{value:"Time",position:"insideBottom",offset:-10,fill:"rgba(255,255,255,0.38)",fontSize:10})}),e.jsx(Ie,{type:"number",domain:[0,b],ticks:V,tick:{fill:"rgba(255,255,255,0.48)",fontSize:10},tickLine:!1,axisLine:{stroke:"rgba(255,255,255,0.12)"},width:34,children:e.jsx(le,{value:"AP/h",angle:-90,position:"insideLeft",fill:"rgba(255,255,255,0.38)",fontSize:10,style:{textAnchor:"middle"}})}),e.jsx(Xe,{cursor:{stroke:"rgba(255,255,255,0.18)",strokeDasharray:"3 4"},content:({active:s,payload:l})=>{var d;const m=s?(d=l==null?void 0:l[0])==null?void 0:d.payload:null;return m?e.jsxs("div",{className:"rounded-[16px] border border-white/10 bg-[rgba(10,15,27,0.95)] px-3 py-2 text-xs text-white shadow-[0_18px_50px_rgba(4,8,18,0.3)] backdrop-blur-xl",children:[e.jsx("div",{className:"font-medium text-white",children:m.label}),e.jsx("div",{className:"mt-1 text-white/60",children:O(m.rateApPerHour)})]}):null}}),a===L?e.jsx(ze,{x:F,stroke:"rgba(255,255,255,0.22)",strokeDasharray:"3 4"}):null,e.jsx(Ye,{type:"linear",dataKey:"rateApPerHour",stroke:"none",fill:"url(#life-force-chart-fill)",isAnimationActive:!1}),e.jsx(Be,{type:"linear",dataKey:"rateApPerHour",stroke:"rgba(214,215,255,0.95)",strokeWidth:1.5,dot:!1,activeDot:!1,isAnimationActive:!1})]}),T?e.jsxs("svg",{className:"pointer-events-none absolute inset-0 z-[15] h-full w-full","aria-hidden":"true",children:[e.jsx("line",{x1:T.constrainedX,y1:T.constrainedY,x2:T.pointerX,y2:T.pointerY,stroke:"rgba(214,215,255,0.38)",strokeDasharray:"4 5",strokeWidth:"1.5"}),e.jsx("circle",{cx:T.pointerX,cy:T.pointerY,r:"11",fill:"rgba(214,215,255,0.12)",stroke:"rgba(214,215,255,0.34)",strokeWidth:"1.5","data-testid":"life-force-ghost-handle"}),e.jsx("circle",{cx:T.pointerX,cy:T.pointerY,r:"3.5",fill:"rgba(255,255,255,0.44)"})]}):null,Z.map((s,l)=>{const m=l===0||l===Z.length-1,d=(n==null?void 0:n.index)===l,g=m?14:16,A=m?22:28;return e.jsx("button",{type:"button","aria-label":`Turn point at ${se(s.minuteOfDay)}`,className:$("absolute z-20 flex items-center justify-center rounded-full transition-transform duration-75",s.locked||m?"cursor-not-allowed":"cursor-grab active:cursor-grabbing",d?"scale-110":""),style:{left:s.x-A/2,top:s.y-A/2,width:A,height:A,touchAction:"none"},onPointerDown:h=>{if(h.preventDefault(),h.stopPropagation(),s.locked||m||!f.current)return;"setPointerCapture"in h.currentTarget&&h.currentTarget.setPointerCapture(h.pointerId);const D=f.current.getBoundingClientRect(),X=Number.isFinite(h.clientX)?h.clientX:D.left+s.x,W=Number.isFinite(h.clientY)?h.clientY:D.top+s.y;H({index:l,pointerId:h.pointerId,pointerX:C(X-D.left,0,D.width),pointerY:C(W-D.top,0,D.height)})},onContextMenu:h=>{h.preventDefault(),h.stopPropagation(),Q({index:l,position:{x:h.clientX+6,y:h.clientY+6}})},children:e.jsx("span",{className:$("pointer-events-none inline-flex rounded-full border border-[rgba(10,15,27,0.92)] shadow-[0_0_0_1px_rgba(255,255,255,0.08),0_10px_24px_rgba(4,8,18,0.28)]",s.locked||m?"bg-white/55":"bg-white"),style:{width:g,height:g,opacity:d?.96:1}})},`${s.minuteOfDay}-${l}`)})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-2 px-1 text-[11px] text-white/42",children:[e.jsxs("div",{children:["Editing ",te[a]," curve"]}),e.jsxs("div",{children:[Math.round(o)," AP/day baseline"]})]})]})]}),e.jsx(Le,{open:p!==null,title:"Turn point actions",subtitle:"Delete the turn point or flatten it back onto the surrounding segment.",items:ge,position:(p==null?void 0:p.position)??null,onClose:()=>Q(null)})]})}function et(){return e.jsx(w,{className:"overflow-hidden p-4",children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Life Force studio"}),e.jsx("div",{className:"mt-2 text-xl font-semibold text-white",children:"Edit weekday curves in the dedicated view"}),e.jsx("div",{className:"mt-2 max-w-3xl text-sm leading-6 text-white/56",children:"The full weekday editor, turn-point menu, and curve calibration now live in their own page so Overview can stay fast and readable."})]}),e.jsxs(Oe,{to:"/life-force",className:"inline-flex min-h-10 min-w-0 max-w-full items-center justify-center gap-2 overflow-hidden whitespace-nowrap rounded-[var(--radius-control)] border border-[var(--primary)]/14 bg-[var(--ui-accent-soft)] px-3 py-2 text-[13px] font-medium text-[var(--ui-ink-on-accent)] shadow-[var(--ui-shadow-soft)] transition hover:bg-[var(--ui-accent-soft-hover)]",children:[e.jsx(me,{className:"size-4"}),"Open Life Force studio"]})]})})}function tt({drains:t,plannedDrains:a,warnings:r,recommendations:o}){return e.jsxs("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1.15fr)_minmax(0,0.85fr)]",children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsxs(w,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Current drains"}),e.jsx("div",{className:"mt-2 text-xl font-semibold text-white",children:"What is consuming Life Force now"})]}),e.jsxs(J,{className:"bg-white/[0.08] text-white/70",children:[t.length," active"]})]}),e.jsx("div",{className:"mt-4 grid gap-3",children:t.length===0?e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4 text-sm text-white/58",children:"No current drainers are active. This is a good moment to choose your next intentional action."}):t.map(i=>e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-base font-semibold text-white",children:i.title}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:i.why})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx("div",{className:"text-base font-semibold text-[var(--primary)]",children:O(i.apPerHour)}),e.jsx("div",{className:"mt-1 text-xs uppercase tracking-[0.14em] text-white/38",children:Ge(i.role)})]})]})},i.id))})]}),e.jsxs(w,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Planned drains"}),e.jsx("div",{className:"mt-2 text-xl font-semibold text-white",children:"What the rest of today is already asking from you"})]}),e.jsxs(J,{className:"bg-white/[0.08] text-white/70",children:[a.length," planned"]})]}),e.jsx("div",{className:"mt-4 grid gap-3",children:a.length===0?e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4 text-sm text-white/58",children:"No future AP load has been forecast yet. The day is still open."}):a.slice(0,6).map(i=>e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-base font-semibold text-white",children:i.title}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:i.why})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx("div",{className:"text-base font-semibold text-[var(--primary)]",children:re(i.instantAp)}),e.jsx("div",{className:"mt-1 text-xs uppercase tracking-[0.14em] text-white/38",children:O(i.apPerHour)})]})]})},i.id))})]})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs(w,{className:"p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Warnings"}),e.jsx("div",{className:"mt-4 grid gap-3",children:r.map(i=>e.jsxs("div",{className:$("rounded-[18px] px-4 py-4",Qe(i.tone)),children:[e.jsx("div",{className:"text-sm font-semibold",children:i.title}),e.jsx("div",{className:"mt-1 text-sm leading-6 text-current/80",children:i.detail})]},i.id))})]}),e.jsxs(w,{className:"p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Recommendations"}),e.jsx("div",{className:"mt-4 grid gap-2",children:o.map((i,v)=>e.jsx("div",{className:"rounded-[16px] bg-white/[0.04] px-4 py-3 text-sm leading-6 text-white/66",children:i},`${i}-${v}`))})]})]})]})}function fe({lifeForce:t,onTired:a,onOkayAgain:r,tiredPending:o,okayPending:i,feedback:v}){return e.jsxs(w,{className:"overflow-hidden p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Life Force now"}),e.jsxs("div",{className:"mt-2 text-2xl font-semibold text-white",children:[t.instantFreeApPerHour.toFixed(1)," AP/h free"]}),e.jsxs("div",{className:"mt-2 text-sm text-white/58",children:[Math.round(t.spentTodayAp)," / ",Math.round(t.dailyBudgetAp)," AP used today"]}),e.jsx("div",{className:"mt-2 text-xs uppercase tracking-[0.14em] text-white/38",children:he(t)})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(ee,{variant:"secondary",onClick:a,pending:o,children:[e.jsx(ke,{className:"mr-2 size-4"}),"I'm getting tired"]}),e.jsxs(ee,{variant:"secondary",onClick:r,pending:i,children:[e.jsx(Pe,{className:"mr-2 size-4"}),"I'm okay again"]})]})]}),v?e.jsx("div",{className:"mt-4 rounded-[18px] bg-[var(--primary)]/10 px-4 py-3 text-sm text-white/74",children:v}):null,e.jsxs("div",{className:"mt-4 grid gap-3 md:grid-cols-3",children:[e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[e.jsx(me,{className:"size-4 text-[var(--primary)]"}),"Instant capacity"]}),e.jsx("div",{className:"mt-2 text-sm text-white/58",children:O(t.instantCapacityApPerHour)})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[e.jsx(De,{className:"size-4 text-[var(--primary)]"}),"Current load"]}),e.jsx("div",{className:"mt-2 text-sm text-white/58",children:O(t.currentDrainApPerHour)}),e.jsx("div",{className:"mt-2 text-xs uppercase tracking-[0.14em] text-white/38",children:t.overloadApPerHour>0?`${O(t.overloadApPerHour)} overload`:"Inside instant limit"})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[e.jsx(Me,{className:"size-4 text-[var(--primary)]"}),"Next move"]}),e.jsx("div",{className:"mt-2 text-sm text-white/58",children:t.recommendations[0]??"Favor the next clean, manageable action."}),e.jsx("div",{className:"mt-2 text-xs uppercase tracking-[0.14em] text-white/38",children:Ve(t)})]})]})]})}function ot({selectedUserIds:t,fallbackLifeForce:a,onRefresh:r,showEditor:o=!0}){var b,G;const i=ue(),v=new Date().getDay(),[y,S]=u.useState(v),P=xe({queryKey:["forge-life-force",...t],queryFn:()=>pe(t),initialData:a===void 0?void 0:{lifeForce:a,templates:te.map((j,V)=>({weekday:V,baselineDailyAp:a.baselineDailyAp,points:a.currentCurve.map(R=>({...R,locked:V===v?R.locked:!1}))}))}}),x=((b=P.data)==null?void 0:b.lifeForce)??a,n=(((G=P.data)==null?void 0:G.templates)??Re(x,v)).find(j=>j.weekday===y)??{weekday:y,baselineDailyAp:x.baselineDailyAp,points:x.currentCurve},[H,E]=u.useState(n.points),[ae,p]=u.useState(!1),[Q,L]=u.useState(null);u.useEffect(()=>{E(n.points),p(!1)},[n.points,n.weekday]);const F=q({mutationFn:j=>Se(n.weekday,{points:qe(j,n.baselineDailyAp)},t),onSuccess:async j=>{await i.invalidateQueries({queryKey:["forge-life-force"]}),await K(i),r&&await r(),E(j.points),p(!1)}}),B=q({mutationFn:()=>U({signalType:"tired"},t),onSuccess:async()=>{await i.invalidateQueries({queryKey:["forge-life-force"]}),await K(i),r&&await r(),L("Tiredness signal applied. Today’s Life Force now reflects the extra strain.")}}),c=q({mutationFn:()=>U({signalType:"okay_again"},t),onSuccess:async()=>{await i.invalidateQueries({queryKey:["forge-life-force"]}),await K(i),r&&await r(),L("Recovery signal applied. Instant strain has been eased for the rest of today.")}});return e.jsxs("div",{className:"grid gap-4",children:[e.jsx(Ze,{lifeForce:x}),e.jsx(Ue,{lifeForce:x}),e.jsx(fe,{lifeForce:x,onTired:()=>{B.mutateAsync()},onOkayAgain:()=>{c.mutateAsync()},tiredPending:B.isPending,okayPending:c.isPending,feedback:Q}),o?e.jsx(Je,{lifeForce:x,weekday:y,points:H,baselineDailyAp:n.baselineDailyAp,isDirty:ae,isSaving:F.isPending,onWeekdayChange:S,onChange:j=>{E(j),p(!0)},onReset:()=>{E(n.points),p(!1)},onSave:()=>{F.mutateAsync(H)}}):e.jsx(et,{}),e.jsx(tt,{drains:x.activeDrains,plannedDrains:x.plannedDrains,warnings:x.warnings,recommendations:x.recommendations}),x.topTaskIdsNeedingSplit.length>0?e.jsxs(w,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[e.jsx(Ae,{className:"size-4 text-[var(--primary)]"}),"Tasks asking to be split"]}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:x.topTaskIdsNeedingSplit.map(j=>e.jsx(J,{className:"bg-white/[0.08] text-white/74",children:j},j))})]}):null]})}function lt({selectedUserIds:t,fallbackLifeForce:a,onRefresh:r}){var n;const o=Array.isArray(t)?t:[],i=ue(),y=((n=xe({queryKey:["forge-life-force",...o],queryFn:()=>pe(o),initialData:a===void 0?void 0:{lifeForce:a,templates:[]}}).data)==null?void 0:n.lifeForce)??a;if(!y)return e.jsxs(w,{className:"p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Life Force"}),e.jsx("div",{className:"mt-2 text-lg font-semibold text-white",children:"Not calibrated yet"}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:"Today can still load without a Life Force snapshot, but the AP and instant headroom model is not available for this state yet."})]});const[S,P]=u.useState(null),x=q({mutationFn:()=>U({signalType:"tired"},o),onSuccess:async()=>{await i.invalidateQueries({queryKey:["forge-life-force"]}),await K(i),r&&await r(),P("Tiredness signal applied. Today’s headroom has been reduced.")}}),f=q({mutationFn:()=>U({signalType:"okay_again"},o),onSuccess:async()=>{await i.invalidateQueries({queryKey:["forge-life-force"]}),await K(i),r&&await r(),P("Recovery signal applied. Today’s headroom has been eased.")}});return e.jsx(fe,{lifeForce:y,onTired:()=>{x.mutateAsync()},onOkayAgain:()=>{f.mutateAsync()},tiredPending:x.isPending,okayPending:f.isPending,feedback:S})}export{ot as L,lt as a};
@@ -1 +1 @@
1
- import{j as e}from"./vendor-DHkYh85p.js";import{C as l,aq as c,Z as x}from"./index-BHTUu_4M.js";function o({label:t,value:n,tone:a="default",detail:s,help:r,className:i}){return e.jsxs(l,{className:x("rounded-[22px] p-4",a==="core"&&"bg-[linear-gradient(180deg,rgba(29,24,48,0.95),rgba(17,17,31,0.92))]",a==="psyche"&&"bg-[linear-gradient(180deg,rgba(18,31,34,0.96),rgba(13,24,27,0.94))]",i),children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:[e.jsx("span",{children:t}),r?e.jsx(c,{label:`Explain ${t}`,title:t,content:r,panelClassName:"normal-case tracking-normal"}):null]}),e.jsx("div",{className:"mt-3 font-display text-3xl text-white",children:n}),s?e.jsx("div",{className:"mt-2 text-sm text-white/56",children:s}):null]})}export{o as M};
1
+ import{j as e}from"./vendor-DHkYh85p.js";import{C as l,aq as c,Z as x}from"./index-CF4J4R9L.js";function o({label:t,value:n,tone:a="default",detail:s,help:r,className:i}){return e.jsxs(l,{className:x("rounded-[22px] p-4",a==="core"&&"bg-[linear-gradient(180deg,rgba(29,24,48,0.95),rgba(17,17,31,0.92))]",a==="psyche"&&"bg-[linear-gradient(180deg,rgba(18,31,34,0.96),rgba(13,24,27,0.94))]",i),children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:[e.jsx("span",{children:t}),r?e.jsx(c,{label:`Explain ${t}`,title:t,content:r,panelClassName:"normal-case tracking-normal"}):null]}),e.jsx("div",{className:"mt-3 font-display text-3xl text-white",children:n}),s?e.jsx("div",{className:"mt-2 text-sm text-white/56",children:s}):null]})}export{o as M};