forge-openclaw-plugin 0.3.3 → 0.3.4
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-5Ii4UzHa.js → action-bar-CMGr_Uv_.js} +1 -1
- package/dist/assets/{activity-page-CWjTKFY3.js → activity-page-DwGKkJtr.js} +1 -1
- package/dist/assets/{ai-surface-workspace-Dd2FSRom.js → ai-surface-workspace-UtnoNmjq.js} +1 -1
- package/dist/assets/{atlas-panel-Dinteouh.js → atlas-panel-f1kc-LkD.js} +1 -1
- package/dist/assets/{calendar-page-BWkXhzDf.js → calendar-page-C4YqeVrC.js} +1 -1
- package/dist/assets/{calendar-rules-CjyuTu2I.js → calendar-rules-BQppCPiN.js} +1 -1
- package/dist/assets/{calendar-week-toolbar-D-nd9tkk.js → calendar-week-toolbar-DdPuHUwd.js} +1 -1
- package/dist/assets/{companion-sync-lab-page-G0t1TqqZ.js → companion-sync-lab-page-N3cR33GS.js} +1 -1
- package/dist/assets/{daily-metrics-dashboard-DpIAdzFX.js → daily-metrics-dashboard-CXnAtN2T.js} +1 -1
- package/dist/assets/{define-workbench-box-BIOZopF2.js → define-workbench-box-DkffygDU.js} +1 -1
- package/dist/assets/{entity-link-multiselect-DZZjpL_d.js → entity-link-multiselect-wuyJ8BbW.js} +1 -1
- package/dist/assets/{entity-note-count-link-CmRRdXAr.js → entity-note-count-link-CEtKyMAl.js} +1 -1
- package/dist/assets/{entity-notes-surface-8MPDscsu.js → entity-notes-surface-iKNiierJ.js} +1 -1
- package/dist/assets/{execution-board-Bi8gi8J6.js → execution-board-DesFZ1f5.js} +1 -1
- package/dist/assets/{faceted-token-search-BGs4TqxT.js → faceted-token-search-D4Okr-Kr.js} +1 -1
- package/dist/assets/{flagship-signal-deck-jLxHEHvb.js → flagship-signal-deck-CW91n6u9.js} +1 -1
- package/dist/assets/{floating-action-menu-Itpm7T2_.js → floating-action-menu-GCeuOdYZ.js} +1 -1
- package/dist/assets/{generic-node-view-KePoUF3Z.js → generic-node-view-COhU_Wm3.js} +1 -1
- package/dist/assets/{goal-detail-page-a1lEswpJ.js → goal-detail-page-Bd8JU3IK.js} +1 -1
- package/dist/assets/{goal-dialog-CYgRzl4y.js → goal-dialog-CLz5fYhO.js} +1 -1
- package/dist/assets/{goals-page-JY_EJq9U.js → goals-page-CZHNVyY-.js} +1 -1
- package/dist/assets/{habits-page-BRI8AoaQ.js → habits-page-CXiBB7_N.js} +1 -1
- package/dist/assets/{health-boxes-DZJOFTOI.js → health-boxes-BUcsxDLh.js} +1 -1
- package/dist/assets/{index-wEZUnRh0.js → index-BejvcRGb.js} +2 -2
- package/dist/assets/{index-Bcem7l5u.css → index-CEgIwgk9.css} +1 -1
- package/dist/assets/{inline-note-fields-CUVRzQkI.js → inline-note-fields-CcRDO3pd.js} +1 -1
- package/dist/assets/{insight-flow-dialog-By73oG1H.js → insight-flow-dialog-DUBk2MR8.js} +1 -1
- package/dist/assets/{insights-page-DLyN-9yz.js → insights-page-8fLhCYsM.js} +1 -1
- package/dist/assets/{kanban-boxes-M71CejV4.js → kanban-boxes-CH7plRk1.js} +1 -1
- package/dist/assets/{kanban-page-InKHhJQD.js → kanban-page-Bq-aYwUL.js} +1 -1
- package/dist/assets/{knowledge-graph-page-C-GEQGRY.js → knowledge-graph-page-DYFfWh4Y.js} +1 -1
- package/dist/assets/{life-force-page-Dq88NzNp.js → life-force-page-D80rgBBR.js} +1 -1
- package/dist/assets/{life-force-workspace-Bl_0slZi.js → life-force-workspace-CcmZRRfU.js} +1 -1
- package/dist/assets/{metric-tile-yQJgjYrN.js → metric-tile-DysHMgM3.js} +1 -1
- package/dist/assets/{movement-boxes-C-rc3N8Z.js → movement-boxes-BH3botKt.js} +1 -1
- package/dist/assets/{movement-page-DK-d1uYa.js → movement-page-D5KLMKS9.js} +1 -1
- package/dist/assets/{note-markdown-7czv-KMH.js → note-markdown-Byd_vNkS.js} +1 -1
- package/dist/assets/{note-tags-input-CkgkqiT3.js → note-tags-input-DYAFDq8Q.js} +1 -1
- package/dist/assets/{notes-boxes-BQuR1MiB.js → notes-boxes-CPiPps1e.js} +1 -1
- package/dist/assets/{notes-page-ec9g1mPh.js → notes-page-DehVrOOb.js} +1 -1
- package/dist/assets/{open-in-graph-button-B_4fdm4l.js → open-in-graph-button-L21MKsb5.js} +1 -1
- package/dist/assets/{orbit-map-DPQNBqS-.js → orbit-map-ChJOQ8CN.js} +1 -1
- package/dist/assets/{overview-page-CZjMab2o.js → overview-page-D_ewyeWF.js} +1 -1
- package/dist/assets/{page-hero-BRcqE3a4.js → page-hero-DlHEJ0Yt.js} +1 -1
- package/dist/assets/{pill-cluster-dy6jG_dV.js → pill-cluster-DhOR4m7X.js} +1 -1
- package/dist/assets/{preference-entity-handoff-button-DOV-_2Vm.js → preference-entity-handoff-button-ugHU2us9.js} +1 -1
- package/dist/assets/{preferences-page-Co8w5hzp.js → preferences-page-BTTXeSDR.js} +1 -1
- package/dist/assets/{project-collections-DNgKleDl.js → project-collections-USb6PUe0.js} +1 -1
- package/dist/assets/{project-detail-page-C-Ib1x8w.js → project-detail-page-1tD6tUsB.js} +1 -1
- package/dist/assets/{project-dialog-D_hgOdB9.js → project-dialog-BaHhJqP6.js} +1 -1
- package/dist/assets/{project-management-hierarchy-page-asf61KSz.js → project-management-hierarchy-page-D4HV8QXs.js} +1 -1
- package/dist/assets/{project-management-section-nav-DAZA1oXG.js → project-management-section-nav-9OV6_ifH.js} +1 -1
- package/dist/assets/{projects-boxes-CHLr1Bs-.js → projects-boxes-AyudWls3.js} +1 -1
- package/dist/assets/{projects-page-BsM8yCqQ.js → projects-page-DizVVzbt.js} +1 -1
- package/dist/assets/{psyche-behaviors-page-COSZeP4J.js → psyche-behaviors-page-CX5MJjWj.js} +1 -1
- package/dist/assets/{psyche-flashcards-page-CJmgGL9x.js → psyche-flashcards-page-DzCGy-FV.js} +1 -1
- package/dist/assets/{psyche-goal-map-page-avrWNSs9.js → psyche-goal-map-page-BcKR792E.js} +1 -1
- package/dist/assets/{psyche-graph-BmwbnNBY.js → psyche-graph-BNllZR67.js} +1 -1
- package/dist/assets/{psyche-metrics-page-CY0J_aMx.js → psyche-metrics-page-CpEKlZLO.js} +1 -1
- package/dist/assets/{psyche-mode-guide-page-COcswIHZ.js → psyche-mode-guide-page-DXKSE2o7.js} +1 -1
- package/dist/assets/{psyche-modes-page-BXF_GZoP.js → psyche-modes-page-Bh6eeNm1.js} +1 -1
- package/dist/assets/{psyche-page-VsMBNG1F.js → psyche-page-B44RJrrC.js} +1 -1
- package/dist/assets/{psyche-patterns-page-DVoIro0Q.js → psyche-patterns-page-Bm7T5FMJ.js} +1 -1
- package/dist/assets/{psyche-questionnaire-builder-page-CahcrbQj.js → psyche-questionnaire-builder-page-BNtMNjY8.js} +1 -1
- package/dist/assets/{psyche-questionnaire-detail-page-CYSgADAD.js → psyche-questionnaire-detail-page-BnMXErRK.js} +1 -1
- package/dist/assets/{psyche-questionnaire-run-detail-page-D5q5URTu.js → psyche-questionnaire-run-detail-page-CWKxbdwZ.js} +1 -1
- package/dist/assets/{psyche-questionnaire-run-page-DUoA-VSs.js → psyche-questionnaire-run-page-DwH7Sk52.js} +1 -1
- package/dist/assets/{psyche-questionnaires-page-dbQlqbKh.js → psyche-questionnaires-page-B1t_a8QU.js} +1 -1
- package/dist/assets/{psyche-report-detail-page-D_Mmlf2D.js → psyche-report-detail-page-x2AtC99e.js} +1 -1
- package/dist/assets/{psyche-reports-page-CO3J4Js3.js → psyche-reports-page-KiwCgWPa.js} +1 -1
- package/dist/assets/{psyche-schemas-beliefs-page-BUNGL4zW.js → psyche-schemas-beliefs-page-CIEoAJAp.js} +1 -1
- package/dist/assets/{psyche-screen-time-page-Bm18uHDg.js → psyche-screen-time-page-DO6UycL9.js} +1 -1
- package/dist/assets/{psyche-self-observation-page-VdPMBuK4.js → psyche-self-observation-page-CPcpUSdm.js} +1 -1
- package/dist/assets/{psyche-values-page-DivSQodJ.js → psyche-values-page-BAgNeo4L.js} +1 -1
- package/dist/assets/{question-flow-dialog-Dsnsc8be.js → question-flow-dialog-BByFV8Yw.js} +1 -1
- package/dist/assets/{report-chain-fields-Bf-WCSJQ.js → report-chain-fields-BpRWMp7h.js} +1 -1
- package/dist/assets/{rewards-page-CI53Cp0i.js → rewards-page-kIiX8SHn.js} +1 -1
- package/dist/assets/{scheduling-rules-editor-Bg3QU_qt.js → scheduling-rules-editor-oQXGcL5l.js} +1 -1
- package/dist/assets/{schema-badge-CRThEDqP.js → schema-badge-BoNjw3h4.js} +1 -1
- package/dist/assets/{schemas-B8-kIOFQ.js → schemas-IBbtdPzn.js} +1 -1
- package/dist/assets/{select-menu-rT3Qd5t5.js → select-menu-U-YryCwP.js} +1 -1
- package/dist/assets/{settings-agents-page-VDUv2WuO.js → settings-agents-page-CbHeMq3e.js} +1 -1
- package/dist/assets/{settings-bin-page-DfuGJVqc.js → settings-bin-page-LxS2YPsA.js} +1 -1
- package/dist/assets/{settings-calendar-page-ex7eHB1y.js → settings-calendar-page-CZc-I-HK.js} +1 -1
- package/dist/assets/{settings-data-page-BPWyPVGo.js → settings-data-page-m-aBRMR9.js} +1 -1
- package/dist/assets/{settings-logs-page-CwTT4n63.js → settings-logs-page-BUEGWlQu.js} +1 -1
- package/dist/assets/{settings-mobile-page-B6sVk872.js → settings-mobile-page-C_5CHjHl.js} +1 -1
- package/dist/assets/{settings-models-page-Dq5XViZd.js → settings-models-page-B4HQu8kL.js} +1 -1
- package/dist/assets/{settings-page-BRxdAxbS.js → settings-page-CY8N-fNV.js} +1 -1
- package/dist/assets/{settings-rewards-page-DRvxTwv3.js → settings-rewards-page-C0XQoWjb.js} +1 -1
- package/dist/assets/{settings-section-nav-D_vKvOWd.js → settings-section-nav-CkqqtM0F.js} +1 -1
- package/dist/assets/{settings-users-page-B6oSpOaV.js → settings-users-page-COCBOq7d.js} +1 -1
- package/dist/assets/{settings-wiki-page-Bkv-SS3J.js → settings-wiki-page-Dy1d7-z-.js} +1 -1
- package/dist/assets/{sleep-page-DELXxo6j.js → sleep-page-1kKicdFq.js} +1 -1
- package/dist/assets/{sports-page-ByWQL0Gf.js → sports-page-DJErRii_.js} +1 -1
- package/dist/assets/{strategies-page-PuUHsaSJ.js → strategies-page-CWNFb9vv.js} +1 -1
- package/dist/assets/{strategy-detail-page-CSyVdv29.js → strategy-detail-page-D9rFVXRS.js} +1 -1
- package/dist/assets/{strategy-dialog-Fgpc0z1M.js → strategy-dialog-BIVHfUR6.js} +1 -1
- package/dist/assets/{surface-DzVqQDmf.js → surface-B3oXO1No.js} +1 -1
- package/dist/assets/{task-detail-page-BoLvJ_4F.js → task-detail-page-r8ipOpAF.js} +1 -1
- package/dist/assets/{task-dialog-B2cGkhLk.js → task-dialog-C3kkWtcT.js} +1 -1
- package/dist/assets/{timebox-planning-dialog-BjiC2jh0.js → timebox-planning-dialog-BadS5tEr.js} +1 -1
- package/dist/assets/{today-boxes-B4f4sBXg.js → today-boxes-CiccN0Gw.js} +1 -1
- package/dist/assets/{today-page-Cusp2JI8.js → today-page-DvQredbl.js} +1 -1
- package/dist/assets/{training-load-page-CsZbK6rY.js → training-load-page-CkX-nSoe.js} +1 -1
- package/dist/assets/{user-badge-CQygGKVs.js → user-badge-BKzwGZDd.js} +1 -1
- package/dist/assets/{utility-widgets-DRESNarT.js → utility-widgets-DvxKA6dI.js} +1 -1
- package/dist/assets/{vitals-page-BlTZ4f78.js → vitals-page-CRIsr_C7.js} +1 -1
- package/dist/assets/{weekly-review-page-3Pk3NeGE.js → weekly-review-page-CNqxLRCd.js} +1 -1
- package/dist/assets/{weight-loss-page-CRCtv1fX.js → weight-loss-page-SSsCp1Yw.js} +3 -3
- package/dist/assets/{wiki-article-markdown-D0PWvioX.js → wiki-article-markdown-C9VKineE.js} +1 -1
- package/dist/assets/{wiki-editor-page-OZMYUgFo.js → wiki-editor-page-DxGsKvF7.js} +1 -1
- package/dist/assets/{wiki-ingest-history-page-DXZHzAqU.js → wiki-ingest-history-page-CFmP7K1F.js} +1 -1
- package/dist/assets/{wiki-ingest-modal-Ro0V4UMB.js → wiki-ingest-modal-BLw2PSWP.js} +1 -1
- package/dist/assets/{wiki-page-B1g3Rfxy.js → wiki-page-BiQ-jAuz.js} +1 -1
- package/dist/assets/{workbench-flow-page-qh5nItU6.js → workbench-flow-page-D960hXu_.js} +1 -1
- package/dist/assets/{workbench-page-CFWfAYMV.js → workbench-page-BWlY-FiL.js} +1 -1
- package/dist/assets/{workout-detail-page-Cw6t6Xj9.js → workout-detail-page-G32yJoE9.js} +1 -1
- package/dist/index.html +2 -2
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as x,j as s,cu as X,cs as Y,cv as J,aC as Z,aK as ee,b7 as se}from"./vendor-Cpmju3nw.js";import{i as re}from"./state-BtwEvpO6.js";import{E as R}from"./entity-link-multiselect-DZZjpL_d.js";import{P as te}from"./project-management-section-nav-DAZA1oXG.js";import{P as ae}from"./page-hero-BRcqE3a4.js";import{d as ie,k as j,b as D,L as ne,e as le,C as z,B as C,h as oe,a as ce,c as F,bj as de}from"./index-wEZUnRh0.js";import{U as A}from"./user-badge-CQygGKVs.js";import"./use-anchored-overlay-position-BrQ4cqKn.js";import"./motion-DwjmC9aq.js";import"./ui-B9O-eUim.js";import"./board-CLOHbg6t.js";import"./forms-C5d5hTf2.js";const _={user:"user:",kind:"kind:"},q=["goal","strategy","project","issue","task","subtask"],T=[...q],L=["active","paused","completed","backlog","focus","in_progress","blocked","done"];function I(r){return r.trim().toLowerCase()}function ue(r){return r.reduce((i,n)=>{if(n.startsWith(_.user))i.userIds.push(n.slice(_.user.length));else if(n.startsWith(_.kind)){const d=n.slice(_.kind.length);(d==="human"||d==="bot")&&i.kinds.push(d)}return i},{userIds:[],kinds:[]})}function he(r,i){return`${i}:${I(r)}`}function ge(r){const i=r.trim();return i.length===0?[]:["any",...q].map(n=>({id:he(i,n),query:i,kind:n}))}function me(r){switch(r){case"done":case"completed":return 1;case"in_progress":case"active":return .66;case"focus":return .45;case"blocked":return .5;case"paused":return .28;default:return .08}}function P(r,i){const n=r.replace(/\s+/g," ").trim();return n.length===0?i:n}function S(r){const i=(r.children??[]).map(S);if(r.kind==="project")return{...r,children:i,progressPercent:r.progressPercent,progressLabel:r.progressLabel??(typeof r.progressPercent=="number"?`${r.progressPercent}% complete`:null)};if(i.length>0){const d=i.map(g=>g.progressPercent).filter(g=>typeof g=="number");if(d.length>0){const g=Math.round(d.reduce((y,h)=>y+h,0)/d.length);return{...r,children:i,progressPercent:g,progressLabel:`${i.length} child item${i.length===1?"":"s"}`}}}const n=Math.round(me(r.statusLabel)*100);return{...r,children:i,progressPercent:n,progressLabel:r.statusLabel?r.statusLabel.replaceAll("_"," "):null}}function V(r){const{goals:i,strategies:n,projects:d,workItems:g,tagNameById:y}=r,h=new Map,v=new Map,m=new Map;for(const e of g)if(e.parentWorkItemId){const a=h.get(e.parentWorkItemId)??[];a.push(e),h.set(e.parentWorkItemId,a)}else if(e.level==="issue"&&e.projectId){const a=v.get(e.projectId)??[];a.push(e),v.set(e.projectId,a)}else if(e.projectId){const a=m.get(e.projectId)??[];a.push(e),m.set(e.projectId,a)}const b=e=>{var a;return S({id:`${e.level}:${e.id}`,entityId:e.id,kind:e.level,label:e.title,description:P(e.description,e.level==="issue"?"Vertical slice issue":e.level==="subtask"?"Granular child step":"Focused AI session task"),searchText:I([e.title,e.description,e.aiInstructions,e.executionMode??"",e.status,((a=e.user)==null?void 0:a.displayName)??"",...(e.assignees??[]).map(c=>c.displayName),...e.tagIds.map(c=>y.get(c)??"")].join(" ")),href:`/tasks/${e.id}`,statusLabel:e.status,executionMode:e.executionMode,goalId:e.goalId,projectId:e.projectId,tagIds:e.tagIds,user:e.user,assignees:e.assignees??[],linkedUserIds:[...e.user?[e.user.id]:[],...e.assigneeUserIds??[]],progressPercent:null,progressLabel:null,children:(h.get(e.id)??[]).map(b)})},f=e=>{var c;const a=n.filter(o=>o.targetProjectIds.includes(e.id));return S({id:`project:${e.id}`,entityId:e.id,kind:"project",label:e.title,description:P(e.description||e.productRequirementsDocument,"PRD-backed initiative"),searchText:I([e.title,e.description,e.productRequirementsDocument,e.goalTitle,e.workflowStatus,e.status,((c=e.user)==null?void 0:c.displayName)??"",...(e.assignees??[]).map(o=>o.displayName)].join(" ")),href:`/projects/${e.id}`,statusLabel:e.workflowStatus,executionMode:null,goalId:e.goalId,projectId:e.id,tagIds:[],user:e.user,assignees:e.assignees??[],linkedUserIds:[...e.user?[e.user.id]:[],...e.assigneeUserIds??[]],progressPercent:e.progress,progressLabel:`${e.completedTaskCount}/${e.totalTasks} done`,children:[...a.map(o=>{var p;return S({id:`strategy:${o.id}`,entityId:o.id,kind:"strategy",label:o.title,description:P(o.overview||o.endStateDescription,"Execution strategy"),searchText:I([o.title,o.overview,o.endStateDescription,o.status,((p=o.user)==null?void 0:p.displayName)??""].join(" ")),href:`/strategies/${o.id}`,statusLabel:o.status,executionMode:null,goalId:e.goalId,projectId:e.id,tagIds:[],user:o.user,assignees:[],linkedUserIds:o.user?[o.user.id]:[],progressPercent:null,progressLabel:null,children:[]})}),...(v.get(e.id)??[]).map(b),...(m.get(e.id)??[]).map(b)]})};return i.map(e=>{var B,w;const a=d.filter(l=>l.goalId===e.id),c=n.filter(l=>l.targetGoalIds.includes(e.id)),o=new Map(c.map(l=>[l.id,[]])),p=new Set;for(const l of a){const N=c.find(U=>U.targetProjectIds.includes(l.id));N&&((B=o.get(N.id))==null||B.push(l),p.add(l.id))}const M=c.map(l=>{var N;return S({id:`strategy:${l.id}`,entityId:l.id,kind:"strategy",label:l.title,description:P(l.overview||l.endStateDescription,"High-level strategy"),searchText:I([l.title,l.overview,l.endStateDescription,l.status,((N=l.user)==null?void 0:N.displayName)??""].join(" ")),href:`/strategies/${l.id}`,statusLabel:l.status,executionMode:null,goalId:e.id,projectId:null,tagIds:[],user:l.user,assignees:[],linkedUserIds:l.user?[l.user.id]:[],progressPercent:null,progressLabel:null,children:(o.get(l.id)??[]).map(f)})}),$=a.filter(l=>!p.has(l.id)).map(f);return S({id:`goal:${e.id}`,entityId:e.id,kind:"goal",label:e.title,description:P(e.description,"Strategic goal"),searchText:I([e.title,e.description,e.status,((w=e.user)==null?void 0:w.displayName)??""].join(" ")),href:`/goals/${e.id}`,statusLabel:e.status,executionMode:null,goalId:e.id,projectId:null,tagIds:e.tagIds,user:e.user,assignees:[],linkedUserIds:e.user?[e.user.id]:[],progressPercent:null,progressLabel:null,children:[...M,...$]})})}function K(r){return r.reduce((i,n)=>i+1+K(n.children??[]),0)}function pe(r,i){return r.searchText.includes(I(i.query))&&(i.kind==="any"||i.kind===r.kind)}function G(r,i,n=!1){const{clauses:d,statusFilters:g,ownerUserIds:y,ownerKinds:h,selectedUserIds:v}=i,m=d.length===0||d.some(p=>pe(r,p)),b=g.length===0||r.statusLabel!==null&&g.includes(r.statusLabel),f=y.length===0&&v.length===0?!0:[...y,...v].some(p=>r.linkedUserIds.includes(p)),e=h.length===0||[r.user,...r.assignees].some(p=>p&&h.includes(p.kind)),a=b&&f&&e,c=d.length===0||n||m,o=(r.children??[]).map(p=>G(p,i,n||a&&m)).filter(p=>p!==null);return a&&c||o.length>0?{...r,children:o}:null}function Q(r,i){return r.flatMap(n=>{const d=Q(n.children??[],i);return i.includes(n.kind)?[{...n,children:d}]:d})}function xe(r){switch(r){case"goal":return"bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_76%,var(--ui-ink-strong)_24%)]";case"strategy":return"bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_76%,var(--ui-ink-strong)_24%)]";case"project":return"bg-[var(--ui-accent-soft)] text-[var(--primary)]";case"issue":return"bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_72%,var(--ui-ink-strong)_28%)]";case"subtask":return"border-[color-mix(in_srgb,var(--tertiary)_28%,var(--ui-border-subtle)_72%)] bg-[var(--ui-tertiary-soft)] text-[var(--tertiary)]";default:return"bg-[var(--ui-tertiary-soft)] text-[var(--tertiary)]"}}function O(r){switch(r){case"done":case"completed":return"bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_76%,var(--ui-ink-strong)_24%)]";case"blocked":return"bg-[var(--ui-danger-soft)] text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)]";case"in_progress":case"active":return"bg-[var(--ui-accent-soft)] text-[var(--primary)]";case"focus":return"bg-[var(--ui-tertiary-soft)] text-[var(--tertiary)]";default:return"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]"}}function W(r){return r==="any"?s.jsx(j,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:"Any"}):r==="subtask"?s.jsx(D,{kind:"task",label:"Subtask",compact:!0,gradient:!1,className:"border-[color-mix(in_srgb,var(--tertiary)_28%,var(--ui-border-subtle)_72%)] bg-[var(--ui-tertiary-soft)] text-[var(--tertiary)]"}):s.jsx(D,{kind:r==="issue"?"issue":r,label:r,compact:!0,gradient:!1})}function be({query:r,onQueryChange:i,clauses:n,onClausesChange:d,resultSummary:g}){const[y,h]=x.useState(!1),[v,m]=x.useState(0),b=x.useMemo(()=>ge(r).filter(a=>!n.some(c=>c.id===a.id)),[n,r]),f=a=>{d([...n,a]),i(""),m(0),h(!1)},e=a=>{d(n.filter(c=>c.id!==a))};return s.jsx("div",{className:"grid gap-3",children:s.jsxs("div",{className:"rounded-[28px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4 shadow-[var(--ui-shadow-soft)] sm:p-5",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.2em] text-[var(--ui-ink-faint)]",children:"Hierarchy search"}),s.jsxs("div",{className:"mt-2 max-w-3xl text-sm leading-6 text-[var(--ui-ink-soft)]",children:["Build OR clauses like"," ",s.jsx("span",{className:"text-[var(--ui-ink-strong)]",children:'Goal + "MD"'})," ","or"," ",s.jsx("span",{className:"text-[var(--ui-ink-strong)]",children:'Any + "Happy"'}),". Matching ancestors keep their branches visible so you can explore the hierarchy, not lose it."]})]}),n.length>0||r.trim().length>0?s.jsx(C,{variant:"secondary",size:"sm",onClick:()=>{i(""),d([]),m(0),h(!1)},children:"Clear search"}):null]}),s.jsxs("div",{className:"mt-4 rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3",children:[n.length>0?s.jsx("div",{className:"mb-3 flex flex-wrap gap-2",children:n.map(a=>s.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-2.5 py-1.5",children:[W(a.kind),s.jsxs("span",{className:"max-w-[14rem] truncate text-sm text-[var(--ui-ink-medium)]",children:['"',a.query,'"']}),s.jsx("button",{type:"button",className:"rounded-full text-[var(--ui-ink-soft)] transition hover:text-[var(--ui-ink-strong)]",onClick:()=>e(a.id),"aria-label":`Remove ${a.kind} ${a.query}`,children:s.jsx(ee,{className:"size-3.5"})})]},a.id))}):null,s.jsxs("div",{className:"relative",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(se,{className:"size-4 text-[var(--ui-ink-muted)]"}),s.jsx("input",{value:r,onChange:a=>{i(a.target.value),h(!0),m(0)},onFocus:()=>h(!0),onBlur:()=>{window.setTimeout(()=>h(!1),120)},onKeyDown:a=>{if(a.key==="Backspace"&&!r&&n.length>0){e(n[n.length-1].id);return}if(a.key==="ArrowDown"){a.preventDefault(),h(!0),m(c=>b.length===0?0:Math.min(b.length-1,c+1));return}if(a.key==="ArrowUp"){a.preventDefault(),m(c=>Math.max(0,c-1));return}if(a.key==="Escape"){h(!1);return}a.key==="Enter"&&b[v]&&(a.preventDefault(),f(b[v]))},placeholder:'Type text, then pick a clause like Goal + "MD" or Any + "Happy"',className:"min-w-0 flex-1 bg-transparent text-sm text-[var(--ui-ink-strong)] placeholder:text-[var(--ui-ink-muted)] focus:outline-none"})]}),y?s.jsx("div",{className:"absolute top-full z-20 mt-2 w-full rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-popover)] p-2 shadow-[var(--ui-shadow-strong)] backdrop-blur-xl",children:b.length>0?b.map((a,c)=>s.jsx("button",{type:"button",className:F("flex w-full items-start justify-between gap-3 rounded-[18px] px-3 py-2.5 text-left transition",c===v?"bg-[var(--ui-surface-active)] text-[var(--ui-ink-strong)]":"text-[var(--ui-ink-medium)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]"),onMouseEnter:()=>m(c),onMouseDown:o=>o.preventDefault(),onClick:()=>f(a),children:s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[W(a.kind),s.jsxs("span",{className:"truncate text-sm font-medium text-[var(--ui-ink-strong)]",children:['"',a.query,'"']})]}),s.jsxs("div",{className:"mt-1 text-xs leading-5 text-[var(--ui-ink-soft)]",children:["Match ",a.kind==="any"?"any visible hierarchy node":`${a.kind} nodes`," that mention this text."]})]})},a.id)):s.jsx("div",{className:"px-3 py-2.5 text-sm text-[var(--ui-ink-muted)]",children:"Type a word or phrase to create a new OR clause."})}):null]})]}),s.jsx("div",{className:"mt-3 text-sm text-[var(--ui-ink-soft)]",children:g})]})})}function Te(){const r=ie(),i=x.useRef(null),[n,d]=x.useState(""),[g,y]=x.useState([]),[h,v]=x.useState([]),[m,b]=x.useState([...L]),[f,e]=x.useState(T),a=re({queryKey:["work-items-hierarchy",...r.selectedUserIds],queryFn:()=>de({userIds:r.selectedUserIds})}),c=x.useMemo(()=>{const t=r.snapshot.users.filter(u=>u.kind==="bot"),k=r.snapshot.users.filter(u=>u.kind==="human");return[{value:`${_.kind}bot`,label:"Bots",description:`${t.length} bot collaborators`,searchText:`bots bot ai agents assistants ${t.map(u=>`${u.displayName} ${u.handle}`).join(" ")}`,badge:s.jsx(j,{className:"border-[color-mix(in_srgb,var(--info)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_76%,var(--ui-ink-strong)_24%)]",children:"Bots"}),menuBadge:s.jsx(j,{className:"border-[color-mix(in_srgb,var(--info)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_76%,var(--ui-ink-strong)_24%)]",children:"Bots"})},{value:`${_.kind}human`,label:"Humans",description:`${k.length} human collaborators`,searchText:`humans human people operators ${k.map(u=>`${u.displayName} ${u.handle}`).join(" ")}`,badge:s.jsx(j,{className:"border-[color-mix(in_srgb,var(--warning)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_76%,var(--ui-ink-strong)_24%)]",children:"Humans"}),menuBadge:s.jsx(j,{className:"border-[color-mix(in_srgb,var(--warning)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_76%,var(--ui-ink-strong)_24%)]",children:"Humans"})},...r.snapshot.users.map(u=>({value:`${_.user}${u.id}`,label:u.displayName,description:`${u.kind}${u.handle?` · @${u.handle}`:""}`,searchText:`${u.displayName} ${u.handle} ${u.kind} ${u.description}`,badge:s.jsx(A,{user:u,compact:!0}),menuBadge:s.jsx(A,{user:u,compact:!0})}))]},[r.snapshot.users]),o=x.useMemo(()=>[{value:"goal",label:"Goal",searchText:"goal direction objective",kind:"goal"},{value:"strategy",label:"Strategy",searchText:"strategy plan sequencing",kind:"strategy"},{value:"project",label:"Project",searchText:"project initiative prd",kind:"project"},{value:"issue",label:"Issue",searchText:"issue vertical slice tracer bullet",kind:"issue"},{value:"task",label:"Task",searchText:"task execution ai session",kind:"task"},{value:"subtask",label:"Subtask",searchText:"subtask child step",badge:s.jsx(D,{kind:"task",label:"Subtask",compact:!0,gradient:!1,className:"border-[color-mix(in_srgb,var(--tertiary)_28%,var(--ui-border-subtle)_72%)] bg-[var(--ui-tertiary-soft)] text-[var(--tertiary)]"}),menuBadge:s.jsx(D,{kind:"task",label:"Subtask",compact:!0,gradient:!1,className:"border-[color-mix(in_srgb,var(--tertiary)_28%,var(--ui-border-subtle)_72%)] bg-[var(--ui-tertiary-soft)] text-[var(--tertiary)]"})}],[]),p=x.useMemo(()=>[{value:"active",label:"Active",searchText:"active in progress live"},{value:"paused",label:"Paused",searchText:"paused suspended"},{value:"completed",label:"Completed",searchText:"completed finished"},{value:"backlog",label:"Backlog",searchText:"backlog queued"},{value:"focus",label:"Focus",searchText:"focus ready"},{value:"in_progress",label:"In progress",searchText:"in progress active doing"},{value:"blocked",label:"Blocked",searchText:"blocked stuck"},{value:"done",label:"Done",searchText:"done complete finished"}].map(t=>({...t,badge:s.jsx(j,{className:O(t.value),children:t.label}),menuBadge:s.jsx(j,{className:O(t.value),children:t.label})})),[]),M=x.useMemo(()=>new Map(r.snapshot.tags.map(t=>[t.id,t.name])),[r.snapshot.tags]),$=x.useMemo(()=>a.data?V({...a.data,tagNameById:M}):V({goals:r.snapshot.goals,strategies:r.snapshot.strategies,projects:r.snapshot.dashboard.projects,tagNameById:M,workItems:r.snapshot.workItems&&r.snapshot.workItems.length>0?r.snapshot.workItems:r.snapshot.tasks}),[a.data,r.snapshot,M]),B=n.trim().length>0||g.length>0||h.length>0||m.length!==L.length||L.some(t=>!m.includes(t))||f.length!==T.length||T.some(t=>!f.includes(t)),w=x.useMemo(()=>ue(h),[h]),l=x.useMemo(()=>{const t=$.map(k=>G(k,{clauses:g,statusFilters:m,ownerUserIds:w.userIds,ownerKinds:w.kinds,selectedUserIds:r.selectedUserIds})).filter(k=>k!==null);return Q(t,f)},[$,w.kinds,w.userIds,g,m,r.selectedUserIds,f]),N=x.useMemo(()=>K(l),[l]),U=`${g.length>0?`${g.length} OR clause${g.length===1?"":"s"} active`:"Search across the full hierarchy"} · ${N} visible node${N===1?"":"s"}.`;return a.isLoading&&$.length===0?s.jsx(ne,{eyebrow:"Hierarchy",title:"Building Forge hierarchy",description:"Loading goals, strategies, projects, issues, tasks, and subtasks into the compact hierarchy view."}):a.isError&&$.length===0?s.jsx(le,{eyebrow:"Hierarchy",error:a.error,onRetry:()=>void a.refetch()}):s.jsxs("div",{className:"grid min-w-0 gap-5",children:[s.jsx(te,{}),s.jsx(ae,{title:"Hierarchy",description:"Explore the full Forge stack from goal to subtask in one compact operational tree, with both strategy layers visible and the same control surfaces as the board.",badge:`${N} visible nodes`}),s.jsxs(z,{className:"min-w-0 overflow-hidden border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)]",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3 border-b border-[var(--ui-border-subtle)] px-5 py-4",children:[s.jsxs("div",{children:[s.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Hierarchy controls"}),s.jsx("div",{className:"mt-2 max-w-3xl text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Filter across goals, projects, tags, humans, bots, and work-item types, then expand or collapse the full tree without losing the hierarchy context."})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx(C,{variant:"secondary",size:"sm",onClick:()=>{var t,k;return(k=(t=i.current)==null?void 0:t.openAll)==null?void 0:k.call(t)},children:"Expand all"}),s.jsx(C,{variant:"secondary",size:"sm",onClick:()=>{var t,k;return(k=(t=i.current)==null?void 0:t.closeAll)==null?void 0:k.call(t)},children:"Collapse all"}),B?s.jsx(C,{variant:"secondary",size:"sm",onClick:()=>{d(""),y([]),v([]),b([...L]),e(T)},children:"Reset"}):null]})]}),s.jsxs("div",{className:"grid gap-4 px-5 py-5",children:[s.jsx(be,{query:n,onQueryChange:d,clauses:g,onClausesChange:y,resultSummary:U}),s.jsxs("div",{className:"grid gap-3 xl:grid-cols-[minmax(0,1.15fr)_minmax(0,1fr)_minmax(0,1fr)]",children:[s.jsx(R,{options:p,selectedValues:m,onChange:t=>b(t),placeholder:"Visible states",emptyMessage:"No states available.",variant:"action-bar"}),s.jsx(R,{options:o,selectedValues:f,onChange:t=>e(t),placeholder:"Visible levels",emptyMessage:"No hierarchy levels.",className:"min-w-0",variant:"action-bar"}),s.jsx(R,{options:c,selectedValues:h,onChange:v,placeholder:"Filter by human, bot, or collaborator",emptyMessage:"No matching collaborators."})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(j,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:[l.length," top-level nodes"]}),s.jsxs(j,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:[N," visible nodes"]}),s.jsx(j,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:f.join(" + ")})]})]})]}),l.length===0?s.jsx(oe,{eyebrow:"Hierarchy",title:"No hierarchy nodes match the current filters",description:"Clear some filters or broaden the search to bring the full planning ladder back into view.",action:s.jsx(C,{variant:"secondary",onClick:()=>{d(""),y([]),v([]),b([...L]),e(T)},children:"Reset hierarchy filters"})}):s.jsxs(z,{className:"min-w-0 overflow-hidden border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-0",children:[s.jsxs("div",{className:"grid grid-cols-[minmax(0,1.8fr)_auto_auto_auto] gap-3 border-b border-[var(--ui-border-subtle)] px-5 py-3 text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:[s.jsx("div",{children:"Name"}),s.jsx("div",{className:"hidden lg:block",children:"State"}),s.jsx("div",{className:"hidden xl:block",children:"People"}),s.jsx("div",{className:"hidden lg:block",children:"Progress"})]}),s.jsx("div",{className:"p-2",children:s.jsx(X,{ref:i,data:l,width:"100%",height:760,rowHeight:64,overscanCount:10,childrenAccessor:t=>t.children??null,openByDefault:!0,paddingTop:8,paddingBottom:8,disableDrag:!0,className:"text-sm",children:({node:t,style:k})=>{const u=t.data.kind==="subtask"?"task":t.data.kind,E=ce(u),H=E.colorToken.rgb.join(", ");return s.jsx("div",{style:k,className:"px-2 py-1.5",children:s.jsxs("div",{className:F("grid min-w-0 items-center gap-3 rounded-[16px] border border-[var(--ui-border-subtle)] px-3 py-2 transition hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)]","grid-cols-[minmax(0,1.8fr)_auto] lg:grid-cols-[minmax(0,1.8fr)_auto_auto] xl:grid-cols-[minmax(0,1.8fr)_auto_auto_auto]"),style:{marginLeft:`${t.level*14}px`,background:`color-mix(in srgb, rgb(${H}) 7%, var(--ui-surface-1))`},children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[s.jsx("button",{type:"button",className:"inline-flex size-7 shrink-0 items-center justify-center rounded-full bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",onClick:()=>t.toggle(),disabled:t.isLeaf,"aria-label":t.isOpen?`Collapse ${t.data.label}`:`Expand ${t.data.label}`,children:t.isLeaf?s.jsx("span",{className:"size-2 rounded-full bg-[var(--ui-ink-muted)]"}):t.isOpen?s.jsx(Y,{className:"size-4"}):s.jsx(J,{className:"size-4"})}),s.jsx("span",{className:F("inline-flex size-9 shrink-0 items-center justify-center rounded-[12px] border",E.subtleBadgeClassName),children:s.jsx(E.icon,{className:F("size-4",E.iconClassName)})}),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(j,{className:xe(t.data.kind),children:t.data.kind}),t.data.executionMode?s.jsx(j,{className:t.data.executionMode==="afk"?"bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_76%,var(--ui-ink-strong)_24%)]":"bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_76%,var(--ui-ink-strong)_24%)]",children:t.data.executionMode.toUpperCase()}):null,s.jsx("div",{className:"truncate text-[13px] font-medium text-[var(--ui-ink-strong)]",children:t.data.label})]}),s.jsx("div",{className:"mt-0.5 truncate text-[11px] leading-5 text-[var(--ui-ink-soft)]",children:t.data.description})]})]}),s.jsx("div",{className:"hidden lg:flex justify-end",children:s.jsx(j,{className:O(t.data.statusLabel),children:t.data.statusLabel?t.data.statusLabel.replaceAll("_"," "):"linked"})}),s.jsxs("div",{className:"hidden xl:flex items-center justify-end gap-2",children:[t.data.user?s.jsx(A,{user:t.data.user,compact:!0}):null,t.data.assignees.length>0?s.jsxs(j,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:["+",t.data.assignees.length]}):null]}),s.jsxs("div",{className:"hidden lg:flex min-w-[11rem] items-center justify-end gap-3",children:[s.jsxs("div",{className:"min-w-[7.5rem]",children:[s.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-[var(--ui-surface-2)]",children:s.jsx("div",{className:"h-full rounded-full",style:{width:`${t.data.progressPercent??0}%`,background:`linear-gradient(90deg, rgb(${H}), color-mix(in srgb, rgb(${H}) 72%, var(--ui-surface-1)))`}})}),s.jsx("div",{className:"mt-1 text-[11px] text-[var(--ui-ink-faint)]",children:t.data.progressLabel??`${t.data.progressPercent??0}% complete`})]}),t.data.href?s.jsx(Z,{to:t.data.href,className:"rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-1.5 text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-medium)] transition hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",children:"Open"}):s.jsx("span",{className:"w-[3.75rem]"})]})]})})}})})]})]})}export{Te as ProjectManagementHierarchyPage};
|
|
1
|
+
import{r as x,j as s,cu as X,cs as Y,cv as J,aC as Z,aK as ee,b7 as se}from"./vendor-Cpmju3nw.js";import{i as re}from"./state-BtwEvpO6.js";import{E as R}from"./entity-link-multiselect-wuyJ8BbW.js";import{P as te}from"./project-management-section-nav-9OV6_ifH.js";import{P as ae}from"./page-hero-DlHEJ0Yt.js";import{d as ie,k as j,b as D,L as ne,e as le,C as z,B as C,h as oe,a as ce,c as F,bj as de}from"./index-BejvcRGb.js";import{U as A}from"./user-badge-BKzwGZDd.js";import"./use-anchored-overlay-position-BrQ4cqKn.js";import"./motion-DwjmC9aq.js";import"./ui-B9O-eUim.js";import"./board-CLOHbg6t.js";import"./forms-C5d5hTf2.js";const _={user:"user:",kind:"kind:"},q=["goal","strategy","project","issue","task","subtask"],T=[...q],L=["active","paused","completed","backlog","focus","in_progress","blocked","done"];function I(r){return r.trim().toLowerCase()}function ue(r){return r.reduce((i,n)=>{if(n.startsWith(_.user))i.userIds.push(n.slice(_.user.length));else if(n.startsWith(_.kind)){const d=n.slice(_.kind.length);(d==="human"||d==="bot")&&i.kinds.push(d)}return i},{userIds:[],kinds:[]})}function he(r,i){return`${i}:${I(r)}`}function ge(r){const i=r.trim();return i.length===0?[]:["any",...q].map(n=>({id:he(i,n),query:i,kind:n}))}function me(r){switch(r){case"done":case"completed":return 1;case"in_progress":case"active":return .66;case"focus":return .45;case"blocked":return .5;case"paused":return .28;default:return .08}}function P(r,i){const n=r.replace(/\s+/g," ").trim();return n.length===0?i:n}function S(r){const i=(r.children??[]).map(S);if(r.kind==="project")return{...r,children:i,progressPercent:r.progressPercent,progressLabel:r.progressLabel??(typeof r.progressPercent=="number"?`${r.progressPercent}% complete`:null)};if(i.length>0){const d=i.map(g=>g.progressPercent).filter(g=>typeof g=="number");if(d.length>0){const g=Math.round(d.reduce((y,h)=>y+h,0)/d.length);return{...r,children:i,progressPercent:g,progressLabel:`${i.length} child item${i.length===1?"":"s"}`}}}const n=Math.round(me(r.statusLabel)*100);return{...r,children:i,progressPercent:n,progressLabel:r.statusLabel?r.statusLabel.replaceAll("_"," "):null}}function V(r){const{goals:i,strategies:n,projects:d,workItems:g,tagNameById:y}=r,h=new Map,v=new Map,m=new Map;for(const e of g)if(e.parentWorkItemId){const a=h.get(e.parentWorkItemId)??[];a.push(e),h.set(e.parentWorkItemId,a)}else if(e.level==="issue"&&e.projectId){const a=v.get(e.projectId)??[];a.push(e),v.set(e.projectId,a)}else if(e.projectId){const a=m.get(e.projectId)??[];a.push(e),m.set(e.projectId,a)}const b=e=>{var a;return S({id:`${e.level}:${e.id}`,entityId:e.id,kind:e.level,label:e.title,description:P(e.description,e.level==="issue"?"Vertical slice issue":e.level==="subtask"?"Granular child step":"Focused AI session task"),searchText:I([e.title,e.description,e.aiInstructions,e.executionMode??"",e.status,((a=e.user)==null?void 0:a.displayName)??"",...(e.assignees??[]).map(c=>c.displayName),...e.tagIds.map(c=>y.get(c)??"")].join(" ")),href:`/tasks/${e.id}`,statusLabel:e.status,executionMode:e.executionMode,goalId:e.goalId,projectId:e.projectId,tagIds:e.tagIds,user:e.user,assignees:e.assignees??[],linkedUserIds:[...e.user?[e.user.id]:[],...e.assigneeUserIds??[]],progressPercent:null,progressLabel:null,children:(h.get(e.id)??[]).map(b)})},f=e=>{var c;const a=n.filter(o=>o.targetProjectIds.includes(e.id));return S({id:`project:${e.id}`,entityId:e.id,kind:"project",label:e.title,description:P(e.description||e.productRequirementsDocument,"PRD-backed initiative"),searchText:I([e.title,e.description,e.productRequirementsDocument,e.goalTitle,e.workflowStatus,e.status,((c=e.user)==null?void 0:c.displayName)??"",...(e.assignees??[]).map(o=>o.displayName)].join(" ")),href:`/projects/${e.id}`,statusLabel:e.workflowStatus,executionMode:null,goalId:e.goalId,projectId:e.id,tagIds:[],user:e.user,assignees:e.assignees??[],linkedUserIds:[...e.user?[e.user.id]:[],...e.assigneeUserIds??[]],progressPercent:e.progress,progressLabel:`${e.completedTaskCount}/${e.totalTasks} done`,children:[...a.map(o=>{var p;return S({id:`strategy:${o.id}`,entityId:o.id,kind:"strategy",label:o.title,description:P(o.overview||o.endStateDescription,"Execution strategy"),searchText:I([o.title,o.overview,o.endStateDescription,o.status,((p=o.user)==null?void 0:p.displayName)??""].join(" ")),href:`/strategies/${o.id}`,statusLabel:o.status,executionMode:null,goalId:e.goalId,projectId:e.id,tagIds:[],user:o.user,assignees:[],linkedUserIds:o.user?[o.user.id]:[],progressPercent:null,progressLabel:null,children:[]})}),...(v.get(e.id)??[]).map(b),...(m.get(e.id)??[]).map(b)]})};return i.map(e=>{var B,w;const a=d.filter(l=>l.goalId===e.id),c=n.filter(l=>l.targetGoalIds.includes(e.id)),o=new Map(c.map(l=>[l.id,[]])),p=new Set;for(const l of a){const N=c.find(U=>U.targetProjectIds.includes(l.id));N&&((B=o.get(N.id))==null||B.push(l),p.add(l.id))}const M=c.map(l=>{var N;return S({id:`strategy:${l.id}`,entityId:l.id,kind:"strategy",label:l.title,description:P(l.overview||l.endStateDescription,"High-level strategy"),searchText:I([l.title,l.overview,l.endStateDescription,l.status,((N=l.user)==null?void 0:N.displayName)??""].join(" ")),href:`/strategies/${l.id}`,statusLabel:l.status,executionMode:null,goalId:e.id,projectId:null,tagIds:[],user:l.user,assignees:[],linkedUserIds:l.user?[l.user.id]:[],progressPercent:null,progressLabel:null,children:(o.get(l.id)??[]).map(f)})}),$=a.filter(l=>!p.has(l.id)).map(f);return S({id:`goal:${e.id}`,entityId:e.id,kind:"goal",label:e.title,description:P(e.description,"Strategic goal"),searchText:I([e.title,e.description,e.status,((w=e.user)==null?void 0:w.displayName)??""].join(" ")),href:`/goals/${e.id}`,statusLabel:e.status,executionMode:null,goalId:e.id,projectId:null,tagIds:e.tagIds,user:e.user,assignees:[],linkedUserIds:e.user?[e.user.id]:[],progressPercent:null,progressLabel:null,children:[...M,...$]})})}function K(r){return r.reduce((i,n)=>i+1+K(n.children??[]),0)}function pe(r,i){return r.searchText.includes(I(i.query))&&(i.kind==="any"||i.kind===r.kind)}function G(r,i,n=!1){const{clauses:d,statusFilters:g,ownerUserIds:y,ownerKinds:h,selectedUserIds:v}=i,m=d.length===0||d.some(p=>pe(r,p)),b=g.length===0||r.statusLabel!==null&&g.includes(r.statusLabel),f=y.length===0&&v.length===0?!0:[...y,...v].some(p=>r.linkedUserIds.includes(p)),e=h.length===0||[r.user,...r.assignees].some(p=>p&&h.includes(p.kind)),a=b&&f&&e,c=d.length===0||n||m,o=(r.children??[]).map(p=>G(p,i,n||a&&m)).filter(p=>p!==null);return a&&c||o.length>0?{...r,children:o}:null}function Q(r,i){return r.flatMap(n=>{const d=Q(n.children??[],i);return i.includes(n.kind)?[{...n,children:d}]:d})}function xe(r){switch(r){case"goal":return"bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_76%,var(--ui-ink-strong)_24%)]";case"strategy":return"bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_76%,var(--ui-ink-strong)_24%)]";case"project":return"bg-[var(--ui-accent-soft)] text-[var(--primary)]";case"issue":return"bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_72%,var(--ui-ink-strong)_28%)]";case"subtask":return"border-[color-mix(in_srgb,var(--tertiary)_28%,var(--ui-border-subtle)_72%)] bg-[var(--ui-tertiary-soft)] text-[var(--tertiary)]";default:return"bg-[var(--ui-tertiary-soft)] text-[var(--tertiary)]"}}function O(r){switch(r){case"done":case"completed":return"bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_76%,var(--ui-ink-strong)_24%)]";case"blocked":return"bg-[var(--ui-danger-soft)] text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)]";case"in_progress":case"active":return"bg-[var(--ui-accent-soft)] text-[var(--primary)]";case"focus":return"bg-[var(--ui-tertiary-soft)] text-[var(--tertiary)]";default:return"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]"}}function W(r){return r==="any"?s.jsx(j,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:"Any"}):r==="subtask"?s.jsx(D,{kind:"task",label:"Subtask",compact:!0,gradient:!1,className:"border-[color-mix(in_srgb,var(--tertiary)_28%,var(--ui-border-subtle)_72%)] bg-[var(--ui-tertiary-soft)] text-[var(--tertiary)]"}):s.jsx(D,{kind:r==="issue"?"issue":r,label:r,compact:!0,gradient:!1})}function be({query:r,onQueryChange:i,clauses:n,onClausesChange:d,resultSummary:g}){const[y,h]=x.useState(!1),[v,m]=x.useState(0),b=x.useMemo(()=>ge(r).filter(a=>!n.some(c=>c.id===a.id)),[n,r]),f=a=>{d([...n,a]),i(""),m(0),h(!1)},e=a=>{d(n.filter(c=>c.id!==a))};return s.jsx("div",{className:"grid gap-3",children:s.jsxs("div",{className:"rounded-[28px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4 shadow-[var(--ui-shadow-soft)] sm:p-5",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.2em] text-[var(--ui-ink-faint)]",children:"Hierarchy search"}),s.jsxs("div",{className:"mt-2 max-w-3xl text-sm leading-6 text-[var(--ui-ink-soft)]",children:["Build OR clauses like"," ",s.jsx("span",{className:"text-[var(--ui-ink-strong)]",children:'Goal + "MD"'})," ","or"," ",s.jsx("span",{className:"text-[var(--ui-ink-strong)]",children:'Any + "Happy"'}),". Matching ancestors keep their branches visible so you can explore the hierarchy, not lose it."]})]}),n.length>0||r.trim().length>0?s.jsx(C,{variant:"secondary",size:"sm",onClick:()=>{i(""),d([]),m(0),h(!1)},children:"Clear search"}):null]}),s.jsxs("div",{className:"mt-4 rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3",children:[n.length>0?s.jsx("div",{className:"mb-3 flex flex-wrap gap-2",children:n.map(a=>s.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-2.5 py-1.5",children:[W(a.kind),s.jsxs("span",{className:"max-w-[14rem] truncate text-sm text-[var(--ui-ink-medium)]",children:['"',a.query,'"']}),s.jsx("button",{type:"button",className:"rounded-full text-[var(--ui-ink-soft)] transition hover:text-[var(--ui-ink-strong)]",onClick:()=>e(a.id),"aria-label":`Remove ${a.kind} ${a.query}`,children:s.jsx(ee,{className:"size-3.5"})})]},a.id))}):null,s.jsxs("div",{className:"relative",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(se,{className:"size-4 text-[var(--ui-ink-muted)]"}),s.jsx("input",{value:r,onChange:a=>{i(a.target.value),h(!0),m(0)},onFocus:()=>h(!0),onBlur:()=>{window.setTimeout(()=>h(!1),120)},onKeyDown:a=>{if(a.key==="Backspace"&&!r&&n.length>0){e(n[n.length-1].id);return}if(a.key==="ArrowDown"){a.preventDefault(),h(!0),m(c=>b.length===0?0:Math.min(b.length-1,c+1));return}if(a.key==="ArrowUp"){a.preventDefault(),m(c=>Math.max(0,c-1));return}if(a.key==="Escape"){h(!1);return}a.key==="Enter"&&b[v]&&(a.preventDefault(),f(b[v]))},placeholder:'Type text, then pick a clause like Goal + "MD" or Any + "Happy"',className:"min-w-0 flex-1 bg-transparent text-sm text-[var(--ui-ink-strong)] placeholder:text-[var(--ui-ink-muted)] focus:outline-none"})]}),y?s.jsx("div",{className:"absolute top-full z-20 mt-2 w-full rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-popover)] p-2 shadow-[var(--ui-shadow-strong)] backdrop-blur-xl",children:b.length>0?b.map((a,c)=>s.jsx("button",{type:"button",className:F("flex w-full items-start justify-between gap-3 rounded-[18px] px-3 py-2.5 text-left transition",c===v?"bg-[var(--ui-surface-active)] text-[var(--ui-ink-strong)]":"text-[var(--ui-ink-medium)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]"),onMouseEnter:()=>m(c),onMouseDown:o=>o.preventDefault(),onClick:()=>f(a),children:s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[W(a.kind),s.jsxs("span",{className:"truncate text-sm font-medium text-[var(--ui-ink-strong)]",children:['"',a.query,'"']})]}),s.jsxs("div",{className:"mt-1 text-xs leading-5 text-[var(--ui-ink-soft)]",children:["Match ",a.kind==="any"?"any visible hierarchy node":`${a.kind} nodes`," that mention this text."]})]})},a.id)):s.jsx("div",{className:"px-3 py-2.5 text-sm text-[var(--ui-ink-muted)]",children:"Type a word or phrase to create a new OR clause."})}):null]})]}),s.jsx("div",{className:"mt-3 text-sm text-[var(--ui-ink-soft)]",children:g})]})})}function Te(){const r=ie(),i=x.useRef(null),[n,d]=x.useState(""),[g,y]=x.useState([]),[h,v]=x.useState([]),[m,b]=x.useState([...L]),[f,e]=x.useState(T),a=re({queryKey:["work-items-hierarchy",...r.selectedUserIds],queryFn:()=>de({userIds:r.selectedUserIds})}),c=x.useMemo(()=>{const t=r.snapshot.users.filter(u=>u.kind==="bot"),k=r.snapshot.users.filter(u=>u.kind==="human");return[{value:`${_.kind}bot`,label:"Bots",description:`${t.length} bot collaborators`,searchText:`bots bot ai agents assistants ${t.map(u=>`${u.displayName} ${u.handle}`).join(" ")}`,badge:s.jsx(j,{className:"border-[color-mix(in_srgb,var(--info)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_76%,var(--ui-ink-strong)_24%)]",children:"Bots"}),menuBadge:s.jsx(j,{className:"border-[color-mix(in_srgb,var(--info)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_76%,var(--ui-ink-strong)_24%)]",children:"Bots"})},{value:`${_.kind}human`,label:"Humans",description:`${k.length} human collaborators`,searchText:`humans human people operators ${k.map(u=>`${u.displayName} ${u.handle}`).join(" ")}`,badge:s.jsx(j,{className:"border-[color-mix(in_srgb,var(--warning)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_76%,var(--ui-ink-strong)_24%)]",children:"Humans"}),menuBadge:s.jsx(j,{className:"border-[color-mix(in_srgb,var(--warning)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_76%,var(--ui-ink-strong)_24%)]",children:"Humans"})},...r.snapshot.users.map(u=>({value:`${_.user}${u.id}`,label:u.displayName,description:`${u.kind}${u.handle?` · @${u.handle}`:""}`,searchText:`${u.displayName} ${u.handle} ${u.kind} ${u.description}`,badge:s.jsx(A,{user:u,compact:!0}),menuBadge:s.jsx(A,{user:u,compact:!0})}))]},[r.snapshot.users]),o=x.useMemo(()=>[{value:"goal",label:"Goal",searchText:"goal direction objective",kind:"goal"},{value:"strategy",label:"Strategy",searchText:"strategy plan sequencing",kind:"strategy"},{value:"project",label:"Project",searchText:"project initiative prd",kind:"project"},{value:"issue",label:"Issue",searchText:"issue vertical slice tracer bullet",kind:"issue"},{value:"task",label:"Task",searchText:"task execution ai session",kind:"task"},{value:"subtask",label:"Subtask",searchText:"subtask child step",badge:s.jsx(D,{kind:"task",label:"Subtask",compact:!0,gradient:!1,className:"border-[color-mix(in_srgb,var(--tertiary)_28%,var(--ui-border-subtle)_72%)] bg-[var(--ui-tertiary-soft)] text-[var(--tertiary)]"}),menuBadge:s.jsx(D,{kind:"task",label:"Subtask",compact:!0,gradient:!1,className:"border-[color-mix(in_srgb,var(--tertiary)_28%,var(--ui-border-subtle)_72%)] bg-[var(--ui-tertiary-soft)] text-[var(--tertiary)]"})}],[]),p=x.useMemo(()=>[{value:"active",label:"Active",searchText:"active in progress live"},{value:"paused",label:"Paused",searchText:"paused suspended"},{value:"completed",label:"Completed",searchText:"completed finished"},{value:"backlog",label:"Backlog",searchText:"backlog queued"},{value:"focus",label:"Focus",searchText:"focus ready"},{value:"in_progress",label:"In progress",searchText:"in progress active doing"},{value:"blocked",label:"Blocked",searchText:"blocked stuck"},{value:"done",label:"Done",searchText:"done complete finished"}].map(t=>({...t,badge:s.jsx(j,{className:O(t.value),children:t.label}),menuBadge:s.jsx(j,{className:O(t.value),children:t.label})})),[]),M=x.useMemo(()=>new Map(r.snapshot.tags.map(t=>[t.id,t.name])),[r.snapshot.tags]),$=x.useMemo(()=>a.data?V({...a.data,tagNameById:M}):V({goals:r.snapshot.goals,strategies:r.snapshot.strategies,projects:r.snapshot.dashboard.projects,tagNameById:M,workItems:r.snapshot.workItems&&r.snapshot.workItems.length>0?r.snapshot.workItems:r.snapshot.tasks}),[a.data,r.snapshot,M]),B=n.trim().length>0||g.length>0||h.length>0||m.length!==L.length||L.some(t=>!m.includes(t))||f.length!==T.length||T.some(t=>!f.includes(t)),w=x.useMemo(()=>ue(h),[h]),l=x.useMemo(()=>{const t=$.map(k=>G(k,{clauses:g,statusFilters:m,ownerUserIds:w.userIds,ownerKinds:w.kinds,selectedUserIds:r.selectedUserIds})).filter(k=>k!==null);return Q(t,f)},[$,w.kinds,w.userIds,g,m,r.selectedUserIds,f]),N=x.useMemo(()=>K(l),[l]),U=`${g.length>0?`${g.length} OR clause${g.length===1?"":"s"} active`:"Search across the full hierarchy"} · ${N} visible node${N===1?"":"s"}.`;return a.isLoading&&$.length===0?s.jsx(ne,{eyebrow:"Hierarchy",title:"Building Forge hierarchy",description:"Loading goals, strategies, projects, issues, tasks, and subtasks into the compact hierarchy view."}):a.isError&&$.length===0?s.jsx(le,{eyebrow:"Hierarchy",error:a.error,onRetry:()=>void a.refetch()}):s.jsxs("div",{className:"grid min-w-0 gap-5",children:[s.jsx(te,{}),s.jsx(ae,{title:"Hierarchy",description:"Explore the full Forge stack from goal to subtask in one compact operational tree, with both strategy layers visible and the same control surfaces as the board.",badge:`${N} visible nodes`}),s.jsxs(z,{className:"min-w-0 overflow-hidden border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)]",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3 border-b border-[var(--ui-border-subtle)] px-5 py-4",children:[s.jsxs("div",{children:[s.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Hierarchy controls"}),s.jsx("div",{className:"mt-2 max-w-3xl text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Filter across goals, projects, tags, humans, bots, and work-item types, then expand or collapse the full tree without losing the hierarchy context."})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx(C,{variant:"secondary",size:"sm",onClick:()=>{var t,k;return(k=(t=i.current)==null?void 0:t.openAll)==null?void 0:k.call(t)},children:"Expand all"}),s.jsx(C,{variant:"secondary",size:"sm",onClick:()=>{var t,k;return(k=(t=i.current)==null?void 0:t.closeAll)==null?void 0:k.call(t)},children:"Collapse all"}),B?s.jsx(C,{variant:"secondary",size:"sm",onClick:()=>{d(""),y([]),v([]),b([...L]),e(T)},children:"Reset"}):null]})]}),s.jsxs("div",{className:"grid gap-4 px-5 py-5",children:[s.jsx(be,{query:n,onQueryChange:d,clauses:g,onClausesChange:y,resultSummary:U}),s.jsxs("div",{className:"grid gap-3 xl:grid-cols-[minmax(0,1.15fr)_minmax(0,1fr)_minmax(0,1fr)]",children:[s.jsx(R,{options:p,selectedValues:m,onChange:t=>b(t),placeholder:"Visible states",emptyMessage:"No states available.",variant:"action-bar"}),s.jsx(R,{options:o,selectedValues:f,onChange:t=>e(t),placeholder:"Visible levels",emptyMessage:"No hierarchy levels.",className:"min-w-0",variant:"action-bar"}),s.jsx(R,{options:c,selectedValues:h,onChange:v,placeholder:"Filter by human, bot, or collaborator",emptyMessage:"No matching collaborators."})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(j,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:[l.length," top-level nodes"]}),s.jsxs(j,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:[N," visible nodes"]}),s.jsx(j,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:f.join(" + ")})]})]})]}),l.length===0?s.jsx(oe,{eyebrow:"Hierarchy",title:"No hierarchy nodes match the current filters",description:"Clear some filters or broaden the search to bring the full planning ladder back into view.",action:s.jsx(C,{variant:"secondary",onClick:()=>{d(""),y([]),v([]),b([...L]),e(T)},children:"Reset hierarchy filters"})}):s.jsxs(z,{className:"min-w-0 overflow-hidden border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-0",children:[s.jsxs("div",{className:"grid grid-cols-[minmax(0,1.8fr)_auto_auto_auto] gap-3 border-b border-[var(--ui-border-subtle)] px-5 py-3 text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:[s.jsx("div",{children:"Name"}),s.jsx("div",{className:"hidden lg:block",children:"State"}),s.jsx("div",{className:"hidden xl:block",children:"People"}),s.jsx("div",{className:"hidden lg:block",children:"Progress"})]}),s.jsx("div",{className:"p-2",children:s.jsx(X,{ref:i,data:l,width:"100%",height:760,rowHeight:64,overscanCount:10,childrenAccessor:t=>t.children??null,openByDefault:!0,paddingTop:8,paddingBottom:8,disableDrag:!0,className:"text-sm",children:({node:t,style:k})=>{const u=t.data.kind==="subtask"?"task":t.data.kind,E=ce(u),H=E.colorToken.rgb.join(", ");return s.jsx("div",{style:k,className:"px-2 py-1.5",children:s.jsxs("div",{className:F("grid min-w-0 items-center gap-3 rounded-[16px] border border-[var(--ui-border-subtle)] px-3 py-2 transition hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)]","grid-cols-[minmax(0,1.8fr)_auto] lg:grid-cols-[minmax(0,1.8fr)_auto_auto] xl:grid-cols-[minmax(0,1.8fr)_auto_auto_auto]"),style:{marginLeft:`${t.level*14}px`,background:`color-mix(in srgb, rgb(${H}) 7%, var(--ui-surface-1))`},children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[s.jsx("button",{type:"button",className:"inline-flex size-7 shrink-0 items-center justify-center rounded-full bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",onClick:()=>t.toggle(),disabled:t.isLeaf,"aria-label":t.isOpen?`Collapse ${t.data.label}`:`Expand ${t.data.label}`,children:t.isLeaf?s.jsx("span",{className:"size-2 rounded-full bg-[var(--ui-ink-muted)]"}):t.isOpen?s.jsx(Y,{className:"size-4"}):s.jsx(J,{className:"size-4"})}),s.jsx("span",{className:F("inline-flex size-9 shrink-0 items-center justify-center rounded-[12px] border",E.subtleBadgeClassName),children:s.jsx(E.icon,{className:F("size-4",E.iconClassName)})}),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(j,{className:xe(t.data.kind),children:t.data.kind}),t.data.executionMode?s.jsx(j,{className:t.data.executionMode==="afk"?"bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_76%,var(--ui-ink-strong)_24%)]":"bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_76%,var(--ui-ink-strong)_24%)]",children:t.data.executionMode.toUpperCase()}):null,s.jsx("div",{className:"truncate text-[13px] font-medium text-[var(--ui-ink-strong)]",children:t.data.label})]}),s.jsx("div",{className:"mt-0.5 truncate text-[11px] leading-5 text-[var(--ui-ink-soft)]",children:t.data.description})]})]}),s.jsx("div",{className:"hidden lg:flex justify-end",children:s.jsx(j,{className:O(t.data.statusLabel),children:t.data.statusLabel?t.data.statusLabel.replaceAll("_"," "):"linked"})}),s.jsxs("div",{className:"hidden xl:flex items-center justify-end gap-2",children:[t.data.user?s.jsx(A,{user:t.data.user,compact:!0}):null,t.data.assignees.length>0?s.jsxs(j,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:["+",t.data.assignees.length]}):null]}),s.jsxs("div",{className:"hidden lg:flex min-w-[11rem] items-center justify-end gap-3",children:[s.jsxs("div",{className:"min-w-[7.5rem]",children:[s.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-[var(--ui-surface-2)]",children:s.jsx("div",{className:"h-full rounded-full",style:{width:`${t.data.progressPercent??0}%`,background:`linear-gradient(90deg, rgb(${H}), color-mix(in srgb, rgb(${H}) 72%, var(--ui-surface-1)))`}})}),s.jsx("div",{className:"mt-1 text-[11px] text-[var(--ui-ink-faint)]",children:t.data.progressLabel??`${t.data.progressPercent??0}% complete`})]}),t.data.href?s.jsx(Z,{to:t.data.href,className:"rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-1.5 text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-medium)] transition hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",children:"Open"}):s.jsx("span",{className:"w-[3.75rem]"})]})]})})}})})]})]})}export{Te as ProjectManagementHierarchyPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aJ as v,r as l,cw as b,cx as f,aU as p,j as e,bl as m,F as h,aK as g}from"./vendor-Cpmju3nw.js";import{C as j,c}from"./index-
|
|
1
|
+
import{aJ as v,r as l,cw as b,cx as f,aU as p,j as e,bl as m,F as h,aK as g}from"./vendor-Cpmju3nw.js";import{C as j,c}from"./index-BejvcRGb.js";const i=[{to:"/projects",label:"Projects",icon:b},{to:"/kanban",label:"Board",icon:f},{to:"/projects/hierarchy",label:"Hierarchy",icon:p}];function d(t,s){return s==="/projects"?t==="/projects"||/^\/projects\/[^/]+$/.test(t):t===s||t.startsWith(`${s}/`)}function y({className:t}){const s=v(),[o,n]=l.useState(!1),u=l.useMemo(()=>[...i].sort((r,a)=>a.to.length-r.to.length).find(r=>d(s.pathname,r.to))??i[0],[s.pathname]);return l.useEffect(()=>{if(!o)return;const r=document.body.style.overflow,a=x=>{x.key==="Escape"&&n(!1)};return document.body.style.overflow="hidden",window.addEventListener("keydown",a),()=>{document.body.style.overflow=r,window.removeEventListener("keydown",a)}},[o]),e.jsxs(e.Fragment,{children:[e.jsxs(j,{className:c("overflow-hidden bg-[var(--card-gradient)] p-2",t),children:[e.jsx("div",{className:"hidden items-center gap-3 lg:flex",children:e.jsx("div",{className:"flex flex-wrap gap-2",children:i.map(r=>e.jsxs(m,{to:r.to,end:r.to==="/projects",className:({isActive:a})=>c("inline-flex items-center gap-2 whitespace-nowrap rounded-full px-3 py-1.5 text-[11px] font-semibold uppercase tracking-[0.14em] transition",a||d(s.pathname,r.to)?"border border-[color-mix(in_srgb,var(--info)_28%,var(--ui-border-subtle)_72%)] bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_76%,var(--ui-ink-strong)_24%)]":"border 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)]"),children:[e.jsx(r.icon,{className:"size-3.5"}),e.jsx("span",{children:r.label})]},r.to))})}),e.jsx("div",{className:"flex items-center justify-between gap-3 lg:hidden",children:e.jsx("button",{type:"button",className:"inline-flex min-w-0 flex-1 items-center gap-3 rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3.5 py-2.5 text-left shadow-[var(--ui-shadow-soft)] transition hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)]",onClick:()=>n(!0),children:e.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-2xl border border-[color-mix(in_srgb,var(--info)_24%,var(--ui-border-subtle)_76%)] bg-[var(--ui-info-soft)]",children:e.jsx(u.icon,{className:"size-4 text-[color-mix(in_srgb,var(--info)_76%,var(--ui-ink-strong)_24%)]"})}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block text-[10px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:"Project management"}),e.jsx("span",{className:"mt-0.5 block truncate text-sm font-medium text-[var(--ui-ink-strong)]",children:u.label})]})]})})})]}),o&&typeof document<"u"?h.createPortal(e.jsxs("div",{className:"lg:hidden",children:[e.jsx("div",{className:"surface-overlay fixed inset-0 z-50 backdrop-blur-xl"}),e.jsx("button",{type:"button","aria-label":"Close project management sections",className:"fixed inset-0 z-[51]",onClick:()=>n(!1)}),e.jsx("div",{className:"pointer-events-none fixed inset-0 z-[52] flex items-end justify-center px-3 pt-3 sm:px-4 sm:pt-4",style:{paddingBottom:"calc(var(--forge-mobile-nav-clearance) - 0.25rem)"},children:e.jsxs("div",{className:"surface-modal-panel pointer-events-auto flex max-h-[min(34rem,calc(100dvh-var(--forge-mobile-nav-clearance)-1rem))] w-full max-w-xl min-h-0 flex-col overflow-hidden rounded-[30px] border shadow-[var(--ui-shadow-strong)]",children:[e.jsx("div",{className:"shrink-0 border-b border-[var(--ui-border-subtle)] px-4 pb-2.5 pt-3 sm:px-5",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-label text-[10px] uppercase tracking-[0.22em] text-[var(--ui-ink-muted)]",children:"Forge PM"}),e.jsx("div",{className:"mt-1.5 flex min-w-0 flex-wrap items-center gap-2",children:e.jsx("div",{className:"truncate text-[1.05rem] font-semibold text-[var(--ui-ink-strong)]",children:"Browse the hierarchy"})})]}),e.jsx("button",{type:"button","aria-label":"Close project management sections",className:"inline-flex size-10 shrink-0 items-center justify-center rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-soft)] transition hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",onClick:()=>n(!1),children:e.jsx(g,{className:"size-4"})})]})}),e.jsx("div",{className:"min-h-0 overflow-y-auto p-3 overscroll-contain sm:p-4",children:e.jsx("div",{className:"grid gap-2",children:i.map(r=>{const a=d(s.pathname,r.to);return e.jsx(m,{to:r.to,end:r.to==="/projects",onClick:()=>n(!1),className:c("group flex items-center justify-between gap-3 rounded-[22px] border px-3.5 py-3 transition hover:-translate-y-[1px] hover:text-[var(--ui-ink-strong)]",a?"border-[color-mix(in_srgb,var(--info)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_76%,var(--ui-ink-strong)_24%)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)] hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)]"),children:e.jsxs("span",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"flex size-10 items-center justify-center rounded-2xl border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)]",children:e.jsx(r.icon,{className:"size-4"})}),e.jsx("span",{className:"text-sm font-medium",children:r.label})]})},r.to)})})})]})})]}),document.body):null]})}export{y as P};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as u}from"./vendor-Cpmju3nw.js";import{a as i,j,e as h,d,g as y,b as f,f as P,c as b}from"./generic-node-view-
|
|
1
|
+
import{j as u}from"./vendor-Cpmju3nw.js";import{a as i,j,e as h,d,g as y,b as f,f as P,c as b}from"./generic-node-view-COhU_Wm3.js";import{d as S}from"./define-workbench-box-DkffygDU.js";function x({children:e}){return u.jsx(u.Fragment,{children:e})}function t(e,c,a,l,p,s,o=[],r){const m=(r==null?void 0:r.inputs)??[],n=(r==null?void 0:r.params)??[];return S(x,{id:e,surfaceId:"projects",routePath:"/projects",title:c,icon:"projects",description:a,category:"Projects",tags:l,inputs:m,params:n,output:s,tools:o,NodeView:b({title:c,description:a,inputs:m,params:n,output:s,tools:o}),execute:p})}const k=t("surface:projects:hero","Projects hero","Projects page header.",["projects","hero"],e=>j(e,null,"Projects page header."),[i({label:"Projects summary",description:"High-level projects page framing."})]),W=t("surface:projects:search-results","Search and results","Project browser, filters, and search context.",["projects","search"],e=>P(e,{query:"",entityTypes:["project"],limit:20}),f({itemKind:"project",itemLabel:"Project"}),[y("Search project entities by query and entity types.")],{inputs:d({itemKind:"project",itemLabel:"Project",defaultEntityTypes:["project"],defaultLimit:20}),params:h()}),w=t("surface:projects:summary","Collection summary","Collection summary and project state metrics.",["projects","summary"],e=>j(e,null,"Project collection summary."),[i({label:"Project summary",description:"Summary of the project collection and current state."})]);export{k as P,W as a,w as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,r as g,aK as X,b7 as J,aC as A}from"./vendor-Cpmju3nw.js";import{A as Y}from"./ai-surface-workspace-Dd2FSRom.js";import{P as Z}from"./pill-cluster-dy6jG_dV.js";import{c as V,k as P,b as D,d as U,R as q,C as M,E as W,P as H,B as O,h as ee}from"./index-wEZUnRh0.js";import{P as te,a as se,b as ae}from"./projects-boxes-CHLr1Bs-.js";import{P as ie}from"./page-hero-BRcqE3a4.js";import{E as re}from"./entity-note-count-link-CmRRdXAr.js";import{b as ne,f as oe,P as le}from"./project-collections-DNgKleDl.js";import{P as ce}from"./project-management-section-nav-DAZA1oXG.js";import{U as de}from"./user-badge-CQygGKVs.js";import{b as R,d as F}from"./user-ownership-DJGl4rAj.js";import"./board-CLOHbg6t.js";import"./state-BtwEvpO6.js";import"./motion-DwjmC9aq.js";import"./ui-B9O-eUim.js";import"./forms-C5d5hTf2.js";import"./generic-node-view-KePoUF3Z.js";import"./graph-Cd5WF3lw.js";import"./define-workbench-box-BIOZopF2.js";function ue({children:s,columns:d="single",className:w}){return e.jsx("section",{className:V("grid gap-4",d==="two"&&"lg:grid-cols-2",d==="sidebar"&&"xl:grid-cols-[minmax(0,25rem)_minmax(0,1fr)]",w),children:s})}function me(s){return s.trim().toLowerCase()}function Q(s,d=!1){switch(s.kind){case"goal":return e.jsx(D,{kind:"goal",label:s.label,compact:!0,gradient:!1});case"task":return e.jsx(D,{kind:"task",label:s.label,compact:!0,gradient:!1});case"tag":return e.jsx(P,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:s.label});case"status":return e.jsx(P,{className:"bg-[var(--ui-accent-soft)] text-[color-mix(in_srgb,var(--primary)_72%,var(--ui-ink-strong)_28%)]",children:s.label});case"type":return e.jsx(P,{className:"bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_76%,var(--ui-ink-strong)_24%)]",children:s.label});case"user":return e.jsx(P,{className:"bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_76%,var(--ui-ink-strong)_24%)]",children:s.label});default:return s.label}}function he({query:s,onQueryChange:d,options:w,selectedOptionIds:m,onSelectedOptionIdsChange:I,resultSummary:C}){const[L,j]=g.useState(!1),[T,p]=g.useState(0),N=g.useMemo(()=>m.map(n=>w.find(l=>l.id===n)).filter(Boolean),[w,m]),S=me(s),b=g.useMemo(()=>{const n=w.filter(l=>!m.includes(l.id));return S?n.filter(l=>`${l.label} ${l.description??""} ${l.searchText??""}`.toLowerCase().includes(S)).slice(0,10):n.slice(0,10)},[S,w,m]),k=n=>{m.includes(n)||(I([...m,n]),d(""),p(0),j(!1))},B=n=>{I(m.filter(l=>l!==n))},K=()=>{d(""),I([]),p(0),j(!1)};return e.jsx("div",{className:"grid gap-3",children:e.jsxs("div",{className:"rounded-[28px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4 shadow-[var(--ui-shadow-soft)] sm:p-5",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.2em] text-[var(--ui-ink-muted)]",children:"Project search"}),e.jsx("div",{className:"mt-2 max-w-2xl text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Search with free text, then pin matching goals, tasks, tags, human users, bot users, statuses, or project-type chips as you narrow the list."})]}),s.trim().length>0||m.length>0?e.jsx("button",{type:"button",onClick:K,className:"rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-2 text-sm text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",children:"Clear search"}):null]}),e.jsxs("div",{className:"mt-4 rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3",children:[N.length>0?e.jsx("div",{className:"mb-3 flex flex-wrap gap-2",children:N.map(n=>e.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-2.5 py-1.5",children:[Q(n,!0),e.jsx("button",{type:"button",className:"rounded-full text-[var(--ui-ink-soft)] transition hover:text-[var(--ui-ink-strong)]",onClick:()=>B(n.id),"aria-label":`Remove ${n.label}`,children:e.jsx(X,{className:"size-3.5"})})]},n.id))}):null,e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(J,{className:"size-4 text-[var(--ui-ink-muted)]"}),e.jsx("input",{value:s,onChange:n=>{d(n.target.value),j(!0),p(0)},onFocus:()=>j(!0),onBlur:()=>{window.setTimeout(()=>j(!1),120)},onKeyDown:n=>{if(n.key==="Backspace"&&!s&&m.length>0){B(m[m.length-1]);return}if(n.key==="ArrowDown"){n.preventDefault(),j(!0),p(l=>b.length===0?0:Math.min(b.length-1,l+1));return}if(n.key==="ArrowUp"){n.preventDefault(),p(l=>Math.max(0,l-1));return}if(n.key==="Escape"){j(!1);return}n.key==="Enter"&&b[T]&&(n.preventDefault(),k(b[T].id))},placeholder:"Type a project, goal, task, human, bot, user, or tag",className:"min-w-0 flex-1 bg-transparent text-sm text-[var(--ui-ink-strong)] placeholder:text-[var(--ui-ink-muted)] focus:outline-none"})]}),L?e.jsx("div",{className:"absolute top-full z-20 mt-2 w-full rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-popover)] p-2 shadow-[var(--ui-shadow-strong)] backdrop-blur-xl",children:b.length>0?b.map((n,l)=>e.jsx("button",{type:"button",className:V("flex w-full items-start justify-between gap-3 rounded-[18px] px-3 py-2.5 text-left transition",l===T?"bg-[var(--ui-surface-active)] text-[var(--ui-ink-strong)]":"text-[var(--ui-ink-medium)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]"),onMouseEnter:()=>p(l),onMouseDown:E=>E.preventDefault(),onClick:()=>k(n.id),children:e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-medium",children:Q(n)}),n.description?e.jsx("div",{className:"mt-1 text-xs leading-5 text-[var(--ui-ink-soft)]",children:n.description}):null]})},n.id)):e.jsx("div",{className:"px-3 py-2.5 text-sm text-[var(--ui-ink-muted)]",children:"Keep typing to search by free text, or select a suggested goal, task, human or bot owner, tag, status, or type chip when it appears."})}):null]})]}),e.jsx("div",{className:"mt-3 text-sm text-[var(--ui-ink-soft)]",children:C})]})})}const pe={execution:"Execution",value:"Value",category:"Category"};function xe(s){return s.trim().toLowerCase()}function ze(){const s=U(),[d,w]=g.useState("active"),[m,I]=g.useState(""),[C,L]=g.useState([]),[j,T]=g.useState(null),p=g.useMemo(()=>ne(s.snapshot.dashboard.projects),[s.snapshot.dashboard.projects]),N=g.useMemo(()=>{const a=new Map(s.snapshot.dashboard.goals.map(r=>[r.id,r])),o=new Map(s.snapshot.tags.map(r=>[r.id,r])),u=new Map(s.snapshot.users.map(r=>[r.id,r])),f=new Map;for(const r of s.snapshot.tasks){if(!r.projectId)continue;const x=f.get(r.projectId)??[];x.push(r),f.set(r.projectId,x)}return new Map(s.snapshot.dashboard.projects.map(r=>{const x=a.get(r.goalId)??null,$=f.get(r.id)??[],v=r.userId?u.get(r.userId)??null:null,y=new Map;for(const c of(x==null?void 0:x.tags)??[])y.set(c.id,{id:c.id,name:c.name,kind:c.kind});for(const c of $)for(const t of c.tagIds){const i=o.get(t);i&&y.set(i.id,{id:i.id,name:i.name,kind:i.kind})}const _=Array.from(new Set(Array.from(y.values()).map(c=>c.kind))),z=[r.title,r.description,r.goalTitle,(v==null?void 0:v.displayName)??"",(v==null?void 0:v.handle)??"",(v==null?void 0:v.kind)??"",(x==null?void 0:x.description)??"",r.nextTaskTitle??"",r.momentumLabel,r.status,$.map(c=>c.title).join(" "),Array.from(y.values()).map(c=>`${c.name} ${c.kind}`).join(" ")].join(" ").toLowerCase();return[r.id,{tagIds:Array.from(y.keys()),tags:Array.from(y.values()),taskIds:$.map(c=>c.id),typeKeys:_,userId:r.userId,searchText:z}]}))},[s.snapshot.dashboard.goals,s.snapshot.dashboard.projects,s.snapshot.tags,s.snapshot.tasks,s.snapshot.users]),S=g.useMemo(()=>{var v,y,_,z,c;const a=new Map,o=new Map,u=new Map,f=new Map,r=new Map,x=new Map,$=new Map;for(const t of s.snapshot.dashboard.projects){const i=N.get(t.id);if(i){o.has(t.goalId)||o.set(t.goalId,new Set),o.get(t.goalId).add(t.id),r.has(t.status)||r.set(t.status,new Set),r.get(t.status).add(t.id);for(const h of i.taskIds)u.has(h)||u.set(h,new Set),u.get(h).add(t.id);for(const h of i.tags)f.has(h.id)||f.set(h.id,new Set),f.get(h.id).add(t.id);for(const h of i.typeKeys)x.has(h)||x.set(h,new Set),x.get(h).add(t.id);i.userId&&($.has(i.userId)||$.set(i.userId,new Set),$.get(i.userId).add(t.id))}}for(const t of s.snapshot.dashboard.goals){const i=((v=o.get(t.id))==null?void 0:v.size)??0;i!==0&&a.set(`goal:${t.id}`,{id:`goal:${t.id}`,kind:"goal",value:t.id,label:t.title,description:F(`${i} project${i===1?"":"s"} linked to this goal`,t.user,`${i} project${i===1?"":"s"} linked to this goal`),searchText:R([t.title,t.description],t)})}for(const t of s.snapshot.tasks){const i=((y=u.get(t.id))==null?void 0:y.size)??0;i!==0&&a.set(`task:${t.id}`,{id:`task:${t.id}`,kind:"task",value:t.id,label:t.title,description:F(`${i} project${i===1?"":"s"} linked to this task`,t.user,`${i} project${i===1?"":"s"} linked to this task`),searchText:R([t.title,t.description],t)})}for(const t of s.snapshot.tags){const i=((_=f.get(t.id))==null?void 0:_.size)??0;i!==0&&a.set(`tag:${t.id}`,{id:`tag:${t.id}`,kind:"tag",value:t.id,label:t.name,description:F(`${i} project${i===1?"":"s"} touching this tag`,t.user,`${i} project${i===1?"":"s"} touching this tag`),searchText:R([t.name,t.kind,t.description],t)})}for(const[t,i]of Object.entries(p))t==="all"||i===0||a.set(`status:${t}`,{id:`status:${t}`,kind:"status",value:t,label:t==="paused"?"Suspended":t==="completed"?"Finished":"Active",description:`${i} project${i===1?"":"s"} currently ${t==="paused"?"suspended":t==="completed"?"finished":"active"}`,searchText:`${t} ${t==="paused"?"suspended":""} ${t==="completed"?"finished":""}`});for(const[t,i]of Object.entries(pe)){const h=((z=x.get(t))==null?void 0:z.size)??0;h!==0&&a.set(`type:${t}`,{id:`type:${t}`,kind:"type",value:t,label:i,description:`${h} project${h===1?"":"s"} linked to ${i.toLowerCase()} tags`,searchText:`${i} ${t} project type`})}for(const t of s.snapshot.users){const i=((c=$.get(t.id))==null?void 0:c.size)??0;i!==0&&a.set(`user:${t.id}`,{id:`user:${t.id}`,kind:"user",value:t.id,label:t.displayName,description:`${i} project${i===1?"":"s"} owned by this ${t.kind}`,searchText:`${t.displayName} ${t.handle} ${t.kind} ${t.description}`})}return Array.from(a.values()).sort((t,i)=>t.label.localeCompare(i.label))},[p,N,s.snapshot.dashboard.goals,s.snapshot.dashboard.projects,s.snapshot.tags,s.snapshot.tasks,s.snapshot.users]),b=g.useMemo(()=>C.map(a=>S.find(o=>o.id===a)).filter(Boolean),[S,C]),k=g.useMemo(()=>{const a=xe(m);return oe(s.snapshot.dashboard.projects,d).filter(o=>{const u=N.get(o.id);return!u||!b.every(r=>{switch(r.kind){case"goal":return o.goalId===r.value;case"task":return u.taskIds.includes(r.value);case"tag":return u.tagIds.includes(r.value);case"status":return o.status===r.value;case"type":return u.typeKeys.includes(r.value);case"user":return u.userId===r.value;default:return!0}})?!1:a?u.searchText.includes(a):!0})},[d,N,m,b,s.snapshot.dashboard.projects]),B=d==="all"?p.all:p[d],n=m.trim().length>0||C.length>0?`${k.length} matching project${k.length===1?"":"s"} in the current collection view`:`${B} project${B===1?"":"s"} in ${d==="all"?"all project states":d==="paused"?"the suspended view":d==="completed"?"the finished view":"the active view"}`,l=async a=>{T(a);try{await s.patchProject(a,{status:"active"})}finally{T(null)}},E=e.jsx(ue,{columns:"two",className:"2xl:grid-cols-3",children:k.map(a=>{const o=q(s.snapshot.dashboard.notesSummaryByEntity,"project",a.id),u=N.get(a.id),f=(u==null?void 0:u.tags.slice(0,3))??[];return e.jsxs(M,{className:"flex h-full flex-col transition hover:bg-[var(--ui-surface-hover)]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[e.jsx(D,{kind:"goal",label:a.goalTitle,compact:!0}),e.jsx(de,{user:a.user,compact:!0})]}),e.jsx(P,{className:a.status==="completed"?"bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_76%,var(--ui-ink-strong)_24%)]":a.status==="paused"?"bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_76%,var(--ui-ink-strong)_24%)]":"bg-[var(--ui-accent-soft)] text-[var(--primary)]",children:a.status==="paused"?"Suspended":a.status==="completed"?"Finished":"Active"})]}),e.jsx("div",{className:"mt-4",children:e.jsx(A,{to:`/projects/${a.id}`,className:"transition hover:opacity-90",children:e.jsx(W,{kind:"project",label:a.title,variant:"heading",size:"xl",lines:2})})}),e.jsx("p",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:a.description}),f.length>0?e.jsx(Z,{className:"mt-4",children:f.map(r=>e.jsx(P,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:r.name},r.id))}):null,e.jsx("div",{className:"mt-4",children:e.jsx(H,{value:a.progress,tone:a.status==="completed"?"secondary":"primary"})}),e.jsxs("div",{className:"mt-4 grid grid-cols-3 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:"Active"}),e.jsx("div",{className:"mt-2 text-[var(--ui-ink-strong)]",children:a.activeTaskCount})]}),e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Completed"}),e.jsx("div",{className:"mt-2 text-[var(--ui-ink-strong)]",children:a.completedTaskCount})]}),e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"XP"}),e.jsx("div",{className:"mt-2 text-[var(--ui-ink-strong)]",children:a.earnedPoints})]})]}),e.jsx("div",{className:"mt-5 break-words text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)] [overflow-wrap:anywhere]",children:a.nextTaskTitle?`Next move: ${a.nextTaskTitle}`:"Ready for the next task"}),e.jsx("div",{className:"mt-4",children:e.jsx(re,{entityType:"project",entityId:a.id,count:o.count})}),e.jsxs("div",{className:"mt-5 flex flex-wrap items-center justify-between gap-3 pt-1",children:[e.jsx(A,{to:`/projects/${a.id}`,children:e.jsx(O,{variant:"ghost",children:"Open project"})}),d!=="active"&&a.status!=="active"?e.jsx(O,{variant:"secondary",pending:j===a.id,pendingLabel:"Restarting…",onClick:()=>void l(a.id),children:"Restart"}):null]})]},a.id)})}),G=[{id:"hero",title:"Projects",description:"Route header",defaultWidth:12,defaultHeight:2,removable:!1,surfaceChrome:"none",defaultTitleVisible:!1,defaultDescriptionVisible:!1,render:()=>e.jsx(te,{children:e.jsx(ie,{entityKind:"project",title:e.jsx(W,{kind:"project",label:"Projects",variant:"heading",size:"lg"}),titleText:"Projects",description:"Projects are the concrete paths that move a life goal forward.",badge:`${s.snapshot.dashboard.projects.length} total projects`})})},{id:"search-results",title:"Search and results",description:"Search stays grouped with its live result set.",defaultWidth:8,defaultHeight:6,minWidth:6,render:({compact:a})=>e.jsx(se,{children:e.jsxs("div",{className:"grid min-w-0 gap-4",children:[e.jsx(he,{query:m,onQueryChange:I,options:S,selectedOptionIds:C,onSelectedOptionIdsChange:L,resultSummary:n}),e.jsx(le,{value:d,counts:p,onChange:w}),k.length===0?e.jsxs(M,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"No matching projects"}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Nothing in this project collection matches the current search and chips."})]}):a?e.jsx("div",{className:"grid min-w-0 gap-3",children:k.slice(0,5).map(o=>e.jsx(A,{to:`/projects/${o.id}`,className:"block min-w-0 max-w-full rounded-[18px] bg-[var(--ui-surface-2)] 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:o.title}),e.jsx("div",{className:"truncate text-sm text-[var(--ui-ink-soft)]",children:o.goalTitle})]}),e.jsxs(P,{wrap:!0,className:"max-w-[7rem] shrink-0 bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:[o.earnedPoints," xp"]})]})},o.id))}):E]})})},{id:"summary",title:"Collection summary",description:"Counts and spotlight cards.",defaultWidth:4,defaultHeight:5,minWidth:4,render:()=>{const a=k[0]??s.snapshot.dashboard.projects[0]??null;return e.jsx(ae,{children:e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-1",children:[e.jsxs(M,{className:"p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Active"}),e.jsx("div",{className:"mt-2 font-display text-4xl text-[var(--ui-ink-strong)]",children:p.active})]}),e.jsxs(M,{className:"p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Finished"}),e.jsx("div",{className:"mt-2 font-display text-4xl text-[var(--ui-ink-strong)]",children:p.completed})]})]}),a?e.jsxs(M,{className:"p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Spotlight"}),e.jsx("div",{className:"mt-3 text-base font-semibold text-[var(--ui-ink-strong)]",children:a.title}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:a.description}),e.jsx("div",{className:"mt-3",children:e.jsx(H,{value:a.progress})})]}):null]})})}}];return e.jsxs("div",{className:"grid gap-5",children:[e.jsx(ce,{}),s.snapshot.dashboard.projects.length===0?e.jsx(ee,{eyebrow:"Projects",title:"No projects in flight",description:"Create the first practical path under a life goal so execution, kanban, and evidence all have a concrete home.",action:e.jsx(A,{to:"/goals",className:"inline-flex min-h-10 min-w-max shrink-0 items-center justify-center rounded-full bg-[var(--ui-surface-2)] px-4 py-3 text-sm whitespace-nowrap text-[var(--ui-ink-strong)] transition hover:bg-[var(--ui-surface-hover)]",children:"Open goals"})}):e.jsx(Y,{surfaceId:"projects",baseWidgets:G})]})}export{ze as ProjectsPage};
|
|
1
|
+
import{j as e,r as g,aK as X,b7 as J,aC as A}from"./vendor-Cpmju3nw.js";import{A as Y}from"./ai-surface-workspace-UtnoNmjq.js";import{P as Z}from"./pill-cluster-DhOR4m7X.js";import{c as V,k as P,b as D,d as U,R as q,C as M,E as W,P as H,B as O,h as ee}from"./index-BejvcRGb.js";import{P as te,a as se,b as ae}from"./projects-boxes-AyudWls3.js";import{P as ie}from"./page-hero-DlHEJ0Yt.js";import{E as re}from"./entity-note-count-link-CEtKyMAl.js";import{b as ne,f as oe,P as le}from"./project-collections-USb6PUe0.js";import{P as ce}from"./project-management-section-nav-9OV6_ifH.js";import{U as de}from"./user-badge-BKzwGZDd.js";import{b as R,d as F}from"./user-ownership-DJGl4rAj.js";import"./board-CLOHbg6t.js";import"./state-BtwEvpO6.js";import"./motion-DwjmC9aq.js";import"./ui-B9O-eUim.js";import"./forms-C5d5hTf2.js";import"./generic-node-view-COhU_Wm3.js";import"./graph-Cd5WF3lw.js";import"./define-workbench-box-DkffygDU.js";function ue({children:s,columns:d="single",className:w}){return e.jsx("section",{className:V("grid gap-4",d==="two"&&"lg:grid-cols-2",d==="sidebar"&&"xl:grid-cols-[minmax(0,25rem)_minmax(0,1fr)]",w),children:s})}function me(s){return s.trim().toLowerCase()}function Q(s,d=!1){switch(s.kind){case"goal":return e.jsx(D,{kind:"goal",label:s.label,compact:!0,gradient:!1});case"task":return e.jsx(D,{kind:"task",label:s.label,compact:!0,gradient:!1});case"tag":return e.jsx(P,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:s.label});case"status":return e.jsx(P,{className:"bg-[var(--ui-accent-soft)] text-[color-mix(in_srgb,var(--primary)_72%,var(--ui-ink-strong)_28%)]",children:s.label});case"type":return e.jsx(P,{className:"bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_76%,var(--ui-ink-strong)_24%)]",children:s.label});case"user":return e.jsx(P,{className:"bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_76%,var(--ui-ink-strong)_24%)]",children:s.label});default:return s.label}}function he({query:s,onQueryChange:d,options:w,selectedOptionIds:m,onSelectedOptionIdsChange:I,resultSummary:C}){const[L,j]=g.useState(!1),[T,p]=g.useState(0),N=g.useMemo(()=>m.map(n=>w.find(l=>l.id===n)).filter(Boolean),[w,m]),S=me(s),b=g.useMemo(()=>{const n=w.filter(l=>!m.includes(l.id));return S?n.filter(l=>`${l.label} ${l.description??""} ${l.searchText??""}`.toLowerCase().includes(S)).slice(0,10):n.slice(0,10)},[S,w,m]),k=n=>{m.includes(n)||(I([...m,n]),d(""),p(0),j(!1))},B=n=>{I(m.filter(l=>l!==n))},K=()=>{d(""),I([]),p(0),j(!1)};return e.jsx("div",{className:"grid gap-3",children:e.jsxs("div",{className:"rounded-[28px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4 shadow-[var(--ui-shadow-soft)] sm:p-5",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.2em] text-[var(--ui-ink-muted)]",children:"Project search"}),e.jsx("div",{className:"mt-2 max-w-2xl text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Search with free text, then pin matching goals, tasks, tags, human users, bot users, statuses, or project-type chips as you narrow the list."})]}),s.trim().length>0||m.length>0?e.jsx("button",{type:"button",onClick:K,className:"rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-2 text-sm text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",children:"Clear search"}):null]}),e.jsxs("div",{className:"mt-4 rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3",children:[N.length>0?e.jsx("div",{className:"mb-3 flex flex-wrap gap-2",children:N.map(n=>e.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-2.5 py-1.5",children:[Q(n,!0),e.jsx("button",{type:"button",className:"rounded-full text-[var(--ui-ink-soft)] transition hover:text-[var(--ui-ink-strong)]",onClick:()=>B(n.id),"aria-label":`Remove ${n.label}`,children:e.jsx(X,{className:"size-3.5"})})]},n.id))}):null,e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(J,{className:"size-4 text-[var(--ui-ink-muted)]"}),e.jsx("input",{value:s,onChange:n=>{d(n.target.value),j(!0),p(0)},onFocus:()=>j(!0),onBlur:()=>{window.setTimeout(()=>j(!1),120)},onKeyDown:n=>{if(n.key==="Backspace"&&!s&&m.length>0){B(m[m.length-1]);return}if(n.key==="ArrowDown"){n.preventDefault(),j(!0),p(l=>b.length===0?0:Math.min(b.length-1,l+1));return}if(n.key==="ArrowUp"){n.preventDefault(),p(l=>Math.max(0,l-1));return}if(n.key==="Escape"){j(!1);return}n.key==="Enter"&&b[T]&&(n.preventDefault(),k(b[T].id))},placeholder:"Type a project, goal, task, human, bot, user, or tag",className:"min-w-0 flex-1 bg-transparent text-sm text-[var(--ui-ink-strong)] placeholder:text-[var(--ui-ink-muted)] focus:outline-none"})]}),L?e.jsx("div",{className:"absolute top-full z-20 mt-2 w-full rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-popover)] p-2 shadow-[var(--ui-shadow-strong)] backdrop-blur-xl",children:b.length>0?b.map((n,l)=>e.jsx("button",{type:"button",className:V("flex w-full items-start justify-between gap-3 rounded-[18px] px-3 py-2.5 text-left transition",l===T?"bg-[var(--ui-surface-active)] text-[var(--ui-ink-strong)]":"text-[var(--ui-ink-medium)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]"),onMouseEnter:()=>p(l),onMouseDown:E=>E.preventDefault(),onClick:()=>k(n.id),children:e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-medium",children:Q(n)}),n.description?e.jsx("div",{className:"mt-1 text-xs leading-5 text-[var(--ui-ink-soft)]",children:n.description}):null]})},n.id)):e.jsx("div",{className:"px-3 py-2.5 text-sm text-[var(--ui-ink-muted)]",children:"Keep typing to search by free text, or select a suggested goal, task, human or bot owner, tag, status, or type chip when it appears."})}):null]})]}),e.jsx("div",{className:"mt-3 text-sm text-[var(--ui-ink-soft)]",children:C})]})})}const pe={execution:"Execution",value:"Value",category:"Category"};function xe(s){return s.trim().toLowerCase()}function ze(){const s=U(),[d,w]=g.useState("active"),[m,I]=g.useState(""),[C,L]=g.useState([]),[j,T]=g.useState(null),p=g.useMemo(()=>ne(s.snapshot.dashboard.projects),[s.snapshot.dashboard.projects]),N=g.useMemo(()=>{const a=new Map(s.snapshot.dashboard.goals.map(r=>[r.id,r])),o=new Map(s.snapshot.tags.map(r=>[r.id,r])),u=new Map(s.snapshot.users.map(r=>[r.id,r])),f=new Map;for(const r of s.snapshot.tasks){if(!r.projectId)continue;const x=f.get(r.projectId)??[];x.push(r),f.set(r.projectId,x)}return new Map(s.snapshot.dashboard.projects.map(r=>{const x=a.get(r.goalId)??null,$=f.get(r.id)??[],v=r.userId?u.get(r.userId)??null:null,y=new Map;for(const c of(x==null?void 0:x.tags)??[])y.set(c.id,{id:c.id,name:c.name,kind:c.kind});for(const c of $)for(const t of c.tagIds){const i=o.get(t);i&&y.set(i.id,{id:i.id,name:i.name,kind:i.kind})}const _=Array.from(new Set(Array.from(y.values()).map(c=>c.kind))),z=[r.title,r.description,r.goalTitle,(v==null?void 0:v.displayName)??"",(v==null?void 0:v.handle)??"",(v==null?void 0:v.kind)??"",(x==null?void 0:x.description)??"",r.nextTaskTitle??"",r.momentumLabel,r.status,$.map(c=>c.title).join(" "),Array.from(y.values()).map(c=>`${c.name} ${c.kind}`).join(" ")].join(" ").toLowerCase();return[r.id,{tagIds:Array.from(y.keys()),tags:Array.from(y.values()),taskIds:$.map(c=>c.id),typeKeys:_,userId:r.userId,searchText:z}]}))},[s.snapshot.dashboard.goals,s.snapshot.dashboard.projects,s.snapshot.tags,s.snapshot.tasks,s.snapshot.users]),S=g.useMemo(()=>{var v,y,_,z,c;const a=new Map,o=new Map,u=new Map,f=new Map,r=new Map,x=new Map,$=new Map;for(const t of s.snapshot.dashboard.projects){const i=N.get(t.id);if(i){o.has(t.goalId)||o.set(t.goalId,new Set),o.get(t.goalId).add(t.id),r.has(t.status)||r.set(t.status,new Set),r.get(t.status).add(t.id);for(const h of i.taskIds)u.has(h)||u.set(h,new Set),u.get(h).add(t.id);for(const h of i.tags)f.has(h.id)||f.set(h.id,new Set),f.get(h.id).add(t.id);for(const h of i.typeKeys)x.has(h)||x.set(h,new Set),x.get(h).add(t.id);i.userId&&($.has(i.userId)||$.set(i.userId,new Set),$.get(i.userId).add(t.id))}}for(const t of s.snapshot.dashboard.goals){const i=((v=o.get(t.id))==null?void 0:v.size)??0;i!==0&&a.set(`goal:${t.id}`,{id:`goal:${t.id}`,kind:"goal",value:t.id,label:t.title,description:F(`${i} project${i===1?"":"s"} linked to this goal`,t.user,`${i} project${i===1?"":"s"} linked to this goal`),searchText:R([t.title,t.description],t)})}for(const t of s.snapshot.tasks){const i=((y=u.get(t.id))==null?void 0:y.size)??0;i!==0&&a.set(`task:${t.id}`,{id:`task:${t.id}`,kind:"task",value:t.id,label:t.title,description:F(`${i} project${i===1?"":"s"} linked to this task`,t.user,`${i} project${i===1?"":"s"} linked to this task`),searchText:R([t.title,t.description],t)})}for(const t of s.snapshot.tags){const i=((_=f.get(t.id))==null?void 0:_.size)??0;i!==0&&a.set(`tag:${t.id}`,{id:`tag:${t.id}`,kind:"tag",value:t.id,label:t.name,description:F(`${i} project${i===1?"":"s"} touching this tag`,t.user,`${i} project${i===1?"":"s"} touching this tag`),searchText:R([t.name,t.kind,t.description],t)})}for(const[t,i]of Object.entries(p))t==="all"||i===0||a.set(`status:${t}`,{id:`status:${t}`,kind:"status",value:t,label:t==="paused"?"Suspended":t==="completed"?"Finished":"Active",description:`${i} project${i===1?"":"s"} currently ${t==="paused"?"suspended":t==="completed"?"finished":"active"}`,searchText:`${t} ${t==="paused"?"suspended":""} ${t==="completed"?"finished":""}`});for(const[t,i]of Object.entries(pe)){const h=((z=x.get(t))==null?void 0:z.size)??0;h!==0&&a.set(`type:${t}`,{id:`type:${t}`,kind:"type",value:t,label:i,description:`${h} project${h===1?"":"s"} linked to ${i.toLowerCase()} tags`,searchText:`${i} ${t} project type`})}for(const t of s.snapshot.users){const i=((c=$.get(t.id))==null?void 0:c.size)??0;i!==0&&a.set(`user:${t.id}`,{id:`user:${t.id}`,kind:"user",value:t.id,label:t.displayName,description:`${i} project${i===1?"":"s"} owned by this ${t.kind}`,searchText:`${t.displayName} ${t.handle} ${t.kind} ${t.description}`})}return Array.from(a.values()).sort((t,i)=>t.label.localeCompare(i.label))},[p,N,s.snapshot.dashboard.goals,s.snapshot.dashboard.projects,s.snapshot.tags,s.snapshot.tasks,s.snapshot.users]),b=g.useMemo(()=>C.map(a=>S.find(o=>o.id===a)).filter(Boolean),[S,C]),k=g.useMemo(()=>{const a=xe(m);return oe(s.snapshot.dashboard.projects,d).filter(o=>{const u=N.get(o.id);return!u||!b.every(r=>{switch(r.kind){case"goal":return o.goalId===r.value;case"task":return u.taskIds.includes(r.value);case"tag":return u.tagIds.includes(r.value);case"status":return o.status===r.value;case"type":return u.typeKeys.includes(r.value);case"user":return u.userId===r.value;default:return!0}})?!1:a?u.searchText.includes(a):!0})},[d,N,m,b,s.snapshot.dashboard.projects]),B=d==="all"?p.all:p[d],n=m.trim().length>0||C.length>0?`${k.length} matching project${k.length===1?"":"s"} in the current collection view`:`${B} project${B===1?"":"s"} in ${d==="all"?"all project states":d==="paused"?"the suspended view":d==="completed"?"the finished view":"the active view"}`,l=async a=>{T(a);try{await s.patchProject(a,{status:"active"})}finally{T(null)}},E=e.jsx(ue,{columns:"two",className:"2xl:grid-cols-3",children:k.map(a=>{const o=q(s.snapshot.dashboard.notesSummaryByEntity,"project",a.id),u=N.get(a.id),f=(u==null?void 0:u.tags.slice(0,3))??[];return e.jsxs(M,{className:"flex h-full flex-col transition hover:bg-[var(--ui-surface-hover)]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[e.jsx(D,{kind:"goal",label:a.goalTitle,compact:!0}),e.jsx(de,{user:a.user,compact:!0})]}),e.jsx(P,{className:a.status==="completed"?"bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_76%,var(--ui-ink-strong)_24%)]":a.status==="paused"?"bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_76%,var(--ui-ink-strong)_24%)]":"bg-[var(--ui-accent-soft)] text-[var(--primary)]",children:a.status==="paused"?"Suspended":a.status==="completed"?"Finished":"Active"})]}),e.jsx("div",{className:"mt-4",children:e.jsx(A,{to:`/projects/${a.id}`,className:"transition hover:opacity-90",children:e.jsx(W,{kind:"project",label:a.title,variant:"heading",size:"xl",lines:2})})}),e.jsx("p",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:a.description}),f.length>0?e.jsx(Z,{className:"mt-4",children:f.map(r=>e.jsx(P,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:r.name},r.id))}):null,e.jsx("div",{className:"mt-4",children:e.jsx(H,{value:a.progress,tone:a.status==="completed"?"secondary":"primary"})}),e.jsxs("div",{className:"mt-4 grid grid-cols-3 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:"Active"}),e.jsx("div",{className:"mt-2 text-[var(--ui-ink-strong)]",children:a.activeTaskCount})]}),e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Completed"}),e.jsx("div",{className:"mt-2 text-[var(--ui-ink-strong)]",children:a.completedTaskCount})]}),e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"XP"}),e.jsx("div",{className:"mt-2 text-[var(--ui-ink-strong)]",children:a.earnedPoints})]})]}),e.jsx("div",{className:"mt-5 break-words text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)] [overflow-wrap:anywhere]",children:a.nextTaskTitle?`Next move: ${a.nextTaskTitle}`:"Ready for the next task"}),e.jsx("div",{className:"mt-4",children:e.jsx(re,{entityType:"project",entityId:a.id,count:o.count})}),e.jsxs("div",{className:"mt-5 flex flex-wrap items-center justify-between gap-3 pt-1",children:[e.jsx(A,{to:`/projects/${a.id}`,children:e.jsx(O,{variant:"ghost",children:"Open project"})}),d!=="active"&&a.status!=="active"?e.jsx(O,{variant:"secondary",pending:j===a.id,pendingLabel:"Restarting…",onClick:()=>void l(a.id),children:"Restart"}):null]})]},a.id)})}),G=[{id:"hero",title:"Projects",description:"Route header",defaultWidth:12,defaultHeight:2,removable:!1,surfaceChrome:"none",defaultTitleVisible:!1,defaultDescriptionVisible:!1,render:()=>e.jsx(te,{children:e.jsx(ie,{entityKind:"project",title:e.jsx(W,{kind:"project",label:"Projects",variant:"heading",size:"lg"}),titleText:"Projects",description:"Projects are the concrete paths that move a life goal forward.",badge:`${s.snapshot.dashboard.projects.length} total projects`})})},{id:"search-results",title:"Search and results",description:"Search stays grouped with its live result set.",defaultWidth:8,defaultHeight:6,minWidth:6,render:({compact:a})=>e.jsx(se,{children:e.jsxs("div",{className:"grid min-w-0 gap-4",children:[e.jsx(he,{query:m,onQueryChange:I,options:S,selectedOptionIds:C,onSelectedOptionIdsChange:L,resultSummary:n}),e.jsx(le,{value:d,counts:p,onChange:w}),k.length===0?e.jsxs(M,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"No matching projects"}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Nothing in this project collection matches the current search and chips."})]}):a?e.jsx("div",{className:"grid min-w-0 gap-3",children:k.slice(0,5).map(o=>e.jsx(A,{to:`/projects/${o.id}`,className:"block min-w-0 max-w-full rounded-[18px] bg-[var(--ui-surface-2)] 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:o.title}),e.jsx("div",{className:"truncate text-sm text-[var(--ui-ink-soft)]",children:o.goalTitle})]}),e.jsxs(P,{wrap:!0,className:"max-w-[7rem] shrink-0 bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:[o.earnedPoints," xp"]})]})},o.id))}):E]})})},{id:"summary",title:"Collection summary",description:"Counts and spotlight cards.",defaultWidth:4,defaultHeight:5,minWidth:4,render:()=>{const a=k[0]??s.snapshot.dashboard.projects[0]??null;return e.jsx(ae,{children:e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-1",children:[e.jsxs(M,{className:"p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Active"}),e.jsx("div",{className:"mt-2 font-display text-4xl text-[var(--ui-ink-strong)]",children:p.active})]}),e.jsxs(M,{className:"p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Finished"}),e.jsx("div",{className:"mt-2 font-display text-4xl text-[var(--ui-ink-strong)]",children:p.completed})]})]}),a?e.jsxs(M,{className:"p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Spotlight"}),e.jsx("div",{className:"mt-3 text-base font-semibold text-[var(--ui-ink-strong)]",children:a.title}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:a.description}),e.jsx("div",{className:"mt-3",children:e.jsx(H,{value:a.progress})})]}):null]})})}}];return e.jsxs("div",{className:"grid gap-5",children:[e.jsx(ce,{}),s.snapshot.dashboard.projects.length===0?e.jsx(ee,{eyebrow:"Projects",title:"No projects in flight",description:"Create the first practical path under a life goal so execution, kanban, and evidence all have a concrete home.",action:e.jsx(A,{to:"/goals",className:"inline-flex min-h-10 min-w-max shrink-0 items-center justify-center rounded-full bg-[var(--ui-surface-2)] px-4 py-3 text-sm whitespace-nowrap text-[var(--ui-ink-strong)] transition hover:bg-[var(--ui-surface-hover)]",children:"Open goals"})}):e.jsx(Y,{surfaceId:"projects",baseWidgets:G})]})}export{ze as ProjectsPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as t,aC as pe,bW as ye,bY as ve,r as v}from"./vendor-Cpmju3nw.js";import{j as ge,i as g,k as fe}from"./state-BtwEvpO6.js";import{Q as be,F as i}from"./question-flow-dialog-
|
|
1
|
+
import{j as t,aC as pe,bW as ye,bY as ve,r as v}from"./vendor-Cpmju3nw.js";import{j as ge,i as g,k as fe}from"./state-BtwEvpO6.js";import{Q as be,F as i}from"./question-flow-dialog-BByFV8Yw.js";import{E as xe}from"./entity-note-count-link-CEtKyMAl.js";import{A as V}from"./atlas-panel-f1kc-LkD.js";import{E as S}from"./entity-link-multiselect-wuyJ8BbW.js";import{d as we,L as je,e as ke,B as P,E as Ce,bs as Ie,k as Se,R as Pe,c as G,bM as Ne,bN as Te,I as Be,T as d,bO as Le,bP as Me,bQ as Ee,b5 as Fe,b4 as Oe,b3 as qe,bR as Qe,b7 as Re}from"./index-BejvcRGb.js";import{S as H}from"./schema-badge-BoNjw3h4.js";import{u as Ae,p as De}from"./use-psyche-focus-target-Cuxni3SK.js";import{P as Ue}from"./page-hero-DlHEJ0Yt.js";import{U as Ke}from"./user-badge-BKzwGZDd.js";import{U as We}from"./user-select-field-BNqv8-wd.js";import{p as N}from"./query-cache-IQ8W-LNC.js";import{b as J}from"./psyche-schemas-Dtskzvv1.js";import{g as _e}from"./schema-visuals-CvC9a3i6.js";import{g as $e,b as T,d as B,e as L,a as ze}from"./user-ownership-DJGl4rAj.js";import"./ui-B9O-eUim.js";import"./motion-DwjmC9aq.js";import"./use-anchored-overlay-position-BrQ4cqKn.js";import"./board-CLOHbg6t.js";import"./forms-C5d5hTf2.js";function Ve({entries:s}){const n={away:"border-rose-400/20 bg-[rgba(251,113,133,0.08)]",committed:"border-emerald-400/20 bg-[rgba(110,231,183,0.08)]",recovery:"border-amber-400/20 bg-[rgba(251,191,36,0.08)]"};return t.jsx("div",{className:"grid gap-3 lg:grid-cols-3",children:s.map(o=>t.jsxs(pe,{to:o.href,className:`rounded-[22px] border px-4 py-4 transition hover:-translate-y-0.5 ${n[o.tone]}`,children:[t.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/40",children:o.tone}),t.jsx("div",{className:"mt-2 font-medium text-white",children:o.title}),t.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:o.summary}),t.jsxs("div",{className:"mt-4 inline-flex items-center gap-2 text-sm text-white/54",children:["Open",t.jsx(ye,{className:"size-3.5"})]})]},o.id))})}const f={kind:"away",title:"",description:"",commonCues:[],urgeStory:"",shortTermPayoff:"",longTermCost:"",replacementMove:"",repairPlan:"",linkedPatternIds:[],linkedValueIds:[],linkedSchemaIds:[],linkedModeIds:[],userId:null};function Ge(s){return{kind:s.kind,title:s.title,description:s.description,commonCues:s.commonCues,urgeStory:s.urgeStory,shortTermPayoff:s.shortTermPayoff,longTermCost:s.longTermCost,replacementMove:s.replacementMove,repairPlan:s.repairPlan,linkedPatternIds:s.linkedPatternIds,linkedValueIds:s.linkedValueIds,linkedSchemaIds:s.linkedSchemaIds,linkedModeIds:s.linkedModeIds,userId:s.userId??null}}const Y={away:"Away moves",committed:"Committed actions",recovery:"Recovery moves"};function vt(){var q,Q,R,A,D,U,K,W,_,$,z;const s=we(),n=ge(),[o,M]=ve(),[X,c]=v.useState(!1),[m,p]=v.useState(null),[y,h]=v.useState(f),[Z,b]=v.useState(null),x=g({queryKey:["forge-psyche-behaviors"],queryFn:Fe}),w=g({queryKey:["forge-psyche-patterns"],queryFn:Oe}),j=g({queryKey:["forge-psyche-values"],queryFn:qe}),k=g({queryKey:["forge-psyche-schema-catalog"],queryFn:Qe}),C=g({queryKey:["forge-psyche-modes"],queryFn:Re}),I=((q=x.data)==null?void 0:q.behaviors)??[],ee=((Q=w.data)==null?void 0:Q.patterns)??[],te=((R=j.data)==null?void 0:R.values)??[],ae=((A=k.data)==null?void 0:A.schemas)??[],re=((D=C.data)==null?void 0:D.modes)??[],u=$e(s.selectedUserIds),E=o.get("focus"),se=s.snapshot.dashboard.notesSummaryByEntity;Ae(E),v.useEffect(()=>{if(o.get("create")==="1"){c(!0),p(null),h({...f,userId:u});const e=new URLSearchParams(o);e.delete("create"),M(e,{replace:!0})}},[u,o,M]);const F=fe({mutationFn:async e=>{const a=J.parse(e);return m?Ne(m.id,a):Te(a)},onSuccess:async()=>{c(!1),p(null),h({...f,userId:u}),b(null),await Promise.all([n.invalidateQueries({queryKey:["forge-psyche-behaviors"]}),n.invalidateQueries({queryKey:["forge-psyche-overview"]})])}}),ie=ee.map(e=>({value:e.id,label:L(e.title,e.user),description:B(e.preferredResponse||e.targetBehavior,e.user),searchText:T([e.title,e.preferredResponse,e.targetBehavior,e.description],e),kind:"pattern"})),oe=te.map(e=>({value:e.id,label:L(e.title,e.user),description:B(e.valuedDirection,e.user),searchText:T([e.title,e.valuedDirection,e.description],e),kind:"value"})),ne=ae.map(e=>({value:e.id,label:e.title,description:`${e.description} ${_e(e.family)}`,searchText:`${e.slug} ${e.family} ${e.schemaType}`,badge:t.jsx(H,{label:e.title,schemaType:e.schemaType,compact:!0}),menuBadge:t.jsx(H,{label:e.title,schemaType:e.schemaType,compact:!0})})),le=re.map(e=>({value:e.id,label:L(e.title,e.user),description:B(e.archetype||e.family,e.user),searchText:T([e.title,e.archetype,e.family,e.persona],e),kind:"mode"})),de=async e=>{const{pattern:a}=await Le({title:e,description:"",targetBehavior:e,cueContexts:[],shortTermPayoff:"",longTermCost:"",preferredResponse:"",linkedValueIds:[],linkedSchemaLabels:[],linkedModeIds:[],linkedBeliefIds:[],userId:y.userId});return N(n,["forge-psyche-patterns"],"patterns",a),await n.invalidateQueries({queryKey:["forge-psyche-overview"]}),{value:a.id,label:a.title,description:a.preferredResponse||a.targetBehavior,kind:"pattern"}},ce=async e=>{const{value:a}=await Me({title:e,description:"",valuedDirection:e,whyItMatters:"",linkedGoalIds:[],linkedProjectIds:[],linkedTaskIds:[],committedActions:[],userId:y.userId});return N(n,["forge-psyche-values"],"values",a),await n.invalidateQueries({queryKey:["forge-psyche-overview"]}),{value:a.id,label:a.title,description:a.valuedDirection,kind:"value"}},me=async e=>{const{mode:a}=await Ee({family:"coping",archetype:"",title:e,persona:"",imagery:"",symbolicForm:"",facialExpression:"",fear:"",burden:"",protectiveJob:"",originContext:"",firstAppearanceAt:null,linkedPatternIds:[],linkedBehaviorIds:[],linkedValueIds:[],userId:y.userId});return N(n,["forge-psyche-modes"],"modes",a),await n.invalidateQueries({queryKey:["forge-psyche-overview"]}),{value:a.id,label:a.title,description:a.archetype||a.family,kind:"mode"}},he=[{id:"behavior",eyebrow:"Behavior",title:"Describe the move or urge in plain language",description:"Start with the behavior itself so the map reads like something you can instantly recognize in real life.",render:(e,a)=>t.jsxs(t.Fragment,{children:[t.jsx(We,{value:e.userId??null,users:s.snapshot.users,onChange:r=>a({userId:r}),defaultLabel:ze(s.snapshot.users.find(r=>r.id===u)??null,"Choose behavior owner"),help:"Behaviors can belong to a human or bot user while still linking across shared patterns, schemas, and modes."}),t.jsx(i,{label:"Behavior title",children:t.jsx(Be,{value:e.title,onChange:r=>a({title:r.target.value}),placeholder:"Scroll to numb the impact"})}),t.jsx(i,{label:"What does the move look like?",children:t.jsx(d,{value:e.description,onChange:r=>a({description:r.target.value}),placeholder:"Describe the move the way you would recognize it in the moment, not in therapist shorthand."})})]})},{id:"context",eyebrow:"Context",title:"Capture the cue, the pull, and the immediate payoff",description:"Make the move readable as a real pattern instead of a label.",render:(e,a)=>t.jsxs(t.Fragment,{children:[t.jsx(i,{label:"Common cues",children:t.jsx(d,{value:e.commonCues.join(`
|
|
2
2
|
`),onChange:r=>a({commonCues:r.target.value.split(`
|
|
3
3
|
`).map(ue=>ue.trim()).filter(Boolean)}),placeholder:`One line per cue
|
|
4
4
|
Late-night ambiguity
|
package/dist/assets/{psyche-flashcards-page-CJmgGL9x.js → psyche-flashcards-page-DzCGy-FV.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bY as E,r as x,j as e,bX as B,b7 as z,cC as M,aG as R,aK as q}from"./vendor-Cpmju3nw.js";import{j as Q,i as K,k as F}from"./state-BtwEvpO6.js";import{d as O,L as Y,e as H,B as S,bs as V,I as h,k as N,c as y,T as W,bS as G,bT as X,bU as D,b8 as J}from"./index-wEZUnRh0.js";import{u as Z,p as $}from"./use-psyche-focus-target-Cuxni3SK.js";import{P as ee}from"./page-hero-BRcqE3a4.js";import{U as se}from"./user-badge-CQygGKVs.js";import{U as ae}from"./user-select-field-BNqv8-wd.js";import{f as te}from"./psyche-schemas-Dtskzvv1.js";import{g as re,a as ie}from"./user-ownership-DJGl4rAj.js";import"./motion-DwjmC9aq.js";import"./ui-B9O-eUim.js";import"./board-CLOHbg6t.js";import"./forms-C5d5hTf2.js";const k={title:"",message:"",triggerSentence:"",triggerSituation:"",tags:[],backgroundColor:"#f8fafc",textColor:"#111827",accentColor:"#6ee7b7",typography:"serif",imageUrl:"",imageAlt:"",layout:"centered",visualStyle:"calm",linkedValueIds:[],linkedBehaviorIds:[],linkedPatternIds:[],linkedBeliefIds:[],linkedModeIds:[],linkedReportIds:[],userId:null},le={serif:"font-serif",sans:"font-sans",mono:"font-mono",display:"font-display"},ne={calm:"Calm",urgent:"Urgent",warm:"Warm",clinical:"Clinical",playful:"Playful"};function oe(s){return s.split(",").map(l=>l.trim()).filter(Boolean)}function L(s){return{title:s.title,message:s.message,triggerSentence:s.triggerSentence,triggerSituation:s.triggerSituation,tags:s.tags,backgroundColor:s.backgroundColor,textColor:s.textColor,accentColor:s.accentColor,typography:s.typography,imageUrl:s.imageUrl,imageAlt:s.imageAlt,layout:s.layout,visualStyle:s.visualStyle,linkedValueIds:s.linkedValueIds,linkedBehaviorIds:s.linkedBehaviorIds,linkedPatternIds:s.linkedPatternIds,linkedBeliefIds:s.linkedBeliefIds,linkedModeIds:s.linkedModeIds,linkedReportIds:s.linkedReportIds,userId:s.userId??null}}function T({card:s,compact:l=!1,focused:a=!1,onClick:p}){const c=s.imageUrl.trim().length>0,n=s.layout,d=s.title.trim(),v=s.triggerSentence.trim()||s.triggerSituation.trim();return e.jsxs("button",{type:"button",className:y("group min-w-0 rounded-[26px] border p-2 text-left shadow-[var(--card-shadow)] transition hover:-translate-y-0.5 hover:border-[var(--ui-border-strong)]",a?"border-[color-mix(in_srgb,var(--tertiary)_72%,var(--ui-border-subtle)_28%)]":"border-[var(--ui-border-subtle)]"),onClick:p,children:[e.jsxs("div",{className:y("relative grid min-h-[18rem] overflow-hidden rounded-[20px] border",l?"min-h-[15rem]":"sm:min-h-[21rem]",n==="image_split"&&c?"md:grid-cols-[0.9fr_1.1fr]":""),style:{background:s.backgroundColor,color:s.textColor,borderColor:s.accentColor},children:[c&&n!=="image_split"?e.jsx("img",{src:s.imageUrl,alt:s.imageAlt||d||"Flashcard image",className:"absolute inset-0 size-full object-cover opacity-30"}):null,c&&n==="image_split"?e.jsx("div",{className:"relative min-h-[10rem] overflow-hidden",children:e.jsx("img",{src:s.imageUrl,alt:s.imageAlt||d||"Flashcard image",className:"absolute inset-0 size-full object-cover"})}):null,e.jsxs("div",{className:y("relative z-10 flex min-w-0 flex-col p-6",n==="top_left"?"items-start justify-start":"items-center justify-center text-center",n==="poster"?"min-h-[22rem] p-8":"",le[s.typography]),children:[e.jsx("div",{className:"mb-5 h-1.5 w-16 rounded-full",style:{backgroundColor:s.accentColor}}),e.jsx("div",{className:y("max-w-[24rem] text-balance leading-[1.12]",l?"text-2xl":"text-[clamp(1.9rem,4vw,3.45rem)]"),children:s.message||"Write the sentence that should meet you in the hard moment."}),v?e.jsx("div",{className:"mt-6 max-w-md rounded-full border px-3 py-1.5 text-xs font-medium opacity-75",style:{borderColor:s.accentColor},children:v}):null]})]}),e.jsxs("div",{className:"px-2 pt-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[d?e.jsx("div",{className:"truncate text-sm font-semibold text-[var(--ui-ink-strong)]",children:d}):null,e.jsx(N,{className:"bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:ne[s.visualStyle]})]}),s.tags.length>0?e.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:s.tags.slice(0,5).map(o=>e.jsx("span",{className:"rounded-full bg-[var(--ui-surface-1)] px-2 py-1 text-[11px] text-[var(--ui-ink-soft)]",children:o},o))}):null]})]})}function ce({open:s,editingCard:l,draft:a,users:p,suggestedOwner:c,submitError:n,saving:d,onClose:v,onDelete:o,onDraftChange:i,onSubmit:u}){return s?e.jsx("div",{className:"fixed inset-0 z-50 flex items-end justify-center bg-[var(--overlay)] px-3 py-4 backdrop-blur-xl sm:items-center sm:p-6",children:e.jsxs("div",{className:"max-h-[min(92dvh,58rem)] w-full max-w-6xl overflow-hidden rounded-[30px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-section)] shadow-[var(--ui-shadow-floating)]",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-[var(--ui-border-subtle)] px-5 py-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.2em] text-[var(--tertiary)]",children:l?"Edit flashcard":"New flashcard"}),e.jsx("div",{className:"mt-1 text-lg font-semibold text-[var(--ui-ink-strong)]",children:"Message first, retrieval second, styling last."})]}),e.jsx("button",{type:"button","aria-label":"Close flashcard editor",className:"inline-flex size-10 shrink-0 items-center justify-center rounded-full border border-[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:v,children:e.jsx(q,{className:"size-4"})})]}),e.jsxs("div",{className:"grid max-h-[calc(min(92dvh,58rem)-5rem)] min-h-0 overflow-y-auto p-4 md:grid-cols-[1fr_0.9fr] md:p-5",children:[e.jsxs("div",{className:"grid content-start gap-4 pr-0 md:pr-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Main message"}),e.jsx(W,{className:"mt-2 min-h-28",value:a.message,placeholder:"This urge is a wave. You do not have to obey it.",onChange:r=>i({...a,message:r.target.value})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Trigger sentence"}),e.jsx(h,{className:"mt-2",value:a.triggerSentence,placeholder:"I feel the urge to…",onChange:r=>i({...a,triggerSentence:r.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Optional title"}),e.jsx(h,{className:"mt-2",value:a.title,placeholder:"Late-night urge card",onChange:r=>i({...a,title:r.target.value})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Trigger situation"}),e.jsx(h,{className:"mt-2",value:a.triggerSituation,placeholder:"Late evening shame, loneliness, conflict, or boredom",onChange:r=>i({...a,triggerSituation:r.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Tags"}),e.jsx(h,{className:"mt-2",value:a.tags.join(", "),placeholder:"urge, sobriety, grounding",onChange:r=>i({...a,tags:oe(r.target.value)})})]}),e.jsx("div",{className:"grid gap-4 sm:grid-cols-3",children:[["backgroundColor","Background"],["textColor","Text"],["accentColor","Accent"]].map(([r,m])=>e.jsxs("label",{className:"grid gap-2 text-xs font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:[m,e.jsx("input",{type:"color",value:String(a[r]),className:"h-11 w-full rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-1",onChange:w=>i({...a,[r]:w.target.value})})]},r))}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[e.jsxs("label",{className:"grid gap-2 text-xs font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:["Typography",e.jsxs("select",{className:"h-11 rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 text-sm normal-case tracking-normal text-[var(--ui-ink-strong)]",value:a.typography,onChange:r=>i({...a,typography:r.target.value}),children:[e.jsx("option",{value:"serif",children:"Serif"}),e.jsx("option",{value:"sans",children:"Sans"}),e.jsx("option",{value:"mono",children:"Mono"}),e.jsx("option",{value:"display",children:"Display"})]})]}),e.jsxs("label",{className:"grid gap-2 text-xs font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:["Layout",e.jsxs("select",{className:"h-11 rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 text-sm normal-case tracking-normal text-[var(--ui-ink-strong)]",value:a.layout,onChange:r=>i({...a,layout:r.target.value}),children:[e.jsx("option",{value:"centered",children:"Centered"}),e.jsx("option",{value:"top_left",children:"Top left"}),e.jsx("option",{value:"image_split",children:"Image split"}),e.jsx("option",{value:"poster",children:"Poster"})]})]}),e.jsxs("label",{className:"grid gap-2 text-xs font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:["Tone",e.jsxs("select",{className:"h-11 rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 text-sm normal-case tracking-normal text-[var(--ui-ink-strong)]",value:a.visualStyle,onChange:r=>i({...a,visualStyle:r.target.value}),children:[e.jsx("option",{value:"calm",children:"Calm"}),e.jsx("option",{value:"urgent",children:"Urgent"}),e.jsx("option",{value:"warm",children:"Warm"}),e.jsx("option",{value:"clinical",children:"Clinical"}),e.jsx("option",{value:"playful",children:"Playful"})]})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Image URL"}),e.jsx(h,{className:"mt-2",value:a.imageUrl,placeholder:"https://…",onChange:r=>i({...a,imageUrl:r.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Image alt"}),e.jsx(h,{className:"mt-2",value:a.imageAlt,placeholder:"Describe the image",onChange:r=>i({...a,imageAlt:r.target.value})})]})]}),e.jsx(ae,{users:p,value:a.userId??null,defaultLabel:ie(c,"Choose flashcard owner"),onChange:r=>i({...a,userId:r}),help:"Flashcards can belong to a human or bot owner while still being searchable by trigger, tags, and linked Psyche records."}),n?e.jsx("div",{className:"rounded-[18px] border border-[var(--danger)]/20 bg-[var(--ui-danger-soft)] px-4 py-3 text-sm text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)]",children:n}):null,e.jsxs("div",{className:"flex flex-wrap justify-between gap-3",children:[l?e.jsx(S,{type:"button",variant:"ghost",onClick:o,children:"Delete"}):e.jsx("span",{}),e.jsx(S,{type:"button",disabled:d,onClick:u,children:d?"Saving...":"Save flashcard"})]})]}),e.jsx("div",{className:"mt-5 min-w-0 md:mt-0",children:e.jsx(T,{card:a,compact:!0})})]})]})}):null}function Ne(){var _;const s=O(),l=Q(),[a,p]=E(),c=a.get("focus"),[n,d]=x.useState(""),[v,o]=x.useState(!1),[i,u]=x.useState(null),[r,m]=x.useState(k),[w,C]=x.useState(null),b=re(s.selectedUserIds),A=s.snapshot.users.find(t=>t.id===b)??null;Z(c);const f=K({queryKey:["forge-psyche-flashcards",s.selectedUserIds],queryFn:()=>J(s.selectedUserIds)});x.useEffect(()=>{if(a.get("create")==="1"){u(null),m({...k,userId:b}),o(!0);const t=new URLSearchParams(a);t.delete("create"),p(t,{replace:!0})}},[b,a,p]);const P=F({mutationFn:async t=>{const g=te.parse(t);return i?G(i.id,g):X(g)},onSuccess:async()=>{o(!1),u(null),m({...k,userId:b}),C(null),await Promise.all([l.invalidateQueries({queryKey:["forge-psyche-flashcards"]}),l.invalidateQueries({queryKey:["forge-psyche-overview"]})])},onError:t=>{C(t instanceof Error?t.message:String(t))}}),U=F({mutationFn:async t=>D(t.id),onSuccess:async()=>{o(!1),u(null),await Promise.all([l.invalidateQueries({queryKey:["forge-psyche-flashcards"]}),l.invalidateQueries({queryKey:["forge-psyche-overview"]})])}}),j=((_=f.data)==null?void 0:_.flashcards)??[],I=x.useMemo(()=>{const t=n.trim().toLowerCase();return t?j.filter(g=>[g.title,g.message,g.triggerSentence,g.triggerSituation,...g.tags].join(" ").toLowerCase().includes(t)):j},[j,n]);return f.isLoading?e.jsx(Y,{title:"Loading Psyche flashcards"}):f.isError?e.jsx(H,{eyebrow:"Psyche",error:f.error,onRetry:()=>void f.refetch()}):e.jsxs("div",{className:"grid gap-6",children:[e.jsx(ee,{title:"Flashcards",titleText:"Flashcards",description:"Small therapeutic reminder cards for urges, trigger moments, mode shifts, and values-based pivots.",actions:e.jsxs(S,{type:"button",onClick:()=>{u(null),m({...k,userId:b}),o(!0)},children:[e.jsx(B,{className:"mr-2 size-4"}),"New flashcard"]})}),e.jsx(V,{}),e.jsxs("div",{className:"grid gap-4 rounded-[26px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-section)] p-4 md:grid-cols-[1fr_auto] md:items-center",children:[e.jsxs("div",{className:"relative min-w-0",children:[e.jsx(z,{className:"pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-[var(--ui-ink-faint)]"}),e.jsx(h,{value:n,placeholder:"Search message, tags, trigger sentence, or situation",className:"pl-10",onChange:t=>d(t.target.value)})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 text-sm text-[var(--ui-ink-soft)]",children:[e.jsxs(N,{className:"bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:[j.length," saved"]}),e.jsxs(N,{className:"bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:[I.length," visible"]})]})]}),I.length>0?e.jsx("div",{className:"grid gap-5 lg:grid-cols-2 2xl:grid-cols-3",children:I.map(t=>e.jsxs("div",{className:$(c===t.id),children:[e.jsx(T,{card:t,focused:c===t.id,onClick:()=>{u(t),m(L(t)),o(!0)}}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-2 px-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.user?e.jsx(se,{user:t.user,compact:!0}):null,t.imageUrl?e.jsxs(N,{className:"bg-[var(--ui-surface-1)] text-[var(--ui-ink-soft)]",children:[e.jsx(M,{className:"mr-1 size-3"}),"image"]}):null]}),e.jsx(S,{type:"button",variant:"ghost",onClick:()=>{u(t),m(L(t)),o(!0)},children:"Edit"})]})]},t.id))}):e.jsxs("div",{className:"rounded-[30px] border border-[var(--ui-border-subtle)] bg-[radial-gradient(circle_at_top_left,color-mix(in_srgb,var(--tertiary)_12%,transparent),transparent_46%),var(--ui-surface-section)] p-8 text-center",children:[e.jsx(R,{className:"mx-auto size-8 text-[var(--tertiary)]"}),e.jsx("div",{className:"mt-4 text-xl font-semibold text-[var(--ui-ink-strong)]",children:"No flashcards match this view."}),e.jsx("div",{className:"mx-auto mt-2 max-w-xl text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Create cards for the sentences you want available during urges, shame spirals, critic attacks, and values-based pivots."})]}),e.jsx(ce,{open:v,editingCard:i,draft:r,users:s.snapshot.users,suggestedOwner:A,submitError:w,saving:P.isPending||U.isPending,onClose:()=>{o(!1),u(null),C(null)},onDelete:()=>{i&&U.mutateAsync(i)},onDraftChange:m,onSubmit:()=>void P.mutateAsync(r)})]})}export{Ne as PsycheFlashcardsPage};
|
|
1
|
+
import{bY as E,r as x,j as e,bX as B,b7 as z,cC as M,aG as R,aK as q}from"./vendor-Cpmju3nw.js";import{j as Q,i as K,k as F}from"./state-BtwEvpO6.js";import{d as O,L as Y,e as H,B as S,bs as V,I as h,k as N,c as y,T as W,bS as G,bT as X,bU as D,b8 as J}from"./index-BejvcRGb.js";import{u as Z,p as $}from"./use-psyche-focus-target-Cuxni3SK.js";import{P as ee}from"./page-hero-DlHEJ0Yt.js";import{U as se}from"./user-badge-BKzwGZDd.js";import{U as ae}from"./user-select-field-BNqv8-wd.js";import{f as te}from"./psyche-schemas-Dtskzvv1.js";import{g as re,a as ie}from"./user-ownership-DJGl4rAj.js";import"./motion-DwjmC9aq.js";import"./ui-B9O-eUim.js";import"./board-CLOHbg6t.js";import"./forms-C5d5hTf2.js";const k={title:"",message:"",triggerSentence:"",triggerSituation:"",tags:[],backgroundColor:"#f8fafc",textColor:"#111827",accentColor:"#6ee7b7",typography:"serif",imageUrl:"",imageAlt:"",layout:"centered",visualStyle:"calm",linkedValueIds:[],linkedBehaviorIds:[],linkedPatternIds:[],linkedBeliefIds:[],linkedModeIds:[],linkedReportIds:[],userId:null},le={serif:"font-serif",sans:"font-sans",mono:"font-mono",display:"font-display"},ne={calm:"Calm",urgent:"Urgent",warm:"Warm",clinical:"Clinical",playful:"Playful"};function oe(s){return s.split(",").map(l=>l.trim()).filter(Boolean)}function L(s){return{title:s.title,message:s.message,triggerSentence:s.triggerSentence,triggerSituation:s.triggerSituation,tags:s.tags,backgroundColor:s.backgroundColor,textColor:s.textColor,accentColor:s.accentColor,typography:s.typography,imageUrl:s.imageUrl,imageAlt:s.imageAlt,layout:s.layout,visualStyle:s.visualStyle,linkedValueIds:s.linkedValueIds,linkedBehaviorIds:s.linkedBehaviorIds,linkedPatternIds:s.linkedPatternIds,linkedBeliefIds:s.linkedBeliefIds,linkedModeIds:s.linkedModeIds,linkedReportIds:s.linkedReportIds,userId:s.userId??null}}function T({card:s,compact:l=!1,focused:a=!1,onClick:p}){const c=s.imageUrl.trim().length>0,n=s.layout,d=s.title.trim(),v=s.triggerSentence.trim()||s.triggerSituation.trim();return e.jsxs("button",{type:"button",className:y("group min-w-0 rounded-[26px] border p-2 text-left shadow-[var(--card-shadow)] transition hover:-translate-y-0.5 hover:border-[var(--ui-border-strong)]",a?"border-[color-mix(in_srgb,var(--tertiary)_72%,var(--ui-border-subtle)_28%)]":"border-[var(--ui-border-subtle)]"),onClick:p,children:[e.jsxs("div",{className:y("relative grid min-h-[18rem] overflow-hidden rounded-[20px] border",l?"min-h-[15rem]":"sm:min-h-[21rem]",n==="image_split"&&c?"md:grid-cols-[0.9fr_1.1fr]":""),style:{background:s.backgroundColor,color:s.textColor,borderColor:s.accentColor},children:[c&&n!=="image_split"?e.jsx("img",{src:s.imageUrl,alt:s.imageAlt||d||"Flashcard image",className:"absolute inset-0 size-full object-cover opacity-30"}):null,c&&n==="image_split"?e.jsx("div",{className:"relative min-h-[10rem] overflow-hidden",children:e.jsx("img",{src:s.imageUrl,alt:s.imageAlt||d||"Flashcard image",className:"absolute inset-0 size-full object-cover"})}):null,e.jsxs("div",{className:y("relative z-10 flex min-w-0 flex-col p-6",n==="top_left"?"items-start justify-start":"items-center justify-center text-center",n==="poster"?"min-h-[22rem] p-8":"",le[s.typography]),children:[e.jsx("div",{className:"mb-5 h-1.5 w-16 rounded-full",style:{backgroundColor:s.accentColor}}),e.jsx("div",{className:y("max-w-[24rem] text-balance leading-[1.12]",l?"text-2xl":"text-[clamp(1.9rem,4vw,3.45rem)]"),children:s.message||"Write the sentence that should meet you in the hard moment."}),v?e.jsx("div",{className:"mt-6 max-w-md rounded-full border px-3 py-1.5 text-xs font-medium opacity-75",style:{borderColor:s.accentColor},children:v}):null]})]}),e.jsxs("div",{className:"px-2 pt-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[d?e.jsx("div",{className:"truncate text-sm font-semibold text-[var(--ui-ink-strong)]",children:d}):null,e.jsx(N,{className:"bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:ne[s.visualStyle]})]}),s.tags.length>0?e.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:s.tags.slice(0,5).map(o=>e.jsx("span",{className:"rounded-full bg-[var(--ui-surface-1)] px-2 py-1 text-[11px] text-[var(--ui-ink-soft)]",children:o},o))}):null]})]})}function ce({open:s,editingCard:l,draft:a,users:p,suggestedOwner:c,submitError:n,saving:d,onClose:v,onDelete:o,onDraftChange:i,onSubmit:u}){return s?e.jsx("div",{className:"fixed inset-0 z-50 flex items-end justify-center bg-[var(--overlay)] px-3 py-4 backdrop-blur-xl sm:items-center sm:p-6",children:e.jsxs("div",{className:"max-h-[min(92dvh,58rem)] w-full max-w-6xl overflow-hidden rounded-[30px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-section)] shadow-[var(--ui-shadow-floating)]",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-[var(--ui-border-subtle)] px-5 py-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.2em] text-[var(--tertiary)]",children:l?"Edit flashcard":"New flashcard"}),e.jsx("div",{className:"mt-1 text-lg font-semibold text-[var(--ui-ink-strong)]",children:"Message first, retrieval second, styling last."})]}),e.jsx("button",{type:"button","aria-label":"Close flashcard editor",className:"inline-flex size-10 shrink-0 items-center justify-center rounded-full border border-[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:v,children:e.jsx(q,{className:"size-4"})})]}),e.jsxs("div",{className:"grid max-h-[calc(min(92dvh,58rem)-5rem)] min-h-0 overflow-y-auto p-4 md:grid-cols-[1fr_0.9fr] md:p-5",children:[e.jsxs("div",{className:"grid content-start gap-4 pr-0 md:pr-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Main message"}),e.jsx(W,{className:"mt-2 min-h-28",value:a.message,placeholder:"This urge is a wave. You do not have to obey it.",onChange:r=>i({...a,message:r.target.value})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Trigger sentence"}),e.jsx(h,{className:"mt-2",value:a.triggerSentence,placeholder:"I feel the urge to…",onChange:r=>i({...a,triggerSentence:r.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Optional title"}),e.jsx(h,{className:"mt-2",value:a.title,placeholder:"Late-night urge card",onChange:r=>i({...a,title:r.target.value})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Trigger situation"}),e.jsx(h,{className:"mt-2",value:a.triggerSituation,placeholder:"Late evening shame, loneliness, conflict, or boredom",onChange:r=>i({...a,triggerSituation:r.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Tags"}),e.jsx(h,{className:"mt-2",value:a.tags.join(", "),placeholder:"urge, sobriety, grounding",onChange:r=>i({...a,tags:oe(r.target.value)})})]}),e.jsx("div",{className:"grid gap-4 sm:grid-cols-3",children:[["backgroundColor","Background"],["textColor","Text"],["accentColor","Accent"]].map(([r,m])=>e.jsxs("label",{className:"grid gap-2 text-xs font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:[m,e.jsx("input",{type:"color",value:String(a[r]),className:"h-11 w-full rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-1",onChange:w=>i({...a,[r]:w.target.value})})]},r))}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[e.jsxs("label",{className:"grid gap-2 text-xs font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:["Typography",e.jsxs("select",{className:"h-11 rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 text-sm normal-case tracking-normal text-[var(--ui-ink-strong)]",value:a.typography,onChange:r=>i({...a,typography:r.target.value}),children:[e.jsx("option",{value:"serif",children:"Serif"}),e.jsx("option",{value:"sans",children:"Sans"}),e.jsx("option",{value:"mono",children:"Mono"}),e.jsx("option",{value:"display",children:"Display"})]})]}),e.jsxs("label",{className:"grid gap-2 text-xs font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:["Layout",e.jsxs("select",{className:"h-11 rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 text-sm normal-case tracking-normal text-[var(--ui-ink-strong)]",value:a.layout,onChange:r=>i({...a,layout:r.target.value}),children:[e.jsx("option",{value:"centered",children:"Centered"}),e.jsx("option",{value:"top_left",children:"Top left"}),e.jsx("option",{value:"image_split",children:"Image split"}),e.jsx("option",{value:"poster",children:"Poster"})]})]}),e.jsxs("label",{className:"grid gap-2 text-xs font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:["Tone",e.jsxs("select",{className:"h-11 rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 text-sm normal-case tracking-normal text-[var(--ui-ink-strong)]",value:a.visualStyle,onChange:r=>i({...a,visualStyle:r.target.value}),children:[e.jsx("option",{value:"calm",children:"Calm"}),e.jsx("option",{value:"urgent",children:"Urgent"}),e.jsx("option",{value:"warm",children:"Warm"}),e.jsx("option",{value:"clinical",children:"Clinical"}),e.jsx("option",{value:"playful",children:"Playful"})]})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Image URL"}),e.jsx(h,{className:"mt-2",value:a.imageUrl,placeholder:"https://…",onChange:r=>i({...a,imageUrl:r.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Image alt"}),e.jsx(h,{className:"mt-2",value:a.imageAlt,placeholder:"Describe the image",onChange:r=>i({...a,imageAlt:r.target.value})})]})]}),e.jsx(ae,{users:p,value:a.userId??null,defaultLabel:ie(c,"Choose flashcard owner"),onChange:r=>i({...a,userId:r}),help:"Flashcards can belong to a human or bot owner while still being searchable by trigger, tags, and linked Psyche records."}),n?e.jsx("div",{className:"rounded-[18px] border border-[var(--danger)]/20 bg-[var(--ui-danger-soft)] px-4 py-3 text-sm text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)]",children:n}):null,e.jsxs("div",{className:"flex flex-wrap justify-between gap-3",children:[l?e.jsx(S,{type:"button",variant:"ghost",onClick:o,children:"Delete"}):e.jsx("span",{}),e.jsx(S,{type:"button",disabled:d,onClick:u,children:d?"Saving...":"Save flashcard"})]})]}),e.jsx("div",{className:"mt-5 min-w-0 md:mt-0",children:e.jsx(T,{card:a,compact:!0})})]})]})}):null}function Ne(){var _;const s=O(),l=Q(),[a,p]=E(),c=a.get("focus"),[n,d]=x.useState(""),[v,o]=x.useState(!1),[i,u]=x.useState(null),[r,m]=x.useState(k),[w,C]=x.useState(null),b=re(s.selectedUserIds),A=s.snapshot.users.find(t=>t.id===b)??null;Z(c);const f=K({queryKey:["forge-psyche-flashcards",s.selectedUserIds],queryFn:()=>J(s.selectedUserIds)});x.useEffect(()=>{if(a.get("create")==="1"){u(null),m({...k,userId:b}),o(!0);const t=new URLSearchParams(a);t.delete("create"),p(t,{replace:!0})}},[b,a,p]);const P=F({mutationFn:async t=>{const g=te.parse(t);return i?G(i.id,g):X(g)},onSuccess:async()=>{o(!1),u(null),m({...k,userId:b}),C(null),await Promise.all([l.invalidateQueries({queryKey:["forge-psyche-flashcards"]}),l.invalidateQueries({queryKey:["forge-psyche-overview"]})])},onError:t=>{C(t instanceof Error?t.message:String(t))}}),U=F({mutationFn:async t=>D(t.id),onSuccess:async()=>{o(!1),u(null),await Promise.all([l.invalidateQueries({queryKey:["forge-psyche-flashcards"]}),l.invalidateQueries({queryKey:["forge-psyche-overview"]})])}}),j=((_=f.data)==null?void 0:_.flashcards)??[],I=x.useMemo(()=>{const t=n.trim().toLowerCase();return t?j.filter(g=>[g.title,g.message,g.triggerSentence,g.triggerSituation,...g.tags].join(" ").toLowerCase().includes(t)):j},[j,n]);return f.isLoading?e.jsx(Y,{title:"Loading Psyche flashcards"}):f.isError?e.jsx(H,{eyebrow:"Psyche",error:f.error,onRetry:()=>void f.refetch()}):e.jsxs("div",{className:"grid gap-6",children:[e.jsx(ee,{title:"Flashcards",titleText:"Flashcards",description:"Small therapeutic reminder cards for urges, trigger moments, mode shifts, and values-based pivots.",actions:e.jsxs(S,{type:"button",onClick:()=>{u(null),m({...k,userId:b}),o(!0)},children:[e.jsx(B,{className:"mr-2 size-4"}),"New flashcard"]})}),e.jsx(V,{}),e.jsxs("div",{className:"grid gap-4 rounded-[26px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-section)] p-4 md:grid-cols-[1fr_auto] md:items-center",children:[e.jsxs("div",{className:"relative min-w-0",children:[e.jsx(z,{className:"pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-[var(--ui-ink-faint)]"}),e.jsx(h,{value:n,placeholder:"Search message, tags, trigger sentence, or situation",className:"pl-10",onChange:t=>d(t.target.value)})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 text-sm text-[var(--ui-ink-soft)]",children:[e.jsxs(N,{className:"bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:[j.length," saved"]}),e.jsxs(N,{className:"bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:[I.length," visible"]})]})]}),I.length>0?e.jsx("div",{className:"grid gap-5 lg:grid-cols-2 2xl:grid-cols-3",children:I.map(t=>e.jsxs("div",{className:$(c===t.id),children:[e.jsx(T,{card:t,focused:c===t.id,onClick:()=>{u(t),m(L(t)),o(!0)}}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-2 px-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.user?e.jsx(se,{user:t.user,compact:!0}):null,t.imageUrl?e.jsxs(N,{className:"bg-[var(--ui-surface-1)] text-[var(--ui-ink-soft)]",children:[e.jsx(M,{className:"mr-1 size-3"}),"image"]}):null]}),e.jsx(S,{type:"button",variant:"ghost",onClick:()=>{u(t),m(L(t)),o(!0)},children:"Edit"})]})]},t.id))}):e.jsxs("div",{className:"rounded-[30px] border border-[var(--ui-border-subtle)] bg-[radial-gradient(circle_at_top_left,color-mix(in_srgb,var(--tertiary)_12%,transparent),transparent_46%),var(--ui-surface-section)] p-8 text-center",children:[e.jsx(R,{className:"mx-auto size-8 text-[var(--tertiary)]"}),e.jsx("div",{className:"mt-4 text-xl font-semibold text-[var(--ui-ink-strong)]",children:"No flashcards match this view."}),e.jsx("div",{className:"mx-auto mt-2 max-w-xl text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Create cards for the sentences you want available during urges, shame spirals, critic attacks, and values-based pivots."})]}),e.jsx(ce,{open:v,editingCard:i,draft:r,users:s.snapshot.users,suggestedOwner:A,submitError:w,saving:P.isPending||U.isPending,onClose:()=>{o(!1),u(null),C(null)},onDelete:()=>{i&&U.mutateAsync(i)},onDraftChange:m,onSubmit:()=>void P.mutateAsync(r)})]})}export{Ne as PsycheFlashcardsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as h,j as e,aC as m}from"./vendor-Cpmju3nw.js";import{i as j}from"./state-BtwEvpO6.js";import{b as N,P as I}from"./psyche-graph-
|
|
1
|
+
import{r as h,j as e,aC as m}from"./vendor-Cpmju3nw.js";import{i as j}from"./state-BtwEvpO6.js";import{b as N,P as I}from"./psyche-graph-BNllZR67.js";import{d as S,L as G,e as P,bs as E,C as K,b as L,E as B,k as v,c as _,bK as C,a2 as V}from"./index-BejvcRGb.js";import{P as H}from"./page-hero-DlHEJ0Yt.js";import"./motion-DwjmC9aq.js";import"./ui-B9O-eUim.js";import"./board-CLOHbg6t.js";import"./forms-C5d5hTf2.js";function D(){var x;const n=S(),[p,f]=h.useState(null),o=j({queryKey:["forge-psyche-overview"],queryFn:V}),r=(x=o.data)==null?void 0:x.overview,l=h.useMemo(()=>r?n.snapshot.goals.map(i=>{const u=r.values.filter(t=>t.linkedGoalIds.includes(i.id)),g=n.snapshot.dashboard.projects.filter(t=>t.goalId===i.id),b=n.snapshot.habits.filter(t=>t.linkedGoalIds.includes(i.id)||t.linkedValueIds.some(d=>u.some(c=>c.id===d))),w=r.reports.filter(t=>t.linkedGoalIds.includes(i.id)),y=r.behaviors.filter(t=>t.linkedValueIds.some(d=>u.some(c=>c.id===d))),k=r.beliefs.filter(t=>t.linkedValueIds.some(d=>u.some(c=>c.id===d)));return{goal:i,linkedValues:u,linkedProjects:g,linkedHabits:b,linkedReports:w,linkedBehaviors:y,linkedBeliefs:k}}):[],[r,n.snapshot.dashboard.projects,n.snapshot.goals,n.snapshot.habits]),a=h.useMemo(()=>N(l),[l]);if(h.useEffect(()=>{f(a.defaultSelectedId)},[a.defaultSelectedId]),o.isLoading)return e.jsx(G,{eyebrow:"Goal map",title:"Loading the gravity well",description:"Linking goals, values, reports, beliefs, behaviors, and projects back into execution."});if(o.isError||!r)return e.jsx(P,{eyebrow:"Goal map",error:o.error??new Error("Forge returned an empty Psyche overview payload."),onRetry:()=>void o.refetch()});const s=a.inspectors[p??a.defaultSelectedId]??a.inspectors[a.defaultSelectedId];return e.jsxs("div",{className:"grid min-w-0 gap-4",children:[e.jsx(H,{title:"Goal Map",titleText:"Goal Map",description:"Values orbit each goal. Habits, reports, beliefs, behaviors, and projects reveal where the orbit gets disrupted and how execution reconnects.",badge:`${l.length} goal${l.length===1?"":"s"}`,actions:e.jsxs(e.Fragment,{children:[e.jsx(m,{to:"/goals",className:"inline-flex min-h-10 min-w-max shrink-0 items-center justify-center rounded-full bg-[var(--ui-surface-2)] px-4 py-2 text-sm whitespace-nowrap text-[var(--ui-ink-strong)] transition hover:bg-[var(--ui-surface-hover)]",children:"Open goals"}),e.jsx(m,{to:"/psyche/reports?create=1",className:"inline-flex min-h-10 min-w-max shrink-0 items-center justify-center rounded-full bg-[var(--ui-info-soft)] px-4 py-2 text-sm whitespace-nowrap text-[color-mix(in_srgb,var(--info)_76%,var(--ui-ink-strong)_24%)] transition hover:bg-[color-mix(in_srgb,var(--info)_18%,var(--ui-surface-hover)_82%)]",children:"Reflect"})]})}),e.jsx(E,{}),e.jsxs("section",{className:"grid min-w-0 gap-4 xl:grid-cols-[minmax(0,1fr)_20rem]",children:[e.jsx(I,{testId:"goal-gravity-graph",title:"Life direction, value orbit, and execution field",hint:"Drag to inspect the whole field. Select any goal, value, belief, behavior, project, or report to see what it means and where to act next.",nodes:a.nodes,edges:a.edges,fields:a.fields,selectedNodeId:p,onSelectNode:f,minHeightClassName:"min-h-[25rem] sm:min-h-[34rem] lg:min-h-[56rem]",legend:[{label:"Goals",kind:"goal"},{label:"Values",kind:"value"},{label:"Beliefs",kind:"belief"},{label:"Behaviors",kind:"behavior"},{label:"Habits",kind:"habit"},{label:"Projects",kind:"project"},{label:"Reports",kind:"report"}],action:l.length===0?e.jsx(m,{to:"/goals",className:"inline-flex min-h-10 min-w-max shrink-0 items-center justify-center rounded-[var(--radius-control)] bg-[var(--ui-accent-soft)] px-4 py-2 text-sm font-medium whitespace-nowrap text-[var(--ui-ink-strong)]",children:"Add first goal"}):e.jsx(m,{to:"/goals",className:"inline-flex min-h-10 min-w-max shrink-0 items-center justify-center rounded-[var(--radius-control)] bg-[var(--ui-surface-2)] px-4 py-2 text-sm font-medium whitespace-nowrap text-[var(--ui-ink-strong)] transition hover:bg-[var(--ui-surface-hover)]",children:"Open goals"})}),e.jsxs(K,{className:"min-w-0 h-fit xl:sticky xl:top-24",children:[e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:s.entityKind?e.jsx(L,{kind:s.entityKind,compact:!0,gradient:!1,iconOnly:!0}):e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:s.eyebrow})}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[s.entityKind?e.jsx(B,{kind:s.entityKind,label:s.title,variant:"heading",size:"lg",showKind:!1}):e.jsx("h2",{className:"break-words font-display text-[clamp(1.35rem,2.2vw,2rem)] leading-none text-[var(--ui-ink-strong)] [overflow-wrap:anywhere]",children:s.title}),s.entityKind?null:e.jsx(v,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:s.tone})]}),e.jsx("p",{className:"mt-3 break-words text-sm leading-6 text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",children:s.summary}),s.stats.length>0?e.jsx("div",{className:"mt-4 grid gap-2",children:s.stats.map(i=>e.jsx("div",{className:"break-words rounded-[18px] bg-[var(--ui-surface-1)] px-3 py-3 text-sm text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",children:i},i))}):null,s.chips.length>0?e.jsx("div",{className:"mt-4 flex flex-wrap gap-2",children:s.chips.map(i=>e.jsx(v,{className:"max-w-full bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:i},i))}):null,e.jsx("div",{className:"mt-5",children:e.jsx(m,{to:s.href,className:_("inline-flex min-h-11 w-full items-center justify-center rounded-[var(--radius-control)] px-4 py-2.5 text-sm font-medium whitespace-nowrap shadow-[var(--ui-shadow-soft)]",s.entityKind?C(s.entityKind,!0):"bg-[var(--ui-accent-soft)] text-[var(--ui-ink-strong)]"),children:s.ctaLabel})})]})]})]})}export{D as PsycheGoalMapPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as $,b6 as Xt,j as c,cD as Rt,bX as zt,ch as Ct,cE as Pt,cF as Nt}from"./vendor-Cpmju3nw.js";import{c as dt,B as ot,a as gt}from"./index-wEZUnRh0.js";function Z(n,i,s){return`${i}:${n}:${s}`}function ft(n,i,s){return Math.min(Math.max(n,i),s)}function mt(n,i,s){return Math.min(s,Math.max(1,Math.ceil(n.trim().length/i)))}function _t(n,{compact:i}){const s=mt(n,i?13:14,4),p=(i?114:156)+(s-1)*(i?12:18)+Math.min(24,Math.max(0,n.trim().length-18))*(i?.7:1);return ft(p,i?118:164,i?154:210)}function Tt(n,{compact:i}){const s=mt(n,i?11:13,3),p=(i?40:48)+(s-1)*(i?6:8)+Math.min(i?18:26,Math.max(0,n.trim().length-(i?12:16)))*(i?.45:.55);return ft(p,i?42:50,i?56:68)}function tt(n,{compact:i,emphasis:s=!1}){const p=mt(n,i?16:s?22:20,s?3:2);return{width:ft((i?s?184:152:s?224:176)+Math.min(n.length,48)*(i?1.8:2.15),i?s?188:156:s?228:184,i?s?248:208:s?300:244),height:p===1?i?64:70:p===2?i?82:92:i?98:110}}function kt(n){if(n.kind==="goal"||n.kind==="value"||n.kind==="ghost"){const i=n.radius??(n.kind==="goal"?76:34);return{halfWidth:i,halfHeight:i}}return{halfWidth:(n.width??146)/2,halfHeight:(n.height??58)/2}}function Et(n,{compact:i}){const s=n.map(u=>({...u,homeX:u.x,homeY:u.y,locked:u.kind==="goal"||u.kind==="ghost"})),x=i?28:40,p=i?.08:.06;for(let u=0;u<180;u+=1){for(const r of s)r.locked||(r.x+=(r.homeX-r.x)*p,r.y+=(r.homeY-r.y)*p);for(let r=0;r<s.length;r+=1)for(let v=r+1;v<s.length;v+=1){const g=s[r],w=s[v],h=kt(g),L=kt(w),j=w.x-g.x,z=w.y-g.y,y=h.halfWidth+L.halfWidth+x-Math.abs(j),b=h.halfHeight+L.halfHeight+x-Math.abs(z);if(y<=0||b<=0)continue;const I=y<b?"x":"y",P=Math.sign(I==="x"?j||v-r||1:z||v-r||1),E=(I==="x"?y:b)/(g.locked||w.locked?1:2);g.locked||(I==="x"?g.x-=P*E:g.y-=P*E),w.locked||(I==="x"?w.x+=P*E:w.y+=P*E)}}return s.map(({homeX:u,homeY:r,locked:v,...g})=>g)}function Dt(){return{nodes:[{id:"ghost_goal_north",kind:"ghost",x:-250,y:-20,radius:68,label:"First goal",meta:"Goal",href:"/goals"},{id:"ghost_goal_center",kind:"ghost",x:0,y:34,radius:74,label:"Life goals",meta:"Goal",href:"/goals"},{id:"ghost_goal_south",kind:"ghost",x:250,y:-10,radius:68,label:"Direction",meta:"Goal",href:"/goals"}],edges:[],fields:[],inspectors:{ghost_goal_center:{id:"ghost_goal_center",eyebrow:"Goals",title:"Add the first life goal",summary:"The graph is already laid out. Once a goal exists, values, reports, beliefs, and behaviors will start orbiting it instead of staying fragmented.",href:"/goals",ctaLabel:"Open life goals",tone:"sky",entityKind:"goal",chips:["Goals","Values","Reports"],stats:["0 goals mapped yet"]}},defaultSelectedId:"ghost_goal_center"}}function Wt(n,{compact:i=!1}={}){var w;if(n.length===0)return Dt();const s=[],x=[],p=[],u={},r=i?560:840,v=-((n.length-1)*r)/2;n.forEach((h,L)=>{const j=v+L*r,z=L%2===0?92:146,y=h.linkedBehaviors.length+h.linkedBeliefs.length+h.linkedReports.length+h.linkedHabits.length,b=`goal:${h.goal.id}`;s.push({id:b,kind:"goal",x:j,y:z,radius:_t(h.goal.title,{compact:i}),tone:"amber",label:h.goal.title,href:`/goals/${h.goal.id}`}),u[b]={id:b,eyebrow:"Goal",title:h.goal.title,summary:h.goal.description,href:`/goals/${h.goal.id}`,ctaLabel:"Open goal",tone:"amber",entityKind:"goal",chips:h.linkedValues.slice(0,4).map(e=>e.title),stats:[`${h.linkedValues.length} linked value${h.linkedValues.length===1?"":"s"}`,`${h.linkedProjects.length} live project${h.linkedProjects.length===1?"":"s"}`,`${h.linkedHabits.length} linked habit${h.linkedHabits.length===1?"":"s"}`,`${y} friction signal${y===1?"":"s"}`]},y>0&&p.push({id:`field:${h.goal.id}`,x:j+18,y:z+20,radiusX:i?144:176,radiusY:i?104:132,tone:"rose",opacity:Math.min(.42,.14+y*.04)});const I=i?208:282;h.linkedValues.slice(0,i?4:5).forEach((e,d)=>{const m=(-95+d*(i?78:64))*(Math.PI/180),k=Tt(e.title,{compact:i}),G=j+Math.cos(m)*I,W=z+Math.sin(m)*I,A=Z(h.goal.id,"value",e.id);s.push({id:A,kind:"value",x:G,y:W,radius:k,tone:"mint",label:e.title,meta:`${e.linkedGoalIds.length} goal${e.linkedGoalIds.length===1?"":"s"}`,href:`/psyche/values?focus=${e.id}#values-atlas`}),x.push({id:`${b}->${A}`,from:b,to:A,tone:"mint",strength:"medium"}),u[A]={id:A,eyebrow:"Value",title:e.title,summary:e.valuedDirection||e.whyItMatters||e.description,href:`/psyche/values?focus=${e.id}#values-atlas`,ctaLabel:"Open values",tone:"mint",entityKind:"value",chips:e.committedActions.slice(0,3),stats:[`${e.linkedProjectIds.length} linked project${e.linkedProjectIds.length===1?"":"s"}`,`${e.linkedTaskIds.length} linked task${e.linkedTaskIds.length===1?"":"s"}`]}});const P=h.linkedProjects.slice(0,i?2:3).map(e=>({project:e,size:tt(e.title,{compact:i,emphasis:!0})})),E=i?24:30;let N=-(P.reduce((e,d)=>e+d.size.width,0)+Math.max(0,P.length-1)*E)/2;P.forEach(({project:e,size:d},m)=>{const k=Z(h.goal.id,"project",e.id),G=j+N+d.width/2,W=z-(i?330:434)-m*(i?16:20);N+=d.width+E,s.push({id:k,kind:"project",x:G,y:W,width:d.width,height:d.height,tone:"sky",label:e.title,meta:"Project",href:`/projects/${e.id}`}),x.push({id:`${b}->${k}`,from:b,to:k,tone:"sky",strength:"medium"}),u[k]={id:k,eyebrow:"Project",title:e.title,summary:e.description,href:`/projects/${e.id}`,ctaLabel:"Open project",tone:"sky",entityKind:"project",chips:[e.status,e.goalTitle],stats:[`${e.progress}% progress`,`${e.activeTaskCount} active task${e.activeTaskCount===1?"":"s"}`]}}),h.linkedHabits.slice(0,i?2:3).forEach((e,d)=>{const m=Z(h.goal.id,"habit",e.id),k=tt(e.title,{compact:i}),G=j-(i?44:58),W=z+(i?228:294)+d*(i?92:104);s.push({id:m,kind:"habit",x:G,y:W,width:k.width,height:k.height,tone:"mint",label:e.title,meta:e.polarity,href:"/habits"}),x.push({id:`${b}->${m}`,from:b,to:m,tone:"mint",strength:e.dueToday?"high":"medium"}),u[m]={id:m,eyebrow:"Habit",title:e.title,summary:e.description||"Recurring operating record connected directly to this goal field.",href:"/habits",ctaLabel:"Open habits",tone:"mint",entityKind:"habit",chips:[e.polarity,e.frequency,e.dueToday?"due today":"checked in"],stats:[`${e.streakCount} streak`,`${e.rewardXp}/${e.penaltyXp} xp flow`]}});let O=z+(i?132:156);h.linkedBehaviors.slice(0,i?2:3).forEach(e=>{const d=Z(h.goal.id,"behavior",e.id),m=tt(e.title,{compact:i}),k=j-(i?272:352);s.push({id:d,kind:"behavior",x:k,y:O,width:m.width,height:m.height,tone:"orange",label:e.title,meta:e.kind,href:`/psyche/behaviors?focus=${e.id}#behavior-columns`}),x.push({id:`${b}->${d}`,from:b,to:d,tone:"orange",dashed:e.kind!=="committed",strength:e.kind==="committed"?"medium":"low"}),u[d]={id:d,eyebrow:"Behavior",title:e.title,summary:e.replacementMove||e.description||e.urgeStory,href:`/psyche/behaviors?focus=${e.id}#behavior-columns`,ctaLabel:"Open behaviors",tone:"orange",entityKind:"behavior",chips:[e.kind,...e.commonCues.slice(0,2)],stats:[e.shortTermPayoff?"Short-term payoff mapped":"Payoff still to map",e.longTermCost?"Long-term cost mapped":"Cost still to map"]},O+=m.height+(i?18:22)});let X=z+(i?8:10);h.linkedBeliefs.slice(0,i?2:3).forEach(e=>{const d=Z(h.goal.id,"belief",e.id),m=tt(e.statement,{compact:i,emphasis:!0}),k=j+(i?278:362);s.push({id:d,kind:"belief",x:k,y:X,width:m.width,height:m.height,tone:"violet",label:e.statement,meta:"belief",href:`/psyche/schemas-beliefs?focus=${e.id}`}),x.push({id:`${b}->${d}`,from:b,to:d,tone:"violet",dashed:!0,strength:"low"}),u[d]={id:d,eyebrow:"Belief",title:e.statement,summary:e.flexibleAlternative||e.originNote||"Belief script attached to this part of the map.",href:`/psyche/schemas-beliefs?focus=${e.id}`,ctaLabel:"Open beliefs",tone:"violet",entityKind:"belief",chips:[e.beliefType,`${e.confidence}% grip`],stats:[`${e.linkedBehaviorIds.length} linked behavior${e.linkedBehaviorIds.length===1?"":"s"}`,`${e.linkedReportIds.length} linked report${e.linkedReportIds.length===1?"":"s"}`]},X+=m.height+(i?18:22)});const D=h.linkedReports.slice(0,i?2:3).map(e=>({report:e,size:tt(e.title,{compact:i})})),K=i?20:26;let Q=-(D.reduce((e,d)=>e+d.size.width,0)+Math.max(0,D.length-1)*K)/2;D.forEach(({report:e,size:d})=>{const m=Z(h.goal.id,"report",e.id),k=j+Q+d.width/2,G=z+(i?332:430);Q+=d.width+K,s.push({id:m,kind:"report",x:k,y:G,width:d.width,height:d.height,tone:"blue",label:e.title,meta:e.status,href:`/psyche/reports/${e.id}`}),x.push({id:`${b}->${m}`,from:b,to:m,tone:"sky",strength:"medium"}),u[m]={id:m,eyebrow:"Report",title:e.title,summary:e.eventSituation||e.customEventType||"Reflective chain linked into this goal.",href:`/psyche/reports/${e.id}`,ctaLabel:"Open report",tone:"blue",entityKind:"report",chips:[e.status,...e.nextMoves.slice(0,2)],stats:[`${e.emotions.length} emotion${e.emotions.length===1?"":"s"}`,`${e.behaviors.length} move${e.behaviors.length===1?"":"s"}`]}})});const g=((w=s[0])==null?void 0:w.id)??"ghost_goal_center";return{nodes:Et(s,{compact:i}),edges:x,fields:p,inspectors:u,defaultSelectedId:g}}const et={mint:"color-mix(in srgb, var(--success) 64%, transparent)",sky:"color-mix(in srgb, var(--info) 66%, transparent)",violet:"color-mix(in srgb, var(--primary) 72%, transparent)",rose:"color-mix(in srgb, var(--danger) 68%, transparent)",amber:"color-mix(in srgb, var(--warning) 68%, transparent)",orange:"color-mix(in srgb, var(--tertiary) 72%, transparent)",blue:"color-mix(in srgb, var(--info) 72%, transparent)",slate:"color-mix(in srgb, var(--ui-ink-soft) 52%, transparent)"},it={mint:"color-mix(in srgb, var(--success) 18%, transparent)",sky:"color-mix(in srgb, var(--info) 18%, transparent)",violet:"color-mix(in srgb, var(--primary) 18%, transparent)",rose:"color-mix(in srgb, var(--danger) 18%, transparent)",amber:"color-mix(in srgb, var(--warning) 18%, transparent)",orange:"color-mix(in srgb, var(--tertiary) 18%, transparent)",blue:"color-mix(in srgb, var(--info) 18%, transparent)",slate:"color-mix(in srgb, var(--ui-ink-soft) 12%, transparent)"},H={mint:"color-mix(in srgb, var(--success) 56%, var(--ui-ink-strong) 44%)",sky:"color-mix(in srgb, var(--info) 56%, var(--ui-ink-strong) 44%)",violet:"color-mix(in srgb, var(--primary) 60%, var(--ui-ink-strong) 40%)",rose:"color-mix(in srgb, var(--danger) 58%, var(--ui-ink-strong) 42%)",amber:"color-mix(in srgb, var(--warning) 60%, var(--ui-ink-strong) 40%)",orange:"color-mix(in srgb, var(--tertiary) 60%, var(--ui-ink-strong) 40%)",blue:"color-mix(in srgb, var(--info) 58%, var(--ui-ink-strong) 42%)",slate:"var(--ui-ink-medium)"};function wt(n){switch(n){case"goal":case"value":case"behavior":case"belief":case"report":case"project":case"habit":return n;default:return null}}function St(n){if(n.tone)return n.tone;switch(n.kind){case"goal":return"amber";case"value":return"mint";case"belief":return"violet";case"behavior":return"orange";case"project":return"sky";case"habit":return"mint";case"report":return"blue";default:return"slate"}}function Gt(n){if(n.kind==="ghost")return n.meta??null;const i=wt(n.kind);return i?gt(i).label:n.meta??null}function ut(n,i,s){return Math.min(Math.max(n,i),s)}function lt(n,i,s=3){const x=n.trim().split(/\s+/),p=[];let u="";for(let g=0;g<x.length;g+=1){const w=x[g],h=u?`${u} ${w}`:w;if(h.length>i&&u){if(p.push(u),p.length>=s-1){u=[w,...x.slice(g+1)].join(" ");break}u=w}else u=h}u&&p.push(u);const r=p.slice(0,s),v=r.length-1;return v>=0&&r[v].length>i&&(r[v]=`${r[v].slice(0,Math.max(1,i-1)).trimEnd()}…`),r}function Vt(n,i){if(n.length===0&&i.length===0)return{minX:-360,maxX:360,minY:-240,maxY:240};let s=Number.POSITIVE_INFINITY,x=Number.NEGATIVE_INFINITY,p=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY;for(const r of n){const v=r.kind==="goal"||r.kind==="value"||r.kind==="ghost"?r.radius??32:(r.width??124)/2,g=r.kind==="goal"||r.kind==="value"||r.kind==="ghost"?r.radius??32:(r.height??56)/2,w=r.meta&&(r.kind==="goal"||r.kind==="ghost")?48:0;s=Math.min(s,r.x-v),x=Math.max(x,r.x+v),p=Math.min(p,r.y-g-w),u=Math.max(u,r.y+g)}for(const r of i)s=Math.min(s,r.x-r.radiusX),x=Math.max(x,r.x+r.radiusX),p=Math.min(p,r.y-r.radiusY),u=Math.max(u,r.y+r.radiusY);return{minX:s,maxX:x,minY:p,maxY:u}}function vt(n){return{x:n.x,y:n.y}}function Ft(n){if(n.kind==="goal"){const i=n.radius??112;return lt(n.label,Math.max(14,Math.floor(i/7.2)),4)}if(n.kind==="value"||n.kind==="ghost"){const i=n.radius??40;return lt(n.label,Math.max(12,Math.floor(i/3)),3)}return n.kind==="project"?lt(n.label,Math.max(18,Math.floor((n.width??220)/10)),3):lt(n.label,Math.max(16,Math.floor((n.width??180)/10.5)),2)}function Bt(n){switch(n){case"goal":return"amber";case"project":return"sky";case"value":return"mint";case"behavior":return"orange";case"belief":return"violet";case"report":return"blue";default:return"slate"}}function At({nodes:n,edges:i,fields:s=[],title:x,hint:p,action:u,legend:r,selectedNodeId:v,onSelectNode:g,minHeightClassName:w="min-h-[34rem] lg:min-h-[44rem]",compact:h=!1,testId:L}){const j=$.useRef(null),z=Xt(),[y,b]=$.useState({width:0,height:0}),[I,P]=$.useState({scale:1,x:0,y:0}),[E,q]=$.useState(null),N=$.useRef(null),O=$.useRef({scale:1,x:0,y:0}),X=$.useRef(new Map),D=$.useRef(null),K=$.useRef(0),S=$.useRef(!1),Q=$.useMemo(()=>new Map(n.map(t=>[t.id,t])),[n]),e=$.useMemo(()=>Vt(n,s),[s,n]),d=y.width>0&&y.width<640;$.useEffect(()=>{if(!j.current||typeof ResizeObserver>"u")return;const t=new ResizeObserver(a=>{const l=a[0];b({width:l.contentRect.width,height:l.contentRect.height})});return t.observe(j.current),()=>t.disconnect()},[]);const m=$.useCallback(()=>{if(!y.width||!y.height)return;const t=d?260:h?140:190,a=Math.max(e.maxX-e.minX,1),l=Math.max(e.maxY-e.minY,1),o=ut(Math.min(y.width/(a+t),y.height/(l+t)),d?.16:h?.4:.46,d?.76:h?1.04:1.18),f=(e.minX+e.maxX)/2,Y=(e.minY+e.maxY)/2;P({scale:o,x:y.width/2-f*o,y:y.height/2-Y*o})},[e.maxX,e.maxY,e.minX,e.minY,h,y.height,y.width,d]);$.useEffect(()=>{O.current=I},[I]),$.useEffect(()=>{S.current||m()},[m]);const k=$.useCallback((t,a,l)=>{const o=ut(t,.28,1.9);P(f=>{if(a==null||l==null)return{...f,scale:o};const Y=(a-f.x)/f.scale,V=(l-f.y)/f.scale;return{scale:o,x:a-Y*o,y:l-V*o}})},[]),G=$.useCallback(()=>{const t=[...X.current.values()];if(t.length<2){D.current=null;return}const[a,l]=t,o=Math.hypot(l.x-a.x,l.y-a.y);if(!Number.isFinite(o)||o<=0){D.current=null;return}const f=O.current;D.current={startDistance:o,startScale:f.scale,startViewportX:f.x,startViewportY:f.y,startMidpointX:(a.x+l.x)/2,startMidpointY:(a.y+l.y)/2}},[]),W=t=>{var o;t.preventDefault();const a=(o=j.current)==null?void 0:o.getBoundingClientRect();if(!a)return;S.current=!0;const l=t.deltaY<0?1.1:.9;k(I.scale*l,t.clientX-a.left,t.clientY-a.top)},A=t=>{var f;const a=(f=j.current)==null?void 0:f.getBoundingClientRect(),l=t.clientX-((a==null?void 0:a.left)??0),o=t.clientY-((a==null?void 0:a.top)??0);if(X.current.set(t.pointerId,{x:l,y:o}),X.current.size===1){const Y=O.current;N.current={pointerId:t.pointerId,originX:Y.x,originY:Y.y,startX:l,startY:o}}else N.current=null,G();t.currentTarget.setPointerCapture(t.pointerId)},$t=t=>{var V;const a=(V=j.current)==null?void 0:V.getBoundingClientRect(),l=t.clientX-((a==null?void 0:a.left)??0),o=t.clientY-((a==null?void 0:a.top)??0);if(X.current.has(t.pointerId)&&X.current.set(t.pointerId,{x:l,y:o}),D.current&&X.current.size>=2){const[R,_]=[...X.current.values()],C=Math.hypot(_.x-R.x,_.y-R.y);if(Number.isFinite(C)&&C>0){S.current=!0,K.current=Date.now()+240;const J=(R.x+_.x)/2,B=(R.y+_.y)/2,T=D.current,U=ut(T.startScale*C/T.startDistance,.24,1.42),ct=(T.startMidpointX-T.startViewportX)/T.startScale,ht=(T.startMidpointY-T.startViewportY)/T.startScale;P({scale:U,x:J-ct*U,y:B-ht*U})}return}if(!N.current||N.current.pointerId!==t.pointerId||X.current.size!==1)return;S.current=!0;const f=l-N.current.startX,Y=o-N.current.startY;(Math.abs(f)>3||Math.abs(Y)>3)&&(K.current=Date.now()+240),P(R=>{var _,C;return{...R,x:(((_=N.current)==null?void 0:_.originX)??R.x)+f,y:(((C=N.current)==null?void 0:C.originY)??R.y)+Y}})},xt=t=>{if(X.current.delete(t.pointerId),X.current.size<2&&(D.current=null),X.current.size===1){const[a,l]=[...X.current.entries()][0]??[];if(a!=null&&l){const o=O.current;N.current={pointerId:a,originX:o.x,originY:o.y,startX:l.x,startY:l.y}}}else N.current=null;t.currentTarget.hasPointerCapture(t.pointerId)&&t.currentTarget.releasePointerCapture(t.pointerId)},nt=E??v??null,rt=$.useCallback(t=>{Date.now()<K.current||(g==null||g(t.id),t.href&&z(t.href))},[z,g]);return c.jsxs("section",{"data-testid":L,className:dt("overflow-hidden rounded-[32px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-section)] shadow-[var(--card-shadow)]","px-3 py-3 sm:px-4 sm:py-4 lg:px-5 lg:py-5"),children:[c.jsxs("div",{className:"mb-3 flex min-w-0 flex-wrap items-start justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--info)]",children:"Gravity well"}),c.jsx("h2",{className:dt("mt-2 break-words font-display leading-none text-[var(--ui-ink-strong)]",h?"text-[clamp(1.25rem,2vw,1.7rem)]":"text-[clamp(1.45rem,2.8vw,2.3rem)]"),children:x}),p?c.jsx("p",{className:"mt-1.5 max-w-3xl break-words text-sm leading-6 text-[var(--ui-ink-soft)]",children:d?"Select a node, pan the field, and open the full map when you need the wider structure.":p}):null]}),c.jsx("div",{className:"flex min-w-0 flex-wrap items-center justify-end gap-2",children:u})]}),c.jsxs("div",{ref:j,className:dt("group relative overflow-hidden rounded-[30px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] touch-none",w),style:{touchAction:"none"},onWheel:W,onPointerDown:A,onPointerMove:$t,onPointerUp:xt,onPointerCancel:xt,children:[c.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_center,color-mix(in_srgb,var(--success)_8%,transparent),transparent_28%),radial-gradient(circle_at_20%_20%,color-mix(in_srgb,var(--primary)_10%,transparent),transparent_24%),var(--ui-surface-section)]"}),c.jsxs("div",{className:"absolute left-3 top-3 z-10 inline-flex max-w-[calc(100%-7rem)] items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--surface-glass)] px-2.5 py-1.5 text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)] backdrop-blur-xl sm:left-4 sm:top-4 sm:max-w-none sm:px-3",onPointerDown:t=>t.stopPropagation(),children:[c.jsx(Rt,{className:"size-3.5"}),d?"Drag or pinch":"Drag to pan, scroll to zoom"]}),c.jsxs("div",{className:"absolute right-3 top-3 z-10 flex max-w-[calc(100%-1.5rem)] flex-wrap items-center justify-end gap-1.5 sm:right-4 sm:top-4 sm:max-w-none sm:gap-2",onPointerDown:t=>t.stopPropagation(),children:[c.jsx(ot,{type:"button",variant:"secondary",size:"sm",className:"px-2.5 sm:px-3","aria-label":"Zoom in",onClick:()=>{S.current=!0,k(I.scale*1.12,y.width-96,72)},children:c.jsx(zt,{className:"size-4"})}),c.jsx(ot,{type:"button",variant:"secondary",size:"sm",className:"px-2.5 sm:px-3","aria-label":"Zoom out",onClick:()=>{S.current=!0,k(I.scale*.88,y.width-96,72)},children:c.jsx(Ct,{className:"size-4"})}),c.jsxs(ot,{type:"button",variant:"secondary",size:"sm",className:"px-2.5 sm:min-w-[4.75rem] sm:px-3","aria-label":"Fit graph",onClick:()=>{S.current=!0,m()},children:[c.jsx(Pt,{className:"size-4"}),d?null:"Fit"]}),c.jsxs(ot,{type:"button",variant:"secondary",size:"sm",className:"px-2.5 sm:min-w-[5.5rem] sm:px-3","aria-label":"Reset graph",onClick:()=>{S.current=!1,m()},children:[c.jsx(Nt,{className:"size-4"}),d?null:"Reset"]})]}),r&&r.length>0&&!d?c.jsx("div",{className:"absolute bottom-4 left-4 z-10 flex flex-wrap items-center gap-2 rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--surface-glass)] px-3 py-2 text-xs text-[var(--ui-ink-soft)] backdrop-blur-xl",children:r.map(t=>{const a=t.kind?Bt(t.kind):t.tone??"slate",l=t.kind?gt(t.kind).icon:null;return c.jsxs("span",{className:"inline-flex items-center gap-2 whitespace-nowrap rounded-full bg-[var(--ui-surface-1)] px-2.5 py-1.5",children:[l?c.jsx(l,{className:"size-3.5",color:H[a],strokeWidth:2.1}):c.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:et[a]}}),t.label]},t.label)})}):null,c.jsxs("svg",{className:"relative z-[1] h-full w-full overflow-hidden",viewBox:`0 0 ${y.width||1200} ${y.height||760}`,role:"img","aria-label":x,style:{overflow:"hidden"},children:[c.jsx("defs",{children:c.jsx("filter",{id:"forge-graph-blur",children:c.jsx("feGaussianBlur",{stdDeviation:"34"})})}),c.jsxs("g",{transform:`translate(${I.x} ${I.y}) scale(${I.scale})`,children:[s.map(t=>c.jsx("ellipse",{cx:t.x,cy:t.y,rx:t.radiusX,ry:t.radiusY,fill:it[t.tone??"rose"],opacity:t.opacity??.42,filter:"url(#forge-graph-blur)"},t.id)),n.filter(t=>t.kind==="goal"||t.kind==="ghost").map(t=>{const a=t.radius??76;return c.jsx("g",{opacity:t.kind==="ghost"?.28:.55,children:[a+74,a+124].map((l,o)=>c.jsx("circle",{cx:t.x,cy:t.y,r:l,fill:"none",stroke:o===0?"var(--ui-border-subtle)":"var(--ui-border-strong)",strokeDasharray:o===0?"0":"10 10"},`${t.id}-ring-${l}`))},`${t.id}-orbital-lanes`)}),i.map(t=>{const a=Q.get(t.from),l=Q.get(t.to);if(!a||!l)return null;const o=vt(a),f=vt(l),Y=(o.x+f.x)/2,V=(o.y+f.y)/2,R=Math.max(24,Math.abs(o.x-f.x)*.08),_=Y,C=V-R;return c.jsx("path",{d:`M ${o.x} ${o.y} Q ${_} ${C} ${f.x} ${f.y}`,fill:"none",stroke:et[t.tone??"slate"],strokeWidth:t.strength==="high"?3:t.strength==="medium"?2.2:1.6,strokeDasharray:t.dashed?"8 8":void 0,opacity:nt&&t.from!==nt&&t.to!==nt?.18:.62},t.id)}),n.map(t=>{t.id;const a=E===t.id,l=nt===t.id,o=St(t),f=Gt(t),Y=Ft(t),V=wt(t.kind),R=V?gt(V).icon:null;if(t.kind==="goal"||t.kind==="value"||t.kind==="ghost"){const M=t.radius??(t.kind==="goal"?76:34),st=f?t.y-M-(t.kind==="goal"?18:10):null,yt=t.kind==="goal"?20:14.5,at=t.kind==="goal"?28:16,It=t.kind==="goal"?t.y-M*.34:t.kind==="value"?t.y-M*.3:t.y-M*.2,Yt=t.kind==="goal"?t.y+M*.2:t.y+10;return c.jsxs("g",{tabIndex:0,role:"button",onPointerEnter:()=>{q(t.id),g==null||g(t.id)},onPointerLeave:()=>q(F=>F===t.id?null:F),onFocus:()=>g==null?void 0:g(t.id),onClick:()=>rt(t),onKeyDown:F=>{(F.key==="Enter"||F.key===" ")&&(F.preventDefault(),rt(t))},className:"cursor-pointer outline-none",children:[c.jsx("circle",{cx:t.x,cy:t.y,r:M+(l?14:0),fill:l?it[o]:"transparent",stroke:l?et[o]:"transparent",opacity:a?.98:.9}),c.jsx("circle",{cx:t.x,cy:t.y,r:M+(a?2:0),fill:t.kind==="ghost"?"var(--ui-surface-1)":it[o],stroke:t.kind==="ghost"?"var(--ui-border-strong)":et[o],strokeDasharray:t.kind==="ghost"?"8 8":void 0,strokeWidth:l?2.8:1.6}),f?c.jsx("text",{x:t.x,y:st??t.y-12,textAnchor:"middle",fontSize:t.kind==="goal"?"11.5":"10.5",fill:t.kind==="ghost"?"var(--ui-ink-soft)":H[o],style:{letterSpacing:"0.18em",textTransform:"uppercase"},children:f}):null,R?c.jsx(R,{x:t.x-at/2,y:It-at/2,width:at,height:at,color:H[o],strokeWidth:2.1}):null,Y.map((F,bt)=>c.jsx("text",{x:t.x,y:Yt+bt*yt-(Y.length-1)*yt/2,textAnchor:"middle",fontSize:t.kind==="goal"?21:12.8,fontWeight:t.kind==="goal"?600:500,fill:t.kind==="ghost"?"var(--ui-ink-strong)":H[o],children:F},`${t.id}-${F}-${bt}`))]},t.id)}const _=t.width??146,C=t.height??58,J=t.x-_/2,B=t.y-C/2,T=t.kind==="project"?14:13,U=J+14,ct=B+13,ht=B+22,jt=f?B+C*.65:B+C*.56,pt=t.kind==="project"?16:15,Mt=t.kind==="project"?14.2:13.2;return c.jsxs("g",{tabIndex:0,role:"button",onPointerEnter:()=>{q(t.id),g==null||g(t.id)},onPointerLeave:()=>q(M=>M===t.id?null:M),onFocus:()=>g==null?void 0:g(t.id),onClick:()=>rt(t),onKeyDown:M=>{(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),rt(t))},className:"cursor-pointer outline-none",children:[c.jsx("rect",{x:J-(l?6:0),y:B-(l?6:0),rx:"28",ry:"28",width:_+(l?12:0),height:C+(l?12:0),fill:l?it[o]:"transparent"}),c.jsx("rect",{x:J-(a?2:0),y:B-(a?2:0),rx:"22",ry:"22",width:_+(a?4:0),height:C+(a?4:0),fill:it[o],stroke:et[o],strokeWidth:l?2.3:1.3}),R?c.jsx(R,{x:U,y:ct,width:T,height:T,color:H[o],strokeWidth:2.1}):null,f?c.jsx("text",{x:U+T+8,y:ht,textAnchor:"start",fontSize:"9.5",fill:H[o],style:{letterSpacing:"0.16em",textTransform:"uppercase",opacity:.82},children:f}):null,Y.map((M,st)=>c.jsx("text",{x:t.x,y:jt+st*pt-(Y.length-1)*pt/2,textAnchor:"middle",fontSize:Mt,fontWeight:600,fill:H[o],children:M},`${t.id}-${M}-${st}`))]},t.id)})]})]})]})]})}export{At as P,Wt as b};
|
|
1
|
+
import{r as $,b6 as Xt,j as c,cD as Rt,bX as zt,ch as Ct,cE as Pt,cF as Nt}from"./vendor-Cpmju3nw.js";import{c as dt,B as ot,a as gt}from"./index-BejvcRGb.js";function Z(n,i,s){return`${i}:${n}:${s}`}function ft(n,i,s){return Math.min(Math.max(n,i),s)}function mt(n,i,s){return Math.min(s,Math.max(1,Math.ceil(n.trim().length/i)))}function _t(n,{compact:i}){const s=mt(n,i?13:14,4),p=(i?114:156)+(s-1)*(i?12:18)+Math.min(24,Math.max(0,n.trim().length-18))*(i?.7:1);return ft(p,i?118:164,i?154:210)}function Tt(n,{compact:i}){const s=mt(n,i?11:13,3),p=(i?40:48)+(s-1)*(i?6:8)+Math.min(i?18:26,Math.max(0,n.trim().length-(i?12:16)))*(i?.45:.55);return ft(p,i?42:50,i?56:68)}function tt(n,{compact:i,emphasis:s=!1}){const p=mt(n,i?16:s?22:20,s?3:2);return{width:ft((i?s?184:152:s?224:176)+Math.min(n.length,48)*(i?1.8:2.15),i?s?188:156:s?228:184,i?s?248:208:s?300:244),height:p===1?i?64:70:p===2?i?82:92:i?98:110}}function kt(n){if(n.kind==="goal"||n.kind==="value"||n.kind==="ghost"){const i=n.radius??(n.kind==="goal"?76:34);return{halfWidth:i,halfHeight:i}}return{halfWidth:(n.width??146)/2,halfHeight:(n.height??58)/2}}function Et(n,{compact:i}){const s=n.map(u=>({...u,homeX:u.x,homeY:u.y,locked:u.kind==="goal"||u.kind==="ghost"})),x=i?28:40,p=i?.08:.06;for(let u=0;u<180;u+=1){for(const r of s)r.locked||(r.x+=(r.homeX-r.x)*p,r.y+=(r.homeY-r.y)*p);for(let r=0;r<s.length;r+=1)for(let v=r+1;v<s.length;v+=1){const g=s[r],w=s[v],h=kt(g),L=kt(w),j=w.x-g.x,z=w.y-g.y,y=h.halfWidth+L.halfWidth+x-Math.abs(j),b=h.halfHeight+L.halfHeight+x-Math.abs(z);if(y<=0||b<=0)continue;const I=y<b?"x":"y",P=Math.sign(I==="x"?j||v-r||1:z||v-r||1),E=(I==="x"?y:b)/(g.locked||w.locked?1:2);g.locked||(I==="x"?g.x-=P*E:g.y-=P*E),w.locked||(I==="x"?w.x+=P*E:w.y+=P*E)}}return s.map(({homeX:u,homeY:r,locked:v,...g})=>g)}function Dt(){return{nodes:[{id:"ghost_goal_north",kind:"ghost",x:-250,y:-20,radius:68,label:"First goal",meta:"Goal",href:"/goals"},{id:"ghost_goal_center",kind:"ghost",x:0,y:34,radius:74,label:"Life goals",meta:"Goal",href:"/goals"},{id:"ghost_goal_south",kind:"ghost",x:250,y:-10,radius:68,label:"Direction",meta:"Goal",href:"/goals"}],edges:[],fields:[],inspectors:{ghost_goal_center:{id:"ghost_goal_center",eyebrow:"Goals",title:"Add the first life goal",summary:"The graph is already laid out. Once a goal exists, values, reports, beliefs, and behaviors will start orbiting it instead of staying fragmented.",href:"/goals",ctaLabel:"Open life goals",tone:"sky",entityKind:"goal",chips:["Goals","Values","Reports"],stats:["0 goals mapped yet"]}},defaultSelectedId:"ghost_goal_center"}}function Wt(n,{compact:i=!1}={}){var w;if(n.length===0)return Dt();const s=[],x=[],p=[],u={},r=i?560:840,v=-((n.length-1)*r)/2;n.forEach((h,L)=>{const j=v+L*r,z=L%2===0?92:146,y=h.linkedBehaviors.length+h.linkedBeliefs.length+h.linkedReports.length+h.linkedHabits.length,b=`goal:${h.goal.id}`;s.push({id:b,kind:"goal",x:j,y:z,radius:_t(h.goal.title,{compact:i}),tone:"amber",label:h.goal.title,href:`/goals/${h.goal.id}`}),u[b]={id:b,eyebrow:"Goal",title:h.goal.title,summary:h.goal.description,href:`/goals/${h.goal.id}`,ctaLabel:"Open goal",tone:"amber",entityKind:"goal",chips:h.linkedValues.slice(0,4).map(e=>e.title),stats:[`${h.linkedValues.length} linked value${h.linkedValues.length===1?"":"s"}`,`${h.linkedProjects.length} live project${h.linkedProjects.length===1?"":"s"}`,`${h.linkedHabits.length} linked habit${h.linkedHabits.length===1?"":"s"}`,`${y} friction signal${y===1?"":"s"}`]},y>0&&p.push({id:`field:${h.goal.id}`,x:j+18,y:z+20,radiusX:i?144:176,radiusY:i?104:132,tone:"rose",opacity:Math.min(.42,.14+y*.04)});const I=i?208:282;h.linkedValues.slice(0,i?4:5).forEach((e,d)=>{const m=(-95+d*(i?78:64))*(Math.PI/180),k=Tt(e.title,{compact:i}),G=j+Math.cos(m)*I,W=z+Math.sin(m)*I,A=Z(h.goal.id,"value",e.id);s.push({id:A,kind:"value",x:G,y:W,radius:k,tone:"mint",label:e.title,meta:`${e.linkedGoalIds.length} goal${e.linkedGoalIds.length===1?"":"s"}`,href:`/psyche/values?focus=${e.id}#values-atlas`}),x.push({id:`${b}->${A}`,from:b,to:A,tone:"mint",strength:"medium"}),u[A]={id:A,eyebrow:"Value",title:e.title,summary:e.valuedDirection||e.whyItMatters||e.description,href:`/psyche/values?focus=${e.id}#values-atlas`,ctaLabel:"Open values",tone:"mint",entityKind:"value",chips:e.committedActions.slice(0,3),stats:[`${e.linkedProjectIds.length} linked project${e.linkedProjectIds.length===1?"":"s"}`,`${e.linkedTaskIds.length} linked task${e.linkedTaskIds.length===1?"":"s"}`]}});const P=h.linkedProjects.slice(0,i?2:3).map(e=>({project:e,size:tt(e.title,{compact:i,emphasis:!0})})),E=i?24:30;let N=-(P.reduce((e,d)=>e+d.size.width,0)+Math.max(0,P.length-1)*E)/2;P.forEach(({project:e,size:d},m)=>{const k=Z(h.goal.id,"project",e.id),G=j+N+d.width/2,W=z-(i?330:434)-m*(i?16:20);N+=d.width+E,s.push({id:k,kind:"project",x:G,y:W,width:d.width,height:d.height,tone:"sky",label:e.title,meta:"Project",href:`/projects/${e.id}`}),x.push({id:`${b}->${k}`,from:b,to:k,tone:"sky",strength:"medium"}),u[k]={id:k,eyebrow:"Project",title:e.title,summary:e.description,href:`/projects/${e.id}`,ctaLabel:"Open project",tone:"sky",entityKind:"project",chips:[e.status,e.goalTitle],stats:[`${e.progress}% progress`,`${e.activeTaskCount} active task${e.activeTaskCount===1?"":"s"}`]}}),h.linkedHabits.slice(0,i?2:3).forEach((e,d)=>{const m=Z(h.goal.id,"habit",e.id),k=tt(e.title,{compact:i}),G=j-(i?44:58),W=z+(i?228:294)+d*(i?92:104);s.push({id:m,kind:"habit",x:G,y:W,width:k.width,height:k.height,tone:"mint",label:e.title,meta:e.polarity,href:"/habits"}),x.push({id:`${b}->${m}`,from:b,to:m,tone:"mint",strength:e.dueToday?"high":"medium"}),u[m]={id:m,eyebrow:"Habit",title:e.title,summary:e.description||"Recurring operating record connected directly to this goal field.",href:"/habits",ctaLabel:"Open habits",tone:"mint",entityKind:"habit",chips:[e.polarity,e.frequency,e.dueToday?"due today":"checked in"],stats:[`${e.streakCount} streak`,`${e.rewardXp}/${e.penaltyXp} xp flow`]}});let O=z+(i?132:156);h.linkedBehaviors.slice(0,i?2:3).forEach(e=>{const d=Z(h.goal.id,"behavior",e.id),m=tt(e.title,{compact:i}),k=j-(i?272:352);s.push({id:d,kind:"behavior",x:k,y:O,width:m.width,height:m.height,tone:"orange",label:e.title,meta:e.kind,href:`/psyche/behaviors?focus=${e.id}#behavior-columns`}),x.push({id:`${b}->${d}`,from:b,to:d,tone:"orange",dashed:e.kind!=="committed",strength:e.kind==="committed"?"medium":"low"}),u[d]={id:d,eyebrow:"Behavior",title:e.title,summary:e.replacementMove||e.description||e.urgeStory,href:`/psyche/behaviors?focus=${e.id}#behavior-columns`,ctaLabel:"Open behaviors",tone:"orange",entityKind:"behavior",chips:[e.kind,...e.commonCues.slice(0,2)],stats:[e.shortTermPayoff?"Short-term payoff mapped":"Payoff still to map",e.longTermCost?"Long-term cost mapped":"Cost still to map"]},O+=m.height+(i?18:22)});let X=z+(i?8:10);h.linkedBeliefs.slice(0,i?2:3).forEach(e=>{const d=Z(h.goal.id,"belief",e.id),m=tt(e.statement,{compact:i,emphasis:!0}),k=j+(i?278:362);s.push({id:d,kind:"belief",x:k,y:X,width:m.width,height:m.height,tone:"violet",label:e.statement,meta:"belief",href:`/psyche/schemas-beliefs?focus=${e.id}`}),x.push({id:`${b}->${d}`,from:b,to:d,tone:"violet",dashed:!0,strength:"low"}),u[d]={id:d,eyebrow:"Belief",title:e.statement,summary:e.flexibleAlternative||e.originNote||"Belief script attached to this part of the map.",href:`/psyche/schemas-beliefs?focus=${e.id}`,ctaLabel:"Open beliefs",tone:"violet",entityKind:"belief",chips:[e.beliefType,`${e.confidence}% grip`],stats:[`${e.linkedBehaviorIds.length} linked behavior${e.linkedBehaviorIds.length===1?"":"s"}`,`${e.linkedReportIds.length} linked report${e.linkedReportIds.length===1?"":"s"}`]},X+=m.height+(i?18:22)});const D=h.linkedReports.slice(0,i?2:3).map(e=>({report:e,size:tt(e.title,{compact:i})})),K=i?20:26;let Q=-(D.reduce((e,d)=>e+d.size.width,0)+Math.max(0,D.length-1)*K)/2;D.forEach(({report:e,size:d})=>{const m=Z(h.goal.id,"report",e.id),k=j+Q+d.width/2,G=z+(i?332:430);Q+=d.width+K,s.push({id:m,kind:"report",x:k,y:G,width:d.width,height:d.height,tone:"blue",label:e.title,meta:e.status,href:`/psyche/reports/${e.id}`}),x.push({id:`${b}->${m}`,from:b,to:m,tone:"sky",strength:"medium"}),u[m]={id:m,eyebrow:"Report",title:e.title,summary:e.eventSituation||e.customEventType||"Reflective chain linked into this goal.",href:`/psyche/reports/${e.id}`,ctaLabel:"Open report",tone:"blue",entityKind:"report",chips:[e.status,...e.nextMoves.slice(0,2)],stats:[`${e.emotions.length} emotion${e.emotions.length===1?"":"s"}`,`${e.behaviors.length} move${e.behaviors.length===1?"":"s"}`]}})});const g=((w=s[0])==null?void 0:w.id)??"ghost_goal_center";return{nodes:Et(s,{compact:i}),edges:x,fields:p,inspectors:u,defaultSelectedId:g}}const et={mint:"color-mix(in srgb, var(--success) 64%, transparent)",sky:"color-mix(in srgb, var(--info) 66%, transparent)",violet:"color-mix(in srgb, var(--primary) 72%, transparent)",rose:"color-mix(in srgb, var(--danger) 68%, transparent)",amber:"color-mix(in srgb, var(--warning) 68%, transparent)",orange:"color-mix(in srgb, var(--tertiary) 72%, transparent)",blue:"color-mix(in srgb, var(--info) 72%, transparent)",slate:"color-mix(in srgb, var(--ui-ink-soft) 52%, transparent)"},it={mint:"color-mix(in srgb, var(--success) 18%, transparent)",sky:"color-mix(in srgb, var(--info) 18%, transparent)",violet:"color-mix(in srgb, var(--primary) 18%, transparent)",rose:"color-mix(in srgb, var(--danger) 18%, transparent)",amber:"color-mix(in srgb, var(--warning) 18%, transparent)",orange:"color-mix(in srgb, var(--tertiary) 18%, transparent)",blue:"color-mix(in srgb, var(--info) 18%, transparent)",slate:"color-mix(in srgb, var(--ui-ink-soft) 12%, transparent)"},H={mint:"color-mix(in srgb, var(--success) 56%, var(--ui-ink-strong) 44%)",sky:"color-mix(in srgb, var(--info) 56%, var(--ui-ink-strong) 44%)",violet:"color-mix(in srgb, var(--primary) 60%, var(--ui-ink-strong) 40%)",rose:"color-mix(in srgb, var(--danger) 58%, var(--ui-ink-strong) 42%)",amber:"color-mix(in srgb, var(--warning) 60%, var(--ui-ink-strong) 40%)",orange:"color-mix(in srgb, var(--tertiary) 60%, var(--ui-ink-strong) 40%)",blue:"color-mix(in srgb, var(--info) 58%, var(--ui-ink-strong) 42%)",slate:"var(--ui-ink-medium)"};function wt(n){switch(n){case"goal":case"value":case"behavior":case"belief":case"report":case"project":case"habit":return n;default:return null}}function St(n){if(n.tone)return n.tone;switch(n.kind){case"goal":return"amber";case"value":return"mint";case"belief":return"violet";case"behavior":return"orange";case"project":return"sky";case"habit":return"mint";case"report":return"blue";default:return"slate"}}function Gt(n){if(n.kind==="ghost")return n.meta??null;const i=wt(n.kind);return i?gt(i).label:n.meta??null}function ut(n,i,s){return Math.min(Math.max(n,i),s)}function lt(n,i,s=3){const x=n.trim().split(/\s+/),p=[];let u="";for(let g=0;g<x.length;g+=1){const w=x[g],h=u?`${u} ${w}`:w;if(h.length>i&&u){if(p.push(u),p.length>=s-1){u=[w,...x.slice(g+1)].join(" ");break}u=w}else u=h}u&&p.push(u);const r=p.slice(0,s),v=r.length-1;return v>=0&&r[v].length>i&&(r[v]=`${r[v].slice(0,Math.max(1,i-1)).trimEnd()}…`),r}function Vt(n,i){if(n.length===0&&i.length===0)return{minX:-360,maxX:360,minY:-240,maxY:240};let s=Number.POSITIVE_INFINITY,x=Number.NEGATIVE_INFINITY,p=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY;for(const r of n){const v=r.kind==="goal"||r.kind==="value"||r.kind==="ghost"?r.radius??32:(r.width??124)/2,g=r.kind==="goal"||r.kind==="value"||r.kind==="ghost"?r.radius??32:(r.height??56)/2,w=r.meta&&(r.kind==="goal"||r.kind==="ghost")?48:0;s=Math.min(s,r.x-v),x=Math.max(x,r.x+v),p=Math.min(p,r.y-g-w),u=Math.max(u,r.y+g)}for(const r of i)s=Math.min(s,r.x-r.radiusX),x=Math.max(x,r.x+r.radiusX),p=Math.min(p,r.y-r.radiusY),u=Math.max(u,r.y+r.radiusY);return{minX:s,maxX:x,minY:p,maxY:u}}function vt(n){return{x:n.x,y:n.y}}function Ft(n){if(n.kind==="goal"){const i=n.radius??112;return lt(n.label,Math.max(14,Math.floor(i/7.2)),4)}if(n.kind==="value"||n.kind==="ghost"){const i=n.radius??40;return lt(n.label,Math.max(12,Math.floor(i/3)),3)}return n.kind==="project"?lt(n.label,Math.max(18,Math.floor((n.width??220)/10)),3):lt(n.label,Math.max(16,Math.floor((n.width??180)/10.5)),2)}function Bt(n){switch(n){case"goal":return"amber";case"project":return"sky";case"value":return"mint";case"behavior":return"orange";case"belief":return"violet";case"report":return"blue";default:return"slate"}}function At({nodes:n,edges:i,fields:s=[],title:x,hint:p,action:u,legend:r,selectedNodeId:v,onSelectNode:g,minHeightClassName:w="min-h-[34rem] lg:min-h-[44rem]",compact:h=!1,testId:L}){const j=$.useRef(null),z=Xt(),[y,b]=$.useState({width:0,height:0}),[I,P]=$.useState({scale:1,x:0,y:0}),[E,q]=$.useState(null),N=$.useRef(null),O=$.useRef({scale:1,x:0,y:0}),X=$.useRef(new Map),D=$.useRef(null),K=$.useRef(0),S=$.useRef(!1),Q=$.useMemo(()=>new Map(n.map(t=>[t.id,t])),[n]),e=$.useMemo(()=>Vt(n,s),[s,n]),d=y.width>0&&y.width<640;$.useEffect(()=>{if(!j.current||typeof ResizeObserver>"u")return;const t=new ResizeObserver(a=>{const l=a[0];b({width:l.contentRect.width,height:l.contentRect.height})});return t.observe(j.current),()=>t.disconnect()},[]);const m=$.useCallback(()=>{if(!y.width||!y.height)return;const t=d?260:h?140:190,a=Math.max(e.maxX-e.minX,1),l=Math.max(e.maxY-e.minY,1),o=ut(Math.min(y.width/(a+t),y.height/(l+t)),d?.16:h?.4:.46,d?.76:h?1.04:1.18),f=(e.minX+e.maxX)/2,Y=(e.minY+e.maxY)/2;P({scale:o,x:y.width/2-f*o,y:y.height/2-Y*o})},[e.maxX,e.maxY,e.minX,e.minY,h,y.height,y.width,d]);$.useEffect(()=>{O.current=I},[I]),$.useEffect(()=>{S.current||m()},[m]);const k=$.useCallback((t,a,l)=>{const o=ut(t,.28,1.9);P(f=>{if(a==null||l==null)return{...f,scale:o};const Y=(a-f.x)/f.scale,V=(l-f.y)/f.scale;return{scale:o,x:a-Y*o,y:l-V*o}})},[]),G=$.useCallback(()=>{const t=[...X.current.values()];if(t.length<2){D.current=null;return}const[a,l]=t,o=Math.hypot(l.x-a.x,l.y-a.y);if(!Number.isFinite(o)||o<=0){D.current=null;return}const f=O.current;D.current={startDistance:o,startScale:f.scale,startViewportX:f.x,startViewportY:f.y,startMidpointX:(a.x+l.x)/2,startMidpointY:(a.y+l.y)/2}},[]),W=t=>{var o;t.preventDefault();const a=(o=j.current)==null?void 0:o.getBoundingClientRect();if(!a)return;S.current=!0;const l=t.deltaY<0?1.1:.9;k(I.scale*l,t.clientX-a.left,t.clientY-a.top)},A=t=>{var f;const a=(f=j.current)==null?void 0:f.getBoundingClientRect(),l=t.clientX-((a==null?void 0:a.left)??0),o=t.clientY-((a==null?void 0:a.top)??0);if(X.current.set(t.pointerId,{x:l,y:o}),X.current.size===1){const Y=O.current;N.current={pointerId:t.pointerId,originX:Y.x,originY:Y.y,startX:l,startY:o}}else N.current=null,G();t.currentTarget.setPointerCapture(t.pointerId)},$t=t=>{var V;const a=(V=j.current)==null?void 0:V.getBoundingClientRect(),l=t.clientX-((a==null?void 0:a.left)??0),o=t.clientY-((a==null?void 0:a.top)??0);if(X.current.has(t.pointerId)&&X.current.set(t.pointerId,{x:l,y:o}),D.current&&X.current.size>=2){const[R,_]=[...X.current.values()],C=Math.hypot(_.x-R.x,_.y-R.y);if(Number.isFinite(C)&&C>0){S.current=!0,K.current=Date.now()+240;const J=(R.x+_.x)/2,B=(R.y+_.y)/2,T=D.current,U=ut(T.startScale*C/T.startDistance,.24,1.42),ct=(T.startMidpointX-T.startViewportX)/T.startScale,ht=(T.startMidpointY-T.startViewportY)/T.startScale;P({scale:U,x:J-ct*U,y:B-ht*U})}return}if(!N.current||N.current.pointerId!==t.pointerId||X.current.size!==1)return;S.current=!0;const f=l-N.current.startX,Y=o-N.current.startY;(Math.abs(f)>3||Math.abs(Y)>3)&&(K.current=Date.now()+240),P(R=>{var _,C;return{...R,x:(((_=N.current)==null?void 0:_.originX)??R.x)+f,y:(((C=N.current)==null?void 0:C.originY)??R.y)+Y}})},xt=t=>{if(X.current.delete(t.pointerId),X.current.size<2&&(D.current=null),X.current.size===1){const[a,l]=[...X.current.entries()][0]??[];if(a!=null&&l){const o=O.current;N.current={pointerId:a,originX:o.x,originY:o.y,startX:l.x,startY:l.y}}}else N.current=null;t.currentTarget.hasPointerCapture(t.pointerId)&&t.currentTarget.releasePointerCapture(t.pointerId)},nt=E??v??null,rt=$.useCallback(t=>{Date.now()<K.current||(g==null||g(t.id),t.href&&z(t.href))},[z,g]);return c.jsxs("section",{"data-testid":L,className:dt("overflow-hidden rounded-[32px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-section)] shadow-[var(--card-shadow)]","px-3 py-3 sm:px-4 sm:py-4 lg:px-5 lg:py-5"),children:[c.jsxs("div",{className:"mb-3 flex min-w-0 flex-wrap items-start justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--info)]",children:"Gravity well"}),c.jsx("h2",{className:dt("mt-2 break-words font-display leading-none text-[var(--ui-ink-strong)]",h?"text-[clamp(1.25rem,2vw,1.7rem)]":"text-[clamp(1.45rem,2.8vw,2.3rem)]"),children:x}),p?c.jsx("p",{className:"mt-1.5 max-w-3xl break-words text-sm leading-6 text-[var(--ui-ink-soft)]",children:d?"Select a node, pan the field, and open the full map when you need the wider structure.":p}):null]}),c.jsx("div",{className:"flex min-w-0 flex-wrap items-center justify-end gap-2",children:u})]}),c.jsxs("div",{ref:j,className:dt("group relative overflow-hidden rounded-[30px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] touch-none",w),style:{touchAction:"none"},onWheel:W,onPointerDown:A,onPointerMove:$t,onPointerUp:xt,onPointerCancel:xt,children:[c.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_center,color-mix(in_srgb,var(--success)_8%,transparent),transparent_28%),radial-gradient(circle_at_20%_20%,color-mix(in_srgb,var(--primary)_10%,transparent),transparent_24%),var(--ui-surface-section)]"}),c.jsxs("div",{className:"absolute left-3 top-3 z-10 inline-flex max-w-[calc(100%-7rem)] items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--surface-glass)] px-2.5 py-1.5 text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)] backdrop-blur-xl sm:left-4 sm:top-4 sm:max-w-none sm:px-3",onPointerDown:t=>t.stopPropagation(),children:[c.jsx(Rt,{className:"size-3.5"}),d?"Drag or pinch":"Drag to pan, scroll to zoom"]}),c.jsxs("div",{className:"absolute right-3 top-3 z-10 flex max-w-[calc(100%-1.5rem)] flex-wrap items-center justify-end gap-1.5 sm:right-4 sm:top-4 sm:max-w-none sm:gap-2",onPointerDown:t=>t.stopPropagation(),children:[c.jsx(ot,{type:"button",variant:"secondary",size:"sm",className:"px-2.5 sm:px-3","aria-label":"Zoom in",onClick:()=>{S.current=!0,k(I.scale*1.12,y.width-96,72)},children:c.jsx(zt,{className:"size-4"})}),c.jsx(ot,{type:"button",variant:"secondary",size:"sm",className:"px-2.5 sm:px-3","aria-label":"Zoom out",onClick:()=>{S.current=!0,k(I.scale*.88,y.width-96,72)},children:c.jsx(Ct,{className:"size-4"})}),c.jsxs(ot,{type:"button",variant:"secondary",size:"sm",className:"px-2.5 sm:min-w-[4.75rem] sm:px-3","aria-label":"Fit graph",onClick:()=>{S.current=!0,m()},children:[c.jsx(Pt,{className:"size-4"}),d?null:"Fit"]}),c.jsxs(ot,{type:"button",variant:"secondary",size:"sm",className:"px-2.5 sm:min-w-[5.5rem] sm:px-3","aria-label":"Reset graph",onClick:()=>{S.current=!1,m()},children:[c.jsx(Nt,{className:"size-4"}),d?null:"Reset"]})]}),r&&r.length>0&&!d?c.jsx("div",{className:"absolute bottom-4 left-4 z-10 flex flex-wrap items-center gap-2 rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--surface-glass)] px-3 py-2 text-xs text-[var(--ui-ink-soft)] backdrop-blur-xl",children:r.map(t=>{const a=t.kind?Bt(t.kind):t.tone??"slate",l=t.kind?gt(t.kind).icon:null;return c.jsxs("span",{className:"inline-flex items-center gap-2 whitespace-nowrap rounded-full bg-[var(--ui-surface-1)] px-2.5 py-1.5",children:[l?c.jsx(l,{className:"size-3.5",color:H[a],strokeWidth:2.1}):c.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:et[a]}}),t.label]},t.label)})}):null,c.jsxs("svg",{className:"relative z-[1] h-full w-full overflow-hidden",viewBox:`0 0 ${y.width||1200} ${y.height||760}`,role:"img","aria-label":x,style:{overflow:"hidden"},children:[c.jsx("defs",{children:c.jsx("filter",{id:"forge-graph-blur",children:c.jsx("feGaussianBlur",{stdDeviation:"34"})})}),c.jsxs("g",{transform:`translate(${I.x} ${I.y}) scale(${I.scale})`,children:[s.map(t=>c.jsx("ellipse",{cx:t.x,cy:t.y,rx:t.radiusX,ry:t.radiusY,fill:it[t.tone??"rose"],opacity:t.opacity??.42,filter:"url(#forge-graph-blur)"},t.id)),n.filter(t=>t.kind==="goal"||t.kind==="ghost").map(t=>{const a=t.radius??76;return c.jsx("g",{opacity:t.kind==="ghost"?.28:.55,children:[a+74,a+124].map((l,o)=>c.jsx("circle",{cx:t.x,cy:t.y,r:l,fill:"none",stroke:o===0?"var(--ui-border-subtle)":"var(--ui-border-strong)",strokeDasharray:o===0?"0":"10 10"},`${t.id}-ring-${l}`))},`${t.id}-orbital-lanes`)}),i.map(t=>{const a=Q.get(t.from),l=Q.get(t.to);if(!a||!l)return null;const o=vt(a),f=vt(l),Y=(o.x+f.x)/2,V=(o.y+f.y)/2,R=Math.max(24,Math.abs(o.x-f.x)*.08),_=Y,C=V-R;return c.jsx("path",{d:`M ${o.x} ${o.y} Q ${_} ${C} ${f.x} ${f.y}`,fill:"none",stroke:et[t.tone??"slate"],strokeWidth:t.strength==="high"?3:t.strength==="medium"?2.2:1.6,strokeDasharray:t.dashed?"8 8":void 0,opacity:nt&&t.from!==nt&&t.to!==nt?.18:.62},t.id)}),n.map(t=>{t.id;const a=E===t.id,l=nt===t.id,o=St(t),f=Gt(t),Y=Ft(t),V=wt(t.kind),R=V?gt(V).icon:null;if(t.kind==="goal"||t.kind==="value"||t.kind==="ghost"){const M=t.radius??(t.kind==="goal"?76:34),st=f?t.y-M-(t.kind==="goal"?18:10):null,yt=t.kind==="goal"?20:14.5,at=t.kind==="goal"?28:16,It=t.kind==="goal"?t.y-M*.34:t.kind==="value"?t.y-M*.3:t.y-M*.2,Yt=t.kind==="goal"?t.y+M*.2:t.y+10;return c.jsxs("g",{tabIndex:0,role:"button",onPointerEnter:()=>{q(t.id),g==null||g(t.id)},onPointerLeave:()=>q(F=>F===t.id?null:F),onFocus:()=>g==null?void 0:g(t.id),onClick:()=>rt(t),onKeyDown:F=>{(F.key==="Enter"||F.key===" ")&&(F.preventDefault(),rt(t))},className:"cursor-pointer outline-none",children:[c.jsx("circle",{cx:t.x,cy:t.y,r:M+(l?14:0),fill:l?it[o]:"transparent",stroke:l?et[o]:"transparent",opacity:a?.98:.9}),c.jsx("circle",{cx:t.x,cy:t.y,r:M+(a?2:0),fill:t.kind==="ghost"?"var(--ui-surface-1)":it[o],stroke:t.kind==="ghost"?"var(--ui-border-strong)":et[o],strokeDasharray:t.kind==="ghost"?"8 8":void 0,strokeWidth:l?2.8:1.6}),f?c.jsx("text",{x:t.x,y:st??t.y-12,textAnchor:"middle",fontSize:t.kind==="goal"?"11.5":"10.5",fill:t.kind==="ghost"?"var(--ui-ink-soft)":H[o],style:{letterSpacing:"0.18em",textTransform:"uppercase"},children:f}):null,R?c.jsx(R,{x:t.x-at/2,y:It-at/2,width:at,height:at,color:H[o],strokeWidth:2.1}):null,Y.map((F,bt)=>c.jsx("text",{x:t.x,y:Yt+bt*yt-(Y.length-1)*yt/2,textAnchor:"middle",fontSize:t.kind==="goal"?21:12.8,fontWeight:t.kind==="goal"?600:500,fill:t.kind==="ghost"?"var(--ui-ink-strong)":H[o],children:F},`${t.id}-${F}-${bt}`))]},t.id)}const _=t.width??146,C=t.height??58,J=t.x-_/2,B=t.y-C/2,T=t.kind==="project"?14:13,U=J+14,ct=B+13,ht=B+22,jt=f?B+C*.65:B+C*.56,pt=t.kind==="project"?16:15,Mt=t.kind==="project"?14.2:13.2;return c.jsxs("g",{tabIndex:0,role:"button",onPointerEnter:()=>{q(t.id),g==null||g(t.id)},onPointerLeave:()=>q(M=>M===t.id?null:M),onFocus:()=>g==null?void 0:g(t.id),onClick:()=>rt(t),onKeyDown:M=>{(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),rt(t))},className:"cursor-pointer outline-none",children:[c.jsx("rect",{x:J-(l?6:0),y:B-(l?6:0),rx:"28",ry:"28",width:_+(l?12:0),height:C+(l?12:0),fill:l?it[o]:"transparent"}),c.jsx("rect",{x:J-(a?2:0),y:B-(a?2:0),rx:"22",ry:"22",width:_+(a?4:0),height:C+(a?4:0),fill:it[o],stroke:et[o],strokeWidth:l?2.3:1.3}),R?c.jsx(R,{x:U,y:ct,width:T,height:T,color:H[o],strokeWidth:2.1}):null,f?c.jsx("text",{x:U+T+8,y:ht,textAnchor:"start",fontSize:"9.5",fill:H[o],style:{letterSpacing:"0.16em",textTransform:"uppercase",opacity:.82},children:f}):null,Y.map((M,st)=>c.jsx("text",{x:t.x,y:jt+st*pt-(Y.length-1)*pt/2,textAnchor:"middle",fontSize:Mt,fontWeight:600,fill:H[o],children:M},`${t.id}-${M}-${st}`))]},t.id)})]})]})]})]})}export{At as P,Wt as b};
|