forge-openclaw-plugin 0.3.16 → 0.3.18
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/{action-bar-DgrmzFrI.js → action-bar-BAZevCEA.js} +1 -1
- package/dist/assets/{activity-page-CF451ueg.js → activity-page-CnT_hnCU.js} +1 -1
- package/dist/assets/{ai-surface-workspace-DtwybxJB.js → ai-surface-workspace-GPZzIIut.js} +1 -1
- package/dist/assets/artifacts-page-Bqjp0L-L.js +2 -0
- package/dist/assets/{atlas-panel-CB3uYk_K.js → atlas-panel-B95nrYpZ.js} +1 -1
- package/dist/assets/{board-CuxQRKPJ.js → board-CGgOvBP9.js} +1 -1
- package/dist/assets/{calendar-page-BYsDuLnh.js → calendar-page-mlr94wIS.js} +1 -1
- package/dist/assets/{calendar-rules-DXuOv2J-.js → calendar-rules-DdxPmBZJ.js} +1 -1
- package/dist/assets/{calendar-week-toolbar-8PJmiUE_.js → calendar-week-toolbar-Cu8V6zv1.js} +1 -1
- package/dist/assets/{charts-BzT4pUPg.js → charts-Cdtn55ol.js} +1 -1
- package/dist/assets/{companion-sync-lab-page-DzWNOaBh.js → companion-sync-lab-page-CJI5jf8W.js} +1 -1
- package/dist/assets/{daily-metrics-dashboard-CHcYxDhs.js → daily-metrics-dashboard-CXESx7bU.js} +1 -1
- package/dist/assets/{define-workbench-box-DcI0_QKW.js → define-workbench-box-Dbl9W7oE.js} +1 -1
- package/dist/assets/{entity-link-multiselect-C--AiCMb.js → entity-link-multiselect-DZ_jAjs4.js} +1 -1
- package/dist/assets/{entity-note-count-link-xne6mshj.js → entity-note-count-link-FOK_qhcC.js} +1 -1
- package/dist/assets/{entity-notes-surface-jy6Psist.js → entity-notes-surface-Dq9dFKjD.js} +1 -1
- package/dist/assets/execution-board-D9hkXKC2.js +1 -0
- package/dist/assets/{faceted-token-search-BMQ1Wwzt.js → faceted-token-search-BeShxjkc.js} +1 -1
- package/dist/assets/{flagship-signal-deck-DjcskRwF.js → flagship-signal-deck-DZx_HEH9.js} +1 -1
- package/dist/assets/{floating-action-menu-cGhbJ2tc.js → floating-action-menu-CFrgvQJi.js} +1 -1
- package/dist/assets/{forms-D1qJ3oOP.js → forms-DhEGHkFR.js} +1 -1
- package/dist/assets/{generic-node-view-DNVwfqqq.js → generic-node-view-C1kLClIm.js} +1 -1
- package/dist/assets/{goal-detail-page-dAbyCilO.js → goal-detail-page-BhMrnVQs.js} +1 -1
- package/dist/assets/{goal-dialog-DH50D0tP.js → goal-dialog-BlZHh3dw.js} +1 -1
- package/dist/assets/goals-page-CesC8IkZ.js +1 -0
- package/dist/assets/{graph-BF4IsheG.js → graph-U1J6VkbG.js} +1 -1
- package/dist/assets/habits-page-DHxZSThT.js +1 -0
- package/dist/assets/{health-boxes-BPTgGM6G.js → health-boxes-BZjIqiiG.js} +1 -1
- package/dist/assets/index-CHbe1sy1.css +1 -0
- package/dist/assets/index-Dj8q65se.js +2 -0
- package/dist/assets/{inline-note-fields-D4mCM1gO.js → inline-note-fields-DpmCMAJf.js} +1 -1
- package/dist/assets/{insight-flow-dialog-Btp6bkbV.js → insight-flow-dialog-DNIe0sts.js} +1 -1
- package/dist/assets/{insights-page-1qM4mxjS.js → insights-page-D_N_MWGu.js} +3 -3
- package/dist/assets/{kanban-boxes-u_A-UJG-.js → kanban-boxes-DTDG5UEJ.js} +1 -1
- package/dist/assets/{kanban-page-CKCa_3Qb.js → kanban-page-DEvIY5IW.js} +1 -1
- package/dist/assets/knowledge-graph-page-CvXSnnG5.js +1 -0
- package/dist/assets/{life-force-page-BZlyA144.js → life-force-page-CgvUrqQb.js} +1 -1
- package/dist/assets/{life-force-workspace-CtAWZXNw.js → life-force-workspace-BNeMbRHf.js} +1 -1
- package/dist/assets/{maps-BTVHALP8.js → maps-Dk9tZqTA.js} +1 -1
- package/dist/assets/{metric-tile-Bkx2btO2.js → metric-tile-DAhX60rg.js} +1 -1
- package/dist/assets/{motion-DcgUnXhY.js → motion-DeJZhOSA.js} +1 -1
- package/dist/assets/{movement-boxes-QZ2EIS9q.js → movement-boxes-BOqU18NH.js} +1 -1
- package/dist/assets/{movement-page-B-3ihggI.js → movement-page-DCDeUynh.js} +1 -1
- package/dist/assets/{note-markdown-BWedRE3c.js → note-markdown-Cxj84-0j.js} +1 -1
- package/dist/assets/{note-tags-input-DZkCqI1w.js → note-tags-input-CP0-EPpE.js} +1 -1
- package/dist/assets/{notes-boxes-DGFmt7Dp.js → notes-boxes-C7WPT7mf.js} +1 -1
- package/dist/assets/notes-page-Dll8PIks.js +1 -0
- package/dist/assets/{open-in-graph-button-CjvkEj1P.js → open-in-graph-button-BHl16hJP.js} +1 -1
- package/dist/assets/{orbit-map-CRHSPenk.js → orbit-map-De0qpMpY.js} +1 -1
- package/dist/assets/overview-page-C1RX7dcq.js +1 -0
- package/dist/assets/page-hero-DYmFM6-q.js +1 -0
- package/dist/assets/pill-cluster-ClkmFVFT.js +1 -0
- package/dist/assets/{preference-entity-handoff-button-CfCQl3cW.js → preference-entity-handoff-button-1XXtBsUF.js} +1 -1
- package/dist/assets/{preferences-page-OltGdsQ2.js → preferences-page-OwfPIQwe.js} +1 -1
- package/dist/assets/{project-collections-FfBIVwXu.js → project-collections-DfmkBk9d.js} +1 -1
- package/dist/assets/project-detail-page-BC_MNaca.js +1 -0
- package/dist/assets/{project-dialog-B_J1ESMk.js → project-dialog-BuZdXECa.js} +1 -1
- package/dist/assets/project-management-hierarchy-page-AhEHe60K.js +1 -0
- package/dist/assets/{project-management-section-nav-DBNHt9p5.js → project-management-section-nav-CnaseOqL.js} +1 -1
- package/dist/assets/{projects-boxes-BvlVsO5q.js → projects-boxes-D0zM8PfY.js} +1 -1
- package/dist/assets/projects-page-ltrWfLrA.js +1 -0
- package/dist/assets/psyche-behaviors-page-CPurgDg6.js +5 -0
- package/dist/assets/{psyche-flashcards-page-05606-97.js → psyche-flashcards-page-DnUSe-bb.js} +1 -1
- package/dist/assets/{psyche-goal-map-page-Cw-aqS3Y.js → psyche-goal-map-page-uWocO7kZ.js} +1 -1
- package/dist/assets/{psyche-graph-0E22QHPe.js → psyche-graph-BDszV3UN.js} +1 -1
- package/dist/assets/{psyche-metrics-page-DBFVPeMa.js → psyche-metrics-page-CIJLJTPy.js} +1 -1
- package/dist/assets/psyche-mode-guide-page-uC8L4WvH.js +1 -0
- package/dist/assets/psyche-modes-page-CtBeRA_3.js +1 -0
- package/dist/assets/psyche-page-Ds3QDsin.js +1 -0
- package/dist/assets/psyche-patterns-page-Cvq5WshW.js +5 -0
- package/dist/assets/{psyche-questionnaire-builder-page-DEt0UDsz.js → psyche-questionnaire-builder-page-Cg5Upe6z.js} +1 -1
- package/dist/assets/{psyche-questionnaire-detail-page-BXQbOE6A.js → psyche-questionnaire-detail-page-D4jEnNoh.js} +1 -1
- package/dist/assets/psyche-questionnaire-run-detail-page-CWoZEY31.js +1 -0
- package/dist/assets/{psyche-questionnaire-run-page-D_EokOQm.js → psyche-questionnaire-run-page-Yg_VG2vq.js} +1 -1
- package/dist/assets/{psyche-questionnaires-page-D1Ov2L4n.js → psyche-questionnaires-page-BqeOJRj7.js} +1 -1
- package/dist/assets/{psyche-report-detail-page-9HyPr8BJ.js → psyche-report-detail-page-BtcMQ7mk.js} +3 -3
- package/dist/assets/psyche-reports-page-tagvW0To.js +1 -0
- package/dist/assets/{psyche-schemas-DDol0j-g.js → psyche-schemas-CvRSkI_u.js} +1 -1
- package/dist/assets/psyche-schemas-beliefs-page-4NL3415v.js +9 -0
- package/dist/assets/{psyche-screen-time-page-DJMDR5oo.js → psyche-screen-time-page-Bc5AwZHQ.js} +1 -1
- package/dist/assets/{psyche-self-observation-page-DFKXG1Yv.js → psyche-self-observation-page-CUrUYbQ_.js} +1 -1
- package/dist/assets/{psyche-values-page-TWKth89J.js → psyche-values-page-BshT2sXE.js} +2 -2
- package/dist/assets/{question-flow-dialog-D-_EvoAt.js → question-flow-dialog-CPyXCqA-.js} +2 -2
- package/dist/assets/{report-chain-fields-Dy-jBQDn.js → report-chain-fields-C0UMLpze.js} +1 -1
- package/dist/assets/rewards-page-D9BzsNPW.js +1 -0
- package/dist/assets/{scheduling-rules-editor-CAd290IE.js → scheduling-rules-editor-DiA6KkQ4.js} +1 -1
- package/dist/assets/{schema-badge-BLaVI1D7.js → schema-badge-DURw2eYH.js} +1 -1
- package/dist/assets/{schemas-B0Pa-V-A.js → schemas-D_z2C8l1.js} +1 -1
- package/dist/assets/{select-menu-DcS4Ukjf.js → select-menu-BUB8__Nx.js} +1 -1
- package/dist/assets/{settings-agents-page-Bt38HhEJ.js → settings-agents-page-Kk98Whcf.js} +1 -1
- package/dist/assets/settings-bin-page-BnJ-mgy2.js +1 -0
- package/dist/assets/{settings-calendar-page-DPSSZV3s.js → settings-calendar-page-CdhlUnUW.js} +3 -3
- package/dist/assets/{settings-data-page-BdHsD1C_.js → settings-data-page-BvvuZNbb.js} +1 -1
- package/dist/assets/{settings-logs-page-D9OnWoFq.js → settings-logs-page-CrzkXxtZ.js} +1 -1
- package/dist/assets/{settings-mobile-page-DFpsXA4M.js → settings-mobile-page-Dl582NK6.js} +1 -1
- package/dist/assets/settings-models-page-COoBw28S.js +1 -0
- package/dist/assets/{settings-page-m_3iYPwU.js → settings-page-DqnlOCgo.js} +1 -1
- package/dist/assets/{settings-rewards-page-B2aBm-dA.js → settings-rewards-page-Cw5QSTjy.js} +1 -1
- package/dist/assets/{settings-section-nav-CMeU19Rx.js → settings-section-nav-C1NcWveT.js} +1 -1
- package/dist/assets/{settings-users-page-D8jyewJl.js → settings-users-page-0opvepcM.js} +1 -1
- package/dist/assets/{settings-wiki-page-DjOgQJAh.js → settings-wiki-page-CkpnUkiZ.js} +1 -1
- package/dist/assets/{sleep-page-D8-dA4bE.js → sleep-page-DrS1zs3B.js} +1 -1
- package/dist/assets/{sports-page-CK3PgPKB.js → sports-page-EVnB_zjB.js} +1 -1
- package/dist/assets/{state-Bpe5dF3T.js → state-DWw8Jay_.js} +1 -1
- package/dist/assets/{strategies-page-aFpJath-.js → strategies-page-COhyv_SH.js} +1 -1
- package/dist/assets/{strategy-detail-page-CobF5qLv.js → strategy-detail-page-BaCVkvIu.js} +1 -1
- package/dist/assets/{strategy-dialog-Fgoaoob5.js → strategy-dialog-DvlPo9WV.js} +1 -1
- package/dist/assets/{surface-D0dqgX-k.js → surface-Dg5fauKP.js} +1 -1
- package/dist/assets/{table-U7otr5go.js → table-CWVROEBP.js} +1 -1
- package/dist/assets/task-detail-page-3IeMYIXl.js +1 -0
- package/dist/assets/{task-dialog-eCDTF8xe.js → task-dialog-B7ZT4KE5.js} +5 -5
- package/dist/assets/timebox-planning-dialog-DoZzpEBp.js +1 -0
- package/dist/assets/{today-boxes-CYfskVrM.js → today-boxes-BbUNpb16.js} +1 -1
- package/dist/assets/today-page-adKXN2g1.js +1 -0
- package/dist/assets/training-load-page-DTYbu9f0.js +1 -0
- package/dist/assets/{ui-B9TWEtCx.js → ui-CdEDMtXF.js} +1 -1
- package/dist/assets/{use-anchored-overlay-position-BY4kNzPj.js → use-anchored-overlay-position-Cracjgo6.js} +1 -1
- package/dist/assets/{use-psyche-focus-target-BhNedCZB.js → use-psyche-focus-target-DvRgu-94.js} +1 -1
- package/dist/assets/{user-badge-MEZuJiir.js → user-badge-B8hYK6NU.js} +1 -1
- package/dist/assets/{user-select-field-fx129Uh6.js → user-select-field-akGHK-2t.js} +1 -1
- package/dist/assets/{utility-widgets-h5eG2jvc.js → utility-widgets-D4KsKxLT.js} +2 -2
- package/dist/assets/{vendor-BwL6m4SE.js → vendor-y_uz1Wft.js} +222 -212
- package/dist/assets/{vitals-page-eoFnQ3XL.js → vitals-page-Cjcxh-kO.js} +1 -1
- package/dist/assets/{weekly-review-page-C7BU1gkK.js → weekly-review-page-CR57efzH.js} +1 -1
- package/dist/assets/{weight-loss-page-Cc7Do3XY.js → weight-loss-page-Bk7YkB7b.js} +1 -1
- package/dist/assets/{wiki-article-markdown-CCKoSptz.js → wiki-article-markdown-um6gpmGQ.js} +2 -2
- package/dist/assets/{wiki-editor-page-BpbxZrgz.js → wiki-editor-page-DdP5hvjZ.js} +5 -5
- package/dist/assets/{wiki-ingest-history-page-D5Wfr8pc.js → wiki-ingest-history-page-DSTndduq.js} +1 -1
- package/dist/assets/{wiki-ingest-modal-DhRVsEwC.js → wiki-ingest-modal-PNW3CJ-o.js} +1 -1
- package/dist/assets/wiki-page-CsJlPyQ6.js +1 -0
- package/dist/assets/{workbench-flow-page-y9FxDbKO.js → workbench-flow-page-DFtIKgNe.js} +3 -3
- package/dist/assets/{workbench-page-Da16AZvN.js → workbench-page-DEpKjMEv.js} +1 -1
- package/dist/assets/workout-detail-page-BwfEhxA_.js +2 -0
- package/dist/index.html +8 -8
- package/dist/openclaw/parity.d.ts +1 -1
- package/dist/openclaw/parity.js +10 -0
- package/dist/openclaw/routes.js +78 -0
- package/dist/openclaw/tools.js +42 -0
- package/dist/server/apps/api/migrations/072_artifact_store.sql +106 -0
- package/dist/server/apps/api/migrations/073_artifact_entity_links_repair.sql +24 -0
- package/dist/server/apps/api/src/app.js +364 -3
- package/dist/server/apps/api/src/openapi.js +570 -1
- package/dist/server/apps/api/src/repositories/entity-links.js +66 -0
- package/dist/server/apps/api/src/services/artifacts.js +1059 -0
- package/dist/server/apps/api/src/services/entity-crud.js +22 -0
- package/dist/server/apps/api/src/services/knowledge-graph.js +45 -0
- package/dist/server/apps/api/src/services/psyche-observation-calendar.js +1 -0
- package/dist/server/apps/api/src/types.js +2 -0
- package/dist/server/apps/web/src/lib/api.js +69 -0
- package/dist/server/apps/web/src/lib/entity-visuals.js +10 -1
- package/dist/server/apps/web/src/lib/knowledge-graph-types.js +9 -0
- package/openclaw.plugin.json +2 -1
- package/package.json +1 -1
- package/server/migrations/072_artifact_store.sql +106 -0
- package/server/migrations/073_artifact_entity_links_repair.sql +24 -0
- package/skills/forge-openclaw/SKILL.md +57 -4
- package/skills/forge-openclaw/entity_conversation_playbooks.md +215 -14
- package/skills/forge-openclaw/psyche_entity_playbooks.md +20 -0
- package/dist/assets/execution-board-BSUZCIIx.js +0 -1
- package/dist/assets/goals-page-DkMy9mPD.js +0 -1
- package/dist/assets/habits-page-CCQR8rg6.js +0 -1
- package/dist/assets/index-VzCGTBS_.css +0 -1
- package/dist/assets/index-izRKx6JK.js +0 -2
- package/dist/assets/knowledge-graph-page-BZOxRv19.js +0 -1
- package/dist/assets/notes-page-DYkn04tz.js +0 -1
- package/dist/assets/overview-page-D6LsjPWe.js +0 -1
- package/dist/assets/page-hero-BLhM8FF3.js +0 -1
- package/dist/assets/pill-cluster-B5bYs_e2.js +0 -1
- package/dist/assets/project-detail-page-CCm3iZPQ.js +0 -1
- package/dist/assets/project-management-hierarchy-page-BNzvtNZj.js +0 -1
- package/dist/assets/projects-page-BUf7KV-_.js +0 -1
- package/dist/assets/psyche-behaviors-page-jtyhdpJ1.js +0 -5
- package/dist/assets/psyche-mode-guide-page-DI-LNEDT.js +0 -1
- package/dist/assets/psyche-modes-page-CaMupyfi.js +0 -1
- package/dist/assets/psyche-page-CFBq0YKf.js +0 -1
- package/dist/assets/psyche-patterns-page-sp4ikoef.js +0 -5
- package/dist/assets/psyche-questionnaire-run-detail-page-Cd3ClsSK.js +0 -1
- package/dist/assets/psyche-reports-page-BeyJg5fb.js +0 -1
- package/dist/assets/psyche-schemas-beliefs-page-DNmf-Vma.js +0 -9
- package/dist/assets/rewards-page-D3ymEd2X.js +0 -1
- package/dist/assets/settings-bin-page-DqyVI1i1.js +0 -1
- package/dist/assets/settings-models-page-DaFXLp-O.js +0 -1
- package/dist/assets/task-detail-page-CDK79bzk.js +0 -1
- package/dist/assets/timebox-planning-dialog-CNZIGSpd.js +0 -1
- package/dist/assets/today-page-Bnh8wopq.js +0 -1
- package/dist/assets/training-load-page-C7lq-jqy.js +0 -1
- package/dist/assets/wiki-page-1vf-HErs.js +0 -1
- package/dist/assets/workout-detail-page-Cq0YamXF.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{j as r,r as v}from"./vendor-
|
|
1
|
+
import{j as r,r as v}from"./vendor-y_uz1Wft.js";import{c as x,ch as b,b7 as $}from"./index-Dj8q65se.js";function p(d,s){const i=[],e=/(!?\[\[([^\]]+)\]\]|\[([^\]]+)\]\(([^)]+)\)|`([^`]+)`|\*\*([^*]+)\*\*|\*([^*]+)\*)/g;let l=0,n=null,a=0;for(;(n=e.exec(d))!==null;){if(n.index>l&&(i.push(r.jsx(v.Fragment,{children:d.slice(l,n.index)},`${s}-text-${a}`)),a+=1),n[1]&&n[2]){const o=n[2].trim(),t=n[1].startsWith("!"),c=o.indexOf("|"),h=c>=0?o.slice(0,c).trim():o,m=c>=0?o.slice(c+1).trim():h;if(h.toLowerCase().startsWith("forge:")){const[,u,g]=h.split(":"),w=u&&g?$(u,g):null,f=w?b(w):null;i.push(f?r.jsxs("a",{href:f,className:"inline-flex min-w-0 max-w-full items-center gap-1 rounded-full border border-[var(--warning)]/20 bg-[var(--ui-warning-soft)] px-2 py-0.5 text-[0.9em] text-[color-mix(in_srgb,var(--warning)_78%,var(--ui-ink-strong)_22%)] transition hover:bg-[var(--ui-surface-3)]",children:[r.jsx("span",{className:"shrink-0 text-[0.72em] uppercase tracking-[0.14em] text-[var(--ui-ink-faint)]",children:"Forge"}),r.jsx("span",{className:"min-w-0 break-words [overflow-wrap:anywhere]",children:m})]},`${s}-forge-${a}`):r.jsx("span",{className:"inline-flex min-w-0 max-w-full items-center gap-1 rounded-full bg-[var(--ui-surface-2)] px-2 py-0.5 text-[0.9em] text-[var(--ui-ink-soft)]",children:r.jsx("span",{className:"min-w-0 break-words [overflow-wrap:anywhere]",children:m})},`${s}-forge-${a}`))}else{const u=b(`/wiki/page/${encodeURIComponent(h)}`);i.push(r.jsxs("a",{href:u,className:x("inline-flex min-w-0 max-w-full items-center gap-1 rounded-full px-2 py-0.5 text-[0.9em] transition",t?"border border-[var(--info)]/20 bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_78%,var(--ui-ink-strong)_22%)] hover:bg-[var(--ui-surface-3)]":"bg-[var(--ui-surface-2)] text-[var(--secondary)] hover:bg-[var(--ui-surface-3)]"),children:[t?r.jsx("span",{className:"shrink-0 text-[0.72em] uppercase tracking-[0.14em] text-[var(--ui-ink-faint)]",children:"Embed"}):null,r.jsx("span",{className:"min-w-0 break-words [overflow-wrap:anywhere]",children:m})]},`${s}-wiki-${a}`))}}else if(n[3]&&n[4]){const o=n[4].trim(),t=/^https?:\/\//i.test(o);i.push(r.jsx("a",{href:o,className:"break-words text-[var(--secondary)] underline decoration-current/35 underline-offset-4 transition hover:text-[var(--ui-ink-strong)] [overflow-wrap:anywhere]",target:t?"_blank":void 0,rel:t?"noreferrer":void 0,children:n[3]},`${s}-link-${a}`))}else n[5]?i.push(r.jsx("code",{className:"rounded bg-[var(--ui-surface-2)] px-1.5 py-0.5 text-[0.92em] text-[var(--ui-ink-strong)] [overflow-wrap:anywhere]",children:n[5]},`${s}-code-${a}`)):n[6]?i.push(r.jsx("strong",{className:"font-semibold text-[var(--ui-ink-strong)]",children:n[6]},`${s}-strong-${a}`)):n[7]&&i.push(r.jsx("em",{className:"italic text-[var(--ui-ink-medium)]",children:n[7]},`${s}-em-${a}`));l=e.lastIndex,a+=1}return l<d.length&&i.push(r.jsx(v.Fragment,{children:d.slice(l)},`${s}-tail-${a}`)),i}function j(d){const s=d.replace(/\r/g,"").split(`
|
|
2
2
|
`),i=[];let e=0;for(;e<s.length;){const l=s[e]??"",n=l.trim();if(!n){e+=1;continue}if(n.startsWith("```")){const t=[];for(e+=1;e<s.length&&!(s[e]??"").trim().startsWith("```");)t.push(s[e]??""),e+=1;e+=1,i.push(r.jsx("pre",{className:"max-w-full overflow-x-auto rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3 text-xs leading-6 text-[var(--ui-ink-strong)]",children:r.jsx("code",{className:"block min-w-0 whitespace-pre",children:t.join(`
|
|
3
3
|
`)})},`code-${e}`));continue}const a=l.match(/^(#{1,6})\s+(.*)$/);if(a){const t=a[1].length,c=t===1?"text-xl":t===2?"text-lg":t===3?"text-base":"text-sm";i.push(r.jsx("div",{className:x("font-semibold text-[var(--ui-ink-strong)]",c),children:p(a[2],`heading-${e}`)},`heading-${e}`)),e+=1;continue}if(/^>\s?/.test(l)){const t=[];for(;e<s.length&&/^>\s?/.test(s[e]??"");)t.push((s[e]??"").replace(/^>\s?/,"")),e+=1;i.push(r.jsx("blockquote",{className:"min-w-0 border-l-2 border-[var(--secondary)]/50 pl-4 text-sm leading-7 text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",children:p(t.join(" "),`quote-${e}`)},`quote-${e}`));continue}if(/^[-*+]\s+/.test(l)||/^\d+\.\s+/.test(l)){const t=/^\d+\.\s+/.test(l),c=[];for(;e<s.length&&(/^[-*+]\s+/.test(s[e]??"")||/^\d+\.\s+/.test(s[e]??""));)c.push((s[e]??"").replace(/^[-*+]\s+/,"").replace(/^\d+\.\s+/,"")),e+=1;const h=t?"ol":"ul";i.push(r.jsx(h,{className:x("min-w-0 space-y-1 pl-5 text-sm leading-7 text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",t?"list-decimal":"list-disc"),children:c.map((m,u)=>r.jsx("li",{className:"min-w-0",children:p(m,`list-${e}-${u}`)},`item-${e}-${u}`))},`list-${e}`));continue}const o=[];for(;e<s.length;){const t=s[e]??"";if(!t.trim()||t.trim().startsWith("```")||/^#{1,6}\s+/.test(t)||/^>\s?/.test(t)||/^[-*+]\s+/.test(t)||/^\d+\.\s+/.test(t))break;o.push(t.trim()),e+=1}i.push(r.jsx("p",{className:"min-w-0 text-sm leading-7 text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",children:p(o.join(" "),`paragraph-${e}`)},`paragraph-${e}`))}return i}function y({markdown:d,className:s}){return r.jsx("div",{className:x("grid min-w-0 max-w-full gap-3",s),children:j(d)})}export{y as N};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as i}from"./vendor-
|
|
1
|
+
import{j as i}from"./vendor-y_uz1Wft.js";import{j as s}from"./index-Dj8q65se.js";import{E as c}from"./entity-link-multiselect-DZ_jAjs4.js";const m=[{value:"Working memory",label:"Working memory",description:"What you are actively working on right now."},{value:"Short-term memory",label:"Short-term memory",description:"What just happened and still needs near-term recall."},{value:"Episodic memory",label:"Episodic memory",description:"Long-term recall for what happened or what you did."},{value:"Semantic memory",label:"Semantic memory",description:"Long-term knowledge about what something is."},{value:"Procedural memory",label:"Procedural memory",description:"Long-term know-how and repeatable how-to knowledge."}];function l(o){const r=new Set;return o.map(t=>t.trim()).filter(Boolean).filter(t=>{const a=t.toLowerCase();return r.has(a)?!1:(r.add(a),!0)})}function f(o){const r=o.trim();if(!r)return null;const t=new Date(r);return Number.isNaN(t.getTime())?null:t.toISOString()}function v(o){if(!o)return"";const r=new Date(o);if(Number.isNaN(r.getTime()))return"";const t=r.getFullYear(),a=String(r.getMonth()+1).padStart(2,"0"),e=String(r.getDate()).padStart(2,"0"),u=String(r.getHours()).padStart(2,"0"),n=String(r.getMinutes()).padStart(2,"0");return`${t}-${a}-${e}T${u}:${n}`}function h(o,r){const t=Number(o);if(!Number.isFinite(t)||t<=0)return null;const a=r==="hours"?3600*1e3:1440*60*1e3;return new Date(Date.now()+t*a).toISOString()}function d(o){const r=new Set(m.map(e=>e.value.toLowerCase())),t=m.map(e=>({value:e.value,label:e.label,description:e.description,searchText:`${e.label} ${e.description}`,badge:i.jsx(s,{className:"border border-[color-mix(in_srgb,var(--info)_32%,var(--ui-border-subtle)_68%)] bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_74%,var(--ui-ink-strong)_26%)]",children:e.label}),menuBadge:i.jsx(s,{className:"border border-[color-mix(in_srgb,var(--info)_32%,var(--ui-border-subtle)_68%)] bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_74%,var(--ui-ink-strong)_26%)]",children:e.label})})),a=l(o).filter(e=>!r.has(e.toLowerCase())).map(e=>({value:e,label:e,description:"Custom note tag",searchText:e,badge:i.jsx(s,{className:"border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:e}),menuBadge:i.jsx(s,{className:"border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:e})}));return[...t,...a]}function x({value:o,onChange:r,availableTags:t=[],placeholder:a="Add a memory tag or create a custom tag"}){const e=d([...t,...o]);return i.jsx(c,{options:e,selectedValues:l(o),onChange:u=>r(l(u)),placeholder:a,emptyMessage:"No note tags yet.",createLabel:"Add custom tag",onCreate:async u=>{const n=u.trim();return{value:n,label:n,description:"Custom note tag",searchText:n,badge:i.jsx(s,{className:"border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:n}),menuBadge:i.jsx(s,{className:"border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:n})}}})}export{x as N,h as b,v as f,l as n,f as p};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as i}from"./vendor-
|
|
1
|
+
import{j as i}from"./vendor-y_uz1Wft.js";import{c as a,a as t,b as c,d as m,e as p,f as l,g as u,j as f,m as d}from"./generic-node-view-C1kLClIm.js";import{d as n}from"./define-workbench-box-Dbl9W7oE.js";function s({children:e}){return i.jsx(i.Fragment,{children:e})}const o=m({itemKind:"note",itemLabel:"Note",defaultEntityTypes:["note"],defaultLimit:20}),r=p(),x=n(s,{id:"surface:notes-index:filters",surfaceId:"notes-index",routePath:"/notes",title:"Note filters",icon:"filter",description:"Entity, tag, text, author, and date filters for notes.",category:"Notes",tags:["notes","filters","search"],inputs:o,params:r,output:[t({label:"Filter summary",description:"Summary of the current note filters and search scope."})],tools:[u("Search Forge entities by query and entity types.")],NodeView:a({title:"Note filters",description:"Entity, tag, text, author, and date filters for notes.",inputs:o,params:r,output:[t({label:"Filter summary",description:"Summary of the current note filters and search scope."})],tools:[u("Search Forge entities by query and entity types.")]}),execute:e=>l(e,{query:"",entityTypes:["note"],limit:20})}),N=n(s,{id:"surface:notes-index:composer",surfaceId:"notes-index",routePath:"/notes",title:"Note composer",icon:"write",description:"Markdown note composer with links, tags, and capture actions.",category:"Notes",tags:["notes","composer","capture"],inputs:o,params:r,output:[t({label:"Draft summary",description:"Summary of the current note drafting surface."})],tools:[d("Create an evidence note from markdown content.")],NodeView:a({title:"Note composer",description:"Markdown note composer with links, tags, and capture actions.",inputs:o,params:r,output:[t({label:"Draft summary",description:"Summary of the current note drafting surface."})],tools:[d("Create an evidence note from markdown content.")]}),execute:e=>f(e,{draftable:!0},"This node can draft or create a note.")}),g=n(s,{id:"surface:notes-index:library",surfaceId:"notes-index",routePath:"/notes",title:"Notes library",icon:"library",description:"Filtered library of Forge notes and linked evidence.",category:"Notes",tags:["notes","library","history"],inputs:[],params:[],output:c({itemKind:"note",itemLabel:"Note"}),tools:[],NodeView:a({title:"Notes library",description:"Filtered library of Forge notes and linked evidence.",inputs:[],params:[],output:c({itemKind:"note",itemLabel:"Note"}),tools:[]}),execute:e=>l(e,{query:"",entityTypes:["note"],limit:20})});export{x as N,N as a,g as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as m,j as e,aK as Ae,cv as Ce,b8 as Qe,b7 as Re,bZ as ze,b4 as He,c0 as Ye,c1 as Ze,bY as Ge,cd as Je}from"./vendor-y_uz1Wft.js";import{j as We,i as F,k as ie}from"./state-DWw8Jay_.js";import{E as Fe}from"./entity-link-multiselect-DZ_jAjs4.js";import{b as De,j as z,c as Xe,d as et,g as f,b5 as J,b6 as _e,b7 as Ie,e as tt,B as Q,C as _,z as P,y as at,I as D,T as Le,h as st,b8 as it,b9 as nt,ba as rt,aj as ot,bb as lt,i as dt,bc as ct,bd as ut,be as mt,bf as pt,bg as xt,bh as ht,bi as gt,Z as vt,bj as yt}from"./index-Dj8q65se.js";import{N as ne}from"./note-markdown-Cxj84-0j.js";import{N as re,n as X,f as ft,p as bt,b as kt}from"./note-tags-input-CP0-EPpE.js";import{P as jt}from"./page-hero-DYmFM6-q.js";import{N as Nt,a as wt,b as Tt}from"./notes-boxes-C7WPT7mf.js";import{F as St}from"./floating-action-menu-CFrgvQJi.js";import{b,d as k}from"./user-ownership-DJGl4rAj.js";import"./use-anchored-overlay-position-Cracjgo6.js";import"./motion-DeJZhOSA.js";import"./ui-CdEDMtXF.js";import"./board-CGgOvBP9.js";import"./forms-DhEGHkFR.js";import"./generic-node-view-C1kLClIm.js";import"./graph-U1J6VkbG.js";import"./define-workbench-box-Dbl9W7oE.js";function Mt(i){return i.trim().toLowerCase()}function At(i,o){return i.includes(o)?i:[...i,o]}function Ct({entityOptions:i,selectedEntityValues:o,onSelectedEntityValuesChange:d,selectedTextTerms:u,onSelectedTextTermsChange:I,placeholder:j="Filter by linked entity or add free text"}){const[S,M]=m.useState(""),[ee,g]=m.useState(!1),[H,v]=m.useState(0),B=Mt(S),A=m.useMemo(()=>o.map(s=>i.find(c=>c.value===s)).filter(Boolean),[i,o]),L=m.useMemo(()=>{const s=i.filter(c=>!o.includes(c.value));return B?s.filter(c=>`${c.label} ${c.description??""} ${c.searchText??""}`.toLowerCase().includes(B)).slice(0,8):s.slice(0,8)},[i,B,o]),N=S.trim().length>0&&!u.includes(S.trim()),Y=s=>{d(At(o,s)),M(""),v(0),g(!1)},K=(s=S)=>{const c=s.trim();!c||u.includes(c)||(I([...u,c]),M(""),v(0),g(!1))},$=s=>{d(o.filter(c=>c!==s))},p=s=>{I(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-[var(--ui-ink-muted)]",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-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-2.5 py-1 text-[10px] tracking-[0.14em] text-[var(--ui-ink-medium)] transition hover:bg-[var(--ui-surface-2)] hover:text-[var(--ui-ink-strong)] disabled:cursor-not-allowed disabled:opacity-40",children:"Free text"})]}),e.jsxs("div",{className:"rounded-[24px] border border-[var(--ui-border-subtle)] bg-[image:var(--ui-surface-section)] px-4 py-3 shadow-[var(--ui-shadow-floating)]",children:[A.length>0||u.length>0?e.jsxs("div",{className:"mb-3 flex flex-wrap gap-2",children:[A.map(s=>e.jsxs("span",{className:"inline-flex max-w-full items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-2.5 py-1.5",children:[s.kind?e.jsx(De,{kind:s.kind,label:s.label,compact:!0,gradient:!1,className:"max-w-[16rem]"}):e.jsx(z,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:s.label}),e.jsx("button",{type:"button",className:"rounded-full text-[var(--ui-ink-muted)] transition hover:text-[var(--ui-ink-strong)]",onClick:()=>$(s.value),"aria-label":`Remove ${s.label}`,children:e.jsx(Ae,{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-[color-mix(in_srgb,var(--info)_24%,transparent)] bg-[var(--ui-info-soft)] px-2.5 py-1.5 text-sm text-[color-mix(in_srgb,var(--info)_78%,var(--ui-ink-strong)_22%)]",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(Ce,{className:"size-3.5"}),e.jsx("span",{className:"max-w-[16rem] truncate",children:s})]}),e.jsx("button",{type:"button",className:"rounded-full text-[color-mix(in_srgb,var(--info)_70%,var(--ui-ink-strong)_30%)] transition hover:text-[var(--ui-ink-strong)]",onClick:()=>p(s),"aria-label":`Remove free-text filter ${s}`,children:e.jsx(Ae,{className:"size-3.5"})})]},s))]}):null,u.length>1?e.jsx("div",{className:"mb-3 text-xs text-[var(--ui-ink-muted)]",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-[var(--ui-ink-muted)]"}),e.jsx("input",{value:S,onChange:s=>{M(s.target.value),g(!0),v(0)},onFocus:()=>g(!0),onBlur:()=>{window.setTimeout(()=>g(!1),120)},onKeyDown:s=>{if(s.key==="Backspace"&&!S){if(u.length>0){p(u[u.length-1]);return}o.length>0&&$(o[o.length-1]);return}if(s.key==="ArrowDown"){s.preventDefault(),g(!0),v(w=>L.length===0?0:Math.min(L.length-1,w+1));return}if(s.key==="ArrowUp"){s.preventDefault(),v(w=>Math.max(0,w-1));return}if(s.key==="Escape"){g(!1);return}if(s.key!=="Enter")return;s.preventDefault();const c=L[H];if(c){Y(c.value);return}K()},placeholder:j,className:"min-w-0 flex-1 bg-transparent text-sm text-[var(--ui-ink-strong)] placeholder:text-[var(--ui-ink-muted)] focus:outline-none"})]}),ee?e.jsxs("div",{className:"absolute top-full z-20 mt-2 w-full rounded-[22px] border border-[var(--ui-border-subtle)] bg-[image:var(--ui-surface-modal)] p-2 shadow-[var(--ui-shadow-floating)] backdrop-blur-xl",children:[L.map((s,c)=>e.jsx("button",{type:"button",className:Xe("flex w-full items-start justify-between gap-3 rounded-[18px] px-3 py-2.5 text-left transition",c===H?"bg-[var(--ui-surface-2)] text-[var(--ui-ink-strong)]":"text-[var(--ui-ink-medium)] hover:bg-[var(--ui-surface-2)] hover:text-[var(--ui-ink-strong)]"),onMouseEnter:()=>v(c),onMouseDown:w=>w.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(De,{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-[var(--ui-ink-muted)]",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-[color-mix(in_srgb,var(--info)_78%,var(--ui-ink-strong)_22%)] transition hover:bg-[var(--ui-surface-2)]",onMouseDown:s=>s.preventDefault(),onClick:()=>K(),children:[e.jsx(Ce,{className:"size-4"}),e.jsxs("span",{className:"truncate",children:['Add free text "',S.trim(),'"']})]}):null,L.length===0&&!N?e.jsx("div",{className:"px-3 py-2.5 text-sm text-[var(--ui-ink-muted)]",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","artifact","habit","tag","psyche_value","behavior_pattern","behavior","belief_entry","mode_profile","flashcard","trigger_report"]);function Pe(i){return Ft.has(i)}function x(i,o){return`${i}:${o}`}function W(i){const o=i.indexOf(":");if(o<=0||o>=i.length-1)return null;const d=i.slice(0,o);return Pe(d)?{entityType:d,entityId:i.slice(o+1)}:null}function Ee(i){return i!==null}function $e(i){const o=i.getAll("linkedTo"),d=i.get("entityType"),u=i.get("entityId");return d&&u&&Pe(d)&&o.unshift(x(d,u)),Array.from(new Set(o.map(I=>I.trim()).filter(Boolean)))}function Dt(i){return Array.from(new Set(i.getAll("textTerms").map(o=>o.trim()).filter(Boolean)))}function _t(i){return X(i.getAll("tags"))}function R(i,o=[]){return{contentMarkdown:(i==null?void 0:i.contentMarkdown)??"",author:(i==null?void 0:i.author)??"",linkedValues:(i==null?void 0:i.links.map(d=>x(d.entityType,d.entityId)))??o,tags:X((i==null?void 0:i.tags)??[]),destroyAtInput:ft((i==null?void 0:i.destroyAt)??null),destroyDelayValue:"",destroyDelayUnit:"days"}}function It(i){return[...i].sort((o,d)=>o.label.localeCompare(d.label))}function qe(i){return bt(i.destroyAtInput)??kt(i.destroyDelayValue,i.destroyDelayUnit)}function Xt(){var ye,fe,be,ke,je,Ne,we,Te;const i=Re(),o=We(),d=et(),[u,I]=ze(),[j,S]=m.useState(()=>$e(u)),[M,ee]=m.useState(()=>_t(u)),[g,H]=m.useState(()=>Dt(u)),[v,B]=m.useState(u.get("author")??""),[A,L]=m.useState(u.get("updatedFrom")??""),[N,Y]=m.useState(u.get("updatedTo")??""),[K,$]=m.useState(!1),[p,s]=m.useState(()=>R(null,$e(u))),[c,w]=m.useState(null),[y,T]=m.useState(null),[q,oe]=m.useState(null),le=F({queryKey:["forge-psyche-values"],queryFn:ct}),de=F({queryKey:["forge-psyche-patterns"],queryFn:ut}),ce=F({queryKey:["forge-psyche-behaviors"],queryFn:mt}),ue=F({queryKey:["forge-psyche-beliefs"],queryFn:pt}),me=F({queryKey:["forge-psyche-modes"],queryFn:xt}),pe=F({queryKey:["forge-psyche-flashcards"],queryFn:ht}),xe=F({queryKey:["forge-psyche-reports"],queryFn:gt}),he=Array.isArray(d.selectedUserIds)?d.selectedUserIds:[],U=F({queryKey:["forge-life-force",...he],queryFn:async()=>(await vt(he)).lifeForce});m.useEffect(()=>{const a=new URLSearchParams;for(const n of j)a.append("linkedTo",n);for(const n of M)a.append("tags",n);for(const n of g)a.append("textTerms",n);v.trim()&&a.set("author",v.trim()),A&&a.set("updatedFrom",A),N&&a.set("updatedTo",N),I(a,{replace:!0})},[v,j,M,g,I,A,N]);const Z=m.useMemo(()=>{var n,h,G,l,r,Se,Me;const a=[...d.snapshot.goals.map(t=>({value:x("goal",t.id),label:t.title,description:k(t.description,t.user,"Goal"),searchText:b([t.title,t.description],t),kind:f("goal")??void 0})),...d.snapshot.dashboard.projects.map(t=>({value:x("project",t.id),label:t.title,description:k(`${t.description}${t.description?" · ":""}${t.goalTitle}`,t.user,t.goalTitle),searchText:b([t.title,t.description,t.goalTitle],t),kind:f("project")??void 0})),...d.snapshot.tasks.map(t=>({value:x("task",t.id),label:t.title,description:k(`${t.description}${t.description?" · ":""}${t.owner}`,t.user,t.owner),searchText:b([t.title,t.description,t.owner],t),kind:f("task")??void 0})),...d.snapshot.strategies.map(t=>({value:x("strategy",t.id),label:t.title,description:k(t.overview,t.user,"Strategy"),searchText:b([t.title,t.overview,t.endStateDescription],t),kind:f("strategy")??void 0})),...d.snapshot.habits.map(t=>({value:x("habit",t.id),label:t.title,description:k(t.description,t.user,"Habit"),searchText:b([t.title,t.description],t),kind:f("habit")??void 0})),...d.snapshot.tags.map(t=>({value:x("tag",t.id),label:t.name,description:k(t.description,t.user,t.kind),searchText:b([t.name,t.kind,t.description],t),kind:f("tag")??void 0})),...(((n=le.data)==null?void 0:n.values)??[]).map(t=>({value:x("psyche_value",t.id),label:t.title,description:k(t.description,t.user,"Psyche value"),searchText:b([t.title,t.description,t.valuedDirection],t),kind:f("psyche_value")??void 0})),...(((h=de.data)==null?void 0:h.patterns)??[]).map(t=>({value:x("behavior_pattern",t.id),label:t.title,description:k(t.description,t.user,"Behavior pattern"),searchText:b([t.title,t.description,t.targetBehavior],t),kind:f("behavior_pattern")??void 0})),...(((G=ce.data)==null?void 0:G.behaviors)??[]).map(t=>({value:x("behavior",t.id),label:t.title,description:k(t.description,t.user,"Behavior"),searchText:b([t.title,t.description,t.kind],t),kind:f("behavior")??void 0})),...(((l=ue.data)==null?void 0:l.beliefs)??[]).map(t=>({value:x("belief_entry",t.id),label:t.statement,description:k(t.flexibleAlternative||t.originNote,t.user,"Belief"),searchText:b([t.statement,t.flexibleAlternative,t.originNote],t),kind:f("belief_entry")??void 0})),...(((r=me.data)==null?void 0:r.modes)??[]).map(t=>({value:x("mode_profile",t.id),label:t.title,description:k(t.archetype||t.family,t.user,"Mode"),searchText:b([t.title,t.archetype,t.family,t.persona],t),kind:f("mode_profile")??void 0})),...(((Se=pe.data)==null?void 0:Se.flashcards)??[]).map(t=>({value:x("flashcard",t.id),label:t.title||t.message,description:k(t.triggerSentence||t.triggerSituation,t.user,"Flashcard"),searchText:b([t.title,t.message,t.triggerSentence,t.triggerSituation,...t.tags],t),kind:f("flashcard")??void 0})),...(((Me=xe.data)==null?void 0:Me.reports)??[]).map(t=>({value:x("trigger_report",t.id),label:t.title,description:k(t.eventSituation,t.user,"Trigger report"),searchText:b([t.title,t.eventSituation,t.customEventType??""],t),kind:f("trigger_report")??void 0}))];return It(a)},[(ye=ce.data)==null?void 0:ye.behaviors,(fe=ue.data)==null?void 0:fe.beliefs,(be=pe.data)==null?void 0:be.flashcards,(ke=me.data)==null?void 0:ke.modes,(je=de.data)==null?void 0:je.patterns,(Ne=xe.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,(we=le.data)==null?void 0:we.values]),Be=m.useMemo(()=>Z.map(a=>{const n=W(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)??""}}),[Z]),Ke=m.useMemo(()=>j.map(a=>W(a)).filter(Boolean),[j]),V=F({queryKey:["notes-index",j.join("|"),M.join("|"),g.join("|"),v.trim(),A,N],queryFn:()=>yt({linkedTo:Ke,tags:M,textTerms:g,author:v.trim()||void 0,updatedFrom:A||void 0,updatedTo:N||void 0,limit:200})}),te=async()=>{await Promise.all([o.invalidateQueries({queryKey:["notes-index"]}),dt(o)])},ge=ie({mutationFn:async a=>ot({contentMarkdown:a.contentMarkdown.trim(),author:a.author.trim()||null,tags:X(a.tags),destroyAt:qe(a),links:a.linkedValues.map(n=>W(n)).filter(Ee).map(n=>({entityType:n.entityType,entityId:n.entityId}))}),onSuccess:async()=>{s(R(null,j)),$(!1),await te()}}),ve=ie({mutationFn:async({noteId:a,draft:n})=>lt(a,{contentMarkdown:n.contentMarkdown.trim(),author:n.author.trim()||null,tags:X(n.tags),destroyAt:qe(n),links:n.linkedValues.map(h=>W(h)).filter(Ee).map(h=>({entityType:h.entityType,entityId:h.entityId}))}),onSuccess:async()=>{w(null),T(null),await te()}}),ae=ie({mutationFn:a=>rt(a),onSuccess:te}),O=((Te=V.data)==null?void 0:Te.notes)??[],Ue=new Date().toISOString().slice(0,10),Ve=O.filter(a=>a.createdAt.slice(0,10)===Ue).length*J().totalAp,C=q?O.find(a=>a.id===q.noteId)??null:null,se=C?_e(C):null,E=se?Ie(se.entityType,se.entityId):null,Oe=m.useMemo(()=>C?[{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:()=>{w(C.id),T(R(C))}},{id:"delete-note",label:"Delete note",description:"Soft-delete this note from the main workspace.",icon:Ze,tone:"danger",disabled:ae.isPending,onSelect:()=>{ae.mutateAsync(C.id)}}]:[],[E,C,ae,i]);return V.isError?e.jsx(tt,{eyebrow:"Notes",error:V.error,onRetry:()=>void V.refetch()}):e.jsxs("div",{className:"grid gap-5",children:[e.jsx(jt,{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:`${O.length} visible`,actions:e.jsxs(Q,{onClick:()=>{s(R(null,j)),$(!0)},children:[e.jsx(Ge,{className:"size-4"}),"New note"]})}),e.jsxs("section",{className:"grid gap-4 lg:grid-cols-4",children:[e.jsxs(_,{className:"border-[var(--primary)]/16 shadow-[var(--card-shadow)]",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Quick note default"}),e.jsx("div",{className:"mt-3 font-display text-4xl text-[var(--primary)]",children:P(J().totalAp)}),e.jsx("div",{className:"mt-2 text-sm text-[var(--ui-ink-soft)]",children:"Standalone notes count as a tiny Action Point impulse unless a richer active work context already covers them."})]}),e.jsxs(_,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Notes created today"}),e.jsx("div",{className:"mt-3 font-display text-4xl text-[var(--ui-ink-strong)]",children:P(Ve)}),e.jsx("div",{className:"mt-2 text-sm text-[var(--ui-ink-soft)]",children:"Visible notes created today in this workspace at the default quick note cost."})]}),e.jsxs(_,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Life Force sync"}),e.jsx("div",{className:"mt-3 text-2xl font-display text-[var(--ui-ink-strong)]",children:U.data?`${P(U.data.spentTodayAp)} / ${P(U.data.dailyBudgetAp)}`:"Loading..."}),e.jsx("div",{className:"mt-2 text-sm text-[var(--ui-ink-soft)]",children:"Notes participate in the same Action Point ledger as tasks, habits, movement, and calendar work."})]}),e.jsxs(_,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Instant headroom"}),e.jsx("div",{className:"mt-3 text-2xl font-display text-[var(--ui-ink-strong)]",children:U.data?at(U.data.instantFreeApPerHour):"Loading..."}),e.jsx("div",{className:"mt-2 text-sm text-[var(--ui-ink-soft)]",children:"Useful when deciding whether to just capture a quick note or stay inside a heavier work stream."})]})]}),e.jsx(Nt,{children:e.jsxs(_,{className:"grid gap-4",children:[e.jsx(Ct,{entityOptions:Be,selectedEntityValues:j,onSelectedEntityValuesChange:S,selectedTextTerms:g,onSelectedTextTermsChange:H}),e.jsx(re,{value:M,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:v,onChange:a=>B(a.target.value),placeholder:"Filter by author"}),e.jsx(D,{type:"date",value:A,onChange:a=>L(a.target.value)}),e.jsx(D,{type:"date",value:N,onChange:a=>Y(a.target.value)})]})]})}),K?e.jsx(wt,{children:e.jsxs(_,{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-[var(--ui-ink-faint)]",children:"New note"}),e.jsxs("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",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"," ",P(J().totalAp),"."]})]}),e.jsx(Q,{variant:"ghost",onClick:()=>{$(!1),s(R(null,j))},children:"Cancel"})]}),e.jsx(Le,{value:p.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:p.author,onChange:a=>s(n=>({...n,author:a.target.value})),placeholder:"Optional author"}),e.jsx(Fe,{options:Z,selectedValues:p.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:p.tags,onChange:a=>s(n=>({...n,tags:a}))}),e.jsxs("div",{className:"grid gap-3 rounded-[22px] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Ephemeral auto-destroy"}),e.jsx("div",{className:"mt-2 text-xs leading-5 text-[var(--ui-ink-soft)]",children:"Set an exact destroy time or a relative delay. Leaving both blank keeps the note durable."})]}),e.jsx(D,{type:"datetime-local",value:p.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:p.destroyDelayValue,onChange:a=>s(n=>({...n,destroyDelayValue:a.target.value})),placeholder:"Destroy after"}),e.jsxs("select",{className:"rounded-[14px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-3 text-sm text-[var(--ui-ink-strong)]",value:p.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-[var(--ui-surface-1)] p-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Preview"}),e.jsx("div",{className:"mt-3",children:p.contentMarkdown.trim()?e.jsx(ne,{markdown:p.contentMarkdown}):e.jsx("div",{className:"text-sm text-[var(--ui-ink-faint)]",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:p.contentMarkdown.trim().length===0||p.linkedValues.length===0,onClick:()=>void ge.mutateAsync(p),children:"Save note"})})]})}):null,V.isLoading?e.jsx(_,{className:"text-sm text-[var(--ui-ink-soft)]",children:"Loading notes…"}):O.length===0?e.jsx(st,{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(Tt,{children:e.jsx("div",{className:"grid gap-3",children:O.map(a=>{const n=_e(a),h=n?Ie(n.entityType,n.entityId):null,G=c===a.id&&y!==null;return e.jsxs(_,{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-[var(--ui-ink-faint)]",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:[P(J().totalAp)," ","quick note"]}),a.links.map(l=>e.jsxs(z,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-soft)]",wrap:!0,children:[it(l.entityType),l.anchorKey?` · ${nt(l.anchorKey)}`:""]},`${a.id}-${l.entityType}-${l.entityId}-${l.anchorKey??""}`)),(a.tags??[]).map(l=>e.jsx(z,{className:"border-[var(--info)]/20 bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_78%,var(--ui-ink-strong)_22%)]",wrap:!0,children:l},`${a.id}-tag-${l}`)),a.destroyAt?e.jsxs(z,{className:"border-[var(--warning)]/20 bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_78%,var(--ui-ink-strong)_22%)]",wrap:!0,children:["Ephemeral · deletes"," ",new Date(a.destroyAt).toLocaleString()]}):null]})]}),e.jsx("button",{type:"button",className:"rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-2 text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-3)] hover:text-[var(--ui-ink-strong)]",onClick:l=>{l.preventDefault(),l.stopPropagation();const r=l.currentTarget.getBoundingClientRect();oe({noteId:a.id,position:{x:r.right-8,y:r.bottom+8}})},"aria-label":`Open actions for note ${a.id}`,children:e.jsx(Je,{className:"size-4"})})]}),G?e.jsxs("div",{className:"mt-4 grid gap-4",children:[e.jsx(Le,{value:y.contentMarkdown,onChange:l=>T(r=>r&&{...r,contentMarkdown:l.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:y.author,onChange:l=>T(r=>r&&{...r,author:l.target.value}),placeholder:"Optional author"}),e.jsx(Fe,{options:Z,selectedValues:y.linkedValues,onChange:l=>T(r=>r&&{...r,linkedValues:l}),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:y.tags,onChange:l=>T(r=>r&&{...r,tags:l})}),e.jsxs("div",{className:"grid gap-3 rounded-[22px] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Ephemeral auto-destroy"}),e.jsx("div",{className:"mt-2 text-xs leading-5 text-[var(--ui-ink-soft)]",children:"Set an exact destroy time or a relative delay. Leaving both blank keeps the note durable."})]}),e.jsx(D,{type:"datetime-local",value:y.destroyAtInput,onChange:l=>T(r=>r&&{...r,destroyAtInput:l.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:y.destroyDelayValue,onChange:l=>T(r=>r&&{...r,destroyDelayValue:l.target.value}),placeholder:"Destroy after"}),e.jsxs("select",{className:"rounded-[14px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-3 text-sm text-[var(--ui-ink-strong)]",value:y.destroyDelayUnit,onChange:l=>T(r=>r&&{...r,destroyDelayUnit:l.target.value}),children:[e.jsx("option",{value:"hours",children:"Hours"}),e.jsx("option",{value:"days",children:"Days"})]})]})]})]}),e.jsxs("div",{className:"rounded-[22px] bg-[var(--ui-surface-1)] p-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Preview"}),e.jsx("div",{className:"mt-3",children:y.contentMarkdown.trim()?e.jsx(ne,{markdown:y.contentMarkdown}):e.jsx("div",{className:"text-sm text-[var(--ui-ink-faint)]",children:"No content yet."})})]}),e.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[e.jsx(Q,{variant:"ghost",onClick:()=>{w(null),T(null)},children:"Cancel"}),e.jsx(Q,{pending:ve.isPending,pendingLabel:"Saving",disabled:y.contentMarkdown.trim().length===0||y.linkedValues.length===0,onClick:()=>void ve.mutateAsync({noteId:a.id,draft:y}),children:"Save changes"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"mt-4 min-w-0 max-w-full overflow-hidden text-left",onClick:()=>{h&&i(h.includes("#")?h:`${h}#notes`)},disabled:!h,children:e.jsx(ne,{markdown:a.contentMarkdown,className:"line-clamp-none"})}),h?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:!!q,title:"Note actions",subtitle:C?C.contentPlain.slice(0,80)||"Markdown note":void 0,items:Oe,position:(q==null?void 0:q.position)??null,onClose:()=>oe(null)})]})}export{Xt as NotesPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b7 as p,j as s,aU as c}from"./vendor-y_uz1Wft.js";import{B as u,cg as m}from"./index-Dj8q65se.js";function x({entityType:a,entityId:e,view:n,label:o="Open in graph",variant:r="secondary",size:t}){const i=p();return s.jsxs(u,{variant:r,size:t,onClick:()=>i(m(a,e,{view:n})),children:[s.jsx(c,{className:"size-4"}),o]})}export{x as O};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as w,j as r,aC as R}from"./vendor-
|
|
1
|
+
import{r as w,j as r,aC as R}from"./vendor-y_uz1Wft.js";import{c as O}from"./index-Dj8q65se.js";import{m as B}from"./motion-DeJZhOSA.js";const z={mint:"border-[color-mix(in_srgb,var(--success)_28%,var(--ui-border-subtle)_72%)] bg-[color-mix(in_srgb,var(--success)_12%,var(--ui-surface-1)_88%)] text-[color-mix(in_srgb,var(--success)_62%,var(--ui-ink-strong)_38%)]",sky:"border-[color-mix(in_srgb,var(--info)_28%,var(--ui-border-subtle)_72%)] bg-[color-mix(in_srgb,var(--info)_12%,var(--ui-surface-1)_88%)] text-[color-mix(in_srgb,var(--info)_62%,var(--ui-ink-strong)_38%)]",violet:"border-[color-mix(in_srgb,var(--primary)_28%,var(--ui-border-subtle)_72%)] bg-[color-mix(in_srgb,var(--primary)_12%,var(--ui-surface-1)_88%)] text-[color-mix(in_srgb,var(--primary)_62%,var(--ui-ink-strong)_38%)]",rose:"border-[color-mix(in_srgb,var(--danger)_28%,var(--ui-border-subtle)_72%)] bg-[color-mix(in_srgb,var(--danger)_12%,var(--ui-surface-1)_88%)] text-[color-mix(in_srgb,var(--danger)_62%,var(--ui-ink-strong)_38%)]"};function M(d,a,n){return Math.min(Math.max(d,a),n)}function X(d){const a=d.detail.trim().length;return a>84?130:a>44?118:106}function Y(d,a,n){const v=a/2,p=n/2,b=M(Math.min(a/620,n/430),.64,1.06),s=d.map(i=>{const e=i.angle*Math.PI/180,o=i.radius*b,l=Math.min(184,Math.max(154,a-48)),c=X(i),x=v+Math.cos(e)*o,h=p+Math.sin(e)*o;return{...i,x,y:h,width:l,height:c,homeX:x,homeY:h}}),u=a<720?16:22,y=20,m=a-20,_=18,t=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 o=e+1;o<s.length;o+=1){const l=s[e],c=s[o],x=c.x-l.x,h=c.y-l.y,k=l.width/2+c.width/2+u-Math.abs(x),N=l.height/2+c.height/2+u-Math.abs(h);if(k<=0||N<=0)continue;const j=k<N?"x":"y",f=Math.sign(j==="x"?x||o-e||1:h||o-e||1),g=(j==="x"?k:N)/2;j==="x"?(l.x-=f*g,c.x+=f*g):(l.y-=f*g,c.y+=f*g)}for(const e of s)e.x=M(e.x,y+e.width/2,m-e.width/2),e.y=M(e.y,_+e.height/2,t-e.height/2)}return s}function A({title:d,description:a,centerLabel:n,centerValue:v,nodes:p,action:b}){const s=w.useRef(null),[u,y]=w.useState({width:0,height:0});w.useEffect(()=>{if(!s.current||typeof ResizeObserver>"u")return;const t=new ResizeObserver(i=>{const e=i[0];y({width:e.contentRect.width,height:e.contentRect.height})});return t.observe(s.current),()=>t.disconnect()},[]);const m=p.length>0?p:[{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"}],_=w.useMemo(()=>Y(m,Math.max(u.width,320),Math.max(u.height,320)),[m,u.height,u.width]);return r.jsxs("section",{className:"overflow-hidden rounded-[32px] border border-[var(--ui-border-subtle)] bg-[radial-gradient(circle_at_top,color-mix(in_srgb,var(--success)_12%,transparent),transparent_42%),var(--ui-surface-section)] px-4 py-4 shadow-[var(--card-shadow)] lg:px-5",children:[r.jsxs("div",{className:"mb-4 flex flex-wrap items-end justify-between gap-4",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--success)]",children:"Reflective map"}),r.jsx("h2",{className:"mt-2 break-words font-display text-[clamp(1.35rem,2.3vw,2rem)] leading-none text-[var(--ui-ink-strong)]",children:d}),r.jsx("p",{className:"mt-2 max-w-2xl break-words text-sm leading-6 text-[var(--ui-ink-soft)]",children:a})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsxs("div",{className:"inline-flex min-w-0 items-center gap-3 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-2",children:[r.jsx("span",{className:"text-xs uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:n}),r.jsx("span",{className:"min-w-0 break-words text-sm font-medium text-[var(--ui-ink-strong)]",children:v})]}),b?r.jsx("div",{className:"shrink-0",children:b}):null]})]}),r.jsx("div",{className:"grid gap-3 md:hidden",children:m.map(t=>r.jsxs(R,{to:t.href,className:O("block min-w-0 rounded-[20px] border px-4 py-3 shadow-[var(--ui-shadow-soft)] transition hover:bg-[var(--ui-surface-hover)]",z[t.tone??"mint"]),children:[r.jsx("div",{className:"break-words text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)] [overflow-wrap:anywhere]",children:t.label}),r.jsx("div",{className:"mt-1.5 break-words font-medium text-[var(--ui-ink-strong)] [overflow-wrap:anywhere]",children:t.title}),r.jsx("div",{className:"mt-1.5 break-words text-sm leading-5 text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",children:t.detail})]},t.id))}),r.jsxs("div",{ref:s,className:"relative hidden min-h-[20rem] overflow-hidden rounded-[30px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] md:block lg:min-h-[22rem]",children:[r.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_center,color-mix(in_srgb,var(--success)_8%,transparent),transparent_32%),var(--ui-surface-section)]"}),[112,168,224].map(t=>r.jsx("div",{className:"absolute left-1/2 top-1/2 rounded-full border border-[var(--ui-border-subtle)]",style:{width:`${t*2}px`,height:`${t*2}px`,transform:"translate(-50%, -50%)"}},t)),r.jsx("div",{className:"absolute inset-1/2 size-32 -translate-x-1/2 -translate-y-1/2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] shadow-[var(--card-shadow)]",children:r.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[r.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:n}),r.jsx("div",{className:"mt-2 font-display text-2xl text-[var(--ui-ink-strong)]",children:v})]})}),_.map((t,i)=>r.jsx(B.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:`${t.x}px`,top:`${t.y}px`},whileHover:{y:-6,scale:1.03},children:r.jsxs(R,{to:t.href,className:O("block min-w-0 rounded-[22px] border px-3.5 py-3 shadow-[var(--ui-shadow-soft)] backdrop-blur-sm transition hover:-translate-y-0.5 hover:bg-[var(--ui-surface-hover)]",z[t.tone??"mint"]),children:[r.jsx("div",{className:"break-words text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)] [overflow-wrap:anywhere]",children:t.label}),r.jsx("div",{className:"mt-1.5 break-words font-medium text-[var(--ui-ink-strong)] [overflow-wrap:anywhere]",children:t.title}),r.jsx("div",{className:"mt-1.5 break-words text-sm leading-5 text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",children:t.detail})]})},t.id))]})]})}export{A as O};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as E,j as e,aC as $}from"./vendor-y_uz1Wft.js";import{A as q}from"./ai-surface-workspace-GPZzIIut.js";import{i as F}from"./state-DWw8Jay_.js";import{T as Q,W as B,M as z,S as G,Q as Y}from"./utility-widgets-D4KsKxLT.js";import{F as J}from"./flagship-signal-deck-DZx_HEH9.js";import{u as Z,d as ee,bk as te,z as R,y as L,bl as D,j as p,ad as ie,c as se,C as M,b as ae,E as re,_ as ne,a0 as le,bm as oe,bn as de,a$ as ce,bo as ue}from"./index-Dj8q65se.js";import{L as me}from"./life-force-workspace-BNeMbRHf.js";import{E as pe}from"./entity-note-count-link-FOK_qhcC.js";import{P as fe}from"./page-hero-DYmFM6-q.js";import{a as ve,g as xe}from"./activity-copy-Bj4h9OcF.js";import"./board-CGgOvBP9.js";import"./generic-node-view-C1kLClIm.js";import"./graph-U1J6VkbG.js";import"./motion-DeJZhOSA.js";import"./ui-CdEDMtXF.js";import"./forms-DhEGHkFR.js";import"./floating-action-menu-CFrgvQJi.js";import"./charts-Cdtn55ol.js";const f={"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 he(a){const n=["gamification","summary","pipeline","body-signals","signals"],t=[...a.order];let r=!1;for(const v of n)t.includes(v)||(t.push(v),r=!0);const j=t.indexOf("summary"),c=t.indexOf("pipeline"),x=t.indexOf("body-signals"),g=t.indexOf("signals");if(j===-1||c===-1||x===-1||g===-1)return r?{...a,order:t}:a;if(j<c&&c<x&&x<g&&!r)return a;for(const v of n){const b=t.indexOf(v);b!==-1&&t.splice(b,1)}const y=t.indexOf("goals");return t.splice(y===-1?0:y,0,...n),{...a,order:t}}function ge(a=new Date){const n=a.getFullYear(),t=String(a.getMonth()+1).padStart(2,"0"),r=String(a.getDate()).padStart(2,"0");return`${n}-${t}-${r}`}function W(a){if(a>=3600){const n=a/3600;return n>=10||Number.isInteger(n)?`${Math.round(n)}h`:`${n.toFixed(1)}h`}return`${Math.max(1,Math.round(a/60))}m`}function ye(a){return a>=1e3?`${(a/1e3).toFixed(1)} km`:`${Math.round(a)} m`}function be(a){if(!a)return[];const n=new Map;for(const t of a.segments){if(t.kind!=="stay"||t.durationSeconds<=0)continue;const r=t.label.trim()||"Unlabeled stay";n.set(r,(n.get(r)??0)+t.durationSeconds)}return[...n.entries()].map(([t,r])=>({label:t,seconds:r})).sort((t,r)=>r.seconds-t.seconds).slice(0,3)}function ke(a){return a?["restingHeartRate","heartRateVariabilitySDNN","vo2Max","oxygenSaturation"].map(t=>a.metrics.find(r=>r.metric===t)).filter(t=>!!t).slice(0,3):[]}function we(a){if(a.latestValue==null)return"No reading";const n=a.unit==="steps"||a.unit==="flights"||a.unit==="kcal"||a.unit==="min"?0:1;return`${a.latestValue.toLocaleString(void 0,{maximumFractionDigits:n,minimumFractionDigits:n===0||a.latestValue>=100?0:1})} ${a.unit}`}function De(){var X,C;const{t:a}=Z(),n=ee(),t=n.snapshot,r=Array.isArray(n.selectedUserIds)?n.selectedUserIds:[],j=r.join("|"),[c,x]=E.useState(!1);E.useEffect(()=>{x(!1);const i=window.setTimeout(()=>{x(!0)},650);return()=>window.clearTimeout(i)},[j]);const g=ge(),y=F({queryKey:["forge-overview-sleep",...r],queryFn:async()=>(await oe(r)).sleep,enabled:c,staleTime:6e4})??{},v=F({queryKey:["forge-overview-fitness",...r],queryFn:async()=>(await de(r,{compact:!0})).fitness,enabled:c,staleTime:6e4})??{},b=F({queryKey:["forge-overview-movement-day",g,...r],queryFn:async()=>(await ce({date:g,userIds:r})).movement,enabled:c,staleTime:6e4})??{},H=F({queryKey:["forge-overview-vitals",...r],queryFn:async()=>(await ue(r)).vitals,enabled:c,staleTime:6e4})??{},I=te(r,{skip:!c}),u=t.dashboard.milestoneRewards.find(i=>!i.completed)??t.dashboard.milestoneRewards[0]??null,o=t.overview.topTasks[0]??null,d=t.overview.dueHabits[0]??null,m=t.overview.recentEvidence[0]??null,V=new Map(t.projects.map(i=>[i.id,i])),N=t.metrics.momentumScore>=80?"Strong":t.metrics.momentumScore>=60?"Steady":"Needs attention",k=((X=y.data)==null?void 0:X.summary)??null,h=((C=v.data)==null?void 0:C.summary)??null,l=b.data,S=H.data??null,A=ke(S??void 0),T=be(l),O=k!==null||h!==null||S!==null,P=l!==void 0&&(l.summary.tripCount>0||l.summary.stayCount>0||l.summary.totalMovingSeconds>0||T.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:f["Life Force"]},{label:"Momentum",value:`${t.metrics.momentumScore}`,detail:`${N} · ${t.metrics.streakDays} day streak`,help:f.Momentum},{label:"Instant",value:L(t.lifeForce.instantFreeApPerHour),detail:t.lifeForce.overloadApPerHour>0?`${L(t.lifeForce.overloadApPerHour)} overload`:"Headroom right now",help:f.Instant},{label:"Level",value:`L${t.metrics.level}`,detail:`${t.metrics.currentLevelXp} XP in level`,help:f.Level},{label:"Weekly XP",value:`${t.metrics.weeklyXp}`,detail:`${t.metrics.totalXp} total XP`,help:f["Weekly XP"]}]:[{label:"Level",value:`L${t.metrics.level}`,detail:`${t.metrics.currentLevelXp} XP in level`,help:f.Level},{label:"Weekly XP",value:`${t.metrics.weeklyXp}`,detail:`${t.metrics.totalXp} total XP`,help:f["Weekly XP"]},{label:"Momentum",value:`${t.metrics.momentumScore}`,detail:`${N} · ${t.metrics.streakDays} day streak`,help:f.Momentum}];function _(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(fe,{title:"Overview",titleText:"Overview",description:`${N}. 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-[var(--ui-surface-1)] 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-[var(--ui-ink-faint)]",children:"Momentum summary"}),e.jsx("div",{className:"mt-2 text-lg font-semibold text-[var(--ui-ink-strong)]",children:"Core live metrics"}),e.jsx("div",{className:"mt-1 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Life Force, momentum, XP, and instant headroom stay grouped here."})]}),e.jsx(p,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:N})]}),e.jsx("div",{className:se("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-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:[e.jsx("span",{children:s.label}),e.jsx(ie,{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-[var(--ui-ink-strong)]",children:s.value}),e.jsx("div",{className:"mt-1 text-xs leading-5 text-[var(--ui-ink-faint)]",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(me,{selectedUserIds:r,fallbackLifeForce:t.lifeForce,onRefresh:n.refresh,showEditor:!1}):e.jsx(M,{className:"rounded-[24px] border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-5 text-sm leading-6 text-[var(--ui-ink-soft)]",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-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] 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-[var(--ui-ink-faint)]",children:"Life Force"}),e.jsx("div",{className:"mt-2 text-lg font-semibold text-[var(--ui-ink-strong)]",children:t.lifeForce?`${Math.round(t.lifeForce.remainingAp)} AP remaining`:"No Life Force profile yet"})]}),t.lifeForce?e.jsx(p,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:L(t.lifeForce.instantFreeApPerHour)}):null]}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",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-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] 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-[var(--ui-ink-faint)]",children:"Body signals"}),e.jsx("div",{className:"mt-2 text-lg font-semibold text-[var(--ui-ink-strong)]",children:O?"Recovery, training, and vitals":"No health data yet"})]}),S?e.jsxs(p,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:[S.summary.metricCount," metrics"]}):null]}),y.isLoading||v.isLoading||H.isLoading?e.jsx("div",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Loading recent sleep, workout, and body-signal metrics…"}):O?e.jsxs("div",{className:"mt-3 grid gap-2 text-sm text-[var(--ui-ink-soft)]",children:[k?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-[var(--ui-ink-strong)]",children:W(k.averageSleepSeconds)})]}):null,k?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-[var(--ui-ink-strong)]",children:Math.round(k.averageSleepScore)})]}):null,h?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-[var(--ui-ink-strong)]",children:[Math.round(h.exerciseMinutes)," min"]})]}):null,h?e.jsx("div",{className:"text-xs leading-5 text-[var(--ui-ink-faint)]",children:h.topWorkoutType?`${h.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-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-2",children:[e.jsx("span",{children:i.label}),e.jsx("span",{className:"font-medium text-[var(--ui-ink-strong)]",children:we(i)})]},i.metric))}):null]}):e.jsx("div",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Sleep, workout, and vitals summaries appear here as soon as Forge has recent HealthKit records."})]}),e.jsxs(M,{className:"rounded-[24px] border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] 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-[var(--ui-ink-faint)]",children:"Movement"}),e.jsx("div",{className:"mt-2 text-lg font-semibold text-[var(--ui-ink-strong)]",children:P?"Today's place balance":"No movement timeline yet"})]}),P?e.jsxs(p,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:[W((l==null?void 0:l.summary.totalMovingSeconds)??0)," ","moving"]}):null]}),b.isLoading?e.jsx("div",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Loading today's stays, trips, and place balance…"}):P?e.jsxs("div",{className:"mt-3 grid gap-2",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[T.map(i=>e.jsxs(p,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:[W(i.seconds)," at ",i.label]},i.label)),((l==null?void 0:l.summary.totalMovingSeconds)??0)>0?e.jsxs(p,{className:"bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_74%,var(--ui-ink-strong)_26%)]",children:[W((l==null?void 0:l.summary.totalMovingSeconds)??0)," ","moving"]}):null]}),e.jsxs("div",{className:"text-sm leading-6 text-[var(--ui-ink-soft)]",children:[(l==null?void 0:l.summary.tripCount)??0," trip",((l==null?void 0:l.summary.tripCount)??0)===1?"":"s"," and"," ",ye((l==null?void 0:l.summary.totalDistanceMeters)??0)," ","tracked today."]})]}):e.jsx("div",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",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(J,{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:o?"Top task":d?"Due habit":"Recovery lane",title:(o==null?void 0:o.title)??(d==null?void 0:d.title)??"Get a real task moving",detail:(o==null?void 0:o.description)||(d==null?void 0:d.description)||"There is no single top task yet, so use this surface to choose one clean next move.",badge:o?`${o.points} xp`:d?`${d.rewardXp} xp`:`${t.metrics.weeklyXp} weekly xp`,href:o?`/tasks/${o.id}`:d?"/habits":"/today",actionLabel:o?"Open task":d?"Open habits":"Open today"},{id:"reward",label:"Next reward",title:(u==null?void 0:u.title)??"Keep the streak alive",detail:(u==null?void 0:u.progressLabel)??`Level ${t.metrics.level} is active. ${t.metrics.weeklyXp} weekly XP is already logged.`,badge:(u==null?void 0:u.rewardLabel)??`${t.metrics.comboMultiplier.toFixed(2)}x combo`,href:"/rewards",actionLabel:"Open rewards"},{id:"recent-activity",label:"Recent activity",title:m?xe(m):"No recent evidence",detail:m?ve(m):"The next work closeout or note will appear here.",badge:(m==null?void 0:m.source)??"activity",href:m?_(m):"/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 w;return e.jsxs("div",{className:"group relative rounded-[20px] bg-[var(--ui-surface-1)] p-4 transition hover:bg-[var(--ui-surface-hover)]",children:[e.jsx($,{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(ae,{kind:"goal",label:((w=s.tags[0])==null?void 0:w.name)??s.horizon,compact:!0,gradient:!1}),e.jsxs("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:[s.progress,"%"]})]}),e.jsx("div",{className:"mt-3",children:e.jsx(re,{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-[var(--ui-ink-soft)]",children:s.description}),e.jsx("div",{className:"mt-3",children:e.jsx(ne,{value:s.progress})})]}),e.jsx("div",{className:"relative z-20 mt-3",children:e.jsx(pe,{entityType:"goal",entityId:s.id,count:le(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 min-w-0 gap-3",children:[e.jsx("div",{className:"text-[12px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Projects"}),t.overview.projects.slice(0,i?3:4).map(s=>{var w;return e.jsxs($,{to:`/projects/${s.id}`,className:"block min-w-0 max-w-full rounded-[18px] bg-[var(--ui-surface-1)] px-4 py-3 transition hover:bg-[var(--ui-surface-hover)]",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-[var(--ui-ink-strong)]",children:s.title}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:((w=V.get(s.id))==null?void 0:w.status)??"active"})]}),e.jsxs(p,{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-[var(--ui-ink-soft)]",children:s.description})]},s.id)})]}),e.jsxs("div",{className:"grid min-w-0 gap-3",children:[e.jsx("div",{className:"text-[12px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Due habits"}),t.overview.dueHabits.slice(0,i?3:4).map(s=>e.jsx($,{to:"/habits","aria-label":`Open habit ${s.title}`,className:"block min-w-0 max-w-full rounded-[18px] bg-[var(--ui-surface-1)] px-4 py-3 transition hover:bg-[var(--ui-surface-hover)]",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-[var(--ui-ink-strong)]",children:s.title}),i?null:e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:s.description})]}),e.jsxs(p,{wrap:!0,className:"max-w-[7rem] shrink-0 bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_74%,var(--ui-ink-strong)_26%)]",children:[s.rewardXp," xp"]})]})},s.id))]}),e.jsxs("div",{className:"grid min-w-0 gap-3",children:[e.jsx("div",{className:"text-[12px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Top tasks"}),t.overview.topTasks.slice(0,i?3:4).map(s=>e.jsx($,{to:`/tasks/${s.id}`,className:"block min-w-0 max-w-full rounded-[18px] bg-[var(--ui-surface-1)] px-4 py-3 transition hover:bg-[var(--ui-surface-hover)]",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-[var(--ui-ink-strong)]",children:s.title}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:s.status.replaceAll("_"," ")})]}),e.jsxs(p,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",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(Q,{compact:i})},{id:"weather",title:"Weather",description:"Optional utility widget.",defaultWidth:3,defaultHeight:2,defaultHidden:!0,render:({compact:i})=>e.jsx(B,{compact:i})},{id:"mini-calendar",title:"Mini calendar",description:"Optional utility widget.",defaultWidth:4,defaultHeight:3,defaultHidden:!0,render:({compact:i})=>e.jsx(z,{compact:i})},{id:"spotify",title:"Spotify",description:"Optional utility widget.",defaultWidth:4,defaultHeight:2,defaultHidden:!0,render:()=>e.jsx(G,{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(Y,{compact:i,defaultUserId:r[0]??((s=t.users[0])==null?void 0:s.id)??null})}}];return e.jsx(q,{surfaceId:"overview",baseWidgets:U,normalizeLayout:he})}export{De as OverviewPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./vendor-y_uz1Wft.js";import{a as h,c as v,j,ad as y}from"./index-Dj8q65se.js";function u(r){return r.trim().toLowerCase().replace(/[^a-z0-9]+/g," ")}function N({eyebrow:r,titleText:t,entityKind:n,copyMode:i}){if(!r||i==="title_only"||typeof r!="string")return null;const l=u(r),s=t?u(t):null,o=n?u(h(n).label):null;return!l||s&&(l===s||s.includes(l)||l.includes(s))||o&&l===o?null:r}function E({eyebrow:r,entityKind:t,title:n,titleText:i,description:l,helpTitle:s,helpContent:o,helpLabel:b,badge:m,actions:d,copyMode:w="title_only"}){const a=t?h(t):null,p=a==null?void 0:a.icon,c=N({eyebrow:r,titleText:i,entityKind:t,copyMode:w}),x=i??(typeof n=="string"?n:"this page"),g=o??(typeof l=="string"?l:null),f=!!(a||c||m);return e.jsxs("header",{className:"relative min-w-0 w-full max-w-full overflow-visible border-b border-[var(--ui-border-subtle)] 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-[var(--ui-border-strong)]"}),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-[var(--ui-ink-faint)]",children:[a&&p?e.jsxs("span",{className:"inline-flex items-center gap-2 text-[var(--ui-ink-soft)]","aria-label":a.label,title:a.label,children:[e.jsx(p,{className:v("size-3.5",a.iconClassName)}),e.jsx("span",{children:a.label})]}):null,c?e.jsx("span",{className:"text-[var(--secondary)]/80",children:c}):null,m?e.jsx(j,{tone:"signal",className:"h-8 overflow-visible rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 text-[11px] font-medium tracking-[0.14em] text-[var(--ui-ink-medium)] uppercase",children:m}):null]}):null,e.jsxs("div",{className:v("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-[var(--ui-ink-strong)]",style:{transform:"translateY(var(--forge-shell-hero-title-translate-y)) scale(var(--forge-shell-hero-title-scale))",transformOrigin:"top left",willChange:"transform"},children:n}),g?e.jsx(y,{className:"mt-2 shrink-0",label:b??`Explain what the ${x} page shows and how to interpret it`,title:s??`${x} explained`,content:g}):null]}),e.jsx("div",{className:"mt-2 min-w-0 max-w-3xl text-[14px] leading-6 text-[var(--ui-ink-soft)] 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})]}),d?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:d}):null]})}export{E as P};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t}from"./vendor-y_uz1Wft.js";import{c as a}from"./index-Dj8q65se.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 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b7 as p,j as s,b1 as l}from"./vendor-y_uz1Wft.js";import{j as g,k as y}from"./state-DWw8Jay_.js";import{bC as P,B as C}from"./index-Dj8q65se.js";function v({userId:e,domain:n,entityType:o,entityId:r,label:i,description:a,tags:c,size:f="sm"}){const u=p(),d=g(),t=y({mutationFn:async()=>{if(!e)throw new Error("Select a single owner before sending entities to Preferences.");return P({userId:e,domain:n,entityType:o,entityId:r,label:i,description:a,tags:c})},onSuccess:async({item:m})=>{await d.invalidateQueries({queryKey:["forge-preferences"]}),u(`/preferences?userId=${encodeURIComponent(e??"")}&domain=${encodeURIComponent(n)}&focusItem=${encodeURIComponent(m.id)}`)}});return s.jsxs(C,{variant:"secondary",size:f,disabled:!e,pending:t.isPending,pendingLabel:"Sending to Preferences",onClick:()=>void t.mutateAsync(),title:e?"Add this entity to the Preferences compare queue.":"Select a single user scope before sending entities to Preferences.",children:[s.jsx(l,{className:"size-4"}),"Send to Preferences"]})}export{v as P};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b0 as ht,bp as vt,cA as ft,cB as bt,bj as jt,aG as yt,j as e,aK as Nt,b7 as ce,bY as kt,r as x,aC as ve,c1 as Ct,bX as It}from"./vendor-BwL6m4SE.js";import{j as St,i as Ke,k as N}from"./state-Bpe5dF3T.js";import{c as U,k as I,I as v,L as Je,h as et,B as u,C as j,d as wt,e as Pt,bs as Ft,T as E,bt as Ye,bu as Lt,bv as Tt,bw as Mt,bx as At,by as Dt,bz as Et,bA as zt,bB as _t,bC as Gt,bD as Ot,bE as Bt,bF as $t,bG as qt,bH as Qt,bI as Rt,bJ as Xe}from"./index-izRKx6JK.js";import{P as Ut}from"./page-hero-BLhM8FF3.js";import{U as tt}from"./user-badge-MEZuJiir.js";import{b as Z,f as Wt,g as Ht}from"./user-ownership-DJGl4rAj.js";import{R as Kt,P as Yt,O as Xt,C as Zt,T as Vt,D as Jt,a as es}from"./ui-B9TWEtCx.js";import"./motion-DcgUnXhY.js";import"./board-CuxQRKPJ.js";import"./forms-D1qJ3oOP.js";const st=[{id:"overview",label:"Overview",icon:ht},{id:"map",label:"Map",icon:vt},{id:"table",label:"Table",icon:ft},{id:"history",label:"History",icon:bt},{id:"contexts",label:"Contexts",icon:jt},{id:"concepts",label:"Concepts",icon:yt}],ts=new Set(["projects","tasks","strategies","habits"]),oe=[{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"}],fe={novelty:"Novelty",simplicity:"Simplicity",rigor:"Rigor",aesthetics:"Aesthetics",depth:"Depth",structure:"Structure",familiarity:"Familiarity",surprise:"Surprise"},ne={novelty:0,simplicity:0,rigor:0,aesthetics:0,depth:0,structure:0,familiarity:0,surprise:0},Ze={liked:"bg-[var(--ui-success-soft)] text-[var(--success)]",disliked:"bg-[var(--ui-danger-soft)] text-[var(--danger)]",uncertain:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",vetoed:"bg-[var(--ui-danger-soft)] text-[var(--danger)]",bookmarked:"bg-[var(--ui-info-soft)] text-[var(--info)]",favorite:"bg-[var(--ui-warning-soft)] text-[var(--warning)]",must_have:"bg-[var(--ui-accent-soft)] text-[var(--primary)]",neutral:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]"},ss=[{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 le(i){return i.trim().toLowerCase()}function R(i){return`${Math.round(i*100)}%`}function as(i){return[...i.goals.map(a=>({entityType:"goal",entityId:a.id,domain:"projects",label:a.title,description:a.description,user:a.user,href:`/goals/${a.id}`,searchText:Z([a.title,a.description,a.status,a.horizon],a)})),...i.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:Z([a.title,a.description,a.status,a.goalTitle],a)})),...i.tasks.map(a=>({entityType:"task",entityId:a.id,domain:"tasks",label:a.title,description:a.description,user:a.user,href:`/tasks/${a.id}`,searchText:Z([a.title,a.description,a.status,a.priority,a.owner],a)})),...i.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:Z([a.title,a.overview,a.endStateDescription,a.status],a)})),...i.habits.map(a=>({entityType:"habit",entityId:a.id,domain:"habits",label:a.title,description:a.description,user:a.user,href:null,searchText:Z([a.title,a.description,a.status,a.frequency],a)}))]}function is(i,a){return!i||!a?null:i==="goal"?`/goals/${a}`:i==="project"?`/projects/${a}`:i==="task"?`/tasks/${a}`:i==="strategy"?`/strategies/${a}`:null}function de(i){return i.manualStatus??i.status}function rs(i){return i&&st.some(a=>a.id===i)?i:"overview"}function ns(i){return i.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."}:i.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 ls({summary:i}){const a=Math.max(-1,Math.min(1,i.leaning)),o=(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-[var(--ui-ink-soft)]",children:[e.jsx("span",{children:fe[i.dimensionId]}),e.jsxs("span",{children:[i.movement>.08?"Rising":i.movement<-.08?"Falling":"Stable"," ","· ",R(i.confidence)]})]}),e.jsxs("div",{className:"relative h-2 rounded-full bg-[var(--ui-surface-2)]",children:[e.jsx("div",{className:"absolute inset-y-0 left-1/2 w-px bg-[var(--ui-border-strong)]"}),e.jsx("div",{className:U("absolute top-1/2 size-3 -translate-x-1/2 -translate-y-1/2 rounded-full border border-[var(--ui-border-strong)]",a>=0?"bg-[var(--success)]":"bg-[var(--danger)]"),style:{left:`${o}%`}})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3 text-[11px] uppercase tracking-[0.12em] text-[var(--ui-ink-faint)]",children:[e.jsxs("span",{children:[a>=0?"Leans toward":"Leans away from"," ",fe[i.dimensionId].toLowerCase()]}),e.jsxs("span",{children:["Context ",R(i.contextSensitivity)]})]})]})}function Ve({title:i,description:a,sideLabel:o,onClick:g}){return e.jsxs("button",{type:"button",className:"grid min-h-[220px] gap-4 rounded-[28px] border border-[var(--ui-border-subtle)] bg-[image:var(--ui-surface-section)] p-5 text-left transition hover:border-[color-mix(in_srgb,var(--primary)_40%,transparent)] hover:bg-[var(--ui-surface-hover)]",onClick:g,children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:o}),e.jsx("div",{className:"font-display text-3xl text-[var(--ui-ink-strong)]",children:i}),e.jsx("div",{className:"max-w-[36ch] text-sm leading-6 text-[var(--ui-ink-soft)]",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 ds({state:i,onOpenChange:a,error:o,loading:g,workspaceLoading:k,activeWorkspace:h,conceptSearchQuery:w,onConceptSearchQueryChange:p,filteredCatalogs:S,onSelectDomain:V,onStartCatalogGame:G,onJudge:J,onSignal:O}){return e.jsx(Kt,{open:i.open,onOpenChange:a,children:e.jsxs(Yt,{children:[e.jsx(Xt,{className:"fixed inset-0 z-40 bg-[var(--ui-overlay-backdrop)] backdrop-blur-xl"}),e.jsxs(Zt,{className:"fixed inset-x-4 bottom-4 top-4 z-50 overflow-y-auto rounded-[32px] border border-[var(--ui-border-subtle)] bg-[image:var(--ui-surface-modal)] shadow-[var(--ui-shadow-floating)] 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(Vt,{className:"sr-only",children:"Preference game"}),e.jsx(Jt,{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-[var(--ui-border-subtle)] bg-[color-mix(in_srgb,var(--surface-glass)_94%,transparent)] px-5 py-4 backdrop-blur-xl",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Preference game"}),e.jsx("div",{className:"mt-1 font-display text-2xl text-[var(--ui-ink-strong)]",children:i.phase==="domain"?"Choose a domain":i.phase==="catalog"?"Choose a concept list":"Pick the better fit"})]}),e.jsx(es,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":"Close preference game",className:"rounded-full bg-[var(--ui-surface-2)] p-2 text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",children:e.jsx(Nt,{className:"size-4"})})})]}),e.jsxs("div",{className:"grid gap-5 px-5 py-5",children:[o?e.jsx("div",{className:"rounded-[18px] border border-[color-mix(in_srgb,var(--danger)_28%,transparent)] bg-[var(--ui-danger-soft)] px-4 py-3 text-sm text-[var(--danger)]",children:o}):null,i.phase==="domain"?e.jsx(cs,{onSelectDomain:V}):null,i.phase==="catalog"?e.jsx(os,{domain:i.domain,query:w,onQueryChange:p,catalogs:S,onStartCatalogGame:G}):null,i.phase==="play"?e.jsx(us,{domain:i.domain,loading:g||k,activeWorkspace:h,onJudge:J,onSignal:O}):null]})]})]})})}function cs({onSelectDomain:i}){return e.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:oe.map(a=>e.jsxs("button",{type:"button",className:"rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-5 py-5 text-left transition hover:border-[color-mix(in_srgb,var(--primary)_30%,transparent)] hover:bg-[var(--ui-accent-soft)]",onClick:()=>i(a.value),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:a.label}),e.jsx(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:a.mode==="forge"?"Forge":"Concept"})]}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:a.description})]},a.value))})}function os({domain:i,query:a,onQueryChange:o,catalogs:g,onStartCatalogGame:k}){return e.jsxs("div",{className:"grid gap-4",children:[e.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",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(ce,{className:"size-4 text-[var(--ui-ink-faint)]"}),e.jsx(v,{value:a,onChange:h=>o(h.target.value),placeholder:"Search concept lists"})]}),e.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:g.length>0?g.map(h=>e.jsxs("button",{type:"button",className:"rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-5 py-5 text-left transition hover:border-[color-mix(in_srgb,var(--primary)_30%,transparent)] hover:bg-[var(--ui-accent-soft)]",onClick:()=>k(i,h.id),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:h.title}),e.jsxs(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:[h.items.length," items"]})]}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:h.description||"No description yet."})]},h.id)):e.jsx("div",{className:"rounded-[24px] bg-[var(--ui-surface-1)] px-5 py-6 text-sm text-[var(--ui-ink-soft)]",children:"No concept list matches that search yet."})})]})}function us({domain:i,loading:a,activeWorkspace:o,onJudge:g,onSignal:k}){var w;const h=(o==null?void 0:o.compare.nextPair)??null;return a?e.jsx(Je,{eyebrow:"Preference game",title:"Preparing the next round",description:"Forge is lining up comparison candidates."}):h?e.jsxs("div",{className:"grid gap-5",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-[var(--ui-ink-soft)]",children:[e.jsx(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:((w=oe.find(p=>p.value===i))==null?void 0:w.label)??i}),e.jsx("span",{children:o==null?void 0:o.selectedContext.name}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[(o==null?void 0:o.compare.pendingCount)??0," queued comparisons"]})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsx(Ve,{title:h.left.label,description:h.left.description,sideLabel:"Left",onClick:()=>g("left",1)}),e.jsx(Ve,{title:h.right.label,description:h.right.description,sideLabel:"Right",onClick:()=>g("right",1)})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(u,{onClick:()=>g("left",1),children:"Left"}),e.jsx(u,{onClick:()=>g("right",1),children:"Right"}),e.jsx(u,{variant:"secondary",onClick:()=>g("left",1.75),children:"Strong left"}),e.jsx(u,{variant:"secondary",onClick:()=>g("right",1.75),children:"Strong right"}),e.jsx(u,{variant:"secondary",onClick:()=>g("tie",1),children:"Tie"}),e.jsx(u,{variant:"secondary",onClick:()=>g("skip",1),children:"Skip"})]}),e.jsx("div",{className:"grid gap-4 rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-4 lg:grid-cols-2",children:[h.left,h.right].map(p=>e.jsxs("div",{className:"grid gap-3",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:p.label}),e.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Quick signals"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:ss.map(S=>e.jsx(u,{variant:"secondary",size:"sm",onClick:()=>k(p.id,S.signalType),children:S.label},`${p.id}-${S.signalType}`))})]},p.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."})}function ms({users:i,user:a,selectedUserId:o,selectedDomain:g,workspace:k,onPatchSearch:h}){var w;return e.jsxs(j,{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-[var(--ui-ink-faint)]",children:"Active user"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx("select",{value:o,onChange:p=>h({userId:p.target.value,contextId:null,focusItem:null}),className:"min-h-10 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 text-sm text-[var(--ui-ink-strong)] outline-none transition focus:border-[var(--primary)]",children:i.map(p=>e.jsxs("option",{value:p.id,children:[p.displayName," · ",p.kind]},p.id))}),e.jsx(tt,{user:a}),e.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:Wt(a)})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Domain"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:oe.map(p=>e.jsx("button",{type:"button",className:U("rounded-full border px-3 py-2 text-sm transition",p.value===g?"border-[var(--primary)] bg-[var(--ui-accent-soft)] text-[var(--ui-ink-strong)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-soft)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]"),onClick:()=>h({domain:p.value,contextId:null,focusItem:null}),children:p.label},p.value))}),e.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:(w=oe.find(p=>p.value===g))==null?void 0:w.description})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-[var(--ui-ink-soft)]",children:[e.jsx(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:k.selectedContext.name}),e.jsx("span",{children:k.selectedContext.shareMode}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[k.compare.pendingCount," queued comparisons"]}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[k.libraries.totalCatalogItems," concept items ready"]})]})]})}function xs({selectedTab:i,onSelectTab:a}){return e.jsx("div",{className:"flex flex-wrap gap-2",children:st.map(o=>e.jsxs("button",{type:"button",className:U("inline-flex items-center gap-2 rounded-full border px-3 py-2 text-sm transition",o.id===i?"border-[var(--primary)] bg-[var(--ui-accent-soft)] text-[var(--ui-ink-strong)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-soft)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]"),onClick:()=>a(o.id),children:[e.jsx(o.icon,{className:"size-4"}),o.label]},o.id))})}function Cs(){var qe,Qe,Re;const i=wt(),a=St(),[o,g]=kt(),[k,h]=x.useState(""),[w,p]=x.useState(""),[S,V]=x.useState(""),[G,J]=x.useState(""),[O,be]=x.useState(""),[z,M]=x.useState({open:!1,phase:"domain",domain:o.get("domain")??"projects"}),[at,A]=x.useState(null),[it,ue]=x.useState(!1),[je,B]=x.useState(null),[f,F]=x.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"}}),[_,ee]=x.useState({label:"",description:"",tags:""}),[L,W]=x.useState({name:"",description:"",shareMode:"blended",decayDays:"90"}),[H,me]=x.useState({title:"",description:""}),[rt,te]=x.useState({}),[ye,xe]=x.useState(null),[se,pe]=x.useState({title:"",description:""}),[nt,ge]=x.useState(null),[$,ae]=x.useState({label:"",description:"",tags:""}),m=o.get("userId")??Ht(i.selectedUserIds)??((qe=i.snapshot.users[0])==null?void 0:qe.id)??null,C=o.get("domain")??"projects",T=rs(o.get("tab")),K=o.get("contextId"),ie=o.get("focusItem"),lt=x.useMemo(()=>i.snapshot.users.find(t=>t.id===m)??null,[m,i.snapshot.users]),re=x.useMemo(()=>as(i.snapshot),[i.snapshot]),Y=Ke({queryKey:["forge-preferences",m,C,K],queryFn:async()=>(await Xe({userId:m??void 0,domain:C,contextId:K??void 0})).workspace,enabled:!!m}),Ne=Ke({queryKey:["forge-preferences-game",m,z.domain,K],queryFn:async()=>(await Xe({userId:m??void 0,domain:z.domain,contextId:K??void 0})).workspace,enabled:!!m&&z.open}),r=Y.data??null,P=z.domain===C?r:Ne.data??null;x.useEffect(()=>{var s;if(!r)return;const t=ie&&r.scores.some(d=>d.itemId===ie)?ie:((s=r.scores[0])==null?void 0:s.itemId)??null;B(d=>d&&r.scores.some(n=>n.itemId===d)?d:t)},[ie,r]);const he=x.useMemo(()=>{if(!r)return[];const t=le(k);return t?r.scores.filter(s=>{var d,n,l;return[((d=s.item)==null?void 0:d.label)??"",((n=s.item)==null?void 0:n.description)??"",((l=s.item)==null?void 0:l.tags.join(" "))??"",s.status,s.manualStatus??"",s.dominantDimensions.join(" "),s.explanation.join(" ")].join(" ").toLowerCase().includes(t)}):r.scores},[k,r]),c=he.find(t=>t.itemId===je)??(r==null?void 0:r.scores.find(t=>t.itemId===je))??he[0]??(r==null?void 0:r.scores[0])??null;x.useEffect(()=>{var t,s,d,n,l,y,X,Q,Ue,We,He;c&&F({label:((t=c.item)==null?void 0:t.label)??"",description:((s=c.item)==null?void 0:s.description)??"",tags:((d=c.item)==null?void 0:d.tags.join(", "))??"",manualStatus:c.manualStatus??"",manualScore:typeof c.manualScore=="number"?String(c.manualScore):"",confidenceLock:typeof c.confidenceLock=="number"?String(c.confidenceLock):"",bookmarked:c.bookmarked,compareLater:c.compareLater,frozen:c.frozen,featureWeights:{novelty:String(((n=c.item)==null?void 0:n.featureWeights.novelty)??0),simplicity:String(((l=c.item)==null?void 0:l.featureWeights.simplicity)??0),rigor:String(((y=c.item)==null?void 0:y.featureWeights.rigor)??0),aesthetics:String(((X=c.item)==null?void 0:X.featureWeights.aesthetics)??0),depth:String(((Q=c.item)==null?void 0:Q.featureWeights.depth)??0),structure:String(((Ue=c.item)==null?void 0:Ue.featureWeights.structure)??0),familiarity:String(((We=c.item)==null?void 0:We.featureWeights.familiarity)??0),surprise:String(((He=c.item)==null?void 0:He.featureWeights.surprise)??0)}})},[c]);const ke=x.useMemo(()=>{const t=le(w);return re.filter(s=>s.domain===C).filter(s=>t?s.searchText.includes(t):!0).slice(0,12)},[re,w,C]),Ce=x.useMemo(()=>{const t=T==="concepts"?r:P??r,s=(t==null?void 0:t.catalogs)??[],d=le(S);return d?s.filter(n=>[n.title,n.description,n.source,...n.items.flatMap(l=>[l.label,l.description,l.tags.join(" ")])].join(" ").toLowerCase().includes(d)):s},[P,S,T,r]),b=async()=>{await a.invalidateQueries({queryKey:["forge-preferences"]}),await a.invalidateQueries({queryKey:["forge-preferences-game"]})},Ie=N({mutationFn:Ye,onSuccess:b}),Se=N({mutationFn:Mt,onSuccess:async({item:t})=>{await b(),ee({label:"",description:"",tags:""}),B(t.id)}}),we=N({mutationFn:zt,onSuccess:async()=>{await b(),me({title:"",description:""}),g(t=>{const s=new URLSearchParams(t);return s.set("tab","concepts"),s})}}),Pe=N({mutationFn:({catalogId:t,patch:s})=>_t(t,s),onSuccess:async()=>{await b(),xe(null)}}),Fe=N({mutationFn:Gt,onSuccess:b}),Le=N({mutationFn:$t,onSuccess:async()=>{await b()}}),Te=N({mutationFn:({catalogItemId:t,patch:s})=>Ot(t,s),onSuccess:async()=>{await b(),ge(null)}}),Me=N({mutationFn:Bt,onSuccess:b}),dt=N({mutationFn:qt,onSuccess:async()=>{await b(),M(t=>({...t,phase:"play"}))}}),ct=N({mutationFn:Rt,onSuccess:b}),ot=N({mutationFn:Qt,onSuccess:b}),Ae=N({mutationFn:async()=>{!(c!=null&&c.item)||!m||!r||(await Lt(c.item.id,{label:f.label,description:f.description,tags:f.tags.split(",").map(t=>t.trim()).filter(Boolean),featureWeights:Object.fromEntries(Object.keys(ne).map(t=>[t,Number(f.featureWeights[t]||0)]))}),await Tt(c.item.id,{userId:m,domain:C,contextId:r.selectedContext.id,manualStatus:f.manualStatus||null,manualScore:f.manualScore.trim().length>0?Number(f.manualScore):null,confidenceLock:f.confidenceLock.trim().length>0?Number(f.confidenceLock):null,bookmarked:f.bookmarked,compareLater:f.compareLater,frozen:f.frozen}))},onSuccess:b}),De=N({mutationFn:Dt,onSuccess:async({context:t})=>{await b(),W({name:"",description:"",shareMode:"blended",decayDays:"90"}),g(s=>{const d=new URLSearchParams(s);return d.set("contextId",t.id),d.set("tab","contexts"),d})}}),Ee=N({mutationFn:Et,onSuccess:async()=>{await b(),J(""),be("")}}),q=N({mutationFn:({contextId:t,patch:s})=>At(t,s),onSuccess:b}),D=t=>{g(s=>{const d=new URLSearchParams(s);for(const[n,l]of Object.entries(t))l?d.set(n,l):d.delete(n);return d})},ze=(t=C)=>{A(null),M({open:!0,phase:"domain",domain:t})},ut=async t=>{if(!m)return;A(null),ue(!0);const s=re.filter(l=>{var y;return l.domain===t&&((y=l.user)==null?void 0:y.id)===m}),d=re.filter(l=>l.domain===t),n=(s.length>0?s:d).slice(0,12);if(n.length<2){A("Forge needs at least two matching records in this domain before it can start the game."),ue(!1),M(l=>({...l,phase:"domain"}));return}try{D({domain:t,tab:"overview",contextId:null,focusItem:null}),await Promise.all(n.map(l=>Ye({userId:m,domain:t,entityType:l.entityType,entityId:l.entityId,label:l.label,description:l.description,tags:[]}))),await b(),M({open:!0,phase:"play",domain:t})}catch(l){A(l instanceof Error?l.message:"Forge could not start the game."),M(y=>({...y,phase:"domain"}))}finally{ue(!1)}},_e=async(t,s)=>{if(m){A(null),D({domain:t,tab:"overview",contextId:null,focusItem:null});try{await dt.mutateAsync({userId:m,domain:t,contextId:K??void 0,catalogId:s}),M({open:!0,phase:"play",domain:t})}catch(d){A(d instanceof Error?d.message:"Forge could not start the game.")}}},mt=async t=>{if(ts.has(t)){await ut(t);return}A(null),M({open:!0,phase:"catalog",domain:t})},xt=async(t,s=1)=>{if(!m||!(P!=null&&P.compare.nextPair))return;const d=P.compare.nextPair;await ct.mutateAsync({userId:m,domain:z.domain,contextId:P.selectedContext.id,leftItemId:d.left.id,rightItemId:d.right.id,outcome:t,strength:s})},pt=async(t,s)=>{!m||!P||await ot.mutateAsync({userId:m,domain:z.domain,contextId:P.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(Y.isLoading&&!r)return e.jsx(Je,{eyebrow:"Preferences",title:"Loading preference model",description:"Reconstructing current scores, uncertainty, and concept libraries."});if(Y.isError)return e.jsx(Pt,{eyebrow:"Preferences",error:Y.error,onRetry:()=>void Y.refetch()});if(!r)return null;const gt=[...r.dimensions].sort((t,s)=>s.confidence-t.confidence).slice(0,6),Ge=r.scores.filter(t=>de(t)==="liked"||de(t)==="favorite").slice(0,4),Oe=r.scores.filter(t=>t.uncertainty>=.5).slice(0,4),Be=ns(r),$e=is(((Qe=c==null?void 0:c.item)==null?void 0:Qe.sourceEntityType)??null,((Re=c==null?void 0:c.item)==null?void 0:Re.sourceEntityId)??null);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-5",children:[e.jsx(Ut,{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:`${r.summary.totalItems} items · ${R(r.summary.averageConfidence)} confidence`,actions:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(u,{className:"min-w-[10rem]",onClick:()=>ze(),children:"Start the game"}),e.jsx(u,{variant:"secondary",onClick:()=>void b(),children:"Refresh model"})]})}),e.jsx(Ft,{}),e.jsx(ms,{users:i.snapshot.users,user:lt,selectedUserId:m,selectedDomain:C,workspace:r,onPatchSearch:D}),e.jsx(xs,{selectedTab:T,onSelectTab:t=>D({tab:t})}),T==="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(j,{className:"grid gap-5",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"What Forge knows"}),e.jsx("div",{className:"font-display text-3xl text-[var(--ui-ink-strong)]",children:Be.title}),e.jsx("div",{className:"max-w-[70ch] text-sm leading-6 text-[var(--ui-ink-soft)]",children:Be.description})]}),e.jsx("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-4",children:[{label:"Known items",value:r.summary.totalItems,detail:"Items inside this domain"},{label:"Confidence",value:R(r.summary.averageConfidence),detail:"Average certainty"},{label:"Unknowns",value:r.summary.uncertainCount,detail:"Need more rounds"},{label:"Libraries",value:r.libraries.totalCatalogItems,detail:"Seeded concepts ready"}].map(t=>e.jsxs("div",{className:"rounded-[22px] bg-[var(--ui-surface-2)] px-4 py-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:t.label}),e.jsx("div",{className:"mt-2 font-display text-3xl text-[var(--ui-ink-strong)]",children:t.value}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:t.detail})]},t.label))}),e.jsx("div",{className:"grid gap-4 lg:grid-cols-2",children:gt.map(t=>e.jsx(ls,{summary:t},t.dimensionId))})]}),e.jsxs(j,{className:"grid gap-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Next move"}),e.jsx("div",{className:"font-display text-2xl text-[var(--ui-ink-strong)]",children:"Start the game"}),e.jsx("div",{className:"text-sm leading-6 text-[var(--ui-ink-soft)]",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(u,{className:"w-full",onClick:()=>ze(),children:"Start the game"}),e.jsxs("div",{className:"grid gap-3 rounded-[22px] bg-[var(--ui-surface-2)] px-4 py-4 text-sm text-[var(--ui-ink-soft)]",children:[e.jsxs("div",{children:["Current queue: ",r.compare.pendingCount," comparison",r.compare.pendingCount===1?"":"s"]}),e.jsxs("div",{children:["Active context: ",r.selectedContext.name]}),e.jsxs("div",{children:["Library coverage: ",r.libraries.seededCatalogCount," ","seeded lists and ",r.libraries.customCatalogCount," ","custom lists"]})]})]})]}),e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.3fr)_360px]",children:[e.jsxs(j,{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-[var(--ui-ink-faint)]",children:"Preference map"}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:"Green drifts positive, red drifts negative, and low opacity still means uncertainty."})]}),e.jsx(ve,{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-[var(--ui-border-subtle)] bg-[var(--ui-surface-section)]",children:[e.jsx("div",{className:"absolute inset-x-0 top-1/2 h-px bg-[var(--ui-border-subtle)]"}),e.jsx("div",{className:"absolute inset-y-0 left-1/2 w-px bg-[var(--ui-border-subtle)]"}),r.map.map(t=>e.jsx("button",{type:"button",className:U("absolute -translate-x-1/2 -translate-y-1/2 rounded-full border px-2 py-1 text-[11px] shadow-[var(--ui-shadow-soft)] transition hover:scale-[1.04]",t.itemId===(c==null?void 0:c.itemId)?"border-[var(--ui-border-strong)] bg-[var(--ui-surface-active)] text-[var(--ui-ink-strong)]":t.score>=0?"border-[color-mix(in_srgb,var(--success)_34%,transparent)] bg-[var(--ui-success-soft)] text-[var(--ui-ink-strong)]":"border-[color-mix(in_srgb,var(--danger)_34%,transparent)] bg-[var(--ui-danger-soft)] text-[var(--ui-ink-strong)]"),style:{left:`${50+t.x*30}%`,top:`${50-t.y*30}%`,opacity:.55+t.confidence*.45},onClick:()=>B(t.itemId),children:t.label},t.itemId))]})]}),e.jsxs(j,{className:"grid gap-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Best read so far"}),e.jsx("div",{className:"grid gap-2",children:Ge.length>0?Ge.map(t=>{var s;return e.jsxs("button",{type:"button",className:"rounded-[18px] bg-[var(--ui-surface-2)] px-3 py-3 text-left transition hover:bg-[var(--ui-surface-hover)]",onClick:()=>{B(t.itemId),D({focusItem:t.itemId})},children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:((s=t.item)==null?void 0:s.label)??t.itemId}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:t.explanation[0]||"Forge has positive evidence here."})]},t.itemId)}):e.jsx("div",{className:"rounded-[18px] bg-[var(--ui-surface-2)] px-3 py-3 text-sm text-[var(--ui-ink-soft)]",children:"No clear positives yet. A few comparison rounds will change that."})}),e.jsxs("div",{className:"border-t border-[var(--ui-border-subtle)] pt-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Biggest unknowns"}),e.jsx("div",{className:"mt-3 grid gap-2",children:Oe.length>0?Oe.map(t=>{var s;return e.jsxs("div",{className:"rounded-[18px] bg-[var(--ui-surface-2)] px-3 py-3 text-sm text-[var(--ui-ink-soft)]",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:((s=t.item)==null?void 0:s.label)??t.itemId}),e.jsxs("div",{className:"mt-1",children:["Uncertainty ",R(t.uncertainty)]})]},t.itemId)}):e.jsx("div",{className:"rounded-[18px] bg-[var(--ui-surface-2)] px-3 py-3 text-sm text-[var(--ui-ink-soft)]",children:"The current unknown list is short."})})]})]})]}),e.jsxs(j,{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-[var(--ui-ink-faint)]",children:"Bring in Forge records"}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:"Search goals, projects, tasks, strategies, or habits across human and bot users, then send them straight into this model."})]}),e.jsxs(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:[ke.length," visible"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ce,{className:"size-4 text-[var(--ui-ink-muted)]"}),e.jsx(v,{value:w,onChange:t=>p(t.target.value),placeholder:"Search across owners, handles, user kind, title, and description"})]}),e.jsx("div",{className:"grid gap-2",children:ke.map(t=>e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-[18px] bg-[var(--ui-surface-2)] 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-[var(--ui-ink-strong)]",children:t.label}),e.jsx(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:t.entityType}),t.user?e.jsx(tt,{user:t.user,compact:!0}):null]}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:t.description||"No description yet."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.href?e.jsx(ve,{to:t.href,children:e.jsx(u,{variant:"ghost",size:"sm",children:"Open"})}):null,e.jsx(u,{variant:"secondary",size:"sm",pending:Ie.isPending,pendingLabel:"Adding",onClick:()=>void Ie.mutateAsync({userId:m,domain:C,entityType:t.entityType,entityId:t.entityId,label:t.label,description:t.description,tags:[]}),children:"Add to model"})]})]},`${t.entityType}-${t.entityId}`))})]})]}):null,T==="map"?e.jsxs(j,{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-[var(--ui-ink-faint)]",children:"Full map"}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:"Click a point to inspect why Forge believes it belongs there."})]}),e.jsxs("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:[r.map.length," plotted items"]})]}),e.jsxs("div",{className:"relative min-h-[520px] overflow-hidden rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-section)]",children:[e.jsx("div",{className:"absolute inset-x-0 top-1/2 h-px bg-[var(--ui-border-subtle)]"}),e.jsx("div",{className:"absolute inset-y-0 left-1/2 w-px bg-[var(--ui-border-subtle)]"}),r.map.map(t=>e.jsx("button",{type:"button",className:U("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===(c==null?void 0:c.itemId)?"border-[var(--ui-border-strong)] bg-[var(--ui-surface-active)] text-[var(--ui-ink-strong)]":t.score>=0?"border-[color-mix(in_srgb,var(--success)_34%,transparent)] bg-[var(--ui-success-soft)] text-[var(--ui-ink-strong)]":"border-[color-mix(in_srgb,var(--danger)_34%,transparent)] bg-[var(--ui-danger-soft)] text-[var(--ui-ink-strong)]"),style:{left:`${50+t.x*34}%`,top:`${50-t.y*34}%`,opacity:.45+t.confidence*.55},onClick:()=>{B(t.itemId),D({focusItem:t.itemId})},children:t.label},t.itemId))]})]}):null,T==="table"?e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.2fr)_380px]",children:[e.jsxs(j,{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ce,{className:"size-4 text-[var(--ui-ink-muted)]"}),e.jsx(v,{value:k,onChange:t=>h(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-[var(--ui-ink-muted)]",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:he.map(t=>{var s,d;return e.jsxs("tr",{className:U("cursor-pointer border-t border-[var(--ui-border-subtle)] transition hover:bg-[var(--ui-surface-2)]",t.itemId===(c==null?void 0:c.itemId)?"bg-[var(--ui-surface-2)]":""),onClick:()=>{B(t.itemId),D({focusItem:t.itemId})},children:[e.jsxs("td",{className:"px-3 py-3",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:((s=t.item)==null?void 0:s.label)??t.itemId}),e.jsx("div",{className:"text-xs text-[var(--ui-ink-muted)]",children:(((d=t.item)==null?void 0:d.tags)??[]).join(" · ")})]}),e.jsx("td",{className:"px-3 py-3 text-[var(--ui-ink-medium)]",children:t.latentScore.toFixed(2)}),e.jsx("td",{className:"px-3 py-3 text-[var(--ui-ink-medium)]",children:R(t.confidence)}),e.jsx("td",{className:"px-3 py-3",children:e.jsx(I,{className:Ze[de(t)],children:de(t)})}),e.jsx("td",{className:"px-3 py-3 text-[var(--ui-ink-medium)]",children:t.evidenceCount})]},t.itemId)})})]})})]}),e.jsxs(j,{className:"grid gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Item editor"}),c!=null&&c.item?e.jsxs(e.Fragment,{children:[e.jsx(v,{value:f.label,onChange:t=>F(s=>({...s,label:t.target.value})),placeholder:"Item label"}),e.jsx(E,{value:f.description,onChange:t=>F(s=>({...s,description:t.target.value})),className:"min-h-24",placeholder:"Item description"}),e.jsx(v,{value:f.tags,onChange:t=>F(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:f.manualStatus,onChange:t=>F(s=>({...s,manualStatus:t.target.value})),className:"min-h-10 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 text-sm text-[var(--ui-ink-strong)] outline-none",children:[e.jsx("option",{value:"",children:"Inferred status"}),Object.keys(Ze).map(t=>e.jsx("option",{value:t,children:t},t))]}),e.jsx(v,{value:f.manualScore,onChange:t=>F(s=>({...s,manualScore:t.target.value})),placeholder:"Manual score"}),e.jsx(v,{value:f.confidenceLock,onChange:t=>F(s=>({...s,confidenceLock:t.target.value})),placeholder:"Confidence lock 0-1"})]}),e.jsx("div",{className:"grid gap-2",children:Object.keys(ne).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-[var(--ui-ink-soft)]",children:fe[t]}),e.jsx(v,{value:f.featureWeights[t],onChange:s=>F(d=>({...d,featureWeights:{...d.featureWeights,[t]:s.target.value}}))})]},t))}),e.jsx("div",{className:"grid gap-2 text-sm text-[var(--ui-ink-soft)]",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:f[t],onChange:d=>F(n=>({...n,[t]:d.target.checked}))}),e.jsx("span",{children:s})]},t))}),e.jsx(u,{pending:Ae.isPending,pendingLabel:"Saving item",onClick:()=>void Ae.mutateAsync(),children:"Save item model"}),$e?e.jsx(ve,{className:"text-sm text-[var(--primary)]",to:$e,children:"Open linked entity"}):null]}):e.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Select a row to inspect or edit it."}),e.jsxs("div",{className:"mt-3 border-t border-[var(--ui-border-subtle)] pt-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Add custom item"}),e.jsxs("div",{className:"mt-3 grid gap-3",children:[e.jsx(v,{value:_.label,onChange:t=>ee(s=>({...s,label:t.target.value})),placeholder:"Custom item label"}),e.jsx(E,{value:_.description,onChange:t=>ee(s=>({...s,description:t.target.value})),className:"min-h-24",placeholder:"What is this preference item?"}),e.jsx(v,{value:_.tags,onChange:t=>ee(s=>({...s,tags:t.target.value})),placeholder:"comma, separated, tags"}),e.jsx(u,{disabled:!_.label.trim(),pending:Se.isPending,pendingLabel:"Creating item",onClick:()=>void Se.mutateAsync({userId:m,domain:C,label:_.label,description:_.description,tags:_.tags.split(",").map(t=>t.trim()).filter(Boolean),featureWeights:ne,queueForCompare:!0}),children:"Create custom item"})]})]})]})]}):null,T==="history"?e.jsxs("div",{className:"grid gap-5 xl:grid-cols-3",children:[e.jsxs(j,{className:"grid gap-3 xl:col-span-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Recent pairwise judgments"}),e.jsx("div",{className:"grid gap-2",children:r.history.judgments.slice(0,12).map(t=>{var n,l,y,X;const s=((l=(n=r.scores.find(Q=>Q.itemId===t.leftItemId))==null?void 0:n.item)==null?void 0:l.label)??t.leftItemId,d=((X=(y=r.scores.find(Q=>Q.itemId===t.rightItemId))==null?void 0:y.item)==null?void 0:X.label)??t.rightItemId;return e.jsxs("div",{className:"rounded-[18px] bg-[var(--ui-surface-2)] px-4 py-3 text-sm text-[var(--ui-ink-soft)]",children:[e.jsxs("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:[s," vs ",d]}),e.jsxs("div",{className:"mt-1",children:["Outcome ",t.outcome," · strength"," ",t.strength," ·"," ",new Date(t.createdAt).toLocaleString()]})]},t.id)})})]}),e.jsxs(j,{className:"grid gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Signals and snapshots"}),e.jsx("div",{className:"grid gap-2",children:r.history.signals.slice(0,8).map(t=>{var d,n;const s=((n=(d=r.scores.find(l=>l.itemId===t.itemId))==null?void 0:d.item)==null?void 0:n.label)??t.itemId;return e.jsxs("div",{className:"rounded-[18px] bg-[var(--ui-surface-2)] px-3 py-2 text-sm text-[var(--ui-ink-soft)]",children:[s," · ",t.signalType," ·"," ",new Date(t.createdAt).toLocaleString()]},t.id)})}),e.jsx("div",{className:"grid gap-2",children:r.history.snapshots.slice(0,5).map(t=>e.jsxs("div",{className:"rounded-[18px] bg-[var(--ui-surface-2)] px-3 py-2 text-sm text-[var(--ui-ink-soft)]",children:["Snapshot ",new Date(t.createdAt).toLocaleString()]},t.id))}),e.jsxs("div",{className:"rounded-[18px] bg-[var(--ui-surface-2)] px-3 py-3 text-sm text-[var(--ui-ink-soft)]",children:["Stale items: ",r.history.staleItemIds.length," · Flipped items: ",r.history.flippedItemIds.length]})]})]}):null,T==="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:r.contexts.map(t=>e.jsxs(j,{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-[var(--ui-ink-strong)]",children:t.name}),e.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:t.description||"No description yet."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.isDefault?e.jsx(I,{className:"bg-[var(--primary)]/14 text-[var(--primary)]",children:"Default"}):null,e.jsx(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:t.shareMode}),t.active?null:e.jsx(I,{className:"bg-[var(--ui-warning-soft)] text-[var(--warning)]",children:"Inactive"})]})]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-4",children:[e.jsx(v,{value:t.name,onChange:s=>void q.mutateAsync({contextId:t.id,patch:{name:s.target.value}}),placeholder:"Context name"}),e.jsxs("select",{value:t.shareMode,onChange:s=>void q.mutateAsync({contextId:t.id,patch:{shareMode:s.target.value}}),className:"min-h-10 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 text-sm text-[var(--ui-ink-strong)] 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(v,{value:String(t.decayDays),onChange:s=>void q.mutateAsync({contextId:t.id,patch:{decayDays:Number(s.target.value||90)}}),placeholder:"Decay days"}),e.jsx(u,{variant:"secondary",onClick:()=>D({contextId:t.id,tab:"overview"}),children:"Open context"})]}),e.jsx(E,{value:t.description,onChange:s=>void q.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(u,{variant:"secondary",onClick:()=>void q.mutateAsync({contextId:t.id,patch:{active:!t.active}}),children:t.active?"Deactivate":"Activate"}),t.isDefault?null:e.jsx(u,{variant:"secondary",onClick:()=>void q.mutateAsync({contextId:t.id,patch:{isDefault:!0}}),children:"Make default"})]})]},t.id))}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs(j,{className:"grid gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Create context"}),e.jsx(v,{value:L.name,onChange:t=>W(s=>({...s,name:t.target.value})),placeholder:"Context name"}),e.jsx(E,{value:L.description,onChange:t=>W(s=>({...s,description:t.target.value})),className:"min-h-24",placeholder:"What changes in this context?"}),e.jsxs("select",{value:L.shareMode,onChange:t=>W(s=>({...s,shareMode:t.target.value})),className:"min-h-10 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 text-sm text-[var(--ui-ink-strong)] 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(v,{value:L.decayDays,onChange:t=>W(s=>({...s,decayDays:t.target.value})),placeholder:"Decay days"}),e.jsx(u,{disabled:!L.name.trim(),pending:De.isPending,pendingLabel:"Creating context",onClick:()=>void De.mutateAsync({userId:m,domain:C,name:L.name,description:L.description,shareMode:L.shareMode,decayDays:Number(L.decayDays||90),active:!0,isDefault:!1}),children:"Create context"})]}),e.jsxs(j,{className:"grid gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Merge contexts"}),e.jsxs("select",{value:G,onChange:t=>J(t.target.value),className:"min-h-10 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 text-sm text-[var(--ui-ink-strong)] outline-none",children:[e.jsx("option",{value:"",children:"Source context"}),r.contexts.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]}),e.jsxs("select",{value:O,onChange:t=>be(t.target.value),className:"min-h-10 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 text-sm text-[var(--ui-ink-strong)] outline-none",children:[e.jsx("option",{value:"",children:"Target context"}),r.contexts.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]}),e.jsx(u,{pending:Ee.isPending,pendingLabel:"Merging",disabled:!G||!O||G===O,onClick:()=>void Ee.mutateAsync({sourceContextId:G,targetContextId:O}),children:"Merge into target"})]})]})]}):null,T==="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(j,{className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Concept libraries"}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",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",r.libraries.totalCatalogs],["Concepts",r.libraries.totalCatalogItems],["Seeded",r.libraries.seededCatalogCount],["Custom",r.libraries.customCatalogCount]].map(([t,s])=>e.jsxs("div",{className:"rounded-[18px] bg-[var(--ui-surface-2)] px-4 py-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:t}),e.jsx("div",{className:"mt-2 font-display text-3xl text-[var(--ui-ink-strong)]",children:s})]},t))}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ce,{className:"size-4 text-[var(--ui-ink-muted)]"}),e.jsx(v,{value:S,onChange:t=>V(t.target.value),placeholder:"Search lists, concepts, tags, and seeded domains"})]})]}),e.jsxs(j,{className:"grid gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Create concept list"}),e.jsx(v,{value:H.title,onChange:t=>me(s=>({...s,title:t.target.value})),placeholder:"List title"}),e.jsx(E,{value:H.description,onChange:t=>me(s=>({...s,description:t.target.value})),className:"min-h-24",placeholder:"What should this list help compare?"}),e.jsx(u,{disabled:!H.title.trim(),pending:we.isPending,pendingLabel:"Creating list",onClick:()=>void we.mutateAsync({userId:m,domain:C,title:H.title,description:H.description}),children:"Create list"})]})]}),e.jsx("div",{className:"grid gap-4",children:Ce.map(t=>{const s=rt[t.id]??{label:"",description:"",tags:""},d=t.items.filter(n=>S.trim()?[n.label,n.description,n.tags.join(" ")].join(" ").toLowerCase().includes(le(S)):!0);return e.jsxs(j,{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:ye===t.id?e.jsxs("div",{className:"grid gap-3",children:[e.jsx(v,{value:se.title,onChange:n=>pe(l=>({...l,title:n.target.value}))}),e.jsx(E,{value:se.description,onChange:n=>pe(l=>({...l,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-[var(--ui-ink-strong)]",children:t.title}),e.jsx(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:t.source}),e.jsxs(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:[t.items.length," items"]})]}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:t.description||"No description yet."})]})}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(u,{variant:"secondary",size:"sm",onClick:()=>void _e(C,t.id),children:"Start from this list"}),ye===t.id?e.jsxs(e.Fragment,{children:[e.jsx(u,{size:"sm",pending:Pe.isPending,pendingLabel:"Saving",onClick:()=>void Pe.mutateAsync({catalogId:t.id,patch:{title:se.title,description:se.description}}),children:"Save"}),e.jsx(u,{variant:"ghost",size:"sm",onClick:()=>xe(null),children:"Cancel"})]}):e.jsx(u,{variant:"ghost",size:"sm",onClick:()=>{xe(t.id),pe({title:t.title,description:t.description})},children:"Edit list"}),e.jsx(u,{variant:"ghost",size:"sm",pending:Fe.isPending,pendingLabel:"Deleting",onClick:()=>void Fe.mutateAsync(t.id),children:"Delete list"})]})]}),e.jsx("div",{className:"grid gap-2",children:d.map(n=>e.jsx("div",{className:"rounded-[18px] bg-[var(--ui-surface-2)] px-4 py-3",children:nt===n.id?e.jsxs("div",{className:"grid gap-3",children:[e.jsx(v,{value:$.label,onChange:l=>ae(y=>({...y,label:l.target.value}))}),e.jsx(E,{value:$.description,onChange:l=>ae(y=>({...y,description:l.target.value})),className:"min-h-20"}),e.jsx(v,{value:$.tags,onChange:l=>ae(y=>({...y,tags:l.target.value})),placeholder:"comma, separated, tags"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(u,{size:"sm",pending:Te.isPending,pendingLabel:"Saving",onClick:()=>void Te.mutateAsync({catalogItemId:n.id,patch:{label:$.label,description:$.description,tags:$.tags.split(",").map(l=>l.trim()).filter(Boolean)}}),children:"Save concept"}),e.jsx(u,{variant:"ghost",size:"sm",onClick:()=>ge(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-[var(--ui-ink-strong)]",children:n.label}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:n.description||"No description yet."}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:n.tags.map(l=>e.jsx(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:l},`${n.id}-${l}`))})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(u,{variant:"ghost",size:"sm",onClick:()=>{ge(n.id),ae({label:n.label,description:n.description,tags:n.tags.join(", ")})},children:"Edit"}),e.jsxs(u,{variant:"ghost",size:"sm",pending:Me.isPending,pendingLabel:"Deleting",onClick:()=>void Me.mutateAsync(n.id),children:[e.jsx(Ct,{className:"mr-1 size-4"}),"Delete"]})]})]})},n.id))}),e.jsxs("div",{className:"grid gap-3 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-[var(--ui-ink-medium)]",children:[e.jsx(It,{className:"size-4"}),"Add concept to ",t.title]}),e.jsx(v,{value:s.label,onChange:n=>te(l=>({...l,[t.id]:{...s,label:n.target.value}})),placeholder:"Concept label"}),e.jsx(E,{value:s.description,onChange:n=>te(l=>({...l,[t.id]:{...s,description:n.target.value}})),className:"min-h-20",placeholder:"Short description"}),e.jsx(v,{value:s.tags,onChange:n=>te(l=>({...l,[t.id]:{...s,tags:n.target.value}})),placeholder:"comma, separated, tags"}),e.jsx(u,{disabled:!s.label.trim(),pending:Le.isPending,pendingLabel:"Adding",onClick:()=>void Le.mutateAsync({catalogId:t.id,label:s.label,description:s.description,tags:s.tags.split(",").map(n=>n.trim()).filter(Boolean),featureWeights:ne}).then(()=>te(n=>({...n,[t.id]:{label:"",description:"",tags:""}}))),children:"Add concept"})]})]},t.id)})})]}):null]}),e.jsx(ds,{state:z,onOpenChange:t=>{t||A(null),M(s=>({...s,open:t}))},error:at,loading:it,workspaceLoading:Ne.isLoading,activeWorkspace:P,conceptSearchQuery:S,onConceptSearchQueryChange:V,filteredCatalogs:Ce,onSelectDomain:t=>void mt(t),onStartCatalogGame:(t,s)=>void _e(t,s),onJudge:(t,s)=>void xt(t,s),onSignal:(t,s)=>void pt(t,s)})]})}export{Cs as PreferencesPage};
|
|
1
|
+
import{b1 as ht,bq as vt,cF as ft,cG as bt,bk as jt,aG as yt,j as e,aK as Nt,b8 as ce,bZ as kt,r as x,aC as ve,c1 as Ct,bY as It}from"./vendor-y_uz1Wft.js";import{j as St,i as Ke,k as N}from"./state-DWw8Jay_.js";import{c as U,j as I,I as v,L as Je,h as et,B as u,C as j,d as wt,e as Pt,bB as Ft,T as E,bC as Ye,bD as Lt,bE as Tt,bF as Mt,bG as Dt,bH as At,bI as Et,bJ as zt,bK as _t,bL as Gt,bM as Ot,bN as $t,bO as Bt,bP as qt,bQ as Qt,bR as Rt,bS as Xe}from"./index-Dj8q65se.js";import{P as Ut}from"./page-hero-DYmFM6-q.js";import{U as tt}from"./user-badge-B8hYK6NU.js";import{b as Z,f as Wt,g as Ht}from"./user-ownership-DJGl4rAj.js";import{R as Kt,P as Yt,O as Xt,C as Zt,T as Vt,D as Jt,a as es}from"./ui-CdEDMtXF.js";import"./motion-DeJZhOSA.js";import"./board-CGgOvBP9.js";import"./forms-DhEGHkFR.js";const st=[{id:"overview",label:"Overview",icon:ht},{id:"map",label:"Map",icon:vt},{id:"table",label:"Table",icon:ft},{id:"history",label:"History",icon:bt},{id:"contexts",label:"Contexts",icon:jt},{id:"concepts",label:"Concepts",icon:yt}],ts=new Set(["projects","tasks","strategies","habits"]),oe=[{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"}],fe={novelty:"Novelty",simplicity:"Simplicity",rigor:"Rigor",aesthetics:"Aesthetics",depth:"Depth",structure:"Structure",familiarity:"Familiarity",surprise:"Surprise"},ne={novelty:0,simplicity:0,rigor:0,aesthetics:0,depth:0,structure:0,familiarity:0,surprise:0},Ze={liked:"bg-[var(--ui-success-soft)] text-[var(--success)]",disliked:"bg-[var(--ui-danger-soft)] text-[var(--danger)]",uncertain:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",vetoed:"bg-[var(--ui-danger-soft)] text-[var(--danger)]",bookmarked:"bg-[var(--ui-info-soft)] text-[var(--info)]",favorite:"bg-[var(--ui-warning-soft)] text-[var(--warning)]",must_have:"bg-[var(--ui-accent-soft)] text-[var(--primary)]",neutral:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]"},ss=[{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 le(i){return i.trim().toLowerCase()}function R(i){return`${Math.round(i*100)}%`}function as(i){return[...i.goals.map(a=>({entityType:"goal",entityId:a.id,domain:"projects",label:a.title,description:a.description,user:a.user,href:`/goals/${a.id}`,searchText:Z([a.title,a.description,a.status,a.horizon],a)})),...i.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:Z([a.title,a.description,a.status,a.goalTitle],a)})),...i.tasks.map(a=>({entityType:"task",entityId:a.id,domain:"tasks",label:a.title,description:a.description,user:a.user,href:`/tasks/${a.id}`,searchText:Z([a.title,a.description,a.status,a.priority,a.owner],a)})),...i.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:Z([a.title,a.overview,a.endStateDescription,a.status],a)})),...i.habits.map(a=>({entityType:"habit",entityId:a.id,domain:"habits",label:a.title,description:a.description,user:a.user,href:null,searchText:Z([a.title,a.description,a.status,a.frequency],a)}))]}function is(i,a){return!i||!a?null:i==="goal"?`/goals/${a}`:i==="project"?`/projects/${a}`:i==="task"?`/tasks/${a}`:i==="strategy"?`/strategies/${a}`:null}function de(i){return i.manualStatus??i.status}function rs(i){return i&&st.some(a=>a.id===i)?i:"overview"}function ns(i){return i.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."}:i.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 ls({summary:i}){const a=Math.max(-1,Math.min(1,i.leaning)),o=(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-[var(--ui-ink-soft)]",children:[e.jsx("span",{children:fe[i.dimensionId]}),e.jsxs("span",{children:[i.movement>.08?"Rising":i.movement<-.08?"Falling":"Stable"," ","· ",R(i.confidence)]})]}),e.jsxs("div",{className:"relative h-2 rounded-full bg-[var(--ui-surface-2)]",children:[e.jsx("div",{className:"absolute inset-y-0 left-1/2 w-px bg-[var(--ui-border-strong)]"}),e.jsx("div",{className:U("absolute top-1/2 size-3 -translate-x-1/2 -translate-y-1/2 rounded-full border border-[var(--ui-border-strong)]",a>=0?"bg-[var(--success)]":"bg-[var(--danger)]"),style:{left:`${o}%`}})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3 text-[11px] uppercase tracking-[0.12em] text-[var(--ui-ink-faint)]",children:[e.jsxs("span",{children:[a>=0?"Leans toward":"Leans away from"," ",fe[i.dimensionId].toLowerCase()]}),e.jsxs("span",{children:["Context ",R(i.contextSensitivity)]})]})]})}function Ve({title:i,description:a,sideLabel:o,onClick:g}){return e.jsxs("button",{type:"button",className:"grid min-h-[220px] gap-4 rounded-[28px] border border-[var(--ui-border-subtle)] bg-[image:var(--ui-surface-section)] p-5 text-left transition hover:border-[color-mix(in_srgb,var(--primary)_40%,transparent)] hover:bg-[var(--ui-surface-hover)]",onClick:g,children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:o}),e.jsx("div",{className:"font-display text-3xl text-[var(--ui-ink-strong)]",children:i}),e.jsx("div",{className:"max-w-[36ch] text-sm leading-6 text-[var(--ui-ink-soft)]",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 ds({state:i,onOpenChange:a,error:o,loading:g,workspaceLoading:k,activeWorkspace:h,conceptSearchQuery:w,onConceptSearchQueryChange:p,filteredCatalogs:S,onSelectDomain:V,onStartCatalogGame:G,onJudge:J,onSignal:O}){return e.jsx(Kt,{open:i.open,onOpenChange:a,children:e.jsxs(Yt,{children:[e.jsx(Xt,{className:"fixed inset-0 z-40 bg-[var(--ui-overlay-backdrop)] backdrop-blur-xl"}),e.jsxs(Zt,{className:"fixed inset-x-4 bottom-4 top-4 z-50 overflow-y-auto rounded-[32px] border border-[var(--ui-border-subtle)] bg-[image:var(--ui-surface-modal)] shadow-[var(--ui-shadow-floating)] 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(Vt,{className:"sr-only",children:"Preference game"}),e.jsx(Jt,{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-[var(--ui-border-subtle)] bg-[color-mix(in_srgb,var(--surface-glass)_94%,transparent)] px-5 py-4 backdrop-blur-xl",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Preference game"}),e.jsx("div",{className:"mt-1 font-display text-2xl text-[var(--ui-ink-strong)]",children:i.phase==="domain"?"Choose a domain":i.phase==="catalog"?"Choose a concept list":"Pick the better fit"})]}),e.jsx(es,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":"Close preference game",className:"rounded-full bg-[var(--ui-surface-2)] p-2 text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",children:e.jsx(Nt,{className:"size-4"})})})]}),e.jsxs("div",{className:"grid gap-5 px-5 py-5",children:[o?e.jsx("div",{className:"rounded-[18px] border border-[color-mix(in_srgb,var(--danger)_28%,transparent)] bg-[var(--ui-danger-soft)] px-4 py-3 text-sm text-[var(--danger)]",children:o}):null,i.phase==="domain"?e.jsx(cs,{onSelectDomain:V}):null,i.phase==="catalog"?e.jsx(os,{domain:i.domain,query:w,onQueryChange:p,catalogs:S,onStartCatalogGame:G}):null,i.phase==="play"?e.jsx(us,{domain:i.domain,loading:g||k,activeWorkspace:h,onJudge:J,onSignal:O}):null]})]})]})})}function cs({onSelectDomain:i}){return e.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:oe.map(a=>e.jsxs("button",{type:"button",className:"rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-5 py-5 text-left transition hover:border-[color-mix(in_srgb,var(--primary)_30%,transparent)] hover:bg-[var(--ui-accent-soft)]",onClick:()=>i(a.value),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:a.label}),e.jsx(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:a.mode==="forge"?"Forge":"Concept"})]}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:a.description})]},a.value))})}function os({domain:i,query:a,onQueryChange:o,catalogs:g,onStartCatalogGame:k}){return e.jsxs("div",{className:"grid gap-4",children:[e.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",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(ce,{className:"size-4 text-[var(--ui-ink-faint)]"}),e.jsx(v,{value:a,onChange:h=>o(h.target.value),placeholder:"Search concept lists"})]}),e.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:g.length>0?g.map(h=>e.jsxs("button",{type:"button",className:"rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-5 py-5 text-left transition hover:border-[color-mix(in_srgb,var(--primary)_30%,transparent)] hover:bg-[var(--ui-accent-soft)]",onClick:()=>k(i,h.id),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:h.title}),e.jsxs(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:[h.items.length," items"]})]}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:h.description||"No description yet."})]},h.id)):e.jsx("div",{className:"rounded-[24px] bg-[var(--ui-surface-1)] px-5 py-6 text-sm text-[var(--ui-ink-soft)]",children:"No concept list matches that search yet."})})]})}function us({domain:i,loading:a,activeWorkspace:o,onJudge:g,onSignal:k}){var w;const h=(o==null?void 0:o.compare.nextPair)??null;return a?e.jsx(Je,{eyebrow:"Preference game",title:"Preparing the next round",description:"Forge is lining up comparison candidates."}):h?e.jsxs("div",{className:"grid gap-5",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-[var(--ui-ink-soft)]",children:[e.jsx(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:((w=oe.find(p=>p.value===i))==null?void 0:w.label)??i}),e.jsx("span",{children:o==null?void 0:o.selectedContext.name}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[(o==null?void 0:o.compare.pendingCount)??0," queued comparisons"]})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsx(Ve,{title:h.left.label,description:h.left.description,sideLabel:"Left",onClick:()=>g("left",1)}),e.jsx(Ve,{title:h.right.label,description:h.right.description,sideLabel:"Right",onClick:()=>g("right",1)})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(u,{onClick:()=>g("left",1),children:"Left"}),e.jsx(u,{onClick:()=>g("right",1),children:"Right"}),e.jsx(u,{variant:"secondary",onClick:()=>g("left",1.75),children:"Strong left"}),e.jsx(u,{variant:"secondary",onClick:()=>g("right",1.75),children:"Strong right"}),e.jsx(u,{variant:"secondary",onClick:()=>g("tie",1),children:"Tie"}),e.jsx(u,{variant:"secondary",onClick:()=>g("skip",1),children:"Skip"})]}),e.jsx("div",{className:"grid gap-4 rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-4 lg:grid-cols-2",children:[h.left,h.right].map(p=>e.jsxs("div",{className:"grid gap-3",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:p.label}),e.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Quick signals"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:ss.map(S=>e.jsx(u,{variant:"secondary",size:"sm",onClick:()=>k(p.id,S.signalType),children:S.label},`${p.id}-${S.signalType}`))})]},p.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."})}function ms({users:i,user:a,selectedUserId:o,selectedDomain:g,workspace:k,onPatchSearch:h}){var w;return e.jsxs(j,{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-[var(--ui-ink-faint)]",children:"Active user"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx("select",{value:o,onChange:p=>h({userId:p.target.value,contextId:null,focusItem:null}),className:"min-h-10 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 text-sm text-[var(--ui-ink-strong)] outline-none transition focus:border-[var(--primary)]",children:i.map(p=>e.jsxs("option",{value:p.id,children:[p.displayName," · ",p.kind]},p.id))}),e.jsx(tt,{user:a}),e.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:Wt(a)})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Domain"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:oe.map(p=>e.jsx("button",{type:"button",className:U("rounded-full border px-3 py-2 text-sm transition",p.value===g?"border-[var(--primary)] bg-[var(--ui-accent-soft)] text-[var(--ui-ink-strong)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-soft)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]"),onClick:()=>h({domain:p.value,contextId:null,focusItem:null}),children:p.label},p.value))}),e.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:(w=oe.find(p=>p.value===g))==null?void 0:w.description})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-[var(--ui-ink-soft)]",children:[e.jsx(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:k.selectedContext.name}),e.jsx("span",{children:k.selectedContext.shareMode}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[k.compare.pendingCount," queued comparisons"]}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[k.libraries.totalCatalogItems," concept items ready"]})]})]})}function xs({selectedTab:i,onSelectTab:a}){return e.jsx("div",{className:"flex flex-wrap gap-2",children:st.map(o=>e.jsxs("button",{type:"button",className:U("inline-flex items-center gap-2 rounded-full border px-3 py-2 text-sm transition",o.id===i?"border-[var(--primary)] bg-[var(--ui-accent-soft)] text-[var(--ui-ink-strong)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-soft)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]"),onClick:()=>a(o.id),children:[e.jsx(o.icon,{className:"size-4"}),o.label]},o.id))})}function Cs(){var qe,Qe,Re;const i=wt(),a=St(),[o,g]=kt(),[k,h]=x.useState(""),[w,p]=x.useState(""),[S,V]=x.useState(""),[G,J]=x.useState(""),[O,be]=x.useState(""),[z,M]=x.useState({open:!1,phase:"domain",domain:o.get("domain")??"projects"}),[at,D]=x.useState(null),[it,ue]=x.useState(!1),[je,$]=x.useState(null),[f,F]=x.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"}}),[_,ee]=x.useState({label:"",description:"",tags:""}),[L,W]=x.useState({name:"",description:"",shareMode:"blended",decayDays:"90"}),[H,me]=x.useState({title:"",description:""}),[rt,te]=x.useState({}),[ye,xe]=x.useState(null),[se,pe]=x.useState({title:"",description:""}),[nt,ge]=x.useState(null),[B,ae]=x.useState({label:"",description:"",tags:""}),m=o.get("userId")??Ht(i.selectedUserIds)??((qe=i.snapshot.users[0])==null?void 0:qe.id)??null,C=o.get("domain")??"projects",T=rs(o.get("tab")),K=o.get("contextId"),ie=o.get("focusItem"),lt=x.useMemo(()=>i.snapshot.users.find(t=>t.id===m)??null,[m,i.snapshot.users]),re=x.useMemo(()=>as(i.snapshot),[i.snapshot]),Y=Ke({queryKey:["forge-preferences",m,C,K],queryFn:async()=>(await Xe({userId:m??void 0,domain:C,contextId:K??void 0})).workspace,enabled:!!m}),Ne=Ke({queryKey:["forge-preferences-game",m,z.domain,K],queryFn:async()=>(await Xe({userId:m??void 0,domain:z.domain,contextId:K??void 0})).workspace,enabled:!!m&&z.open}),r=Y.data??null,P=z.domain===C?r:Ne.data??null;x.useEffect(()=>{var s;if(!r)return;const t=ie&&r.scores.some(d=>d.itemId===ie)?ie:((s=r.scores[0])==null?void 0:s.itemId)??null;$(d=>d&&r.scores.some(n=>n.itemId===d)?d:t)},[ie,r]);const he=x.useMemo(()=>{if(!r)return[];const t=le(k);return t?r.scores.filter(s=>{var d,n,l;return[((d=s.item)==null?void 0:d.label)??"",((n=s.item)==null?void 0:n.description)??"",((l=s.item)==null?void 0:l.tags.join(" "))??"",s.status,s.manualStatus??"",s.dominantDimensions.join(" "),s.explanation.join(" ")].join(" ").toLowerCase().includes(t)}):r.scores},[k,r]),c=he.find(t=>t.itemId===je)??(r==null?void 0:r.scores.find(t=>t.itemId===je))??he[0]??(r==null?void 0:r.scores[0])??null;x.useEffect(()=>{var t,s,d,n,l,y,X,Q,Ue,We,He;c&&F({label:((t=c.item)==null?void 0:t.label)??"",description:((s=c.item)==null?void 0:s.description)??"",tags:((d=c.item)==null?void 0:d.tags.join(", "))??"",manualStatus:c.manualStatus??"",manualScore:typeof c.manualScore=="number"?String(c.manualScore):"",confidenceLock:typeof c.confidenceLock=="number"?String(c.confidenceLock):"",bookmarked:c.bookmarked,compareLater:c.compareLater,frozen:c.frozen,featureWeights:{novelty:String(((n=c.item)==null?void 0:n.featureWeights.novelty)??0),simplicity:String(((l=c.item)==null?void 0:l.featureWeights.simplicity)??0),rigor:String(((y=c.item)==null?void 0:y.featureWeights.rigor)??0),aesthetics:String(((X=c.item)==null?void 0:X.featureWeights.aesthetics)??0),depth:String(((Q=c.item)==null?void 0:Q.featureWeights.depth)??0),structure:String(((Ue=c.item)==null?void 0:Ue.featureWeights.structure)??0),familiarity:String(((We=c.item)==null?void 0:We.featureWeights.familiarity)??0),surprise:String(((He=c.item)==null?void 0:He.featureWeights.surprise)??0)}})},[c]);const ke=x.useMemo(()=>{const t=le(w);return re.filter(s=>s.domain===C).filter(s=>t?s.searchText.includes(t):!0).slice(0,12)},[re,w,C]),Ce=x.useMemo(()=>{const t=T==="concepts"?r:P??r,s=(t==null?void 0:t.catalogs)??[],d=le(S);return d?s.filter(n=>[n.title,n.description,n.source,...n.items.flatMap(l=>[l.label,l.description,l.tags.join(" ")])].join(" ").toLowerCase().includes(d)):s},[P,S,T,r]),b=async()=>{await a.invalidateQueries({queryKey:["forge-preferences"]}),await a.invalidateQueries({queryKey:["forge-preferences-game"]})},Ie=N({mutationFn:Ye,onSuccess:b}),Se=N({mutationFn:Mt,onSuccess:async({item:t})=>{await b(),ee({label:"",description:"",tags:""}),$(t.id)}}),we=N({mutationFn:zt,onSuccess:async()=>{await b(),me({title:"",description:""}),g(t=>{const s=new URLSearchParams(t);return s.set("tab","concepts"),s})}}),Pe=N({mutationFn:({catalogId:t,patch:s})=>_t(t,s),onSuccess:async()=>{await b(),xe(null)}}),Fe=N({mutationFn:Gt,onSuccess:b}),Le=N({mutationFn:Bt,onSuccess:async()=>{await b()}}),Te=N({mutationFn:({catalogItemId:t,patch:s})=>Ot(t,s),onSuccess:async()=>{await b(),ge(null)}}),Me=N({mutationFn:$t,onSuccess:b}),dt=N({mutationFn:qt,onSuccess:async()=>{await b(),M(t=>({...t,phase:"play"}))}}),ct=N({mutationFn:Rt,onSuccess:b}),ot=N({mutationFn:Qt,onSuccess:b}),De=N({mutationFn:async()=>{!(c!=null&&c.item)||!m||!r||(await Lt(c.item.id,{label:f.label,description:f.description,tags:f.tags.split(",").map(t=>t.trim()).filter(Boolean),featureWeights:Object.fromEntries(Object.keys(ne).map(t=>[t,Number(f.featureWeights[t]||0)]))}),await Tt(c.item.id,{userId:m,domain:C,contextId:r.selectedContext.id,manualStatus:f.manualStatus||null,manualScore:f.manualScore.trim().length>0?Number(f.manualScore):null,confidenceLock:f.confidenceLock.trim().length>0?Number(f.confidenceLock):null,bookmarked:f.bookmarked,compareLater:f.compareLater,frozen:f.frozen}))},onSuccess:b}),Ae=N({mutationFn:At,onSuccess:async({context:t})=>{await b(),W({name:"",description:"",shareMode:"blended",decayDays:"90"}),g(s=>{const d=new URLSearchParams(s);return d.set("contextId",t.id),d.set("tab","contexts"),d})}}),Ee=N({mutationFn:Et,onSuccess:async()=>{await b(),J(""),be("")}}),q=N({mutationFn:({contextId:t,patch:s})=>Dt(t,s),onSuccess:b}),A=t=>{g(s=>{const d=new URLSearchParams(s);for(const[n,l]of Object.entries(t))l?d.set(n,l):d.delete(n);return d})},ze=(t=C)=>{D(null),M({open:!0,phase:"domain",domain:t})},ut=async t=>{if(!m)return;D(null),ue(!0);const s=re.filter(l=>{var y;return l.domain===t&&((y=l.user)==null?void 0:y.id)===m}),d=re.filter(l=>l.domain===t),n=(s.length>0?s:d).slice(0,12);if(n.length<2){D("Forge needs at least two matching records in this domain before it can start the game."),ue(!1),M(l=>({...l,phase:"domain"}));return}try{A({domain:t,tab:"overview",contextId:null,focusItem:null}),await Promise.all(n.map(l=>Ye({userId:m,domain:t,entityType:l.entityType,entityId:l.entityId,label:l.label,description:l.description,tags:[]}))),await b(),M({open:!0,phase:"play",domain:t})}catch(l){D(l instanceof Error?l.message:"Forge could not start the game."),M(y=>({...y,phase:"domain"}))}finally{ue(!1)}},_e=async(t,s)=>{if(m){D(null),A({domain:t,tab:"overview",contextId:null,focusItem:null});try{await dt.mutateAsync({userId:m,domain:t,contextId:K??void 0,catalogId:s}),M({open:!0,phase:"play",domain:t})}catch(d){D(d instanceof Error?d.message:"Forge could not start the game.")}}},mt=async t=>{if(ts.has(t)){await ut(t);return}D(null),M({open:!0,phase:"catalog",domain:t})},xt=async(t,s=1)=>{if(!m||!(P!=null&&P.compare.nextPair))return;const d=P.compare.nextPair;await ct.mutateAsync({userId:m,domain:z.domain,contextId:P.selectedContext.id,leftItemId:d.left.id,rightItemId:d.right.id,outcome:t,strength:s})},pt=async(t,s)=>{!m||!P||await ot.mutateAsync({userId:m,domain:z.domain,contextId:P.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(Y.isLoading&&!r)return e.jsx(Je,{eyebrow:"Preferences",title:"Loading preference model",description:"Reconstructing current scores, uncertainty, and concept libraries."});if(Y.isError)return e.jsx(Pt,{eyebrow:"Preferences",error:Y.error,onRetry:()=>void Y.refetch()});if(!r)return null;const gt=[...r.dimensions].sort((t,s)=>s.confidence-t.confidence).slice(0,6),Ge=r.scores.filter(t=>de(t)==="liked"||de(t)==="favorite").slice(0,4),Oe=r.scores.filter(t=>t.uncertainty>=.5).slice(0,4),$e=ns(r),Be=is(((Qe=c==null?void 0:c.item)==null?void 0:Qe.sourceEntityType)??null,((Re=c==null?void 0:c.item)==null?void 0:Re.sourceEntityId)??null);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-5",children:[e.jsx(Ut,{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:`${r.summary.totalItems} items · ${R(r.summary.averageConfidence)} confidence`,actions:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(u,{className:"min-w-[10rem]",onClick:()=>ze(),children:"Start the game"}),e.jsx(u,{variant:"secondary",onClick:()=>void b(),children:"Refresh model"})]})}),e.jsx(Ft,{}),e.jsx(ms,{users:i.snapshot.users,user:lt,selectedUserId:m,selectedDomain:C,workspace:r,onPatchSearch:A}),e.jsx(xs,{selectedTab:T,onSelectTab:t=>A({tab:t})}),T==="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(j,{className:"grid gap-5",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"What Forge knows"}),e.jsx("div",{className:"font-display text-3xl text-[var(--ui-ink-strong)]",children:$e.title}),e.jsx("div",{className:"max-w-[70ch] text-sm leading-6 text-[var(--ui-ink-soft)]",children:$e.description})]}),e.jsx("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-4",children:[{label:"Known items",value:r.summary.totalItems,detail:"Items inside this domain"},{label:"Confidence",value:R(r.summary.averageConfidence),detail:"Average certainty"},{label:"Unknowns",value:r.summary.uncertainCount,detail:"Need more rounds"},{label:"Libraries",value:r.libraries.totalCatalogItems,detail:"Seeded concepts ready"}].map(t=>e.jsxs("div",{className:"rounded-[22px] bg-[var(--ui-surface-2)] px-4 py-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:t.label}),e.jsx("div",{className:"mt-2 font-display text-3xl text-[var(--ui-ink-strong)]",children:t.value}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:t.detail})]},t.label))}),e.jsx("div",{className:"grid gap-4 lg:grid-cols-2",children:gt.map(t=>e.jsx(ls,{summary:t},t.dimensionId))})]}),e.jsxs(j,{className:"grid gap-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Next move"}),e.jsx("div",{className:"font-display text-2xl text-[var(--ui-ink-strong)]",children:"Start the game"}),e.jsx("div",{className:"text-sm leading-6 text-[var(--ui-ink-soft)]",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(u,{className:"w-full",onClick:()=>ze(),children:"Start the game"}),e.jsxs("div",{className:"grid gap-3 rounded-[22px] bg-[var(--ui-surface-2)] px-4 py-4 text-sm text-[var(--ui-ink-soft)]",children:[e.jsxs("div",{children:["Current queue: ",r.compare.pendingCount," comparison",r.compare.pendingCount===1?"":"s"]}),e.jsxs("div",{children:["Active context: ",r.selectedContext.name]}),e.jsxs("div",{children:["Library coverage: ",r.libraries.seededCatalogCount," ","seeded lists and ",r.libraries.customCatalogCount," ","custom lists"]})]})]})]}),e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.3fr)_360px]",children:[e.jsxs(j,{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-[var(--ui-ink-faint)]",children:"Preference map"}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:"Green drifts positive, red drifts negative, and low opacity still means uncertainty."})]}),e.jsx(ve,{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-[var(--ui-border-subtle)] bg-[var(--ui-surface-section)]",children:[e.jsx("div",{className:"absolute inset-x-0 top-1/2 h-px bg-[var(--ui-border-subtle)]"}),e.jsx("div",{className:"absolute inset-y-0 left-1/2 w-px bg-[var(--ui-border-subtle)]"}),r.map.map(t=>e.jsx("button",{type:"button",className:U("absolute -translate-x-1/2 -translate-y-1/2 rounded-full border px-2 py-1 text-[11px] shadow-[var(--ui-shadow-soft)] transition hover:scale-[1.04]",t.itemId===(c==null?void 0:c.itemId)?"border-[var(--ui-border-strong)] bg-[var(--ui-surface-active)] text-[var(--ui-ink-strong)]":t.score>=0?"border-[color-mix(in_srgb,var(--success)_34%,transparent)] bg-[var(--ui-success-soft)] text-[var(--ui-ink-strong)]":"border-[color-mix(in_srgb,var(--danger)_34%,transparent)] bg-[var(--ui-danger-soft)] text-[var(--ui-ink-strong)]"),style:{left:`${50+t.x*30}%`,top:`${50-t.y*30}%`,opacity:.55+t.confidence*.45},onClick:()=>$(t.itemId),children:t.label},t.itemId))]})]}),e.jsxs(j,{className:"grid gap-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Best read so far"}),e.jsx("div",{className:"grid gap-2",children:Ge.length>0?Ge.map(t=>{var s;return e.jsxs("button",{type:"button",className:"rounded-[18px] bg-[var(--ui-surface-2)] px-3 py-3 text-left transition hover:bg-[var(--ui-surface-hover)]",onClick:()=>{$(t.itemId),A({focusItem:t.itemId})},children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:((s=t.item)==null?void 0:s.label)??t.itemId}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:t.explanation[0]||"Forge has positive evidence here."})]},t.itemId)}):e.jsx("div",{className:"rounded-[18px] bg-[var(--ui-surface-2)] px-3 py-3 text-sm text-[var(--ui-ink-soft)]",children:"No clear positives yet. A few comparison rounds will change that."})}),e.jsxs("div",{className:"border-t border-[var(--ui-border-subtle)] pt-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Biggest unknowns"}),e.jsx("div",{className:"mt-3 grid gap-2",children:Oe.length>0?Oe.map(t=>{var s;return e.jsxs("div",{className:"rounded-[18px] bg-[var(--ui-surface-2)] px-3 py-3 text-sm text-[var(--ui-ink-soft)]",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:((s=t.item)==null?void 0:s.label)??t.itemId}),e.jsxs("div",{className:"mt-1",children:["Uncertainty ",R(t.uncertainty)]})]},t.itemId)}):e.jsx("div",{className:"rounded-[18px] bg-[var(--ui-surface-2)] px-3 py-3 text-sm text-[var(--ui-ink-soft)]",children:"The current unknown list is short."})})]})]})]}),e.jsxs(j,{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-[var(--ui-ink-faint)]",children:"Bring in Forge records"}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:"Search goals, projects, tasks, strategies, or habits across human and bot users, then send them straight into this model."})]}),e.jsxs(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:[ke.length," visible"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ce,{className:"size-4 text-[var(--ui-ink-muted)]"}),e.jsx(v,{value:w,onChange:t=>p(t.target.value),placeholder:"Search across owners, handles, user kind, title, and description"})]}),e.jsx("div",{className:"grid gap-2",children:ke.map(t=>e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-[18px] bg-[var(--ui-surface-2)] 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-[var(--ui-ink-strong)]",children:t.label}),e.jsx(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:t.entityType}),t.user?e.jsx(tt,{user:t.user,compact:!0}):null]}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:t.description||"No description yet."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.href?e.jsx(ve,{to:t.href,children:e.jsx(u,{variant:"ghost",size:"sm",children:"Open"})}):null,e.jsx(u,{variant:"secondary",size:"sm",pending:Ie.isPending,pendingLabel:"Adding",onClick:()=>void Ie.mutateAsync({userId:m,domain:C,entityType:t.entityType,entityId:t.entityId,label:t.label,description:t.description,tags:[]}),children:"Add to model"})]})]},`${t.entityType}-${t.entityId}`))})]})]}):null,T==="map"?e.jsxs(j,{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-[var(--ui-ink-faint)]",children:"Full map"}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:"Click a point to inspect why Forge believes it belongs there."})]}),e.jsxs("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:[r.map.length," plotted items"]})]}),e.jsxs("div",{className:"relative min-h-[520px] overflow-hidden rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-section)]",children:[e.jsx("div",{className:"absolute inset-x-0 top-1/2 h-px bg-[var(--ui-border-subtle)]"}),e.jsx("div",{className:"absolute inset-y-0 left-1/2 w-px bg-[var(--ui-border-subtle)]"}),r.map.map(t=>e.jsx("button",{type:"button",className:U("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===(c==null?void 0:c.itemId)?"border-[var(--ui-border-strong)] bg-[var(--ui-surface-active)] text-[var(--ui-ink-strong)]":t.score>=0?"border-[color-mix(in_srgb,var(--success)_34%,transparent)] bg-[var(--ui-success-soft)] text-[var(--ui-ink-strong)]":"border-[color-mix(in_srgb,var(--danger)_34%,transparent)] bg-[var(--ui-danger-soft)] text-[var(--ui-ink-strong)]"),style:{left:`${50+t.x*34}%`,top:`${50-t.y*34}%`,opacity:.45+t.confidence*.55},onClick:()=>{$(t.itemId),A({focusItem:t.itemId})},children:t.label},t.itemId))]})]}):null,T==="table"?e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.2fr)_380px]",children:[e.jsxs(j,{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ce,{className:"size-4 text-[var(--ui-ink-muted)]"}),e.jsx(v,{value:k,onChange:t=>h(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-[var(--ui-ink-muted)]",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:he.map(t=>{var s,d;return e.jsxs("tr",{className:U("cursor-pointer border-t border-[var(--ui-border-subtle)] transition hover:bg-[var(--ui-surface-2)]",t.itemId===(c==null?void 0:c.itemId)?"bg-[var(--ui-surface-2)]":""),onClick:()=>{$(t.itemId),A({focusItem:t.itemId})},children:[e.jsxs("td",{className:"px-3 py-3",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:((s=t.item)==null?void 0:s.label)??t.itemId}),e.jsx("div",{className:"text-xs text-[var(--ui-ink-muted)]",children:(((d=t.item)==null?void 0:d.tags)??[]).join(" · ")})]}),e.jsx("td",{className:"px-3 py-3 text-[var(--ui-ink-medium)]",children:t.latentScore.toFixed(2)}),e.jsx("td",{className:"px-3 py-3 text-[var(--ui-ink-medium)]",children:R(t.confidence)}),e.jsx("td",{className:"px-3 py-3",children:e.jsx(I,{className:Ze[de(t)],children:de(t)})}),e.jsx("td",{className:"px-3 py-3 text-[var(--ui-ink-medium)]",children:t.evidenceCount})]},t.itemId)})})]})})]}),e.jsxs(j,{className:"grid gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Item editor"}),c!=null&&c.item?e.jsxs(e.Fragment,{children:[e.jsx(v,{value:f.label,onChange:t=>F(s=>({...s,label:t.target.value})),placeholder:"Item label"}),e.jsx(E,{value:f.description,onChange:t=>F(s=>({...s,description:t.target.value})),className:"min-h-24",placeholder:"Item description"}),e.jsx(v,{value:f.tags,onChange:t=>F(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:f.manualStatus,onChange:t=>F(s=>({...s,manualStatus:t.target.value})),className:"min-h-10 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 text-sm text-[var(--ui-ink-strong)] outline-none",children:[e.jsx("option",{value:"",children:"Inferred status"}),Object.keys(Ze).map(t=>e.jsx("option",{value:t,children:t},t))]}),e.jsx(v,{value:f.manualScore,onChange:t=>F(s=>({...s,manualScore:t.target.value})),placeholder:"Manual score"}),e.jsx(v,{value:f.confidenceLock,onChange:t=>F(s=>({...s,confidenceLock:t.target.value})),placeholder:"Confidence lock 0-1"})]}),e.jsx("div",{className:"grid gap-2",children:Object.keys(ne).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-[var(--ui-ink-soft)]",children:fe[t]}),e.jsx(v,{value:f.featureWeights[t],onChange:s=>F(d=>({...d,featureWeights:{...d.featureWeights,[t]:s.target.value}}))})]},t))}),e.jsx("div",{className:"grid gap-2 text-sm text-[var(--ui-ink-soft)]",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:f[t],onChange:d=>F(n=>({...n,[t]:d.target.checked}))}),e.jsx("span",{children:s})]},t))}),e.jsx(u,{pending:De.isPending,pendingLabel:"Saving item",onClick:()=>void De.mutateAsync(),children:"Save item model"}),Be?e.jsx(ve,{className:"text-sm text-[var(--primary)]",to:Be,children:"Open linked entity"}):null]}):e.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Select a row to inspect or edit it."}),e.jsxs("div",{className:"mt-3 border-t border-[var(--ui-border-subtle)] pt-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Add custom item"}),e.jsxs("div",{className:"mt-3 grid gap-3",children:[e.jsx(v,{value:_.label,onChange:t=>ee(s=>({...s,label:t.target.value})),placeholder:"Custom item label"}),e.jsx(E,{value:_.description,onChange:t=>ee(s=>({...s,description:t.target.value})),className:"min-h-24",placeholder:"What is this preference item?"}),e.jsx(v,{value:_.tags,onChange:t=>ee(s=>({...s,tags:t.target.value})),placeholder:"comma, separated, tags"}),e.jsx(u,{disabled:!_.label.trim(),pending:Se.isPending,pendingLabel:"Creating item",onClick:()=>void Se.mutateAsync({userId:m,domain:C,label:_.label,description:_.description,tags:_.tags.split(",").map(t=>t.trim()).filter(Boolean),featureWeights:ne,queueForCompare:!0}),children:"Create custom item"})]})]})]})]}):null,T==="history"?e.jsxs("div",{className:"grid gap-5 xl:grid-cols-3",children:[e.jsxs(j,{className:"grid gap-3 xl:col-span-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Recent pairwise judgments"}),e.jsx("div",{className:"grid gap-2",children:r.history.judgments.slice(0,12).map(t=>{var n,l,y,X;const s=((l=(n=r.scores.find(Q=>Q.itemId===t.leftItemId))==null?void 0:n.item)==null?void 0:l.label)??t.leftItemId,d=((X=(y=r.scores.find(Q=>Q.itemId===t.rightItemId))==null?void 0:y.item)==null?void 0:X.label)??t.rightItemId;return e.jsxs("div",{className:"rounded-[18px] bg-[var(--ui-surface-2)] px-4 py-3 text-sm text-[var(--ui-ink-soft)]",children:[e.jsxs("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:[s," vs ",d]}),e.jsxs("div",{className:"mt-1",children:["Outcome ",t.outcome," · strength"," ",t.strength," ·"," ",new Date(t.createdAt).toLocaleString()]})]},t.id)})})]}),e.jsxs(j,{className:"grid gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Signals and snapshots"}),e.jsx("div",{className:"grid gap-2",children:r.history.signals.slice(0,8).map(t=>{var d,n;const s=((n=(d=r.scores.find(l=>l.itemId===t.itemId))==null?void 0:d.item)==null?void 0:n.label)??t.itemId;return e.jsxs("div",{className:"rounded-[18px] bg-[var(--ui-surface-2)] px-3 py-2 text-sm text-[var(--ui-ink-soft)]",children:[s," · ",t.signalType," ·"," ",new Date(t.createdAt).toLocaleString()]},t.id)})}),e.jsx("div",{className:"grid gap-2",children:r.history.snapshots.slice(0,5).map(t=>e.jsxs("div",{className:"rounded-[18px] bg-[var(--ui-surface-2)] px-3 py-2 text-sm text-[var(--ui-ink-soft)]",children:["Snapshot ",new Date(t.createdAt).toLocaleString()]},t.id))}),e.jsxs("div",{className:"rounded-[18px] bg-[var(--ui-surface-2)] px-3 py-3 text-sm text-[var(--ui-ink-soft)]",children:["Stale items: ",r.history.staleItemIds.length," · Flipped items: ",r.history.flippedItemIds.length]})]})]}):null,T==="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:r.contexts.map(t=>e.jsxs(j,{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-[var(--ui-ink-strong)]",children:t.name}),e.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:t.description||"No description yet."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.isDefault?e.jsx(I,{className:"bg-[var(--primary)]/14 text-[var(--primary)]",children:"Default"}):null,e.jsx(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:t.shareMode}),t.active?null:e.jsx(I,{className:"bg-[var(--ui-warning-soft)] text-[var(--warning)]",children:"Inactive"})]})]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-4",children:[e.jsx(v,{value:t.name,onChange:s=>void q.mutateAsync({contextId:t.id,patch:{name:s.target.value}}),placeholder:"Context name"}),e.jsxs("select",{value:t.shareMode,onChange:s=>void q.mutateAsync({contextId:t.id,patch:{shareMode:s.target.value}}),className:"min-h-10 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 text-sm text-[var(--ui-ink-strong)] 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(v,{value:String(t.decayDays),onChange:s=>void q.mutateAsync({contextId:t.id,patch:{decayDays:Number(s.target.value||90)}}),placeholder:"Decay days"}),e.jsx(u,{variant:"secondary",onClick:()=>A({contextId:t.id,tab:"overview"}),children:"Open context"})]}),e.jsx(E,{value:t.description,onChange:s=>void q.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(u,{variant:"secondary",onClick:()=>void q.mutateAsync({contextId:t.id,patch:{active:!t.active}}),children:t.active?"Deactivate":"Activate"}),t.isDefault?null:e.jsx(u,{variant:"secondary",onClick:()=>void q.mutateAsync({contextId:t.id,patch:{isDefault:!0}}),children:"Make default"})]})]},t.id))}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs(j,{className:"grid gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Create context"}),e.jsx(v,{value:L.name,onChange:t=>W(s=>({...s,name:t.target.value})),placeholder:"Context name"}),e.jsx(E,{value:L.description,onChange:t=>W(s=>({...s,description:t.target.value})),className:"min-h-24",placeholder:"What changes in this context?"}),e.jsxs("select",{value:L.shareMode,onChange:t=>W(s=>({...s,shareMode:t.target.value})),className:"min-h-10 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 text-sm text-[var(--ui-ink-strong)] 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(v,{value:L.decayDays,onChange:t=>W(s=>({...s,decayDays:t.target.value})),placeholder:"Decay days"}),e.jsx(u,{disabled:!L.name.trim(),pending:Ae.isPending,pendingLabel:"Creating context",onClick:()=>void Ae.mutateAsync({userId:m,domain:C,name:L.name,description:L.description,shareMode:L.shareMode,decayDays:Number(L.decayDays||90),active:!0,isDefault:!1}),children:"Create context"})]}),e.jsxs(j,{className:"grid gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Merge contexts"}),e.jsxs("select",{value:G,onChange:t=>J(t.target.value),className:"min-h-10 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 text-sm text-[var(--ui-ink-strong)] outline-none",children:[e.jsx("option",{value:"",children:"Source context"}),r.contexts.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]}),e.jsxs("select",{value:O,onChange:t=>be(t.target.value),className:"min-h-10 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 text-sm text-[var(--ui-ink-strong)] outline-none",children:[e.jsx("option",{value:"",children:"Target context"}),r.contexts.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]}),e.jsx(u,{pending:Ee.isPending,pendingLabel:"Merging",disabled:!G||!O||G===O,onClick:()=>void Ee.mutateAsync({sourceContextId:G,targetContextId:O}),children:"Merge into target"})]})]})]}):null,T==="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(j,{className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Concept libraries"}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",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",r.libraries.totalCatalogs],["Concepts",r.libraries.totalCatalogItems],["Seeded",r.libraries.seededCatalogCount],["Custom",r.libraries.customCatalogCount]].map(([t,s])=>e.jsxs("div",{className:"rounded-[18px] bg-[var(--ui-surface-2)] px-4 py-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:t}),e.jsx("div",{className:"mt-2 font-display text-3xl text-[var(--ui-ink-strong)]",children:s})]},t))}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ce,{className:"size-4 text-[var(--ui-ink-muted)]"}),e.jsx(v,{value:S,onChange:t=>V(t.target.value),placeholder:"Search lists, concepts, tags, and seeded domains"})]})]}),e.jsxs(j,{className:"grid gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Create concept list"}),e.jsx(v,{value:H.title,onChange:t=>me(s=>({...s,title:t.target.value})),placeholder:"List title"}),e.jsx(E,{value:H.description,onChange:t=>me(s=>({...s,description:t.target.value})),className:"min-h-24",placeholder:"What should this list help compare?"}),e.jsx(u,{disabled:!H.title.trim(),pending:we.isPending,pendingLabel:"Creating list",onClick:()=>void we.mutateAsync({userId:m,domain:C,title:H.title,description:H.description}),children:"Create list"})]})]}),e.jsx("div",{className:"grid gap-4",children:Ce.map(t=>{const s=rt[t.id]??{label:"",description:"",tags:""},d=t.items.filter(n=>S.trim()?[n.label,n.description,n.tags.join(" ")].join(" ").toLowerCase().includes(le(S)):!0);return e.jsxs(j,{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:ye===t.id?e.jsxs("div",{className:"grid gap-3",children:[e.jsx(v,{value:se.title,onChange:n=>pe(l=>({...l,title:n.target.value}))}),e.jsx(E,{value:se.description,onChange:n=>pe(l=>({...l,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-[var(--ui-ink-strong)]",children:t.title}),e.jsx(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:t.source}),e.jsxs(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:[t.items.length," items"]})]}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:t.description||"No description yet."})]})}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(u,{variant:"secondary",size:"sm",onClick:()=>void _e(C,t.id),children:"Start from this list"}),ye===t.id?e.jsxs(e.Fragment,{children:[e.jsx(u,{size:"sm",pending:Pe.isPending,pendingLabel:"Saving",onClick:()=>void Pe.mutateAsync({catalogId:t.id,patch:{title:se.title,description:se.description}}),children:"Save"}),e.jsx(u,{variant:"ghost",size:"sm",onClick:()=>xe(null),children:"Cancel"})]}):e.jsx(u,{variant:"ghost",size:"sm",onClick:()=>{xe(t.id),pe({title:t.title,description:t.description})},children:"Edit list"}),e.jsx(u,{variant:"ghost",size:"sm",pending:Fe.isPending,pendingLabel:"Deleting",onClick:()=>void Fe.mutateAsync(t.id),children:"Delete list"})]})]}),e.jsx("div",{className:"grid gap-2",children:d.map(n=>e.jsx("div",{className:"rounded-[18px] bg-[var(--ui-surface-2)] px-4 py-3",children:nt===n.id?e.jsxs("div",{className:"grid gap-3",children:[e.jsx(v,{value:B.label,onChange:l=>ae(y=>({...y,label:l.target.value}))}),e.jsx(E,{value:B.description,onChange:l=>ae(y=>({...y,description:l.target.value})),className:"min-h-20"}),e.jsx(v,{value:B.tags,onChange:l=>ae(y=>({...y,tags:l.target.value})),placeholder:"comma, separated, tags"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(u,{size:"sm",pending:Te.isPending,pendingLabel:"Saving",onClick:()=>void Te.mutateAsync({catalogItemId:n.id,patch:{label:B.label,description:B.description,tags:B.tags.split(",").map(l=>l.trim()).filter(Boolean)}}),children:"Save concept"}),e.jsx(u,{variant:"ghost",size:"sm",onClick:()=>ge(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-[var(--ui-ink-strong)]",children:n.label}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:n.description||"No description yet."}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:n.tags.map(l=>e.jsx(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:l},`${n.id}-${l}`))})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(u,{variant:"ghost",size:"sm",onClick:()=>{ge(n.id),ae({label:n.label,description:n.description,tags:n.tags.join(", ")})},children:"Edit"}),e.jsxs(u,{variant:"ghost",size:"sm",pending:Me.isPending,pendingLabel:"Deleting",onClick:()=>void Me.mutateAsync(n.id),children:[e.jsx(Ct,{className:"mr-1 size-4"}),"Delete"]})]})]})},n.id))}),e.jsxs("div",{className:"grid gap-3 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-[var(--ui-ink-medium)]",children:[e.jsx(It,{className:"size-4"}),"Add concept to ",t.title]}),e.jsx(v,{value:s.label,onChange:n=>te(l=>({...l,[t.id]:{...s,label:n.target.value}})),placeholder:"Concept label"}),e.jsx(E,{value:s.description,onChange:n=>te(l=>({...l,[t.id]:{...s,description:n.target.value}})),className:"min-h-20",placeholder:"Short description"}),e.jsx(v,{value:s.tags,onChange:n=>te(l=>({...l,[t.id]:{...s,tags:n.target.value}})),placeholder:"comma, separated, tags"}),e.jsx(u,{disabled:!s.label.trim(),pending:Le.isPending,pendingLabel:"Adding",onClick:()=>void Le.mutateAsync({catalogId:t.id,label:s.label,description:s.description,tags:s.tags.split(",").map(n=>n.trim()).filter(Boolean),featureWeights:ne}).then(()=>te(n=>({...n,[t.id]:{label:"",description:"",tags:""}}))),children:"Add concept"})]})]},t.id)})})]}):null]}),e.jsx(ds,{state:z,onOpenChange:t=>{t||D(null),M(s=>({...s,open:t}))},error:at,loading:it,workspaceLoading:Ne.isLoading,activeWorkspace:P,conceptSearchQuery:S,onConceptSearchQueryChange:V,filteredCatalogs:Ce,onSelectDomain:t=>void mt(t),onStartCatalogGame:(t,s)=>void _e(t,s),onJudge:(t,s)=>void xt(t,s),onSignal:(t,s)=>void pt(t,s)})]})}export{Cs as PreferencesPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as a}from"./vendor-
|
|
1
|
+
import{j as a}from"./vendor-y_uz1Wft.js";import{c as n}from"./index-Dj8q65se.js";const u={active:"Active",paused:"Suspended",completed:"Finished",all:"All"};function d({value:e,counts:t,onChange:s,className:o}){return a.jsx("div",{className:n("flex flex-wrap gap-2",o),children:Object.keys(u).map(r=>{const i=r===e;return a.jsxs("button",{type:"button",onClick:()=>s(r),className:n("inline-flex min-h-10 items-center gap-2 rounded-full border px-4 py-2 text-sm transition",i?"border-[var(--ui-border-strong)] bg-[var(--ui-accent-soft)] text-[var(--ui-ink-strong)] shadow-[var(--ui-shadow-soft)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] hover:bg-[var(--ui-surface-2)] hover:text-[var(--ui-ink-strong)]"),children:[a.jsx("span",{children:u[r]}),a.jsx("span",{className:n("rounded-full px-2 py-0.5 text-[11px]",i?"bg-[var(--ui-surface-active)] text-[var(--ui-ink-strong)]":"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]"),children:t[r]})]},r)})})}function v(e){return{active:e.filter(t=>t.status==="active").length,paused:e.filter(t=>t.status==="paused").length,completed:e.filter(t=>t.status==="completed").length,all:e.length}}function f(e,t){return t==="all"?e:e.filter(s=>s.status===t)}export{d as P,v as b,f};
|