forge-openclaw-plugin 0.2.101 → 0.2.102
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.
- package/dist/assets/{activity-page-CpjuNSHw.js → activity-page-CgF7K2ww.js} +1 -1
- package/dist/assets/ai-surface-workspace-xtB5RFQu.js +1 -0
- package/dist/assets/atlas-panel-B3dPHCmZ.js +1 -0
- package/dist/assets/{board-BkDRaMp6.js → board-DqHzdCPQ.js} +1 -1
- package/dist/assets/{calendar-page-DNNt6lfz.js → calendar-page-C1Wfd2Fy.js} +1 -1
- package/dist/assets/{calendar-rules-DNJFNsxi.js → calendar-rules-CaZXtlxt.js} +1 -1
- package/dist/assets/calendar-week-toolbar-BZ_-X3Wb.js +1 -0
- package/dist/assets/{charts-P7EVhIog.js → charts-FcU0F3XV.js} +8 -8
- package/dist/assets/{companion-sync-lab-page-KxEDigM6.js → companion-sync-lab-page-NgeK-O-P.js} +1 -1
- package/dist/assets/daily-metrics-dashboard-BMyL0Qr4.js +1 -0
- package/dist/assets/{entity-note-count-link-DrhjJZ4i.js → entity-note-count-link-BrS1-O0o.js} +1 -1
- package/dist/assets/entity-notes-surface-CBylYDwy.js +1 -0
- package/dist/assets/{execution-board-D07gOocB.js → execution-board-CpO2ch6v.js} +1 -1
- package/dist/assets/faceted-token-search-D7xPWfOl.js +1 -0
- package/dist/assets/flagship-signal-deck-BEFKOhvx.js +1 -0
- package/dist/assets/{floating-action-menu-Fs_ZiUMo.js → floating-action-menu-zzC2r0Ob.js} +1 -1
- package/dist/assets/{forms-BFlTgZ3W.js → forms-CmLAyGqz.js} +1 -1
- package/dist/assets/{goal-detail-page-CqLiNz4f.js → goal-detail-page-JK_Nva8e.js} +1 -1
- package/dist/assets/goals-page-yeoJ06Vw.js +1 -0
- package/dist/assets/{graph-D6JLqDbD.js → graph-BTa79qum.js} +14 -14
- package/dist/assets/{habits-page-BJxagdzx.js → habits-page-Dx5EhkJi.js} +1 -1
- package/dist/assets/index-BHIKoiZ6.js +19 -0
- package/dist/assets/index-H8R-ABM3.css +1 -0
- package/dist/assets/insight-flow-dialog-BtIQXXsS.js +1 -0
- package/dist/assets/{insights-page-D6rOa7uk.js → insights-page-CujrosD_.js} +1 -1
- package/dist/assets/{kanban-page-XQ7Se6dH.js → kanban-page-Q9NuIz5w.js} +1 -1
- package/dist/assets/knowledge-graph-page-DaJmlvvM.js +1 -0
- package/dist/assets/{life-force-page-Dy0JTS2G.js → life-force-page-BGDkKfbJ.js} +1 -1
- package/dist/assets/{life-force-workspace-OfyB9HJM.js → life-force-workspace-CLVexVnb.js} +1 -1
- package/dist/assets/{maps-ClgJoCjz.js → maps-CF1RagUX.js} +1 -1
- package/dist/assets/metric-tile-4iMd_WnJ.js +1 -0
- package/dist/assets/{motion-BeD44FeG.js → motion-CfdU2F35.js} +1 -1
- package/dist/assets/movement-page-ClaoTNuX.js +1 -0
- package/dist/assets/note-markdown-CsGQhQXF.js +3 -0
- package/dist/assets/note-tags-input-DdZi93tj.js +1 -0
- package/dist/assets/notes-page-DYI8s3NN.js +1 -0
- package/dist/assets/{open-in-graph-button-IXe9SGth.js → open-in-graph-button-C0TGev7c.js} +1 -1
- package/dist/assets/orbit-map-DVXkfQdd.js +1 -0
- package/dist/assets/overview-page-BwMlFQKX.js +1 -0
- package/dist/assets/page-hero-oFHaAjtL.js +1 -0
- package/dist/assets/pill-cluster-7UZd_lHp.js +1 -0
- package/dist/assets/{preference-entity-handoff-button-5PzUn42S.js → preference-entity-handoff-button-DOKV9bZc.js} +1 -1
- package/dist/assets/preferences-page-BrKEkmfD.js +1 -0
- package/dist/assets/{project-collections-xPz2mlRr.js → project-collections-CZagCmeH.js} +1 -1
- package/dist/assets/{project-detail-page-BXK5-4xW.js → project-detail-page-DogvVNEn.js} +1 -1
- package/dist/assets/{project-management-hierarchy-page-DtRpMABw.js → project-management-hierarchy-page-Dr7hW9PW.js} +1 -1
- package/dist/assets/{project-management-section-nav-P3ixzPa-.js → project-management-section-nav-BLdAgTge.js} +1 -1
- package/dist/assets/{projects-page-C5ViRuf4.js → projects-page-UKrby_5-.js} +1 -1
- package/dist/assets/psyche-behaviors-page-BeVlXvbj.js +5 -0
- package/dist/assets/psyche-flashcards-page-CqAWCO4E.js +1 -0
- package/dist/assets/psyche-goal-map-page-IyNnbk_W.js +1 -0
- package/dist/assets/psyche-graph-IkUQRaDK.js +1 -0
- package/dist/assets/{psyche-metrics-page-CuR9oqEy.js → psyche-metrics-page-uai0a7Lx.js} +1 -1
- package/dist/assets/psyche-mode-guide-page-C7p-ABiF.js +1 -0
- package/dist/assets/psyche-modes-page-CLQ5V3w0.js +1 -0
- package/dist/assets/psyche-page-NQBHkkpU.js +1 -0
- package/dist/assets/psyche-patterns-page-BkRiNpI_.js +5 -0
- package/dist/assets/psyche-questionnaire-builder-page-Du-7HwPC.js +1 -0
- package/dist/assets/psyche-questionnaire-detail-page-C5-yf8MF.js +1 -0
- package/dist/assets/psyche-questionnaire-run-detail-page-CoSH5O6R.js +1 -0
- package/dist/assets/psyche-questionnaire-run-page-ChI7c1wy.js +1 -0
- package/dist/assets/psyche-questionnaires-page-xUcJJzbI.js +1 -0
- package/dist/assets/psyche-report-detail-page-BPrZCFZS.js +3 -0
- package/dist/assets/psyche-reports-page-D2EXJmm6.js +1 -0
- package/dist/assets/{psyche-schemas-HFmg37Wj.js → psyche-schemas-RcZYaokx.js} +1 -1
- package/dist/assets/psyche-schemas-beliefs-page-h0ooZ1lp.js +9 -0
- package/dist/assets/psyche-screen-time-page-_3-4LikV.js +1 -0
- package/dist/assets/psyche-self-observation-page-BdbCsgR5.js +1 -0
- package/dist/assets/psyche-values-page-DuUVki5e.js +5 -0
- package/dist/assets/report-chain-fields-BBMz0sGI.js +1 -0
- package/dist/assets/{rewards-page-DmC4R_Ps.js → rewards-page-PZFPa6rR.js} +1 -1
- package/dist/assets/{scheduling-rules-editor-D02s70hr.js → scheduling-rules-editor-B9KNKsQz.js} +1 -1
- package/dist/assets/schema-badge-D93RcG36.js +1 -0
- package/dist/assets/schema-visuals-CvC9a3i6.js +1 -0
- package/dist/assets/select-menu-Cdq7foRu.js +1 -0
- package/dist/assets/{settings-agents-page-C_v_hMJF.js → settings-agents-page-DPx2F6wf.js} +3 -3
- package/dist/assets/{settings-bin-page-DY5bg81n.js → settings-bin-page-COwP3gjo.js} +1 -1
- package/dist/assets/settings-calendar-page-C-ghE0YT.js +5 -0
- package/dist/assets/{settings-data-page-CHRQFU9H.js → settings-data-page-CBubzKBw.js} +1 -1
- package/dist/assets/{settings-logs-page-B04pUwEv.js → settings-logs-page-uOuXMeBm.js} +1 -1
- package/dist/assets/{settings-mobile-page-D9kTlYDS.js → settings-mobile-page-C5rfj8_r.js} +1 -1
- package/dist/assets/settings-models-page-DijmUWdU.js +1 -0
- package/dist/assets/{settings-page-DYDTFlnv.js → settings-page-B4u5TR5g.js} +1 -1
- package/dist/assets/{settings-rewards-page-cl4vqqO_.js → settings-rewards-page-COiTwkMH.js} +1 -1
- package/dist/assets/{settings-section-nav-DSOuht_F.js → settings-section-nav-Dc4IeVBt.js} +1 -1
- package/dist/assets/{settings-users-page-BU79JB_T.js → settings-users-page-DEGa5DNn.js} +1 -1
- package/dist/assets/settings-wiki-page-Cvsiz5_e.js +1 -0
- package/dist/assets/{sleep-page-D8NbdhyS.js → sleep-page-BnSOwkEU.js} +1 -1
- package/dist/assets/{sports-page-CV4Cnzwn.js → sports-page-l1RqXzA_.js} +1 -1
- package/dist/assets/{state-B-4sS1xO.js → state-VYvD1QVP.js} +1 -1
- package/dist/assets/{strategies-page-C4qvXnql.js → strategies-page-DEnPlpAs.js} +1 -1
- package/dist/assets/{strategy-detail-page-DJLo5rfy.js → strategy-detail-page-Ls8bxKeH.js} +1 -1
- package/dist/assets/strategy-dialog-DMyRKrWf.js +1 -0
- package/dist/assets/surface-Bfz_sLX6.js +1 -0
- package/dist/assets/{table-WfAPUppN.js → table-C0VTeqw0.js} +1 -1
- package/dist/assets/task-detail-page-CgrYgQLD.js +1 -0
- package/dist/assets/{timebox-planning-dialog-DB6FLqmI.js → timebox-planning-dialog-Ww0NGLLo.js} +1 -1
- package/dist/assets/today-page-CIuFHMi1.js +1 -0
- package/dist/assets/training-load-page-BIwc648i.js +1 -0
- package/dist/assets/{ui-C13Nbgas.js → ui-CsEkP2V8.js} +4 -4
- package/dist/assets/use-psyche-focus-target-qxT5Oy_z.js +1 -0
- package/dist/assets/{vendor-DHkYh85p.js → vendor-kIz9EZnX.js} +237 -222
- package/dist/assets/{vitals-page-qre17Nw8.js → vitals-page-Dz1Jt5H8.js} +1 -1
- package/dist/assets/{weekly-review-page-Cz4vkRcx.js → weekly-review-page-BFpBe1kI.js} +1 -1
- package/dist/assets/weight-loss-page-BgMoBpBt.js +5 -0
- package/dist/assets/{wiki-article-markdown-DdiR2TJE.js → wiki-article-markdown-gsPTXTg1.js} +1 -1
- package/dist/assets/{wiki-editor-page-DqwoqVFb.js → wiki-editor-page-BpAZHooY.js} +7 -7
- package/dist/assets/{wiki-ingest-history-page--evBLbOw.js → wiki-ingest-history-page-C-ig8O22.js} +1 -1
- package/dist/assets/{wiki-ingest-modal--ohzFnj2.js → wiki-ingest-modal-BK4eQgqs.js} +1 -1
- package/dist/assets/{wiki-page-B_VJFBPA.js → wiki-page-CMTZ60Zt.js} +1 -1
- package/dist/assets/workbench-flow-page-BIpWUcLJ.js +5 -0
- package/dist/assets/workbench-page-CtCjYSRe.js +1 -0
- package/dist/assets/workout-detail-page-DD9IGN6l.js +2 -0
- package/dist/index.html +9 -9
- package/dist/openclaw/local-runtime.js +41 -14
- package/dist/server/server/migrations/067_weight_loss_daily_active_overrides.sql +13 -0
- package/dist/server/server/src/app.js +103 -30
- package/dist/server/server/src/health-weight-loss.js +457 -55
- package/dist/server/server/src/health.js +12 -4
- package/dist/server/server/src/movement.js +84 -1
- package/dist/server/server/src/openapi.js +123 -18
- package/dist/server/server/src/repositories/model-settings.js +12 -9
- package/dist/server/server/src/repositories/settings.js +19 -5
- package/dist/server/src/components/ui/info-tooltip.js +6 -6
- package/dist/server/src/lib/api.js +14 -4
- package/dist/server/src/lib/theme-system.js +8 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +3 -3
- package/server/migrations/067_weight_loss_daily_active_overrides.sql +13 -0
- package/skills/forge-openclaw/SKILL.md +13 -0
- package/skills/forge-openclaw/entity_conversation_playbooks.md +7 -1
- package/dist/assets/ai-surface-workspace-DEAFZruS.js +0 -1
- package/dist/assets/atlas-panel-CdVNPotj.js +0 -1
- package/dist/assets/calendar-week-toolbar-BbPwYeN0.js +0 -1
- package/dist/assets/daily-metrics-dashboard-B3cqJgDt.js +0 -1
- package/dist/assets/entity-notes-surface-CkcRsKJQ.js +0 -1
- package/dist/assets/faceted-token-search-BxRRcM3q.js +0 -1
- package/dist/assets/flagship-signal-deck-cmy82b8_.js +0 -1
- package/dist/assets/goals-page-BTk7mg_T.js +0 -1
- package/dist/assets/index-CF4J4R9L.js +0 -19
- package/dist/assets/index-CZbuZQjw.css +0 -1
- package/dist/assets/insight-flow-dialog-8f3D0GuC.js +0 -1
- package/dist/assets/knowledge-graph-page-BtAg8iv3.js +0 -1
- package/dist/assets/metric-tile-DKpo-8xw.js +0 -1
- package/dist/assets/movement-page-Bg_T_Stx.js +0 -1
- package/dist/assets/note-markdown-N-uxD3Xt.js +0 -3
- package/dist/assets/note-tags-input-Cdu7wiw6.js +0 -1
- package/dist/assets/notes-page-CKXnF_KU.js +0 -1
- package/dist/assets/orbit-map-Dzi6KliQ.js +0 -1
- package/dist/assets/overview-page-1miYqaVS.js +0 -1
- package/dist/assets/page-hero-DRy5b2MU.js +0 -1
- package/dist/assets/pill-cluster-C9QczVJ2.js +0 -1
- package/dist/assets/preferences-page-DtNaF5Q3.js +0 -1
- package/dist/assets/psyche-behaviors-page-Dco46sC4.js +0 -5
- package/dist/assets/psyche-flashcards-page-ZcoEB8gV.js +0 -1
- package/dist/assets/psyche-goal-map-page-CLBAQOI0.js +0 -1
- package/dist/assets/psyche-graph-k4tX2tdp.js +0 -1
- package/dist/assets/psyche-mode-guide-page-hIVXcCnE.js +0 -1
- package/dist/assets/psyche-modes-page-0lYtBlhO.js +0 -1
- package/dist/assets/psyche-page-VZ9k9ISp.js +0 -1
- package/dist/assets/psyche-patterns-page-gx5nmdGq.js +0 -5
- package/dist/assets/psyche-questionnaire-builder-page-Bn0TOISd.js +0 -1
- package/dist/assets/psyche-questionnaire-detail-page-CmVzSd_s.js +0 -1
- package/dist/assets/psyche-questionnaire-run-detail-page-BsMbmXCG.js +0 -1
- package/dist/assets/psyche-questionnaire-run-page-CgkRL2vi.js +0 -1
- package/dist/assets/psyche-questionnaires-page-D7V8uLXM.js +0 -1
- package/dist/assets/psyche-report-detail-page-OlFq57eL.js +0 -3
- package/dist/assets/psyche-reports-page-dVUZjna1.js +0 -1
- package/dist/assets/psyche-schemas-beliefs-page-BCgc8FUd.js +0 -9
- package/dist/assets/psyche-screen-time-page-B_6BT_WN.js +0 -1
- package/dist/assets/psyche-self-observation-page-CEG5mluK.js +0 -1
- package/dist/assets/psyche-values-page-DRbRfEd6.js +0 -5
- package/dist/assets/report-chain-fields-CALCV3V5.js +0 -1
- package/dist/assets/schema-badge-BZO-qNhO.js +0 -1
- package/dist/assets/schema-visuals-D6nxjbYC.js +0 -1
- package/dist/assets/select-menu-fYyreSdQ.js +0 -1
- package/dist/assets/settings-calendar-page-D1CzE6cg.js +0 -5
- package/dist/assets/settings-models-page-D26270R2.js +0 -1
- package/dist/assets/settings-wiki-page-DwAUlyA3.js +0 -1
- package/dist/assets/strategy-dialog-D3AuUlVz.js +0 -1
- package/dist/assets/task-detail-page-z-9u9rF0.js +0 -1
- package/dist/assets/today-page-BKlu6gx5.js +0 -1
- package/dist/assets/training-load-page-CyJQqo_3.js +0 -1
- package/dist/assets/use-psyche-focus-target-C1C_XjYG.js +0 -1
- package/dist/assets/weight-loss-page-BQrnOI0y.js +0 -1
- package/dist/assets/workbench-flow-page-Du62mtJU.js +0 -5
- package/dist/assets/workbench-page-4MKr3iRm.js +0 -1
- package/dist/assets/workout-detail-page-DfUbYYw1.js +0 -2
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as p,j as e,aK as Ce,cu as Me,b3 as Qe,b5 as Re,c2 as ze,bg as He,ce as Ye,c7 as Ge,b4 as Je,ca as We}from"./vendor-DHkYh85p.js";import{j as Xe,i as F,k as ie}from"./state-B-4sS1xO.js";import{b as Fe,c as z,Z as Ze,u as et,g as v,bk as b,bl as w,ao as tt,bm as at,bn as st,bo as W,bp as De,bq as Ie,E as it,B as Q,C as I,h as B,d as nt,br as rt,I as D,bs as lt,T as Le,m as _e,a as ot,bt as dt,bu as ct,bv as ut,i as pt,bw as ht,bx as mt,by as xt,bz as gt,bA as yt,bB as ft,bC as vt,O as bt,bD as wt}from"./index-CF4J4R9L.js";import{N as ne}from"./note-markdown-N-uxD3Xt.js";import{n as Z,N as re,f as jt,p as Nt,b as kt}from"./note-tags-input-Cdu7wiw6.js";import{P as Tt}from"./page-hero-DRy5b2MU.js";import{F as St}from"./floating-action-menu-Fs_ZiUMo.js";import"./board-BkDRaMp6.js";import"./ui-C13Nbgas.js";import"./motion-BeD44FeG.js";import"./forms-BFlTgZ3W.js";import"./graph-D6JLqDbD.js";function At(i){return i.trim().toLowerCase()}function Ct(i,l){return i.includes(l)?i:[...i,l]}function Mt({entityOptions:i,selectedEntityValues:l,onSelectedEntityValuesChange:d,selectedTextTerms:u,onSelectedTextTermsChange:L,placeholder:j="Filter by linked entity or add free text"}){const[S,A]=p.useState(""),[ee,g]=p.useState(!1),[H,y]=p.useState(0),P=At(S),C=p.useMemo(()=>l.map(s=>i.find(c=>c.value===s)).filter(Boolean),[i,l]),_=p.useMemo(()=>{const s=i.filter(c=>!l.includes(c.value));return P?s.filter(c=>`${c.label} ${c.description??""} ${c.searchText??""}`.toLowerCase().includes(P)).slice(0,8):s.slice(0,8)},[i,P,l]),N=S.trim().length>0&&!u.includes(S.trim()),Y=s=>{d(Ct(l,s)),A(""),y(0),g(!1)},K=(s=S)=>{const c=s.trim();!c||u.includes(c)||(L([...u,c]),A(""),y(0),g(!1))},q=s=>{d(l.filter(c=>c!==s))},h=s=>{L(u.filter(c=>c!==s))};return e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 text-[11px] uppercase tracking-[0.16em] text-white/40",children:[e.jsx("span",{children:"Search hints: entity chips match linked records, free-text chips match note body or author."}),e.jsx("button",{type:"button",onClick:()=>K(),disabled:!N,className:"rounded-full border border-white/8 bg-white/[0.04] px-2.5 py-1 text-[10px] tracking-[0.14em] text-white/62 transition hover:bg-white/[0.08] hover:text-white disabled:cursor-not-allowed disabled:opacity-40",children:"Free text"})]}),e.jsxs("div",{className:"rounded-[24px] border border-white/8 bg-[linear-gradient(135deg,rgba(19,28,48,0.88),rgba(10,14,26,0.98))] px-4 py-3 shadow-[0_24px_70px_rgba(3,8,18,0.2)]",children:[C.length>0||u.length>0?e.jsxs("div",{className:"mb-3 flex flex-wrap gap-2",children:[C.map(s=>e.jsxs("span",{className:"inline-flex max-w-full items-center gap-2 rounded-full border border-white/8 bg-white/[0.06] px-2.5 py-1.5",children:[s.kind?e.jsx(Fe,{kind:s.kind,label:s.label,compact:!0,gradient:!1,className:"max-w-[16rem]"}):e.jsx(z,{className:"bg-white/[0.08] text-white/78",children:s.label}),e.jsx("button",{type:"button",className:"rounded-full text-white/50 transition hover:text-white",onClick:()=>q(s.value),"aria-label":`Remove ${s.label}`,children:e.jsx(Ce,{className:"size-3.5"})})]},s.value)),u.map(s=>e.jsxs("span",{className:"inline-flex max-w-full items-center gap-2 rounded-full border border-cyan-300/16 bg-cyan-400/10 px-2.5 py-1.5 text-sm text-cyan-50",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(Me,{className:"size-3.5"}),e.jsx("span",{className:"max-w-[16rem] truncate",children:s})]}),e.jsx("button",{type:"button",className:"rounded-full text-cyan-100/70 transition hover:text-white",onClick:()=>h(s),"aria-label":`Remove free-text filter ${s}`,children:e.jsx(Ce,{className:"size-3.5"})})]},s))]}):null,u.length>1?e.jsx("div",{className:"mb-3 text-xs text-white/42",children:"Free-text chips are combined with OR."}):null,e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Qe,{className:"size-4 text-white/34"}),e.jsx("input",{value:S,onChange:s=>{A(s.target.value),g(!0),y(0)},onFocus:()=>g(!0),onBlur:()=>{window.setTimeout(()=>g(!1),120)},onKeyDown:s=>{if(s.key==="Backspace"&&!S){if(u.length>0){h(u[u.length-1]);return}l.length>0&&q(l[l.length-1]);return}if(s.key==="ArrowDown"){s.preventDefault(),g(!0),y(k=>_.length===0?0:Math.min(_.length-1,k+1));return}if(s.key==="ArrowUp"){s.preventDefault(),y(k=>Math.max(0,k-1));return}if(s.key==="Escape"){g(!1);return}if(s.key!=="Enter")return;s.preventDefault();const c=_[H];if(c){Y(c.value);return}K()},placeholder:j,className:"min-w-0 flex-1 bg-transparent text-sm text-white placeholder:text-white/34 focus:outline-none"})]}),ee?e.jsxs("div",{className:"absolute top-full z-20 mt-2 w-full rounded-[22px] border border-white/8 bg-[rgba(8,13,24,0.96)] p-2 shadow-[0_26px_60px_rgba(4,8,18,0.32)] backdrop-blur-xl",children:[_.map((s,c)=>e.jsx("button",{type:"button",className:Ze("flex w-full items-start justify-between gap-3 rounded-[18px] px-3 py-2.5 text-left transition",c===H?"bg-white/[0.1] text-white":"text-white/70 hover:bg-white/[0.06] hover:text-white"),onMouseEnter:()=>y(c),onMouseDown:k=>k.preventDefault(),onClick:()=>Y(s.value),children:e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-medium",children:s.kind?e.jsx(Fe,{kind:s.kind,label:s.label,compact:!0,gradient:!1}):s.label}),s.description?e.jsx("div",{className:"mt-1 text-xs leading-5 text-white/46",children:s.description}):null]})},s.value)),N?e.jsxs("button",{type:"button",className:"mt-1 flex w-full items-center gap-2 rounded-[18px] px-3 py-2.5 text-left text-sm text-cyan-100 transition hover:bg-white/[0.06]",onMouseDown:s=>s.preventDefault(),onClick:()=>K(),children:[e.jsx(Me,{className:"size-4"}),e.jsxs("span",{className:"truncate",children:['Add free text "',S.trim(),'"']})]}):null,_.length===0&&!N?e.jsx("div",{className:"px-3 py-2.5 text-sm text-white/42",children:"Keep typing to find a linked entity, or press Enter to add a free-text badge."}):null]}):null]})]})]})}const Ft=new Set(["goal","project","task","strategy","habit","tag","psyche_value","behavior_pattern","behavior","belief_entry","mode_profile","flashcard","trigger_report"]);function Be(i){return Ft.has(i)}function m(i,l){return`${i}:${l}`}function X(i){const l=i.indexOf(":");if(l<=0||l>=i.length-1)return null;const d=i.slice(0,l);return Be(d)?{entityType:d,entityId:i.slice(l+1)}:null}function Ee(i){return i!==null}function qe(i){const l=i.getAll("linkedTo"),d=i.get("entityType"),u=i.get("entityId");return d&&u&&Be(d)&&l.unshift(m(d,u)),Array.from(new Set(l.map(L=>L.trim()).filter(Boolean)))}function Dt(i){return Array.from(new Set(i.getAll("textTerms").map(l=>l.trim()).filter(Boolean)))}function It(i){return Z(i.getAll("tags"))}function R(i,l=[]){return{contentMarkdown:(i==null?void 0:i.contentMarkdown)??"",author:(i==null?void 0:i.author)??"",linkedValues:(i==null?void 0:i.links.map(d=>m(d.entityType,d.entityId)))??l,tags:Z((i==null?void 0:i.tags)??[]),destroyAtInput:jt((i==null?void 0:i.destroyAt)??null),destroyDelayValue:"",destroyDelayUnit:"days"}}function Lt(i){return[...i].sort((l,d)=>l.label.localeCompare(d.label))}function $e(i){return Nt(i.destroyAtInput)??kt(i.destroyDelayValue,i.destroyDelayUnit)}function Ht(){var fe,ve,be,we,je,Ne,ke,Te;const i=Re(),l=Xe(),d=et(),[u,L]=ze(),[j,S]=p.useState(()=>qe(u)),[A,ee]=p.useState(()=>It(u)),[g,H]=p.useState(()=>Dt(u)),[y,P]=p.useState(u.get("author")??""),[C,_]=p.useState(u.get("updatedFrom")??""),[N,Y]=p.useState(u.get("updatedTo")??""),[K,q]=p.useState(!1),[h,s]=p.useState(()=>R(null,qe(u))),[c,k]=p.useState(null),[f,T]=p.useState(null),[$,le]=p.useState(null),oe=F({queryKey:["forge-psyche-values"],queryFn:ht}),de=F({queryKey:["forge-psyche-patterns"],queryFn:mt}),ce=F({queryKey:["forge-psyche-behaviors"],queryFn:xt}),ue=F({queryKey:["forge-psyche-beliefs"],queryFn:gt}),pe=F({queryKey:["forge-psyche-modes"],queryFn:yt}),he=F({queryKey:["forge-psyche-flashcards"],queryFn:ft}),me=F({queryKey:["forge-psyche-reports"],queryFn:vt}),xe=Array.isArray(d.selectedUserIds)?d.selectedUserIds:[],U=F({queryKey:["forge-life-force",...xe],queryFn:async()=>(await bt(xe)).lifeForce});p.useEffect(()=>{const a=new URLSearchParams;for(const n of j)a.append("linkedTo",n);for(const n of A)a.append("tags",n);for(const n of g)a.append("textTerms",n);y.trim()&&a.set("author",y.trim()),C&&a.set("updatedFrom",C),N&&a.set("updatedTo",N),L(a,{replace:!0})},[y,j,A,g,L,C,N]);const G=p.useMemo(()=>{var n,x,J,o,r,Se,Ae;const a=[...d.snapshot.goals.map(t=>({value:m("goal",t.id),label:t.title,description:w(t.description,t.user,"Goal"),searchText:b([t.title,t.description],t),kind:v("goal")??void 0})),...d.snapshot.dashboard.projects.map(t=>({value:m("project",t.id),label:t.title,description:w(`${t.description}${t.description?" · ":""}${t.goalTitle}`,t.user,t.goalTitle),searchText:b([t.title,t.description,t.goalTitle],t),kind:v("project")??void 0})),...d.snapshot.tasks.map(t=>({value:m("task",t.id),label:t.title,description:w(`${t.description}${t.description?" · ":""}${t.owner}`,t.user,t.owner),searchText:b([t.title,t.description,t.owner],t),kind:v("task")??void 0})),...d.snapshot.strategies.map(t=>({value:m("strategy",t.id),label:t.title,description:w(t.overview,t.user,"Strategy"),searchText:b([t.title,t.overview,t.endStateDescription],t),kind:v("strategy")??void 0})),...d.snapshot.habits.map(t=>({value:m("habit",t.id),label:t.title,description:w(t.description,t.user,"Habit"),searchText:b([t.title,t.description],t),kind:v("habit")??void 0})),...d.snapshot.tags.map(t=>({value:m("tag",t.id),label:t.name,description:w(t.description,t.user,t.kind),searchText:b([t.name,t.kind,t.description],t),kind:v("tag")??void 0})),...(((n=oe.data)==null?void 0:n.values)??[]).map(t=>({value:m("psyche_value",t.id),label:t.title,description:w(t.description,t.user,"Psyche value"),searchText:b([t.title,t.description,t.valuedDirection],t),kind:v("psyche_value")??void 0})),...(((x=de.data)==null?void 0:x.patterns)??[]).map(t=>({value:m("behavior_pattern",t.id),label:t.title,description:w(t.description,t.user,"Behavior pattern"),searchText:b([t.title,t.description,t.targetBehavior],t),kind:v("behavior_pattern")??void 0})),...(((J=ce.data)==null?void 0:J.behaviors)??[]).map(t=>({value:m("behavior",t.id),label:t.title,description:w(t.description,t.user,"Behavior"),searchText:b([t.title,t.description,t.kind],t),kind:v("behavior")??void 0})),...(((o=ue.data)==null?void 0:o.beliefs)??[]).map(t=>({value:m("belief_entry",t.id),label:t.statement,description:w(t.flexibleAlternative||t.originNote,t.user,"Belief"),searchText:b([t.statement,t.flexibleAlternative,t.originNote],t),kind:v("belief_entry")??void 0})),...(((r=pe.data)==null?void 0:r.modes)??[]).map(t=>({value:m("mode_profile",t.id),label:t.title,description:w(t.archetype||t.family,t.user,"Mode"),searchText:b([t.title,t.archetype,t.family,t.persona],t),kind:v("mode_profile")??void 0})),...(((Se=he.data)==null?void 0:Se.flashcards)??[]).map(t=>({value:m("flashcard",t.id),label:t.title||t.message,description:w(t.triggerSentence||t.triggerSituation,t.user,"Flashcard"),searchText:b([t.title,t.message,t.triggerSentence,t.triggerSituation,...t.tags],t),kind:v("flashcard")??void 0})),...(((Ae=me.data)==null?void 0:Ae.reports)??[]).map(t=>({value:m("trigger_report",t.id),label:t.title,description:w(t.eventSituation,t.user,"Trigger report"),searchText:b([t.title,t.eventSituation,t.customEventType??""],t),kind:v("trigger_report")??void 0}))];return Lt(a)},[(fe=ce.data)==null?void 0:fe.behaviors,(ve=ue.data)==null?void 0:ve.beliefs,(be=he.data)==null?void 0:be.flashcards,(we=pe.data)==null?void 0:we.modes,(je=de.data)==null?void 0:je.patterns,(Ne=me.data)==null?void 0:Ne.reports,d.snapshot.dashboard.projects,d.snapshot.goals,d.snapshot.habits,d.snapshot.strategies,d.snapshot.tags,d.snapshot.tasks,(ke=oe.data)==null?void 0:ke.values]),Pe=p.useMemo(()=>G.map(a=>{const n=X(a.value);return{value:a.value,label:a.label,description:a.description,searchText:a.searchText,kind:a.kind,entityType:(n==null?void 0:n.entityType)??"goal",entityId:(n==null?void 0:n.entityId)??""}}),[G]),Ke=p.useMemo(()=>j.map(a=>X(a)).filter(Boolean),[j]),O=F({queryKey:["notes-index",j.join("|"),A.join("|"),g.join("|"),y.trim(),C,N],queryFn:()=>wt({linkedTo:Ke,tags:A,textTerms:g,author:y.trim()||void 0,updatedFrom:C||void 0,updatedTo:N||void 0,limit:200})}),te=async()=>{await Promise.all([l.invalidateQueries({queryKey:["notes-index"]}),pt(l)])},ge=ie({mutationFn:async a=>tt({contentMarkdown:a.contentMarkdown.trim(),author:a.author.trim()||null,tags:Z(a.tags),destroyAt:$e(a),links:a.linkedValues.map(n=>X(n)).filter(Ee).map(n=>({entityType:n.entityType,entityId:n.entityId}))}),onSuccess:async()=>{s(R(null,j)),q(!1),await te()}}),ye=ie({mutationFn:async({noteId:a,draft:n})=>at(a,{contentMarkdown:n.contentMarkdown.trim(),author:n.author.trim()||null,tags:Z(n.tags),destroyAt:$e(n),links:n.linkedValues.map(x=>X(x)).filter(Ee).map(x=>({entityType:x.entityType,entityId:x.entityId}))}),onSuccess:async()=>{k(null),T(null),await te()}}),ae=ie({mutationFn:a=>st(a),onSuccess:te}),V=((Te=O.data)==null?void 0:Te.notes)??[],Ue=new Date().toISOString().slice(0,10),Oe=V.filter(a=>a.createdAt.slice(0,10)===Ue).length*W().totalAp,M=$?V.find(a=>a.id===$.noteId)??null:null,se=M?De(M):null,E=se?Ie(se.entityType,se.entityId):null,Ve=p.useMemo(()=>M?[{id:"open-linked",label:"Open linked record",description:E?"Jump back into the main entity this note is attached to.":"This note has no navigable linked record yet.",icon:He,disabled:!E,onSelect:()=>{E&&i(E.includes("#")?E:`${E}#notes`)}},{id:"edit-note",label:"Edit note",description:"Update the Markdown body, note tags, expiry, or connected entity links.",icon:Ye,onSelect:()=>{k(M.id),T(R(M))}},{id:"delete-note",label:"Delete note",description:"Soft-delete this note from the main workspace.",icon:Ge,tone:"danger",disabled:ae.isPending,onSelect:()=>{ae.mutateAsync(M.id)}}]:[],[E,M,ae,i]);return O.isError?e.jsx(it,{eyebrow:"Notes",error:O.error,onRetry:()=>void O.refetch()}):e.jsxs("div",{className:"grid gap-5",children:[e.jsx(Tt,{title:"Notes",titleText:"Notes",description:"Notes are first-class Markdown entities in Forge. Search them by linked records, note tags, date, or free text, then create durable or ephemeral notes that stay connected to the rest of the graph.",badge:`${V.length} visible`,actions:e.jsxs(Q,{onClick:()=>{s(R(null,j)),q(!0)},children:[e.jsx(Je,{className:"size-4"}),"New note"]})}),e.jsxs("section",{className:"grid gap-4 lg:grid-cols-4",children:[e.jsxs(I,{className:"border-[var(--primary)]/16 shadow-[0_0_0_1px_rgba(245,158,11,0.08)]",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Quick note default"}),e.jsx("div",{className:"mt-3 font-display text-4xl text-[var(--primary)]",children:B(W().totalAp)}),e.jsx("div",{className:"mt-2 text-sm text-white/58",children:"Standalone notes count as a tiny Action Point impulse unless a richer active work context already covers them."})]}),e.jsxs(I,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Notes created today"}),e.jsx("div",{className:"mt-3 font-display text-4xl text-white",children:B(Oe)}),e.jsx("div",{className:"mt-2 text-sm text-white/58",children:"Visible notes created today in this workspace at the default quick note cost."})]}),e.jsxs(I,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Life Force sync"}),e.jsx("div",{className:"mt-3 text-2xl font-display text-white",children:U.data?`${B(U.data.spentTodayAp)} / ${B(U.data.dailyBudgetAp)}`:"Loading..."}),e.jsx("div",{className:"mt-2 text-sm text-white/58",children:"Notes participate in the same Action Point ledger as tasks, habits, movement, and calendar work."})]}),e.jsxs(I,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Instant headroom"}),e.jsx("div",{className:"mt-3 text-2xl font-display text-white",children:U.data?nt(U.data.instantFreeApPerHour):"Loading..."}),e.jsx("div",{className:"mt-2 text-sm text-white/58",children:"Useful when deciding whether to just capture a quick note or stay inside a heavier work stream."})]})]}),e.jsx(rt,{children:e.jsxs(I,{className:"grid gap-4",children:[e.jsx(Mt,{entityOptions:Pe,selectedEntityValues:j,onSelectedEntityValuesChange:S,selectedTextTerms:g,onSelectedTextTermsChange:H}),e.jsx(re,{value:A,onChange:ee,placeholder:"Filter by memory tag or custom note tag"}),e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1fr)_minmax(12rem,0.38fr)_minmax(12rem,0.38fr)]",children:[e.jsx(D,{value:y,onChange:a=>P(a.target.value),placeholder:"Filter by author"}),e.jsx(D,{type:"date",value:C,onChange:a=>_(a.target.value)}),e.jsx(D,{type:"date",value:N,onChange:a=>Y(a.target.value)})]})]})}),K?e.jsx(lt,{children:e.jsxs(I,{className:"grid gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-white/42",children:"New note"}),e.jsxs("div",{className:"mt-2 text-sm leading-6 text-white/58",children:["Notes are independent Markdown entities. Link them to one or more real records, add memory-system or custom tags, and optionally make them ephemeral with an automatic destroy time. Standalone notes default to"," ",B(W().totalAp),"."]})]}),e.jsx(Q,{variant:"ghost",onClick:()=>{q(!1),s(R(null,j))},children:"Cancel"})]}),e.jsx(Le,{value:h.contentMarkdown,onChange:a=>s(n=>({...n,contentMarkdown:a.target.value})),className:"min-h-[16rem]",placeholder:"Write the note in Markdown. This can be as short as a handoff line or as long as a wiki page."}),e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)]",children:[e.jsx(D,{value:h.author,onChange:a=>s(n=>({...n,author:a.target.value})),placeholder:"Optional author"}),e.jsx(_e,{options:G,selectedValues:h.linkedValues,onChange:a=>s(n=>({...n,linkedValues:a})),placeholder:"Link this note to strategies, goals, projects, tasks, habits, or human/bot-owned records",emptyMessage:"No matching entities found yet."})]}),e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1.15fr)_minmax(0,0.85fr)]",children:[e.jsx(re,{value:h.tags,onChange:a=>s(n=>({...n,tags:a}))}),e.jsxs("div",{className:"grid gap-3 rounded-[22px] bg-white/[0.03] p-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Ephemeral auto-destroy"}),e.jsx("div",{className:"mt-2 text-xs leading-5 text-white/48",children:"Set an exact destroy time or a relative delay. Leaving both blank keeps the note durable."})]}),e.jsx(D,{type:"datetime-local",value:h.destroyAtInput,onChange:a=>s(n=>({...n,destroyAtInput:a.target.value}))}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr)_10rem]",children:[e.jsx(D,{type:"number",min:"1",value:h.destroyDelayValue,onChange:a=>s(n=>({...n,destroyDelayValue:a.target.value})),placeholder:"Destroy after"}),e.jsxs("select",{className:"rounded-[14px] border border-white/10 bg-white/[0.04] px-3 py-3 text-sm text-white",value:h.destroyDelayUnit,onChange:a=>s(n=>({...n,destroyDelayUnit:a.target.value})),children:[e.jsx("option",{value:"hours",children:"Hours"}),e.jsx("option",{value:"days",children:"Days"})]})]})]})]}),e.jsxs("div",{className:"rounded-[22px] bg-white/[0.03] p-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Preview"}),e.jsx("div",{className:"mt-3",children:h.contentMarkdown.trim()?e.jsx(ne,{markdown:h.contentMarkdown}):e.jsx("div",{className:"text-sm text-white/42",children:"Markdown preview appears here."})})]}),e.jsx("div",{className:"flex flex-wrap justify-end gap-2",children:e.jsx(Q,{pending:ge.isPending,pendingLabel:"Saving",disabled:h.contentMarkdown.trim().length===0||h.linkedValues.length===0,onClick:()=>void ge.mutateAsync(h),children:"Save note"})})]})}):null,O.isLoading?e.jsx(I,{className:"text-sm text-white/58",children:"Loading notes…"}):V.length===0?e.jsx(ot,{eyebrow:"Notes",title:"No matching notes yet",description:"Try broader linked-entity filters, remove a date bound, or add the first durable note from the button above."}):e.jsx(dt,{children:e.jsx("div",{className:"grid gap-3",children:V.map(a=>{const n=De(a),x=n?Ie(n.entityType,n.entityId):null,J=c===a.id&&f!==null;return e.jsxs(I,{className:"min-w-0 overflow-hidden p-5",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"text-xs uppercase tracking-[0.16em] text-white/38",children:[(a.author??"Unknown author").toString()," •"," ",new Date(a.updatedAt).toLocaleString()]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(z,{className:"bg-[var(--primary)]/12 text-[var(--primary)]",wrap:!0,children:[B(W().totalAp)," ","quick note"]}),a.links.map(o=>e.jsxs(z,{className:"bg-white/[0.08] text-white/68",wrap:!0,children:[ct(o.entityType),o.anchorKey?` · ${ut(o.anchorKey)}`:""]},`${a.id}-${o.entityType}-${o.entityId}-${o.anchorKey??""}`)),(a.tags??[]).map(o=>e.jsx(z,{className:"bg-cyan-400/10 text-cyan-50",wrap:!0,children:o},`${a.id}-tag-${o}`)),a.destroyAt?e.jsxs(z,{className:"bg-amber-400/10 text-amber-100",wrap:!0,children:["Ephemeral · deletes"," ",new Date(a.destroyAt).toLocaleString()]}):null]})]}),e.jsx("button",{type:"button",className:"rounded-full border border-white/8 bg-white/[0.04] p-2 text-white/58 transition hover:bg-white/[0.08] hover:text-white",onClick:o=>{o.preventDefault(),o.stopPropagation();const r=o.currentTarget.getBoundingClientRect();le({noteId:a.id,position:{x:r.right-8,y:r.bottom+8}})},"aria-label":`Open actions for note ${a.id}`,children:e.jsx(We,{className:"size-4"})})]}),J?e.jsxs("div",{className:"mt-4 grid gap-4",children:[e.jsx(Le,{value:f.contentMarkdown,onChange:o=>T(r=>r&&{...r,contentMarkdown:o.target.value}),className:"min-h-[14rem]"}),e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)]",children:[e.jsx(D,{value:f.author,onChange:o=>T(r=>r&&{...r,author:o.target.value}),placeholder:"Optional author"}),e.jsx(_e,{options:G,selectedValues:f.linkedValues,onChange:o=>T(r=>r&&{...r,linkedValues:o}),placeholder:"Update the linked entities",emptyMessage:"No matching entities found yet."})]}),e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1.15fr)_minmax(0,0.85fr)]",children:[e.jsx(re,{value:f.tags,onChange:o=>T(r=>r&&{...r,tags:o})}),e.jsxs("div",{className:"grid gap-3 rounded-[22px] bg-white/[0.03] p-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Ephemeral auto-destroy"}),e.jsx("div",{className:"mt-2 text-xs leading-5 text-white/48",children:"Set an exact destroy time or a relative delay. Leaving both blank keeps the note durable."})]}),e.jsx(D,{type:"datetime-local",value:f.destroyAtInput,onChange:o=>T(r=>r&&{...r,destroyAtInput:o.target.value})}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr)_10rem]",children:[e.jsx(D,{type:"number",min:"1",value:f.destroyDelayValue,onChange:o=>T(r=>r&&{...r,destroyDelayValue:o.target.value}),placeholder:"Destroy after"}),e.jsxs("select",{className:"rounded-[14px] border border-white/10 bg-white/[0.04] px-3 py-3 text-sm text-white",value:f.destroyDelayUnit,onChange:o=>T(r=>r&&{...r,destroyDelayUnit:o.target.value}),children:[e.jsx("option",{value:"hours",children:"Hours"}),e.jsx("option",{value:"days",children:"Days"})]})]})]})]}),e.jsxs("div",{className:"rounded-[22px] bg-white/[0.03] p-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Preview"}),e.jsx("div",{className:"mt-3",children:f.contentMarkdown.trim()?e.jsx(ne,{markdown:f.contentMarkdown}):e.jsx("div",{className:"text-sm text-white/42",children:"No content yet."})})]}),e.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[e.jsx(Q,{variant:"ghost",onClick:()=>{k(null),T(null)},children:"Cancel"}),e.jsx(Q,{pending:ye.isPending,pendingLabel:"Saving",disabled:f.contentMarkdown.trim().length===0||f.linkedValues.length===0,onClick:()=>void ye.mutateAsync({noteId:a.id,draft:f}),children:"Save changes"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"mt-4 w-full text-left",onClick:()=>{x&&i(x.includes("#")?x:`${x}#notes`)},disabled:!x,children:e.jsx(ne,{markdown:a.contentMarkdown,className:"line-clamp-none"})}),x?e.jsx("div",{className:"mt-4 inline-flex text-xs uppercase tracking-[0.16em] text-[var(--secondary)]",children:"Open linked record"}):null]})]},a.id)})})}),e.jsx(St,{open:!!$,title:"Note actions",subtitle:M?M.contentPlain.slice(0,80)||"Markdown note":void 0,items:Ve,position:($==null?void 0:$.position)??null,onClose:()=>le(null)})]})}export{Ht as NotesPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as y,j as t,aC as R}from"./vendor-DHkYh85p.js";import{Z as O}from"./index-CF4J4R9L.js";import{m as z}from"./motion-BeD44FeG.js";const B={mint:"border-emerald-300/24 bg-[rgba(16,185,129,0.12)] text-emerald-100",sky:"border-sky-300/24 bg-[rgba(56,189,248,0.12)] text-sky-100",violet:"border-violet-300/24 bg-[rgba(167,139,250,0.12)] text-violet-100",rose:"border-rose-300/24 bg-[rgba(251,113,133,0.12)] text-rose-100"};function k(d,r,n){return Math.min(Math.max(d,r),n)}function X(d){const r=d.detail.trim().length;return r>84?130:r>44?118:106}function Y(d,r,n){const p=r/2,g=n/2,b=k(Math.min(r/620,n/430),.64,1.06),s=d.map(i=>{const e=i.angle*Math.PI/180,l=i.radius*b,o=Math.min(184,Math.max(154,r-48)),c=X(i),x=p+Math.cos(e)*l,m=g+Math.sin(e)*l;return{...i,x,y:m,width:o,height:c,homeX:x,homeY:m}}),h=r<720?16:22,v=20,u=r-20,N=18,a=n-18;for(let i=0;i<220;i+=1){for(const e of s)e.x+=(e.homeX-e.x)*.065,e.y+=(e.homeY-e.y)*.065;for(let e=0;e<s.length;e+=1)for(let l=e+1;l<s.length;l+=1){const o=s[e],c=s[l],x=c.x-o.x,m=c.y-o.y,j=o.width/2+c.width/2+h-Math.abs(x),_=o.height/2+c.height/2+h-Math.abs(m);if(j<=0||_<=0)continue;const M=j<_?"x":"y",f=Math.sign(M==="x"?x||l-e||1:m||l-e||1),w=(M==="x"?j:_)/2;M==="x"?(o.x-=f*w,c.x+=f*w):(o.y-=f*w,c.y+=f*w)}for(const e of s)e.x=k(e.x,v+e.width/2,u-e.width/2),e.y=k(e.y,N+e.height/2,a-e.height/2)}return s}function A({title:d,description:r,centerLabel:n,centerValue:p,nodes:g,action:b}){const s=y.useRef(null),[h,v]=y.useState({width:0,height:0});y.useEffect(()=>{if(!s.current||typeof ResizeObserver>"u")return;const a=new ResizeObserver(i=>{const e=i[0];v({width:e.contentRect.width,height:e.contentRect.height})});return a.observe(s.current),()=>a.disconnect()},[]);const u=g.length>0?g:[{id:"values",label:"Values",title:"Add value",detail:"Name what matters",href:"/psyche/values?create=1",angle:-86,radius:112,tone:"mint"},{id:"patterns",label:"Patterns",title:"Add pattern",detail:"Map a loop",href:"/psyche/patterns?create=1",angle:-14,radius:122,tone:"rose"},{id:"beliefs",label:"Beliefs",title:"Add belief",detail:"Capture a script",href:"/psyche/schemas-beliefs?create=1",angle:72,radius:118,tone:"violet"},{id:"reports",label:"Reports",title:"Reflect",detail:"Open the chain",href:"/psyche/reports?create=1",angle:160,radius:124,tone:"sky"}],N=y.useMemo(()=>Y(u,Math.max(h.width,320),Math.max(h.height,320)),[u,h.height,h.width]);return t.jsxs("section",{className:"overflow-hidden rounded-[32px] border border-white/8 bg-[radial-gradient(circle_at_top,rgba(110,231,183,0.14),transparent_42%),linear-gradient(180deg,rgba(15,30,34,0.98),rgba(10,21,25,0.98))] px-4 py-4 shadow-[0_24px_70px_rgba(4,8,18,0.28)] lg:px-5",children:[t.jsxs("div",{className:"mb-4 flex flex-wrap items-end justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[rgba(110,231,183,0.8)]",children:"Reflective map"}),t.jsx("h2",{className:"mt-2 font-display text-[clamp(1.35rem,2.3vw,2rem)] leading-none text-white",children:d}),t.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-6 text-white/60",children:r})]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsxs("div",{className:"inline-flex items-center gap-3 rounded-full border border-white/10 bg-white/[0.04] px-4 py-2",children:[t.jsx("span",{className:"text-xs uppercase tracking-[0.18em] text-white/38",children:n}),t.jsx("span",{className:"text-sm font-medium text-white",children:p})]}),b?t.jsx("div",{className:"shrink-0",children:b}):null]})]}),t.jsxs("div",{ref:s,className:"relative min-h-[20rem] overflow-hidden rounded-[30px] border border-white/6 bg-[radial-gradient(circle_at_center,rgba(255,255,255,0.05),transparent_42%)] lg:min-h-[22rem]",children:[t.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_center,rgba(110,231,183,0.08),transparent_32%),linear-gradient(180deg,transparent,rgba(8,13,24,0.24))]"}),[112,168,224].map(a=>t.jsx("div",{className:"absolute left-1/2 top-1/2 rounded-full border border-white/[0.05]",style:{width:`${a*2}px`,height:`${a*2}px`,transform:"translate(-50%, -50%)"}},a)),t.jsx("div",{className:"absolute inset-1/2 size-32 -translate-x-1/2 -translate-y-1/2 rounded-full border border-white/10 bg-[radial-gradient(circle,rgba(255,255,255,0.08),rgba(255,255,255,0.02))] shadow-[0_0_0_18px_rgba(255,255,255,0.02),0_0_0_56px_rgba(255,255,255,0.015)]",children:t.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[t.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:n}),t.jsx("div",{className:"mt-2 font-display text-2xl text-white",children:p})]})}),N.map((a,i)=>t.jsx(z.div,{initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},transition:{duration:.35,delay:i*.05,ease:"easeOut"},className:"absolute w-[min(11.5rem,calc(100vw-4rem))] max-w-[11.5rem] -translate-x-1/2 -translate-y-1/2",style:{left:`${a.x}px`,top:`${a.y}px`},whileHover:{y:-6,scale:1.03},children:t.jsxs(R,{to:a.href,className:O("block rounded-[22px] border px-3.5 py-3 shadow-[0_18px_38px_rgba(4,8,18,0.28)] backdrop-blur-sm transition hover:-translate-y-0.5 hover:bg-white/[0.1] hover:shadow-[0_24px_44px_rgba(4,8,18,0.34)]",B[a.tone??"mint"]),children:[t.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/45",children:a.label}),t.jsx("div",{className:"mt-1.5 font-medium text-white",children:a.title}),t.jsx("div",{className:"mt-1.5 text-sm leading-5 text-white/62",children:a.detail})]})},a.id))]})]})}export{A as O};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as E,j as e,aC as S}from"./vendor-DHkYh85p.js";import{A as B}from"./ai-surface-workspace-DEAFZruS.js";import{i as $}from"./state-B-4sS1xO.js";import{P as Q,u as z,bE as G,h as R,d as L,bF as D,c as h,aq as _,Z as J,C as M,b as Y,V as Z,W as ee,_ as te,bG as ie,bH as se,bI as ae,bJ as re,bK as le,bL as ne,bM as de,be as oe,bN as ce}from"./index-CF4J4R9L.js";import{F as me}from"./flagship-signal-deck-cmy82b8_.js";import{L as ue}from"./life-force-workspace-OfyB9HJM.js";import{E as he}from"./entity-note-count-link-DrhjJZ4i.js";import{P as pe}from"./page-hero-DRy5b2MU.js";import{a as xe,g as ge}from"./activity-copy-Bj4h9OcF.js";import"./board-BkDRaMp6.js";import"./ui-C13Nbgas.js";import"./motion-BeD44FeG.js";import"./forms-BFlTgZ3W.js";import"./graph-D6JLqDbD.js";import"./floating-action-menu-Fs_ZiUMo.js";import"./charts-P7EVhIog.js";const p={"Life Force":"Life Force compares today's spent Action Points with the modeled daily budget. It is Forge's local capacity planning layer, not a medical score.",Momentum:"Momentum summarizes recent execution, XP, streak context, and movement across Forge records. Use it as an attention signal.",Instant:"Instant AP/hour estimates current headroom from the Life Force drain model. Higher values mean Forge thinks the next block can absorb more effort.",Level:"Level comes from the XP ledger. It represents accumulated meaningful Forge activity for the selected user scope.","Weekly XP":"Weekly XP is recent reward-ledger movement. It helps separate a genuinely active week from old accumulated progress."};function fe(a){const l=["gamification","summary","pipeline","body-signals","signals"],t=[...a.order];let r=!1;for(const x of l)t.includes(x)||(t.push(x),r=!0);const N=t.indexOf("summary"),c=t.indexOf("pipeline"),g=t.indexOf("body-signals"),v=t.indexOf("signals");if(N===-1||c===-1||g===-1||v===-1)return r?{...a,order:t}:a;if(N<c&&c<g&&g<v&&!r)return a;for(const x of l){const y=t.indexOf(x);y!==-1&&t.splice(y,1)}const w=t.indexOf("goals");return t.splice(w===-1?0:w,0,...l),{...a,order:t}}function ve(a=new Date){const l=a.getFullYear(),t=String(a.getMonth()+1).padStart(2,"0"),r=String(a.getDate()).padStart(2,"0");return`${l}-${t}-${r}`}function P(a){if(a>=3600){const l=a/3600;return l>=10||Number.isInteger(l)?`${Math.round(l)}h`:`${l.toFixed(1)}h`}return`${Math.max(1,Math.round(a/60))}m`}function we(a){return a>=1e3?`${(a/1e3).toFixed(1)} km`:`${Math.round(a)} m`}function ye(a){if(!a)return[];const l=new Map;for(const t of a.segments){if(t.kind!=="stay"||t.durationSeconds<=0)continue;const r=t.label.trim()||"Unlabeled stay";l.set(r,(l.get(r)??0)+t.durationSeconds)}return[...l.entries()].map(([t,r])=>({label:t,seconds:r})).sort((t,r)=>r.seconds-t.seconds).slice(0,3)}function be(a){return a?["restingHeartRate","heartRateVariabilitySDNN","vo2Max","oxygenSaturation"].map(t=>a.metrics.find(r=>r.metric===t)).filter(t=>!!t).slice(0,3):[]}function je(a){if(a.latestValue==null)return"No reading";const l=a.unit==="steps"||a.unit==="flights"||a.unit==="kcal"||a.unit==="min"?0:1;return`${a.latestValue.toLocaleString(void 0,{maximumFractionDigits:l,minimumFractionDigits:l===0||a.latestValue>=100?0:1})} ${a.unit}`}function Ee(){var X,C;const{t:a}=Q(),l=z(),t=l.snapshot,r=Array.isArray(l.selectedUserIds)?l.selectedUserIds:[],N=r.join("|"),[c,g]=E.useState(!1);E.useEffect(()=>{g(!1);const i=window.setTimeout(()=>{g(!0)},650);return()=>window.clearTimeout(i)},[N]);const v=ve(),w=$({queryKey:["forge-overview-sleep",...r],queryFn:async()=>(await ne(r)).sleep,enabled:c,staleTime:6e4})??{},x=$({queryKey:["forge-overview-fitness",...r],queryFn:async()=>(await de(r)).fitness,enabled:c,staleTime:6e4})??{},y=$({queryKey:["forge-overview-movement-day",v,...r],queryFn:async()=>(await oe({date:v,userIds:r})).movement,enabled:c,staleTime:6e4})??{},H=$({queryKey:["forge-overview-vitals",...r],queryFn:async()=>(await ce(r)).vitals,enabled:c,staleTime:6e4})??{},I=G(r,{skip:!c}),m=t.dashboard.milestoneRewards.find(i=>!i.completed)??t.dashboard.milestoneRewards[0]??null,d=t.overview.topTasks[0]??null,o=t.overview.dueHabits[0]??null,u=t.overview.recentEvidence[0]??null,V=new Map(t.projects.map(i=>[i.id,i])),k=t.metrics.momentumScore>=80?"Strong":t.metrics.momentumScore>=60?"Steady":"Needs attention",b=((X=w.data)==null?void 0:X.summary)??null,f=((C=x.data)==null?void 0:C.summary)??null,n=y.data,F=H.data??null,A=be(F??void 0),O=ye(n),T=b!==null||f!==null||F!==null,W=n!==void 0&&(n.summary.tripCount>0||n.summary.stayCount>0||n.summary.totalMovingSeconds>0||O.length>0),K=t.lifeForce?[{label:"Life Force",value:`${Math.round(t.lifeForce.spentTodayAp)} / ${Math.round(t.lifeForce.dailyBudgetAp)} AP`,detail:`Remaining ${R(t.lifeForce.remainingAp)}`,help:p["Life Force"]},{label:"Momentum",value:`${t.metrics.momentumScore}`,detail:`${k} · ${t.metrics.streakDays} day streak`,help:p.Momentum},{label:"Instant",value:L(t.lifeForce.instantFreeApPerHour),detail:t.lifeForce.overloadApPerHour>0?`${L(t.lifeForce.overloadApPerHour)} overload`:"Headroom right now",help:p.Instant},{label:"Level",value:`L${t.metrics.level}`,detail:`${t.metrics.currentLevelXp} XP in level`,help:p.Level},{label:"Weekly XP",value:`${t.metrics.weeklyXp}`,detail:`${t.metrics.totalXp} total XP`,help:p["Weekly XP"]}]:[{label:"Level",value:`L${t.metrics.level}`,detail:`${t.metrics.currentLevelXp} XP in level`,help:p.Level},{label:"Weekly XP",value:`${t.metrics.weeklyXp}`,detail:`${t.metrics.totalXp} total XP`,help:p["Weekly XP"]},{label:"Momentum",value:`${t.metrics.momentumScore}`,detail:`${k} · ${t.metrics.streakDays} day streak`,help:p.Momentum}];function q(i){return i.entityType==="goal"?`/goals/${i.entityId}`:i.entityType==="project"?`/projects/${i.entityId}`:i.entityType==="task"?`/tasks/${i.entityId}`:i.entityType==="habit"?"/habits":i.entityType==="task_run"&&typeof i.metadata.taskId=="string"?`/tasks/${i.metadata.taskId}`:`/activity?eventId=${i.id}`}const U=[{id:"hero",title:"Overview",description:"The route header stays movable like any other surface block.",defaultWidth:12,defaultHeight:2,removable:!1,minHeight:2,maxHeight:3,surfaceChrome:"none",defaultTitleVisible:!1,defaultDescriptionVisible:!1,render:()=>e.jsx(pe,{title:"Overview",titleText:"Overview",description:`${k}. Life Force, momentum, XP, goals, active projects, and top tasks all start here.`,badge:`Momentum ${t.metrics.momentumScore}`})},{id:"gamification",title:"Forge Smith",description:"Selected-user level, XP, streak, trophy, and unlock state.",defaultWidth:12,defaultHeight:4,removable:!1,minHeight:3,surfaceChrome:"none",defaultTitleVisible:!1,defaultDescriptionVisible:!1,render:({compact:i})=>{var s;return I.data?e.jsx(D,{metrics:I.data.metrics,compact:i}):e.jsx(D,{metrics:{scope:{mode:"operator_fallback",userIds:t.userScope.selectedUserIds,users:t.userScope.selectedUsers,label:((s=t.userScope.selectedUsers[0])==null?void 0:s.displayName)??"Forge"},profile:t.metrics,achievements:[],milestoneRewards:[],momentumPulse:{status:t.metrics.momentumScore>=80?"surging":t.metrics.momentumScore>=60?"steady":"recovering",headline:`${t.metrics.streakDays}-day streak`,detail:`${t.metrics.currentLevelXp}/${t.metrics.nextLevelXp} XP in level ${t.metrics.level}.`,celebrationLabel:"Forge Smith",nextMilestoneId:null,nextMilestoneLabel:"Next unlock"},catalogPreview:[],unlockedItemCount:0,totalItemCount:144,nextUnlock:null,newestUnlock:null,nextTargets:[],equipment:{selectedMascotSkin:null,selectedHudTreatment:null,selectedStreakEffect:null,selectedTrophyShelf:null,selectedCelebrationVariant:null,updatedAt:null},mascot:{mood:"wise",spriteKey:"mascot-state-014",streakSpriteKey:"mascot-state-017",headline:"Small heat still counts.",line:"Return to the anvil today.",pressureLevel:0,missedDays:0,lastActiveDateKey:null},celebrations:[],recentLedger:[],rules:[],dailyAmbientXp:0,dailyAmbientCap:12},compact:i})}},{id:"summary",title:"Momentum summary",description:"Smaller titles and denser metrics free space for the widgets themselves.",defaultWidth:12,defaultHeight:3,minWidth:6,render:({compact:i})=>e.jsxs("div",{className:"rounded-[24px] bg-white/[0.04] 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.16em] text-white/38",children:"Momentum summary"}),e.jsx("div",{className:"mt-2 text-lg font-semibold text-white",children:"Core live metrics"}),e.jsx("div",{className:"mt-1 text-sm leading-6 text-white/56",children:"Life Force, momentum, XP, and instant headroom stay grouped here."})]}),e.jsx(h,{className:"bg-white/[0.08] text-white/70",children:k})]}),e.jsx("div",{className:J("mt-4 grid gap-3",i?"grid-cols-2":"sm:grid-cols-2 xl:grid-cols-5"),children:K.map(s=>e.jsxs("div",{className:"rounded-[20px] border border-white/8 bg-white/[0.04] px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] uppercase tracking-[0.16em] text-white/40",children:[e.jsx("span",{children:s.label}),e.jsx(_,{label:`Explain ${s.label}`,title:s.label,content:s.help,panelClassName:"normal-case tracking-normal"})]}),e.jsx("div",{className:"mt-1 text-lg font-semibold text-white",children:s.value}),e.jsx("div",{className:"mt-1 text-xs leading-5 text-white/54",children:s.detail})]},s.label))})]})},{id:"life-force",title:"Life Force",description:"Dynamic Action Points, the editable capacity curve, current drains, and stat growth all live here.",defaultWidth:12,defaultHeight:7,minWidth:6,render:()=>t.lifeForce?e.jsx(ue,{selectedUserIds:r,fallbackLifeForce:t.lifeForce,onRefresh:l.refresh,showEditor:!1}):e.jsx(M,{className:"rounded-[24px] border-white/8 bg-white/[0.04] p-5 text-sm leading-6 text-white/60",children:"Life Force is not configured for this user yet. Once a profile exists, the full capacity curve, drains, and recommendations will appear here."})},{id:"body-signals",title:"Life, health, movement",description:"Health imports and movement context make the overview feel like a real daily operating page.",defaultWidth:12,defaultHeight:4,minWidth:6,render:()=>e.jsxs("div",{className:"grid min-w-0 gap-4 xl:grid-cols-3",children:[e.jsxs(M,{className:"rounded-[24px] border-white/8 bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/38",children:"Life Force"}),e.jsx("div",{className:"mt-2 text-lg font-semibold text-white",children:t.lifeForce?`${Math.round(t.lifeForce.remainingAp)} AP remaining`:"No Life Force profile yet"})]}),t.lifeForce?e.jsx(h,{className:"bg-white/[0.08] text-white/72",children:L(t.lifeForce.instantFreeApPerHour)}):null]}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/58",children:t.lifeForce?`${Math.round(t.lifeForce.spentTodayAp)} / ${Math.round(t.lifeForce.dailyBudgetAp)} AP spent today. Remaining ${R(t.lifeForce.remainingAp)} with ${L(t.lifeForce.currentDrainApPerHour)} current drain.`:"Once Life Force is configured, this block will show today's budget, remaining headroom, and live drain."})]}),e.jsxs(M,{className:"rounded-[24px] border-white/8 bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/38",children:"Body signals"}),e.jsx("div",{className:"mt-2 text-lg font-semibold text-white",children:T?"Recovery, training, and vitals":"No health data yet"})]}),F?e.jsxs(h,{className:"bg-white/[0.08] text-white/72",children:[F.summary.metricCount," metrics"]}):null]}),w.isLoading||x.isLoading||H.isLoading?e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/58",children:"Loading recent sleep, workout, and body-signal metrics…"}):T?e.jsxs("div",{className:"mt-3 grid gap-2 text-sm text-white/72",children:[b?e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("span",{children:"Average sleep"}),e.jsx("span",{className:"font-medium text-white",children:P(b.averageSleepSeconds)})]}):null,b?e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("span",{children:"Sleep score"}),e.jsx("span",{className:"font-medium text-white",children:Math.round(b.averageSleepScore)})]}):null,f?e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("span",{children:"Exercise"}),e.jsxs("span",{className:"font-medium text-white",children:[Math.round(f.exerciseMinutes)," min"]})]}):null,f?e.jsx("div",{className:"text-xs leading-5 text-white/54",children:f.topWorkoutType?`${f.topWorkoutType} is the top workout type right now.`:"Workout imports are available when Apple Health or habit-generated sessions exist."}):null,A.length>0?e.jsx("div",{className:"mt-1 grid gap-2",children:A.map(i=>e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded-[14px] border border-white/8 bg-white/[0.03] px-3 py-2",children:[e.jsx("span",{children:i.label}),e.jsx("span",{className:"font-medium text-white",children:je(i)})]},i.metric))}):null]}):e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/58",children:"Sleep, workout, and vitals summaries appear here as soon as Forge has recent HealthKit records."})]}),e.jsxs(M,{className:"rounded-[24px] border-white/8 bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/38",children:"Movement"}),e.jsx("div",{className:"mt-2 text-lg font-semibold text-white",children:W?"Today's place balance":"No movement timeline yet"})]}),W?e.jsxs(h,{className:"bg-white/[0.08] text-white/72",children:[P((n==null?void 0:n.summary.totalMovingSeconds)??0)," ","moving"]}):null]}),y.isLoading?e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/58",children:"Loading today's stays, trips, and place balance…"}):W?e.jsxs("div",{className:"mt-3 grid gap-2",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[O.map(i=>e.jsxs(h,{className:"bg-white/[0.08] text-white/78",children:[P(i.seconds)," at ",i.label]},i.label)),((n==null?void 0:n.summary.totalMovingSeconds)??0)>0?e.jsxs(h,{className:"bg-[rgba(78,222,163,0.14)] text-[var(--secondary)]",children:[P((n==null?void 0:n.summary.totalMovingSeconds)??0)," ","moving"]}):null]}),e.jsxs("div",{className:"text-sm leading-6 text-white/58",children:[(n==null?void 0:n.summary.tripCount)??0," trip",((n==null?void 0:n.summary.tripCount)??0)===1?"":"s"," and"," ",we((n==null?void 0:n.summary.totalDistanceMeters)??0)," ","tracked today."]})]}):e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/58",children:"Movement summaries appear here once the companion has synced stays, trips, or known places."})]})]})},{id:"signals",title:"Action signals",description:"Direct links to the next things worth opening.",defaultWidth:7,defaultHeight:4,minWidth:4,render:()=>e.jsx(me,{eyebrow:"Actions",title:"Open what matters now",description:"These cards stay compact by default so the page can fit more live context at once.",items:[{id:"top-task",label:d?"Top task":o?"Due habit":"Recovery lane",title:(d==null?void 0:d.title)??(o==null?void 0:o.title)??"Get a real task moving",detail:(d==null?void 0:d.description)||(o==null?void 0:o.description)||"There is no single top task yet, so use this surface to choose one clean next move.",badge:d?`${d.points} xp`:o?`${o.rewardXp} xp`:`${t.metrics.weeklyXp} weekly xp`,href:d?`/tasks/${d.id}`:o?"/habits":"/today",actionLabel:d?"Open task":o?"Open habits":"Open today"},{id:"reward",label:"Next reward",title:(m==null?void 0:m.title)??"Keep the streak alive",detail:(m==null?void 0:m.progressLabel)??`Level ${t.metrics.level} is active. ${t.metrics.weeklyXp} weekly XP is already logged.`,badge:(m==null?void 0:m.rewardLabel)??`${t.metrics.comboMultiplier.toFixed(2)}x combo`,href:"/rewards",actionLabel:"Open rewards"},{id:"recent-activity",label:"Recent activity",title:u?ge(u):"No recent evidence",detail:u?xe(u):"The next work closeout or note will appear here.",badge:(u==null?void 0:u.source)??"activity",href:u?q(u):"/activity",actionLabel:"Open"}]})},{id:"goals",title:"Goals",description:"Long-range direction stays visible without taking over the whole page.",defaultWidth:8,defaultHeight:5,minWidth:4,render:({compact:i})=>e.jsx("div",{className:"grid gap-3",children:t.overview.activeGoals.slice(0,i?2:4).map(s=>{var j;return e.jsxs("div",{className:"group relative rounded-[20px] bg-white/[0.04] p-4 transition hover:bg-white/[0.06]",children:[e.jsx(S,{to:`/goals/${s.id}`,className:"absolute inset-0 rounded-[20px] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--primary)]","aria-label":`Open goal ${s.title}`}),e.jsxs("div",{className:"pointer-events-none relative z-10",children:[e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[e.jsx(Y,{kind:"goal",label:((j=s.tags[0])==null?void 0:j.name)??s.horizon,compact:!0,gradient:!1}),e.jsxs("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:[s.progress,"%"]})]}),e.jsx("div",{className:"mt-3",children:e.jsx(Z,{kind:"goal",label:s.title,variant:"heading",size:i?"md":"lg",lines:2,className:"max-w-full",labelClassName:"[overflow-wrap:anywhere]"})}),i?null:e.jsx("p",{className:"mt-2 text-sm leading-6 text-white/60",children:s.description}),e.jsx("div",{className:"mt-3",children:e.jsx(ee,{value:s.progress})})]}),e.jsx("div",{className:"relative z-20 mt-3",children:e.jsx(he,{entityType:"goal",entityId:s.id,count:te(t.dashboard.notesSummaryByEntity,"goal",s.id).count})})]},s.id)})})},{id:"pipeline",title:"Projects, habits, tasks",description:"Execution blocks can shrink while keeping the useful subtitles visible.",defaultWidth:12,defaultHeight:5,minWidth:6,render:({compact:i})=>e.jsxs("div",{className:"grid min-w-0 gap-4 xl:grid-cols-3",children:[e.jsxs("div",{className:"grid gap-3",children:[e.jsx("div",{className:"text-[12px] uppercase tracking-[0.16em] text-white/38",children:"Projects"}),t.overview.projects.slice(0,i?3:4).map(s=>{var j;return e.jsxs(S,{to:`/projects/${s.id}`,className:"rounded-[18px] bg-white/[0.04] px-4 py-3 transition hover:bg-white/[0.06]",children:[e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-semibold text-white",children:s.title}),e.jsx("div",{className:"mt-1 text-sm text-white/56",children:((j=V.get(s.id))==null?void 0:j.status)??"active"})]}),e.jsxs(h,{wrap:!0,className:"max-w-[7rem] shrink-0",children:[s.earnedPoints," xp"]})]}),i?null:e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/56",children:s.description})]},s.id)})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsx("div",{className:"text-[12px] uppercase tracking-[0.16em] text-white/38",children:"Due habits"}),t.overview.dueHabits.slice(0,i?3:4).map(s=>e.jsx(S,{to:"/habits","aria-label":`Open habit ${s.title}`,className:"rounded-[18px] bg-white/[0.04] px-4 py-3 transition hover:bg-white/[0.06]",children:e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-semibold text-white",children:s.title}),i?null:e.jsx("div",{className:"mt-1 text-sm text-white/56",children:s.description})]}),e.jsxs(h,{className:"bg-[rgba(78,222,163,0.14)] text-[var(--secondary)]",children:[s.rewardXp," xp"]})]})},s.id))]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsx("div",{className:"text-[12px] uppercase tracking-[0.16em] text-white/38",children:"Top tasks"}),t.overview.topTasks.slice(0,i?3:4).map(s=>e.jsx(S,{to:`/tasks/${s.id}`,className:"rounded-[18px] bg-white/[0.04] px-4 py-3 transition hover:bg-white/[0.06]",children:e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-semibold text-white",children:s.title}),e.jsx("div",{className:"mt-1 text-sm text-white/56",children:s.status.replaceAll("_"," ")})]}),e.jsxs(h,{className:"bg-white/[0.08] text-white/72",children:[s.points," xp"]})]})},s.id))]})]})},{id:"time",title:"Clock",description:"Optional utility widget.",defaultWidth:3,defaultHeight:2,defaultHidden:!0,render:({compact:i})=>e.jsx(ie,{compact:i})},{id:"weather",title:"Weather",description:"Optional utility widget.",defaultWidth:3,defaultHeight:2,defaultHidden:!0,render:({compact:i})=>e.jsx(se,{compact:i})},{id:"mini-calendar",title:"Mini calendar",description:"Optional utility widget.",defaultWidth:4,defaultHeight:3,defaultHidden:!0,render:({compact:i})=>e.jsx(ae,{compact:i})},{id:"spotify",title:"Spotify",description:"Optional utility widget.",defaultWidth:4,defaultHeight:2,defaultHidden:!0,render:()=>e.jsx(re,{surfaceId:"overview"})},{id:"quick-capture",title:"Quick capture",description:"Save a standalone note or wiki draft from any dashboard.",defaultWidth:5,defaultHeight:3,defaultHidden:!0,render:({compact:i})=>{var s;return e.jsx(le,{compact:i,defaultUserId:r[0]??((s=t.users[0])==null?void 0:s.id)??null})}}];return e.jsx(B,{surfaceId:"overview",baseWidgets:U,normalizeLayout:fe})}export{Ee as OverviewPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./vendor-DHkYh85p.js";import{aR as w,Z as h,c as y,aq as j}from"./index-CF4J4R9L.js";function p(a){return a.trim().toLowerCase().replace(/[^a-z0-9]+/g," ")}function N({eyebrow:a,titleText:r,entityKind:s,copyMode:i}){if(!a||i==="title_only"||typeof a!="string")return null;const l=p(a),n=r?p(r):null,o=s?p(w(s).label):null;return!l||n&&(l===n||n.includes(l)||l.includes(n))||o&&l===o?null:a}function E({eyebrow:a,entityKind:r,title:s,titleText:i,description:l,helpTitle:n,helpContent:o,helpLabel:v,badge:m,actions:x,copyMode:b="title_only"}){const t=r?w(r):null,d=t==null?void 0:t.icon,c=N({eyebrow:a,titleText:i,entityKind:r,copyMode:b}),u=i??(typeof s=="string"?s:"this page"),g=o??(typeof l=="string"?l:null),f=!!(t||c||m);return e.jsxs("header",{className:"relative min-w-0 w-full max-w-full overflow-visible border-b border-white/6 px-5 py-5 sm:px-6 lg:grid lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end lg:px-7 lg:py-6",style:{background:"var(--hero-gradient)",paddingTop:"var(--forge-shell-hero-padding-top)",paddingBottom:"var(--forge-shell-hero-padding-bottom)"},children:[e.jsx("div",{className:"pointer-events-none absolute inset-0",style:{background:"radial-gradient(circle at top right, color-mix(in srgb, var(--forge-body-ambient-primary) 94%, transparent), transparent 34%)"}}),e.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-px bg-white/10"}),e.jsxs("div",{className:"relative min-w-0 w-full max-w-full",children:[f?e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2 text-[11px] font-medium uppercase tracking-[0.2em] text-white/40",children:[t&&d?e.jsxs("span",{className:"inline-flex items-center gap-2 text-white/56","aria-label":t.label,title:t.label,children:[e.jsx(d,{className:h("size-3.5",t.iconClassName)}),e.jsx("span",{children:t.label})]}):null,c?e.jsx("span",{className:"text-[var(--secondary)]/80",children:c}):null,m?e.jsx(y,{tone:"signal",className:"h-8 overflow-visible rounded-full border border-white/8 bg-white/[0.04] px-3 text-[11px] font-medium tracking-[0.14em] text-white/80 uppercase",children:m}):null]}):null,e.jsxs("div",{className:h("flex min-w-0 max-w-4xl items-start gap-2",f?"mt-3":""),children:[e.jsx("div",{className:"min-w-0 text-[clamp(1.85rem,3.5vw,4rem)] font-medium leading-[0.92] text-white",style:{transform:"translateY(var(--forge-shell-hero-title-translate-y)) scale(var(--forge-shell-hero-title-scale))",transformOrigin:"top left",willChange:"transform"},children:s}),g?e.jsx(j,{className:"mt-2 shrink-0",label:v??`Explain what the ${u} page shows and how to interpret it`,title:n??`${u} explained`,content:g}):null]}),e.jsx("div",{className:"mt-2 min-w-0 max-w-3xl text-[14px] leading-6 text-white/58 sm:text-[15px]",style:{opacity:"var(--forge-shell-hero-description-opacity)",transform:"translateY(var(--forge-shell-hero-description-translate-y))",willChange:"opacity, transform"},children:l})]}),x?e.jsx("div",{className:"relative mt-4 flex min-w-0 w-full max-w-full flex-wrap items-center gap-2 lg:mt-0 lg:max-w-[26rem] lg:justify-end",children:x}):null]})}export{E as P};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t}from"./vendor-DHkYh85p.js";import{Z as a}from"./index-CF4J4R9L.js";function i({children:r,className:s}){return t.jsx("div",{className:a("flex flex-wrap gap-2",s),children:r})}export{i as P};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c2 as ft,r as h,j as e,b0 as jt,bH as wt,cG as yt,cH as Nt,bf as Ct,aG as It,aC as ue,b3 as se,c7 as St,b4 as kt,aK as Ft}from"./vendor-DHkYh85p.js";import{R as Pt,P as Lt,O as Tt,C as Mt,T as At,D as Dt,a as Et}from"./ui-C13Nbgas.js";import{j as _t,i as Ze,k as j}from"./state-B-4sS1xO.js";import{u as zt,s as Ot,c4 as Ve,c5 as $t,c6 as Bt,c7 as Wt,c8 as qt,c9 as Rt,ca as Qt,cb as Ut,cc as Gt,cd as Ht,ce as Kt,cf as Jt,cg as Yt,ch as Xt,ci as Zt,cj as Vt,a as et,L as tt,E as es,B as o,ck as ts,C as v,U as st,H as ss,Z as $,c as y,I as x,T,bk as H,cl as at}from"./index-CF4J4R9L.js";import{P as as}from"./page-hero-DRy5b2MU.js";import"./board-BkDRaMp6.js";import"./motion-BeD44FeG.js";import"./forms-BFlTgZ3W.js";import"./graph-D6JLqDbD.js";const rt=[{id:"overview",label:"Overview",icon:jt},{id:"map",label:"Map",icon:wt},{id:"table",label:"Table",icon:yt},{id:"history",label:"History",icon:Nt},{id:"contexts",label:"Contexts",icon:Ct},{id:"concepts",label:"Concepts",icon:It}],is=new Set(["projects","tasks","strategies","habits"]),ae=[{value:"projects",label:"Projects",description:"Goals and projects already living in Forge.",mode:"forge"},{value:"tasks",label:"Tasks",description:"Execution-level work choices inside Forge.",mode:"forge"},{value:"strategies",label:"Strategies",description:"Plan shapes and sequencing choices in Forge.",mode:"forge"},{value:"habits",label:"Habits",description:"Recurring behaviors and routines from Forge.",mode:"forge"},{value:"activities",label:"Activities",description:"Movement, leisure, and social setting concepts.",mode:"concept"},{value:"food",label:"Food",description:"Cuisine, meal mood, and drink preferences.",mode:"concept"},{value:"places",label:"Places",description:"Living environments, venues, and trip shapes.",mode:"concept"},{value:"countries",label:"Countries",description:"Country-level attraction and lifestyle fit.",mode:"concept"},{value:"fashion",label:"Fashion",description:"Silhouette, material, and palette preferences.",mode:"concept"},{value:"people",label:"People",description:"Presence, body-type, and conversation preferences.",mode:"concept"},{value:"media",label:"Media",description:"Film, reading, and music taste.",mode:"concept"},{value:"tools",label:"Tools",description:"Workflow and capture preferences.",mode:"concept"},{value:"custom",label:"Custom",description:"General-purpose concept libraries you control.",mode:"concept"}],ve={novelty:"Novelty",simplicity:"Simplicity",rigor:"Rigor",aesthetics:"Aesthetics",depth:"Depth",structure:"Structure",familiarity:"Familiarity",surprise:"Surprise"},ie={novelty:0,simplicity:0,rigor:0,aesthetics:0,depth:0,structure:0,familiarity:0,surprise:0},it={liked:"bg-emerald-500/12 text-emerald-200",disliked:"bg-rose-500/12 text-rose-200",uncertain:"bg-white/[0.08] text-white/70",vetoed:"bg-rose-500/15 text-rose-100",bookmarked:"bg-sky-500/12 text-sky-200",favorite:"bg-amber-500/12 text-amber-200",must_have:"bg-indigo-500/15 text-indigo-100",neutral:"bg-white/[0.08] text-white/70"},ns=[{signalType:"favorite",label:"Favorite"},{signalType:"must_have",label:"Must-have"},{signalType:"bookmark",label:"Bookmark"},{signalType:"compare_later",label:"Later"},{signalType:"neutral",label:"Neutral"},{signalType:"veto",label:"Veto"}];function ne(c){return c.trim().toLowerCase()}function B(c){return`${Math.round(c*100)}%`}function rs(c){return[...c.goals.map(a=>({entityType:"goal",entityId:a.id,domain:"projects",label:a.title,description:a.description,user:a.user,href:`/goals/${a.id}`,searchText:H([a.title,a.description,a.status,a.horizon],a)})),...c.dashboard.projects.map(a=>({entityType:"project",entityId:a.id,domain:"projects",label:a.title,description:a.description,user:a.user,href:`/projects/${a.id}`,searchText:H([a.title,a.description,a.status,a.goalTitle],a)})),...c.tasks.map(a=>({entityType:"task",entityId:a.id,domain:"tasks",label:a.title,description:a.description,user:a.user,href:`/tasks/${a.id}`,searchText:H([a.title,a.description,a.status,a.priority,a.owner],a)})),...c.strategies.map(a=>({entityType:"strategy",entityId:a.id,domain:"strategies",label:a.title,description:a.overview||a.endStateDescription,user:a.user,href:`/strategies/${a.id}`,searchText:H([a.title,a.overview,a.endStateDescription,a.status],a)})),...c.habits.map(a=>({entityType:"habit",entityId:a.id,domain:"habits",label:a.title,description:a.description,user:a.user,href:null,searchText:H([a.title,a.description,a.status,a.frequency],a)}))]}function ls(c,a){return!c||!a?null:c==="goal"?`/goals/${a}`:c==="project"?`/projects/${a}`:c==="task"?`/tasks/${a}`:c==="strategy"?`/strategies/${a}`:null}function re(c){return c.manualStatus??c.status}function ds(c){return c&&rt.some(a=>a.id===c)?c:"overview"}function cs(c){return c.summary.totalItems<2?{title:"Forge does not know enough yet.",description:"Start the game so Forge can ask a few clean comparisons and build a real preference model."}:c.summary.averageConfidence<.28?{title:"Forge has a rough sketch, not a stable read.",description:"There is some signal, but the model still needs more rounds before its preferences are trustworthy."}:{title:"This is what Forge currently thinks.",description:"The summary below is the current best model for this user, this domain, and the active context."}}function os({summary:c}){const a=Math.max(-1,Math.min(1,c.leaning)),N=(a+1)/2*100;return e.jsxs("div",{className:"grid gap-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs text-white/56",children:[e.jsx("span",{children:ve[c.dimensionId]}),e.jsxs("span",{children:[c.movement>.08?"Rising":c.movement<-.08?"Falling":"Stable"," ","· ",B(c.confidence)]})]}),e.jsxs("div",{className:"relative h-2 rounded-full bg-white/[0.08]",children:[e.jsx("div",{className:"absolute inset-y-0 left-1/2 w-px bg-white/10"}),e.jsx("div",{className:$("absolute top-1/2 size-3 -translate-x-1/2 -translate-y-1/2 rounded-full border border-white/12",a>=0?"bg-emerald-300":"bg-rose-300"),style:{left:`${N}%`}})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3 text-[11px] uppercase tracking-[0.12em] text-white/38",children:[e.jsxs("span",{children:[a>=0?"Leans toward":"Leans away from"," ",ve[c.dimensionId].toLowerCase()]}),e.jsxs("span",{children:["Context ",B(c.contextSensitivity)]})]})]})}function nt({title:c,description:a,sideLabel:N,onClick:W}){return e.jsxs("button",{type:"button",className:"grid min-h-[220px] gap-4 rounded-[28px] border border-white/10 bg-[linear-gradient(180deg,rgba(255,255,255,0.07),rgba(255,255,255,0.03))] p-5 text-left transition hover:border-[var(--primary)]/40 hover:bg-[linear-gradient(180deg,rgba(192,193,255,0.14),rgba(255,255,255,0.05))]",onClick:W,children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/42",children:N}),e.jsx("div",{className:"font-display text-3xl text-white",children:c}),e.jsx("div",{className:"max-w-[36ch] text-sm leading-6 text-white/56",children:a||"Choose the one that feels more right."}),e.jsx("div",{className:"mt-auto text-sm text-[var(--primary)]",children:"Click this card"})]})}function js(){var Qe,Ue,Ge,He,Ke;const c=zt(),a=_t(),[N,W]=ft(),[le,lt]=h.useState(""),[de,dt]=h.useState(""),[D,be]=h.useState(""),[K,fe]=h.useState(""),[J,je]=h.useState(""),[f,F]=h.useState({open:!1,phase:"domain",domain:N.get("domain")??"projects"}),[we,P]=h.useState(null),[ct,ce]=h.useState(!1),[ye,E]=h.useState(null),[p,C]=h.useState({label:"",description:"",tags:"",manualStatus:"",manualScore:"",confidenceLock:"",bookmarked:!1,compareLater:!1,frozen:!1,featureWeights:{novelty:"0",simplicity:"0",rigor:"0",aesthetics:"0",depth:"0",structure:"0",familiarity:"0",surprise:"0"}}),[M,Y]=h.useState({label:"",description:"",tags:""}),[I,q]=h.useState({name:"",description:"",shareMode:"blended",decayDays:"90"}),[R,oe]=h.useState({title:"",description:""}),[ot,X]=h.useState({}),[Ne,me]=h.useState(null),[Z,he]=h.useState({title:"",description:""}),[mt,xe]=h.useState(null),[_,V]=h.useState({label:"",description:"",tags:""}),m=N.get("userId")??Ot(c.selectedUserIds)??((Qe=c.snapshot.users[0])==null?void 0:Qe.id)??null,w=N.get("domain")??"projects",S=ds(N.get("tab")),Q=N.get("contextId"),ee=N.get("focusItem"),Ce=h.useMemo(()=>c.snapshot.users.find(t=>t.id===m)??null,[m,c.snapshot.users]),te=h.useMemo(()=>rs(c.snapshot),[c.snapshot]),U=Ze({queryKey:["forge-preferences",m,w,Q],queryFn:async()=>(await at({userId:m??void 0,domain:w,contextId:Q??void 0})).workspace,enabled:!!m}),Ie=Ze({queryKey:["forge-preferences-game",m,f.domain,Q],queryFn:async()=>(await at({userId:m??void 0,domain:f.domain,contextId:Q??void 0})).workspace,enabled:!!m&&f.open}),i=U.data??null,g=f.domain===w?i:Ie.data??null;h.useEffect(()=>{var s;if(!i)return;const t=ee&&i.scores.some(l=>l.itemId===ee)?ee:((s=i.scores[0])==null?void 0:s.itemId)??null;E(l=>l&&i.scores.some(n=>n.itemId===l)?l:t)},[ee,i]);const pe=h.useMemo(()=>{if(!i)return[];const t=ne(le);return t?i.scores.filter(s=>{var l,n,r;return[((l=s.item)==null?void 0:l.label)??"",((n=s.item)==null?void 0:n.description)??"",((r=s.item)==null?void 0:r.tags.join(" "))??"",s.status,s.manualStatus??"",s.dominantDimensions.join(" "),s.explanation.join(" ")].join(" ").toLowerCase().includes(t)}):i.scores},[le,i]),d=pe.find(t=>t.itemId===ye)??(i==null?void 0:i.scores.find(t=>t.itemId===ye))??pe[0]??(i==null?void 0:i.scores[0])??null;h.useEffect(()=>{var t,s,l,n,r,b,G,O,Je,Ye,Xe;d&&C({label:((t=d.item)==null?void 0:t.label)??"",description:((s=d.item)==null?void 0:s.description)??"",tags:((l=d.item)==null?void 0:l.tags.join(", "))??"",manualStatus:d.manualStatus??"",manualScore:typeof d.manualScore=="number"?String(d.manualScore):"",confidenceLock:typeof d.confidenceLock=="number"?String(d.confidenceLock):"",bookmarked:d.bookmarked,compareLater:d.compareLater,frozen:d.frozen,featureWeights:{novelty:String(((n=d.item)==null?void 0:n.featureWeights.novelty)??0),simplicity:String(((r=d.item)==null?void 0:r.featureWeights.simplicity)??0),rigor:String(((b=d.item)==null?void 0:b.featureWeights.rigor)??0),aesthetics:String(((G=d.item)==null?void 0:G.featureWeights.aesthetics)??0),depth:String(((O=d.item)==null?void 0:O.featureWeights.depth)??0),structure:String(((Je=d.item)==null?void 0:Je.featureWeights.structure)??0),familiarity:String(((Ye=d.item)==null?void 0:Ye.featureWeights.familiarity)??0),surprise:String(((Xe=d.item)==null?void 0:Xe.featureWeights.surprise)??0)}})},[d]);const Se=h.useMemo(()=>{const t=ne(de);return te.filter(s=>s.domain===w).filter(s=>t?s.searchText.includes(t):!0).slice(0,12)},[te,de,w]),ge=h.useMemo(()=>{const t=S==="concepts"?i:g??i,s=(t==null?void 0:t.catalogs)??[],l=ne(D);return l?s.filter(n=>[n.title,n.description,n.source,...n.items.flatMap(r=>[r.label,r.description,r.tags.join(" ")])].join(" ").toLowerCase().includes(l)):s},[g,D,S,i]),u=async()=>{await a.invalidateQueries({queryKey:["forge-preferences"]}),await a.invalidateQueries({queryKey:["forge-preferences-game"]})},ke=j({mutationFn:Ve,onSuccess:u}),Fe=j({mutationFn:$t,onSuccess:async({item:t})=>{await u(),Y({label:"",description:"",tags:""}),E(t.id)}}),Pe=j({mutationFn:Bt,onSuccess:async()=>{await u(),oe({title:"",description:""}),W(t=>{const s=new URLSearchParams(t);return s.set("tab","concepts"),s})}}),Le=j({mutationFn:({catalogId:t,patch:s})=>Wt(t,s),onSuccess:async()=>{await u(),me(null)}}),Te=j({mutationFn:qt,onSuccess:u}),Me=j({mutationFn:Rt,onSuccess:async()=>{await u()}}),Ae=j({mutationFn:({catalogItemId:t,patch:s})=>Qt(t,s),onSuccess:async()=>{await u(),xe(null)}}),De=j({mutationFn:Ut,onSuccess:u}),ht=j({mutationFn:Gt,onSuccess:async()=>{await u(),F(t=>({...t,phase:"play"}))}}),xt=j({mutationFn:Ht,onSuccess:u}),pt=j({mutationFn:Kt,onSuccess:u}),Ee=j({mutationFn:async()=>{!(d!=null&&d.item)||!m||!i||(await Jt(d.item.id,{label:p.label,description:p.description,tags:p.tags.split(",").map(t=>t.trim()).filter(Boolean),featureWeights:Object.fromEntries(Object.keys(ie).map(t=>[t,Number(p.featureWeights[t]||0)]))}),await Yt(d.item.id,{userId:m,domain:w,contextId:i.selectedContext.id,manualStatus:p.manualStatus||null,manualScore:p.manualScore.trim().length>0?Number(p.manualScore):null,confidenceLock:p.confidenceLock.trim().length>0?Number(p.confidenceLock):null,bookmarked:p.bookmarked,compareLater:p.compareLater,frozen:p.frozen}))},onSuccess:u}),_e=j({mutationFn:Xt,onSuccess:async({context:t})=>{await u(),q({name:"",description:"",shareMode:"blended",decayDays:"90"}),W(s=>{const l=new URLSearchParams(s);return l.set("contextId",t.id),l.set("tab","contexts"),l})}}),ze=j({mutationFn:Zt,onSuccess:async()=>{await u(),fe(""),je("")}}),z=j({mutationFn:({contextId:t,patch:s})=>Vt(t,s),onSuccess:u}),k=t=>{W(s=>{const l=new URLSearchParams(s);for(const[n,r]of Object.entries(t))r?l.set(n,r):l.delete(n);return l})},Oe=(t=w)=>{P(null),F({open:!0,phase:"domain",domain:t})},gt=async t=>{if(!m)return;P(null),ce(!0);const s=te.filter(r=>{var b;return r.domain===t&&((b=r.user)==null?void 0:b.id)===m}),l=te.filter(r=>r.domain===t),n=(s.length>0?s:l).slice(0,12);if(n.length<2){P("Forge needs at least two matching records in this domain before it can start the game."),ce(!1),F(r=>({...r,phase:"domain"}));return}try{k({domain:t,tab:"overview",contextId:null,focusItem:null}),await Promise.all(n.map(r=>Ve({userId:m,domain:t,entityType:r.entityType,entityId:r.entityId,label:r.label,description:r.description,tags:[]}))),await u(),F({open:!0,phase:"play",domain:t})}catch(r){P(r instanceof Error?r.message:"Forge could not start the game."),F(b=>({...b,phase:"domain"}))}finally{ce(!1)}},$e=async(t,s)=>{if(m){P(null),k({domain:t,tab:"overview",contextId:null,focusItem:null});try{await ht.mutateAsync({userId:m,domain:t,contextId:Q??void 0,catalogId:s}),F({open:!0,phase:"play",domain:t})}catch(l){P(l instanceof Error?l.message:"Forge could not start the game.")}}},ut=async t=>{if(is.has(t)){await gt(t);return}P(null),F({open:!0,phase:"catalog",domain:t})},L=async(t,s=1)=>{if(!m||!(g!=null&&g.compare.nextPair))return;const l=g.compare.nextPair;await xt.mutateAsync({userId:m,domain:f.domain,contextId:g.selectedContext.id,leftItemId:l.left.id,rightItemId:l.right.id,outcome:t,strength:s})},vt=async(t,s)=>{!m||!g||await pt.mutateAsync({userId:m,domain:f.domain,contextId:g.selectedContext.id,itemId:t,signalType:s,strength:1})};if(!m)return e.jsx(et,{eyebrow:"Preferences",title:"No Forge user available",description:"Forge needs at least one human or bot user before it can learn preferences."});if(U.isLoading&&!i)return e.jsx(tt,{eyebrow:"Preferences",title:"Loading preference model",description:"Reconstructing current scores, uncertainty, and concept libraries."});if(U.isError)return e.jsx(es,{eyebrow:"Preferences",error:U.error,onRetry:()=>void U.refetch()});if(!i)return null;const bt=[...i.dimensions].sort((t,s)=>s.confidence-t.confidence).slice(0,6),Be=i.scores.filter(t=>re(t)==="liked"||re(t)==="favorite").slice(0,4),We=i.scores.filter(t=>t.uncertainty>=.5).slice(0,4),qe=cs(i),Re=ls(((Ue=d==null?void 0:d.item)==null?void 0:Ue.sourceEntityType)??null,((Ge=d==null?void 0:d.item)==null?void 0:Ge.sourceEntityId)??null),A=(g==null?void 0:g.compare.nextPair)??null;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-5",children:[e.jsx(as,{title:"Preferences",titleText:"Preferences",description:"Forge keeps an explicit, editable model of what one user prefers in one domain. The first job of this page is to show what Forge currently knows.",badge:`${i.summary.totalItems} items · ${B(i.summary.averageConfidence)} confidence`,actions:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(o,{className:"min-w-[10rem]",onClick:()=>Oe(),children:"Start the game"}),e.jsx(o,{variant:"secondary",onClick:()=>void u(),children:"Refresh model"})]})}),e.jsx(ts,{}),e.jsxs(v,{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-3 xl:grid-cols-[minmax(0,1.2fr)_minmax(0,1fr)]",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Active user"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx("select",{value:m,onChange:t=>k({userId:t.target.value,contextId:null,focusItem:null}),className:"min-h-10 rounded-[18px] border border-white/8 bg-white/[0.05] px-3 text-sm text-white outline-none",children:c.snapshot.users.map(t=>e.jsxs("option",{value:t.id,children:[t.displayName," · ",t.kind]},t.id))}),e.jsx(st,{user:Ce}),e.jsx("div",{className:"text-sm text-white/54",children:ss(Ce)})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Domain"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:ae.map(t=>e.jsx("button",{type:"button",className:$("rounded-full border px-3 py-2 text-sm transition",t.value===w?"border-[var(--primary)] bg-[var(--primary)]/14 text-white":"border-white/8 bg-white/[0.04] text-white/62 hover:bg-white/[0.08]"),onClick:()=>k({domain:t.value,contextId:null,focusItem:null}),children:t.label},t.value))}),e.jsx("div",{className:"text-sm text-white/48",children:(He=ae.find(t=>t.value===w))==null?void 0:He.description})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-white/50",children:[e.jsx(y,{className:"bg-white/[0.08] text-white/70",children:i.selectedContext.name}),e.jsx("span",{children:i.selectedContext.shareMode}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[i.compare.pendingCount," queued comparisons"]}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[i.libraries.totalCatalogItems," concept items ready"]})]})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:rt.map(t=>e.jsxs("button",{type:"button",className:$("inline-flex items-center gap-2 rounded-full border px-3 py-2 text-sm transition",t.id===S?"border-[var(--primary)] bg-[var(--primary)]/14 text-white":"border-white/8 bg-white/[0.04] text-white/62 hover:bg-white/[0.08]"),onClick:()=>k({tab:t.id}),children:[e.jsx(t.icon,{className:"size-4"}),t.label]},t.id))}),S==="overview"?e.jsxs("div",{className:"grid gap-5",children:[e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.3fr)_360px]",children:[e.jsxs(v,{className:"grid gap-5",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"What Forge knows"}),e.jsx("div",{className:"font-display text-3xl text-white",children:qe.title}),e.jsx("div",{className:"max-w-[70ch] text-sm leading-6 text-white/58",children:qe.description})]}),e.jsx("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-4",children:[{label:"Known items",value:i.summary.totalItems,detail:"Items inside this domain"},{label:"Confidence",value:B(i.summary.averageConfidence),detail:"Average certainty"},{label:"Unknowns",value:i.summary.uncertainCount,detail:"Need more rounds"},{label:"Libraries",value:i.libraries.totalCatalogItems,detail:"Seeded concepts ready"}].map(t=>e.jsxs("div",{className:"rounded-[22px] bg-white/[0.04] px-4 py-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:t.label}),e.jsx("div",{className:"mt-2 font-display text-3xl text-white",children:t.value}),e.jsx("div",{className:"mt-1 text-sm text-white/52",children:t.detail})]},t.label))}),e.jsx("div",{className:"grid gap-4 lg:grid-cols-2",children:bt.map(t=>e.jsx(os,{summary:t},t.dimensionId))})]}),e.jsxs(v,{className:"grid gap-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Next move"}),e.jsx("div",{className:"font-display text-2xl text-white",children:"Start the game"}),e.jsx("div",{className:"text-sm leading-6 text-white/58",children:"Forge will ask a small number of pairwise questions. You choose a domain, Forge supplies the candidates, and the model tightens from there."}),e.jsx(o,{className:"w-full",onClick:()=>Oe(),children:"Start the game"}),e.jsxs("div",{className:"grid gap-3 rounded-[22px] bg-white/[0.04] px-4 py-4 text-sm text-white/58",children:[e.jsxs("div",{children:["Current queue: ",i.compare.pendingCount," comparison",i.compare.pendingCount===1?"":"s"]}),e.jsxs("div",{children:["Active context: ",i.selectedContext.name]}),e.jsxs("div",{children:["Library coverage: ",i.libraries.seededCatalogCount," ","seeded lists and ",i.libraries.customCatalogCount," ","custom lists"]})]})]})]}),e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.3fr)_360px]",children:[e.jsxs(v,{className:"grid gap-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.16em] text-white/42",children:"Preference map"}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:"Green drifts positive, red drifts negative, and low opacity still means uncertainty."})]}),e.jsx(ue,{to:"?tab=map",className:"text-sm text-[var(--primary)]",children:"Open full map"})]}),e.jsxs("div",{className:"relative min-h-[340px] overflow-hidden rounded-[24px] border border-white/8 bg-[radial-gradient(circle_at_top,rgba(87,196,138,0.18),transparent_35%),radial-gradient(circle_at_bottom_right,rgba(255,104,130,0.14),transparent_30%),linear-gradient(180deg,rgba(255,255,255,0.03),rgba(255,255,255,0.01))]",children:[e.jsx("div",{className:"absolute inset-x-0 top-1/2 h-px bg-white/8"}),e.jsx("div",{className:"absolute inset-y-0 left-1/2 w-px bg-white/8"}),i.map.map(t=>e.jsx("button",{type:"button",className:$("absolute -translate-x-1/2 -translate-y-1/2 rounded-full border px-2 py-1 text-[11px] shadow-[0_10px_25px_rgba(5,8,16,0.32)] transition hover:scale-[1.04]",t.itemId===(d==null?void 0:d.itemId)?"border-white/30 bg-white/16 text-white":t.score>=0?"border-emerald-300/30 bg-emerald-500/14 text-emerald-100":"border-rose-300/30 bg-rose-500/14 text-rose-100"),style:{left:`${50+t.x*30}%`,top:`${50-t.y*30}%`,opacity:.55+t.confidence*.45},onClick:()=>E(t.itemId),children:t.label},t.itemId))]})]}),e.jsxs(v,{className:"grid gap-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Best read so far"}),e.jsx("div",{className:"grid gap-2",children:Be.length>0?Be.map(t=>{var s;return e.jsxs("button",{type:"button",className:"rounded-[18px] bg-white/[0.04] px-3 py-3 text-left transition hover:bg-white/[0.07]",onClick:()=>{E(t.itemId),k({focusItem:t.itemId})},children:[e.jsx("div",{className:"font-medium text-white",children:((s=t.item)==null?void 0:s.label)??t.itemId}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:t.explanation[0]||"Forge has positive evidence here."})]},t.itemId)}):e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-3 py-3 text-sm text-white/58",children:"No clear positives yet. A few comparison rounds will change that."})}),e.jsxs("div",{className:"border-t border-white/8 pt-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Biggest unknowns"}),e.jsx("div",{className:"mt-3 grid gap-2",children:We.length>0?We.map(t=>{var s;return e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-3 py-3 text-sm text-white/58",children:[e.jsx("div",{className:"font-medium text-white",children:((s=t.item)==null?void 0:s.label)??t.itemId}),e.jsxs("div",{className:"mt-1",children:["Uncertainty ",B(t.uncertainty)]})]},t.itemId)}):e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-3 py-3 text-sm text-white/58",children:"The current unknown list is short."})})]})]})]}),e.jsxs(v,{className:"grid gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Bring in Forge records"}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:"Search goals, projects, tasks, strategies, or habits across human and bot users, then send them straight into this model."})]}),e.jsxs(y,{className:"bg-white/[0.08] text-white/70",children:[Se.length," visible"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(se,{className:"size-4 text-white/38"}),e.jsx(x,{value:de,onChange:t=>dt(t.target.value),placeholder:"Search across owners, handles, user kind, title, and description"})]}),e.jsx("div",{className:"grid gap-2",children:Se.map(t=>e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-[18px] bg-white/[0.04] px-4 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-medium text-white",children:t.label}),e.jsx(y,{className:"bg-white/[0.08] text-white/70",children:t.entityType}),t.user?e.jsx(st,{user:t.user,compact:!0}):null]}),e.jsx("div",{className:"mt-1 text-sm text-white/52",children:t.description||"No description yet."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.href?e.jsx(ue,{to:t.href,children:e.jsx(o,{variant:"ghost",size:"sm",children:"Open"})}):null,e.jsx(o,{variant:"secondary",size:"sm",pending:ke.isPending,pendingLabel:"Adding",onClick:()=>void ke.mutateAsync({userId:m,domain:w,entityType:t.entityType,entityId:t.entityId,label:t.label,description:t.description,tags:[]}),children:"Add to model"})]})]},`${t.entityType}-${t.entityId}`))})]})]}):null,S==="map"?e.jsxs(v,{className:"grid gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Full map"}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:"Click a point to inspect why Forge believes it belongs there."})]}),e.jsxs("div",{className:"text-sm text-white/52",children:[i.map.length," plotted items"]})]}),e.jsxs("div",{className:"relative min-h-[520px] overflow-hidden rounded-[24px] border border-white/8 bg-[radial-gradient(circle_at_20%_20%,rgba(87,196,138,0.2),transparent_25%),radial-gradient(circle_at_80%_80%,rgba(255,104,130,0.2),transparent_26%),linear-gradient(180deg,rgba(255,255,255,0.03),rgba(255,255,255,0.01))]",children:[e.jsx("div",{className:"absolute inset-x-0 top-1/2 h-px bg-white/8"}),e.jsx("div",{className:"absolute inset-y-0 left-1/2 w-px bg-white/8"}),i.map.map(t=>e.jsx("button",{type:"button",className:$("absolute -translate-x-1/2 -translate-y-1/2 rounded-full border px-3 py-1 text-xs transition hover:scale-[1.04]",t.itemId===(d==null?void 0:d.itemId)?"border-white/30 bg-white/16 text-white":t.score>=0?"border-emerald-300/30 bg-emerald-500/14 text-emerald-100":"border-rose-300/30 bg-rose-500/14 text-rose-100"),style:{left:`${50+t.x*34}%`,top:`${50-t.y*34}%`,opacity:.45+t.confidence*.55},onClick:()=>{E(t.itemId),k({focusItem:t.itemId})},children:t.label},t.itemId))]})]}):null,S==="table"?e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.2fr)_380px]",children:[e.jsxs(v,{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(se,{className:"size-4 text-white/38"}),e.jsx(x,{value:le,onChange:t=>lt(t.target.value),placeholder:"Search learned items, explanations, tags, or dominant dimensions"})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full text-left text-sm",children:[e.jsx("thead",{className:"text-[11px] uppercase tracking-[0.14em] text-white/38",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-2",children:"Item"}),e.jsx("th",{className:"px-3 py-2",children:"Score"}),e.jsx("th",{className:"px-3 py-2",children:"Confidence"}),e.jsx("th",{className:"px-3 py-2",children:"Status"}),e.jsx("th",{className:"px-3 py-2",children:"Evidence"})]})}),e.jsx("tbody",{children:pe.map(t=>{var s,l;return e.jsxs("tr",{className:$("cursor-pointer border-t border-white/6 transition hover:bg-white/[0.04]",t.itemId===(d==null?void 0:d.itemId)?"bg-white/[0.05]":""),onClick:()=>{E(t.itemId),k({focusItem:t.itemId})},children:[e.jsxs("td",{className:"px-3 py-3",children:[e.jsx("div",{className:"font-medium text-white",children:((s=t.item)==null?void 0:s.label)??t.itemId}),e.jsx("div",{className:"text-xs text-white/48",children:(((l=t.item)==null?void 0:l.tags)??[]).join(" · ")})]}),e.jsx("td",{className:"px-3 py-3 text-white/68",children:t.latentScore.toFixed(2)}),e.jsx("td",{className:"px-3 py-3 text-white/68",children:B(t.confidence)}),e.jsx("td",{className:"px-3 py-3",children:e.jsx(y,{className:it[re(t)],children:re(t)})}),e.jsx("td",{className:"px-3 py-3 text-white/68",children:t.evidenceCount})]},t.itemId)})})]})})]}),e.jsxs(v,{className:"grid gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Item editor"}),d!=null&&d.item?e.jsxs(e.Fragment,{children:[e.jsx(x,{value:p.label,onChange:t=>C(s=>({...s,label:t.target.value})),placeholder:"Item label"}),e.jsx(T,{value:p.description,onChange:t=>C(s=>({...s,description:t.target.value})),className:"min-h-24",placeholder:"Item description"}),e.jsx(x,{value:p.tags,onChange:t=>C(s=>({...s,tags:t.target.value})),placeholder:"comma, separated, tags"}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("select",{value:p.manualStatus,onChange:t=>C(s=>({...s,manualStatus:t.target.value})),className:"min-h-10 rounded-[18px] border border-white/8 bg-white/[0.05] px-3 text-sm text-white outline-none",children:[e.jsx("option",{value:"",children:"Inferred status"}),Object.keys(it).map(t=>e.jsx("option",{value:t,children:t},t))]}),e.jsx(x,{value:p.manualScore,onChange:t=>C(s=>({...s,manualScore:t.target.value})),placeholder:"Manual score"}),e.jsx(x,{value:p.confidenceLock,onChange:t=>C(s=>({...s,confidenceLock:t.target.value})),placeholder:"Confidence lock 0-1"})]}),e.jsx("div",{className:"grid gap-2",children:Object.keys(ie).map(t=>e.jsxs("div",{className:"grid grid-cols-[110px_minmax(0,1fr)] items-center gap-3",children:[e.jsx("div",{className:"text-sm text-white/56",children:ve[t]}),e.jsx(x,{value:p.featureWeights[t],onChange:s=>C(l=>({...l,featureWeights:{...l.featureWeights,[t]:s.target.value}}))})]},t))}),e.jsx("div",{className:"grid gap-2 text-sm text-white/58",children:[["bookmarked","Bookmarked"],["compareLater","Compare later"],["frozen","Frozen"]].map(([t,s])=>e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:p[t],onChange:l=>C(n=>({...n,[t]:l.target.checked}))}),e.jsx("span",{children:s})]},t))}),e.jsx(o,{pending:Ee.isPending,pendingLabel:"Saving item",onClick:()=>void Ee.mutateAsync(),children:"Save item model"}),Re?e.jsx(ue,{className:"text-sm text-[var(--primary)]",to:Re,children:"Open linked entity"}):null]}):e.jsx("div",{className:"text-sm text-white/52",children:"Select a row to inspect or edit it."}),e.jsxs("div",{className:"mt-3 border-t border-white/8 pt-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Add custom item"}),e.jsxs("div",{className:"mt-3 grid gap-3",children:[e.jsx(x,{value:M.label,onChange:t=>Y(s=>({...s,label:t.target.value})),placeholder:"Custom item label"}),e.jsx(T,{value:M.description,onChange:t=>Y(s=>({...s,description:t.target.value})),className:"min-h-24",placeholder:"What is this preference item?"}),e.jsx(x,{value:M.tags,onChange:t=>Y(s=>({...s,tags:t.target.value})),placeholder:"comma, separated, tags"}),e.jsx(o,{disabled:!M.label.trim(),pending:Fe.isPending,pendingLabel:"Creating item",onClick:()=>void Fe.mutateAsync({userId:m,domain:w,label:M.label,description:M.description,tags:M.tags.split(",").map(t=>t.trim()).filter(Boolean),featureWeights:ie,queueForCompare:!0}),children:"Create custom item"})]})]})]})]}):null,S==="history"?e.jsxs("div",{className:"grid gap-5 xl:grid-cols-3",children:[e.jsxs(v,{className:"grid gap-3 xl:col-span-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Recent pairwise judgments"}),e.jsx("div",{className:"grid gap-2",children:i.history.judgments.slice(0,12).map(t=>{var n,r,b,G;const s=((r=(n=i.scores.find(O=>O.itemId===t.leftItemId))==null?void 0:n.item)==null?void 0:r.label)??t.leftItemId,l=((G=(b=i.scores.find(O=>O.itemId===t.rightItemId))==null?void 0:b.item)==null?void 0:G.label)??t.rightItemId;return e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-3 text-sm text-white/58",children:[e.jsxs("div",{className:"font-medium text-white",children:[s," vs ",l]}),e.jsxs("div",{className:"mt-1",children:["Outcome ",t.outcome," · strength"," ",t.strength," ·"," ",new Date(t.createdAt).toLocaleString()]})]},t.id)})})]}),e.jsxs(v,{className:"grid gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Signals and snapshots"}),e.jsx("div",{className:"grid gap-2",children:i.history.signals.slice(0,8).map(t=>{var l,n;const s=((n=(l=i.scores.find(r=>r.itemId===t.itemId))==null?void 0:l.item)==null?void 0:n.label)??t.itemId;return e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-3 py-2 text-sm text-white/58",children:[s," · ",t.signalType," ·"," ",new Date(t.createdAt).toLocaleString()]},t.id)})}),e.jsx("div",{className:"grid gap-2",children:i.history.snapshots.slice(0,5).map(t=>e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-3 py-2 text-sm text-white/58",children:["Snapshot ",new Date(t.createdAt).toLocaleString()]},t.id))}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-3 py-3 text-sm text-white/58",children:["Stale items: ",i.history.staleItemIds.length," · Flipped items: ",i.history.flippedItemIds.length]})]})]}):null,S==="contexts"?e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.1fr)_360px]",children:[e.jsx("div",{className:"grid gap-4",children:i.contexts.map(t=>e.jsxs(v,{className:"grid gap-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-display text-2xl text-white",children:t.name}),e.jsx("div",{className:"text-sm text-white/54",children:t.description||"No description yet."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.isDefault?e.jsx(y,{className:"bg-[var(--primary)]/14 text-[var(--primary)]",children:"Default"}):null,e.jsx(y,{className:"bg-white/[0.08] text-white/70",children:t.shareMode}),t.active?null:e.jsx(y,{className:"bg-amber-500/12 text-amber-200",children:"Inactive"})]})]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-4",children:[e.jsx(x,{value:t.name,onChange:s=>void z.mutateAsync({contextId:t.id,patch:{name:s.target.value}}),placeholder:"Context name"}),e.jsxs("select",{value:t.shareMode,onChange:s=>void z.mutateAsync({contextId:t.id,patch:{shareMode:s.target.value}}),className:"min-h-10 rounded-[18px] border border-white/8 bg-white/[0.05] px-3 text-sm text-white outline-none",children:[e.jsx("option",{value:"shared",children:"shared"}),e.jsx("option",{value:"blended",children:"blended"}),e.jsx("option",{value:"isolated",children:"isolated"})]}),e.jsx(x,{value:String(t.decayDays),onChange:s=>void z.mutateAsync({contextId:t.id,patch:{decayDays:Number(s.target.value||90)}}),placeholder:"Decay days"}),e.jsx(o,{variant:"secondary",onClick:()=>k({contextId:t.id,tab:"overview"}),children:"Open context"})]}),e.jsx(T,{value:t.description,onChange:s=>void z.mutateAsync({contextId:t.id,patch:{description:s.target.value}}),className:"min-h-20"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(o,{variant:"secondary",onClick:()=>void z.mutateAsync({contextId:t.id,patch:{active:!t.active}}),children:t.active?"Deactivate":"Activate"}),t.isDefault?null:e.jsx(o,{variant:"secondary",onClick:()=>void z.mutateAsync({contextId:t.id,patch:{isDefault:!0}}),children:"Make default"})]})]},t.id))}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs(v,{className:"grid gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Create context"}),e.jsx(x,{value:I.name,onChange:t=>q(s=>({...s,name:t.target.value})),placeholder:"Context name"}),e.jsx(T,{value:I.description,onChange:t=>q(s=>({...s,description:t.target.value})),className:"min-h-24",placeholder:"What changes in this context?"}),e.jsxs("select",{value:I.shareMode,onChange:t=>q(s=>({...s,shareMode:t.target.value})),className:"min-h-10 rounded-[18px] border border-white/8 bg-white/[0.05] px-3 text-sm text-white outline-none",children:[e.jsx("option",{value:"blended",children:"blended"}),e.jsx("option",{value:"shared",children:"shared"}),e.jsx("option",{value:"isolated",children:"isolated"})]}),e.jsx(x,{value:I.decayDays,onChange:t=>q(s=>({...s,decayDays:t.target.value})),placeholder:"Decay days"}),e.jsx(o,{disabled:!I.name.trim(),pending:_e.isPending,pendingLabel:"Creating context",onClick:()=>void _e.mutateAsync({userId:m,domain:w,name:I.name,description:I.description,shareMode:I.shareMode,decayDays:Number(I.decayDays||90),active:!0,isDefault:!1}),children:"Create context"})]}),e.jsxs(v,{className:"grid gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Merge contexts"}),e.jsxs("select",{value:K,onChange:t=>fe(t.target.value),className:"min-h-10 rounded-[18px] border border-white/8 bg-white/[0.05] px-3 text-sm text-white outline-none",children:[e.jsx("option",{value:"",children:"Source context"}),i.contexts.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]}),e.jsxs("select",{value:J,onChange:t=>je(t.target.value),className:"min-h-10 rounded-[18px] border border-white/8 bg-white/[0.05] px-3 text-sm text-white outline-none",children:[e.jsx("option",{value:"",children:"Target context"}),i.contexts.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]}),e.jsx(o,{pending:ze.isPending,pendingLabel:"Merging",disabled:!K||!J||K===J,onClick:()=>void ze.mutateAsync({sourceContextId:K,targetContextId:J}),children:"Merge into target"})]})]})]}):null,S==="concepts"?e.jsxs("div",{className:"grid gap-5",children:[e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.1fr)_380px]",children:[e.jsxs(v,{className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Concept libraries"}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:"These are the lists Forge can use when you start the game in a concept domain. Seeded lists are editable, and custom lists are fully yours."})]}),e.jsx("div",{className:"grid gap-3 md:grid-cols-4",children:[["Lists",i.libraries.totalCatalogs],["Concepts",i.libraries.totalCatalogItems],["Seeded",i.libraries.seededCatalogCount],["Custom",i.libraries.customCatalogCount]].map(([t,s])=>e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:t}),e.jsx("div",{className:"mt-2 font-display text-3xl text-white",children:s})]},t))}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(se,{className:"size-4 text-white/38"}),e.jsx(x,{value:D,onChange:t=>be(t.target.value),placeholder:"Search lists, concepts, tags, and seeded domains"})]})]}),e.jsxs(v,{className:"grid gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Create concept list"}),e.jsx(x,{value:R.title,onChange:t=>oe(s=>({...s,title:t.target.value})),placeholder:"List title"}),e.jsx(T,{value:R.description,onChange:t=>oe(s=>({...s,description:t.target.value})),className:"min-h-24",placeholder:"What should this list help compare?"}),e.jsx(o,{disabled:!R.title.trim(),pending:Pe.isPending,pendingLabel:"Creating list",onClick:()=>void Pe.mutateAsync({userId:m,domain:w,title:R.title,description:R.description}),children:"Create list"})]})]}),e.jsx("div",{className:"grid gap-4",children:ge.map(t=>{const s=ot[t.id]??{label:"",description:"",tags:""},l=t.items.filter(n=>D.trim()?[n.label,n.description,n.tags.join(" ")].join(" ").toLowerCase().includes(ne(D)):!0);return e.jsxs(v,{className:"grid gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsx("div",{className:"min-w-0",children:Ne===t.id?e.jsxs("div",{className:"grid gap-3",children:[e.jsx(x,{value:Z.title,onChange:n=>he(r=>({...r,title:n.target.value}))}),e.jsx(T,{value:Z.description,onChange:n=>he(r=>({...r,description:n.target.value})),className:"min-h-24"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"font-display text-2xl text-white",children:t.title}),e.jsx(y,{className:"bg-white/[0.08] text-white/70",children:t.source}),e.jsxs(y,{className:"bg-white/[0.08] text-white/70",children:[t.items.length," items"]})]}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:t.description||"No description yet."})]})}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(o,{variant:"secondary",size:"sm",onClick:()=>void $e(w,t.id),children:"Start from this list"}),Ne===t.id?e.jsxs(e.Fragment,{children:[e.jsx(o,{size:"sm",pending:Le.isPending,pendingLabel:"Saving",onClick:()=>void Le.mutateAsync({catalogId:t.id,patch:{title:Z.title,description:Z.description}}),children:"Save"}),e.jsx(o,{variant:"ghost",size:"sm",onClick:()=>me(null),children:"Cancel"})]}):e.jsx(o,{variant:"ghost",size:"sm",onClick:()=>{me(t.id),he({title:t.title,description:t.description})},children:"Edit list"}),e.jsx(o,{variant:"ghost",size:"sm",pending:Te.isPending,pendingLabel:"Deleting",onClick:()=>void Te.mutateAsync(t.id),children:"Delete list"})]})]}),e.jsx("div",{className:"grid gap-2",children:l.map(n=>e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-3",children:mt===n.id?e.jsxs("div",{className:"grid gap-3",children:[e.jsx(x,{value:_.label,onChange:r=>V(b=>({...b,label:r.target.value}))}),e.jsx(T,{value:_.description,onChange:r=>V(b=>({...b,description:r.target.value})),className:"min-h-20"}),e.jsx(x,{value:_.tags,onChange:r=>V(b=>({...b,tags:r.target.value})),placeholder:"comma, separated, tags"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(o,{size:"sm",pending:Ae.isPending,pendingLabel:"Saving",onClick:()=>void Ae.mutateAsync({catalogItemId:n.id,patch:{label:_.label,description:_.description,tags:_.tags.split(",").map(r=>r.trim()).filter(Boolean)}}),children:"Save concept"}),e.jsx(o,{variant:"ghost",size:"sm",onClick:()=>xe(null),children:"Cancel"})]})]}):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:"font-medium text-white",children:n.label}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:n.description||"No description yet."}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:n.tags.map(r=>e.jsx(y,{className:"bg-white/[0.08] text-white/70",children:r},`${n.id}-${r}`))})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(o,{variant:"ghost",size:"sm",onClick:()=>{xe(n.id),V({label:n.label,description:n.description,tags:n.tags.join(", ")})},children:"Edit"}),e.jsxs(o,{variant:"ghost",size:"sm",pending:De.isPending,pendingLabel:"Deleting",onClick:()=>void De.mutateAsync(n.id),children:[e.jsx(St,{className:"mr-1 size-4"}),"Delete"]})]})]})},n.id))}),e.jsxs("div",{className:"grid gap-3 rounded-[18px] border border-white/8 bg-white/[0.02] px-4 py-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-white/68",children:[e.jsx(kt,{className:"size-4"}),"Add concept to ",t.title]}),e.jsx(x,{value:s.label,onChange:n=>X(r=>({...r,[t.id]:{...s,label:n.target.value}})),placeholder:"Concept label"}),e.jsx(T,{value:s.description,onChange:n=>X(r=>({...r,[t.id]:{...s,description:n.target.value}})),className:"min-h-20",placeholder:"Short description"}),e.jsx(x,{value:s.tags,onChange:n=>X(r=>({...r,[t.id]:{...s,tags:n.target.value}})),placeholder:"comma, separated, tags"}),e.jsx(o,{disabled:!s.label.trim(),pending:Me.isPending,pendingLabel:"Adding",onClick:()=>void Me.mutateAsync({catalogId:t.id,label:s.label,description:s.description,tags:s.tags.split(",").map(n=>n.trim()).filter(Boolean),featureWeights:ie}).then(()=>X(n=>({...n,[t.id]:{label:"",description:"",tags:""}}))),children:"Add concept"})]})]},t.id)})})]}):null]}),e.jsx(Pt,{open:f.open,onOpenChange:t=>{t||P(null),F(s=>({...s,open:t}))},children:e.jsxs(Lt,{children:[e.jsx(Tt,{className:"fixed inset-0 z-40 bg-[rgba(4,8,18,0.74)] backdrop-blur-xl"}),e.jsxs(Mt,{className:"fixed inset-x-4 bottom-4 top-4 z-50 overflow-y-auto rounded-[32px] border border-white/10 bg-[linear-gradient(180deg,rgba(17,24,39,0.98),rgba(10,14,24,0.98))] shadow-[0_30px_90px_rgba(3,8,18,0.45)] md:inset-x-10 lg:left-1/2 lg:right-auto lg:w-[min(72rem,calc(100vw-3rem))] lg:-translate-x-1/2",children:[e.jsx(At,{className:"sr-only",children:"Preference game"}),e.jsx(Dt,{className:"sr-only",children:"Start comparison rounds from a Forge domain or concept list."}),e.jsxs("div",{className:"sticky top-0 z-10 flex items-center justify-between gap-4 border-b border-white/8 bg-[rgba(10,14,24,0.92)] px-5 py-4 backdrop-blur-xl",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/42",children:"Preference game"}),e.jsx("div",{className:"mt-1 font-display text-2xl text-white",children:f.phase==="domain"?"Choose a domain":f.phase==="catalog"?"Choose a concept list":"Pick the better fit"})]}),e.jsx(Et,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":"Close preference game",className:"rounded-full bg-white/6 p-2 text-white/65 transition hover:bg-white/10 hover:text-white",children:e.jsx(Ft,{className:"size-4"})})})]}),e.jsxs("div",{className:"grid gap-5 px-5 py-5",children:[we?e.jsx("div",{className:"rounded-[18px] border border-rose-400/25 bg-rose-500/10 px-4 py-3 text-sm text-rose-100",children:we}):null,f.phase==="domain"?e.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:ae.map(t=>e.jsxs("button",{type:"button",className:"rounded-[24px] border border-white/8 bg-white/[0.04] px-5 py-5 text-left transition hover:border-[var(--primary)]/30 hover:bg-[var(--primary)]/10",onClick:()=>void ut(t.value),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium text-white",children:t.label}),e.jsx(y,{className:"bg-white/[0.08] text-white/70",children:t.mode==="forge"?"Forge":"Concept"})]}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/56",children:t.description})]},t.value))}):null,f.phase==="catalog"?e.jsxs("div",{className:"grid gap-4",children:[e.jsx("div",{className:"text-sm text-white/58",children:"Pick the concept list Forge should draw from. You do not need to assemble the items yourself."}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(se,{className:"size-4 text-white/38"}),e.jsx(x,{value:D,onChange:t=>be(t.target.value),placeholder:"Search concept lists"})]}),e.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:ge.length>0?ge.map(t=>e.jsxs("button",{type:"button",className:"rounded-[24px] border border-white/8 bg-white/[0.04] px-5 py-5 text-left transition hover:border-[var(--primary)]/30 hover:bg-[var(--primary)]/10",onClick:()=>void $e(f.domain,t.id),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium text-white",children:t.title}),e.jsxs(y,{className:"bg-white/[0.08] text-white/70",children:[t.items.length," items"]})]}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/56",children:t.description||"No description yet."})]},t.id)):e.jsx("div",{className:"rounded-[24px] bg-white/[0.04] px-5 py-6 text-sm text-white/58",children:"No concept list matches that search yet."})})]}):null,f.phase==="play"?e.jsx("div",{className:"grid gap-5",children:ct||Ie.isLoading?e.jsx(tt,{eyebrow:"Preference game",title:"Preparing the next round",description:"Forge is lining up comparison candidates."}):A?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-white/52",children:[e.jsx(y,{className:"bg-white/[0.08] text-white/70",children:((Ke=ae.find(t=>t.value===f.domain))==null?void 0:Ke.label)??f.domain}),e.jsx("span",{children:g==null?void 0:g.selectedContext.name}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[(g==null?void 0:g.compare.pendingCount)??0," ","queued comparisons"]})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsx(nt,{title:A.left.label,description:A.left.description,sideLabel:"Left",onClick:()=>void L("left",1)}),e.jsx(nt,{title:A.right.label,description:A.right.description,sideLabel:"Right",onClick:()=>void L("right",1)})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(o,{onClick:()=>void L("left",1),children:"Left"}),e.jsx(o,{onClick:()=>void L("right",1),children:"Right"}),e.jsx(o,{variant:"secondary",onClick:()=>void L("left",1.75),children:"Strong left"}),e.jsx(o,{variant:"secondary",onClick:()=>void L("right",1.75),children:"Strong right"}),e.jsx(o,{variant:"secondary",onClick:()=>void L("tie",1),children:"Tie"}),e.jsx(o,{variant:"secondary",onClick:()=>void L("skip",1),children:"Skip"})]}),e.jsx("div",{className:"grid gap-4 rounded-[24px] border border-white/8 bg-white/[0.03] px-4 py-4 lg:grid-cols-2",children:[A.left,A.right].map(t=>e.jsxs("div",{className:"grid gap-3",children:[e.jsx("div",{className:"font-medium text-white",children:t.label}),e.jsx("div",{className:"text-sm text-white/56",children:"Quick signals"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:ns.map(s=>e.jsx(o,{variant:"secondary",size:"sm",onClick:()=>void vt(t.id,s.signalType),children:s.label},`${t.id}-${s.signalType}`))})]},t.id))})]}):e.jsx(et,{eyebrow:"Preference game",title:"No pair is ready yet",description:"Forge needs more items in this domain before it can keep asking comparisons."})}):null]})]})]})})]})}export{js as PreferencesPage};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{j as t,aC as ue,b8 as pe,c2 as ye,r as v}from"./vendor-DHkYh85p.js";import{j as ve,i as g,k as ge}from"./state-B-4sS1xO.js";import{u as fe,s as xe,co as be,cp as we,bk as P,bl as N,cq as T,L as je,E as ke,B,V as Ce,ck as Ie,c as Se,U as Pe,_ as Ne,Q as Te,a0 as Be,a1 as Le,F as i,I as Me,T as d,m as S,cr as Ee,cs as Fe,ct as qe,by as Oe,bx as Ae,bw as Qe,cu as De,bA as Ke}from"./index-CF4J4R9L.js";import{E as Re}from"./entity-note-count-link-DrhjJZ4i.js";import{A as G}from"./atlas-panel-CdVNPotj.js";import{S as _}from"./schema-badge-BZO-qNhO.js";import{u as Ue,p as $e}from"./use-psyche-focus-target-C1C_XjYG.js";import{P as We}from"./page-hero-DRy5b2MU.js";import{p as L}from"./query-cache-IQ8W-LNC.js";import{b as H}from"./psyche-schemas-HFmg37Wj.js";import{g as ze}from"./schema-visuals-D6nxjbYC.js";import"./board-BkDRaMp6.js";import"./ui-C13Nbgas.js";import"./motion-BeD44FeG.js";import"./forms-BFlTgZ3W.js";import"./graph-D6JLqDbD.js";function Ve({entries:r}){const n={away:"border-rose-400/20 bg-[rgba(251,113,133,0.08)]",committed:"border-emerald-400/20 bg-[rgba(110,231,183,0.08)]",recovery:"border-amber-400/20 bg-[rgba(251,191,36,0.08)]"};return t.jsx("div",{className:"grid gap-3 lg:grid-cols-3",children:r.map(o=>t.jsxs(ue,{to:o.href,className:`rounded-[22px] border px-4 py-4 transition hover:-translate-y-0.5 ${n[o.tone]}`,children:[t.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/40",children:o.tone}),t.jsx("div",{className:"mt-2 font-medium text-white",children:o.title}),t.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:o.summary}),t.jsxs("div",{className:"mt-4 inline-flex items-center gap-2 text-sm text-white/54",children:["Open",t.jsx(pe,{className:"size-3.5"})]})]},o.id))})}const f={kind:"away",title:"",description:"",commonCues:[],urgeStory:"",shortTermPayoff:"",longTermCost:"",replacementMove:"",repairPlan:"",linkedPatternIds:[],linkedValueIds:[],linkedSchemaIds:[],linkedModeIds:[],userId:null};function Ge(r){return{kind:r.kind,title:r.title,description:r.description,commonCues:r.commonCues,urgeStory:r.urgeStory,shortTermPayoff:r.shortTermPayoff,longTermCost:r.longTermCost,replacementMove:r.replacementMove,repairPlan:r.repairPlan,linkedPatternIds:r.linkedPatternIds,linkedValueIds:r.linkedValueIds,linkedSchemaIds:r.linkedSchemaIds,linkedModeIds:r.linkedModeIds,userId:r.userId??null}}const J={away:"Away moves",committed:"Committed actions",recovery:"Recovery moves"};function ct(){var O,A,Q,D,K,R,U,$,W,z,V;const r=fe(),n=ve(),[o,M]=ye(),[X,c]=v.useState(!1),[h,p]=v.useState(null),[y,m]=v.useState(f),[Y,x]=v.useState(null),b=g({queryKey:["forge-psyche-behaviors"],queryFn:Oe}),w=g({queryKey:["forge-psyche-patterns"],queryFn:Ae}),j=g({queryKey:["forge-psyche-values"],queryFn:Qe}),k=g({queryKey:["forge-psyche-schema-catalog"],queryFn:De}),C=g({queryKey:["forge-psyche-modes"],queryFn:Ke}),I=((O=b.data)==null?void 0:O.behaviors)??[],Z=((A=w.data)==null?void 0:A.patterns)??[],ee=((Q=j.data)==null?void 0:Q.values)??[],te=((D=k.data)==null?void 0:D.schemas)??[],ae=((K=C.data)==null?void 0:K.modes)??[],u=xe(r.selectedUserIds),E=o.get("focus"),se=r.snapshot.dashboard.notesSummaryByEntity;Ue(E),v.useEffect(()=>{if(o.get("create")==="1"){c(!0),p(null),m({...f,userId:u});const e=new URLSearchParams(o);e.delete("create"),M(e,{replace:!0})}},[u,o,M]);const F=ge({mutationFn:async e=>{const a=H.parse(e);return h?be(h.id,a):we(a)},onSuccess:async()=>{c(!1),p(null),m({...f,userId:u}),x(null),await Promise.all([n.invalidateQueries({queryKey:["forge-psyche-behaviors"]}),n.invalidateQueries({queryKey:["forge-psyche-overview"]})])}}),re=Z.map(e=>({value:e.id,label:T(e.title,e.user),description:N(e.preferredResponse||e.targetBehavior,e.user),searchText:P([e.title,e.preferredResponse,e.targetBehavior,e.description],e),kind:"pattern"})),ie=ee.map(e=>({value:e.id,label:T(e.title,e.user),description:N(e.valuedDirection,e.user),searchText:P([e.title,e.valuedDirection,e.description],e),kind:"value"})),oe=te.map(e=>({value:e.id,label:e.title,description:`${e.description} ${ze(e.family)}`,searchText:`${e.slug} ${e.family} ${e.schemaType}`,badge:t.jsx(_,{label:e.title,schemaType:e.schemaType,compact:!0}),menuBadge:t.jsx(_,{label:e.title,schemaType:e.schemaType,compact:!0})})),ne=ae.map(e=>({value:e.id,label:T(e.title,e.user),description:N(e.archetype||e.family,e.user),searchText:P([e.title,e.archetype,e.family,e.persona],e),kind:"mode"})),le=async e=>{const{pattern:a}=await Ee({title:e,description:"",targetBehavior:e,cueContexts:[],shortTermPayoff:"",longTermCost:"",preferredResponse:"",linkedValueIds:[],linkedSchemaLabels:[],linkedModeIds:[],linkedBeliefIds:[],userId:y.userId});return L(n,["forge-psyche-patterns"],"patterns",a),await n.invalidateQueries({queryKey:["forge-psyche-overview"]}),{value:a.id,label:a.title,description:a.preferredResponse||a.targetBehavior,kind:"pattern"}},de=async e=>{const{value:a}=await Fe({title:e,description:"",valuedDirection:e,whyItMatters:"",linkedGoalIds:[],linkedProjectIds:[],linkedTaskIds:[],committedActions:[],userId:y.userId});return L(n,["forge-psyche-values"],"values",a),await n.invalidateQueries({queryKey:["forge-psyche-overview"]}),{value:a.id,label:a.title,description:a.valuedDirection,kind:"value"}},ce=async e=>{const{mode:a}=await qe({family:"coping",archetype:"",title:e,persona:"",imagery:"",symbolicForm:"",facialExpression:"",fear:"",burden:"",protectiveJob:"",originContext:"",firstAppearanceAt:null,linkedPatternIds:[],linkedBehaviorIds:[],linkedValueIds:[],userId:y.userId});return L(n,["forge-psyche-modes"],"modes",a),await n.invalidateQueries({queryKey:["forge-psyche-overview"]}),{value:a.id,label:a.title,description:a.archetype||a.family,kind:"mode"}},he=[{id:"behavior",eyebrow:"Behavior",title:"Describe the move or urge in plain language",description:"Start with the behavior itself so the map reads like something you can instantly recognize in real life.",render:(e,a)=>t.jsxs(t.Fragment,{children:[t.jsx(Be,{value:e.userId??null,users:r.snapshot.users,onChange:s=>a({userId:s}),defaultLabel:Le(r.snapshot.users.find(s=>s.id===u)??null,"Choose behavior owner"),help:"Behaviors can belong to a human or bot user while still linking across shared patterns, schemas, and modes."}),t.jsx(i,{label:"Behavior title",children:t.jsx(Me,{value:e.title,onChange:s=>a({title:s.target.value}),placeholder:"Scroll to numb the impact"})}),t.jsx(i,{label:"What does the move look like?",children:t.jsx(d,{value:e.description,onChange:s=>a({description:s.target.value}),placeholder:"Describe the move the way you would recognize it in the moment, not in therapist shorthand."})})]})},{id:"context",eyebrow:"Context",title:"Capture the cue, the pull, and the immediate payoff",description:"Make the move readable as a real pattern instead of a label.",render:(e,a)=>t.jsxs(t.Fragment,{children:[t.jsx(i,{label:"Common cues",children:t.jsx(d,{value:e.commonCues.join(`
|
|
2
|
-
`),onChange:s=>a({commonCues:s.target.value.split(`
|
|
3
|
-
`).map(me=>me.trim()).filter(Boolean)}),placeholder:`One line per cue
|
|
4
|
-
Late-night ambiguity
|
|
5
|
-
Feedback after a hard week`})}),t.jsx(i,{label:"What inner push or story shows up?",children:t.jsx(d,{value:e.urgeStory,onChange:s=>a({urgeStory:s.target.value}),placeholder:"What inner push or justification tends to appear?"})}),t.jsx(i,{label:"What do you get right away from this move?",children:t.jsx(d,{value:e.shortTermPayoff,onChange:s=>a({shortTermPayoff:s.target.value}),placeholder:"What relief, certainty, distance, or control does it give in the short term?"})})]})},{id:"classification",eyebrow:"Classification",title:"Now classify the move and define the return path",description:"Once the move is clear, decide whether it is an away move, a committed action, or a recovery path.",render:(e,a)=>t.jsxs(t.Fragment,{children:[t.jsx(i,{label:"Move type",children:t.jsx("div",{className:"grid gap-3 md:grid-cols-3",children:["away","committed","recovery"].map(s=>t.jsx("button",{type:"button",className:`rounded-[22px] border px-4 py-4 text-left transition ${e.kind===s?"border-white/20 bg-white/[0.12] text-white":"border-white/8 bg-white/[0.04] text-white/62 hover:bg-white/[0.07]"}`,onClick:()=>a({kind:s}),children:J[s]},s))})}),t.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[t.jsx(i,{label:"What does it cost over time?",children:t.jsx(d,{value:e.longTermCost,onChange:s=>a({longTermCost:s.target.value}),placeholder:"What does this move cost over time?"})}),t.jsx(i,{label:"What move should replace or steady it?",children:t.jsx(d,{value:e.replacementMove,onChange:s=>a({replacementMove:s.target.value}),placeholder:"What move should replace this one when possible?"})})]}),t.jsx(i,{label:"If the slip happens, how do you repair and return?",children:t.jsx(d,{value:e.repairPlan,onChange:s=>a({repairPlan:s.target.value}),placeholder:"Describe the repair path without shame or collapse."})})]})},{id:"links",eyebrow:"Links",title:"Attach the move to patterns, values, schemas, and modes",description:"This turns the move into part of the full graphical psyche system.",render:(e,a)=>t.jsxs(t.Fragment,{children:[t.jsx(i,{label:"Linked patterns",children:t.jsx(S,{options:re,selectedValues:e.linkedPatternIds,onChange:s=>a({linkedPatternIds:s}),placeholder:"Search or create a pattern…",emptyMessage:"No patterns match yet.",createLabel:"Create pattern",onCreate:le})}),t.jsx(i,{label:"Linked values",children:t.jsx(S,{options:ie,selectedValues:e.linkedValueIds,onChange:s=>a({linkedValueIds:s}),placeholder:"Search or create a value…",emptyMessage:"No values match yet.",createLabel:"Create value",onCreate:de})}),t.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[t.jsx(i,{label:"Linked schemas",children:t.jsx(S,{options:oe,selectedValues:e.linkedSchemaIds,onChange:s=>a({linkedSchemaIds:s}),placeholder:"Search schema themes…",emptyMessage:"No schema themes match."})}),t.jsx(i,{label:"Linked modes",children:t.jsx(S,{options:ne,selectedValues:e.linkedModeIds,onChange:s=>a({linkedModeIds:s}),placeholder:"Search or create a mode…",emptyMessage:"No modes match yet.",createLabel:"Create mode",onCreate:ce})})]})]})}];if(b.isLoading||w.isLoading||j.isLoading||k.isLoading||C.isLoading)return t.jsx(je,{eyebrow:"Behaviors",title:"Loading behaviors",description:"Getting behaviors, patterns, values, schemas, and modes ready."});const q=b.error??w.error??j.error??k.error??C.error;if(q)return t.jsx(ke,{eyebrow:"Psyche behaviors",error:q,onRetry:()=>void Promise.all([b.refetch(),w.refetch(),j.refetch(),k.refetch(),C.refetch()])});const l={away:I.filter(e=>e.kind==="away"),committed:I.filter(e=>e.kind==="committed"),recovery:I.filter(e=>e.kind==="recovery")};return t.jsxs("div",{className:"grid gap-5",children:[t.jsx(We,{entityKind:"behavior",title:t.jsx(Ce,{kind:"behavior",label:"Behaviors",variant:"heading",size:"lg"}),description:"Group behaviors by what pulls you away, what moves you toward your values, and what helps you recover after a slip.",badge:`${I.length} mapped`,actions:t.jsx(B,{onClick:()=>{p(null),m({...f,userId:u}),c(!0)},children:"Add behavior"})}),t.jsx(Ie,{}),t.jsx(G,{eyebrow:"Overview",title:"Behavior summary",description:"This summary keeps the three behavior types visible together: away, committed, and recovery.",tone:"amber",children:t.jsx(Ve,{entries:[{id:"away",title:((R=l.away[0])==null?void 0:R.title)??"No away move mapped yet",summary:((U=l.away[0])==null?void 0:U.replacementMove)||"Map the move that tends to pull you away first.",href:"#behavior-columns",tone:"away"},{id:"committed",title:(($=l.committed[0])==null?void 0:$.title)??"No committed action mapped yet",summary:((W=l.committed[0])==null?void 0:W.replacementMove)||"Map the move you want to practice instead.",href:"#behavior-columns",tone:"committed"},{id:"recovery",title:((z=l.recovery[0])==null?void 0:z.title)??"No recovery move mapped yet",summary:((V=l.recovery[0])==null?void 0:V.repairPlan)||"Map how you return after a slip without turning it into collapse.",href:"#behavior-columns",tone:"recovery"}]})}),t.jsx(G,{eyebrow:"Behaviors",title:"Behaviors by type",description:"Use these columns to separate what pulls you off course, what helps you move toward your values, and what helps you recover.",tone:"default",children:t.jsx("div",{id:"behavior-columns",className:"grid gap-4 xl:grid-cols-3",children:["away","committed","recovery"].map(e=>t.jsxs("div",{className:"grid gap-3 rounded-[24px] bg-white/[0.04] p-4",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("div",{className:"font-medium text-white",children:J[e]}),t.jsx(Se,{children:l[e].length})]}),l[e].length===0?t.jsx("div",{className:"flex",children:t.jsxs(B,{variant:"secondary",onClick:()=>{p(null),m({...f,userId:u}),c(!0)},children:["Add"," ",e==="away"?"away move":e==="committed"?"committed action":"recovery move"]})}):l[e].map(a=>t.jsxs("div",{"data-psyche-focus-id":a.id,className:`rounded-[22px] border border-white/8 bg-white/[0.04] p-4 text-left transition hover:bg-white/[0.08] ${$e(E===a.id)}`,children:[t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("div",{className:"font-medium text-white",children:a.title}),a.user?t.jsx(Pe,{user:a.user,compact:!0}):null]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx(Re,{entityType:"behavior",entityId:a.id,count:Ne(se,"behavior",a.id).count}),t.jsx(B,{variant:"secondary",size:"sm",onClick:()=>{p(a),m(Ge(a)),c(!0)},children:"Edit"})]})]}),t.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:a.description}),t.jsx("div",{className:"mt-3 text-sm text-white/46",children:a.replacementMove||a.repairPlan||"No recovery step recorded yet."})]},a.id))]},e))})}),t.jsx(Te,{open:X,onOpenChange:c,eyebrow:"Behavior",title:h?"Refine behavior path":"Create behavior",description:"Use this guided flow to describe the behavior, when it shows up, what it gives you, and what kind of move it is.",value:y,onChange:m,draftPersistenceKey:h?`psyche.behavior.${h.id}`:"psyche.behavior.new",steps:he,submitLabel:h?"Save behavior":"Create behavior",pending:F.isPending,error:Y,onSubmit:async()=>{x(null);const e=H.safeParse(y);if(!e.success){x("This behavior still needs a kind and a title before it can be saved.");return}try{await F.mutateAsync(e.data)}catch(a){x(a instanceof Error?a.message:"Unable to save this behavior right now.")}}})]})}export{ct as PsycheBehaviorsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c2 as T,r as h,j as e,b4 as B,b3 as z,cI as M,aG as R,aK as q}from"./vendor-DHkYh85p.js";import{j as Q,i as K,k as L}from"./state-B-4sS1xO.js";import{u as O,s as Y,cv as H,cw as V,cx as W,L as G,E as X,B as S,ck as Z,I as x,c as N,U as D,Z as y,T as J,a0 as $,a1 as ee,bB as se}from"./index-CF4J4R9L.js";import{u as te,p as ae}from"./use-psyche-focus-target-C1C_XjYG.js";import{P as le}from"./page-hero-DRy5b2MU.js";import{f as ie}from"./psyche-schemas-HFmg37Wj.js";import"./board-BkDRaMp6.js";import"./ui-C13Nbgas.js";import"./motion-BeD44FeG.js";import"./forms-BFlTgZ3W.js";import"./graph-D6JLqDbD.js";const w={title:"",message:"",triggerSentence:"",triggerSituation:"",tags:[],backgroundColor:"#f8fafc",textColor:"#111827",accentColor:"#6ee7b7",typography:"serif",imageUrl:"",imageAlt:"",layout:"centered",visualStyle:"calm",linkedValueIds:[],linkedBehaviorIds:[],linkedPatternIds:[],linkedBeliefIds:[],linkedModeIds:[],linkedReportIds:[],userId:null},re={serif:"font-serif",sans:"font-sans",mono:"font-mono",display:"font-display"},ne={calm:"Calm",urgent:"Urgent",warm:"Warm",clinical:"Clinical",playful:"Playful"};function oe(s){return s.split(",").map(r=>r.trim()).filter(Boolean)}function _(s){return{title:s.title,message:s.message,triggerSentence:s.triggerSentence,triggerSituation:s.triggerSituation,tags:s.tags,backgroundColor:s.backgroundColor,textColor:s.textColor,accentColor:s.accentColor,typography:s.typography,imageUrl:s.imageUrl,imageAlt:s.imageAlt,layout:s.layout,visualStyle:s.visualStyle,linkedValueIds:s.linkedValueIds,linkedBehaviorIds:s.linkedBehaviorIds,linkedPatternIds:s.linkedPatternIds,linkedBeliefIds:s.linkedBeliefIds,linkedModeIds:s.linkedModeIds,linkedReportIds:s.linkedReportIds,userId:s.userId??null}}function A({card:s,compact:r=!1,focused:t=!1,onClick:p}){const c=s.imageUrl.trim().length>0,n=s.layout,d=s.title.trim(),v=s.triggerSentence.trim()||s.triggerSituation.trim();return e.jsxs("button",{type:"button",className:y("group min-w-0 rounded-[26px] border p-2 text-left shadow-[0_26px_80px_rgba(3,8,18,0.28)] transition hover:-translate-y-0.5 hover:border-white/20",t?"border-[rgba(110,231,183,0.8)]":"border-white/10"),onClick:p,children:[e.jsxs("div",{className:y("relative grid min-h-[18rem] overflow-hidden rounded-[20px] border",r?"min-h-[15rem]":"sm:min-h-[21rem]",n==="image_split"&&c?"md:grid-cols-[0.9fr_1.1fr]":""),style:{background:s.backgroundColor,color:s.textColor,borderColor:s.accentColor},children:[c&&n!=="image_split"?e.jsx("img",{src:s.imageUrl,alt:s.imageAlt||d||"Flashcard image",className:"absolute inset-0 size-full object-cover opacity-30"}):null,c&&n==="image_split"?e.jsx("div",{className:"relative min-h-[10rem] overflow-hidden",children:e.jsx("img",{src:s.imageUrl,alt:s.imageAlt||d||"Flashcard image",className:"absolute inset-0 size-full object-cover"})}):null,e.jsxs("div",{className:y("relative z-10 flex min-w-0 flex-col p-6",n==="top_left"?"items-start justify-start":"items-center justify-center text-center",n==="poster"?"min-h-[22rem] p-8":"",re[s.typography]),children:[e.jsx("div",{className:"mb-5 h-1.5 w-16 rounded-full",style:{backgroundColor:s.accentColor}}),e.jsx("div",{className:y("max-w-[24rem] text-balance leading-[1.12]",r?"text-2xl":"text-[clamp(1.9rem,4vw,3.45rem)]"),children:s.message||"Write the sentence that should meet you in the hard moment."}),v?e.jsx("div",{className:"mt-6 max-w-md rounded-full border px-3 py-1.5 text-xs font-medium opacity-75",style:{borderColor:s.accentColor},children:v}):null]})]}),e.jsxs("div",{className:"px-2 pt-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[d?e.jsx("div",{className:"truncate text-sm font-semibold text-white",children:d}):null,e.jsx(N,{className:"bg-white/[0.06] text-white/70",children:ne[s.visualStyle]})]}),s.tags.length>0?e.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:s.tags.slice(0,5).map(o=>e.jsx("span",{className:"rounded-full bg-white/[0.06] px-2 py-1 text-[11px] text-white/55",children:o},o))}):null]})]})}function ce({open:s,editingCard:r,draft:t,users:p,suggestedOwner:c,submitError:n,saving:d,onClose:v,onDelete:o,onDraftChange:i,onSubmit:m}){return s?e.jsx("div",{className:"fixed inset-0 z-50 flex items-end justify-center bg-[rgba(3,8,18,0.76)] px-3 py-4 backdrop-blur-xl sm:items-center sm:p-6",children:e.jsxs("div",{className:"max-h-[min(92dvh,58rem)] w-full max-w-6xl overflow-hidden rounded-[30px] border border-white/10 bg-[linear-gradient(180deg,rgba(17,24,39,0.98),rgba(7,12,22,0.98))] shadow-[0_42px_120px_rgba(0,0,0,0.5)]",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-white/8 px-5 py-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.2em] text-[var(--tertiary)]",children:r?"Edit flashcard":"New flashcard"}),e.jsx("div",{className:"mt-1 text-lg font-semibold text-white",children:"Message first, retrieval second, styling last."})]}),e.jsx("button",{type:"button","aria-label":"Close flashcard editor",className:"inline-flex size-10 shrink-0 items-center justify-center rounded-full border border-white/10 bg-white/[0.06] text-white/65 hover:bg-white/[0.1]",onClick:v,children:e.jsx(q,{className:"size-4"})})]}),e.jsxs("div",{className:"grid max-h-[calc(min(92dvh,58rem)-5rem)] min-h-0 overflow-y-auto p-4 md:grid-cols-[1fr_0.9fr] md:p-5",children:[e.jsxs("div",{className:"grid content-start gap-4 pr-0 md:pr-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-white/48",children:"Main message"}),e.jsx(J,{className:"mt-2 min-h-28",value:t.message,placeholder:"This urge is a wave. You do not have to obey it.",onChange:l=>i({...t,message:l.target.value})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-white/48",children:"Trigger sentence"}),e.jsx(x,{className:"mt-2",value:t.triggerSentence,placeholder:"I feel the urge to…",onChange:l=>i({...t,triggerSentence:l.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-white/48",children:"Optional title"}),e.jsx(x,{className:"mt-2",value:t.title,placeholder:"Late-night urge card",onChange:l=>i({...t,title:l.target.value})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-white/48",children:"Trigger situation"}),e.jsx(x,{className:"mt-2",value:t.triggerSituation,placeholder:"Late evening shame, loneliness, conflict, or boredom",onChange:l=>i({...t,triggerSituation:l.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-white/48",children:"Tags"}),e.jsx(x,{className:"mt-2",value:t.tags.join(", "),placeholder:"urge, sobriety, grounding",onChange:l=>i({...t,tags:oe(l.target.value)})})]}),e.jsx("div",{className:"grid gap-4 sm:grid-cols-3",children:[["backgroundColor","Background"],["textColor","Text"],["accentColor","Accent"]].map(([l,u])=>e.jsxs("label",{className:"grid gap-2 text-xs font-semibold uppercase tracking-[0.16em] text-white/48",children:[u,e.jsx("input",{type:"color",value:String(t[l]),className:"h-11 w-full rounded-[16px] border border-white/10 bg-white/[0.05] p-1",onChange:k=>i({...t,[l]:k.target.value})})]},l))}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[e.jsxs("label",{className:"grid gap-2 text-xs font-semibold uppercase tracking-[0.16em] text-white/48",children:["Typography",e.jsxs("select",{className:"h-11 rounded-[16px] border border-white/10 bg-[rgba(15,23,42,0.95)] px-3 text-sm normal-case tracking-normal text-white",value:t.typography,onChange:l=>i({...t,typography:l.target.value}),children:[e.jsx("option",{value:"serif",children:"Serif"}),e.jsx("option",{value:"sans",children:"Sans"}),e.jsx("option",{value:"mono",children:"Mono"}),e.jsx("option",{value:"display",children:"Display"})]})]}),e.jsxs("label",{className:"grid gap-2 text-xs font-semibold uppercase tracking-[0.16em] text-white/48",children:["Layout",e.jsxs("select",{className:"h-11 rounded-[16px] border border-white/10 bg-[rgba(15,23,42,0.95)] px-3 text-sm normal-case tracking-normal text-white",value:t.layout,onChange:l=>i({...t,layout:l.target.value}),children:[e.jsx("option",{value:"centered",children:"Centered"}),e.jsx("option",{value:"top_left",children:"Top left"}),e.jsx("option",{value:"image_split",children:"Image split"}),e.jsx("option",{value:"poster",children:"Poster"})]})]}),e.jsxs("label",{className:"grid gap-2 text-xs font-semibold uppercase tracking-[0.16em] text-white/48",children:["Tone",e.jsxs("select",{className:"h-11 rounded-[16px] border border-white/10 bg-[rgba(15,23,42,0.95)] px-3 text-sm normal-case tracking-normal text-white",value:t.visualStyle,onChange:l=>i({...t,visualStyle:l.target.value}),children:[e.jsx("option",{value:"calm",children:"Calm"}),e.jsx("option",{value:"urgent",children:"Urgent"}),e.jsx("option",{value:"warm",children:"Warm"}),e.jsx("option",{value:"clinical",children:"Clinical"}),e.jsx("option",{value:"playful",children:"Playful"})]})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-white/48",children:"Image URL"}),e.jsx(x,{className:"mt-2",value:t.imageUrl,placeholder:"https://…",onChange:l=>i({...t,imageUrl:l.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-white/48",children:"Image alt"}),e.jsx(x,{className:"mt-2",value:t.imageAlt,placeholder:"Describe the image",onChange:l=>i({...t,imageAlt:l.target.value})})]})]}),e.jsx($,{users:p,value:t.userId??null,defaultLabel:ee(c,"Choose flashcard owner"),onChange:l=>i({...t,userId:l}),help:"Flashcards can belong to a human or bot owner while still being searchable by trigger, tags, and linked Psyche records."}),n?e.jsx("div",{className:"rounded-[18px] border border-red-300/20 bg-red-400/10 px-4 py-3 text-sm text-red-100",children:n}):null,e.jsxs("div",{className:"flex flex-wrap justify-between gap-3",children:[r?e.jsx(S,{type:"button",variant:"ghost",onClick:o,children:"Delete"}):e.jsx("span",{}),e.jsx(S,{type:"button",disabled:d,onClick:m,children:d?"Saving...":"Save flashcard"})]})]}),e.jsx("div",{className:"mt-5 min-w-0 md:mt-0",children:e.jsx(A,{card:t,compact:!0})})]})]})}):null}function ye(){var F;const s=O(),r=Q(),[t,p]=T(),c=t.get("focus"),[n,d]=h.useState(""),[v,o]=h.useState(!1),[i,m]=h.useState(null),[l,u]=h.useState(w),[k,C]=h.useState(null),b=Y(s.selectedUserIds),E=s.snapshot.users.find(a=>a.id===b)??null;te(c);const j=K({queryKey:["forge-psyche-flashcards",s.selectedUserIds],queryFn:()=>se(s.selectedUserIds)});h.useEffect(()=>{if(t.get("create")==="1"){m(null),u({...w,userId:b}),o(!0);const a=new URLSearchParams(t);a.delete("create"),p(a,{replace:!0})}},[b,t,p]);const P=L({mutationFn:async a=>{const g=ie.parse(a);return i?H(i.id,g):V(g)},onSuccess:async()=>{o(!1),m(null),u({...w,userId:b}),C(null),await Promise.all([r.invalidateQueries({queryKey:["forge-psyche-flashcards"]}),r.invalidateQueries({queryKey:["forge-psyche-overview"]})])},onError:a=>{C(a instanceof Error?a.message:String(a))}}),U=L({mutationFn:async a=>W(a.id),onSuccess:async()=>{o(!1),m(null),await Promise.all([r.invalidateQueries({queryKey:["forge-psyche-flashcards"]}),r.invalidateQueries({queryKey:["forge-psyche-overview"]})])}}),f=((F=j.data)==null?void 0:F.flashcards)??[],I=h.useMemo(()=>{const a=n.trim().toLowerCase();return a?f.filter(g=>[g.title,g.message,g.triggerSentence,g.triggerSituation,...g.tags].join(" ").toLowerCase().includes(a)):f},[f,n]);return j.isLoading?e.jsx(G,{title:"Loading Psyche flashcards"}):j.isError?e.jsx(X,{eyebrow:"Psyche",error:j.error,onRetry:()=>void j.refetch()}):e.jsxs("div",{className:"grid gap-6",children:[e.jsx(le,{title:"Flashcards",titleText:"Flashcards",description:"Small therapeutic reminder cards for urges, trigger moments, mode shifts, and values-based pivots.",actions:e.jsxs(S,{type:"button",onClick:()=>{m(null),u({...w,userId:b}),o(!0)},children:[e.jsx(B,{className:"mr-2 size-4"}),"New flashcard"]})}),e.jsx(Z,{}),e.jsxs("div",{className:"grid gap-4 rounded-[26px] border border-white/10 bg-white/[0.04] p-4 md:grid-cols-[1fr_auto] md:items-center",children:[e.jsxs("div",{className:"relative min-w-0",children:[e.jsx(z,{className:"pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-white/38"}),e.jsx(x,{value:n,placeholder:"Search message, tags, trigger sentence, or situation",className:"pl-10",onChange:a=>d(a.target.value)})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 text-sm text-white/52",children:[e.jsxs(N,{className:"bg-white/[0.06] text-white/70",children:[f.length," saved"]}),e.jsxs(N,{className:"bg-white/[0.06] text-white/70",children:[I.length," visible"]})]})]}),I.length>0?e.jsx("div",{className:"grid gap-5 lg:grid-cols-2 2xl:grid-cols-3",children:I.map(a=>e.jsxs("div",{className:ae(c===a.id),children:[e.jsx(A,{card:a,focused:c===a.id,onClick:()=>{m(a),u(_(a)),o(!0)}}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-2 px-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.user?e.jsx(D,{user:a.user,compact:!0}):null,a.imageUrl?e.jsxs(N,{className:"bg-white/[0.06] text-white/60",children:[e.jsx(M,{className:"mr-1 size-3"}),"image"]}):null]}),e.jsx(S,{type:"button",variant:"ghost",onClick:()=>{m(a),u(_(a)),o(!0)},children:"Edit"})]})]},a.id))}):e.jsxs("div",{className:"rounded-[30px] border border-white/10 bg-[linear-gradient(135deg,rgba(110,231,183,0.08),rgba(96,165,250,0.08))] p-8 text-center",children:[e.jsx(R,{className:"mx-auto size-8 text-[var(--tertiary)]"}),e.jsx("div",{className:"mt-4 text-xl font-semibold text-white",children:"No flashcards match this view."}),e.jsx("div",{className:"mx-auto mt-2 max-w-xl text-sm leading-6 text-white/58",children:"Create cards for the sentences you want available during urges, shame spirals, critic attacks, and values-based pivots."})]}),e.jsx(ce,{open:v,editingCard:i,draft:l,users:s.snapshot.users,suggestedOwner:E,submitError:k,saving:P.isPending||U.isPending,onClose:()=>{o(!1),m(null),C(null)},onDelete:()=>{i&&U.mutateAsync(i)},onDraftChange:u,onSubmit:()=>void P.mutateAsync(l)})]})}export{ye as PsycheFlashcardsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as p,j as e,aC as m}from"./vendor-DHkYh85p.js";import{i as k}from"./state-B-4sS1xO.js";import{b as N,P as I}from"./psyche-graph-k4tX2tdp.js";import{u as S,L as G,E as P,ck as E,C as K,b as L,V as B,c as f,Z as V,cm as C,ad as H}from"./index-CF4J4R9L.js";import{P as M}from"./page-hero-DRy5b2MU.js";import"./board-BkDRaMp6.js";import"./ui-C13Nbgas.js";import"./motion-BeD44FeG.js";import"./forms-BFlTgZ3W.js";import"./graph-D6JLqDbD.js";function T(){var u;const r=S(),[x,g]=p.useState(null),l=k({queryKey:["forge-psyche-overview"],queryFn:H}),n=(u=l.data)==null?void 0:u.overview,o=p.useMemo(()=>n?r.snapshot.goals.map(i=>{const h=n.values.filter(s=>s.linkedGoalIds.includes(i.id)),w=r.snapshot.dashboard.projects.filter(s=>s.goalId===i.id),b=r.snapshot.habits.filter(s=>s.linkedGoalIds.includes(i.id)||s.linkedValueIds.some(d=>h.some(c=>c.id===d))),y=n.reports.filter(s=>s.linkedGoalIds.includes(i.id)),v=n.behaviors.filter(s=>s.linkedValueIds.some(d=>h.some(c=>c.id===d))),j=n.beliefs.filter(s=>s.linkedValueIds.some(d=>h.some(c=>c.id===d)));return{goal:i,linkedValues:h,linkedProjects:w,linkedHabits:b,linkedReports:y,linkedBehaviors:v,linkedBeliefs:j}}):[],[n,r.snapshot.dashboard.projects,r.snapshot.goals,r.snapshot.habits]),a=p.useMemo(()=>N(o),[o]);if(p.useEffect(()=>{g(a.defaultSelectedId)},[a.defaultSelectedId]),l.isLoading)return e.jsx(G,{eyebrow:"Goal map",title:"Loading the gravity well",description:"Linking goals, values, reports, beliefs, behaviors, and projects back into execution."});if(l.isError||!n)return e.jsx(P,{eyebrow:"Goal map",error:l.error??new Error("Forge returned an empty Psyche overview payload."),onRetry:()=>void l.refetch()});const t=a.inspectors[x??a.defaultSelectedId]??a.inspectors[a.defaultSelectedId];return e.jsxs("div",{className:"grid min-w-0 gap-4",children:[e.jsx(M,{title:"Goal Map",titleText:"Goal Map",description:"Values orbit each goal. Habits, reports, beliefs, behaviors, and projects reveal where the orbit gets disrupted and how execution reconnects.",badge:`${o.length} goal${o.length===1?"":"s"}`,actions:e.jsxs(e.Fragment,{children:[e.jsx(m,{to:"/goals",className:"inline-flex min-h-10 min-w-max shrink-0 items-center justify-center rounded-full bg-white/[0.08] px-4 py-2 text-sm whitespace-nowrap text-white transition hover:bg-white/[0.12]",children:"Open goals"}),e.jsx(m,{to:"/psyche/reports?create=1",className:"inline-flex min-h-10 min-w-max shrink-0 items-center justify-center rounded-full bg-[rgba(125,211,252,0.16)] px-4 py-2 text-sm whitespace-nowrap text-white transition hover:bg-[rgba(125,211,252,0.22)]",children:"Reflect"})]})}),e.jsx(E,{}),e.jsxs("section",{className:"grid min-w-0 gap-4 xl:grid-cols-[minmax(0,1fr)_20rem]",children:[e.jsx(I,{testId:"goal-gravity-graph",title:"Life direction, value orbit, and execution field",hint:"Drag to inspect the whole field. Select any goal, value, belief, behavior, project, or report to see what it means and where to act next.",nodes:a.nodes,edges:a.edges,fields:a.fields,selectedNodeId:x,onSelectNode:g,minHeightClassName:"min-h-[25rem] sm:min-h-[34rem] lg:min-h-[56rem]",legend:[{label:"Goals",kind:"goal"},{label:"Values",kind:"value"},{label:"Beliefs",kind:"belief"},{label:"Behaviors",kind:"behavior"},{label:"Habits",kind:"habit"},{label:"Projects",kind:"project"},{label:"Reports",kind:"report"}],action:o.length===0?e.jsx(m,{to:"/goals",className:"inline-flex min-h-10 min-w-max shrink-0 items-center justify-center rounded-[var(--radius-control)] bg-[linear-gradient(135deg,rgba(192,193,255,0.36),rgba(192,193,255,0.22))] px-4 py-2 text-sm font-medium whitespace-nowrap text-white",children:"Add first goal"}):e.jsx(m,{to:"/goals",className:"inline-flex min-h-10 min-w-max shrink-0 items-center justify-center rounded-[var(--radius-control)] bg-white/8 px-4 py-2 text-sm font-medium whitespace-nowrap text-white transition hover:bg-white/12",children:"Open goals"})}),e.jsxs(K,{className:"min-w-0 h-fit xl:sticky xl:top-24",children:[e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:t.entityKind?e.jsx(L,{kind:t.entityKind,compact:!0,gradient:!1,iconOnly:!0}):e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:t.eyebrow})}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[t.entityKind?e.jsx(B,{kind:t.entityKind,label:t.title,variant:"heading",size:"lg",showKind:!1}):e.jsx("h2",{className:"font-display text-[clamp(1.35rem,2.2vw,2rem)] leading-none text-white",children:t.title}),t.entityKind?null:e.jsx(f,{className:"bg-white/[0.08]",style:{color:"white"},children:t.tone})]}),e.jsx("p",{className:"mt-3 text-sm leading-6 text-white/60",children:t.summary}),t.stats.length>0?e.jsx("div",{className:"mt-4 grid gap-2",children:t.stats.map(i=>e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-3 py-3 text-sm text-white/68",children:i},i))}):null,t.chips.length>0?e.jsx("div",{className:"mt-4 flex flex-wrap gap-2",children:t.chips.map(i=>e.jsx(f,{className:"bg-white/[0.08] text-white/74",children:i},i))}):null,e.jsx("div",{className:"mt-5",children:e.jsx(m,{to:t.href,className:V("inline-flex min-h-11 w-full items-center justify-center rounded-[var(--radius-control)] px-4 py-2.5 text-sm font-medium whitespace-nowrap shadow-[0_12px_30px_rgba(192,193,255,0.08)]",t.entityKind?C(t.entityKind,!0):"bg-[linear-gradient(135deg,rgba(192,193,255,0.36),rgba(192,193,255,0.22))] text-white"),children:t.ctaLabel})})]})]})]})}export{T as PsycheGoalMapPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as v,b5 as Xt,j as c,cJ as Rt,b4 as zt,cn as Ct,cK as Pt,cL as _t}from"./vendor-DHkYh85p.js";import{Z as ht,B as at,aR as gt}from"./index-CF4J4R9L.js";function q(n,i,r){return`${i}:${n}:${r}`}function ft(n,i,r){return Math.min(Math.max(n,i),r)}function mt(n,i,r){return Math.min(r,Math.max(1,Math.ceil(n.trim().length/i)))}function Nt(n,{compact:i}){const r=mt(n,i?13:14,4),p=(i?114:156)+(r-1)*(i?12:18)+Math.min(24,Math.max(0,n.trim().length-18))*(i?.7:1);return ft(p,i?118:164,i?154:210)}function Tt(n,{compact:i}){const r=mt(n,i?11:13,3),p=(i?40:48)+(r-1)*(i?6:8)+Math.min(i?18:26,Math.max(0,n.trim().length-(i?12:16)))*(i?.45:.55);return ft(p,i?42:50,i?56:68)}function et(n,{compact:i,emphasis:r=!1}){const p=mt(n,i?16:r?22:20,r?3:2);return{width:ft((i?r?184:152:r?224:176)+Math.min(n.length,48)*(i?1.8:2.15),i?r?188:156:r?228:184,i?r?248:208:r?300:244),height:p===1?i?64:70:p===2?i?82:92:i?98:110}}function kt(n){if(n.kind==="goal"||n.kind==="value"||n.kind==="ghost"){const i=n.radius??(n.kind==="goal"?76:34);return{halfWidth:i,halfHeight:i}}return{halfWidth:(n.width??146)/2,halfHeight:(n.height??58)/2}}function Et(n,{compact:i}){const r=n.map(u=>({...u,homeX:u.x,homeY:u.y,locked:u.kind==="goal"||u.kind==="ghost"})),x=i?28:40,p=i?.08:.06;for(let u=0;u<180;u+=1){for(const s of r)s.locked||(s.x+=(s.homeX-s.x)*p,s.y+=(s.homeY-s.y)*p);for(let s=0;s<r.length;s+=1)for(let w=s+1;w<r.length;w+=1){const g=r[s],$=r[w],h=kt(g),F=kt($),j=$.x-g.x,z=$.y-g.y,y=h.halfWidth+F.halfWidth+x-Math.abs(j),b=h.halfHeight+F.halfHeight+x-Math.abs(z);if(y<=0||b<=0)continue;const I=y<b?"x":"y",P=Math.sign(I==="x"?j||w-s||1:z||w-s||1),E=(I==="x"?y:b)/(g.locked||$.locked?1:2);g.locked||(I==="x"?g.x-=P*E:g.y-=P*E),$.locked||(I==="x"?$.x+=P*E:$.y+=P*E)}}return r.map(({homeX:u,homeY:s,locked:w,...g})=>g)}function Dt(){return{nodes:[{id:"ghost_goal_north",kind:"ghost",x:-250,y:-20,radius:68,label:"First goal",meta:"Goal",href:"/goals"},{id:"ghost_goal_center",kind:"ghost",x:0,y:34,radius:74,label:"Life goals",meta:"Goal",href:"/goals"},{id:"ghost_goal_south",kind:"ghost",x:250,y:-10,radius:68,label:"Direction",meta:"Goal",href:"/goals"}],edges:[],fields:[],inspectors:{ghost_goal_center:{id:"ghost_goal_center",eyebrow:"Goals",title:"Add the first life goal",summary:"The graph is already laid out. Once a goal exists, values, reports, beliefs, and behaviors will start orbiting it instead of staying fragmented.",href:"/goals",ctaLabel:"Open life goals",tone:"sky",entityKind:"goal",chips:["Goals","Values","Reports"],stats:["0 goals mapped yet"]}},defaultSelectedId:"ghost_goal_center"}}function Wt(n,{compact:i=!1}={}){var $;if(n.length===0)return Dt();const r=[],x=[],p=[],u={},s=i?560:840,w=-((n.length-1)*s)/2;n.forEach((h,F)=>{const j=w+F*s,z=F%2===0?92:146,y=h.linkedBehaviors.length+h.linkedBeliefs.length+h.linkedReports.length+h.linkedHabits.length,b=`goal:${h.goal.id}`;r.push({id:b,kind:"goal",x:j,y:z,radius:Nt(h.goal.title,{compact:i}),tone:"amber",label:h.goal.title,href:`/goals/${h.goal.id}`}),u[b]={id:b,eyebrow:"Goal",title:h.goal.title,summary:h.goal.description,href:`/goals/${h.goal.id}`,ctaLabel:"Open goal",tone:"amber",entityKind:"goal",chips:h.linkedValues.slice(0,4).map(e=>e.title),stats:[`${h.linkedValues.length} linked value${h.linkedValues.length===1?"":"s"}`,`${h.linkedProjects.length} live project${h.linkedProjects.length===1?"":"s"}`,`${h.linkedHabits.length} linked habit${h.linkedHabits.length===1?"":"s"}`,`${y} friction signal${y===1?"":"s"}`]},y>0&&p.push({id:`field:${h.goal.id}`,x:j+18,y:z+20,radiusX:i?144:176,radiusY:i?104:132,tone:"rose",opacity:Math.min(.42,.14+y*.04)});const I=i?208:282;h.linkedValues.slice(0,i?4:5).forEach((e,d)=>{const m=(-95+d*(i?78:64))*(Math.PI/180),k=Tt(e.title,{compact:i}),G=j+Math.cos(m)*I,W=z+Math.sin(m)*I,K=q(h.goal.id,"value",e.id);r.push({id:K,kind:"value",x:G,y:W,radius:k,tone:"mint",label:e.title,meta:`${e.linkedGoalIds.length} goal${e.linkedGoalIds.length===1?"":"s"}`,href:`/psyche/values?focus=${e.id}#values-atlas`}),x.push({id:`${b}->${K}`,from:b,to:K,tone:"mint",strength:"medium"}),u[K]={id:K,eyebrow:"Value",title:e.title,summary:e.valuedDirection||e.whyItMatters||e.description,href:`/psyche/values?focus=${e.id}#values-atlas`,ctaLabel:"Open values",tone:"mint",entityKind:"value",chips:e.committedActions.slice(0,3),stats:[`${e.linkedProjectIds.length} linked project${e.linkedProjectIds.length===1?"":"s"}`,`${e.linkedTaskIds.length} linked task${e.linkedTaskIds.length===1?"":"s"}`]}});const P=h.linkedProjects.slice(0,i?2:3).map(e=>({project:e,size:et(e.title,{compact:i,emphasis:!0})})),E=i?24:30;let _=-(P.reduce((e,d)=>e+d.size.width,0)+Math.max(0,P.length-1)*E)/2;P.forEach(({project:e,size:d},m)=>{const k=q(h.goal.id,"project",e.id),G=j+_+d.width/2,W=z-(i?330:434)-m*(i?16:20);_+=d.width+E,r.push({id:k,kind:"project",x:G,y:W,width:d.width,height:d.height,tone:"sky",label:e.title,meta:"Project",href:`/projects/${e.id}`}),x.push({id:`${b}->${k}`,from:b,to:k,tone:"sky",strength:"medium"}),u[k]={id:k,eyebrow:"Project",title:e.title,summary:e.description,href:`/projects/${e.id}`,ctaLabel:"Open project",tone:"sky",entityKind:"project",chips:[e.status,e.goalTitle],stats:[`${e.progress}% progress`,`${e.activeTaskCount} active task${e.activeTaskCount===1?"":"s"}`]}}),h.linkedHabits.slice(0,i?2:3).forEach((e,d)=>{const m=q(h.goal.id,"habit",e.id),k=et(e.title,{compact:i}),G=j-(i?44:58),W=z+(i?228:294)+d*(i?92:104);r.push({id:m,kind:"habit",x:G,y:W,width:k.width,height:k.height,tone:"mint",label:e.title,meta:e.polarity,href:"/habits"}),x.push({id:`${b}->${m}`,from:b,to:m,tone:"mint",strength:e.dueToday?"high":"medium"}),u[m]={id:m,eyebrow:"Habit",title:e.title,summary:e.description||"Recurring operating record connected directly to this goal field.",href:"/habits",ctaLabel:"Open habits",tone:"mint",entityKind:"habit",chips:[e.polarity,e.frequency,e.dueToday?"due today":"checked in"],stats:[`${e.streakCount} streak`,`${e.rewardXp}/${e.penaltyXp} xp flow`]}});let O=z+(i?132:156);h.linkedBehaviors.slice(0,i?2:3).forEach(e=>{const d=q(h.goal.id,"behavior",e.id),m=et(e.title,{compact:i}),k=j-(i?272:352);r.push({id:d,kind:"behavior",x:k,y:O,width:m.width,height:m.height,tone:"orange",label:e.title,meta:e.kind,href:`/psyche/behaviors?focus=${e.id}#behavior-columns`}),x.push({id:`${b}->${d}`,from:b,to:d,tone:"orange",dashed:e.kind!=="committed",strength:e.kind==="committed"?"medium":"low"}),u[d]={id:d,eyebrow:"Behavior",title:e.title,summary:e.replacementMove||e.description||e.urgeStory,href:`/psyche/behaviors?focus=${e.id}#behavior-columns`,ctaLabel:"Open behaviors",tone:"orange",entityKind:"behavior",chips:[e.kind,...e.commonCues.slice(0,2)],stats:[e.shortTermPayoff?"Short-term payoff mapped":"Payoff still to map",e.longTermCost?"Long-term cost mapped":"Cost still to map"]},O+=m.height+(i?18:22)});let X=z+(i?8:10);h.linkedBeliefs.slice(0,i?2:3).forEach(e=>{const d=q(h.goal.id,"belief",e.id),m=et(e.statement,{compact:i,emphasis:!0}),k=j+(i?278:362);r.push({id:d,kind:"belief",x:k,y:X,width:m.width,height:m.height,tone:"violet",label:e.statement,meta:"belief",href:`/psyche/schemas-beliefs?focus=${e.id}`}),x.push({id:`${b}->${d}`,from:b,to:d,tone:"violet",dashed:!0,strength:"low"}),u[d]={id:d,eyebrow:"Belief",title:e.statement,summary:e.flexibleAlternative||e.originNote||"Belief script attached to this part of the map.",href:`/psyche/schemas-beliefs?focus=${e.id}`,ctaLabel:"Open beliefs",tone:"violet",entityKind:"belief",chips:[e.beliefType,`${e.confidence}% grip`],stats:[`${e.linkedBehaviorIds.length} linked behavior${e.linkedBehaviorIds.length===1?"":"s"}`,`${e.linkedReportIds.length} linked report${e.linkedReportIds.length===1?"":"s"}`]},X+=m.height+(i?18:22)});const D=h.linkedReports.slice(0,i?2:3).map(e=>({report:e,size:et(e.title,{compact:i})})),Z=i?20:26;let Q=-(D.reduce((e,d)=>e+d.size.width,0)+Math.max(0,D.length-1)*Z)/2;D.forEach(({report:e,size:d})=>{const m=q(h.goal.id,"report",e.id),k=j+Q+d.width/2,G=z+(i?332:430);Q+=d.width+Z,r.push({id:m,kind:"report",x:k,y:G,width:d.width,height:d.height,tone:"blue",label:e.title,meta:e.status,href:`/psyche/reports/${e.id}`}),x.push({id:`${b}->${m}`,from:b,to:m,tone:"sky",strength:"medium"}),u[m]={id:m,eyebrow:"Report",title:e.title,summary:e.eventSituation||e.customEventType||"Reflective chain linked into this goal.",href:`/psyche/reports/${e.id}`,ctaLabel:"Open report",tone:"blue",entityKind:"report",chips:[e.status,...e.nextMoves.slice(0,2)],stats:[`${e.emotions.length} emotion${e.emotions.length===1?"":"s"}`,`${e.behaviors.length} move${e.behaviors.length===1?"":"s"}`]}})});const g=(($=r[0])==null?void 0:$.id)??"ghost_goal_center";return{nodes:Et(r,{compact:i}),edges:x,fields:p,inspectors:u,defaultSelectedId:g}}const A={mint:"rgba(110,231,183,0.64)",sky:"rgba(125,211,252,0.66)",violet:"rgba(196,181,253,0.72)",rose:"rgba(251,113,133,0.68)",amber:"rgba(251,191,36,0.68)",orange:"rgba(251,146,60,0.72)",blue:"rgba(96,165,250,0.72)",slate:"rgba(148,163,184,0.52)"},dt={mint:"rgba(16,185,129,0.18)",sky:"rgba(56,189,248,0.18)",violet:"rgba(167,139,250,0.18)",rose:"rgba(251,113,133,0.18)",amber:"rgba(251,191,36,0.18)",orange:"rgba(251,146,60,0.18)",blue:"rgba(96,165,250,0.18)",slate:"rgba(148,163,184,0.12)"},H={mint:"rgba(209,250,229,0.98)",sky:"rgba(224,242,254,0.98)",violet:"rgba(237,233,254,0.98)",rose:"rgba(255,228,230,0.98)",amber:"rgba(254,243,199,0.98)",orange:"rgba(255,237,213,0.98)",blue:"rgba(219,234,254,0.98)",slate:"rgba(241,245,249,0.9)"};function $t(n){switch(n){case"goal":case"value":case"behavior":case"belief":case"report":case"project":case"habit":return n;default:return null}}function St(n){if(n.tone)return n.tone;switch(n.kind){case"goal":return"amber";case"value":return"mint";case"belief":return"violet";case"behavior":return"orange";case"project":return"sky";case"habit":return"mint";case"report":return"blue";default:return"slate"}}function Gt(n){if(n.kind==="ghost")return n.meta??null;const i=$t(n.kind);return i?gt(i).label:n.meta??null}function ut(n,i,r){return Math.min(Math.max(n,i),r)}function lt(n,i,r=3){const x=n.trim().split(/\s+/),p=[];let u="";for(let g=0;g<x.length;g+=1){const $=x[g],h=u?`${u} ${$}`:$;if(h.length>i&&u){if(p.push(u),p.length>=r-1){u=[$,...x.slice(g+1)].join(" ");break}u=$}else u=h}u&&p.push(u);const s=p.slice(0,r),w=s.length-1;return w>=0&&s[w].length>i&&(s[w]=`${s[w].slice(0,Math.max(1,i-1)).trimEnd()}…`),s}function Vt(n,i){if(n.length===0&&i.length===0)return{minX:-360,maxX:360,minY:-240,maxY:240};let r=Number.POSITIVE_INFINITY,x=Number.NEGATIVE_INFINITY,p=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY;for(const s of n){const w=s.kind==="goal"||s.kind==="value"||s.kind==="ghost"?s.radius??32:(s.width??124)/2,g=s.kind==="goal"||s.kind==="value"||s.kind==="ghost"?s.radius??32:(s.height??56)/2,$=s.meta&&(s.kind==="goal"||s.kind==="ghost")?48:0;r=Math.min(r,s.x-w),x=Math.max(x,s.x+w),p=Math.min(p,s.y-g-$),u=Math.max(u,s.y+g)}for(const s of i)r=Math.min(r,s.x-s.radiusX),x=Math.max(x,s.x+s.radiusX),p=Math.min(p,s.y-s.radiusY),u=Math.max(u,s.y+s.radiusY);return{minX:r,maxX:x,minY:p,maxY:u}}function wt(n){return{x:n.x,y:n.y}}function Lt(n){if(n.kind==="goal"){const i=n.radius??112;return lt(n.label,Math.max(14,Math.floor(i/7.2)),4)}if(n.kind==="value"||n.kind==="ghost"){const i=n.radius??40;return lt(n.label,Math.max(12,Math.floor(i/3)),3)}return n.kind==="project"?lt(n.label,Math.max(18,Math.floor((n.width??220)/10)),3):lt(n.label,Math.max(16,Math.floor((n.width??180)/10.5)),2)}function Bt(n){switch(n){case"goal":return"amber";case"project":return"sky";case"value":return"mint";case"behavior":return"orange";case"belief":return"violet";case"report":return"blue";default:return"slate"}}function Kt({nodes:n,edges:i,fields:r=[],title:x,hint:p,action:u,legend:s,selectedNodeId:w,onSelectNode:g,minHeightClassName:$="min-h-[34rem] lg:min-h-[44rem]",compact:h=!1,testId:F}){const j=v.useRef(null),z=Xt(),[y,b]=v.useState({width:0,height:0}),[I,P]=v.useState({scale:1,x:0,y:0}),[E,J]=v.useState(null),_=v.useRef(null),O=v.useRef({scale:1,x:0,y:0}),X=v.useRef(new Map),D=v.useRef(null),Z=v.useRef(0),S=v.useRef(!1),Q=v.useMemo(()=>new Map(n.map(t=>[t.id,t])),[n]),e=v.useMemo(()=>Vt(n,r),[r,n]),d=y.width>0&&y.width<640;v.useEffect(()=>{if(!j.current||typeof ResizeObserver>"u")return;const t=new ResizeObserver(a=>{const o=a[0];b({width:o.contentRect.width,height:o.contentRect.height})});return t.observe(j.current),()=>t.disconnect()},[]);const m=v.useCallback(()=>{if(!y.width||!y.height)return;const t=d?132:h?140:190,a=Math.max(e.maxX-e.minX,1),o=Math.max(e.maxY-e.minY,1),l=ut(Math.min(y.width/(a+t),y.height/(o+t)),d?.24:h?.4:.46,d?.76:h?1.04:1.18),f=(e.minX+e.maxX)/2,Y=(e.minY+e.maxY)/2;P({scale:l,x:y.width/2-f*l,y:y.height/2-Y*l})},[e.maxX,e.maxY,e.minX,e.minY,h,y.height,y.width,d]);v.useEffect(()=>{O.current=I},[I]),v.useEffect(()=>{S.current||m()},[m]);const k=v.useCallback((t,a,o)=>{const l=ut(t,.28,1.9);P(f=>{if(a==null||o==null)return{...f,scale:l};const Y=(a-f.x)/f.scale,V=(o-f.y)/f.scale;return{scale:l,x:a-Y*l,y:o-V*l}})},[]),G=v.useCallback(()=>{const t=[...X.current.values()];if(t.length<2){D.current=null;return}const[a,o]=t,l=Math.hypot(o.x-a.x,o.y-a.y);if(!Number.isFinite(l)||l<=0){D.current=null;return}const f=O.current;D.current={startDistance:l,startScale:f.scale,startViewportX:f.x,startViewportY:f.y,startMidpointX:(a.x+o.x)/2,startMidpointY:(a.y+o.y)/2}},[]),W=t=>{var l;t.preventDefault();const a=(l=j.current)==null?void 0:l.getBoundingClientRect();if(!a)return;S.current=!0;const o=t.deltaY<0?1.1:.9;k(I.scale*o,t.clientX-a.left,t.clientY-a.top)},K=t=>{var f;const a=(f=j.current)==null?void 0:f.getBoundingClientRect(),o=t.clientX-((a==null?void 0:a.left)??0),l=t.clientY-((a==null?void 0:a.top)??0);if(X.current.set(t.pointerId,{x:o,y:l}),X.current.size===1){const Y=O.current;_.current={pointerId:t.pointerId,originX:Y.x,originY:Y.y,startX:o,startY:l}}else _.current=null,G();t.currentTarget.setPointerCapture(t.pointerId)},vt=t=>{var V;const a=(V=j.current)==null?void 0:V.getBoundingClientRect(),o=t.clientX-((a==null?void 0:a.left)??0),l=t.clientY-((a==null?void 0:a.top)??0);if(X.current.has(t.pointerId)&&X.current.set(t.pointerId,{x:o,y:l}),D.current&&X.current.size>=2){const[R,N]=[...X.current.values()],C=Math.hypot(N.x-R.x,N.y-R.y);if(Number.isFinite(C)&&C>0){S.current=!0,Z.current=Date.now()+240;const tt=(R.x+N.x)/2,B=(R.y+N.y)/2,T=D.current,U=ut(T.startScale*C/T.startDistance,.24,1.42),ot=(T.startMidpointX-T.startViewportX)/T.startScale,ct=(T.startMidpointY-T.startViewportY)/T.startScale;P({scale:U,x:tt-ot*U,y:B-ct*U})}return}if(!_.current||_.current.pointerId!==t.pointerId||X.current.size!==1)return;S.current=!0;const f=o-_.current.startX,Y=l-_.current.startY;(Math.abs(f)>3||Math.abs(Y)>3)&&(Z.current=Date.now()+240),P(R=>{var N,C;return{...R,x:(((N=_.current)==null?void 0:N.originX)??R.x)+f,y:(((C=_.current)==null?void 0:C.originY)??R.y)+Y}})},xt=t=>{if(X.current.delete(t.pointerId),X.current.size<2&&(D.current=null),X.current.size===1){const[a,o]=[...X.current.entries()][0]??[];if(a!=null&&o){const l=O.current;_.current={pointerId:a,originX:l.x,originY:l.y,startX:o.x,startY:o.y}}}else _.current=null;t.currentTarget.hasPointerCapture(t.pointerId)&&t.currentTarget.releasePointerCapture(t.pointerId)},it=E??w??null,nt=v.useCallback(t=>{Date.now()<Z.current||(g==null||g(t.id),t.href&&z(t.href))},[z,g]);return c.jsxs("section",{"data-testid":F,className:ht("overflow-hidden rounded-[32px] border border-white/8 bg-[radial-gradient(circle_at_top,rgba(125,211,252,0.12),transparent_32%),linear-gradient(180deg,rgba(11,18,31,0.985),rgba(7,12,23,0.98))] shadow-[0_26px_90px_rgba(2,6,16,0.38)]","px-3 py-3 sm:px-4 sm:py-4 lg:px-5 lg:py-5"),children:[c.jsxs("div",{className:"mb-3 flex min-w-0 flex-wrap items-start justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[rgba(125,211,252,0.82)]",children:"Gravity well"}),c.jsx("h2",{className:ht("mt-2 font-display leading-none text-white",h?"text-[clamp(1.25rem,2vw,1.7rem)]":"text-[clamp(1.45rem,2.8vw,2.3rem)]"),children:x}),p?c.jsx("p",{className:"mt-1.5 max-w-3xl text-sm leading-6 text-white/54",children:d?"Select a node, pan the field, and open the full map when you need the wider structure.":p}):null]}),c.jsx("div",{className:"flex min-w-0 flex-wrap items-center justify-end gap-2",children:u})]}),c.jsxs("div",{ref:j,className:ht("group relative overflow-hidden rounded-[30px] border border-white/6 bg-[radial-gradient(circle_at_center,rgba(255,255,255,0.04),transparent_46%)] touch-none",$),style:{touchAction:"none"},onWheel:W,onPointerDown:K,onPointerMove:vt,onPointerUp:xt,onPointerCancel:xt,children:[c.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_center,rgba(110,231,183,0.06),transparent_28%),radial-gradient(circle_at_20%_20%,rgba(196,181,253,0.08),transparent_24%),linear-gradient(180deg,rgba(255,255,255,0.015),rgba(4,8,18,0.24))]"}),c.jsxs("div",{className:"absolute left-3 top-3 z-10 inline-flex max-w-[calc(100%-7rem)] items-center gap-2 rounded-full border border-white/8 bg-[rgba(8,14,25,0.78)] px-2.5 py-1.5 text-[11px] uppercase tracking-[0.18em] text-white/42 backdrop-blur-xl sm:left-4 sm:top-4 sm:max-w-none sm:px-3",onPointerDown:t=>t.stopPropagation(),children:[c.jsx(Rt,{className:"size-3.5"}),d?"Drag or pinch":"Drag to pan, scroll to zoom"]}),c.jsxs("div",{className:"absolute right-3 top-3 z-10 flex max-w-[calc(100%-1.5rem)] flex-wrap items-center justify-end gap-1.5 sm:right-4 sm:top-4 sm:max-w-none sm:gap-2",onPointerDown:t=>t.stopPropagation(),children:[c.jsx(at,{type:"button",variant:"secondary",size:"sm",className:"px-2.5 sm:px-3","aria-label":"Zoom in",onClick:()=>{S.current=!0,k(I.scale*1.12,y.width-96,72)},children:c.jsx(zt,{className:"size-4"})}),c.jsx(at,{type:"button",variant:"secondary",size:"sm",className:"px-2.5 sm:px-3","aria-label":"Zoom out",onClick:()=>{S.current=!0,k(I.scale*.88,y.width-96,72)},children:c.jsx(Ct,{className:"size-4"})}),c.jsxs(at,{type:"button",variant:"secondary",size:"sm",className:"px-2.5 sm:min-w-[4.75rem] sm:px-3","aria-label":"Fit graph",onClick:()=>{S.current=!0,m()},children:[c.jsx(Pt,{className:"size-4"}),d?null:"Fit"]}),c.jsxs(at,{type:"button",variant:"secondary",size:"sm",className:"px-2.5 sm:min-w-[5.5rem] sm:px-3","aria-label":"Reset graph",onClick:()=>{S.current=!1,m()},children:[c.jsx(_t,{className:"size-4"}),d?null:"Reset"]})]}),s&&s.length>0&&!d?c.jsx("div",{className:"absolute bottom-4 left-4 z-10 flex flex-wrap items-center gap-2 rounded-[24px] border border-white/8 bg-[rgba(8,14,25,0.76)] px-3 py-2 text-xs text-white/58 backdrop-blur-xl",children:s.map(t=>{const a=t.kind?Bt(t.kind):t.tone??"slate",o=t.kind?gt(t.kind).icon:null;return c.jsxs("span",{className:"inline-flex items-center gap-2 whitespace-nowrap rounded-full bg-white/[0.04] px-2.5 py-1.5",children:[o?c.jsx(o,{className:"size-3.5",color:H[a],strokeWidth:2.1}):c.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:A[a]}}),t.label]},t.label)})}):null,c.jsxs("svg",{className:"relative z-[1] h-full w-full",viewBox:`0 0 ${y.width||1200} ${y.height||760}`,role:"img","aria-label":x,children:[c.jsx("defs",{children:c.jsx("filter",{id:"forge-graph-blur",children:c.jsx("feGaussianBlur",{stdDeviation:"34"})})}),c.jsxs("g",{transform:`translate(${I.x} ${I.y}) scale(${I.scale})`,children:[r.map(t=>c.jsx("ellipse",{cx:t.x,cy:t.y,rx:t.radiusX,ry:t.radiusY,fill:dt[t.tone??"rose"],opacity:t.opacity??.42,filter:"url(#forge-graph-blur)"},t.id)),n.filter(t=>t.kind==="goal"||t.kind==="ghost").map(t=>{const a=t.radius??76;return c.jsx("g",{opacity:t.kind==="ghost"?.28:.55,children:[a+74,a+124].map((o,l)=>c.jsx("circle",{cx:t.x,cy:t.y,r:o,fill:"none",stroke:l===0?"rgba(255,255,255,0.08)":"rgba(255,255,255,0.045)",strokeDasharray:l===0?"0":"10 10"},`${t.id}-ring-${o}`))},`${t.id}-orbital-lanes`)}),i.map(t=>{const a=Q.get(t.from),o=Q.get(t.to);if(!a||!o)return null;const l=wt(a),f=wt(o),Y=(l.x+f.x)/2,V=(l.y+f.y)/2,R=Math.max(24,Math.abs(l.x-f.x)*.08),N=Y,C=V-R;return c.jsx("path",{d:`M ${l.x} ${l.y} Q ${N} ${C} ${f.x} ${f.y}`,fill:"none",stroke:A[t.tone??"slate"],strokeWidth:t.strength==="high"?3:t.strength==="medium"?2.2:1.6,strokeDasharray:t.dashed?"8 8":void 0,opacity:it&&t.from!==it&&t.to!==it?.18:.62},t.id)}),n.map(t=>{t.id;const a=E===t.id,o=it===t.id,l=St(t),f=Gt(t),Y=Lt(t),V=$t(t.kind),R=V?gt(V).icon:null;if(t.kind==="goal"||t.kind==="value"||t.kind==="ghost"){const M=t.radius??(t.kind==="goal"?76:34),st=f?t.y-M-(t.kind==="goal"?18:10):null,yt=t.kind==="goal"?20:14.5,rt=t.kind==="goal"?28:16,It=t.kind==="goal"?t.y-M*.34:t.kind==="value"?t.y-M*.3:t.y-M*.2,Yt=t.kind==="goal"?t.y+M*.2:t.y+10;return c.jsxs("g",{tabIndex:0,role:"button",onPointerEnter:()=>{J(t.id),g==null||g(t.id)},onPointerLeave:()=>J(L=>L===t.id?null:L),onFocus:()=>g==null?void 0:g(t.id),onClick:()=>nt(t),onKeyDown:L=>{(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),nt(t))},className:"cursor-pointer outline-none",children:[c.jsx("circle",{cx:t.x,cy:t.y,r:M+(o?14:0),fill:o?`${A[l]}22`:"transparent",stroke:o?A[l]:"transparent",opacity:a?.98:.9}),c.jsx("circle",{cx:t.x,cy:t.y,r:M+(a?2:0),fill:t.kind==="ghost"?"rgba(255,255,255,0.03)":dt[l],stroke:t.kind==="ghost"?"rgba(255,255,255,0.18)":A[l],strokeDasharray:t.kind==="ghost"?"8 8":void 0,strokeWidth:o?2.8:1.6}),f?c.jsx("text",{x:t.x,y:st??t.y-12,textAnchor:"middle",fontSize:t.kind==="goal"?"11.5":"10.5",fill:t.kind==="ghost"?"rgba(255,255,255,0.62)":H[l],style:{letterSpacing:"0.18em",textTransform:"uppercase"},children:f}):null,R?c.jsx(R,{x:t.x-rt/2,y:It-rt/2,width:rt,height:rt,color:H[l],strokeWidth:2.1}):null,Y.map((L,bt)=>c.jsx("text",{x:t.x,y:Yt+bt*yt-(Y.length-1)*yt/2,textAnchor:"middle",fontSize:t.kind==="goal"?21:12.8,fontWeight:t.kind==="goal"?600:500,fill:t.kind==="ghost"?"rgba(255,255,255,0.92)":H[l],children:L},`${t.id}-${L}-${bt}`))]},t.id)}const N=t.width??146,C=t.height??58,tt=t.x-N/2,B=t.y-C/2,T=t.kind==="project"?14:13,U=tt+14,ot=B+13,ct=B+22,jt=f?B+C*.65:B+C*.56,pt=t.kind==="project"?16:15,Mt=t.kind==="project"?14.2:13.2;return c.jsxs("g",{tabIndex:0,role:"button",onPointerEnter:()=>{J(t.id),g==null||g(t.id)},onPointerLeave:()=>J(M=>M===t.id?null:M),onFocus:()=>g==null?void 0:g(t.id),onClick:()=>nt(t),onKeyDown:M=>{(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),nt(t))},className:"cursor-pointer outline-none",children:[c.jsx("rect",{x:tt-(o?6:0),y:B-(o?6:0),rx:"28",ry:"28",width:N+(o?12:0),height:C+(o?12:0),fill:o?`${A[l]}22`:"transparent"}),c.jsx("rect",{x:tt-(a?2:0),y:B-(a?2:0),rx:"22",ry:"22",width:N+(a?4:0),height:C+(a?4:0),fill:dt[l],stroke:A[l],strokeWidth:o?2.3:1.3}),R?c.jsx(R,{x:U,y:ot,width:T,height:T,color:H[l],strokeWidth:2.1}):null,f?c.jsx("text",{x:U+T+8,y:ct,textAnchor:"start",fontSize:"9.5",fill:H[l],style:{letterSpacing:"0.16em",textTransform:"uppercase",opacity:.82},children:f}):null,Y.map((M,st)=>c.jsx("text",{x:t.x,y:jt+st*pt-(Y.length-1)*pt/2,textAnchor:"middle",fontSize:Mt,fontWeight:600,fill:H[l],children:M},`${t.id}-${M}-${st}`))]},t.id)})]})]})]})]})}export{Kt as P,Wt as b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,aC as v}from"./vendor-DHkYh85p.js";import{j as N,i as w,k as S}from"./state-B-4sS1xO.js";import{u as C}from"./forms-BFlTgZ3W.js";import{cz as k,L as M,E as P,B as d,ck as q,C as l,a as j,c as f,cA as E}from"./index-CF4J4R9L.js";import{P as L}from"./page-hero-DRy5b2MU.js";import{m as Q}from"./psyche-schemas-HFmg37Wj.js";import"./board-BkDRaMp6.js";import"./ui-C13Nbgas.js";import"./motion-BeD44FeG.js";import"./graph-D6JLqDbD.js";function R(a){return a instanceof Error?a:typeof a=="string"&&a.trim().length>0?new Error(a):new Error("Forge could not complete the requested query collection.")}function _(a){const i=a.find(t=>t.isError);return{isLoading:a.some(t=>t.isPending||t.isLoading),error:i?R(i.error):null}}async function F(a){await Promise.all(a.map(i=>i.refetch()))}const n={copingResponse:[{value:"fight",label:"Fight"},{value:"flight",label:"Flight"},{value:"freeze",label:"Freeze"},{value:"detach",label:"Detach"},{value:"comply",label:"Comply"},{value:"overcompensate",label:"Overcompensate"},{value:"none",label:"Mixed / unsure"}],childState:[{value:"vulnerable",label:"Vulnerable"},{value:"angry",label:"Angry"},{value:"impulsive",label:"Impulsive"},{value:"lonely",label:"Lonely"},{value:"ashamed",label:"Ashamed"},{value:"none",label:"Mixed / unsure"}],criticStyle:[{value:"demanding",label:"Demanding"},{value:"punitive",label:"Punitive"},{value:"none",label:"Neither / unclear"}],healthyContact:[{value:"healthy_adult",label:"Healthy adult"},{value:"happy_child",label:"Happy child"},{value:"none",label:"Hard to access right now"}]};function D(){var u,p,x,g,y,b;const a=N(),i=w({queryKey:["forge-psyche-mode-guide-sessions"],queryFn:E}),t=C({defaultValues:{summary:"What mode was most present in this moment?",copingResponse:"none",childState:"none",criticStyle:"none",healthyContact:"none"}}),o=S({mutationFn:async s=>{const r=Q.parse({summary:s.summary,answers:[{questionKey:"coping_response",value:s.copingResponse},{questionKey:"child_state",value:s.childState},{questionKey:"critic_style",value:s.criticStyle},{questionKey:"healthy_contact",value:s.healthyContact}]});return k(r)},onSuccess:async()=>{await a.invalidateQueries({queryKey:["forge-psyche-mode-guide-sessions"]})}}),m=[i],c=_(m),h=((u=o.data)==null?void 0:u.session)??((x=(p=i.data)==null?void 0:p.sessions)==null?void 0:x[0]);return c.isLoading?e.jsx(M,{eyebrow:"Mode guide",title:"Loading guided sessions",description:"Hydrating previous mode-guide runs and the latest stored readings."}):c.error?e.jsx(P,{eyebrow:"Mode guide",error:c.error,onRetry:()=>void F(m)}):e.jsxs("div",{className:"grid gap-5",children:[e.jsx(L,{eyebrow:"Mode guide",title:"Guided Mode Identification",description:"A short guided pass can help separate coping responses, child states, critic pressure, and whatever healthy contact is still available.",badge:`${((g=i.data)==null?void 0:g.sessions.length)??0} sessions`,actions:e.jsx(v,{to:"/psyche/modes",children:e.jsx(d,{variant:"secondary",children:"Back to mode map"})})}),e.jsx(q,{}),e.jsxs("section",{className:"grid gap-5 xl:grid-cols-[minmax(0,0.9fr)_minmax(0,1.1fr)]",children:[e.jsxs(l,{className:"bg-[linear-gradient(180deg,rgba(16,20,30,0.96),rgba(11,15,24,0.94))]",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Guided questionnaire"}),e.jsxs("form",{className:"mt-4 grid gap-5",onSubmit:t.handleSubmit(async s=>o.mutateAsync(s)),children:[e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-white/58",children:"Prompt"}),e.jsx("input",{className:"w-full rounded-2xl border border-white/8 bg-white/6 px-4 py-3 text-sm text-white outline-none placeholder:text-white/35",...t.register("summary")})]}),e.jsxs(l,{className:"rounded-[24px] bg-[rgba(248,113,113,0.08)] p-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-rose-100/80",children:"When the pressure rose, what coping move dominated?"}),e.jsx("div",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:n.copingResponse.map(s=>e.jsxs("label",{className:"flex items-center gap-3 rounded-[18px] bg-white/[0.04] px-4 py-3",children:[e.jsx("input",{type:"radio",value:s.value,...t.register("copingResponse")}),e.jsx("span",{className:"text-white/74",children:s.label})]},s.value))})]}),e.jsxs(l,{className:"rounded-[24px] bg-[rgba(196,181,253,0.08)] p-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-violet-100/80",children:"Which child state felt closest?"}),e.jsx("div",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:n.childState.map(s=>e.jsxs("label",{className:"flex items-center gap-3 rounded-[18px] bg-white/[0.04] px-4 py-3",children:[e.jsx("input",{type:"radio",value:s.value,...t.register("childState")}),e.jsx("span",{className:"text-white/74",children:s.label})]},s.value))})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(l,{className:"rounded-[24px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/48",children:"What was the critic like?"}),e.jsx("div",{className:"mt-3 grid gap-2",children:n.criticStyle.map(s=>e.jsxs("label",{className:"flex items-center gap-3 rounded-[18px] bg-white/[0.04] px-4 py-3",children:[e.jsx("input",{type:"radio",value:s.value,...t.register("criticStyle")}),e.jsx("span",{className:"text-white/74",children:s.label})]},s.value))})]}),e.jsxs(l,{className:"rounded-[24px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/48",children:"What healthy contact was still reachable?"}),e.jsx("div",{className:"mt-3 grid gap-2",children:n.healthyContact.map(s=>e.jsxs("label",{className:"flex items-center gap-3 rounded-[18px] bg-white/[0.04] px-4 py-3",children:[e.jsx("input",{type:"radio",value:s.value,...t.register("healthyContact")}),e.jsx("span",{className:"text-white/74",children:s.label})]},s.value))})]})]}),e.jsx(d,{type:"submit",children:"Run guide"})]})]}),e.jsxs("div",{className:"grid gap-5",children:[e.jsxs(l,{className:"bg-[linear-gradient(180deg,rgba(15,21,34,0.96),rgba(10,15,23,0.94))]",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Latest reading"}),h?e.jsxs("div",{className:"mt-4 grid gap-3",children:[h.results.map(s=>e.jsxs("div",{className:"rounded-[22px] bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium text-white",children:s.label}),e.jsxs(f,{className:"text-white/70",children:[Math.round(s.confidence*100),"%"]})]}),e.jsx("div",{className:"mt-2 text-sm text-white/58",children:s.family.replaceAll("_"," ")}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/66",children:s.reasoning})]},`${s.family}:${s.label}`)),e.jsx(v,{to:"/psyche/modes",children:e.jsx(d,{variant:"secondary",children:"Use this in the mode map"})})]}):e.jsx("div",{className:"mt-4",children:e.jsx(j,{eyebrow:"Guided reading",title:"No guided sessions yet",description:"Run the guide once to separate coping response, child state, critic pressure, and reachable healthy contact."})})]}),e.jsxs(l,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Session history"}),e.jsx("div",{className:"mt-4 grid gap-3",children:(((y=i.data)==null?void 0:y.sessions)??[]).length===0?e.jsx(j,{eyebrow:"Session history",title:"No stored guide history",description:"Completed guide sessions will accumulate here so later mode-map work can build from real prior readings."}):(((b=i.data)==null?void 0:b.sessions)??[]).map(s=>e.jsxs("div",{className:"rounded-[20px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"font-medium text-white",children:s.summary}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:s.results.map(r=>e.jsx(f,{className:"text-white/72",children:r.label},`${s.id}:${r.label}`))})]},s.id))})]})]})]})]})}export{D as PsycheModeGuidePage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t,c2 as ae,r as b}from"./vendor-DHkYh85p.js";import{j as re,i as I,k as se}from"./state-B-4sS1xO.js";import{Z as ie,u as oe,s as ne,cB as le,ct as de,bk as S,bl as M,cq as E,L as ce,E as he,B as C,V as Q,ck as pe,c as ue,b as me,_ as ge,Q as ye,a0 as be,a1 as fe,F as i,I as P,T as m,m as N,cr as ve,cp as xe,cs as we,bA as je,bx as ke,by as Ie,bw as Ce}from"./index-CF4J4R9L.js";import{E as Pe}from"./entity-note-count-link-DrhjJZ4i.js";import{A as Se}from"./atlas-panel-CdVNPotj.js";import{u as Me,p as Ee}from"./use-psyche-focus-target-C1C_XjYG.js";import{P as Ne}from"./page-hero-DRy5b2MU.js";import{p as F}from"./query-cache-IQ8W-LNC.js";import{a as K}from"./psyche-schemas-HFmg37Wj.js";import"./board-BkDRaMp6.js";import"./ui-C13Nbgas.js";import"./motion-BeD44FeG.js";import"./forms-BFlTgZ3W.js";import"./graph-D6JLqDbD.js";const Fe={coping:"bg-[rgba(251,113,133,0.16)] text-rose-100",child:"bg-[rgba(125,211,252,0.16)] text-sky-100",critic_parent:"bg-[rgba(196,181,253,0.16)] text-violet-100",healthy_adult:"bg-[rgba(110,231,183,0.16)] text-emerald-100",happy_child:"bg-[rgba(251,191,36,0.16)] text-amber-100"};function Le({family:s,label:o,className:h}){return t.jsx("span",{className:ie("inline-flex items-center rounded-full px-3 py-1.5 text-xs",Fe[s],h),children:o})}const g={family:"coping",archetype:"",title:"",persona:"",imagery:"",symbolicForm:"",facialExpression:"",fear:"",burden:"",protectiveJob:"",originContext:"",firstAppearanceAt:null,linkedPatternIds:[],linkedBehaviorIds:[],linkedValueIds:[],userId:null};function Te(s){return{family:s.family,archetype:s.archetype,title:s.title,persona:s.persona,imagery:s.imagery,symbolicForm:s.symbolicForm,facialExpression:s.facialExpression,fear:s.fear,burden:s.burden,protectiveJob:s.protectiveJob,originContext:s.originContext,firstAppearanceAt:s.firstAppearanceAt,linkedPatternIds:s.linkedPatternIds,linkedBehaviorIds:s.linkedBehaviorIds,linkedValueIds:s.linkedValueIds,userId:s.userId??null}}const L={coping:"Coping",child:"Child",critic_parent:"Critic / parent",healthy_adult:"Healthy adult",happy_child:"Happy child"};function $e(){var D,O,q,H;const s=oe(),o=re(),[h,T]=ae(),[U,n]=b.useState(!1),[p,u]=b.useState(null),[y,l]=b.useState(g),[z,f]=b.useState(null),v=I({queryKey:["forge-psyche-modes"],queryFn:je}),x=I({queryKey:["forge-psyche-patterns"],queryFn:ke}),w=I({queryKey:["forge-psyche-behaviors"],queryFn:Ie}),j=I({queryKey:["forge-psyche-values"],queryFn:Ce}),d=((D=v.data)==null?void 0:D.modes)??[],R=((O=x.data)==null?void 0:O.patterns)??[],J=((q=w.data)==null?void 0:q.behaviors)??[],G=((H=j.data)==null?void 0:H.values)??[],c=ne(s.selectedUserIds),B=h.get("focus"),$=s.snapshot.dashboard.notesSummaryByEntity;Me(B),b.useEffect(()=>{if(h.get("create")==="1"){n(!0),u(null),l({...g,userId:c});const e=new URLSearchParams(h);e.delete("create"),T(e,{replace:!0})}},[c,h,T]);const A=se({mutationFn:async e=>{const a=K.parse(e);return p?le(p.id,a):de(a)},onSuccess:async()=>{n(!1),u(null),l({...g,userId:c}),f(null),await Promise.all([o.invalidateQueries({queryKey:["forge-psyche-modes"]}),o.invalidateQueries({queryKey:["forge-psyche-overview"]})])}}),V=R.map(e=>({value:e.id,label:E(e.title,e.user),description:M(e.preferredResponse||e.targetBehavior,e.user),searchText:S([e.title,e.preferredResponse,e.targetBehavior,e.description],e),kind:"pattern"})),Z=J.map(e=>({value:e.id,label:E(e.title,e.user),description:M(e.kind,e.user),searchText:S([e.title,e.kind,e.description],e),kind:"behavior"})),W=G.map(e=>({value:e.id,label:E(e.title,e.user),description:M(e.valuedDirection,e.user),searchText:S([e.title,e.valuedDirection,e.description],e),kind:"value"})),X=async e=>{const{pattern:a}=await ve({title:e,description:"",targetBehavior:e,cueContexts:[],shortTermPayoff:"",longTermCost:"",preferredResponse:"",linkedValueIds:[],linkedSchemaLabels:[],linkedModeIds:[],linkedBeliefIds:[],userId:y.userId});return F(o,["forge-psyche-patterns"],"patterns",a),await o.invalidateQueries({queryKey:["forge-psyche-overview"]}),{value:a.id,label:a.title,description:a.preferredResponse||a.targetBehavior,kind:"pattern"}},Y=async e=>{const{behavior:a}=await xe({kind:"away",title:e,description:"",commonCues:[],urgeStory:"",shortTermPayoff:"",longTermCost:"",replacementMove:"",repairPlan:"",linkedPatternIds:[],linkedValueIds:[],linkedSchemaIds:[],linkedModeIds:[],userId:y.userId});return F(o,["forge-psyche-behaviors"],"behaviors",a),await o.invalidateQueries({queryKey:["forge-psyche-overview"]}),{value:a.id,label:a.title,description:a.kind,kind:"behavior"}},ee=async e=>{const{value:a}=await we({title:e,description:"",valuedDirection:e,whyItMatters:"",linkedGoalIds:[],linkedProjectIds:[],linkedTaskIds:[],committedActions:[],userId:y.userId});return F(o,["forge-psyche-values"],"values",a),await o.invalidateQueries({queryKey:["forge-psyche-overview"]}),{value:a.id,label:a.title,description:a.valuedDirection,kind:"value"}},te=[{id:"identity",eyebrow:"Identity",title:"Name the cast member and place it in the right family",description:"Start with the mode itself: who it feels like, what family it belongs to, and the recognizable role it plays.",render:(e,a)=>t.jsxs(t.Fragment,{children:[t.jsx(be,{value:e.userId??null,users:s.snapshot.users,onChange:r=>a({userId:r}),defaultLabel:fe(s.snapshot.users.find(r=>r.id===c)??null,"Choose mode owner"),help:"Modes can belong to a human or bot user while still linking across shared patterns, behaviors, and values."}),t.jsx(i,{label:"Mode family",description:"Choose the broader inner family this mode belongs to.",labelHelp:"A mode family is the bigger cluster this state belongs to, like a coping part, a vulnerable child state, or a healthy adult response.",children:t.jsx("div",{className:"grid gap-3 md:grid-cols-3",children:["coping","child","critic_parent","healthy_adult","happy_child"].map(r=>t.jsx("button",{type:"button",className:`rounded-[22px] border px-4 py-4 text-left transition ${e.family===r?"border-white/20 bg-white/[0.12] text-white":"border-white/8 bg-white/[0.04] text-white/62 hover:bg-white/[0.07]"}`,onClick:()=>a({family:r}),children:L[r]},r))})}),t.jsx(i,{label:"Mode name",description:"Give it a memorable name you would instantly recognize later.",labelHelp:"This is the user-facing name of the mode. It should read like a cast member title, not a clinical record.",children:t.jsx(P,{value:e.title,onChange:r=>a({title:r.target.value}),placeholder:"The Friday Vigil, The Scanner, The Good Son"})}),t.jsx(i,{label:"Archetype",description:"Name the recognizable inner role or pattern this mode most resembles.",labelHelp:"An archetype is the role this mode tends to play, like a protector, a critic, a frightened child, or a calm adult anchor.",children:t.jsx(P,{value:e.archetype,onChange:r=>a({archetype:r.target.value}),placeholder:"Detached protector, vulnerable child, demanding critic"})})]})},{id:"texture",eyebrow:"Texture",title:"Give the mode a recognizable presence",description:"Imagery, facial expression, and persona should make the mode instantly memorable.",render:(e,a)=>t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[t.jsx(i,{label:"Persona",description:"Describe how this mode sounds, moves, and carries itself.",labelHelp:"Persona is the tone, posture, and voice of the mode. Imagine how it enters the room and how it speaks.",children:t.jsx(m,{value:e.persona,onChange:r=>a({persona:r.target.value}),placeholder:"Quiet, hyper-alert, always scanning for threat and trying to stay one step ahead."})}),t.jsx(i,{label:"Imagery",description:"Capture the mental image or scene that helps this mode feel vivid.",labelHelp:"Imagery is the picture that makes the mode easy to remember, like a scene, posture, weather pattern, or atmosphere.",children:t.jsx(m,{value:e.imagery,onChange:r=>a({imagery:r.target.value}),placeholder:"A night watchman under cold fluorescent light, pacing and checking every door twice."})})]}),t.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[t.jsx(i,{label:"Symbolic form",description:"Pick the object, creature, or shape that best symbolizes this mode.",labelHelp:"Symbolic form is the metaphor for the mode, like armor, a fox, a storm front, or a glass wall.",children:t.jsx(P,{value:e.symbolicForm,onChange:r=>a({symbolicForm:r.target.value}),placeholder:"A locked visor, a fox, a steel shield"})}),t.jsx(i,{label:"Facial expression",description:"Describe what you would see on the mode's face if it took over.",labelHelp:"This is the visible emotional expression of the mode: tight jaw, blank stare, pleading eyes, or calm grounded attention.",children:t.jsx(P,{value:e.facialExpression,onChange:r=>a({facialExpression:r.target.value}),placeholder:"Tight jaw, narrowed eyes, forced calm"})})]})]})},{id:"burden",eyebrow:"Burden",title:"Map fear, burden, job, and origin",description:"This is what turns a named mode into a readable inner-state profile.",render:(e,a)=>t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[t.jsx(i,{label:"Fear",description:"Name the threat this mode is trying hard to prevent.",labelHelp:"Fear is the danger the mode believes it must protect you from, such as rejection, shame, collapse, failure, or being trapped.",children:t.jsx(m,{value:e.fear,onChange:r=>a({fear:r.target.value}),placeholder:"If I relax, I will miss the threat and get hurt."})}),t.jsx(i,{label:"Burden",description:"Describe the emotional weight or exhausting role this mode keeps carrying.",labelHelp:"Burden is the heavy job or emotional load the mode feels stuck holding, even when it costs a lot.",children:t.jsx(m,{value:e.burden,onChange:r=>a({burden:r.target.value}),placeholder:"It believes it must never let the guard down, even when that means constant tension."})}),t.jsx(i,{label:"Protective job",description:"Describe the job this mode thinks it is performing for you.",labelHelp:"Protective job is the function the mode is trying to serve, like preventing rejection, keeping control, stopping humiliation, or preserving closeness.",children:t.jsx(m,{value:e.protectiveJob,onChange:r=>a({protectiveJob:r.target.value}),placeholder:"Keeps me prepared so I never get blindsided or look naive."})})]}),t.jsx(i,{label:"Origin context",description:"Describe when this mode first became useful or understandable.",labelHelp:"Origin context is the stretch of life where this mode likely learned its job or became especially necessary.",children:t.jsx(m,{value:e.originContext,onChange:r=>a({originContext:r.target.value}),placeholder:"Started getting stronger during adolescence when mistakes were met with criticism and unpredictability."})})]})},{id:"links",eyebrow:"Links",title:"Attach the mode to the rest of the psyche system",description:"Modes should connect to patterns, behaviors, and values, not sit in isolation.",render:(e,a)=>t.jsxs(t.Fragment,{children:[t.jsx(i,{label:"Linked patterns",description:"Choose the loops this mode tends to activate or maintain.",children:t.jsx(N,{options:V,selectedValues:e.linkedPatternIds,onChange:r=>a({linkedPatternIds:r}),placeholder:"Search or create a pattern…",emptyMessage:"No patterns match yet.",createLabel:"Create pattern",onCreate:X})}),t.jsx(i,{label:"Linked behaviors",description:"Choose the moves this mode tends to trigger, justify, or amplify.",children:t.jsx(N,{options:Z,selectedValues:e.linkedBehaviorIds,onChange:r=>a({linkedBehaviorIds:r}),placeholder:"Search or create a behavior…",emptyMessage:"No behaviors match yet.",createLabel:"Create behavior",onCreate:Y})}),t.jsx(i,{label:"Colliding values",description:"Choose the valued directions this mode most often interrupts.",labelHelp:"These are the values that get obscured, sidelined, or distorted when this mode takes over.",children:t.jsx(N,{options:W,selectedValues:e.linkedValueIds,onChange:r=>a({linkedValueIds:r}),placeholder:"Search or create a value…",emptyMessage:"No values match yet.",createLabel:"Create value",onCreate:ee})})]})}];if(v.isLoading||x.isLoading||w.isLoading||j.isLoading)return t.jsx(ce,{eyebrow:"Modes",title:"Loading modes",description:"Getting modes, linked patterns, behaviors, and values ready."});const _=v.error??x.error??w.error??j.error;if(_)return t.jsx(he,{eyebrow:"Modes",error:_,onRetry:()=>void Promise.all([v.refetch(),x.refetch(),w.refetch(),j.refetch()])});const k={coping:d.filter(e=>e.family==="coping"),child:d.filter(e=>e.family==="child"),critic_parent:d.filter(e=>e.family==="critic_parent"),healthy_adult:d.filter(e=>e.family==="healthy_adult"),happy_child:d.filter(e=>e.family==="happy_child")};return t.jsxs("div",{className:"grid gap-5",children:[t.jsx(Ne,{entityKind:"mode",title:t.jsx(Q,{kind:"mode",label:"Modes",variant:"heading",size:"lg"}),description:"Modes should look and feel like a cast of inner states with identity, burden, and relational links, not a flat list of records.",badge:`${d.length} modes`,actions:t.jsx(C,{onClick:()=>{u(null),l({...g,userId:c}),n(!0)},children:"Add mode"})}),t.jsx(pe,{}),t.jsx(Se,{eyebrow:"Mode families",title:"Modes by family",description:"Use these groups to see which modes show up most often, what role they play, and what they are connected to.",tone:"violet",children:d.length===0?t.jsx("div",{className:"flex justify-start",children:t.jsx(C,{onClick:()=>{u(null),l({...g,userId:c}),n(!0)},children:"Add mode"})}):t.jsx("div",{className:"grid gap-4 xl:grid-cols-2",children:Object.keys(k).map(e=>t.jsxs("div",{className:"grid gap-3 rounded-[26px] bg-white/[0.04] p-4",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(Le,{family:e,label:L[e]}),t.jsx(ue,{children:k[e].length})]}),k[e].length===0?t.jsx("div",{className:"flex",children:t.jsxs(C,{variant:"secondary",onClick:()=>{u(null),l({...g,userId:c}),n(!0)},children:["Add ",L[e].toLowerCase()]})}):k[e].map(a=>t.jsxs("div",{"data-psyche-focus-id":a.id,className:`rounded-[22px] bg-white/[0.04] p-4 text-left transition hover:bg-white/[0.08] ${Ee(B===a.id)}`,children:[t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{children:[t.jsx(me,{kind:"mode",compact:!0,gradient:!1}),t.jsx(Q,{kind:"mode",label:a.title,variant:"heading",size:"lg"})]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx(Pe,{entityType:"mode_profile",entityId:a.id,count:ge($,"mode_profile",a.id).count}),t.jsx(C,{variant:"secondary",size:"sm",onClick:()=>{u(a),l(Te(a)),n(!0)},children:"Edit"})]})]}),t.jsx("div",{className:"mt-2 text-sm text-white/52",children:a.archetype}),t.jsx("div",{className:"mt-3 text-sm leading-6 text-white/62",children:a.persona||a.protectiveJob||"Open the mode to add persona and protective details."})]},a.id))]},e))})}),t.jsx(ye,{open:U,onOpenChange:n,eyebrow:"Mode",title:p?"Refine cast member":"Create mode",description:"Use this guided flow to define the mode, how it shows up, what it is protecting, and where it comes from.",value:y,onChange:l,draftPersistenceKey:p?`psyche.mode.${p.id}`:"psyche.mode.new",steps:te,submitLabel:p?"Save mode":"Create mode",pending:A.isPending,error:z,onSubmit:async()=>{f(null);const e=K.safeParse(y);if(!e.success){f("This mode still needs a family and a name before it can be saved.");return}try{await A.mutateAsync(e.data)}catch(a){f(a instanceof Error?a.message:"Unable to save this mode right now.")}}})]})}export{$e as PsycheModesPage};
|