ltcai 9.9.0 → 9.9.2
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/README.md +41 -35
- package/bin/ltcai.js +1 -1
- package/desktop/electron/main.cjs +1 -1
- package/docs/CHANGELOG.md +83 -0
- package/docs/CI_AND_RELEASE_GATES.md +1 -1
- package/docs/COMMUNITY_AND_PLUGINS.md +1 -1
- package/docs/DEVELOPMENT.md +1 -1
- package/docs/LEGACY_COMPATIBILITY.md +48 -49
- package/docs/ONBOARDING.md +1 -1
- package/docs/OPERATIONS.md +1 -1
- package/docs/TRUST_MODEL.md +1 -1
- package/docs/WHY_LATTICE.md +1 -1
- package/docs/kg-schema.md +6 -6
- package/lattice_brain/__init__.py +1 -1
- package/lattice_brain/graph/schema.py +1 -1
- package/lattice_brain/runtime/multi_agent.py +1 -1
- package/latticeai/__init__.py +1 -1
- package/latticeai/api/chat.py +3 -0
- package/latticeai/api/chat_agent_http.py +2 -1
- package/latticeai/api/chat_intents.py +130 -7
- package/latticeai/app_factory.py +1 -0
- package/latticeai/core/agent.py +114 -2
- package/latticeai/core/file_generation.py +58 -0
- package/latticeai/core/legacy_compatibility.py +71 -47
- package/latticeai/core/marketplace.py +1 -1
- package/latticeai/core/workspace_os.py +1 -1
- package/latticeai/services/app_context.py +3 -0
- package/latticeai/services/architecture_readiness.py +1 -1
- package/latticeai/services/product_readiness.py +7 -2
- package/latticeai/services/tool_dispatch.py +36 -0
- package/latticeai/tools/__init__.py +1 -1
- package/latticeai/tools/knowledge.py +1 -1
- package/package.json +6 -16
- package/scripts/check_current_release_docs.mjs +20 -1
- package/scripts/check_legacy_debt.mjs +91 -0
- package/scripts/prune_release_evidence.mjs +38 -0
- package/scripts/wheel_smoke.py +22 -6
- package/src-tauri/Cargo.lock +1 -1
- package/src-tauri/Cargo.toml +1 -1
- package/src-tauri/src/main.rs +12 -12
- package/src-tauri/tauri.conf.json +1 -13
- package/static/app/asset-manifest.json +27 -27
- package/static/app/assets/Act-Cx_gZNbE.js +1 -0
- package/static/app/assets/{Brain-Cgkh0Hpn.js → Brain-BnGbytHa.js} +2 -2
- package/static/app/assets/BrainHome-CRUMJL93.js +2 -0
- package/static/app/assets/BrainSignals-BP8-Qh2g.js +1 -0
- package/static/app/assets/Capture-CAKnLcb0.js +1 -0
- package/static/app/assets/CommandPalette-BoUTXBfm.js +1 -0
- package/static/app/assets/Library-PcfVUco6.js +1 -0
- package/static/app/assets/LivingBrain-C3VbogVo.js +1 -0
- package/static/app/assets/ProductFlow-BLau7c7N.js +1 -0
- package/static/app/assets/ReviewCard-CX5RqRqx.js +1 -0
- package/static/app/assets/System-DRHc_6Su.js +1 -0
- package/static/app/assets/bot-DZkDdh-A.js +1 -0
- package/static/app/assets/cpu-DyvsDBbj.js +1 -0
- package/static/app/assets/download-C7yxYHvz.js +1 -0
- package/static/app/assets/folder-open-CffoIr9t.js +1 -0
- package/static/app/assets/hard-drive-C1oojrHb.js +1 -0
- package/static/app/assets/{index-BjaXCeOZ.js → index-BS_3aN1n.js} +3 -3
- package/static/app/assets/index-DU78Kogz.css +2 -0
- package/static/app/assets/input-B_U7zvbR.js +1 -0
- package/static/app/assets/navigation-xG-gyjbe.js +1 -0
- package/static/app/assets/network-BF13HJJF.js +1 -0
- package/static/app/assets/primitives-DsuKh3M8.js +1 -0
- package/static/app/assets/sunrise-CIP2ELJ1.js +1 -0
- package/static/app/assets/textarea-DsDL4ET8.js +1 -0
- package/static/app/assets/utils-Dh-Dwtkb.js +7 -0
- package/static/app/index.html +4 -4
- package/static/sw.js +1 -1
- package/auto_setup.py +0 -21
- package/kg_schema.py +0 -13
- package/knowledge_graph.py +0 -51
- package/knowledge_graph_api.py +0 -24
- package/llm_router.py +0 -20
- package/local_knowledge_api.py +0 -16
- package/ltcai_cli.py +0 -21
- package/mcp_registry.py +0 -20
- package/p_reinforce.py +0 -16
- package/setup_wizard.py +0 -16
- package/static/app/assets/Act-CfOPUKPs.js +0 -2
- package/static/app/assets/BrainHome-D8e3wQiW.js +0 -3
- package/static/app/assets/BrainSignals-BjRBA18L.js +0 -1
- package/static/app/assets/Capture-CQQYQ1Ga.js +0 -1
- package/static/app/assets/CommandPalette-pss56Mg4.js +0 -1
- package/static/app/assets/Library-CoI3xYJk.js +0 -1
- package/static/app/assets/LivingBrain-CaU_hCxQ.js +0 -1
- package/static/app/assets/ProductFlow-Db-1O71-.js +0 -1
- package/static/app/assets/System-Dfocn0zN.js +0 -1
- package/static/app/assets/bot-Bp2x1i6F.js +0 -1
- package/static/app/assets/circle-check-CyGal42W.js +0 -1
- package/static/app/assets/cpu-DQFk82hG.js +0 -1
- package/static/app/assets/download-C70gKQVi.js +0 -1
- package/static/app/assets/folder-open-DNGytsVw.js +0 -1
- package/static/app/assets/hard-drive-CYo_bEl4.js +0 -1
- package/static/app/assets/i18n-BBMJshCW.js +0 -7
- package/static/app/assets/index-BqRcLZR3.css +0 -2
- package/static/app/assets/input-ChWD-Fsh.js +0 -1
- package/static/app/assets/navigation-D9D9_FPC.js +0 -1
- package/static/app/assets/network-DzLDGmtV.js +0 -1
- package/static/app/assets/primitives-CmaSAyGG.js +0 -1
- package/static/app/assets/sparkles-DXiaM1NS.js +0 -1
- package/static/app/assets/textarea-CV43-o79.js +0 -1
- package/telegram_bot.py +0 -16
- package/tools/__init__.py +0 -29
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{_ as e,b as t,f as n,h as r,m as i,n as a,r as o,v as s}from"./i18n-BBMJshCW.js";import{a as c,n as l,r as u,t as d}from"./navigation-D9D9_FPC.js";import{i as f,n as p,r as m,t as h}from"./LivingBrain-CaU_hCxQ.js";import{t as g}from"./bot-Bp2x1i6F.js";import{_,a as v,c as y,d as b,f as x,g as S,h as C,i as w,l as T,m as E,n as D,o as O,p as k,r as A,s as j,t as M,u as N}from"./BrainSignals-BjRBA18L.js";import{t as P}from"./circle-check-CyGal42W.js";import{t as F}from"./cpu-DQFk82hG.js";import{t as I}from"./download-C70gKQVi.js";import{n as ee,r as L,t as te}from"./hard-drive-CYo_bEl4.js";import{t as R}from"./folder-open-DNGytsVw.js";import{n as ne,t as z}from"./sparkles-DXiaM1NS.js";import{t as B}from"./network-DzLDGmtV.js";import{a as V,d as re,f as ie,h as ae,i as H,l as oe,n as U,r as se,v as W,w as G,x as K,y as ce}from"./index-BjaXCeOZ.js";var q=i(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),J=i(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),le=i(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),ue=i(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),de=i(`database-zap`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 15 21.84`,key:`14ibmq`}],[`path`,{d:`M21 5V8`,key:`1marbg`}],[`path`,{d:`M21 12L18 17H22L19 22`,key:`zafso`}],[`path`,{d:`M3 12A9 3 0 0 0 14.59 14.87`,key:`1y4wr8`}]]),fe=i(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),pe=i(`file-check-corner`,[[`path`,{d:`M10.5 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v6`,key:`g5mvt7`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14 20 2 2 4-4`,key:`15kota`}]]),me=i(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),he=i(`file-up`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]),ge=i(`git-pull-request-arrow`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M5 9v12`,key:`ih889a`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}]]),_e=i(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),ve=i(`image-plus`,[[`path`,{d:`M16 5h6`,key:`1vod17`}],[`path`,{d:`M19 2v6`,key:`4bpg5p`}],[`path`,{d:`M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5`,key:`1ue2ih`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]),ye=i(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),be=i(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),xe=i(`message-circle-plus`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),Se=i(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),Ce=i(`repeat-2`,[[`path`,{d:`m2 9 3-3 3 3`,key:`1ltn5i`}],[`path`,{d:`M13 18H7a2 2 0 0 1-2-2V6`,key:`1r6tfw`}],[`path`,{d:`m22 15-3 3-3-3`,key:`4rnwn2`}],[`path`,{d:`M11 6h6a2 2 0 0 1 2 2v10`,key:`2f72bc`}]]),we=i(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Te=i(`search-check`,[[`path`,{d:`m8 11 2 2 4-4`,key:`1sed1v`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),Ee=i(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),De=i(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Oe=i(`sunrise`,[[`path`,{d:`M12 2v8`,key:`1q4o3n`}],[`path`,{d:`m4.93 10.93 1.41 1.41`,key:`2a7f42`}],[`path`,{d:`M2 18h2`,key:`j10viu`}],[`path`,{d:`M20 18h2`,key:`wocana`}],[`path`,{d:`m19.07 10.93-1.41 1.41`,key:`15zs5n`}],[`path`,{d:`M22 22H2`,key:`19qnx5`}],[`path`,{d:`m8 6 4-4 4 4`,key:`ybng9g`}],[`path`,{d:`M16 18a4 4 0 0 0-8 0`,key:`1lzouq`}]]),ke=i(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Y=t(s()),X=e();function Ae(e,t){return`${e}-cite-${t}`}function je({language:e,proof:t,messageId:n}){let r=e=>{let t=document.getElementById(Ae(n,e));t&&(t.scrollIntoView({behavior:`smooth`,block:`nearest`}),t.focus())};return(0,X.jsx)(`span`,{className:`brain-inline-citations`,"aria-label":a(e,`brain.answerProof.citationsLabel`,{count:t.citations.length}),children:t.citations.map((t,i)=>(0,X.jsx)(`button`,{type:`button`,className:`brain-inline-citation`,"aria-label":a(e,`brain.answerProof.marker`,{index:i+1}),"aria-controls":Ae(n,t.id),title:t.title,onClick:()=>r(t.id),children:i+1},t.id))})}function Me({language:e,proof:t,messageId:n}){return(0,X.jsxs)(`section`,{className:`brain-answer-proof`,role:`group`,"aria-label":a(e,`brain.answerProof.aria`),children:[(0,X.jsxs)(`div`,{className:`brain-answer-proof-head`,children:[(0,X.jsx)(`span`,{children:a(e,`brain.answerProof.title`)}),(0,X.jsx)(`strong`,{children:t.provenAcrossModels?a(e,`brain.answerProof.modelProven`,{model:t.model}):a(e,`brain.answerProof.modelPending`,{model:t.model})}),t.citations.length?(0,X.jsx)(`small`,{className:`brain-answer-proof-count`,children:a(e,`brain.answerProof.citationsLabel`,{count:t.citations.length})}):null]}),t.citations.length?(0,X.jsx)(`ol`,{children:t.citations.map((r,i)=>(0,X.jsxs)(`li`,{id:Ae(n,r.id),tabIndex:-1,"aria-label":a(e,`brain.answerProof.citationItem`,{index:i+1,title:r.title}),children:[(0,X.jsx)(`span`,{className:`brain-answer-proof-index`,"aria-hidden":`true`,children:i+1}),(0,X.jsx)(`span`,{children:r.source}),(0,X.jsx)(`strong`,{children:r.title}),(0,X.jsx)(`small`,{children:r.snippet||t.query}),(0,X.jsx)(Ne,{language:e,citation:r})]},r.id))}):(0,X.jsx)(`small`,{children:a(e,`brain.answerProof.empty`)})]})}function Ne({language:e,citation:t}){let n=t.matchedTerms.length>0;return(0,X.jsxs)(`span`,{className:`brain-citation-why`,"aria-label":a(e,`brain.answerProof.why.aria`),children:[(0,X.jsx)(`em`,{className:`brain-citation-confidence is-${t.confidence}`,children:a(e,`brain.answerProof.confidence.${t.confidence}`)}),n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`brain-citation-why-label`,children:a(e,`brain.answerProof.matched`)}),t.matchedTerms.slice(0,4).map(e=>(0,X.jsx)(`mark`,{children:e},e))]}):(0,X.jsx)(`span`,{className:`brain-citation-why-label`,children:a(e,`brain.answerProof.matched.none`)})]})}function Pe({language:e}){let t=c(),[r,i]=Y.useState(!1),[o,s]=Y.useState(``),[l,d]=Y.useState(``),[f,p]=Y.useState(``),[m,h]=Y.useState(null),g=u({queryKey:[`portability`],queryFn:n.graphPortability}),_=u({queryKey:[`backupHealth`],queryFn:n.backupHealth}),v=Y.useCallback(e=>h(e),[]),y=o.trim()?Be(o.trim(),e):``,b=l.trim()?Ve(l,e):``,x=!l||l===f,C=!!l.trim()&&x&&!b,w=!!o.trim()&&!y,T=Fe(()=>n.graphExport(),void 0,v),E=Fe(()=>n.graphBackup(),()=>{t.invalidateQueries({queryKey:[`backupHealth`]}),t.invalidateQueries({queryKey:[`portability`]})},v),D=Fe(()=>n.brainArchive({path:o.trim()||null,passphrase:l}),()=>void t.invalidateQueries({queryKey:[`backupHealth`]}),v),O=Fe(()=>n.brainArchiveInspect({path:o.trim(),passphrase:l||null}),void 0,v),k=Fe(()=>n.brainArchiveRestore({path:o.trim(),passphrase:l,dry_run:!0,confirm:!1}),void 0,v),A=Le(g.data?.data),j=Re(_.data?.data,e);return(0,X.jsxs)(`section`,{className:`brain-care-panel ${r?`is-expanded`:`is-collapsed`}`,"aria-label":a(e,`care.title`),children:[(0,X.jsxs)(`button`,{className:`brain-care-summary`,type:`button`,"aria-expanded":r,"aria-controls":`brain-care-details`,onClick:()=>i(e=>!e),children:[(0,X.jsxs)(`span`,{className:`brain-care-summary-main`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(oe,{className:`h-3.5 w-3.5`}),` `,a(e,`care.title`)]}),(0,X.jsx)(`strong`,{children:a(e,`care.subtitle`)})]}),(0,X.jsxs)(`div`,{className:`brain-care-proof`,"aria-label":a(e,`care.ownershipModel`),children:[(0,X.jsx)(`span`,{children:a(e,`care.private`)}),(0,X.jsx)(`span`,{children:A}),(0,X.jsx)(`span`,{children:j})]}),(0,X.jsx)(W,{className:`brain-care-toggle h-4 w-4`,"aria-hidden":`true`})]}),r?(0,X.jsxs)(`div`,{id:`brain-care-details`,className:`brain-care-details`,children:[(0,X.jsxs)(`div`,{className:`brain-care-actions`,children:[(0,X.jsx)(Ie,{icon:(0,X.jsx)(I,{className:`h-3.5 w-3.5`}),label:a(e,`care.export`),detail:a(e,`care.export.detail`),pendingLabel:a(e,`care.working`),pending:T.isPending,onClick:()=>T.mutate()}),(0,X.jsx)(Ie,{icon:(0,X.jsx)(S,{className:`h-3.5 w-3.5`}),label:a(e,`care.backup`),detail:a(e,`care.backup.detail`),pendingLabel:a(e,`care.working`),pending:E.isPending,onClick:()=>E.mutate()}),(0,X.jsx)(Ie,{icon:(0,X.jsx)(q,{className:`h-3.5 w-3.5`}),label:a(e,`care.archive`),detail:a(e,`care.archive.detail`),pendingLabel:a(e,`care.working`),pending:D.isPending,disabled:!C,onClick:()=>D.mutate()})]}),(0,X.jsxs)(`div`,{className:`brain-care-archive`,children:[(0,X.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),placeholder:a(e,`care.path.placeholder`),"aria-label":a(e,`care.path.label`)}),(0,X.jsx)(`input`,{type:`password`,value:l,onChange:e=>d(e.target.value),placeholder:a(e,`care.passphrase.placeholder`),"aria-label":a(e,`care.passphrase.label`)}),(0,X.jsx)(`input`,{type:`password`,value:f,onChange:e=>p(e.target.value),placeholder:a(e,`care.passphrase.confirmPlaceholder`),"aria-label":a(e,`care.passphrase.confirmLabel`)}),(0,X.jsxs)(`div`,{className:`brain-care-guidance`,role:`status`,children:[y?(0,X.jsx)(`span`,{className:`is-error`,children:y}):o.trim()?(0,X.jsx)(`span`,{children:a(e,`care.path.ready`)}):null,b?(0,X.jsx)(`span`,{className:`is-error`,children:b}):l?(0,X.jsx)(`span`,{children:a(e,`care.passphrase.strong`)}):null,x?null:(0,X.jsx)(`span`,{className:`is-error`,children:a(e,`care.passphrase.mismatch`)})]}),(0,X.jsxs)(`div`,{className:`brain-care-archive-actions`,children:[(0,X.jsxs)(H,{variant:`outline`,size:`sm`,disabled:!w||O.isPending,onClick:()=>O.mutate(),children:[(0,X.jsx)(fe,{className:`h-3.5 w-3.5`}),` `,a(e,`care.inspect`)]}),(0,X.jsxs)(H,{variant:`outline`,size:`sm`,disabled:!w||!l.trim()||!x||k.isPending,onClick:()=>k.mutate(),children:[(0,X.jsx)(ie,{className:`h-3.5 w-3.5`}),` `,a(e,`care.restorePreview`)]})]})]}),m?(0,X.jsx)(`div`,{className:`brain-care-result ${m.ok?`is-ok`:`is-error`}`,role:`status`,children:(0,X.jsx)(ze,{result:m,language:e})}):(0,X.jsx)(`p`,{className:`brain-care-note`,children:a(e,`care.note`)})]}):null]})}function Fe(e,t,n){return G({mutationFn:e,onSuccess:e=>{n?.(e),t?.()}})}function Ie({icon:e,label:t,detail:n,pendingLabel:r,pending:i,disabled:a,onClick:o}){return(0,X.jsxs)(`button`,{className:`brain-care-button`,type:`button`,disabled:a||i,onClick:o,children:[e,(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:i?r:t}),(0,X.jsx)(`small`,{children:n})]})]})}function Le(e){return C(b(e)?e:{},[`archive_format`,`format`,`graph_schema_version`,`schema_version`],`.latticebrain`)}function Re(e,t){let n=b(e)?e:{},r=n.count||n.backups||n.available;return r!=null&&r!==``?a(t,`care.backup.count`,{count:String(r)}):a(t,`care.backup.ready`)}function ze({result:e,language:t}){if(!e.ok)return(0,X.jsx)(X.Fragment,{children:e.error||a(t,`care.result.error`)});let n=b(e.data)?e.data:{},r=C(n,[`path`,`archive_path`,`backup_path`,`export_path`,`latest_backup`]),i=C(n,[`message`,`status`,`result`],a(t,`care.result.completed`)),o={memories:C(n,[`nodes`,`total_nodes`,`memories`,`memory_count`]),links:C(n,[`edges`,`total_edges`,`relationships`,`relationship_count`]),conversations:C(n,[`conversations`,`conversation_count`])};return(0,X.jsxs)(`div`,{className:`brain-care-result-summary`,children:[(0,X.jsx)(`strong`,{children:i}),r?(0,X.jsx)(`span`,{children:a(t,`care.result.path`,{path:r})}):null,o.memories||o.links||o.conversations?(0,X.jsx)(`span`,{children:a(t,`care.result.contents`,{memories:o.memories||`0`,links:o.links||`0`,conversations:o.conversations||`0`})}):null,n.dry_run===!0?(0,X.jsx)(`span`,{children:a(t,`care.result.dryRun`)}):null]})}function Be(e,t){return/[<>:"|?*]/.test(e)?a(t,`care.path.invalidChars`):/\.(latticebrain|zip|json)$/i.test(e)?``:a(t,`care.path.extension`)}function Ve(e,t){return e.length<12?a(t,`care.passphrase.tooShort`):[/[a-z]/,/[A-Z]/,/\d/,/[^A-Za-z0-9]/].filter(t=>t.test(e)).length<3?a(t,`care.passphrase.tooSimple`):``}var He=[`freshness`,`connectivity`,`embedding_coverage`,`consistency`],Ue=new Set([`rebuild_vector_index`,`review_orphans`,`refresh_stale_knowledge`,`resolve_contradictions`]);function We({language:e}){let t=c(),[r,i]=Y.useState(!1),o=u({queryKey:[`brainHealth`],queryFn:n.brainHealth,enabled:r}),s=u({queryKey:[`brainInsights`],queryFn:n.brainInsights,enabled:r}),l=u({queryKey:[`brainContradictions`],queryFn:n.brainContradictions,enabled:r}),[d,f]=Y.useState(null),p=G({mutationFn:()=>n.brainConsolidate(!1),onSuccess:e=>{e.ok&&b(e.data)&&f(e.data)}}),m=G({mutationFn:()=>n.brainConsolidate(!0),onSuccess:e=>{e.ok&&b(e.data)&&f(e.data),t.invalidateQueries({queryKey:[`brainHealth`]})}}),h=o.data?.ok&&b(o.data.data)?o.data.data:null,g=r&&!o.isPending&&(!o.data?.ok||o.data?.source===`unavailable`),_=s.data?.ok&&b(s.data.data)?s.data.data:null,v=l.data?.ok&&b(l.data.data)?Number(l.data.data.count||0):0,y=h&&typeof h.overall_score==`number`?h.overall_score:null,x=h&&typeof h.grade==`string`?h.grade:null,S=h&&b(h.dimensions)?h.dimensions:{},C=h&&Array.isArray(h.recommended_actions)?h.recommended_actions:[],w=_&&b(_.activity)?_.activity:{},T=_&&b(_.attention)?_.attention:{};return(0,X.jsxs)(`section`,{className:`brain-care-panel brain-intelligence-panel ${r?`is-expanded`:`is-collapsed`}`,"aria-label":a(e,`intelligence.title`),children:[(0,X.jsxs)(`button`,{className:`brain-care-summary`,type:`button`,"aria-expanded":r,"aria-controls":`brain-intelligence-details`,onClick:()=>i(e=>!e),children:[(0,X.jsxs)(`span`,{className:`brain-care-summary-main`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(z,{className:`h-3.5 w-3.5`}),` `,a(e,`intelligence.title`)]}),(0,X.jsx)(`strong`,{children:a(e,`intelligence.subtitle`)})]}),r&&y!==null?(0,X.jsxs)(`div`,{className:`brain-care-proof`,children:[(0,X.jsxs)(`span`,{children:[a(e,`intelligence.score`),`: `,y]}),(0,X.jsx)(`span`,{children:Ge(x,e)})]}):null,(0,X.jsx)(W,{className:`brain-care-toggle h-4 w-4`,"aria-hidden":`true`})]}),r?(0,X.jsx)(`div`,{id:`brain-intelligence-details`,className:`brain-care-details`,children:o.isPending?(0,X.jsx)(`p`,{className:`brain-care-note`,children:a(e,`intelligence.loading`)}):g?(0,X.jsx)(`p`,{className:`brain-care-note`,children:a(e,`intelligence.unavailable`)}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`brain-intelligence-dimensions`,role:`list`,children:He.map(t=>{let n=b(S[t])?S[t]:{},r=typeof n.score==`number`?n.score:null;return(0,X.jsxs)(`div`,{className:`brain-intelligence-dimension`,role:`listitem`,children:[(0,X.jsx)(`small`,{children:a(e,`intelligence.dim.${t}`)}),(0,X.jsx)(`strong`,{children:r===null?`—`:r})]},t)})}),(0,X.jsxs)(`div`,{className:`brain-intelligence-insights`,role:`status`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(K,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),` `,a(e,`intelligence.insights.recent`,{count:String(Z(w.recent_nodes))})]}),(0,X.jsx)(`span`,{children:a(e,`intelligence.insights.stale`,{count:String(Z(T.stale_nodes))})}),(0,X.jsx)(`span`,{children:a(e,`intelligence.insights.orphans`,{count:String(Z(T.orphan_nodes))})}),(0,X.jsx)(`span`,{children:a(e,`intelligence.contradictions`,{count:String(v)})})]}),C.length?(0,X.jsxs)(`div`,{className:`brain-intelligence-actions`,children:[(0,X.jsx)(`small`,{children:a(e,`intelligence.actions`)}),(0,X.jsx)(`ul`,{children:C.map((t,n)=>{let r=b(t)?t:{},i=String(r.id||``);return(0,X.jsx)(`li`,{children:Ue.has(i)?a(e,`intelligence.action.${i}`):String(r.reason||i)},`${i}-${n}`)})})]}):null,(0,X.jsxs)(`div`,{className:`brain-care-archive-actions`,children:[(0,X.jsx)(H,{variant:`outline`,size:`sm`,disabled:p.isPending,onClick:()=>p.mutate(),children:p.isPending?a(e,`intelligence.consolidate.working`):a(e,`intelligence.consolidate`)}),d&&Z(d.duplicate_memory_count)>0&&d.mode!==`applied`?(0,X.jsx)(H,{variant:`outline`,size:`sm`,disabled:m.isPending,onClick:()=>m.mutate(),children:a(e,`intelligence.consolidate.apply`)}):null]}),d?(0,X.jsx)(`p`,{className:`brain-care-note`,role:`status`,children:d.mode===`applied`?a(e,`intelligence.consolidate.applied`,{count:String(Z(d.pruned))}):Z(d.duplicate_memory_count)>0||Z(d.duplicate_edge_count)>0?a(e,`intelligence.consolidate.found`,{memories:String(Z(d.duplicate_memory_count)),edges:String(Z(d.duplicate_edge_count))}):a(e,`intelligence.consolidate.none`)}):null]})}):null]})}function Ge(e,t){return a(t,`intelligence.grade.${e&&new Set([`excellent`,`good`,`attention`,`critical`]).has(e)?e:`unknown`}`)}function Z(e){let t=Number(e);return Number.isFinite(t)?t:0}var Ke={"review-pending":`briefing.action.reviewPending`,"enable-drafts":`briefing.action.enableDrafts`,"install-suggestion":`briefing.action.installSuggestion`,"connect-knowledge":`briefing.action.connectKnowledge`,"check-health":`briefing.action.checkHealth`,"ask-brain":`briefing.action.askBrain`};function Q(e,t){let n=(e.sections||{})[t];return n&&typeof n==`object`?n:{}}function qe({language:e}){let[t,r]=Y.useState(!1),i=u({queryKey:[`commandBriefing`],queryFn:n.commandBriefing,enabled:t}),s=i.data?.data||{},c=Q(s,`knowledge`),d=Q(s,`conversations`),p=Q(s,`automations`),m=Q(s,`review`),h=Q(s,`health`),g=Q(s,`suggestions`),_=o(s.quick_actions),v=o(c.recent);return(0,X.jsxs)(`section`,{className:`brain-care-panel daily-briefing-panel ${t?`is-expanded`:`is-collapsed`}`,"aria-label":a(e,`briefing.title`),"data-testid":`daily-briefing`,children:[(0,X.jsxs)(`button`,{className:`brain-care-summary`,type:`button`,"aria-expanded":t,"aria-controls":`daily-briefing-details`,onClick:()=>r(e=>!e),children:[(0,X.jsxs)(`span`,{className:`brain-care-summary-main`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(Oe,{className:`h-3.5 w-3.5`}),` `,a(e,`briefing.title`)]}),(0,X.jsx)(`strong`,{children:a(e,`briefing.subtitle`)})]}),(0,X.jsx)(W,{className:`brain-care-toggle h-4 w-4`,"aria-hidden":`true`})]}),t?(0,X.jsx)(`div`,{id:`daily-briefing-details`,className:`brain-care-details`,children:i.isPending?(0,X.jsx)(`p`,{className:`brain-care-note`,children:a(e,`briefing.loading`)}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`daily-briefing-stats`,role:`list`,children:[(0,X.jsxs)(`div`,{role:`listitem`,className:`daily-briefing-stat`,children:[(0,X.jsx)(`strong`,{children:String(d.questions??0)}),(0,X.jsx)(`span`,{children:a(e,`briefing.stat.questions`)})]}),(0,X.jsxs)(`div`,{role:`listitem`,className:`daily-briefing-stat`,children:[(0,X.jsxs)(`strong`,{children:[String(p.enabled??0),`/`,String(p.total??0)]}),(0,X.jsx)(`span`,{children:a(e,`briefing.stat.automations`)})]}),(0,X.jsxs)(`div`,{role:`listitem`,className:`daily-briefing-stat`,children:[(0,X.jsx)(`strong`,{children:String(m.pending??0)}),(0,X.jsx)(`span`,{children:a(e,`briefing.stat.review`)})]}),(0,X.jsxs)(`div`,{role:`listitem`,className:`daily-briefing-stat`,children:[(0,X.jsx)(`strong`,{children:h.available&&h.grade?String(h.grade):`—`}),(0,X.jsx)(`span`,{children:a(e,`briefing.stat.health`)})]})]}),v.length>0?(0,X.jsxs)(`div`,{className:`daily-briefing-recent`,children:[(0,X.jsx)(`p`,{className:`command-palette-group`,children:a(e,`briefing.recent`)}),(0,X.jsx)(`ul`,{children:v.slice(0,3).map(e=>(0,X.jsx)(`li`,{title:String(e.title||``),children:String(e.title||e.id||``)},String(e.id)))})]}):null,Number(g.count??0)>0?(0,X.jsx)(`p`,{className:`brain-care-note`,children:a(e,`briefing.suggestions`,{count:String(g.count)})}):null,_.length>0?(0,X.jsx)(`div`,{className:`daily-briefing-actions`,children:_.map(t=>{let n=Ke[t.id];return n?(0,X.jsxs)(`button`,{type:`button`,className:`daily-briefing-action`,onClick:()=>l(t.target),children:[(0,X.jsx)(`span`,{children:a(e,n,{count:String(t.count||0)})}),(0,X.jsx)(f,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})]},t.id):null})}):null]})}):null]})}function Je({language:e}){let t=c(),[r,i]=Y.useState(!1),s=u({queryKey:[`pendingProposals`],queryFn:n.proposals,enabled:r}),l=async()=>{await Promise.all([t.invalidateQueries({queryKey:[`pendingProposals`]}),t.invalidateQueries({queryKey:[`reviewItems`]})])},d=G({mutationFn:e=>n.approveProposal(e),onSuccess:l}),f=G({mutationFn:e=>n.rejectProposal(e),onSuccess:l}),p=o((s.data?.data||{}).items),m=d.isPending||f.isPending;return(0,X.jsxs)(`section`,{className:`brain-care-panel pending-proposals-panel ${r?`is-expanded`:`is-collapsed`}`,"aria-label":a(e,`proposals.title`),"data-testid":`pending-proposals`,children:[(0,X.jsxs)(`button`,{className:`brain-care-summary`,type:`button`,"aria-expanded":r,"aria-controls":`pending-proposals-details`,onClick:()=>i(e=>!e),children:[(0,X.jsxs)(`span`,{className:`brain-care-summary-main`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(ge,{className:`h-3.5 w-3.5`}),` `,a(e,`proposals.title`)]}),(0,X.jsx)(`strong`,{children:a(e,`proposals.subtitle`)})]}),(0,X.jsx)(W,{className:`brain-care-toggle h-4 w-4`,"aria-hidden":`true`})]}),r?(0,X.jsxs)(`div`,{id:`pending-proposals-details`,className:`brain-care-details`,children:[s.isPending?(0,X.jsx)(`p`,{className:`brain-care-note`,children:a(e,`proposals.loading`)}):p.length===0?(0,X.jsx)(`p`,{className:`brain-care-note`,children:a(e,`proposals.empty`)}):(0,X.jsx)(`div`,{className:`pending-proposals-list`,children:p.map(t=>{let n=t.payload||{},r=o(n.diff),i=String(n.tier||`small`);return(0,X.jsxs)(`article`,{className:`pending-proposal`,children:[(0,X.jsxs)(`header`,{children:[(0,X.jsx)(`strong`,{title:String(n.path||t.title),children:String(n.path||t.title)}),(0,X.jsx)(`span`,{className:`pending-proposal-tier`,children:a(e,t.kind===`file_delete`?`proposals.kind.delete`:i===`large`?`proposals.tier.large`:`proposals.tier.small`)})]}),(0,X.jsx)(`p`,{className:`brain-care-note`,children:t.summary}),r.length>0?(0,X.jsxs)(`pre`,{className:`pending-proposal-diff`,"aria-label":a(e,`proposals.diff`),children:[r.slice(0,24).join(`
|
|
2
|
-
`),r.length>24?`\n… (+${r.length-24})`:``]}):null,(0,X.jsxs)(`div`,{className:`pending-proposal-actions`,children:[(0,X.jsxs)(`button`,{type:`button`,className:`daily-briefing-action`,disabled:m,onClick:()=>d.mutate(t.id),children:[(0,X.jsx)(ce,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:a(e,`proposals.approve`)})]}),(0,X.jsxs)(`button`,{type:`button`,className:`daily-briefing-action pending-proposal-reject`,disabled:m,onClick:()=>f.mutate(t.id),children:[(0,X.jsx)(V,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:a(e,`proposals.reject`)})]})]})]},t.id)})}),(0,X.jsx)(`p`,{className:`brain-care-note`,children:a(e,`proposals.note`)})]}):null]})}function Ye({language:e,draft:t,streaming:n,imageData:r,uploadingDocument:i,onDraftChange:o,onImageDataChange:s,onUploadDocument:c,onSend:l,onStop:u}){let d=Y.useRef(null);return Y.useEffect(()=>{let e=d.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,152)}px`)},[t]),(0,X.jsxs)(`div`,{className:`brain-composer`,"aria-busy":n,children:[(0,X.jsx)(`textarea`,{ref:d,rows:1,value:t,onChange:e=>o(e.target.value),onKeyDown:e=>{e.nativeEvent.isComposing||e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),l())},"aria-label":a(e,`brain.placeholder`),"aria-describedby":`brain-composer-hint`,"aria-keyshortcuts":`Control+K Meta+K`,placeholder:a(e,`brain.placeholder`)}),(0,X.jsxs)(`div`,{className:`brain-composer-actions`,children:[(0,X.jsxs)(`div`,{className:`brain-composer-attachments`,"aria-label":a(e,`brain.composer.attachments`),children:[(0,X.jsxs)(`label`,{className:`brain-document-input ${i?`is-disabled`:``}`,children:[(0,X.jsx)(he,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:i?a(e,`brain.upload.uploading`):a(e,`brain.upload.ctaShort`)}),(0,X.jsx)(`input`,{type:`file`,accept:`.pdf,.docx,.xlsx,.pptx,.txt,.md,.csv,application/pdf,text/plain,text/markdown,text/csv`,className:`sr-only`,disabled:i,onChange:e=>{let t=e.target.files?.[0];e.currentTarget.value=``,t&&c(t)}})]}),(0,X.jsxs)(`label`,{className:`brain-image-input`,children:[(0,X.jsx)(ve,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:a(e,`brain.image`)}),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`sr-only`,onChange:async e=>{let t=e.target.files?.[0];e.currentTarget.value=``,t&&s(await Xe(t))}})]}),r?(0,X.jsx)(`span`,{className:`brain-quiet-success`,children:a(e,`brain.imageAttached`)}):null]}),(0,X.jsx)(`span`,{id:`brain-composer-hint`,className:`brain-composer-hint`,children:a(e,`brain.composer.hint`)}),n&&u?(0,X.jsxs)(H,{onClick:u,variant:`outline`,className:`brain-composer-submit`,children:[(0,X.jsx)(De,{className:`h-4 w-4`,"aria-hidden":`true`}),` `,a(e,`brain.stop`)]}):(0,X.jsxs)(H,{onClick:l,disabled:!t.trim()||n,className:`brain-composer-submit`,children:[(0,X.jsx)(Ee,{className:`h-4 w-4`,"aria-hidden":`true`}),` `,a(e,`brain.send`)]})]})]})}function Xe(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result||``)),r.onerror=()=>n(r.error),r.readAsDataURL(e)})}function Ze({memories:e,concepts:t,readiness:n,proof:i,onOpenDepth:o}){let s=r(e=>e.language),c=e.filter(e=>e.agentGenerated).slice(0,3),l=e.filter(e=>!e.agentGenerated),u=l.slice(0,3),d=l.slice(3,6),f=t.slice(0,4),p=i.proofs.hasDurableEvidence||i.modelContinuity.proven,m=i.recall.items.length>0,h=i.modelContinuity.proven&&i.claims.keepsContextAcrossModels?i.modelContinuity.activeModel||a(s,`brain.proof.noModel`):a(s,`brain.proof.modelPending`);return(0,X.jsxs)(`section`,{className:`brain-overview-panel`,"aria-label":a(s,`brain.aria.overview`),children:[(0,X.jsxs)(`div`,{className:`brain-overview-head`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{children:a(s,`brain.overview.kicker`)}),(0,X.jsx)(`strong`,{children:a(s,`brain.overview.title`)})]}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>o(5),children:a(s,`brain.overview.graph`)})]}),(0,X.jsxs)(`div`,{className:`brain-overview-grid`,children:[(0,X.jsx)($e,{title:a(s,`brain.overview.agent`),empty:a(s,`brain.overview.agentEmpty`),items:c.map(e=>e.title),featured:c.length>0,onOpen:()=>o(2)}),(0,X.jsx)($e,{title:a(s,`brain.overview.recent`),empty:a(s,`brain.overview.recentEmpty`),items:u.map(e=>e.title),onOpen:()=>o(2)}),(0,X.jsx)($e,{title:a(s,`brain.overview.older`),empty:a(s,`brain.overview.olderEmpty`),items:d.map(e=>e.title),onOpen:()=>o(2)}),(0,X.jsx)($e,{title:a(s,`brain.overview.topics`),empty:a(s,`brain.overview.topicsEmpty`),items:f.map(e=>e.label),onOpen:()=>o(3)})]}),(0,X.jsxs)(`div`,{className:`brain-readiness-strip`,"data-state":n.state,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{children:a(s,`brain.readiness.kicker`)}),(0,X.jsx)(`strong`,{children:a(s,n.titleKey)})]}),(0,X.jsx)(`div`,{className:`brain-readiness-meter`,"aria-label":a(s,`brain.readiness.aria`),children:(0,X.jsx)(`i`,{style:{width:`${n.score}%`}})}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>o(n.depth),children:a(s,n.actionKey)})]}),(0,X.jsxs)(`div`,{className:`brain-proof-strip`,"aria-label":a(s,`brain.proof.aria`),children:[(0,X.jsx)(Qe,{icon:(0,X.jsx)(de,{className:`h-4 w-4`}),label:a(s,`brain.proof.context`),value:p?a(s,`brain.proof.contextValue`,{count:i.proofs.durableItems}):a(s,`brain.proof.contextEmpty`)}),(0,X.jsx)(Qe,{icon:(0,X.jsx)(Ce,{className:`h-4 w-4`}),label:a(s,`brain.proof.model`),value:h}),(0,X.jsx)(Qe,{icon:(0,X.jsx)(_,{className:`h-4 w-4`}),label:a(s,`brain.proof.store`),value:a(s,`brain.proof.storeValue`,{topics:i.proofs.graphConcepts,vectors:i.proofs.vectorItems})})]}),m?(0,X.jsxs)(`button`,{type:`button`,className:`brain-recall-proof`,onClick:()=>o(2),children:[(0,X.jsx)(`span`,{children:a(s,`brain.proof.recall`)}),(0,X.jsx)(`strong`,{children:i.recall.items[0].title}),(0,X.jsx)(`small`,{children:i.recall.items[0].snippet||i.recall.query})]}):(0,X.jsxs)(`div`,{className:`brain-recall-proof is-empty`,role:`status`,children:[(0,X.jsx)(`span`,{children:a(s,`brain.proof.recallEmpty.kicker`)}),(0,X.jsx)(`strong`,{children:a(s,p?`brain.proof.recallPending`:`brain.proof.recallEmpty.title`)}),(0,X.jsx)(`small`,{children:a(s,p?`brain.proof.recallPending.detail`:`brain.proof.recallEmpty.detail`)})]})]})}function Qe({icon:e,label:t,value:n}){return(0,X.jsxs)(`div`,{className:`brain-proof-point`,children:[e,(0,X.jsx)(`span`,{children:t}),(0,X.jsx)(`strong`,{children:n})]})}function $e({title:e,empty:t,items:n,featured:r=!1,onOpen:i}){return(0,X.jsxs)(`button`,{type:`button`,className:`brain-overview-column${r?` is-featured`:``}`,onClick:i,children:[(0,X.jsx)(`span`,{children:e}),n.length?n.slice(0,3).map(e=>(0,X.jsx)(`strong`,{children:e},e)):(0,X.jsx)(`em`,{children:t})]})}function et({language:e}){return(0,X.jsxs)(`div`,{className:`brain-model-missing`,role:`note`,children:[(0,X.jsx)(F,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:a(e,`brain.noModel.banner`)}),(0,X.jsxs)(`button`,{type:`button`,onClick:()=>l(`/models`),children:[a(e,`brain.noModel.cta`),(0,X.jsx)(f,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})]})]})}function tt(e,t){if(!t)return``;let n=e===`ko`?`ko-KR`:`en-US`,r=new Date(t),i=new Date;return r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()&&r.getDate()===i.getDate()?r.toLocaleTimeString(n,{hour:`2-digit`,minute:`2-digit`}):r.toLocaleDateString(n,{month:`short`,day:`numeric`})}var nt=5,rt=20;function it({language:e,items:t,busyId:n,onResume:r,onDelete:i}){let[o,s]=Y.useState(null),[c,l]=Y.useState(!1),u=t.slice(0,c?rt:nt),d=Math.min(t.length,rt)-nt;return u.length?(0,X.jsxs)(`section`,{className:`brain-history-panel`,"aria-label":a(e,`brain.history.aria`),children:[(0,X.jsxs)(`div`,{className:`brain-history-head`,children:[(0,X.jsx)(_e,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,X.jsx)(`strong`,{children:a(e,`brain.history.title`)}),(0,X.jsx)(`span`,{children:a(e,`brain.history.hint`)})]}),(0,X.jsx)(`ul`,{className:`brain-history-list`,children:u.map(t=>{let c=n===t.id,l=o===t.id;return(0,X.jsxs)(`li`,{className:`brain-history-item${c?` is-busy`:``}`,children:[(0,X.jsxs)(`button`,{type:`button`,className:`brain-history-resume`,disabled:c,"aria-label":a(e,`brain.history.resumeAria`,{title:t.title}),onClick:()=>r(t.id),children:[c?(0,X.jsx)(ne,{className:`h-3.5 w-3.5 brain-ingest-spin`,"aria-hidden":`true`}):null,(0,X.jsx)(`span`,{className:`brain-history-title`,children:t.title}),(0,X.jsxs)(`small`,{children:[a(e,`brain.history.messages`,{count:t.messageCount}),t.updatedAt?` · ${tt(e,t.updatedAt)}`:``]})]}),(0,X.jsxs)(`button`,{type:`button`,className:`brain-history-delete${l?` is-confirming`:``}`,disabled:c,"aria-label":l?a(e,`brain.history.deleteConfirm`):a(e,`brain.history.deleteAria`,{title:t.title}),onClick:()=>{l?(s(null),i(t.id)):s(t.id)},onBlur:()=>s(e=>e===t.id?null:e),children:[(0,X.jsx)(ke,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),l?(0,X.jsx)(`span`,{children:a(e,`brain.history.deleteConfirm`)}):null]})]},t.id)})}),d>0?(0,X.jsx)(`button`,{type:`button`,className:`brain-history-more`,"aria-expanded":c,onClick:()=>l(e=>!e),children:c?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(le,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),a(e,`brain.history.showLess`)]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(W,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),a(e,`brain.history.showMore`,{count:d})]})}):null]}):null}function at(e,t){if(e.id===`ask_brain`){d();return}if(e.id===`verify_model`){t();return}e.route&&l(e.route)}function ot({language:e,brief:t,showEvidence:n=!0,onAction:r}){let i=t.focus.title||a(e,`brain.brief.focus.empty`),o=t.focus.detail||a(e,`brain.brief.focus.empty.detail`),s=t.nextActions.slice(0,3);return(0,X.jsxs)(`section`,{className:`brain-brief-panel`,"aria-label":a(e,`brain.brief.aria`),children:[(0,X.jsxs)(`div`,{className:`brain-brief-copy`,children:[(0,X.jsx)(`span`,{children:a(e,`brain.brief.kicker`)}),(0,X.jsx)(`strong`,{children:a(e,t.headlineKey)}),(0,X.jsx)(`p`,{children:a(e,t.bodyKey,{focus:i})})]}),(0,X.jsxs)(`div`,{className:`brain-brief-focus`,children:[(0,X.jsx)(z,{className:`h-4 w-4`}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{children:a(e,`brain.brief.focus`)}),(0,X.jsx)(`strong`,{children:i}),(0,X.jsx)(`small`,{children:o})]})]}),n?(0,X.jsx)(`div`,{className:`brain-brief-evidence`,"aria-label":a(e,`brain.brief.evidence.aria`),children:t.evidence.slice(0,3).map(t=>(0,X.jsxs)(`span`,{title:a(e,t.detailKey),children:[(0,X.jsx)(`strong`,{children:t.value}),a(e,t.labelKey)]},t.id))}):null,s.length?(0,X.jsx)(`div`,{className:`brain-brief-actions`,"aria-label":a(e,`brain.brief.actions`),children:s.map(t=>(0,X.jsxs)(`button`,{type:`button`,onClick:()=>r(t),children:[st(t.id),(0,X.jsx)(`span`,{children:a(e,t.labelKey)}),(0,X.jsx)(`small`,{children:a(e,t.detailKey)})]},t.id))}):null]})}function st(e){return e===`add_source`?(0,X.jsx)(he,{className:`h-4 w-4`}):e===`inspect_topics`?(0,X.jsx)(re,{className:`h-4 w-4`}):e===`verify_model`?(0,X.jsx)(Ce,{className:`h-4 w-4`}):e===`backup_brain`?(0,X.jsx)(te,{className:`h-4 w-4`}):(0,X.jsx)(f,{className:`h-4 w-4`})}function ct({language:e,proof:t,modelName:n,onVerify:r}){return(0,X.jsxs)(`section`,{className:`brain-model-demo`,"aria-label":a(e,`brain.modelDemo.aria`),children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{children:a(e,`brain.modelDemo.kicker`)}),(0,X.jsx)(`strong`,{children:t.modelContinuity.proven?a(e,`brain.modelDemo.proven`):a(e,`brain.modelDemo.pending`)}),(0,X.jsx)(`small`,{children:a(e,`brain.modelDemo.detail`,{model:t.modelContinuity.activeModel||n})})]}),(0,X.jsxs)(`button`,{type:`button`,onClick:r,children:[(0,X.jsx)(Ce,{className:`h-3.5 w-3.5`}),a(e,`brain.modelDemo.verify`)]}),(0,X.jsxs)(`button`,{type:`button`,onClick:()=>l(`/models`),children:[(0,X.jsx)(F,{className:`h-3.5 w-3.5`}),a(e,`brain.modelDemo.change`)]})]})}var lt={chat:`brain.ingest.type.chat`,file:`brain.ingest.type.file`,folder:`brain.ingest.type.folder`,note:`brain.ingest.type.note`,web:`brain.ingest.type.web`};function ut({language:e,uploadingDocument:t,ingestionStates:n,onUploadDocument:r,onPickFolder:i,onConnectFolder:o,onIngestNote:s,onIngestWeb:c}){let[l,u]=Y.useState(``),[d,f]=Y.useState(``),[p,m]=Y.useState(``);return(0,X.jsxs)(`section`,{className:`brain-ingestion-panel`,"aria-label":a(e,`brain.ingest.aria`),children:[(0,X.jsxs)(`div`,{className:`brain-ingestion-head`,children:[(0,X.jsx)(`span`,{children:a(e,`brain.ingest.kicker`)}),(0,X.jsx)(`strong`,{children:a(e,`brain.ingest.title`)})]}),(0,X.jsxs)(`div`,{className:`brain-ingestion-grid`,children:[(0,X.jsxs)(`label`,{className:`brain-ingest-tile is-primary ${$(n.file)} ${t?`is-disabled`:``}`,children:[(0,X.jsx)(he,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:t?a(e,`brain.upload.uploading`):a(e,`brain.ingest.file`)}),(0,X.jsx)(`small`,{children:a(e,`brain.ingest.file.detail`)}),(0,X.jsx)(`input`,{type:`file`,accept:`.pdf,.docx,.xlsx,.pptx,.txt,.md,.csv,application/pdf,text/plain,text/markdown,text/csv`,className:`sr-only`,disabled:t,onChange:e=>{let t=e.target.files?.[0];e.currentTarget.value=``,t&&r(t)}}),(0,X.jsx)(pt,{language:e,state:n.file,ctaKey:`brain.ingest.cta.file`})]}),(0,X.jsxs)(`form`,{className:`brain-ingest-tile ${$(n.folder)}`,onSubmit:e=>{e.preventDefault(),o(l),u(``)},children:[(0,X.jsx)(ee,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:a(e,`brain.ingest.folder`)}),(0,X.jsxs)(`button`,{type:`button`,className:`brain-ingest-folder-picker`,onClick:i,children:[(0,X.jsx)(R,{className:`h-4 w-4`,"aria-hidden":`true`}),a(e,`capture.local.choose`)]}),(0,X.jsx)(`input`,{value:l,onChange:e=>u(e.target.value),placeholder:a(e,`brain.ingest.folder.placeholder`)}),(0,X.jsx)(pt,{language:e,state:n.folder,ctaKey:`brain.ingest.cta.folder`})]}),(0,X.jsxs)(`form`,{className:`brain-ingest-tile ${$(n.note)}`,onSubmit:e=>{e.preventDefault(),s(d),f(``)},children:[(0,X.jsx)(me,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:a(e,`brain.ingest.note`)}),(0,X.jsx)(`input`,{value:d,onChange:e=>f(e.target.value),placeholder:a(e,`brain.ingest.note.placeholder`)}),(0,X.jsx)(pt,{language:e,state:n.note,ctaKey:`brain.ingest.cta.note`})]}),(0,X.jsxs)(`form`,{className:`brain-ingest-tile ${$(n.web)}`,onSubmit:e=>{e.preventDefault(),c(p),m(``)},children:[(0,X.jsx)(L,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:a(e,`brain.ingest.web`)}),(0,X.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),placeholder:a(e,`brain.ingest.web.placeholder`)}),(0,X.jsx)(pt,{language:e,state:n.web,ctaKey:`brain.ingest.cta.web`})]})]})]})}function dt({language:e,uploadingDocument:t,ingestionStates:n,onUploadDocument:r,onPickFolder:i,onConnectFolder:o,onIngestNote:s,onIngestWeb:c}){let[l,u]=Y.useState(null),[d,f]=Y.useState(``),[p,m]=Y.useState(``),[h,g]=Y.useState(``),_=Y.useId(),v=e=>{u(t=>t===e?null:e)},y=e=>{if(e===`folder`){if(!d.trim())return;o(d),f(``)}else if(e===`note`){if(!p.trim())return;s(p),m(``)}else{if(!h.trim())return;c(h),g(``)}u(null)};return(0,X.jsxs)(`section`,{className:`brain-ingestion-dock`,"data-testid":`brain-ingestion-dock`,"aria-label":a(e,`brain.ingest.aria`),onKeyDown:e=>{e.key===`Escape`&&u(null)},children:[(0,X.jsxs)(`div`,{className:`brain-ingestion-dock-head`,children:[(0,X.jsx)(z,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`small`,{children:a(e,`brain.ingest.kicker`)}),(0,X.jsx)(`strong`,{children:a(e,`brain.ingest.dock.title`)})]})]}),(0,X.jsxs)(`div`,{className:`brain-ingestion-dock-actions`,children:[(0,X.jsxs)(`label`,{className:`brain-ingestion-dock-action ${$(n.file)} ${t?`is-disabled`:``}`,children:[(0,X.jsx)(he,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:a(e,`brain.ingest.type.file`)}),(0,X.jsx)(`i`,{"aria-hidden":`true`}),(0,X.jsx)(`input`,{type:`file`,accept:`.pdf,.docx,.xlsx,.pptx,.txt,.md,.csv,application/pdf,text/plain,text/markdown,text/csv`,className:`sr-only`,disabled:t,onChange:e=>{let t=e.target.files?.[0];e.currentTarget.value=``,t&&r(t)}})]}),[[`folder`,R],[`note`,me],[`web`,L]].map(([t,r])=>(0,X.jsxs)(`button`,{type:`button`,className:`brain-ingestion-dock-action ${$(n[t])}`,"aria-expanded":l===t,"aria-controls":l===t?_:void 0,onClick:()=>v(t),children:[(0,X.jsx)(r,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:a(e,`brain.ingest.type.${t}`)}),(0,X.jsx)(`i`,{"aria-hidden":`true`})]},t))]}),l?(0,X.jsxs)(`div`,{id:_,className:`brain-ingestion-dock-popover`,children:[(0,X.jsxs)(`header`,{children:[(0,X.jsx)(`span`,{children:a(e,`brain.ingest.${l}`)}),(0,X.jsx)(`button`,{type:`button`,"aria-label":a(e,`brain.ingest.dock.close`),onClick:()=>u(null),children:(0,X.jsx)(V,{className:`h-4 w-4`,"aria-hidden":`true`})})]}),l===`folder`?(0,X.jsxs)(`button`,{type:`button`,className:`brain-ingestion-dock-picker`,onClick:i,children:[(0,X.jsx)(R,{className:`h-4 w-4`,"aria-hidden":`true`}),a(e,`capture.local.choose`)]}):null,(0,X.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),y(l)},children:[(0,X.jsx)(`input`,{autoFocus:!0,value:l===`folder`?d:l===`note`?p:h,onChange:e=>{l===`folder`?f(e.target.value):l===`note`?m(e.target.value):g(e.target.value)},placeholder:a(e,`brain.ingest.${l}.placeholder`),"aria-label":a(e,`brain.ingest.${l}.placeholder`)}),(0,X.jsx)(`button`,{type:`submit`,"aria-label":a(e,`brain.action.add`),children:(0,X.jsx)(J,{className:`h-4 w-4`,"aria-hidden":`true`})})]}),(0,X.jsx)(pt,{language:e,state:n[l],ctaKey:`brain.ingest.cta.${l}`})]}):null]})}function $(e){return e?e.stage===`error`?`is-failed`:e.stage===`complete`?`is-emerged`:`is-ingesting`:``}var ft={preparing:`brain.ingest.stage.preparing.hint`,parsing:`brain.ingest.stage.parsing.hint`,embedding:`brain.ingest.stage.embedding.hint`,indexing:`brain.ingest.stage.indexing.hint`,complete:`brain.ingest.stage.complete.hint`,error:`brain.ingest.stage.error`};function pt({language:e,state:t,ctaKey:n}){if(!t)return(0,X.jsx)(`small`,{className:`brain-ingest-cta`,children:a(e,n)});let r=t.stage===`error`,i=t.stage===`complete`,o=t.newMemories>0||t.newEntities>0;return(0,X.jsxs)(`div`,{className:`brain-ingest-progress`,role:`status`,"aria-live":`polite`,"aria-label":a(e,`brain.ingest.progress.aria`,{label:t.label}),children:[(0,X.jsx)(`div`,{className:`brain-ingest-stage-badges`,"aria-hidden":`true`,children:(0,X.jsxs)(`span`,{className:`brain-ingest-stage-badge ${r?`is-failed`:i?`is-done`:`is-active`}`,children:[!r&&!i?(0,X.jsx)(ne,{className:`h-3 w-3 brain-ingest-spin`}):null,a(e,`brain.ingest.stage.${t.stage}`)]})}),(0,X.jsx)(`small`,{className:`brain-ingest-stage-hint ${r?`is-failed`:i?`is-emerged`:``}`,children:r?a(e,`brain.ingest.stage.error`):i?o?a(e,`brain.ingest.result`,{memories:t.newMemories,entities:t.newEntities}):a(e,`brain.ingest.result.empty`):a(e,ft[t.stage])}),i?(0,X.jsx)(mt,{language:e,state:t}):null]})}function mt({language:e,state:t}){let n=t.extraction;if(!n||n.level!==`low`)return null;let r=n.warnings.slice(0,3);return(0,X.jsxs)(`div`,{className:`brain-ingest-quality-note`,role:`note`,"data-testid":`extraction-quality-note`,children:[(0,X.jsx)(`p`,{children:a(e,`brain.ingest.quality.low`)}),r.length?(0,X.jsx)(`ul`,{children:r.map(e=>(0,X.jsx)(`li`,{children:e},e))}):null]})}function ht(e,t,n){let r=Math.floor((n-t)/6e4);return r<1?a(e,`brain.timeline.justNow`):a(e,`brain.timeline.minutesAgo`,{count:r})}function gt({language:e,emergenceEvents:t}){let n=Date.now();return(0,X.jsxs)(`section`,{className:`brain-emergence-timeline`,"aria-label":a(e,`brain.timeline.aria`),"aria-live":`polite`,children:[(0,X.jsxs)(`div`,{className:`brain-emergence-head`,children:[(0,X.jsx)(z,{className:`h-3.5 w-3.5`}),(0,X.jsx)(`strong`,{children:a(e,`brain.timeline.emergenceTitle`)}),(0,X.jsx)(`span`,{children:a(e,`brain.timeline.recent`)})]}),t.length===0?(0,X.jsx)(`p`,{className:`brain-emergence-empty`,children:a(e,`brain.timeline.empty`)}):(0,X.jsx)(`ol`,{className:`brain-emergence-list`,children:t.map(t=>(0,X.jsxs)(`li`,{className:`brain-emergence-item`,children:[(0,X.jsx)(`span`,{className:`brain-emergence-type`,children:a(e,lt[t.sourceType])}),(0,X.jsx)(`span`,{className:`brain-emergence-label`,children:t.label}),(0,X.jsxs)(`span`,{className:`brain-emergence-counts`,children:[(0,X.jsx)(`strong`,{children:a(e,`brain.timeline.newMemories`,{count:t.newMemories})}),(0,X.jsx)(`strong`,{children:a(e,`brain.timeline.newEntities`,{count:t.newEntities})})]}),(0,X.jsx)(`time`,{className:`brain-emergence-at`,children:ht(e,t.at,n)})]},t.id))})]})}var _t=[{x:68,y:16},{x:84,y:20},{x:94,y:39},{x:91,y:63},{x:73,y:69},{x:62,y:52},{x:76,y:43},{x:84,y:55}],vt=[`chat`,`file`,`folder`,`note`,`web`],yt={chat:Se,file:he,folder:R,note:me,web:L};function bt(e){return!!(e&&e.stage!==`complete`&&e.stage!==`error`)}var xt=Y.memo(function({language:e,brainState:t,intensity:n,graph:r,readiness:i,brief:o,memories:s,ingestionStates:c,emergenceEvents:l,streaming:u,onExploreBrain:d}){let p=l[0],m=Y.useMemo(()=>{let e=new Map;for(let t of r.edges)e.set(t.source,(e.get(t.source)??0)+1),e.set(t.target,(e.get(t.target)??0)+1);let t=new Set(p?.nodeIds??[]);return[...r.nodes].sort((n,r)=>Number(t.has(r.id))-Number(t.has(n.id))||(e.get(r.id)??0)-(e.get(n.id)??0)||r.importance-n.importance).slice(0,_t.length)},[r.edges,r.nodes,p?.nodeIds]),g=Y.useMemo(()=>new Map(m.map((e,t)=>[e.id,_t[t]])),[m]),_=Y.useMemo(()=>r.edges.filter(e=>g.has(e.source)&&g.has(e.target)).slice(0,16),[r.edges,g]),v=vt.map(e=>c[e]).find(e=>bt(e)),y=Y.useMemo(()=>new Set(p?.nodeIds??[]),[p]),b=u||!!v,x=u?`chat`:v?.sourceType,S=v?.label||p?.label||o.focus.title||s[0]?.title||a(e,`brain.flow.source.empty`),C=v?a(e,`brain.ingest.stage.${v.stage}.hint`):p?a(e,`brain.flow.status.emerged`,{memories:p.newMemories,entities:p.newEntities}):m.length?a(e,`brain.flow.status.ready`,{focus:o.focus.title||m[0]?.label||`Brain`}):a(e,`brain.flow.status.empty`),w=Math.max(i.signals.memoryCount,s.length),T=Math.max(i.signals.conceptCount,r.nodes.length),E=Math.max(i.signals.relationshipCount,r.edges.length);return(0,X.jsxs)(`section`,{className:`brain-knowledge-flow ${b?`is-absorbing`:``}`,"data-source":x||`idle`,"data-stage":v?.stage||(p?`connected`:`ready`),"data-brain-state":t,"aria-labelledby":`brain-home-title`,children:[(0,X.jsxs)(`header`,{className:`brain-flow-heading`,children:[(0,X.jsxs)(`div`,{className:`brain-flow-heading-copy`,children:[(0,X.jsx)(`span`,{className:`brain-home-kicker`,children:a(e,`brain.home.kicker`)}),(0,X.jsx)(`h1`,{id:`brain-home-title`,children:a(e,`brain.firstScreen.title`)}),(0,X.jsx)(`p`,{children:a(e,`brain.firstScreen.body`)})]}),(0,X.jsxs)(`div`,{className:`brain-flow-vital`,"data-state":t,children:[(0,X.jsxs)(`span`,{"aria-hidden":`true`,children:[(0,X.jsx)(`i`,{}),(0,X.jsx)(`i`,{})]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`small`,{children:a(e,`brain.flow.vital`)}),(0,X.jsx)(`strong`,{children:a(e,`brain.living.state.${t}`)})]})]})]}),(0,X.jsxs)(`div`,{className:`brain-flow-canvas`,"data-testid":`brain-knowledge-flow`,children:[(0,X.jsxs)(`div`,{className:`brain-flow-sources`,"aria-label":a(e,`brain.flow.sources.aria`),children:[(0,X.jsx)(`span`,{className:`brain-flow-column-label`,children:a(e,`brain.flow.sources`)}),vt.map(t=>{let n=yt[t],r=c[t],i=t===x,o=r?.stage===`complete`;return(0,X.jsxs)(`span`,{className:`brain-flow-source ${i?`is-active`:``} ${o?`is-remembered`:``}`,"aria-current":i?`step`:void 0,children:[(0,X.jsx)(n,{className:`h-4 w-4`,"aria-hidden":`true`}),a(e,`brain.ingest.type.${t}`)]},t)})]}),(0,X.jsxs)(`svg`,{className:`brain-flow-transfer`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[(0,X.jsx)(`path`,{className:`brain-flow-transfer-path`,d:`M20 50 C28 50 31 50 38 50`}),(0,X.jsx)(`path`,{className:`brain-flow-transfer-path is-output`,d:`M54 50 C59 50 62 50 67 50`}),b?Array.from({length:4}).map((e,t)=>(0,X.jsx)(`circle`,{className:`brain-flow-particle`,r:`0.8`,style:{animationDelay:`${t*240}ms`},children:(0,X.jsx)(`animateMotion`,{dur:`1.7s`,repeatCount:`indefinite`,path:`M20 50 C28 50 31 50 43 50`})},t)):null,m.length?Array.from({length:3}).map((e,t)=>(0,X.jsx)(`circle`,{className:`brain-flow-particle is-output`,r:`0.66`,children:(0,X.jsx)(`animateMotion`,{begin:`${t*1.15}s`,dur:b?`2.1s`:`4.2s`,repeatCount:`indefinite`,path:`M51 50 C58 46 61 44 70 42`})},`output-${t}`)):null]}),(0,X.jsxs)(`div`,{className:`brain-flow-organism`,children:[(0,X.jsx)(`span`,{className:`brain-flow-column-label`,children:a(e,`brain.flow.memory`)}),(0,X.jsx)(h,{state:t,intensity:b?Math.max(n,.9):n,size:`large`,depth:i.depth,showLabel:!1,onInteract:d}),(0,X.jsxs)(`span`,{className:`brain-flow-organism-vital`,"aria-hidden":`true`,children:[(0,X.jsx)(`i`,{}),a(e,`brain.living.state.${t}`)]})]}),(0,X.jsxs)(`div`,{className:`brain-flow-graph`,"aria-label":a(e,`brain.flow.graph.aria`,{concepts:T,relationships:E}),children:[(0,X.jsx)(`span`,{className:`brain-flow-column-label`,children:a(e,`brain.flow.graph`)}),(0,X.jsx)(`svg`,{className:`brain-flow-edges`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:_.map((e,t)=>{let n=g.get(e.source),r=g.get(e.target);return!n||!r?null:(0,X.jsx)(`line`,{x1:n.x,y1:n.y,x2:r.x,y2:r.y,vectorEffect:`non-scaling-stroke`,style:{animationDelay:`${t*-.72}s`}},e.id)})}),m.length?m.map((t,n)=>{let r=_t[n];return(0,X.jsxs)(`button`,{type:`button`,className:`brain-flow-node ${y.has(t.id)?`is-emerging`:``}`,style:{left:`${r.x}%`,top:`${r.y}%`},"aria-label":a(e,`brain.flow.node.aria`,{label:t.label,type:t.type}),title:t.summary||t.type,onClick:d,children:[(0,X.jsx)(`span`,{children:t.type}),(0,X.jsx)(`strong`,{children:t.label})]},t.id)}):(0,X.jsxs)(`div`,{className:`brain-flow-empty-graph`,children:[(0,X.jsx)(B,{className:`h-5 w-5`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:a(e,`brain.flow.graph.empty`)})]}),(0,X.jsx)(`ul`,{className:`sr-only`,children:_.map(e=>{let t=m.find(t=>t.id===e.source),n=m.find(t=>t.id===e.target);return!t||!n?null:(0,X.jsxs)(`li`,{children:[t.label,` — `,e.label,` — `,n.label]},`accessible-${e.id}`)})})]}),(0,X.jsxs)(`div`,{className:`brain-flow-live-status`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:[(0,X.jsx)(`span`,{className:`brain-flow-status-icon`,"aria-hidden":`true`,children:b?(0,X.jsx)(z,{className:`h-4 w-4`}):(0,X.jsx)(P,{className:`h-4 w-4`})}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:S}),(0,X.jsx)(`small`,{children:C})]})]}),(0,X.jsxs)(`ol`,{className:`brain-flow-path`,"aria-label":a(e,`brain.flow.path.aria`),children:[(0,X.jsxs)(`li`,{"data-active":!!x,children:[(0,X.jsx)(`span`,{children:a(e,`brain.flow.path.input`)}),(0,X.jsx)(`strong`,{children:x?a(e,`brain.ingest.type.${x}`):a(e,`brain.flow.path.waiting`)})]}),(0,X.jsx)(f,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,X.jsxs)(`li`,{"data-active":b,children:[(0,X.jsx)(`span`,{children:a(e,`brain.flow.path.memory`)}),(0,X.jsx)(`strong`,{children:a(e,`brain.flow.path.memoryCount`,{count:w})})]}),(0,X.jsx)(f,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{children:a(e,`brain.flow.path.connections`)}),(0,X.jsx)(`strong`,{children:a(e,`brain.flow.path.graphCount`,{concepts:T,relationships:E})})]}),(0,X.jsx)(f,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{children:a(e,`brain.flow.path.automation`)}),(0,X.jsx)(`strong`,{children:a(e,`brain.flow.path.actionCount`,{count:o.proactiveActions.length})})]})]})]})]})});function St({language:e,brief:t,activities:n,streaming:r,onAction:i,compact:o=!1}){let s=Y.useRef(null),c=t.proactiveActions.slice(0,3),l=t.evidence.filter(e=>e.value>0).slice(0,3),u=t.focus.title||a(e,`brain.brief.focus.empty`),d=()=>{let e=s.current;e&&(e.removeAttribute(`open`),e.querySelector(`summary`)?.focus())};if(o){let t=c[0];return(0,X.jsxs)(`section`,{className:`brain-memory-automation is-compact ${c.length>1?`has-more-actions`:c.length===1?`has-single-action`:`has-no-actions`}`,"data-testid":`brain-automation-dock`,"aria-labelledby":`brain-memory-automation-compact-title`,children:[(0,X.jsxs)(`div`,{className:`brain-automation-compact-head`,children:[(0,X.jsx)(`span`,{className:`brain-memory-automation-mark`,"aria-hidden":`true`,children:(0,X.jsx)(g,{className:`h-4 w-4`})}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`small`,{children:a(e,`brain.automation.kicker`)}),(0,X.jsx)(`strong`,{id:`brain-memory-automation-compact-title`,children:a(e,`brain.automation.title`)})]}),c.length>1?(0,X.jsxs)(`details`,{ref:s,className:`brain-automation-more`,"data-testid":`brain-automation-more`,onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),d())},children:[(0,X.jsx)(`summary`,{"aria-label":a(e,`brain.automation.more`),children:(0,X.jsx)(ae,{className:`h-4 w-4`,"aria-hidden":`true`})}),(0,X.jsxs)(`div`,{className:`brain-automation-more-popover`,children:[(0,X.jsxs)(`header`,{className:`brain-automation-more-head`,children:[(0,X.jsx)(`strong`,{children:a(e,`brain.automation.title`)}),(0,X.jsx)(`button`,{type:`button`,"aria-label":a(e,`brain.automation.close`),onClick:d,children:(0,X.jsx)(V,{className:`h-4 w-4`,"aria-hidden":`true`})})]}),(0,X.jsx)(`div`,{className:`brain-automation-actions`,children:c.map(t=>(0,X.jsxs)(`button`,{type:`button`,disabled:r,onClick:()=>i(t),children:[(0,X.jsx)(`span`,{className:`brain-automation-action-icon`,"aria-hidden":`true`,children:wt(t.intent)}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:a(e,t.labelKey)}),(0,X.jsx)(`small`,{children:a(e,t.detailKey)})]}),(0,X.jsx)(`em`,{children:a(e,Tt(t.intent))}),(0,X.jsx)(f,{className:`h-4 w-4`,"aria-hidden":`true`})]},t.id))}),(0,X.jsxs)(`div`,{className:`brain-automation-guard`,children:[(0,X.jsx)(oe,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:a(e,`brain.automation.guard`)})]}),n.length?(0,X.jsx)(`ol`,{className:`brain-automation-activity`,"aria-label":a(e,`brain.proactive.trail.aria`),"aria-live":`polite`,children:n.slice(0,3).map(t=>(0,X.jsxs)(`li`,{"data-status":t.status,children:[(0,X.jsx)(P,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),(0,X.jsx)(`strong`,{children:a(e,t.labelKey)}),(0,X.jsx)(`span`,{children:a(e,`brain.proactive.status.${t.status}`)})]},t.id))}):null]})]}):null]}),(0,X.jsx)(`span`,{className:`brain-automation-compact-focus`,title:u,children:u}),t?(0,X.jsxs)(`button`,{type:`button`,className:`brain-automation-primary-action`,disabled:r,onClick:()=>i(t),children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,children:wt(t.intent)}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:a(e,t.labelKey)}),(0,X.jsx)(`small`,{children:a(e,Tt(t.intent))})]}),(0,X.jsx)(f,{className:`h-4 w-4`,"aria-hidden":`true`})]}):(0,X.jsx)(`p`,{className:`brain-automation-empty`,children:a(e,`brain.automation.empty`)})]})}return(0,X.jsxs)(`section`,{className:`brain-memory-automation`,"aria-labelledby":`brain-memory-automation-title`,children:[(0,X.jsxs)(`div`,{className:`brain-memory-automation-head`,children:[(0,X.jsx)(`div`,{className:`brain-memory-automation-mark`,"aria-hidden":`true`,children:(0,X.jsx)(g,{className:`h-5 w-5`})}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{children:a(e,`brain.automation.kicker`)}),(0,X.jsx)(`h2`,{id:`brain-memory-automation-title`,children:a(e,`brain.automation.title`)}),(0,X.jsx)(`p`,{children:a(e,`brain.automation.body`)})]})]}),(0,X.jsxs)(`div`,{className:`brain-automation-grounding`,children:[(0,X.jsx)(ye,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`small`,{children:a(e,`brain.automation.basedOn`)}),(0,X.jsx)(`strong`,{children:u}),t.focus.empty?null:(0,X.jsx)(`em`,{children:t.focus.source})]}),l.length?(0,X.jsx)(`div`,{className:`brain-automation-evidence`,"aria-label":a(e,`brain.brief.evidence.aria`),children:l.map(t=>(0,X.jsxs)(`span`,{title:a(e,t.detailKey),children:[(0,X.jsx)(`strong`,{children:t.value}),` `,a(e,t.labelKey)]},t.id))}):null]}),c.length?(0,X.jsx)(`div`,{className:`brain-automation-actions`,children:c.map(t=>(0,X.jsxs)(`button`,{type:`button`,disabled:r,onClick:()=>i(t),children:[(0,X.jsx)(`span`,{className:`brain-automation-action-icon`,"aria-hidden":`true`,children:wt(t.intent)}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:a(e,t.labelKey)}),(0,X.jsx)(`small`,{children:a(e,t.detailKey)})]}),(0,X.jsx)(`em`,{children:a(e,Tt(t.intent))}),(0,X.jsx)(f,{className:`h-4 w-4`,"aria-hidden":`true`})]},t.id))}):(0,X.jsx)(`p`,{className:`brain-automation-empty`,children:a(e,`brain.automation.empty`)}),(0,X.jsxs)(`div`,{className:`brain-automation-guard`,children:[(0,X.jsx)(oe,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:a(e,`brain.automation.guard`)})]}),n.length?(0,X.jsx)(`ol`,{className:`brain-automation-activity`,"aria-label":a(e,`brain.proactive.trail.aria`),"aria-live":`polite`,children:n.slice(0,3).map(t=>(0,X.jsxs)(`li`,{"data-status":t.status,children:[(0,X.jsx)(P,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),(0,X.jsx)(`strong`,{children:a(e,t.labelKey)}),(0,X.jsx)(`span`,{children:a(e,`brain.proactive.status.${t.status}`)})]},t.id))}):null]})}function Ct({language:e,state:t,concepts:n,relationshipCount:r,onExploreBrain:i}){return(0,X.jsxs)(`div`,{className:`brain-conversation-trace ${bt(t)?`is-active`:``}`,role:`status`,"aria-live":`polite`,children:[(0,X.jsxs)(`span`,{className:`brain-conversation-trace-source`,children:[(0,X.jsx)(Se,{className:`h-4 w-4`,"aria-hidden":`true`}),a(e,`brain.flow.conversation`)]}),(0,X.jsx)(f,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),(0,X.jsxs)(`span`,{className:`brain-conversation-trace-memory`,children:[(0,X.jsx)(z,{className:`h-4 w-4`,"aria-hidden":`true`}),t?a(e,`brain.ingest.stage.${t.stage}.hint`):a(e,`brain.flow.conversation.ready`)]}),(0,X.jsx)(f,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),(0,X.jsxs)(`button`,{type:`button`,onClick:i,children:[(0,X.jsx)(B,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:n.slice(0,3).map(e=>e.label).join(` · `)||a(e,`brain.flow.graph.empty.short`)}),(0,X.jsx)(`small`,{children:a(e,`brain.flow.relationships`,{count:r})})]})]})}function wt(e){return e===`delegate`?(0,X.jsx)(g,{className:`h-4 w-4`}):e===`review`?(0,X.jsx)(Te,{className:`h-4 w-4`}):e===`route`?(0,X.jsx)(B,{className:`h-4 w-4`}):(0,X.jsx)(Se,{className:`h-4 w-4`})}function Tt(e){return e===`delegate`?`brain.automation.intent.delegate`:e===`review`?`brain.automation.intent.review`:e===`route`?`brain.automation.intent.route`:`brain.automation.intent.ask`}function Et({language:e,content:t}){return(0,X.jsx)(X.Fragment,{children:Y.useMemo(()=>At(t),[t]).map((t,n)=>t.kind===`code`?(0,X.jsx)(Nt,{language:e,code:t.value,lang:t.lang},n):t.value.trim()?(0,X.jsx)(kt,{value:t.value},n):null)})}function Dt(e){let t=[],n=[],r=()=>{n.length&&(t.push({kind:`paragraph`,lines:n}),n=[])};for(let i of e.split(`
|
|
3
|
-
`)){let e=i.trim();if(!e){r();continue}let a=/^(#{1,4})\s+(.+)$/.exec(e);if(a){r(),t.push({kind:`heading`,depth:a[1].length,text:a[2]});continue}let o=/^[-*•]\s+(.+)$/.exec(e);if(o){r();let e=t[t.length-1];e?.kind===`list`&&!e.ordered?e.items.push(o[1]):t.push({kind:`list`,ordered:!1,items:[o[1]]});continue}let s=/^\d+[.)]\s+(.+)$/.exec(e);if(s){r();let e=t[t.length-1];e?.kind===`list`&&e.ordered?e.items.push(s[1]):t.push({kind:`list`,ordered:!0,items:[s[1]]});continue}let c=/^>\s?(.*)$/.exec(e);if(c){r();let e=t[t.length-1];e?.kind===`quote`?e.lines.push(c[1]):t.push({kind:`quote`,lines:[c[1]]});continue}if(/^([-_*])\1{2,}$/.test(e)){r();continue}n.push(e)}return r(),t}function Ot(e){let t=/(\*\*[^*]+\*\*|`[^`]+`|\[[^\]]+\]\(https?:\/\/[^)\s]+\))/g,n=[],r=0,i=0;for(let a=t.exec(e);a;a=t.exec(e)){a.index>r&&n.push(e.slice(r,a.index));let t=a[0];if(t.startsWith(`**`))n.push((0,X.jsx)(`strong`,{children:t.slice(2,-2)},i++));else if(t.startsWith("`"))n.push((0,X.jsx)(`code`,{children:t.slice(1,-1)},i++));else{let e=/^\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)$/.exec(t);e?n.push((0,X.jsx)(`a`,{href:e[2],target:`_blank`,rel:`noreferrer noopener`,children:e[1]},i++)):n.push(t)}r=a.index+t.length}return r<e.length&&n.push(e.slice(r)),n}function kt({value:e}){return(0,X.jsx)(`div`,{className:`brain-md`,children:Y.useMemo(()=>Dt(e),[e]).map((e,t)=>{if(e.kind===`heading`)return(0,X.jsx)(`p`,{className:`brain-md-heading is-depth-${Math.min(e.depth,3)}`,children:Ot(e.text)},t);if(e.kind===`list`){let n=e.items.map((e,t)=>(0,X.jsx)(`li`,{children:Ot(e)},t));return e.ordered?(0,X.jsx)(`ol`,{children:n},t):(0,X.jsx)(`ul`,{children:n},t)}return e.kind===`quote`?(0,X.jsx)(`blockquote`,{children:Ot(e.lines.join(` `))},t):(0,X.jsx)(`p`,{children:e.lines.map((e,t)=>(0,X.jsxs)(Y.Fragment,{children:[t>0?(0,X.jsx)(`br`,{}):null,Ot(e)]},t))},t)})})}function At(e){let t=[],n=/```([\w.+-]*)\n([\s\S]*?)(?:```|$)/g,r=0;for(let i=n.exec(e);i;i=n.exec(e))i.index>r&&t.push({kind:`text`,value:e.slice(r,i.index)}),t.push({kind:`code`,value:i[2].replace(/\n$/,``),lang:i[1]||void 0}),r=i.index+i[0].length;return r<e.length&&t.push({kind:`text`,value:e.slice(r)}),t.length?t:[{kind:`text`,value:e}]}var jt={python:`py`,py:`py`,javascript:`js`,js:`js`,typescript:`ts`,ts:`ts`,tsx:`tsx`,jsx:`jsx`,html:`html`,css:`css`,json:`json`,markdown:`md`,md:`md`,bash:`sh`,sh:`sh`,shell:`sh`,zsh:`sh`,sql:`sql`,yaml:`yml`,yml:`yml`,toml:`toml`,csv:`csv`,xml:`xml`,text:`txt`,txt:`txt`};function Mt(e){let t=jt[(e||``).toLowerCase()]||`txt`,n=new Date;return`chat-${[n.getFullYear(),String(n.getMonth()+1).padStart(2,`0`),String(n.getDate()).padStart(2,`0`)].join(``)+`-`+[String(n.getHours()).padStart(2,`0`),String(n.getMinutes()).padStart(2,`0`),String(n.getSeconds()).padStart(2,`0`)].join(``)}.${t}`}function Nt({language:e,code:t,lang:r}){let[i,o]=Y.useState(!1),[s,c]=Y.useState(`idle`),[l,u]=Y.useState(null),[d,f]=Y.useState(``);async function p(){try{await navigator.clipboard?.writeText(t),o(!0),window.setTimeout(()=>o(!1),2e3)}catch{}}async function m(){if(s===`saving`)return;c(`saving`),f(``);let e=Mt(r),i=await n.saveChatFile(e,t);if(!i.ok){c(`error`),f(i.error||`unavailable`);return}let a=i.data,o=a.path||e;u({path:o,filename:o.split(`/`).pop()||e,bytes:a.bytes||0}),c(`saved`)}return(0,X.jsxs)(`div`,{className:`brain-code-block`,children:[(0,X.jsxs)(`div`,{className:`brain-code-head`,children:[(0,X.jsx)(`span`,{className:`brain-code-lang`,children:r||`text`}),(0,X.jsxs)(`div`,{className:`brain-code-actions`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:()=>void p(),children:i?a(e,`brain.code.copied`):a(e,`brain.code.copy`)}),(0,X.jsxs)(`button`,{type:`button`,onClick:()=>void m(),disabled:s===`saving`,children:[(0,X.jsx)(we,{className:`h-3 w-3`,"aria-hidden":`true`}),s===`saving`?a(e,`brain.code.saving`):a(e,`brain.code.save`)]})]})]}),(0,X.jsx)(`pre`,{children:(0,X.jsx)(`code`,{children:t})}),s===`saved`&&l?(0,X.jsx)(Ft,{language:e,files:[l],compact:!0}):null,s===`error`?(0,X.jsx)(`small`,{className:`brain-code-save-error`,role:`alert`,children:a(e,`brain.code.saveError`,{reason:d})}):null]})}function Pt(e){return e?e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:``}function Ft({language:e,files:t,compact:r=!1}){let[i,o]=Y.useState(null),[s,c]=Y.useState(``);async function l(e){if(i)return;o(e.path),c(``);let t=await n.downloadWorkspaceFile(e.path,e.filename);t.ok||c(t.error||`unavailable`),o(null)}return(0,X.jsxs)(`section`,{className:`brain-created-files ${r?`is-compact`:``}`,"aria-label":a(e,`brain.files.title`),children:[(0,X.jsxs)(`div`,{className:`brain-created-files-head`,children:[(0,X.jsx)(pe,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,X.jsx)(`strong`,{children:a(e,`brain.files.title`)})]}),(0,X.jsx)(`ul`,{children:t.map(t=>(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`brain-created-file-name`,children:t.filename}),t.bytes?(0,X.jsx)(`small`,{children:Pt(t.bytes)}):null,(0,X.jsxs)(`button`,{type:`button`,onClick:()=>void l(t),disabled:i===t.path,children:[(0,X.jsx)(I,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),i===t.path?a(e,`brain.files.downloading`):a(e,`brain.files.download`)]})]},t.path))}),(0,X.jsx)(`small`,{className:`brain-created-files-hint`,children:a(e,`brain.files.hint`)}),s?(0,X.jsx)(`small`,{className:`brain-created-files-error`,role:`alert`,children:a(e,`brain.files.downloadError`,{reason:s})}):null]})}function It({language:e,brainState:t,intensity:n,readiness:r,memories:i,concepts:o,relationshipCount:s,onExploreBrain:c,onOpenDepth:l}){let[u,d]=Y.useState(null),f=Y.useMemo(()=>{let e=i.filter(e=>e.kind===`Conversation`),t=i.filter(e=>e.kind!==`Conversation`).sort((e,t)=>Number(t.agentGenerated)-Number(e.agentGenerated));return[{id:`now`,depth:1,labelKey:`brain.rings.1`,emptyKey:`brain.rings.empty.now`,position:`top`,count:e.length,items:e.slice(0,3).map(e=>e.title)},{id:`memories`,depth:2,labelKey:`brain.rings.2`,emptyKey:`brain.rings.empty.memories`,position:`left`,count:t.length,items:t.slice(0,3).map(e=>e.title)},{id:`topics`,depth:3,labelKey:`brain.rings.3`,emptyKey:`brain.rings.empty.topics`,position:`bottom`,count:o.length,items:o.slice(0,3).map(e=>e.label)},{id:`graph`,depth:5,labelKey:`brain.rings.5`,emptyKey:`brain.rings.empty.graph`,position:`right`,count:s,items:[]}]},[i,o,s]);Y.useEffect(()=>{if(u===null)return;let e=e=>{e.key===`Escape`&&d(null)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[u]);let p=f.find(e=>e.id===u)??null;return(0,X.jsxs)(`div`,{className:`brain-rings`,"aria-label":a(e,`brain.rings.aria`),children:[(0,X.jsxs)(`div`,{className:`brain-concentric-container`,children:[(0,X.jsx)(`div`,{className:`brain-orbit-field`,"aria-hidden":`true`,children:f.map((e,t)=>(0,X.jsx)(`div`,{className:`brain-concentric-ring ring-${t+1} ${e.count>0?`is-populated`:`is-dormant`}`},e.id))}),f.map(t=>(0,X.jsxs)(`button`,{type:`button`,className:`ring-label ring-label-${t.position} ${t.count>0?`is-populated`:``} ${u===t.id?`is-active`:``}`,"aria-expanded":u===t.id,"aria-controls":`brain-ring-peek`,"aria-label":a(e,`brain.rings.peek.aria`,{label:a(e,t.labelKey),count:t.count}),onClick:()=>d(e=>e===t.id?null:t.id),children:[a(e,t.labelKey),(0,X.jsx)(`em`,{children:t.count})]},t.id)),(0,X.jsx)(`div`,{className:`brain-center-orb`,children:(0,X.jsx)(h,{state:t,intensity:n,size:`large`,depth:r.depth||Math.max(1,Math.floor(r.score/20)),showLabel:!1,className:`brain-home-presence`,onInteract:c})})]}),p?(0,X.jsxs)(`section`,{id:`brain-ring-peek`,className:`brain-ring-peek`,"aria-label":a(e,`brain.rings.peek.title`,{label:a(e,p.labelKey)}),children:[(0,X.jsxs)(`header`,{children:[(0,X.jsx)(`strong`,{children:a(e,p.labelKey)}),(0,X.jsx)(`span`,{children:a(e,`brain.rings.count`,{count:p.count})}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>d(null),"aria-label":a(e,`brain.rings.close`),children:`×`})]}),p.items.length?(0,X.jsx)(`ul`,{children:p.items.map(e=>(0,X.jsx)(`li`,{children:e},e))}):(0,X.jsx)(`p`,{children:a(e,p.count>0?`brain.rings.peek.summary`:p.emptyKey,{count:p.count})}),(0,X.jsx)(`button`,{type:`button`,className:`brain-ring-peek-deeper`,onClick:()=>l(p.depth),children:a(e,`brain.rings.deeper`)})]}):null]})}function Lt({language:e,modelName:t,modelReady:n,messages:i,pastConversations:o,historyBusyId:s,starterPrompts:c,memoryFeedback:u,ingestionStates:d,emergenceEvents:f,proactiveActivities:p,draft:m,streaming:g,imageData:_,streamRef:v,memories:y,graph:b,concepts:x,relationshipCount:S,readiness:C,proof:w,brief:T,uploadingDocument:E,onOpenDepth:O,onDraftChange:k,onImageDataChange:A,onUploadDocument:j,onPickFolder:N,onConnectFolder:F,onIngestNote:I,onIngestWeb:ee,onVerifyModelContinuity:L,onSend:te,onSendText:R,onCreateActionItem:ne,onProactiveAction:B,onStop:re,onRegenerate:ie,onNewConversation:ae,onResumeConversation:H,onDeleteConversation:U,brainState:W,intensity:G,onExploreBrain:K,onRequestDetails:ce}){let q=i.length>0,J=r(e=>e.mode)===`basic`,le=Bt(i),ue=T.suggestedQuestions.slice(0,3);return(0,X.jsx)(`section`,{className:`brain-conversation`,"aria-label":a(e,`brain.aria.conversation`),children:(0,X.jsx)(`div`,{className:`brain-chat-home-layout`,children:(0,X.jsxs)(`section`,{className:`brain-chat-home-card ${q?`has-messages`:`is-empty-home`}`,"aria-label":a(e,`brain.chatHome.aria`),children:[(0,X.jsx)(D,{language:e}),q?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`header`,{className:`brain-chat-header`,children:[(0,X.jsxs)(`div`,{className:`brain-header-presence`,children:[(0,X.jsx)(h,{state:W,intensity:G,size:`trace`,showLabel:!1,onInteract:K}),(0,X.jsxs)(`div`,{className:`brain-header-title`,children:[(0,X.jsx)(`strong`,{children:a(e,`brain.title`)}),(0,X.jsxs)(`span`,{children:[a(e,`brain.firstScreen.state.${C.state}`),J?``:` (${C.score}%)`]})]})]}),(0,X.jsxs)(`div`,{className:`brain-header-actions`,children:[J?null:(0,X.jsx)(`div`,{className:`brain-model-pill`,children:t}),(0,X.jsxs)(`button`,{type:`button`,className:`brain-deeper-btn`,onClick:ae,children:[(0,X.jsx)(xe,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),a(e,`brain.newChat`)]}),(0,X.jsx)(`button`,{type:`button`,className:`brain-deeper-btn`,onClick:K,children:a(e,`brain.firstScreen.action.graph`)})]})]}),(0,X.jsx)(Ct,{language:e,state:d.chat,concepts:x,relationshipCount:S,onExploreBrain:K}),(0,X.jsx)(`div`,{ref:v,className:`brain-stream`,children:i.map((t,n)=>{let r=`brain-msg-${n}`,i=t.role===`assistant`?t.proof:void 0,a=t.role===`assistant`&&!!t.content.trim()&&!g,o=a&&n===le;return(0,X.jsxs)(`div`,{className:`brain-message ${t.role}`,children:[(0,X.jsxs)(`div`,{className:`brain-message-bubble`,children:[t.role===`assistant`?(0,X.jsx)(Et,{language:e,content:t.content}):t.content,i&&i.citations.length?(0,X.jsx)(je,{language:e,proof:i,messageId:r}):null,t.role===`assistant`&&t.contextQuality?.limited?(0,X.jsx)(Rt,{language:e,reason:J?null:t.contextQuality.reason}):null]}),a?(0,X.jsx)(Vt,{language:e,content:t.content,canRegenerate:n===le,onRegenerate:ie,canFollowUp:o,onFollowUp:R,onCreateActionItem:ne}):null,t.files?.length?(0,X.jsx)(Ft,{language:e,files:t.files}):null,i?(0,X.jsx)(Me,{language:e,proof:i,messageId:r}):null]},`${t.role}-${n}`)})}),n?null:(0,X.jsx)(et,{language:e}),(0,X.jsx)(Ye,{language:e,draft:m,streaming:g,imageData:_,uploadingDocument:E,onDraftChange:k,onImageDataChange:A,onUploadDocument:j,onSend:te,onStop:re}),(0,X.jsx)(St,{language:e,brief:T,activities:p,streaming:g,onAction:B})]}):(0,X.jsxs)(`div`,{className:`brain-centered-home`,"data-testid":`brain-home-stage`,children:[(0,X.jsx)(xt,{language:e,brainState:W,intensity:G,graph:b,readiness:C,brief:T,memories:y,ingestionStates:d,emergenceEvents:f,streaming:g,onExploreBrain:K}),n?null:(0,X.jsx)(et,{language:e}),ue.length?(0,X.jsxs)(`section`,{className:`brain-home-prompt-strip`,"aria-label":a(e,`brain.suggestions.aria`),children:[(0,X.jsxs)(`span`,{className:`brain-home-prompt-strip-label`,children:[(0,X.jsx)(z,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),a(e,`brain.suggestions.title`)]}),ue.map(t=>{let n=a(e,t.promptKey,t.params);return(0,X.jsxs)(`button`,{type:`button`,disabled:g,title:a(e,t.detailKey),onClick:()=>{k(``),R(n)},children:[(0,X.jsx)(`strong`,{children:a(e,t.labelKey)}),(0,X.jsx)(`span`,{children:a(e,t.detailKey)})]},t.id)})]}):(0,X.jsxs)(`div`,{className:`brain-home-prompt-strip`,"aria-label":a(e,`brain.suggestions.aria`),children:[(0,X.jsxs)(`span`,{className:`brain-home-prompt-strip-label`,children:[(0,X.jsx)(z,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),a(e,`brain.suggestions.title`)]}),c.slice(0,3).map(e=>(0,X.jsx)(`button`,{type:`button`,onClick:()=>k(e),className:`brain-prompt-pill`,children:e},e))]}),(0,X.jsxs)(`div`,{className:`brain-home-control-deck`,children:[(0,X.jsxs)(`div`,{className:`brain-live-source-panel`,children:[(0,X.jsx)(dt,{language:e,uploadingDocument:E,ingestionStates:d,onUploadDocument:j,onPickFolder:N,onConnectFolder:F,onIngestNote:I,onIngestWeb:ee}),(0,X.jsx)(M,{language:e})]}),(0,X.jsx)(Ye,{language:e,draft:m,streaming:g,imageData:_,uploadingDocument:E,onDraftChange:k,onImageDataChange:A,onUploadDocument:j,onSend:te,onStop:re}),(0,X.jsxs)(`aside`,{className:`brain-home-action-dock`,"aria-label":a(e,`brain.automation.title`),children:[(0,X.jsx)(St,{language:e,brief:T,activities:p,streaming:g,onAction:B,compact:!0}),(0,X.jsxs)(`div`,{className:`brain-home-shelves`,children:[(0,X.jsxs)(`details`,{className:`brain-home-history-shelf`,"data-testid":`brain-history-shelf`,onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),zt(e.currentTarget))},children:[(0,X.jsxs)(`summary`,{children:[(0,X.jsx)(_e,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:a(e,`brain.history.title`)}),(0,X.jsx)(`small`,{children:o.length})]}),(0,X.jsxs)(`div`,{className:`brain-home-shelf-popover`,children:[(0,X.jsx)(`button`,{type:`button`,className:`brain-home-shelf-close`,"aria-label":a(e,`brain.home.shelf.close`),onClick:e=>zt(e.currentTarget),children:(0,X.jsx)(V,{className:`h-4 w-4`,"aria-hidden":`true`})}),(0,X.jsx)(it,{language:e,items:o,busyId:s,onResume:H,onDelete:U})]})]}),(0,X.jsxs)(`details`,{className:`brain-home-insights`,"data-testid":`brain-insights-shelf`,onToggle:e=>e.currentTarget.open&&ce(),onKeyDown:e=>{e.key===`Escape`&&(e.currentTarget.querySelector(`#brain-ring-peek`)||(e.preventDefault(),zt(e.currentTarget)))},children:[(0,X.jsxs)(`summary`,{children:[(0,X.jsx)(z,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:a(e,`brain.home.insights`)})]}),(0,X.jsxs)(`div`,{className:`brain-home-shelf-popover brain-home-insights-content`,children:[(0,X.jsx)(`button`,{type:`button`,className:`brain-home-shelf-close`,"aria-label":a(e,`brain.home.shelf.close`),onClick:e=>zt(e.currentTarget),children:(0,X.jsx)(V,{className:`h-4 w-4`,"aria-hidden":`true`})}),(0,X.jsx)(It,{language:e,brainState:W,intensity:G,readiness:C,memories:y,concepts:x,relationshipCount:S,onExploreBrain:K,onOpenDepth:O}),(0,X.jsx)(ot,{language:e,brief:T,showEvidence:!J,onAction:e=>at(e,L)}),J?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(gt,{language:e,emergenceEvents:f}),(0,X.jsx)(ct,{language:e,proof:w,modelName:t,onVerify:L}),(0,X.jsx)(Ze,{memories:y,concepts:x,readiness:C,proof:w,onOpenDepth:O})]}),(0,X.jsx)(qe,{language:e}),(0,X.jsx)(Je,{language:e}),(0,X.jsx)(We,{language:e}),(0,X.jsx)(Pe,{language:e})]})]})]})]})]})]}),u?(0,X.jsxs)(`div`,{className:`brain-save-feedback`,role:`status`,children:[(0,X.jsx)(de,{className:`h-3.5 w-3.5`}),(0,X.jsx)(`span`,{children:u}),(0,X.jsx)(`small`,{children:a(e,`brain.saved.detail`)})]}):null,q?(0,X.jsxs)(`details`,{className:`brain-utility-drawer`,onToggle:e=>e.currentTarget.open&&ce(),children:[(0,X.jsx)(`summary`,{children:a(e,J?`brain.chatHome.utility.basic`:`brain.chatHome.utility`)}),(0,X.jsxs)(`div`,{className:`brain-utility-tools`,"aria-label":a(e,`brain.chatHome.contextAria`),children:[(0,X.jsx)(se,{compact:!0}),J?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`brain-model-pill`,children:t}),(0,X.jsxs)(`button`,{className:`brain-admin-link`,type:`button`,onClick:()=>l(`/admin`),children:[(0,X.jsx)(oe,{className:`h-3.5 w-3.5`}),a(e,`brain.admin`)]})]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(P,{className:`h-3.5 w-3.5`}),a(e,`brain.local`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(P,{className:`h-3.5 w-3.5`}),a(e,`brain.private`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(P,{className:`h-3.5 w-3.5`}),a(e,`brain.portable`)]})]}),(0,X.jsxs)(`div`,{className:`brain-utility-grid`,children:[q?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ut,{language:e,uploadingDocument:E,ingestionStates:d,onUploadDocument:j,onPickFolder:N,onConnectFolder:F,onIngestNote:I,onIngestWeb:ee}),(0,X.jsx)(M,{language:e})]}):null,J?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(gt,{language:e,emergenceEvents:f}),(0,X.jsx)(ct,{language:e,proof:w,modelName:t,onVerify:L}),(0,X.jsx)(Ze,{memories:y,concepts:x,readiness:C,proof:w,onOpenDepth:O})]}),(0,X.jsx)(qe,{language:e}),(0,X.jsx)(Je,{language:e}),(0,X.jsx)(We,{language:e}),(0,X.jsx)(Pe,{language:e})]})]}):null]})})})}function Rt({language:e,reason:t}){return(0,X.jsxs)(`p`,{className:`brain-context-quality-note`,role:`note`,"data-testid":`context-quality-note`,children:[(0,X.jsx)(`span`,{children:a(e,`brain.contextQuality.limited`)}),t?(0,X.jsx)(`small`,{children:a(e,`brain.contextQuality.reason`,{reason:t})}):null]})}function zt(e){let t=e instanceof HTMLDetailsElement?e:e.closest(`details`);t&&(t.removeAttribute(`open`),t.querySelector(`summary`)?.focus())}function Bt(e){for(let t=e.length-1;t>=0;--t)if(e[t].role===`assistant`)return t;return-1}function Vt({language:e,content:t,canRegenerate:n,onRegenerate:r,canFollowUp:i,onFollowUp:o,onCreateActionItem:s}){let[c,l]=Y.useState(!1),u=Y.useMemo(()=>[{labelKey:`brain.message.followup.checklist`,promptKey:`brain.message.followup.checklist.prompt`},{labelKey:`brain.message.followup.evidence`,promptKey:`brain.message.followup.evidence.prompt`},{labelKey:`brain.message.followup.next`,promptKey:`brain.message.followup.next.prompt`}],[]);async function d(){try{await navigator.clipboard?.writeText(t),l(!0),window.setTimeout(()=>l(!1),2e3)}catch{}}return(0,X.jsxs)(`div`,{className:`brain-message-actions`,children:[(0,X.jsxs)(`button`,{type:`button`,"aria-label":a(e,`brain.message.copyAria`),onClick:()=>void d(),children:[(0,X.jsx)(ue,{className:`h-3 w-3`,"aria-hidden":`true`}),c?a(e,`brain.message.copied`):a(e,`brain.message.copy`)]}),n?(0,X.jsxs)(`button`,{type:`button`,"aria-label":a(e,`brain.message.regenerateAria`),onClick:r,children:[(0,X.jsx)(m,{className:`h-3 w-3`,"aria-hidden":`true`}),a(e,`brain.message.regenerate`)]}):null,i?(0,X.jsxs)(`button`,{type:`button`,"aria-label":a(e,`brain.message.saveTaskAria`),onClick:()=>s(t),children:[(0,X.jsx)(be,{className:`h-3 w-3`,"aria-hidden":`true`}),a(e,`brain.message.saveTask`)]}):null,i?(0,X.jsx)(`div`,{className:`brain-message-followups`,"aria-label":a(e,`brain.message.followup.aria`),children:u.map(t=>(0,X.jsx)(`button`,{type:`button`,onClick:()=>o(a(e,t.promptKey)),children:a(e,t.labelKey)},t.promptKey))}):null]})}function Ht({language:e,modelReady:t,onBrainChange:r,setMemoryFeedback:i,beginIngestion:o,completeIngestion:s,failIngestion:l,setLastRecallQuery:u,attachAnswerProof:d}){let f=c(),m=U(e=>e.messages),h=U(e=>e.setMessages),g=U(e=>e.conversationId),_=U(e=>e.setConversationId),[v,y]=Y.useState(``),[b,S]=Y.useState(null),[C,w]=Y.useState(!1),[T,E]=Y.useState([]),D=Y.useRef(null),O=Y.useRef(null),k=Y.useRef(null),A=G({mutationFn:async t=>{let r=await n.runAgent(t,[`planner`,`executor`,`reviewer`]);if(!r.ok)throw Error(r.error||a(e,`ui.status.unavailable`));return r},onSuccess:()=>{f.invalidateQueries({queryKey:[`memoryManager`]}),f.invalidateQueries({queryKey:[`memoryBrainBrief`]}),f.invalidateQueries({queryKey:[`graphPreview`]}),f.invalidateQueries({queryKey:[`graph`]}),f.invalidateQueries({queryKey:[`agentRuntime`]}),i(a(e,`brain.delegate.done`)),window.setTimeout(()=>i(null),4200)},onError:t=>i(a(e,`brain.delegate.failed`,{reason:String(t)}))});Y.useEffect(()=>{C?r(`thinking`,.94):v.trim().length>4?r(`listening`,.76):r(`idle`,.58)},[v,r,C]),Y.useEffect(()=>{D.current&&(D.current.scrollTop=D.current.scrollHeight)},[m]),Y.useEffect(()=>()=>{k.current!==null&&window.clearTimeout(k.current),O.current?.abort()},[]);async function j(){let e=v.trim();!e||C||(y(``),await N(e))}async function M(){if(C)return;let e=[...m].reverse().find(e=>e.role===`user`);e&&(h(e=>{let t=[...e];return t[t.length-1]?.role===`assistant`&&t.pop(),t[t.length-1]?.role===`user`&&t.pop(),t}),await N(e.content))}async function N(c){if(!c||C)return;let m=g||`brain-${Date.now()}`;if(g||_(m),!t){h(t=>[...t,{role:`user`,content:c},{role:`assistant`,content:a(e,`brain.noModel.message`)}]),S(null),i(a(e,`brain.noModel.status`));return}h(e=>[...e,{role:`user`,content:c},{role:`assistant`,content:``}]),S(null),w(!0),i(null),o(`chat`,c.slice(0,120)),r(`thinking`,.96);let v=new AbortController;O.current=v;try{let t=await n.streamChat({message:c,conversation_id:m,image_data:b||void 0},{signal:v.signal,onChunk:(e,t)=>{h(e=>{let n=[...e];return n[n.length-1]={...n[n.length-1],role:`assistant`,content:t},n})},onAgent:e=>{let t=(e.created_files||[]).map(e=>({path:e.path,filename:e.filename||e.path.split(`/`).pop()||e.path,bytes:e.bytes||0}));t.length&&h(e=>{let n=[...e];return n[n.length-1]={...n[n.length-1],files:t},n})},onTrace:e=>{e&&(r(`recalling`,.9),p(),k.current!==null&&window.clearTimeout(k.current),k.current=window.setTimeout(()=>r(`thinking`,.9),900))}});if(t.error)h(n=>Ut(n,`${a(e,`brain.unavailable`)}: ${t.error}`)),l(`chat`,String(t.error));else{let n=x(`contextQuality`in t?t.contextQuality:null)||x(t.trace);n&&h(e=>{let t=[...e];for(let e=t.length-1;e>=0;--e)if(t[e].role===`assistant`){t[e]={...t[e],contextQuality:n};break}return t}),u(c);let r=await s(`chat`);i(a(e,`brain.saved`,{topics:r.entities,memories:r.memories})),p(),d(c)}}catch(t){let n=t instanceof DOMException&&t.name===`AbortError`;h(r=>{let i=[...r],o=i[i.length-1];return o?.role===`assistant`&&!o.content.trim()&&(i[i.length-1]={...o,content:n?a(e,`brain.stopped.empty`):`${a(e,`brain.unavailable`)}: ${t instanceof Error?t.message:String(t)}`}),i}),i(n?a(e,`brain.stopped`):null),l(`chat`,n?`stopped`:t instanceof Error?t.message:String(t))}finally{O.current=null,w(!1);for(let e of[`chatHistory`,`memoryManager`,`graphPreview`,`graph`,`memoryBrainProof`,`memoryBrainBrief`])f.invalidateQueries({queryKey:[e]})}}async function P(t){let r=t.trim();if(!r)return!1;let o=([...m].reverse().find(e=>e.role===`user`)?.content||a(e,`brain.action.defaultTitle`)).trim().slice(0,96),s=await n.createReviewItem({title:o,summary:r.slice(0,420),source:`chat_followup`,kind:`task_draft`,payload:{answer_preview:r.slice(0,2e3),conversation_id:g||``},provenance:{conversation_id:g||``,source_detail:`brain_chat`}});return i(s.ok?a(e,`brain.action.saved`):a(e,`brain.action.saveFailed`,{reason:s.error||String(s.status||``)})),s.ok}function F(e,t,n,r=`${e.id}-${Date.now()}`){let i=Date.now();return E(a=>{let o=a.find(e=>e.id===r);return[{id:r,actionId:e.id,labelKey:e.labelKey,intent:e.intent,status:t,startedAt:o?.startedAt??i,completedAt:t===`running`?void 0:i,detail:n},...a.filter(e=>e.id!==r)].slice(0,6)}),r}async function I(e){let t=e.prompt.trim(),n=F(e,`running`);if(e.intent===`route`&&e.route){window.location.hash=e.route,F(e,`completed`,e.route,n);return}if(!t){F(e,`failed`,`empty prompt`,n);return}try{e.intent===`delegate`?(await A.mutateAsync(t),F(e,`completed`,`agent`,n)):e.intent===`review`?F(e,await P(t)?`completed`:`failed`,`review`,n):(await N(t),F(e,`completed`,`chat`,n))}catch(t){F(e,`failed`,t instanceof Error?t.message:String(t),n)}}return{messages:m,conversationId:g,draft:v,setDraft:y,imageData:b,setImageData:S,streaming:C,streamRef:D,proactiveActivities:T,send:j,sendText:N,regenerate:M,createActionItem:P,handleProactiveAction:I,stopStreaming:()=>O.current?.abort()}}function Ut(e,t){let n=[...e];return n[n.length-1]={role:`assistant`,content:t},n}function Wt({language:e,setMemoryFeedback:t}){let r=c(),i=U(e=>e.conversationId),o=U(e=>e.setConversationId),s=U(e=>e.setMessages),l=U(e=>e.resetConversation),[d,f]=Y.useState(null),p=u({queryKey:[`chatHistory`],queryFn:n.chatHistory});return{historyQ:p,pastConversations:Y.useMemo(()=>O(p.data?.data),[p.data]),historyBusyId:d,resetConversation:l,resumeConversation:Y.useCallback(async(r,i)=>{if(!(d||i)){f(r),t(a(e,`brain.history.loading`));try{let i=await n.conversation(r);if(!i.ok){t(a(e,`brain.history.loadFailed`,{reason:i.error||`unavailable`}));return}let c=k(i.data);if(!c.length){t(a(e,`brain.history.loadFailed`,{reason:a(e,`brain.history.emptyConversation`)}));return}o(r),s(c),t(a(e,`brain.history.resumed`))}finally{f(null)}}},[d,e,o,t,s]),deleteConversation:Y.useCallback(async o=>{if(!d){f(o);try{let s=await n.deleteConversation(o);if(!s.ok){t(a(e,`brain.history.deleteFailed`,{reason:s.error||`unavailable`}));return}i===o&&l(),t(a(e,`brain.history.deleted`)),r.invalidateQueries({queryKey:[`chatHistory`]}),r.invalidateQueries({queryKey:[`memoryManager`]})}finally{f(null)}}},[i,d,e,r,l,t])}}var Gt={chat:null,file:null,folder:null,note:null,web:null};function Kt({language:e,brainReadiness:t,memoryFragments:r,graphModel:i,memoriesFetched:o,graphFetched:s,requestDetails:l,setLastRecallQuery:u,setMemoryFeedback:d,onBrainChange:f}){let m=c(),[h,g]=Y.useState(!1),[_,y]=Y.useState(Gt),[b,x]=Y.useState([]),[S,C]=Y.useState(!1),w=Y.useRef({});Y.useEffect(()=>{if(!b[0]?.id)return;C(!0);let e=window.setTimeout(()=>C(!1),1650);return()=>window.clearTimeout(e)},[b]);let D=Y.useCallback((e,t)=>{y(n=>{let r=n[e];return r?{...n,[e]:{...r,stage:t,completedAt:t===`complete`||t===`error`?Date.now():r.completedAt}}:n})},[]),O=Y.useCallback((e,n)=>{l(),w.current[e]={memories:Math.max(t.signals.memoryCount,r.length),entities:Math.max(t.signals.conceptCount,i.nodes.length),label:n,memoryKnown:o,graphKnown:s,nodeIds:new Set(i.nodes.map(e=>e.id))},y(t=>({...t,[e]:{sourceType:e,label:n,stage:`preparing`,startedAt:Date.now(),completedAt:null,newMemories:0,newEntities:0,nodeIds:[]}}))},[t.signals.conceptCount,t.signals.memoryCount,s,i.nodes,o,r.length,l]),k=Y.useCallback((e,t,n,r,i)=>{let a=w.current[e],o=a?.label??``,s=a?.graphKnown?r.nodes.filter(e=>!a.nodeIds.has(e.id)).map(e=>e.id):[],c=i.nodeIds.filter(e=>!a?.graphKnown||!a.nodeIds.has(e)),l=Array.from(new Set([...s,...c])).slice(0,24),u=a?.memoryKnown?Math.max(0,t-a.memories):0,d=a?.graphKnown?Math.max(l.length,Math.max(0,n-a.entities)):l.length;delete w.current[e],y(t=>{let n=t[e];return n?{...t,[e]:{...n,stage:`complete`,completedAt:Date.now(),newMemories:u,newEntities:d,nodeIds:l,chunkCount:i.chunkCount,duplicate:i.duplicate,provenanceId:i.provenanceId,extraction:i.extraction}}:t}),x(t=>[{id:`${e}-${Date.now()}`,sourceType:e,label:o,newMemories:u,newEntities:d,nodeIds:l,at:Date.now()},...t].slice(0,10))},[]),A=Y.useCallback(async(e,a=null)=>{D(e,`indexing`);let o=T(a),[s,c]=await Promise.all([n.memoryManager(),n.graphPreview(48)]),l=c.ok?E(c.data):i,u=s.ok?v(s.data,r.length,l.nodes.length):t;return s.ok&&m.setQueryData([`memoryManager`],s),c.ok&&m.setQueryData([`graphPreview`],c),k(e,Math.max(u.signals.memoryCount,r.length),Math.max(u.signals.conceptCount,l.nodes.length),l,o),await Promise.all([m.invalidateQueries({queryKey:[`chatHistory`]}),m.invalidateQueries({queryKey:[`graph`]}),m.invalidateQueries({queryKey:[`memoryBrainProof`]}),m.invalidateQueries({queryKey:[`memoryBrainBrief`]}),m.invalidateQueries({queryKey:[`vectorFreshness`]}),m.invalidateQueries({queryKey:[`ingestionJobs`]})]),{memories:Math.max(u.signals.memoryCount,r.length),entities:Math.max(u.signals.conceptCount,l.nodes.length)}},[t,i,r.length,m,k,D]),j=Y.useCallback((e,t)=>{delete w.current[e],y(n=>{let r=n[e];return r?{...n,[e]:{...r,stage:`error`,completedAt:Date.now(),error:t}}:n})},[]),M=Y.useCallback(async t=>{if(!h){g(!0),d(a(e,`brain.upload.pending`,{name:t.name})),f(`recalling`,.86),O(`file`,t.name);try{let r=await n.uploadDocument(t);if(!r.ok){let t=r.error||`unavailable`;d(a(e,`brain.upload.failed`,{reason:t})),j(`file`,t);return}d(a(e,`brain.upload.saved`,{name:t.name})),u(t.name),await A(`file`,r.data),p()}finally{g(!1)}}},[O,A,j,e,f,u,d,h]),N=Y.useCallback(async t=>{let r=t.trim();if(!r)return;d(a(e,`brain.ingest.folder.pending`,{path:r})),f(`recalling`,.84),O(`folder`,r);let i=await n.connectFolder(r);if(!i.ok){let t=i.error||`unavailable`;d(a(e,`brain.ingest.folder.failed`,{reason:t})),j(`folder`,t);return}d(a(e,`brain.ingest.folder.saved`,{path:r})),u(r),await A(`folder`,i.data),p()},[O,A,j,e,f,u,d]);return{ingestionStates:_,emergenceEvents:b,synthesisActive:S,uploadingDocument:h,beginIngestion:O,completeIngestion:A,failIngestion:j,uploadDocument:M,pickFolder:Y.useCallback(async()=>{let t=await n.selectFolder();if(!t){d(a(e,`capture.local.pickUnavailable`));return}await N(t)},[N,e,d]),connectFolder:N,ingestNote:Y.useCallback(async t=>{let r=t.trim();if(!r)return;d(a(e,`brain.ingest.note.pending`)),f(`recalling`,.84),O(`note`,r.slice(0,80));let i=await n.ingestNote(r,r.slice(0,80));if(!i.ok){let t=i.error||`unavailable`;d(a(e,`brain.ingest.note.failed`,{reason:t})),j(`note`,t);return}d(a(e,`brain.ingest.note.saved`)),u(r.slice(0,120)),await A(`note`,i.data),p()},[O,A,j,e,f,u,d]),ingestWeb:Y.useCallback(async t=>{let r=t.trim();if(!r)return;d(a(e,`brain.ingest.web.pending`,{url:r})),f(`recalling`,.84),O(`web`,r);let i=await n.browserReadUrl(r),o=i.data&&typeof i.data==`object`?i.data:{},s=typeof o.status==`string`?o.status:``;if(!i.ok||s!==`ok`){let t=i.error||(typeof o.detail==`string`?o.detail:s)||`unavailable`;d(a(e,`brain.ingest.web.failed`,{reason:t})),j(`web`,t);return}d(a(e,`brain.ingest.web.saved`,{url:r})),u(r),await A(`web`,i.data),p()},[O,A,j,e,f,u,d]),resetChatIngestion:()=>y(e=>({...e,chat:null}))}}function qt({language:e,messages:t,modelName:r,setMemoryFeedback:i}){let o=U(e=>e.setMessages),[s,c]=Y.useState(``),[l,d]=Y.useState(!1),f=u({queryKey:[`memoryBrainProof`,s],queryFn:()=>n.memoryBrainProof(s,3),enabled:l||!!s||t.length>0}),p=u({queryKey:[`memoryBrainBrief`,s],queryFn:()=>n.memoryBrainBrief(s,3)}),m=Y.useMemo(()=>w(f.data,r),[f.data,r]),h=Y.useMemo(()=>A(p.data?.data),[p.data]),g=Y.useCallback(async t=>{let s=await n.memoryBrainProof(t,4);if(!s.ok)return i(a(e,`brain.proof.unavailable`,{reason:s.error||a(e,`ui.status.unavailable`)})),!1;let c=Jt(w(s,r),t,r);return o(e=>{let t=[...e];for(let e=t.length-1;e>=0;--e)if(t[e].role===`assistant`){t[e]={...t[e],proof:c};break}return t}),!0},[e,r,i,o]);return{brainProof:m,brainBrief:h,lastRecallQuery:s,setLastRecallQuery:c,requestDetails:()=>d(!0),attachAnswerProof:g,verifyModelContinuity:Y.useCallback(async()=>{let n=[...t].reverse().find(e=>e.role===`user`),o=s||n?.content||``;if(!o.trim()){i(a(e,`brain.modelDemo.needQuestion`));return}i(a(e,`brain.modelDemo.checking`,{model:r})),await g(o)&&(c(o),i(a(e,`brain.modelDemo.done`,{model:r})))},[g,e,s,t,r,i])}}function Jt(e,t,n){return{query:t,model:e.modelContinuity.activeModel||n,provenAcrossModels:e.modelContinuity.proven&&e.claims.keepsContextAcrossModels,citations:e.recall.items.slice(0,4).map(e=>({id:e.id,source:e.source,title:e.title,snippet:e.snippet,matchedTerms:e.matchedTerms,confidence:e.confidence,score:e.score}))}}function Yt({brainState:e,intensity:t,onBrainChange:i}){let o=r(e=>e.language),s=U(e=>e.messages),[c,l]=Y.useState(null),d=u({queryKey:[`memoryManager`],queryFn:n.memoryManager}),f=u({queryKey:[`graphPreview`],queryFn:()=>n.graphPreview(48)}),m=u({queryKey:[`models`],queryFn:n.models}),h=Wt({language:o,setMemoryFeedback:l}),g=Y.useMemo(()=>j(d.data?.data,h.historyQ.data?.data),[h.historyQ.data,d.data]),_=Y.useMemo(()=>E(f.data?.data),[f.data]),b=Y.useMemo(()=>_.nodes.slice(0,10),[_.nodes]),x=Y.useMemo(()=>v(d.data?.data,g.length,b.length),[b.length,d.data,g.length]),S=Y.useMemo(()=>y(m.data?.data),[m.data]),C=Y.useMemo(()=>N(m.data?.data),[m.data]),w=qt({language:o,messages:s,modelName:S,setMemoryFeedback:l}),T=Kt({language:o,brainReadiness:x,memoryFragments:g,graphModel:_,memoriesFetched:d.isFetched,graphFetched:f.isFetched,requestDetails:w.requestDetails,setLastRecallQuery:w.setLastRecallQuery,setMemoryFeedback:l,onBrainChange:i}),D=Ht({language:o,modelReady:C,onBrainChange:i,setMemoryFeedback:l,beginIngestion:T.beginIngestion,completeIngestion:T.completeIngestion,failIngestion:T.failIngestion,setLastRecallQuery:w.setLastRecallQuery,attachAnswerProof:w.attachAnswerProof}),O=Y.useMemo(()=>[a(o,`brain.prompt.remember`),a(o,`brain.prompt.know`),a(o,`brain.prompt.plan`)],[o]),k=Y.useCallback(e=>{p(),i(`recalling`,.82),window.location.hash=e<=2?`/memory`:`/knowledge-graph`},[i]),A=Y.useCallback(()=>{D.streaming&&D.stopStreaming(),h.resetConversation(),T.resetChatIngestion(),l(null),i(`idle`,.58)},[D,h,T,i]),M=D.proactiveActivities.some(e=>e.status===`running`),P=Object.values(T.ingestionStates).some(e=>e&&e.stage!==`complete`&&e.stage!==`error`),F=M?`acting`:D.streaming&&e===`recalling`?`recalling`:D.streaming?`thinking`:P?`recalling`:T.synthesisActive?`synthesizing`:D.draft.trim()?`listening`:`idle`,I=F===`idle`?.62:F===`listening`?.76:Math.max(.92,t);return(0,X.jsx)(`main`,{className:`brain-home`,"aria-label":a(o,`brain.aria.home`),children:(0,X.jsx)(Lt,{language:o,brainState:F,intensity:I,modelName:S,modelReady:C,messages:D.messages,pastConversations:h.pastConversations,historyBusyId:h.historyBusyId,starterPrompts:O,memoryFeedback:c,ingestionStates:T.ingestionStates,emergenceEvents:T.emergenceEvents,proactiveActivities:D.proactiveActivities,draft:D.draft,streaming:D.streaming,imageData:D.imageData,streamRef:D.streamRef,memories:g,graph:_,concepts:b,relationshipCount:Math.max(x.signals.relationshipCount,_.edges.length),readiness:x,proof:w.brainProof,brief:w.brainBrief,uploadingDocument:T.uploadingDocument,onOpenDepth:k,onDraftChange:D.setDraft,onImageDataChange:D.setImageData,onUploadDocument:e=>void T.uploadDocument(e),onPickFolder:()=>void T.pickFolder(),onConnectFolder:e=>void T.connectFolder(e),onIngestNote:e=>void T.ingestNote(e),onIngestWeb:e=>void T.ingestWeb(e),onVerifyModelContinuity:()=>void w.verifyModelContinuity(),onSend:()=>void D.send(),onSendText:e=>void D.sendText(e),onCreateActionItem:e=>void D.createActionItem(e),onProactiveAction:e=>void D.handleProactiveAction(e),onStop:D.stopStreaming,onRegenerate:()=>void D.regenerate(),onNewConversation:A,onResumeConversation:e=>void h.resumeConversation(e,D.streaming),onDeleteConversation:e=>void h.deleteConversation(e),onExploreBrain:()=>k(5),onRequestDetails:w.requestDetails})})}export{Yt as BrainHome};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,b as t,f as n,i as r,m as i,n as a,r as o,s,v as c}from"./i18n-BBMJshCW.js";import{a as l,r as u}from"./navigation-D9D9_FPC.js";import{c as d,f,w as p}from"./index-BjaXCeOZ.js";var m=i(`brain-circuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),h=i(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),g=i(`database-backup`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 12a9 3 0 0 0 5 2.69`,key:`1ui2ym`}],[`path`,{d:`M21 9.3V5`,key:`6k6cib`}],[`path`,{d:`M3 5v14a9 3 0 0 0 6.47 2.88`,key:`i62tjy`}],[`path`,{d:`M12 12v4h4`,key:`1bxaet`}],[`path`,{d:`M13 20a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L12 16`,key:`1f4ei9`}]]),_=t(c());function v(e){return o(e).flatMap(e=>{let t=z(e,[`id`,`conversation_id`]);return t?[{id:t,title:z(e,[`title`,`summary`,`last_message`],t).trim()||t,messageCount:Math.max(0,Math.round(W(e,[`message_count`,`messages`]))),updatedAt:V(e,[`updated_at`,`updatedAt`,`created_at`,`createdAt`])}]:[]}).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0))}function y(e){return o((R(e)?e:{}).messages).flatMap(e=>{let t=z(e,[`role`]),n=typeof e.content==`string`?e.content:``;return t!==`user`&&t!==`assistant`||!n.trim()?[]:[{role:t,content:n}]})}function b(e,t){let n=R(e)?e:{},r=(o(n.sources).length?o(n.sources):o(n.tiers)).map((e,t)=>({id:z(e,[`id`,`source`,`label`],`memory-${t}`),title:z(e,[`title`,`label`,`source`,`path`,`name`],`Workspace memory`),kind:B(e,[`type`,`source_type`,`kind`,`health`],`Memory`),tags:[],agentGenerated:!1})),i=o(n.recent_memories||n.recentMemories).map((e,t)=>{let n=R(e.metadata)?e.metadata:{},r=H(e,[`tags`]),i=z(e,[`content`,`summary`,`detail`]),a=z(n,[`source`]),o=r.includes(`agent-synthesis`)||a===`agent_runtime`||a===`agent_runtime_synthesis`;return{id:z(e,[`id`],`recent-memory-${t}`),title:i?i.replace(/\s+/g,` `).slice(0,96):B(e,[`kind`],`Memory`),kind:B(e,[`kind`],`Memory`),detail:i,tags:r,agentGenerated:o}}),a=o(t).map((e,t)=>({id:z(e,[`id`,`conversation_id`],`conversation-${t}`),title:z(e,[`title`,`summary`,`id`],`Conversation`),kind:`Conversation`,tags:[],agentGenerated:!1}));return N([...i,...r,...a]).slice(0,12)}function x(e){let t=R(e)?e:{},n=o(t.nodes),i=o(t.edges),a=n.flatMap(e=>{let t=z(e,[`id`,`node_id`,`title`,`label`]);if(!t)return[];let n=R(e.metadata)?e.metadata:{},i=B(e,[`type`,`kind`,`category`],`Concept`),a=z(e,[`title`,`label`,`name`],t.replace(/^[^:]+:/,``)),o=z(e,[`summary`,`description`,`snippet`])||z(n,[`summary`,`description`,`relative_path`,`filename`]),s=r(W(e,[`importance_norm`,`importance`,`score`])||.5,.08,1),c=V(e,[`created_at`,`createdAt`,`added_at`,`addedAt`,`timestamp`,`updated_at`,`updatedAt`])??V(n,[`created_at`,`createdAt`,`added_at`,`addedAt`,`timestamp`,`updated_at`,`updatedAt`]);return[{id:t,label:a,type:i,summary:o,importance:s,...c===void 0?{}:{createdAt:c}}]}).sort((e,t)=>t.importance-e.importance),s=new Set(a.map(e=>e.id));return{nodes:a,edges:i.flatMap((e,t)=>{let n=z(e,[`from`,`source`,`source_id`]),r=z(e,[`to`,`target`,`target_id`]);return!n||!r||!s.has(n)||!s.has(r)?[]:[{id:z(e,[`id`],`edge-${t}`),source:n,target:r,label:B(e,[`type`,`label`,`relationship`],`Relates`),weight:W(e,[`weight`,`score`,`confidence`])||1}]})}}function S(e){let t=R(e)?e:{},n=[t,t.knowledge_graph,t.ingestion,t.result].filter(R),r=new Set,i=0,a,s;for(let e of n){let t=z(e,[`node_id`,`graph_node`,`graph_node_id`]);t&&r.add(t);for(let t of o(e.indexed_nodes))if(typeof t==`string`&&t.trim())r.add(t.trim());else if(R(t)){let e=z(t,[`node_id`,`graph_node_id`,`id`]);e&&r.add(e)}i=Math.max(i,W(e,[`chunk_count`,`chunks`,`indexed_count`])),typeof e.duplicate==`boolean`&&(a=e.duplicate),s||=z(e,[`provenance_id`])}let c;for(let e of n){let t=C(e);if(t){c=t;break}}return{nodeIds:Array.from(r),chunkCount:i,...a===void 0?{}:{duplicate:a},...s?{provenanceId:s}:{},...c?{extraction:c}:{}}}function C(e){let t=R(e)?e:{},n=R(t.extraction_quality)?t.extraction_quality:null;if(!n)return null;let r=z(n,[`level`]);if(r!==`high`&&r!==`medium`&&r!==`low`)return null;let i=H(t,[`warnings`]).length?H(t,[`warnings`]):H(n,[`warnings`]);return{score:W(n,[`score`]),level:r,reasons:H(n,[`reasons`]),warnings:i}}function w(e){let t=R(e)?e:{},n=R(t.context_quality)?t.context_quality:null,r=!n&&R(t.trace)&&R(t.trace.context_quality)?t.trace.context_quality:null,i=n||r||(typeof t.mode==`string`&&typeof t.limited==`boolean`?t:null);if(!i)return null;let a=z(i,[`mode`]);if(!a)return null;let o=typeof i.reason==`string`&&i.reason.trim()?i.reason.trim():null;return{mode:a,nodes:Math.max(0,Math.round(W(i,[`nodes`]))),limited:G(i,[`limited`],!1),reason:o}}function T(e){let t=R(e)?e:{};return{status:z(t,[`status`],`unavailable`),pendingItems:Math.max(0,Math.round(W(t,[`pending_items`,`pendingItems`]))),totalItems:Math.max(0,Math.round(W(t,[`total_items`,`totalItems`]))),detail:z(t,[`detail`])}}function E(e){return o((R(e)?e:{}).jobs).flatMap(e=>{let t=z(e,[`job_id`,`jobId`,`id`]);if(!t)return[];let n=z(e,[`created_at`,`createdAt`]),r=z(e,[`updated_at`,`updatedAt`]);return[{jobId:t,status:z(e,[`status`],`queued`),total:Math.max(0,Math.round(W(e,[`total`]))),processed:Math.max(0,Math.round(W(e,[`processed`]))),failed:Math.max(0,Math.round(W(e,[`failed`]))),errors:H(e,[`errors`]),...n?{createdAt:n}:{},...r?{updatedAt:r}:{}}]})}function D(e){let t=R(e)?e:{},n=z(t,[`current`,`current_model`,`local_model`]);if(n)return n;let r=o(t.loaded||t.loaded_models).find(e=>e.id||e.name||e.model_id);return r?z(r,[`name`,`id`,`model_id`],`local mind`):`local mind`}function O(e){let t=R(e)?e:{};return z(t,[`current`,`current_model`,`local_model`])?!0:o(t.loaded||t.loaded_models).some(e=>e.id||e.name||e.model_id)}function k(e,t,n){let i=R(e)?e:{},a=R(i.brain_readiness)?i.brain_readiness:{},o=z(a,[`state`]),s=W(a,[`depth`]),c=W(a,[`score`]);if((o===`quiet`||o===`forming`||o===`alive`)&&L(s)){let e=R(a.signals)?a.signals:{};return{score:r(Math.round(c||0),0,100),state:o,depth:s,titleKey:z(a,[`title_key`,`titleKey`],`brain.readiness.${o}`),actionKey:z(a,[`action_key`,`actionKey`],I(o)),source:`memory_service`,signals:{memoryCount:W(e,[`memory_count`,`memoryCount`]),conceptCount:W(e,[`concept_count`,`conceptCount`]),relationshipCount:W(e,[`relationship_count`,`relationshipCount`]),healthySources:W(e,[`healthy_sources`,`healthySources`])}}}return F(t,n)}function A(e,t=``){let n=R(e)&&typeof e.ok==`boolean`&&`data`in e?e:null;if(n&&!n.ok)return j(t);let r=n?n.data:e,i=R(r)?r:{},a=R(i.model_continuity)?i.model_continuity:{},s=R(i.proofs)?i.proofs:{},c=R(i.recall)?i.recall:{},l=R(i.claims)?i.claims:{},u=W(s,[`durable_items`,`durableItems`]);return{status:z(i,[`status`],`quiet`),modelContinuity:{activeModel:z(a,[`active_model`,`activeModel`],t),brainOwner:z(a,[`brain_owner`,`brainOwner`],`lattice_brain`),capability:G(a,[`capability`],!0),survivesModelSwitch:G(a,[`survives_model_switch`,`survivesModelSwitch`],!1),proven:G(a,[`proven`],!1),contextStore:z(a,[`context_store`,`contextStore`],`workspace + conversation + graph + vector`)},proofs:{durableItems:u,hasDurableEvidence:G(s,[`has_durable_evidence`,`hasDurableEvidence`],u>0),workspaceMemories:W(s,[`workspace_memories`,`workspaceMemories`]),conversations:W(s,[`conversations`]),graphConcepts:W(s,[`graph_concepts`,`graphConcepts`]),vectorItems:W(s,[`vector_items`,`vectorItems`]),healthySources:W(s,[`healthy_sources`,`healthySources`])},recall:{query:z(c,[`query`]),count:W(c,[`count`]),items:o(c.items).map((e,t)=>({id:z(e,[`id`],`recall-${t}`),source:B(e,[`source`],`Memory`),title:z(e,[`title`],`Memory`),snippet:z(e,[`snippet`]),score:W(e,[`score`]),matchedTerms:H(e,[`matched_terms`,`matchedTerms`]),confidence:U(e,W(e,[`score`]))}))},claims:{canRecallUserContext:G(l,[`can_recall_user_context`,`canRecallUserContext`],!1),keepsContextAcrossModels:G(l,[`keeps_context_across_models`,`keepsContextAcrossModels`],!1),isKnowledgeStore:G(l,[`is_knowledge_store`,`isKnowledgeStore`],!1)}}}function j(e){return{status:`unavailable`,modelContinuity:{activeModel:e,brainOwner:``,capability:!1,survivesModelSwitch:!1,proven:!1,contextStore:``},proofs:{durableItems:0,hasDurableEvidence:!1,workspaceMemories:0,conversations:0,graphConcepts:0,vectorItems:0,healthySources:0},recall:{query:``,count:0,items:[]},claims:{canRecallUserContext:!1,keepsContextAcrossModels:!1,isKnowledgeStore:!1}}}function M(e){let t=R(e)?e:{},n=R(t.focus)?t.focus:{},i=o(t.next_actions||t.nextActions),a=o(t.suggested_questions||t.suggestedQuestions),s=o(t.proactive_actions||t.proactiveActions),c=o(t.evidence),l=i.length?i:[{id:`add_source`,label_key:`brain.brief.action.add`,detail_key:`brain.brief.action.add.detail`,route:`/capture`,priority:10},{id:`ask_brain`,label_key:`brain.brief.action.ask`,detail_key:`brain.brief.action.ask.detail`,route:``,priority:9}],u=c.length?c:[{id:`durable`,label_key:`brain.brief.evidence.durable`,value:0,detail_key:`brain.brief.evidence.durable.detail`},{id:`graph`,label_key:`brain.brief.evidence.graph`,value:0,detail_key:`brain.brief.evidence.graph.detail`},{id:`sources`,label_key:`brain.brief.evidence.sources`,value:0,detail_key:`brain.brief.evidence.sources.detail`}];return{status:z(t,[`status`],`quiet`),score:r(Math.round(W(t,[`score`])),0,100),headlineKey:z(t,[`headline_key`,`headlineKey`],`brain.brief.headline.quiet`),bodyKey:z(t,[`body_key`,`bodyKey`],`brain.brief.body.quiet`),focus:{kind:z(n,[`kind`],`empty`),title:z(n,[`title`]),detail:z(n,[`detail`]),source:B(n,[`source`],`Memory`),score:W(n,[`score`]),empty:G(n,[`empty`],!z(n,[`title`]))},nextActions:l.map(e=>({id:z(e,[`id`],`ask_brain`),labelKey:z(e,[`label_key`,`labelKey`],`brain.brief.action.ask`),detailKey:z(e,[`detail_key`,`detailKey`],`brain.brief.action.ask.detail`),route:z(e,[`route`]),priority:W(e,[`priority`])})),suggestedQuestions:a.map(e=>({id:z(e,[`id`],`suggested-question`),labelKey:z(e,[`label_key`,`labelKey`],`brain.suggestion.focus.label`),detailKey:z(e,[`detail_key`,`detailKey`],`brain.suggestion.focus.detail`),promptKey:z(e,[`prompt_key`,`promptKey`],`brain.suggestion.focus.prompt`),params:P(e.params),priority:W(e,[`priority`])})).sort((e,t)=>t.priority-e.priority),proactiveActions:s.map(e=>({id:z(e,[`id`],`proactive-action`),intent:z(e,[`intent`],`ask`),labelKey:z(e,[`label_key`,`labelKey`],`brain.proactive.evidence.label`),detailKey:z(e,[`detail_key`,`detailKey`],`brain.proactive.evidence.detail`),prompt:z(e,[`prompt`]),route:z(e,[`route`]),priority:W(e,[`priority`]),context:P(e.context)})).sort((e,t)=>t.priority-e.priority),evidence:u.map(e=>({id:z(e,[`id`],`evidence`),labelKey:z(e,[`label_key`,`labelKey`],`brain.brief.evidence.durable`),value:W(e,[`value`]),detailKey:z(e,[`detail_key`,`detailKey`],`brain.brief.evidence.durable.detail`)})),generatedAt:z(t,[`generated_at`,`generatedAt`])}}function N(e){let t=new Set;return e.filter(e=>t.has(e.id)?!1:(t.add(e.id),!0))}function P(e){return R(e)?Object.entries(e).reduce((e,[t,n])=>((typeof n==`string`||typeof n==`number`)&&(e[t]=n),e),{}):{}}function F(e,t){let n=Math.min(100,Math.round(e*12+t*10));return e<1?{score:Math.max(12,n),state:`quiet`,depth:2,titleKey:`brain.readiness.quiet`,actionKey:`brain.readiness.start`,source:`frontend_fallback`,signals:{memoryCount:e,conceptCount:t,relationshipCount:0,healthySources:0}}:t<3?{score:Math.max(38,n),state:`forming`,depth:3,titleKey:`brain.readiness.forming`,actionKey:`brain.readiness.grow`,source:`frontend_fallback`,signals:{memoryCount:e,conceptCount:t,relationshipCount:0,healthySources:0}}:{score:Math.max(72,n),state:`alive`,depth:5,titleKey:`brain.readiness.alive`,actionKey:`brain.readiness.map`,source:`frontend_fallback`,signals:{memoryCount:e,conceptCount:t,relationshipCount:0,healthySources:0}}}function I(e){return e===`quiet`?`brain.readiness.start`:e===`forming`?`brain.readiness.grow`:`brain.readiness.map`}function L(e){return e>=1&&e<=5&&Number.isInteger(e)}var R=s;function z(e,t,n=``){for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim())return t;if(typeof t==`number`&&Number.isFinite(t))return String(t)}return n}function B(e,t,n=``){return z(e,t,n).replace(/[_-]+/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function V(e,t){for(let n of t){let t=e[n];if(typeof t==`number`&&Number.isFinite(t))return t<0xe8d4a51000?t*1e3:t;if(typeof t==`string`&&t.trim()){let e=Number(t);if(Number.isFinite(e)&&/^\d+$/.test(t.trim()))return e<0xe8d4a51000?e*1e3:e;let n=Date.parse(t);if(Number.isFinite(n))return n}}}function H(e,t){for(let n of t){let t=e[n];if(Array.isArray(t))return t.filter(e=>typeof e==`string`&&e.trim().length>0)}return[]}function U(e,t){let n=e.confidence;return n===`high`||n===`medium`||n===`low`?n:t>=.65?`high`:t>=.3?`medium`:`low`}function W(e,t){for(let n of t){let t=Number(e[n]);if(Number.isFinite(t))return t}return 0}function G(e,t,n){for(let n of t){let t=e[n];if(typeof t==`boolean`)return t}return n}var K=e();function q(){let e=u({queryKey:[`vectorFreshness`],queryFn:n.brainVectorFreshness,staleTime:6e4,refetchOnWindowFocus:!1,retry:!1});return _.useMemo(()=>e.data?.ok?T(e.data.data):null,[e.data])}function J({language:e}){let t=q();return!t||t.status!==`pending`||t.pendingItems<1?null:(0,K.jsxs)(`p`,{className:`brain-freshness-chip`,role:`status`,"data-testid":`vector-freshness-chip`,children:[(0,K.jsx)(h,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:a(e,`brain.freshness.pending`,{count:t.pendingItems})})]})}var Y=new Set([`queued`,`running`]),X=new Set([`failed`,`partial`]);function Z(e){return Y.has(e.status)}function Q(e){return e===`queued`||e===`running`||e===`completed`||e===`failed`||e===`partial`?`brain.jobs.status.${e}`:`brain.jobs.status.queued`}function $({language:e}){let t=l(),r=u({queryKey:[`ingestionJobs`],queryFn:n.ingestionJobs,refetchOnWindowFocus:!1,retry:!1,refetchInterval:e=>{let t=e.state.data;return t?.ok&&E(t.data).some(Z)?4e3:!1}}),i=p({mutationFn:e=>n.resumeIngestionJob(e),onSettled:()=>void t.invalidateQueries({queryKey:[`ingestionJobs`]})}),o=_.useMemo(()=>r.data?.ok?E(r.data.data):[],[r.data]).filter(e=>Z(e)||X.has(e.status)).slice(0,4);return o.length?(0,K.jsxs)(`section`,{className:`brain-jobs-panel`,"aria-label":a(e,`brain.jobs.aria`),"data-testid":`ingestion-jobs-panel`,children:[(0,K.jsx)(`header`,{className:`brain-jobs-head`,children:(0,K.jsx)(`strong`,{children:a(e,`brain.jobs.title`)})}),(0,K.jsx)(`ul`,{className:`brain-jobs-list`,children:o.map(t=>{let n=Math.max(t.total,t.processed,1),r=Math.min(100,Math.round(t.processed/n*100)),o=X.has(t.status),s=i.isPending&&i.variables===t.jobId;return(0,K.jsxs)(`li`,{className:`brain-jobs-item is-${t.status}`,children:[(0,K.jsxs)(`div`,{className:`brain-jobs-item-row`,children:[(0,K.jsx)(`span`,{className:`brain-jobs-status`,children:a(e,Q(t.status))}),(0,K.jsx)(`span`,{className:`brain-jobs-counts`,children:a(e,`brain.jobs.progress`,{processed:t.processed,total:t.total})}),t.failed>0?(0,K.jsxs)(`span`,{className:`brain-jobs-failed`,children:[(0,K.jsx)(d,{className:`h-3 w-3`,"aria-hidden":`true`}),a(e,`brain.jobs.failedCount`,{count:t.failed})]}):null]}),(0,K.jsx)(`div`,{className:`brain-jobs-bar`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":r,"aria-label":a(e,`brain.jobs.progressAria`,{processed:t.processed,total:t.total}),children:(0,K.jsx)(`span`,{className:`brain-jobs-bar-fill`,style:{width:`${r}%`}})}),o?(0,K.jsxs)(`button`,{type:`button`,className:`brain-jobs-resume`,disabled:i.isPending,onClick:()=>i.mutate(t.jobId),children:[(0,K.jsx)(f,{className:`h-3 w-3`,"aria-hidden":`true`}),s?a(e,`brain.jobs.resuming`):a(e,`brain.jobs.resume`)]}):null]},t.jobId)})})]}):null}export{m as _,k as a,D as c,R as d,w as f,g,z as h,A as i,S as l,x as m,J as n,v as o,y as p,M as r,b as s,$ as t,O as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,b as t,f as n,h as r,m as i,n as a,r as o,v as s}from"./i18n-BBMJshCW.js";import{a as c,n as l,r as u}from"./navigation-D9D9_FPC.js";import{_ as d,c as f,d as p,g as m,h,i as g,m as _,n as v,p as y,t as b,u as x,y as S}from"./primitives-CmaSAyGG.js";import{t as C}from"./circle-check-CyGal42W.js";import{n as w,r as T,t as E}from"./hard-drive-CYo_bEl4.js";import{t as D}from"./folder-open-DNGytsVw.js";import{n as O}from"./sparkles-DXiaM1NS.js";import{f as k,i as A,w as j}from"./index-BjaXCeOZ.js";import{t as M}from"./input-ChWD-Fsh.js";var N=i(`clipboard-paste`,[[`path`,{d:`M11 14h10`,key:`1w8e9d`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v1.344`,key:`1e62lh`}],[`path`,{d:`m17 18 4-4-4-4`,key:`z2g111`}],[`path`,{d:`M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113`,key:`bjbb7m`}],[`rect`,{x:`8`,y:`2`,width:`8`,height:`4`,rx:`1`,key:`ublpy`}]]),P=i(`scan-line`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}]]),F=i(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),I=t(s()),L=e();function R({initialTab:e}){let t=r(e=>e.language),n=r(e=>e.mode),[i,o]=I.useState(e||`files`),s=[{id:`files`,label:a(t,`capture.tab.files`)},{id:`local`,label:a(t,`capture.tab.local`)},{id:`browser`,label:a(t,`capture.tab.browser`)},{id:`pipeline`,label:a(t,`capture.tab.pipeline`)}];I.useEffect(()=>{(e===`pipeline`||e===`local`||e===`browser`||e===`files`)&&o(e)},[e]);let c=e=>{o(e),l(`/`+{files:`capture`,local:`my-computer`,browser:`capture-browser`,pipeline:`pipeline`}[e])};return(0,L.jsxs)(`div`,{className:`product-page capture-page space-y-5`,children:[(0,L.jsxs)(`header`,{className:`page-hero`,children:[(0,L.jsxs)(`div`,{className:`page-kicker`,children:[(0,L.jsx)(F,{className:`h-4 w-4`}),` `,a(t,`capture.kicker`)]}),(0,L.jsx)(`h1`,{className:`page-title`,children:a(t,`capture.title`)}),(0,L.jsx)(`p`,{className:`page-copy`,children:a(t,`capture.body`)})]}),(0,L.jsx)(p,{tabs:n===`basic`?s.filter(e=>e.id!==`pipeline`):s,value:i,onChange:e=>c(e)}),i===`files`?(0,L.jsx)(z,{}):null,i===`local`?(0,L.jsx)(X,{}):null,i===`browser`?(0,L.jsx)(Z,{}):null,i===`pipeline`?(0,L.jsx)($,{}):null]})}function z(){let e=r(e=>e.language),t=c(),i=u({queryKey:[`documents`],queryFn:()=>n.documents(200)}),[o,s]=I.useState([]),l=j({mutationFn:e=>B(e,s),onSuccess:()=>{t.invalidateQueries({queryKey:[`documents`]}),t.invalidateQueries({queryKey:[`graphStats`]}),t.invalidateQueries({queryKey:[`memoryManager`]})}}),f=I.useCallback(e=>{let t=Array.from(e);t.length&&l.mutate(t)},[l]);return(0,L.jsxs)(`div`,{className:`capture-files-flow grid gap-4 xl:grid-cols-[0.75fr_1.25fr]`,children:[(0,L.jsxs)(y,{children:[(0,L.jsxs)(m,{children:[(0,L.jsxs)(d,{className:`flex items-center gap-2`,children:[(0,L.jsx)(F,{className:`h-4 w-4`}),` `,a(e,`capture.files.title`)]}),(0,L.jsx)(h,{children:a(e,`capture.files.description`)})]}),(0,L.jsxs)(_,{children:[(0,L.jsxs)(`label`,{className:`flex min-h-56 cursor-pointer flex-col items-center justify-center gap-3 rounded-lg border border-dashed border-border bg-muted/30 p-6 text-center transition hover:bg-muted/50`,onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),f(e.dataTransfer.files)},children:[(0,L.jsx)(F,{className:`h-7 w-7 text-primary`}),(0,L.jsx)(`span`,{className:`text-lg font-semibold`,children:a(e,`capture.files.drop`)}),(0,L.jsx)(`span`,{className:`max-w-sm text-sm leading-6 text-muted-foreground`,children:a(e,`capture.files.dropDetail`)}),(0,L.jsx)(`input`,{type:`file`,multiple:!0,className:`sr-only`,onChange:e=>e.target.files&&f(e.target.files)})]}),(0,L.jsx)(V,{queue:o,onRetry:e=>f([e])})]})]}),(0,L.jsx)(v,{title:a(e,`capture.files.uploaded`),result:i.data,children:t=>(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(g,{items:t.documents||t,titleKey:`filename`,metaKey:`ingest_state`,limit:12}),(0,L.jsx)(`div`,{className:`rounded-md border border-border bg-background/55 p-3 text-sm text-muted-foreground`,children:a(e,`capture.files.completed`)})]})})]})}async function B(e,t){let r=e.map(e=>({id:`${e.name}-${e.size}-${e.lastModified}-${Date.now()}`,file:e,name:W(e),size:e.size,status:`queued`}));t(e=>[...r,...e].slice(0,12));let i=[];for(let e of r){t(t=>t.map(t=>t.id===e.id?{...t,status:`uploading`}:t));let r=await n.uploadDocument(e.file);i.push(r),t(t=>t.map(t=>t.id===e.id?{...t,status:r.ok?`done`:`failed`,result:r}:t))}return i}function V({queue:e,onRetry:t}){let n=r(e=>e.language);return e.length?(0,L.jsx)(`div`,{className:`mt-4 space-y-2`,children:e.map(e=>{let r=H(e,n);return(0,L.jsxs)(`div`,{className:`rounded-md border border-border bg-background/55 p-3 text-sm`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2 font-medium`,children:[e.status===`done`?(0,L.jsx)(C,{className:`h-4 w-4 text-emerald-400`}):e.status===`failed`?(0,L.jsx)(S,{className:`h-4 w-4 text-amber-400`}):(0,L.jsx)(O,{className:`h-4 w-4 animate-spin text-primary`}),e.name]}),(0,L.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[Math.max(1,Math.round(e.size/1024)),` KB · `,r]})]}),e.status===`failed`?(0,L.jsxs)(A,{size:`sm`,variant:`outline`,onClick:()=>t(e.file),children:[(0,L.jsx)(k,{className:`h-3.5 w-3.5`}),` `,a(n,`capture.retry`)]}):null]}),e.result?(0,L.jsx)(f,{result:e.result,successLabel:a(n,`capture.files.success`)}):null]},e.id)})}):null}function H(e,t){if(e.status===`queued`)return a(t,`capture.files.queued`);if(e.status===`uploading`)return a(t,`capture.files.uploading`);if(!e.result?.ok)return e.result?.error||a(t,`capture.files.failed`);let n=e.result.data||{},r=String(n.node_id||n.graph_node||n.provenance_id||``);return r?a(t,`capture.files.capturedWithNode`,{node:r}):a(t,`capture.files.captured`)}var U={webkitdirectory:``,directory:``};function W(e){return e.webkitRelativePath||e.name}function G(e){return(e[0]?.webkitRelativePath||``).split(`/`).filter(Boolean)[0]||``}function K(){let e=window;return!!(e.__TAURI__?.core?.invoke||e.latticeDesktop?.selectFolder||e.__TAURI_INTERNALS__&&window.location.protocol===`tauri:`)}function q(e){return e instanceof DOMException&&e.name===`AbortError`}async function J(e){let t=[];if(typeof e.values==`function`){for await(let n of e.values())t.push(n);return t}if(typeof e.entries==`function`)for await(let[,n]of e.entries())t.push(n);return t}async function Y(e){let t=[];for(let n of await J(e)){if(n.kind===`file`){t.push(await n.getFile());continue}t.push(...await Y(n))}return t}function X(){let e=r(e=>e.language),t=c(),i=I.useRef(null),[s,l]=I.useState(``),[p,S]=I.useState(null),[C,T]=I.useState(``),[E,k]=I.useState(!1),[N,F]=I.useState([]),R=u({queryKey:[`localSources`],queryFn:n.localSources}),z=u({queryKey:[`localAgent`],queryFn:n.localAgent}),H=j({mutationFn:e=>n.connectFolder((e||s).trim()),onSuccess:()=>{S(null),t.invalidateQueries({queryKey:[`localSources`]}),t.invalidateQueries({queryKey:[`graphStats`]}),t.invalidateQueries({queryKey:[`memoryManager`]})}}),W=j({mutationFn:e=>B(e,F),onSuccess:()=>{t.invalidateQueries({queryKey:[`documents`]}),t.invalidateQueries({queryKey:[`graphStats`]}),t.invalidateQueries({queryKey:[`memoryManager`]})}}),J=I.useCallback((t,n)=>{if(!t.length){S(a(e,`capture.local.emptyFolder`));return}S(null),T(n||G(t)||a(e,`capture.local.browserFolder`)),W.mutate(t)},[W,e]),X=I.useCallback(async()=>{if(!E){k(!0),S(null);try{let t=window.showDirectoryPicker;if(!K()&&typeof t==`function`){let e=await t.call(window);J(await Y(e),e.name);return}if(K()){let e=await n.selectFolder();if(e){T(``),l(e),H.mutate(e);return}}if(typeof t==`function`){let e=await t.call(window);J(await Y(e),e.name);return}if(i.current){i.current.click();return}S(a(e,`capture.local.pickUnavailable`))}catch(t){q(t)||S(a(e,`capture.local.pickUnavailable`))}finally{k(!1)}}},[J,E,H,e]),Z=I.useCallback(()=>{let e=s.trim();e&&(S(null),T(``),H.mutate(e))},[H,s]),Q=(W.data||[]).find(e=>!e.ok)?.error,$=!!(W.error||Q);return(0,L.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[0.9fr_1.1fr]`,children:[(0,L.jsxs)(y,{children:[(0,L.jsxs)(m,{children:[(0,L.jsxs)(d,{className:`flex items-center gap-2`,children:[(0,L.jsx)(w,{className:`h-4 w-4`}),` `,a(e,`capture.local.title`)]}),(0,L.jsx)(h,{children:a(e,`capture.local.description`)})]}),(0,L.jsxs)(_,{className:`space-y-3`,children:[(0,L.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),Z()},children:[(0,L.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,L.jsx)(M,{value:s,onChange:e=>l(e.target.value),placeholder:a(e,`capture.local.placeholder`)}),(0,L.jsxs)(A,{type:`button`,variant:`outline`,disabled:E||H.isPending||W.isPending,onClick:()=>void X(),children:[E?(0,L.jsx)(O,{className:`h-4 w-4 animate-spin`}):(0,L.jsx)(D,{className:`h-4 w-4`}),E?a(e,`capture.local.choosing`):a(e,`capture.local.choose`)]})]}),(0,L.jsx)(`input`,{ref:i,type:`file`,multiple:!0,className:`sr-only`,"aria-hidden":`true`,tabIndex:-1,...U,onChange:e=>{let t=Array.from(e.currentTarget.files||[]);e.currentTarget.value=``,J(t)}}),(0,L.jsxs)(A,{type:`submit`,disabled:!s.trim()||H.isPending,children:[H.isPending?(0,L.jsx)(O,{className:`h-4 w-4 animate-spin`}):(0,L.jsx)(P,{className:`h-4 w-4`}),a(e,`capture.local.connect`)]})]}),p?(0,L.jsx)(f,{result:{ok:!1,status:0,data:{},source:`unavailable`,error:p}}):null,H.data?(0,L.jsx)(f,{result:H.data,successLabel:a(e,`capture.local.success`)}):null,C?(0,L.jsx)(f,{result:{ok:W.isPending||!$,status:$?0:200,data:{folder:C},source:$?`unavailable`:`live`,error:W.error?a(e,`capture.local.browserImportFailed`):Q},successLabel:W.isPending?a(e,`capture.local.browserImporting`):a(e,`capture.local.browserImportSuccess`,{folder:C})}):null,(0,L.jsx)(V,{queue:N,onRetry:e=>J([e],C)})]})]}),(0,L.jsx)(v,{title:a(e,`capture.local.sources`),result:R.data,children:t=>(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(g,{items:t.sources,titleKey:`path`,metaKey:`status`}),o(t.sources).map(t=>(0,L.jsx)(b,{label:a(e,`capture.local.stop`,{source:String(t.path||t.id||a(e,`capture.local.source`))}),action:()=>n.localWatchStop(String(t.id||t.source_id)),invalidate:[`localSources`]},String(t.id||t.source_id||t.path)))]})}),(0,L.jsx)(v,{title:a(e,`capture.local.access`),result:z.data,className:`xl:col-span-2`,children:e=>(0,L.jsx)(x,{value:e})})]})}function Z(){let e=r(e=>e.language),t=c(),[i,o]=I.useState(``),s=j({mutationFn:e=>n.browserReadUrl(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`graphStats`]}),t.invalidateQueries({queryKey:[`memoryManager`]})}}),l=I.useCallback(()=>{let e=Q(i);e&&(o(e),s.mutate(e))},[s,i]),u=I.useCallback(async()=>{let e=Q(await navigator.clipboard?.readText().catch(()=>``)||``);e&&(o(e),s.mutate(e))},[s]);return(0,L.jsxs)(y,{children:[(0,L.jsxs)(m,{children:[(0,L.jsxs)(d,{className:`flex items-center gap-2`,children:[(0,L.jsx)(T,{className:`h-4 w-4`}),` `,a(e,`capture.browser.title`)]}),(0,L.jsx)(h,{children:a(e,`capture.browser.description`)})]}),(0,L.jsxs)(_,{className:`space-y-3`,children:[(0,L.jsxs)(`form`,{className:`flex flex-col gap-2 sm:flex-row`,onSubmit:e=>{e.preventDefault(),l()},children:[(0,L.jsx)(M,{value:i,onChange:e=>o(e.target.value),placeholder:a(e,`capture.browser.placeholder`),inputMode:`url`}),(0,L.jsxs)(A,{type:`button`,variant:`outline`,disabled:s.isPending,onClick:()=>void u(),children:[(0,L.jsx)(N,{className:`h-4 w-4`}),` `,a(e,`capture.browser.paste`)]}),(0,L.jsxs)(A,{type:`submit`,disabled:!i.trim()||s.isPending,children:[s.isPending?(0,L.jsx)(O,{className:`h-4 w-4 animate-spin`}):(0,L.jsx)(P,{className:`h-4 w-4`}),a(e,`capture.browser.capture`)]})]}),s.data?(0,L.jsx)(f,{result:s.data,successLabel:a(e,`capture.browser.success`)}):null]})]})}function Q(e){let t=e.trim();return t?/^https?:\/\//i.test(t)?t:/^[\w.-]+\.[a-z]{2,}([/:?#].*)?$/i.test(t)?`https://${t}`:t:``}function $(){let e=r(e=>e.language),t=u({queryKey:[`index`],queryFn:n.indexStatus}),i=u({queryKey:[`graphStats`],queryFn:n.graphStats});return(0,L.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,L.jsx)(v,{title:a(e,`capture.pipeline.status`),result:t.data,children:e=>(0,L.jsx)(x,{value:e})}),(0,L.jsx)(v,{title:a(e,`capture.pipeline.growth`),result:i.data,children:e=>(0,L.jsx)(x,{value:e})}),(0,L.jsxs)(y,{className:`xl:col-span-2`,children:[(0,L.jsxs)(m,{children:[(0,L.jsxs)(d,{className:`flex items-center gap-2`,children:[(0,L.jsx)(E,{className:`h-4 w-4`}),` `,a(e,`capture.pipeline.refresh`)]}),(0,L.jsx)(h,{children:a(e,`capture.pipeline.description`)})]}),(0,L.jsx)(_,{children:(0,L.jsx)(b,{label:a(e,`capture.pipeline.rebuild`),action:()=>n.rebuildIndex(),invalidate:[`index`]})})]})]})}export{R as CapturePage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,b as t,f as n,m as r,n as i,r as a,v as o}from"./i18n-BBMJshCW.js";import{n as s,r as c}from"./navigation-D9D9_FPC.js";import{t as l}from"./bot-Bp2x1i6F.js";import{b as u,d,g as f,m as p,o as m,p as h,u as g}from"./index-BjaXCeOZ.js";var _=r(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),v=r(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),y=r(`file-search`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`11.5`,cy:`14.5`,r:`2.5`,key:`1bq0ko`}],[`path`,{d:`M13.3 16.3 15 18`,key:`2quom7`}]]),b=r(`message-circle`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]),x=t(o()),S=e(),C=[{id:`page-brain`,labelKey:`shell.route.brain`,target:`/brain`,icon:(0,S.jsx)(u,{className:`h-4 w-4`})},{id:`page-capture`,labelKey:`shell.route.capture`,target:`/capture`,icon:(0,S.jsx)(p,{className:`h-4 w-4`})},{id:`page-memory`,labelKey:`shell.route.memory`,target:`/hybrid-search`,icon:(0,S.jsx)(f,{className:`h-4 w-4`})},{id:`page-library`,labelKey:`shell.route.library`,target:`/models`,icon:(0,S.jsx)(h,{className:`h-4 w-4`})},{id:`page-act`,labelKey:`shell.route.act`,target:`/agents`,icon:(0,S.jsx)(m,{className:`h-4 w-4`})},{id:`page-review`,labelKey:`command.page.review`,target:`/act/review`,icon:(0,S.jsx)(y,{className:`h-4 w-4`})},{id:`page-system`,labelKey:`shell.route.system`,target:`/settings`,icon:(0,S.jsx)(g,{className:`h-4 w-4`})}];function w(e,t){let[n,r]=x.useState(e);return x.useEffect(()=>{let n=window.setTimeout(()=>r(e),t);return()=>window.clearTimeout(n)},[e,t]),n}function T({language:e,initialOpen:t=!1}){let[r,o]=x.useState(t),[u,p]=x.useState(``),[m,h]=x.useState(0),g=x.useRef(null),y=w(u.trim(),220);x.useEffect(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),o(e=>!e))},t=()=>o(!0);return window.addEventListener(`keydown`,e),window.addEventListener(`lattice:open-command`,t),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`lattice:open-command`,t)}},[]),x.useEffect(()=>{r&&(p(``),h(0),window.setTimeout(()=>g.current?.focus(),0))},[r]);let T=c({queryKey:[`commandSearch`,y],queryFn:()=>n.commandSearch(y),enabled:r&&y.length>0}),E=x.useMemo(()=>{let t=u.trim().toLowerCase(),n=C.map(t=>({id:t.id,group:`pages`,title:i(e,t.labelKey),icon:t.icon,target:t.target})).filter(e=>!t||e.title.toLowerCase().includes(t)),r=a(T.data?.data?.groups),o=[];for(let t of r)for(let n of a(t.items))t.kind===`knowledge`?o.push({id:`kg-${String(n.id??o.length)}`,group:`knowledge`,title:String(n.title||n.id||``),detail:String(n.summary||n.type||``),icon:(0,S.jsx)(f,{className:`h-4 w-4`}),target:`/brain/graph`}):t.kind===`conversation`?o.push({id:`conv-${String(n.conversation_id??o.length)}`,group:`conversation`,title:String(n.snippet||``),detail:String(n.timestamp||``).slice(0,10),icon:(0,S.jsx)(b,{className:`h-4 w-4`}),target:`/brain`}):t.kind===`automation`&&o.push({id:`wf-${String(n.id??o.length)}`,group:`automation`,title:String(n.name||``),detail:n.enabled?i(e,`command.automation.enabled`):i(e,`command.automation.draft`),icon:(0,S.jsx)(l,{className:`h-4 w-4`}),target:`/act/workflows`});return[...o,...n]},[e,u,T.data]);x.useEffect(()=>{h(0)},[E.length,y]);let D=x.useCallback(()=>o(!1),[]),O=x.useCallback(e=>{e&&(D(),s(e.target))},[D]),k=e=>{e.key===`Escape`?(e.preventDefault(),D()):e.key===`ArrowDown`?(e.preventDefault(),h(e=>Math.min(e+1,Math.max(E.length-1,0)))):e.key===`ArrowUp`?(e.preventDefault(),h(e=>Math.max(e-1,0))):e.key===`Enter`&&(e.preventDefault(),O(E[m]))};if(!r)return null;let A={pages:i(e,`command.group.pages`),knowledge:i(e,`command.group.knowledge`),conversation:i(e,`command.group.conversation`),automation:i(e,`command.group.automation`)},j=null;return(0,S.jsx)(`div`,{className:`command-palette-backdrop`,role:`presentation`,onMouseDown:e=>{e.target===e.currentTarget&&D()},children:(0,S.jsxs)(`div`,{className:`command-palette`,role:`dialog`,"aria-modal":`true`,"aria-label":i(e,`command.title`),"data-testid":`command-palette`,children:[(0,S.jsxs)(`div`,{className:`command-palette-input`,children:[(0,S.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,S.jsx)(`input`,{ref:g,value:u,onChange:e=>p(e.target.value),onKeyDown:k,placeholder:i(e,`command.placeholder`),"aria-label":i(e,`command.title`),autoComplete:`off`,spellCheck:!1}),(0,S.jsxs)(`span`,{className:`command-palette-hint`,"aria-hidden":`true`,children:[(0,S.jsx)(_,{className:`h-3 w-3`}),i(e,`command.shortcutKey`)]})]}),(0,S.jsxs)(`div`,{className:`command-palette-results`,role:`listbox`,"aria-label":i(e,`command.results`),children:[T.isFetching?(0,S.jsx)(`p`,{className:`command-palette-note`,children:i(e,`command.searching`)}):null,E.length===0&&!T.isFetching?(0,S.jsx)(`p`,{className:`command-palette-note`,children:i(e,`command.empty`)}):null,E.map((e,t)=>{let n=e.group===j?null:(0,S.jsx)(`p`,{className:`command-palette-group`,children:A[e.group]},`h-${e.group}`);return j=e.group,(0,S.jsxs)(x.Fragment,{children:[n,(0,S.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t===m,className:`command-palette-item ${t===m?`is-active`:``}`,onMouseEnter:()=>h(t),onClick:()=>O(e),children:[e.icon,(0,S.jsx)(`span`,{className:`command-palette-item-title`,children:e.title}),e.detail?(0,S.jsx)(`span`,{className:`command-palette-item-detail`,children:e.detail}):null,t===m?(0,S.jsx)(v,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}):null]})]},e.id)})]}),(0,S.jsx)(`p`,{className:`command-palette-footer`,children:i(e,`command.footer`)})]})})}export{T as CommandPalette};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,b as t,f as n,h as r,m as i,n as a,r as o,v as s}from"./i18n-BBMJshCW.js";import{a as c,n as l,r as u}from"./navigation-D9D9_FPC.js";import{_ as d,c as f,d as p,f as m,g as h,h as g,i as _,l as v,m as y,n as b,p as x,r as S,t as C,u as w,v as T}from"./primitives-CmaSAyGG.js";import{t as E}from"./circle-check-CyGal42W.js";import{t as D}from"./cpu-DQFk82hG.js";import{t as O}from"./download-C70gKQVi.js";import{i as k,w as A}from"./index-BjaXCeOZ.js";import{t as j}from"./input-ChWD-Fsh.js";var M=i(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),N=i(`circle-play`,[[`path`,{d:`M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z`,key:`kmsa83`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),P=i(`package-plus`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M19 14v6`,key:`1ckrd5`}],[`path`,{d:`M21 10.535V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`28k6lz`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),F=i(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),I=i(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),L=t(s()),R=e(),z=[{id:`models`,labelKey:`library.tab.models`},{id:`skills`,labelKey:`library.tab.skills`},{id:`mcp`,labelKey:`library.tab.mcp`},{id:`marketplace`,labelKey:`library.tab.marketplace`}];function B({initialTab:e}){let t=r(e=>e.mode),n=r(e=>e.language),[i,o]=L.useState(e||`models`);L.useEffect(()=>{z.some(t=>t.id===e)&&o(e)},[e]);let s=(t===`basic`?z.filter(e=>e.id===`models`):z).map(e=>({id:e.id,label:a(n,e.labelKey)})),c=e=>{o(e),l(`/`+e)};return(0,R.jsxs)(`div`,{className:`product-page library-page space-y-5`,children:[(0,R.jsxs)(`header`,{className:`page-hero`,children:[(0,R.jsxs)(`div`,{className:`page-kicker`,children:[(0,R.jsx)(M,{className:`h-4 w-4`}),` `,a(n,`library.kicker`)]}),(0,R.jsx)(`h1`,{className:`page-title`,children:a(n,`library.title`)}),(0,R.jsx)(`p`,{className:`page-copy`,children:a(n,`library.body`)})]}),(0,R.jsx)(p,{tabs:s,value:i,onChange:e=>c(e)}),i===`models`?(0,R.jsx)(V,{}):null,i===`skills`?(0,R.jsx)(K,{}):null,i===`mcp`?(0,R.jsx)(q,{}):null,i===`marketplace`?(0,R.jsx)(J,{}):null]})}function V(){let e=c(),t=r(e=>e.mode),i=r(e=>e.language),s=u({queryKey:[`models`],queryFn:n.models}),l=u({queryKey:[`modelRecommendations`,`local_mlx`],queryFn:()=>n.modelRecommendations(`local_mlx`)}),d=u({queryKey:[`embeddings`],queryFn:n.embeddingsStatus}),[f,p]=L.useState(!1),[h,g]=L.useState(null),[v,y]=L.useState([]),[x,A]=L.useState(null),[j,M]=L.useState(null),[F,z]=L.useState(!1),B=[...o(s.data?.data?.catalog),...o(s.data?.data?.recommended)],V=o(l.data?.data?.recommendations?.models),K=new Map(V.map(e=>[String(e.id),e])),q=o(s.data?.data?.loaded),J=String(s.data?.data?.current||``),Y=B.find(e=>q.includes(String(e.id))||String(e.id)===J),X=l.data?.data?.recommendations?.top_pick||null,Z=v[v.length-1]||null,Q=L.useCallback(e=>{let n=String(e||a(i,`library.model.notReady`));if(t!==`basic`)return n;let r=n.replace(/gemma4_unified/gi,a(i,`library.model.localFormat`)).replace(/mlx[-_ ]?vlm|mlx[-_ ]?lm|local_mlx|\bmlx\b|\bgguf\b|\bollama\b|hugging face/gi,a(i,`library.model.localSupport`)).replace(/runtime/gi,a(i,`library.model.support`)).replace(/model_type/gi,a(i,`library.model.format`));return i===`en`?r.replace(/this local model format local model support format/gi,a(i,`library.model.localFormat`)).replace(/local model support model support/gi,a(i,`library.model.localSupport`)):r},[i,t]);async function $(t,r,i){z(!0),g(t),y([]),A(null),M(null);let a=await n.streamModelPrepare({model:t,engine:r||`local_mlx`,allow_download:i},{onProgress:e=>y(t=>[...t.slice(-8),e]),onDone:e=>A(e),onError:e=>M(e)});z(!1),await e.invalidateQueries({queryKey:[`models`]}),await e.invalidateQueries({queryKey:[`modelRecommendations`,`local_mlx`]}),!a.ok&&!j&&M(a.data)}return(0,R.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[1.2fr_0.8fr]`,children:[(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsx)(b,{title:a(i,`library.models.setup.title`),description:a(i,`library.models.setup.desc`),result:l.data,children:r=>{let o=r.recommendations,s=r.profile;return(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsx)(U,{language:i,mode:t,profile:s||{},recommendation:o||{},current:Y,currentId:J,latestProgress:Z,lastResult:x,onReload:()=>{Y&&$(String(Y.recommended_load_id||Y.id||J),String(Y.recommended_engine||Y.engine||`local_mlx`),f)},onUnload:()=>{J&&n.unloadModel(J).then(()=>e.invalidateQueries({queryKey:[`models`]}))}}),(0,R.jsx)(`div`,{className:`grid gap-2 md:grid-cols-3 xl:grid-cols-6`,children:[[a(i,`library.step.environment`),!0,D],[a(i,`library.step.recommend`),!!(X||B.length),E],[a(i,`library.step.install`),!!(Y||Z?.stage===`engine`),P],[a(i,`library.step.download`),!!(Y||Z?.stage===`download`),O],[a(i,`library.step.validate`),!!(Y||Z?.stage===`smoke_test`),I],[a(i,`library.step.ready`),!!(Y||x),N]].map(([e,t,n])=>(0,R.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/55 p-3`,children:[L.createElement(n,{className:`h-4 w-4 text-primary`}),(0,R.jsx)(`div`,{className:`mt-2 text-sm font-medium`,children:String(e)}),(0,R.jsx)(T,{variant:t?`success`:`muted`,children:t?a(i,`library.step.done`):a(i,`library.step.pending`)})]},String(e)))}),(0,R.jsxs)(`label`,{className:`flex items-start gap-2 rounded-lg border border-border bg-background/55 p-3 text-sm leading-6`,children:[(0,R.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:f,onChange:e=>p(e.target.checked)}),(0,R.jsx)(`span`,{children:a(i,`library.consent`)})]}),Z?(0,R.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/55 p-3 text-sm`,children:[(0,R.jsx)(`div`,{className:`font-medium`,children:String(Z.message||a(i,`library.preparing`))}),(0,R.jsx)(`div`,{className:`mt-2 h-2 overflow-hidden rounded-full bg-muted`,children:(0,R.jsx)(`div`,{className:`h-full bg-primary`,style:{width:`${Number(Z.percent||8)}%`}})}),Z.detail?(0,R.jsx)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:String(Z.detail)}):null]}):null,j?(0,R.jsx)(W,{error:j}):null]})}}),(0,R.jsx)(b,{title:t===`basic`?a(i,`library.panel.recommended.basic`):a(i,`library.panel.recommended.other`),result:s.data,children:e=>(0,R.jsxs)(`div`,{className:`grid gap-2`,children:[(B.length?B:o(e.loaded)).slice(0,t===`basic`?3:14).map((r,s)=>{let c=String(r.id||r.model_id||r.name||s),l=o(e.loaded).includes(c)||e.current===c||r.state===`loaded`,u=String(r.recommended_load_id||c),d=String(r.recommended_engine||r.engine||``),p=K.get(c)||K.get(u)||{},m=G(r.verification),g=G(p.verification),_=G(r.hardware),v=G(p.hardware),y=_.notes||v.notes||(_.recommended_ram_gb?a(i,`library.model.ramRecommended`,{ram:String(_.recommended_ram_gb)}):``),b=r.safety_notes||p.safety_notes,x=r.license||p.license,S=r.runtime_compatibility||p.runtime_compatibility||{},w=String(S.status||``)===`fallback_available`,E=r.load_status===`unsupported`||S.supported===!1,D=!!r.download_required,O=(!!r.load_available||l)&&!E,A=String(r.load_status||(l?`loaded`:`unavailable`)),j=Q(r.unavailable_reason||a(i,`library.model.notReady`)),M=String(r.runtime_label||S.preferred_runtime||d||`local_mlx`),N=String(S.action||A.replace(/_/g,` `)),P=E&&t===`basic`?a(i,`library.model.needsAttention`):E?N:A,I=O||D,L=r.download_size||r.estimated_size||p.download_size||p.estimated_size||r.size||p.size,z=r.provider||p.provider||r.organization||p.organization;return(0,R.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-border bg-background/55 p-4 md:grid-cols-[1fr_auto]`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(`div`,{className:`text-base font-semibold`,children:String(r.name||c)}),X?.id===c||r.recommended_default?(0,R.jsx)(T,{variant:`success`,children:a(i,`library.model.recommended`)}):null,String(r.modality||p.modality||``).includes(`multi`)||String(r.modality||``)===`multimodal`?(0,R.jsx)(T,{variant:`muted`,children:a(i,`library.model.multimodal`)}):null,m.verified||g.verified?(0,R.jsx)(T,{variant:`success`,title:a(i,`library.model.hfVerified`),children:`✓ HF`}):null]}),(0,R.jsx)(`div`,{className:`mt-1 text-sm text-muted-foreground`,children:t===`basic`?[Q(r.family||p.family||a(i,`library.model.local`)),/mlx|gguf|ollama/i.test(String(r.size||p.size||``))?``:r.size||p.size].filter(Boolean).map(String).join(` · `):[r.family||p.family||a(i,`library.value.local`),r.size||p.size].filter(Boolean).map(String).join(` · `)}),r.hardware||p.hardware?(0,R.jsx)(`div`,{className:`mt-1 text-[11px] text-muted-foreground/80`,children:String(y)}):null,(0,R.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1 text-[11px] text-muted-foreground`,children:[(0,R.jsx)(T,{variant:`muted`,children:D?a(i,`library.model.downloadSize`,{size:String(L||a(i,`library.model.downloadRequired`))}):a(i,`library.model.noDownload`)}),(0,R.jsx)(T,{variant:`muted`,children:D?a(i,`library.model.internetDuringDownload`):a(i,`library.model.runsLocally`)}),z?(0,R.jsx)(T,{variant:`muted`,children:String(z)}):null]}),E?(0,R.jsxs)(`div`,{className:`mt-3 rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-sm`,children:[(0,R.jsx)(`div`,{className:`font-medium`,children:t===`basic`?a(i,`library.model.attentionBeforeLoad`):N}),(0,R.jsx)(`div`,{className:`text-muted-foreground`,children:Q(S.user_message||j)})]}):w?(0,R.jsxs)(`div`,{className:`mt-3 rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-sm`,children:[(0,R.jsx)(`div`,{className:`font-medium`,children:t===`basic`?a(i,`library.model.compatiblePath`):a(i,`library.model.runtimeFallback`)}),(0,R.jsx)(`div`,{className:`text-muted-foreground`,children:Q(S.user_message||a(i,`library.model.compatibilityFallback`))})]}):!l&&!O?(0,R.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:j}):null,t===`basic`?null:(0,R.jsxs)(`div`,{className:`mt-2 space-y-1 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`div`,{children:[M,` · `,u,r.load_strategy||p.load_strategy?` · ${String(r.load_strategy||p.load_strategy)}`:``,m.notes?` · ${String(m.notes).slice(0,60)}`:``]}),b||x?(0,R.jsx)(`div`,{children:[x?a(i,`library.model.license`,{license:String(x)}):``,b?String(b):``].filter(Boolean).join(` · `)}):null]}),E||w?(0,R.jsx)(H,{compatibility:S}):null]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 md:justify-end`,children:[(0,R.jsx)(T,{variant:l?`success`:O?`muted`:`warning`,children:l?a(i,`library.model.loaded`):P}),l?(0,R.jsx)(C,{label:a(i,`library.runtime.unload`),action:()=>n.unloadModel(u),invalidate:[`models`]}):(0,R.jsx)(k,{variant:`outline`,disabled:F||E||!I||D&&!f,onClick:()=>$(u,d||`local_mlx`,f),children:h===u&&F?a(i,`library.btn.preparing`):D?a(i,`library.btn.installLoad`):a(i,`library.btn.validateLoad`)})]})]},c)}),t===`basic`&&B.length>3?(0,R.jsx)(`div`,{className:`rounded-lg border border-border bg-background/55 p-3 text-sm text-muted-foreground`,children:a(i,`library.model.shortListHint`)}):null]})})]}),(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsx)(b,{title:t===`basic`?a(i,`library.models.embedding.basic`):a(i,`library.models.embedding.advanced`),result:d.data,children:e=>t===`basic`?(0,R.jsx)(m,{value:e.state||a(i,`library.value.ready`)}):(0,R.jsx)(w,{value:e})}),(0,R.jsx)(b,{title:t===`basic`?a(i,`library.models.validation`):a(i,`library.models.validationAdvanced`),result:s.data,children:e=>{let n=o(e.compat_profiles);return n.length?(0,R.jsx)(_,{items:n.map(e=>({...e,name:t===`basic`?e.name||e.display_name||a(i,`library.model.loadedName`):e.name||e.display_name||e.model_id,status:e.quality_status||e.load_status||a(i,`library.model.checked`)})),titleKey:`name`,metaKey:`status`,limit:6}):(0,R.jsx)(S,{title:a(i,`library.model.noneChecked`),detail:a(i,`library.model.noneCheckedHint`)})}})]})]})}function H({compatibility:e}){let t=r(e=>e.mode),n=r(e=>e.language),i=o(e.alternatives);return i.length?(0,R.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:i.slice(0,3).map(e=>(0,R.jsx)(T,{variant:`muted`,children:t===`basic`&&/mlx|gguf|ollama|lm studio/i.test(String(e.name||e.id))?a(n,`library.model.compatibleAlternative`):String(e.name||e.id)},String(e.id||e.name)))}):null}function U({language:e=`en`,mode:t=`advanced`,profile:n,recommendation:r,current:i,currentId:o,latestProgress:s,lastResult:c,onReload:l,onUnload:u}){let d=String(i?.name||i?.id||o||``),f=String(i?.engine||i?.recommended_engine||s?.engine||`local_mlx`),p=String(i?.local_path||i?.storage_location||r.cache_path||r.storage_location||`~/.cache/huggingface / ~/.latticeai/models`),m=String(s?.stage||c?.stage||(d?a(e,`library.value.ready`):a(e,`library.value.idle`))),h=t===`basic`;return(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsx)(v,{stats:h?[{label:a(e,`library.runtime.computer`),value:n?.os?`${String(n.os)} ${String(n.arch||``)}`:a(e,`library.value.detected`)},{label:a(e,`library.runtime.loaded`),value:d||a(e,`library.runtime.noneShort`)}]:[{label:a(e,`library.runtime.computer`),value:n?.os?`${String(n.os)} ${String(n.arch||``)}`:a(e,`library.value.detected`)},{label:a(e,`library.runtime.engine`),value:f},{label:a(e,`library.runtime.loaded`),value:d||a(e,`library.runtime.noLoaded`)},{label:a(e,`library.runtime.state`),value:m}]}),(0,R.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/55 p-3 text-sm`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`font-medium`,children:d?a(e,`library.models.runtime.available`):a(e,`library.models.runtime.none`)}),h?null:(0,R.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:a(e,`library.runtime.cacheStorage`,{path:p})})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,R.jsx)(k,{variant:`outline`,size:`sm`,disabled:!d,onClick:l,children:a(e,`library.runtime.reload`)}),(0,R.jsx)(k,{variant:`outline`,size:`sm`,disabled:!d,onClick:u,children:a(e,`library.runtime.unload`)})]})]}),s?(0,R.jsxs)(`div`,{className:`mt-3`,children:[(0,R.jsxs)(`div`,{className:`flex justify-between text-xs text-muted-foreground`,children:[(0,R.jsx)(`span`,{children:String(s.message||a(e,`library.preparing`))}),(0,R.jsxs)(`span`,{children:[Number(s.percent||0),`%`]})]}),(0,R.jsx)(`div`,{className:`mt-1 h-2 overflow-hidden rounded-full bg-muted`,children:(0,R.jsx)(`div`,{className:`h-full bg-primary`,style:{width:`${Number(s.percent||8)}%`}})})]}):null]})]})}function W({error:e}){let t=r(e=>e.language),n=o(e.recovery_guidance);return(0,R.jsxs)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-sm`,children:[(0,R.jsx)(`div`,{className:`font-medium`,children:String(e.user_message||a(t,`library.model.setupAttention`))}),n.length?(0,R.jsx)(`ul`,{className:`mt-2 list-inside list-disc text-muted-foreground`,children:n.slice(0,3).map(e=>(0,R.jsx)(`li`,{children:e},e))}):null]})}function G(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function K(){let e=c(),t=r(e=>e.language),i=u({queryKey:[`skills`],queryFn:n.skills}),s=u({queryKey:[`skillsMarketplace`],queryFn:n.skillsMarketplace}),l=A({mutationFn:e=>n.skillInstall(String(e.name||e.id),String(e.plugin||``)),onSuccess:()=>e.invalidateQueries({queryKey:[`skills`]})});return(0,R.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,R.jsx)(b,{title:a(t,`library.skills.installed`),result:i.data,children:e=>(0,R.jsx)(`div`,{className:`grid gap-2`,children:o(e.skills).map(e=>(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`font-medium`,children:String(e.name||e.id)}),(0,R.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:String(e.plugin||e.description||``)})]}),(0,R.jsx)(C,{label:a(t,e.enabled?`library.skills.disable`:`library.skills.enable`),action:()=>n.skillToggle(String(e.name||e.id),!!e.enabled),invalidate:[`skills`]})]},String(e.name||e.id)))})}),(0,R.jsx)(b,{title:a(t,`library.skills.marketplace`),result:s.data,children:e=>(0,R.jsx)(`div`,{className:`grid gap-2`,children:o(e.skills).slice(0,10).map(e=>(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`font-medium`,children:String(e.name||e.id)}),(0,R.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:String(e.description||e.category||``)})]}),(0,R.jsx)(k,{variant:`outline`,disabled:l.isPending,onClick:()=>l.mutate(e),children:a(t,`library.skills.install`)})]},String(e.name||e.id)))})})]})}function q(){let e=r(e=>e.mode),t=r(e=>e.language),[i,o]=L.useState(`github`),s=u({queryKey:[`mcpTools`],queryFn:n.mcpTools}),c=A({mutationFn:()=>n.mcpRecommend(i)});return(0,R.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[1fr_1fr]`,children:[(0,R.jsx)(b,{title:a(t,e===`basic`?`library.connector.connections`:`library.connector.mcpTools`),result:s.data,children:e=>(0,R.jsx)(_,{items:e.tools||e.installed_mcps,titleKey:`name`,metaKey:`status`})}),(0,R.jsxs)(x,{children:[(0,R.jsxs)(h,{children:[(0,R.jsxs)(d,{className:`flex items-center gap-2`,children:[(0,R.jsx)(F,{className:`h-4 w-4`}),` `,a(t,`library.connector.recommend`)]}),(0,R.jsx)(g,{children:a(t,`library.connector.recommendHint`)})]}),(0,R.jsxs)(y,{className:`space-y-3`,children:[(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(j,{value:i,onChange:e=>o(e.target.value)}),(0,R.jsx)(k,{onClick:()=>c.mutate(),disabled:!i.trim()||c.isPending,children:a(t,`library.connector.recommendAction`)})]}),c.data?(0,R.jsx)(f,{result:c.data,successLabel:a(t,`library.connector.recommendDone`)}):null]})]})]})}function J(){let e=r(e=>e.language),t=u({queryKey:[`templates`],queryFn:n.templates}),i=u({queryKey:[`plugins`],queryFn:n.pluginsRegistry}),s=u({queryKey:[`pluginsDirectory`],queryFn:n.pluginsDirectory});return(0,R.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-3`,children:[(0,R.jsx)(b,{title:a(e,`library.market.templates`),result:t.data,children:e=>(0,R.jsx)(_,{items:e.templates,titleKey:`name`,metaKey:`kind`})}),(0,R.jsx)(b,{title:a(e,`library.market.installedPlugins`),result:i.data,children:e=>(0,R.jsx)(_,{items:e.plugins,titleKey:`name`,metaKey:`status`})}),(0,R.jsx)(b,{title:a(e,`library.market.pluginDirectory`),result:s.data,children:e=>(0,R.jsx)(_,{items:e.plugins,titleKey:`name`,metaKey:`category`})}),(0,R.jsxs)(x,{className:`xl:col-span-3`,children:[(0,R.jsxs)(h,{children:[(0,R.jsxs)(d,{className:`flex items-center gap-2`,children:[(0,R.jsx)(P,{className:`h-4 w-4`}),` `,a(e,`library.market.templateInstall`)]}),(0,R.jsx)(g,{children:a(e,`library.market.templateInstallHint`)})]}),(0,R.jsx)(y,{children:o(t.data?.data?.templates).length?(0,R.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:o(t.data?.data?.templates).slice(0,6).map(t=>(0,R.jsx)(C,{label:a(e,`library.market.installTemplate`,{name:String(t.name||t.id)}),action:()=>n.installTemplate(t)},String(t.id||t.name)))}):(0,R.jsx)(_,{items:[]})})]})]})}export{B as LibraryPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,a as t,b as n,h as r,m as i,n as a,v as o}from"./i18n-BBMJshCW.js";var s=i(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),c=i(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),l=n(o()),u=e(),d=Array.from({length:12},(e,t)=>t),f=[{x:22,y:32,delay:-.4,duration:5.8},{x:36,y:18,delay:-2.1,duration:6.4},{x:65,y:22,delay:-3.7,duration:5.4},{x:79,y:42,delay:-1.3,duration:6.8},{x:68,y:72,delay:-4.5,duration:5.9},{x:31,y:75,delay:-2.8,duration:6.2}];function p({state:e=`idle`,intensity:n=.6,onPulse:i,size:o=`large`,label:s,className:c,showLabel:p=!0,depth:h=0,onInteract:g}){let _=r(e=>e.language),v=l.useRef(null),y=l.useRef(null),b=l.useRef(null),x=l.useRef({x:0,y:0}),S=l.useId().replace(/:/g,``),C={left:`${S}-lobe-left`,right:`${S}-lobe-right`,bridge:`${S}-bridge`,stem:`${S}-stem`,sheen:`${S}-sheen`},w=l.useCallback(()=>{v.current&&(v.current.classList.add(`pulse`),y.current!==null&&window.clearTimeout(y.current),y.current=window.setTimeout(()=>{v.current&&v.current.classList.remove(`pulse`)},1350)),i?.()},[i]);l.useEffect(()=>{let e=()=>w();return window.addEventListener(`brain:recall`,e),()=>{window.removeEventListener(`brain:recall`,e),y.current!==null&&window.clearTimeout(y.current)}},[w]),l.useEffect(()=>{if(e===`recalling`||n>.82){let e=window.setTimeout(()=>w(),180);return()=>clearTimeout(e)}},[e,n,w]);let T=e,E=o===`large`,D=o===`trace`,O=Math.max(.35,Math.min(1,n)),k=Math.max(0,Math.min(5,h||0)),A=e===`thinking`||e===`recalling`||e===`synthesizing`||e===`acting`,j=()=>{w(),!A&&g?.()},M=l.useRef(!1);l.useEffect(()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>{M.current=e.matches};return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let N=l.useCallback(e=>{if(M.current||e.pointerType===`touch`)return;let t=v.current;if(!t)return;let n=t.getBoundingClientRect(),r=(e.clientX-n.left)/n.width*2-1;x.current={x:((e.clientY-n.top)/n.height*2-1)*-9,y:r*11},b.current===null&&(b.current=window.requestAnimationFrame(()=>{b.current=null;let e=v.current;e&&(e.style.setProperty(`--tilt-y`,`${x.current.y.toFixed(2)}deg`),e.style.setProperty(`--tilt-x`,`${x.current.x.toFixed(2)}deg`))}))},[]),P=l.useCallback(()=>{b.current!==null&&(window.cancelAnimationFrame(b.current),b.current=null);let e=v.current;e&&(e.style.setProperty(`--tilt-y`,`0deg`),e.style.setProperty(`--tilt-x`,`0deg`))},[]);return l.useEffect(()=>()=>{b.current!==null&&window.cancelAnimationFrame(b.current)},[]),(0,u.jsxs)(`div`,{className:t(`brain-presence select-none`,E&&`large`,D&&`trace`,c,k>0&&`is-exploring`),"aria-label":a(_,`brain.living.aria`),role:`group`,"data-depth":k,children:[(0,u.jsxs)(`button`,{type:`button`,ref:v,className:t(`brain-organism`,`size-${o}`,`depth-${k}`),"data-state":T,"data-testid":`living-brain`,"aria-label":a(_,k<5?`brain.living.open`:`brain.living.graph`),"aria-busy":A,style:{"--brain-scale":`${.96+(O-.5)*.09+k*.015}`},onClick:j,onPointerMove:N,onPointerLeave:P,title:a(_,k<5?`brain.living.open`:`brain.living.graph`),children:[(0,u.jsxs)(`div`,{className:`brain-vital-field`,"aria-hidden":`true`,children:[(0,u.jsx)(`span`,{className:`brain-vital-ring is-primary`}),(0,u.jsx)(`span`,{className:`brain-vital-ring is-echo`}),(0,u.jsx)(`span`,{className:`brain-orbit is-near`,children:(0,u.jsx)(`i`,{})}),(0,u.jsx)(`span`,{className:`brain-orbit is-far`,children:(0,u.jsx)(`i`,{})}),f.map((e,t)=>(0,u.jsx)(`i`,{className:`brain-vital-spark`,style:{left:`${e.x}%`,top:`${e.y}%`,animationDelay:`${e.delay}s`,animationDuration:`${e.duration}s`,"--spark-index":t}},`${e.x}-${e.y}`))]}),(0,u.jsx)(`div`,{className:`brain-core`,style:{"--core-scale":`${1+k*.045}`},children:(0,u.jsx)(`div`,{className:`brain-body-motion`,children:(0,u.jsxs)(`svg`,{className:`brain-anatomy`,viewBox:`0 0 220 174`,"aria-hidden":!0,children:[(0,u.jsxs)(`defs`,{children:[(0,u.jsxs)(`radialGradient`,{id:C.left,cx:`34%`,cy:`26%`,r:`85%`,children:[(0,u.jsx)(`stop`,{offset:`0%`,stopColor:`hsl(var(--brain-halo) / 0.8)`}),(0,u.jsx)(`stop`,{offset:`42%`,stopColor:`hsl(var(--brain-core) / 0.46)`}),(0,u.jsx)(`stop`,{offset:`78%`,stopColor:`hsl(var(--brain-core) / 0.2)`}),(0,u.jsx)(`stop`,{offset:`100%`,stopColor:`hsl(228 30% 8% / 0.28)`})]}),(0,u.jsxs)(`radialGradient`,{id:C.right,cx:`62%`,cy:`24%`,r:`88%`,children:[(0,u.jsx)(`stop`,{offset:`0%`,stopColor:`hsl(var(--connection) / 0.66)`}),(0,u.jsx)(`stop`,{offset:`46%`,stopColor:`hsl(var(--connection) / 0.32)`}),(0,u.jsx)(`stop`,{offset:`80%`,stopColor:`hsl(var(--connection) / 0.14)`}),(0,u.jsx)(`stop`,{offset:`100%`,stopColor:`hsl(228 30% 8% / 0.3)`})]}),(0,u.jsxs)(`radialGradient`,{id:C.bridge,cx:`50%`,cy:`30%`,r:`80%`,children:[(0,u.jsx)(`stop`,{offset:`0%`,stopColor:`hsl(var(--memory) / 0.55)`}),(0,u.jsx)(`stop`,{offset:`100%`,stopColor:`hsl(var(--memory) / 0.1)`})]}),(0,u.jsxs)(`linearGradient`,{id:C.stem,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,u.jsx)(`stop`,{offset:`0%`,stopColor:`hsl(var(--knowledge) / 0.42)`}),(0,u.jsx)(`stop`,{offset:`100%`,stopColor:`hsl(var(--knowledge) / 0.08)`})]}),(0,u.jsxs)(`linearGradient`,{id:C.sheen,x1:`0`,y1:`0`,x2:`0.4`,y2:`1`,children:[(0,u.jsx)(`stop`,{offset:`0%`,stopColor:`hsl(40 60% 98% / 0.5)`}),(0,u.jsx)(`stop`,{offset:`70%`,stopColor:`hsl(40 60% 98% / 0.06)`}),(0,u.jsx)(`stop`,{offset:`100%`,stopColor:`hsl(40 60% 98% / 0)`})]})]}),(0,u.jsx)(`path`,{className:`brain-lobe brain-lobe-left`,style:{fill:`url(#${C.left})`},d:`M102 30c-13-20-44-19-55 1-18 1-29 16-28 33-13 8-18 25-11 39-9 16-1 36 17 42 5 19 27 26 43 15 13 10 33 8 43-5 5-7 8-16 8-27V52c0-8-6-17-17-22Z`}),(0,u.jsx)(`path`,{className:`brain-lobe brain-lobe-right`,style:{fill:`url(#${C.right})`},d:`M118 30c13-20 44-19 55 1 18 1 29 16 28 33 13 8 18 25 11 39 9 16 1 36-17 42-5 19-27 26-43 15-13 10-33 8-43-5-5-7-8-16-8-27V52c0-8 6-17 17-22Z`}),(0,u.jsx)(`path`,{className:`brain-bridge`,style:{fill:`url(#${C.bridge})`},d:`M103 48c9-8 24-8 33 0 7 6 9 16 5 25-5 11-16 15-31 12-15 3-26-1-31-12-4-9-2-19 5-25 5-4 12-6 19 0Z`}),(0,u.jsx)(`path`,{className:`brain-stem`,style:{fill:`url(#${C.stem})`},d:`M92 137c10 9 26 9 36 0 1 14 7 25 20 33H76c12-8 17-19 16-33Z`}),(0,u.jsx)(`path`,{className:`brain-fold fold-a`,d:`M48 50c18-11 38-8 47 8`}),(0,u.jsx)(`path`,{className:`brain-fold fold-b`,d:`M34 82c22-8 45-5 58 8`}),(0,u.jsx)(`path`,{className:`brain-fold fold-c`,d:`M43 119c18 5 35 2 49-11`}),(0,u.jsx)(`path`,{className:`brain-fold fold-d`,d:`M172 50c-18-11-38-8-47 8`}),(0,u.jsx)(`path`,{className:`brain-fold fold-e`,d:`M186 82c-22-8-45-5-58 8`}),(0,u.jsx)(`path`,{className:`brain-fold fold-f`,d:`M177 119c-18 5-35 2-49-11`}),(0,u.jsx)(`path`,{className:`brain-fold fold-mid`,d:`M110 38c-5 30-5 70 0 112`}),(0,u.jsx)(`path`,{className:`brain-sheen`,style:{fill:`url(#${C.sheen})`},d:`M58 38c22-16 52-20 78-10-30-2-58 6-74 22-8 8-16 6-4-12Z`})]})})}),(0,u.jsx)(`div`,{className:`brain-aura`,style:{animationDuration:e===`thinking`?`1.65s`:e===`recalling`?`2.4s`:`6.8s`,"--aura-scale":`${1+k*.12}`,opacity:.65+k*.05,boxShadow:k>2?`0 0 60px hsl(var(--brain-core) / 0.25)`:`none`}}),(0,u.jsx)(`div`,{className:`thought-activity`,"aria-hidden":!0,children:d.slice(0,Math.min(12,5+k*2)).map(e=>(0,u.jsx)(`div`,{className:t(`thought-particle`,k>=3&&`resolving`),style:{left:`${18+(e*13+k*4)%64}%`,top:`${22+e%5*14}%`,animationDelay:`-${e*.55+n*1.1-k*.2}s`,animationDuration:`${2.8+(1-O)*1.6-k*.15}s`}},e))}),Array.from({length:1+Math.floor(k/1.5)}).map((e,t)=>(0,u.jsx)(`div`,{className:`memory-ripple`,"aria-hidden":!0,style:{inset:`${18+t*6}%`,animationDelay:`${180+t*220}ms`,opacity:.55+k*.06}},t))]}),p&&!D&&(0,u.jsxs)(`div`,{className:`brain-presence-label`,"data-state":e,children:[(0,u.jsx)(`span`,{className:`dot`}),s||(k>0?a(_,`brain.living.depth`,{depth:k}):a(_,m(e)))]})]})}function m(e){switch(e){case`listening`:return`brain.living.state.listening`;case`thinking`:return`brain.living.state.thinking`;case`recalling`:return`brain.living.state.recalling`;case`synthesizing`:return`brain.living.state.synthesizing`;case`planning`:return`brain.living.state.planning`;case`acting`:return`brain.living.state.acting`;case`resting`:return`brain.living.state.resting`;default:return`brain.living.state.idle`}}function h(){typeof window<`u`&&window.dispatchEvent(new CustomEvent(`brain:recall`))}export{s as i,h as n,c as r,p as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,b as t,f as n,h as r,m as i,n as a,r as o,t as s,v as c}from"./i18n-BBMJshCW.js";import{i as l,r as u,t as d}from"./LivingBrain-CaU_hCxQ.js";import{t as f}from"./circle-check-CyGal42W.js";import{t as p}from"./cpu-DQFk82hG.js";import{S as m,c as h,i as g}from"./index-BjaXCeOZ.js";import{t as _}from"./input-ChWD-Fsh.js";var v=i(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),y=i(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),b=i(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),x=i(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),S=t(c());function C(e){let t=M(e?.models),n=[...o(t.recommended),...o(t.catalog)],r=M(e?.recommendations?.recommendations),i=o(r.models),a=M(r.top_pick),s=new Map;for(let e of[...i,...n]){let t=String(e.id||e.model_id||e.recommended_load_id||``);t&&s.set(t,{...s.get(t)||{},...e})}a.id&&!s.has(String(a.id))&&s.set(String(a.id),a);let c=Array.from(s.values()).map(T).filter(e=>e.id),l=c.filter(e=>e.supported),u=l.length?l:c,d=(e=>u.find(t=>t.id===String(e)))(a.id)||(e=>u.find(t=>e.test(`${t.name} ${t.id}`)))(/gemma.*12|12b/i)||u[0],f=u.find(e=>e.id!==d?.id&&/qwen|8b|7b/i.test(`${e.name} ${e.id}`))||u.find(e=>e.id!==d?.id),p=u.find(e=>e.id!==d?.id&&e.id!==f?.id&&/26b|32b|70b|advanced/i.test(`${e.name} ${e.id}`))||u.find(e=>e.id!==d?.id&&e.id!==f?.id);return[d?{...d,role:`best`,reason:d.reason||`best`}:null,f?{...f,role:`faster`,reason:f.reason||`faster`}:null,p?{...p,role:`advanced`,reason:p.reason||`advanced`}:null].filter(Boolean)}function ee(e){let{analysis:t,endpoints:n}=e;if(!n)return{status:`loading`,recommendations:[],reason:null,failedEndpoints:[]};let r=Object.keys(n).filter(e=>!n[e]);if(!(n.recommendations||n.models))return{status:`unavailable`,recommendations:[],reason:`probe_failed`,failedEndpoints:r};let i=C(t).filter(e=>e.supported);return i.length?{status:`ready`,recommendations:i,reason:null,failedEndpoints:r}:{status:`unavailable`,recommendations:[],reason:`no_supported_model`,failedEndpoints:r}}function w(){return{id:`mlx-community/Qwen3-VL-8B-Instruct-4bit`,loadId:`mlx-community/Qwen3-VL-8B-Instruct-4bit`,engine:`local_mlx`,name:`Qwen3-VL 8B`,shortName:`Qwen 3`,family:`Qwen 3`,size:``,role:`best`,reason:`best`,supported:!0,downloadRequired:!1,downloadSize:``,storageLocation:`~/.latticeai/models`,externalHost:``,estimatedDownloadMinutes:0,estimatedFirstResponseSeconds:5,parameterBillions:8}}function T(e){let t=M(e.runtime_compatibility),n=String(e.id||e.model_id||e.recommended_load_id||``),r=String(e.recommended_load_id||e.load_id||n),i=String(e.display_name||e.name||n||`recommended_brain`),a=e.load_status!==`unsupported`&&e.load_status!==`runtime_update_needed`&&e.status!==`not_recommended`&&t.supported!==!1,o=!!e.download_required,s=o?String(e.download_size||e.size||``):``,c=O(`${i} ${n}`);return{id:n,loadId:r,engine:String(e.recommended_engine||e.engine||`local_mlx`),name:i,shortName:j(i||n),family:j(String(e.family||i||`local_brain`)),size:String(e.size||``),role:`best`,reason:String(e.reason||``),supported:a,downloadRequired:o,downloadSize:s,storageLocation:String(e.storage_location||e.local_path||`~/.latticeai/models`),externalHost:o?A(e):``,estimatedDownloadMinutes:o?D(s):0,estimatedFirstResponseSeconds:k(c),parameterBillions:c}}function E(e){let t=String(e||``).match(/([\d.]+)\s*(t|g|m)?b?/i);if(!t)return null;let n=Number(t[1]);if(!Number.isFinite(n)||n<=0)return null;let r=(t[2]||`g`).toLowerCase();return r===`t`?n*1024*1024:r===`m`?n:n*1024}function D(e){let t=E(e);if(t===null)return null;let n=t/(15/8)/60;return Math.max(1,Math.round(n))}function O(e){let t=String(e||``).match(/(\d{1,3}(?:\.\d)?)\s*b\b/i);if(!t)return null;let n=Number(t[1]);return Number.isFinite(n)&&n>0?n:null}function k(e){return e===null?8:e<=9?5:e<=16?10:e<=40?18:30}function A(e){let t=String(e.source_url||e.download_url||e.repository||e.provider||e.id||``);return t?/huggingface|hf\\.co|mlx-community/i.test(t)?`huggingface`:/ollama/i.test(t)?`ollama`:t.replace(/^https?:\/\//,``).split(`/`)[0]||t:``}function j(e){return String(e||`recommended_brain`).replace(/^mlx-community\//i,``).replace(/[-_]?Instruct/gi,``).replace(/[-_]?4bit/gi,``).replace(/Qwen3[-_ ]?VL/gi,`Qwen 3`).replace(/Qwen3/gi,`Qwen 3`).replace(/Gemma[-_ ]?4/gi,`Gemma 4`).replace(/A4B/gi,``).replace(/[-_]+/g,` `).replace(/\s+/g,` `).trim()}function M(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}var N=e();function te({model:e}){let t=r(e=>e.language),n=e.downloadRequired?[{label:a(t,`flow.consent.size`),value:e.downloadSize||a(t,`flow.consent.sizeUnknown`)},{label:a(t,`flow.consent.location`),value:e.storageLocation},{label:a(t,`flow.consent.external`),value:e.externalHost||a(t,`flow.consent.externalUnknown`)}]:[{label:a(t,`flow.consent.state`),value:a(t,`flow.consent.stateReady`)},{label:a(t,`flow.consent.location`),value:e.storageLocation},{label:a(t,`flow.consent.external`),value:a(t,`flow.consent.externalNone`)}],i=e.downloadRequired?`flow.consent.title`:`flow.consent.readyTitle`;return(0,N.jsxs)(`section`,{className:`ritual-consent-panel`,"aria-label":a(t,i),children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`strong`,{children:a(t,i)}),(0,N.jsx)(`p`,{children:e.downloadRequired?a(t,`flow.consent.body`):a(t,`flow.consent.ready`)})]}),(0,N.jsx)(`dl`,{children:n.map(e=>(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`dt`,{children:e.label}),(0,N.jsx)(`dd`,{children:e.value})]},e.label))})]})}function P({model:e,onBack:t,onComplete:i,onLater:o}){let s=r(e=>e.language),[c,l]=S.useState(!1),[u,p]=S.useState(`idle`),[m,h]=S.useState(0),[_,v]=S.useState(a(s,`flow.install.wait`)),[y,b]=S.useState(null);async function x(){l(!0),b(null),p(`install`),h(8),v(a(s,`flow.install.prepare`));let t=await n.streamModelPrepare({model:e.loadId,engine:e.engine||`local_mlx`,allow_download:e.downloadRequired},{onProgress:e=>{let t=L(String(e.stage||``));p(t),h(Number(e.percent||R(t))),v(z(e,t,s))},onDone:()=>{p(`done`),h(100),v(a(s,`flow.install.done`))},onError:e=>{p(`error`),b(U(e))}});l(!1),t.ok?(p(`done`),h(100),v(a(s,`flow.install.done`)),window.setTimeout(i,700)):(p(`error`),b(U(t.data)))}let C=u===`download`?`thinking`:u===`validate`?`recalling`:u===`load`?`synthesizing`:u===`done`?`idle`:`listening`;return(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`ritual-title`,children:a(s,e.downloadRequired?`flow.install.title`:`flow.install.title.ready`)}),(0,N.jsxs)(`div`,{className:`ritual-subtitle`,children:[(0,N.jsx)(`strong`,{children:e.shortName}),` — `,e.reason,`.`,(0,N.jsx)(`br`,{}),a(s,e.downloadRequired?`flow.install.body`:`flow.install.body.ready`)]}),(0,N.jsxs)(`section`,{className:`ritual-card ritual-expected-card`,"aria-label":a(s,`flow.install.expectedTitle`),children:[(0,N.jsx)(`div`,{className:`ritual-fact-label`,children:a(s,`flow.install.expectedTitle`)}),(0,N.jsx)(`div`,{className:`ritual-time-estimate ritual-expected-line`,children:F(e,s)}),(0,N.jsx)(`ol`,{className:`ritual-timeline`,children:I(e,s).map(e=>(0,N.jsxs)(`li`,{className:`ritual-timeline-step`,children:[(0,N.jsx)(`span`,{className:`ritual-timeline-name`,children:e.name}),(0,N.jsx)(`span`,{className:`ritual-timeline-time`,children:e.time})]},e.key))}),(0,N.jsx)(`div`,{className:`ritual-muted-hint`,children:a(s,`flow.install.expectedCompletion`)})]}),(0,N.jsx)(`div`,{className:`ritual-install-brain`,children:(0,N.jsx)(d,{state:C,intensity:u===`download`||u===`load`?.96:.82,size:`normal`})}),(0,N.jsx)(te,{model:e}),(0,N.jsxs)(`div`,{className:`ritual-progress`,children:[(0,N.jsx)(`div`,{className:`ritual-stage-list`,children:[`install`,`download`,`validate`,`load`].map(t=>(0,N.jsxs)(`div`,{className:`ritual-stage ${H(u,t)}`,children:[(0,N.jsx)(f,{className:`ritual-stage-icon`}),(0,N.jsx)(`span`,{children:B(t,s,e)})]},t))}),(0,N.jsx)(`div`,{className:`ritual-bar`,children:(0,N.jsx)(`span`,{className:`ritual-bar-fill ${V(m)}`})})]}),(0,N.jsx)(`div`,{className:`ritual-status`,children:_}),(0,N.jsx)(`div`,{className:`ritual-card ritual-status-card`,children:a(s,e.downloadRequired?`flow.install.note`:`flow.install.note.ready`)}),y&&(0,N.jsxs)(`div`,{className:`ritual-card ritual-error-card ritual-install-error`,role:`alert`,children:[y,(0,N.jsx)(`div`,{className:`ritual-error-detail`,children:a(s,`flow.install.retry`)})]}),(0,N.jsxs)(`div`,{className:`ritual-button-row`,children:[(0,N.jsx)(g,{variant:`ghost`,onClick:t,disabled:c,children:a(s,`flow.install.back`)}),(0,N.jsx)(g,{variant:`outline`,onClick:o,disabled:c,children:a(s,`flow.install.later`)}),u===`done`?(0,N.jsx)(g,{onClick:i,children:a(s,`flow.install.enter`)}):(0,N.jsx)(g,{onClick:x,disabled:c||!e.supported,children:c?a(s,`flow.install.busy`):a(s,e.downloadRequired?`flow.install.start`:`flow.install.startReady`)})]}),(0,N.jsx)(`div`,{className:`ritual-local-note`,children:a(s,e.downloadRequired?`flow.install.local`:`flow.install.local.ready`)})]})}function F(e,t){let n=e.estimatedFirstResponseSeconds;return!e.downloadRequired||e.estimatedDownloadMinutes===0?a(t,`flow.install.expected.ready`,{response:n}):e.estimatedDownloadMinutes===null?a(t,`flow.install.expected.unknown`,{response:n}):a(t,`flow.install.expected`,{download:a(t,`flow.recommend.minutes`,{count:e.estimatedDownloadMinutes}),response:n})}function I(e,t){let n=e.downloadRequired&&e.estimatedDownloadMinutes?a(t,`flow.install.timelineApprox`,{time:a(t,`flow.recommend.minutes`,{count:e.estimatedDownloadMinutes})}):a(t,`flow.install.timelineQuick`);return[{key:`download`,name:a(t,e.downloadRequired?`flow.install.timelineStep.download`:`flow.install.timelineStep.ready`),time:n},{key:`validate`,name:a(t,`flow.install.timelineStep.validate`),time:a(t,`flow.install.timelineQuick`)},{key:`load`,name:a(t,`flow.install.timelineStep.load`),time:a(t,`flow.install.timelineApprox`,{time:`${e.estimatedFirstResponseSeconds}s`})}]}function L(e){return/download|pull|weights/i.test(e)?`download`:/smoke|validate|verify|test/i.test(e)?`validate`:/load|ready/i.test(e)?`load`:/done|complete/i.test(e)?`done`:`install`}function R(e){return e===`install`?20:e===`download`?55:e===`validate`?82:e===`load`?94:e===`done`?100:8}function z(e,t,n){let r={install:a(n,`flow.install.prepare`),download:a(n,`flow.install.stage.download`),validate:a(n,`flow.install.stage.validate`),load:a(n,`flow.install.stage.load`),done:a(n,`flow.install.done`),idle:a(n,`flow.install.wait`),error:a(n,`flow.install.stage.error`)}[t];return W(String(e.user_message||e.message||r))}function B(e,t,n){return e===`download`&&!n.downloadRequired?a(t,`flow.install.step.ready`):a(t,`flow.install.step.${e}`)}function V(e){return`progress-${Math.max(0,Math.min(100,Math.round(e/10)*10))}`}function H(e,t){let n=[`idle`,`install`,`download`,`validate`,`load`,`done`],r=n.indexOf(e),i=n.indexOf(t);return e===`error`?`is-error`:e===`done`||r>i?`is-done`:e===t?`is-active`:``}function U(e){let t=M(e),n=o(t.recovery_guidance).map(W).filter(Boolean);return[W(String(t.user_message||t.reason||t.error||`The selected model could not be loaded.`)),...n.slice(0,2)].join(` `)}function W(e){return String(e||``).replace(/gemma4_unified/gi,`this model format`).replace(/mlx[-_ ]?vlm|mlx[-_ ]?lm|local_mlx|\bmlx\b|\bgguf\b|\bollama\b|huggingface|hugging face/gi,`local model support`).replace(/runtime/gi,`model support`).replace(/No module named ['\"][^'\"]+['\"]/gi,`A local support component is missing`).replace(/\s+/g,` `).trim()}function G(){let e=r(e=>e.language),t=r(e=>e.setLanguage);return(0,N.jsx)(`div`,{className:`language-switcher ritual-language`,"aria-label":a(e,`language.label`),children:[`ko`,`en`].map(n=>(0,N.jsx)(`button`,{type:`button`,className:e===n?`is-active`:``,onClick:()=>t(n),"aria-pressed":e===n,children:s[n]},n))})}var K=`lattice.productFlow.user`;function q(){try{let e=localStorage.getItem(K);return e?JSON.parse(e):null}catch{}return null}function J({onSuccess:e}){let t=r(e=>e.language),[i,o]=S.useState(()=>q()?.email||`you@local`),[s,c]=S.useState(``),[l,u]=S.useState(()=>q()?.name||`You`),[d,f]=S.useState(!1),[p,m]=S.useState(null);async function h(r){r.preventDefault();let o=i.trim(),c=s.trim(),u=l.trim()||o.split(`@`)[0]||`You`;if(!o||!c){m(a(t,`flow.login.missing`));return}f(!0),m(null);let d=q(),p=await n.login(o,c);if(!p.ok){if((await n.profile()).ok&&(!d?.email||d.email===o)){try{localStorage.setItem(K,JSON.stringify({email:o,name:u}))}catch{}f(!1),e();return}if(d?.email&&d.email!==o){f(!1),m(a(t,`flow.login.otherEmail`));return}if(d?.email===o){f(!1),m(a(t,`flow.login.wrongPassword`));return}(await n.register({email:o,password:c,name:u,nickname:u})).ok&&(p=await n.login(o,c))}if(!p.ok){f(!1),m(a(t,`flow.login.unavailable`));return}try{localStorage.setItem(K,JSON.stringify({email:o,name:u}))}catch{}f(!1),e()}return(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`ritual-title`,children:a(t,`flow.login.title`)}),(0,N.jsx)(`div`,{className:`ritual-subtitle`,children:a(t,`flow.login.body`)}),(0,N.jsx)(Y,{}),(0,N.jsxs)(`form`,{onSubmit:h,className:`ritual-card ritual-form`,children:[(0,N.jsxs)(`div`,{className:`ritual-field-stack`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`ritual-field-label`,children:a(t,`flow.name`)}),(0,N.jsx)(_,{value:l,onChange:e=>u(e.target.value),placeholder:a(t,`flow.name.placeholder`),autoComplete:`name`})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`ritual-field-label`,children:a(t,`flow.email`)}),(0,N.jsx)(_,{value:i,onChange:e=>o(e.target.value),type:`email`,placeholder:a(t,`flow.email.placeholder`),autoComplete:`email`})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`ritual-field-label`,children:a(t,`flow.password`)}),(0,N.jsx)(_,{value:s,onChange:e=>c(e.target.value),type:`password`,placeholder:a(t,`flow.password.placeholder`),autoComplete:`current-password`})]})]}),p&&(0,N.jsx)(`div`,{className:`ritual-error`,role:`alert`,children:p}),(0,N.jsx)(`div`,{className:`ritual-muted-hint`,children:a(t,`flow.login.passwordLocal`)}),(0,N.jsx)(g,{type:`submit`,disabled:d||!i.trim()||!s.trim(),className:`ritual-full-button`,children:d?a(t,`flow.login.busy`):a(t,`flow.login.submit`)}),(0,N.jsx)(`div`,{className:`ritual-note`,children:a(t,`flow.login.note`)})]})]})}function Y(){let e=r(e=>e.language);return(0,N.jsxs)(`div`,{className:`ritual-promise`,"aria-label":a(e,`flow.promise.aria`),children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`span`,{children:a(e,`flow.promise.memory.k`)}),(0,N.jsx)(`strong`,{children:a(e,`flow.promise.memory.v`)})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`span`,{children:a(e,`flow.promise.model.k`)}),(0,N.jsx)(`strong`,{children:a(e,`flow.promise.model.v`)})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`span`,{children:a(e,`flow.promise.ownership.k`)}),(0,N.jsx)(`strong`,{children:a(e,`flow.promise.ownership.v`)})]})]})}function X({status:e,reason:t,recommendations:n,analysis:i,onBack:o,onRetry:s,onSkipModel:c,onSelect:d}){let f=r(e=>e.language);if(e===`loading`)return(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`ritual-title`,children:a(f,`flow.recommend.title`)}),(0,N.jsx)(`div`,{className:`ritual-subtitle`,children:a(f,`flow.recommend.body`)}),(0,N.jsxs)(`div`,{className:`ritual-scan-banner is-loading`,role:`status`,children:[(0,N.jsx)(`span`,{className:`ritual-scan-dot pulsing`}),(0,N.jsx)(`span`,{children:a(f,`flow.recommend.loading`)})]}),(0,N.jsxs)(`div`,{className:`ritual-action-row`,children:[(0,N.jsx)(g,{variant:`ghost`,onClick:o,children:a(f,`flow.recommend.back`)}),(0,N.jsx)(g,{variant:`outline`,onClick:c,children:a(f,`flow.recommend.skip`)})]})]});if(e===`unavailable`){let e=t===`no_supported_model`?`flow.recommend.unavailable.empty`:`flow.recommend.unavailable.probe`;return(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`ritual-title`,children:a(f,`flow.recommend.title`)}),(0,N.jsx)(`section`,{className:`ritual-card ritual-error-card ritual-unavailable-card`,role:`alert`,"aria-label":a(f,`flow.recommend.unavailable.aria`),children:(0,N.jsxs)(`div`,{className:`ritual-inline-row`,children:[(0,N.jsx)(h,{className:`ritual-core-icon`,"aria-hidden":`true`}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`ritual-strong-text`,children:a(f,`flow.recommend.unavailable.title`)}),(0,N.jsx)(`div`,{className:`ritual-muted-text`,children:a(f,e)})]})]})}),(0,N.jsxs)(`div`,{className:`ritual-button-row ritual-button-row-primary`,children:[(0,N.jsxs)(`button`,{type:`button`,className:`ritual-full-button ritual-full-button-primary`,onClick:s,children:[(0,N.jsx)(u,{size:16}),` `,a(f,`flow.recommend.unavailable.retry`)]}),(0,N.jsx)(`button`,{type:`button`,className:`ritual-secondary-button`,onClick:c,children:a(f,`flow.recommend.skip`)})]}),(0,N.jsxs)(`div`,{className:`ritual-action-row`,children:[(0,N.jsx)(g,{variant:`ghost`,onClick:o,children:a(f,`flow.recommend.back`)}),(0,N.jsx)(`div`,{className:`ritual-muted-hint`,children:a(f,`flow.recommend.unavailable.hint`)})]})]})}let p=n;function m(e,t){if(!e)return(0,N.jsxs)(`div`,{className:`ritual-scan-banner is-loading`,children:[(0,N.jsx)(`span`,{className:`ritual-scan-dot pulsing`}),(0,N.jsx)(`span`,{children:a(t,`flow.analysis.checking`)})]});let n=M(e.recommendations?.recommendations),r=M(e.setup?.environment),i=M(e.recommendations?.profile),o={...r,...i},s=Number(n.ram_gb||Number(o.ram_mb||0)/1024||0);return n.apple_silicon||String(o.arch||``).includes(`arm`)?(0,N.jsxs)(`div`,{className:`ritual-scan-banner is-success`,children:[(0,N.jsx)(`span`,{className:`ritual-scan-dot is-success`}),(0,N.jsx)(`span`,{children:a(t,`flow.recommend.environment.apple`,{ram:Math.round(s)})})]}):(0,N.jsxs)(`div`,{className:`ritual-scan-banner is-warning`,children:[(0,N.jsx)(`span`,{className:`ritual-scan-dot is-warning`}),(0,N.jsx)(`span`,{children:a(t,`flow.recommend.environment.standard`,{ram:Math.round(s)})})]})}return(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`ritual-title`,children:a(f,`flow.recommend.title`)}),(0,N.jsx)(`div`,{className:`ritual-subtitle`,children:a(f,`flow.recommend.body`)}),m(i,f),(0,N.jsxs)(`div`,{className:`ritual-model-list`,children:[p[0]?.supported?(0,N.jsxs)(`div`,{className:`ritual-primary-cta`,children:[(0,N.jsxs)(g,{onClick:()=>d(p[0]),className:`ritual-primary-model-button`,children:[a(f,`flow.recommend.primary`),` `,(0,N.jsx)(l,{size:16})]}),(0,N.jsx)(`div`,{className:`ritual-time-estimate ritual-primary-note`,children:re(p[0],f)}),(0,N.jsx)(`div`,{className:`ritual-muted-hint ritual-next-hint`,children:a(f,p[0].downloadRequired?`flow.recommend.nextHint`:`flow.recommend.nextHint.ready`)})]}):null,p.slice(0,3).map((e,t)=>{let n=e.role===`best`?b:e.role===`faster`?x:v;return(0,N.jsxs)(`button`,{className:`ritual-model-card`,onClick:()=>e.supported&&d(e),disabled:!e.supported,children:[(0,N.jsxs)(`div`,{className:`ritual-model-heading`,children:[(0,N.jsx)(n,{size:16}),(0,N.jsx)(`div`,{className:`role`,children:ie(e.role,t,f)})]}),(0,N.jsx)(`div`,{className:`name`,children:e.shortName}),(0,N.jsxs)(`div`,{className:`reason`,children:[e.reason,` · `,e.size||a(f,`flow.recommend.sizeReady`),Q(e.role,f)?(0,N.jsxs)(`span`,{className:`ritual-model-comparison`,children:[` `,Q(e.role,f)]}):null]}),(0,N.jsx)(`div`,{className:`ritual-model-stats`,children:(0,N.jsx)(`span`,{className:`ritual-time-estimate`,children:ne(e,f)})}),e.supported?(0,N.jsxs)(`span`,{className:`ritual-model-choose`,children:[a(f,`flow.recommend.choose`),` `,(0,N.jsx)(l,{size:14})]}):(0,N.jsx)(`div`,{className:`ritual-model-warning`,children:a(f,`flow.recommend.unsupported`)})]},`${e.role}-${e.id}`)}),(0,N.jsx)(`div`,{className:`ritual-time-note`,children:a(f,`flow.recommend.timeNote`)})]}),(0,N.jsxs)(`div`,{className:`ritual-action-row`,children:[(0,N.jsx)(g,{variant:`ghost`,onClick:o,children:a(f,`flow.recommend.back`)}),(0,N.jsx)(g,{variant:`outline`,onClick:c,children:a(f,`flow.recommend.skip`)}),(0,N.jsx)(`div`,{className:`ritual-muted-hint`,children:a(f,`flow.recommend.hint`)})]})]})}function Z(e,t){return a(t,`flow.recommend.minutes`,{count:e})}function ne(e,t){let n=e.estimatedFirstResponseSeconds;return!e.downloadRequired||e.estimatedDownloadMinutes===0?a(t,`flow.recommend.timeEstimate.ready`,{response:n}):e.estimatedDownloadMinutes===null?a(t,`flow.recommend.timeEstimate.unknown`,{response:n}):a(t,`flow.recommend.timeEstimate`,{download:Z(e.estimatedDownloadMinutes,t),response:n})}function re(e,t){return!e.downloadRequired||e.estimatedDownloadMinutes===0?a(t,`flow.recommend.primaryNote.ready`):e.estimatedDownloadMinutes===null?a(t,`flow.recommend.primaryNote.unknown`):a(t,`flow.recommend.primaryNote`,{time:Z(e.estimatedDownloadMinutes,t)})}function Q(e,t){return e===`faster`?a(t,`flow.recommend.comparison.faster`):e===`advanced`?a(t,`flow.recommend.comparison.advanced`):``}function ie(e,t,n){return e===`best`?a(n,`flow.recommend.rank.best`):e===`faster`?a(n,`flow.recommend.rank.faster`):e===`advanced`?a(n,`flow.recommend.rank.advanced`):a(n,`flow.recommend.rank.choice`,{index:t+1})}function ae({onComplete:e}){let t=r(e=>e.language),[i,o]=S.useState(`wake`),[s,c]=S.useState(null),[l,u]=S.useState(null),[f,p]=S.useState(0),[m,h]=S.useState(null),g=S.useMemo(()=>ee({analysis:s,endpoints:l}),[s,l]);S.useEffect(()=>{let e=!1;async function t(){let[t,r,i,a]=await Promise.all([n.setupScan(),n.modelRecommendations(`local_mlx`),n.models(),n.sysinfo()]);e||(c({setup:t.ok?t.data:null,recommendations:r.ok?r.data:null,models:i.ok?i.data:null,sysinfo:a.ok?a.data:null}),u({setup:t.ok,recommendations:r.ok,models:i.ok,sysinfo:a.ok}))}return t(),()=>{e=!0}},[f]);let _=S.useCallback(()=>{c(null),u(null),p(e=>e+1)},[]);return(0,N.jsx)(`div`,{className:`ritual-shell`,"aria-label":a(t,`flow.shell`),children:(0,N.jsxs)(`div`,{className:`ritual-container`,children:[(0,N.jsx)(G,{}),(0,N.jsxs)(`div`,{className:`ritual-brain`,children:[(0,N.jsx)(d,{state:se(i),intensity:i===`install`?.92:.7,size:`large`,showLabel:!1}),(0,N.jsx)(`div`,{className:`ritual-edition`,title:a(t,`brain.edition.tip`),children:a(t,`brain.edition`)})]}),i===`wake`&&(0,N.jsx)(oe,{onWake:()=>o(`login`),onUseExisting:()=>$(e)}),i===`login`&&(0,N.jsx)(J,{onSuccess:()=>o(`recommend`)}),i===`recommend`&&(0,N.jsx)(X,{status:g.status,reason:g.reason,recommendations:g.recommendations,analysis:s,onBack:()=>o(`login`),onRetry:_,onSkipModel:()=>$(e),onSelect:e=>{h(e),o(`install`)}}),i===`install`&&(0,N.jsx)(P,{model:m||g.recommendations[0]||w(),onBack:()=>o(`recommend`),onComplete:()=>$(e),onLater:()=>$(e)})]})})}function oe({onWake:e,onUseExisting:t}){let n=r(e=>e.language),i=[{icon:y,label:a(n,`flow.wake.value.local.k`),body:a(n,`flow.wake.value.local.v`)},{icon:x,label:a(n,`flow.wake.value.instant.k`),body:a(n,`flow.wake.value.instant.v`)},{icon:p,label:a(n,`flow.wake.value.brain.k`),body:a(n,`flow.wake.value.brain.v`)}];return(0,N.jsxs)(`section`,{className:`ritual-wake`,"aria-label":a(n,`flow.wake.aria`),children:[(0,N.jsx)(`div`,{className:`ritual-title`,children:a(n,`flow.wake.title`)}),(0,N.jsx)(`div`,{className:`ritual-subtitle`,children:a(n,`flow.wake.body`)}),(0,N.jsx)(`div`,{className:`ritual-value-grid`,"aria-label":a(n,`flow.wake.value.aria`),children:i.map(e=>{let t=e.icon;return(0,N.jsxs)(`div`,{className:`ritual-value-card`,children:[(0,N.jsxs)(`div`,{className:`ritual-value-label`,children:[(0,N.jsx)(t,{size:14}),` `,e.label]}),(0,N.jsx)(`div`,{className:`ritual-value-body`,children:e.body})]},e.label)})}),(0,N.jsxs)(`div`,{className:`ritual-wake-plan`,"aria-label":a(n,`flow.wake.plan.aria`),children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`span`,{children:`1`}),(0,N.jsx)(`strong`,{children:a(n,`flow.wake.step.identity`)})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`span`,{children:`2`}),(0,N.jsx)(`strong`,{children:a(n,`flow.wake.step.check`)})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`span`,{children:`3`}),(0,N.jsx)(`strong`,{children:a(n,`flow.wake.step.voice`)})]})]}),(0,N.jsxs)(`div`,{className:`ritual-button-row ritual-button-row-primary`,children:[(0,N.jsxs)(`button`,{type:`button`,className:`ritual-full-button ritual-full-button-primary`,onClick:e,children:[a(n,`flow.wake.primary`),` `,(0,N.jsx)(l,{size:18})]}),(0,N.jsx)(`button`,{type:`button`,className:`ritual-secondary-button`,onClick:t,children:a(n,`flow.wake.existing`)})]}),(0,N.jsx)(`div`,{className:`ritual-start-note`,children:a(n,`flow.wake.startNote`)})]})}function $(e){m(),e()}function se(e){return e===`wake`?`idle`:e===`analysis`?`listening`:e===`recommend`?`recalling`:e===`install`?`thinking`:`idle`}export{ae as ProductFlow};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,b as t,f as n,h as r,l as i,n as a,r as o,s,v as c}from"./i18n-BBMJshCW.js";import{a as l,n as u,r as d}from"./navigation-D9D9_FPC.js";import{_ as f,a as p,c as m,d as h,g,h as _,i as v,l as y,m as b,n as x,p as S,r as C,s as w,t as T,u as E,v as D}from"./primitives-CmaSAyGG.js";import{t as O}from"./network-DzLDGmtV.js";import{_ as k,i as A,l as j,s as M,t as N,w as P}from"./index-BjaXCeOZ.js";import{t as F}from"./input-ChWD-Fsh.js";var I=t(c()),L=e(),R=[{id:`account`,labelKey:`system.tab.account`},{id:`workspaces`,labelKey:`system.tab.workspaces`},{id:`snapshots`,labelKey:`system.tab.snapshots`},{id:`activity`,labelKey:`system.tab.activity`},{id:`network`,labelKey:`system.tab.network`},{id:`settings`,labelKey:`system.tab.settings`},{id:`admin`,labelKey:`system.tab.admin`}];function z({initialTab:e}){let t=r(e=>e.mode),n=r(e=>e.language),[i,o]=I.useState(e||`account`);I.useEffect(()=>{R.some(t=>t.id===e)&&o(e)},[e]);let s=e=>{o(e),u(`/`+{account:`account`,workspaces:`workspace-admin`,snapshots:`snapshots`,activity:`activity`,network:`network`,settings:`settings`,admin:`system-admin`}[e])};return(0,L.jsxs)(`div`,{className:`product-page settings-page space-y-5`,children:[(0,L.jsxs)(`header`,{className:`page-hero`,children:[(0,L.jsxs)(`div`,{className:`page-kicker`,children:[(0,L.jsx)(j,{className:`h-4 w-4`}),` `,a(n,`system.kicker`)]}),(0,L.jsx)(`h1`,{className:`page-title`,children:a(n,`system.title`)}),(0,L.jsx)(`p`,{className:`page-copy`,children:a(n,`system.body`)})]}),(0,L.jsx)(h,{tabs:(t===`basic`?R.filter(e=>e.id===`account`||e.id===`workspaces`||e.id===`snapshots`||e.id===`settings`):R).map(e=>({id:e.id,label:a(n,e.labelKey)})),value:i,onChange:e=>s(e)}),i===`account`?(0,L.jsx)(B,{}):null,i===`workspaces`?(0,L.jsx)(V,{}):null,i===`snapshots`?(0,L.jsx)(ee,{}):null,i===`activity`?(0,L.jsx)(H,{}):null,i===`network`?(0,L.jsx)(te,{}):null,i===`settings`?(0,L.jsx)(U,{}):null,i===`admin`?(0,L.jsx)(X,{}):null]})}function B(){let e=l(),t=r(e=>e.language),i=r(e=>e.setWorkspaceId),o=d({queryKey:[`profile`],queryFn:n.profile}),s=d({queryKey:[`sso`],queryFn:n.ssoConfig}),[c,u]=I.useState(``),[h,v]=I.useState(``),[y,C]=I.useState(``),[w,D]=I.useState(``),[O,j]=I.useState(``),M=e=>{e.ok&&(N(),i(null))},R=P({mutationFn:()=>n.login(c,h),onSuccess:M}),z=P({mutationFn:()=>n.register({email:c,password:h,name:y,nickname:w}),onSuccess:M}),B=P({mutationFn:()=>n.updateProfile({name:y,nickname:w}),onSuccess:()=>e.invalidateQueries({queryKey:[`profile`]})}),V=P({mutationFn:()=>n.changePassword(h,O)});return(0,L.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,L.jsx)(x,{title:a(t,`system.account.profile`),result:o.data,children:e=>(0,L.jsx)(p,{data:e})}),(0,L.jsxs)(S,{children:[(0,L.jsxs)(g,{children:[(0,L.jsxs)(f,{className:`flex items-center gap-2`,children:[(0,L.jsx)(k,{className:`h-4 w-4`}),` `,a(t,`system.account.title`)]}),(0,L.jsx)(_,{children:a(t,`system.account.detail`)})]}),(0,L.jsxs)(b,{className:`grid gap-3`,children:[(0,L.jsx)(F,{value:c,onChange:e=>u(e.target.value),placeholder:a(t,`system.account.email`)}),(0,L.jsx)(F,{type:`password`,value:h,onChange:e=>v(e.target.value),placeholder:a(t,`system.account.password`)}),(0,L.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,L.jsx)(F,{value:y,onChange:e=>C(e.target.value),placeholder:a(t,`system.account.name`)}),(0,L.jsx)(F,{value:w,onChange:e=>D(e.target.value),placeholder:a(t,`system.account.nickname`)})]}),(0,L.jsx)(F,{type:`password`,value:O,onChange:e=>j(e.target.value),placeholder:a(t,`system.account.newPassword`)}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsx)(A,{onClick:()=>R.mutate(),disabled:!c||!h||R.isPending,children:a(t,`system.account.login`)}),(0,L.jsx)(A,{variant:`outline`,onClick:()=>z.mutate(),disabled:!c||!h||z.isPending,children:a(t,`system.account.register`)}),(0,L.jsx)(A,{variant:`outline`,onClick:()=>B.mutate(),disabled:B.isPending,children:a(t,`system.account.save`)}),(0,L.jsx)(A,{variant:`outline`,onClick:()=>V.mutate(),disabled:!h||!O||V.isPending,children:a(t,`system.account.changePassword`)}),(0,L.jsx)(T,{label:a(t,`system.account.logout`),action:()=>n.logout(),onSuccess:M})]}),[R.data,z.data,B.data,V.data].filter(Boolean).map((e,n)=>(0,L.jsx)(m,{result:e,successLabel:a(t,`system.account.requestDone`)},n))]})]}),(0,L.jsx)(x,{title:a(t,`system.account.signInOptions`),result:s.data,className:`xl:col-span-2`,children:e=>(0,L.jsx)(E,{value:e})})]})}function V(){let e=l(),t=r(e=>e.language),{setWorkspaceId:i}=r(),s=d({queryKey:[`workspaceRegistry`],queryFn:n.workspaceRegistry}),c=d({queryKey:[`invitations`],queryFn:n.invitations}),[u,p]=I.useState(``),[m,h]=I.useState(``),[y,C]=I.useState(``),w=P({mutationFn:()=>n.createOrg(u),onSuccess:()=>e.invalidateQueries({queryKey:[`workspaceRegistry`]})}),E=P({mutationFn:()=>n.createInvitation({email:m||null,role:`member`,expires_hours:168}),onSuccess:()=>e.invalidateQueries({queryKey:[`invitations`]})}),D=P({mutationFn:()=>n.acceptInvitation(y),onSuccess:()=>e.invalidateQueries({queryKey:[`workspaceRegistry`]})}),O=o(s.data?.data?.workspaces);return(0,L.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[1.1fr_0.9fr]`,children:[(0,L.jsx)(x,{title:a(t,`system.workspace.yours`),result:s.data,children:()=>(0,L.jsx)(`div`,{className:`grid gap-2`,children:O.map(e=>{let r=String(e.workspace_id||e.id);return(0,L.jsx)(`div`,{className:`rounded-md border border-border p-3`,children:(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`font-medium`,children:String(e.name||r)}),(0,L.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[String(e.type||``),` · `,String(e.your_role||e.role||``)]})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsx)(A,{variant:`outline`,onClick:()=>i(r),children:a(t,`system.workspace.use`)}),(0,L.jsx)(T,{label:a(t,`system.workspace.activate`),action:()=>n.activateWorkspace(r),invalidate:[`workspaceRegistry`]}),(0,L.jsx)(T,{label:a(t,`system.workspace.archive`),action:()=>n.archiveWorkspace(r),invalidate:[`workspaceRegistry`],variant:`destructive`})]})]})},r)})})}),(0,L.jsxs)(S,{children:[(0,L.jsxs)(g,{children:[(0,L.jsxs)(f,{className:`flex items-center gap-2`,children:[(0,L.jsx)(M,{className:`h-4 w-4`}),` `,a(t,`system.workspace.organizations`)]}),(0,L.jsx)(_,{children:a(t,`system.workspace.organizationsHint`)})]}),(0,L.jsxs)(b,{className:`grid gap-3`,children:[(0,L.jsx)(F,{value:u,onChange:e=>p(e.target.value),placeholder:a(t,`system.workspace.orgPlaceholder`)}),(0,L.jsx)(A,{disabled:!u.trim()||w.isPending,onClick:()=>w.mutate(),children:a(t,`system.workspace.createOrg`)}),(0,L.jsx)(F,{value:m,onChange:e=>h(e.target.value),placeholder:a(t,`system.workspace.inviteeEmail`)}),(0,L.jsx)(A,{variant:`outline`,disabled:E.isPending,onClick:()=>E.mutate(),children:a(t,`system.workspace.createInvite`)}),(0,L.jsx)(F,{value:y,onChange:e=>C(e.target.value),placeholder:a(t,`system.workspace.inviteToken`)}),(0,L.jsx)(A,{variant:`outline`,disabled:!y.trim()||D.isPending,onClick:()=>D.mutate(),children:a(t,`system.workspace.acceptInvite`)}),(0,L.jsx)(x,{title:a(t,`system.workspace.invitations`),result:c.data,children:e=>(0,L.jsx)(v,{items:e.invitations,titleKey:`token`,metaKey:`role`})})]})]})]})}function ee(){let e=r(e=>e.language),t=d({queryKey:[`snapshots`],queryFn:n.snapshots}),i=d({queryKey:[`timeMachine`],queryFn:n.timeMachine}),[s,c]=I.useState(``),[l,u]=I.useState(``),[p,h]=I.useState(``),y=P({mutationFn:()=>n.createSnapshot(s||a(e,`system.snapshots.defaultName`))}),C=P({mutationFn:()=>n.compareSnapshots(l,p)}),w=o(t.data?.data?.snapshots);return(0,L.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,L.jsx)(x,{title:a(e,`system.snapshots.title`),result:t.data,children:()=>(0,L.jsx)(`div`,{className:`space-y-2`,children:w.map(t=>{let r=String(t.id||t.snapshot_id);return(0,L.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,L.jsx)(`div`,{className:`font-medium`,children:String(t.name||r)}),(0,L.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,L.jsx)(T,{label:a(e,`system.snapshots.export`),action:()=>n.exportSnapshot(r)}),(0,L.jsx)(T,{label:a(e,`system.snapshots.mergeRestore`),action:()=>n.restoreSnapshot(r),variant:`outline`})]})]},r)})})}),(0,L.jsxs)(S,{children:[(0,L.jsxs)(g,{children:[(0,L.jsx)(f,{children:a(e,`system.snapshots.actions`)}),(0,L.jsx)(_,{children:a(e,`system.snapshots.actionsHint`)})]}),(0,L.jsxs)(b,{className:`grid gap-3`,children:[(0,L.jsx)(F,{value:s,onChange:e=>c(e.target.value),placeholder:a(e,`system.snapshots.namePlaceholder`)}),(0,L.jsx)(A,{onClick:()=>y.mutate(),disabled:y.isPending,children:a(e,`system.snapshots.create`)}),(0,L.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,L.jsx)(F,{value:l,onChange:e=>u(e.target.value),placeholder:a(e,`system.snapshots.beforeId`)}),(0,L.jsx)(F,{value:p,onChange:e=>h(e.target.value),placeholder:a(e,`system.snapshots.afterId`)})]}),(0,L.jsx)(A,{variant:`outline`,onClick:()=>C.mutate(),disabled:!l||!p||C.isPending,children:a(e,`system.snapshots.compare`)}),C.data?(0,L.jsx)(m,{result:C.data,successLabel:a(e,`system.snapshots.compareDone`)}):null]})]}),(0,L.jsx)(x,{title:a(e,`system.snapshots.timeline`),result:i.data,className:`xl:col-span-2`,children:e=>(0,L.jsx)(v,{items:e.events||e,titleKey:`event`,metaKey:`type`,limit:14})})]})}function H(){let e=r(e=>e.language),t=d({queryKey:[`realtimeFeed`],queryFn:n.realtimeFeed}),i=d({queryKey:[`presence`],queryFn:n.presence});return(0,L.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,L.jsx)(x,{title:a(e,`system.activity.feed`),result:t.data,children:e=>(0,L.jsx)(v,{items:e.events,titleKey:`event_type`,metaKey:`area`,limit:14})}),(0,L.jsx)(x,{title:a(e,`system.activity.presence`),result:i.data,children:e=>(0,L.jsx)(G,{data:e})})]})}function te(){let e=l(),t=r(e=>e.language),i=d({queryKey:[`networkIdentity`],queryFn:n.networkIdentity}),s=d({queryKey:[`networkPeers`],queryFn:n.networkPeers}),[c,u]=I.useState(``),[p,h]=I.useState(``),[v,y]=I.useState(``),C=P({mutationFn:()=>n.pairPeer({name:c,base_url:p,public_key:v}),onSuccess:()=>e.invalidateQueries({queryKey:[`networkPeers`]})});return(0,L.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[0.8fr_1.2fr]`,children:[(0,L.jsx)(x,{title:a(t,`system.network.identity`),result:i.data,children:e=>(0,L.jsx)(K,{data:e})}),(0,L.jsxs)(S,{children:[(0,L.jsxs)(g,{children:[(0,L.jsxs)(f,{className:`flex items-center gap-2`,children:[(0,L.jsx)(O,{className:`h-4 w-4`}),` `,a(t,`system.network.pair`)]}),(0,L.jsx)(_,{children:a(t,`system.network.pairHint`)})]}),(0,L.jsxs)(b,{className:`grid gap-3`,children:[(0,L.jsx)(F,{value:c,onChange:e=>u(e.target.value),placeholder:a(t,`system.network.deviceName`)}),(0,L.jsx)(F,{value:p,onChange:e=>h(e.target.value),placeholder:a(t,`system.network.address`)}),(0,L.jsx)(F,{value:v,onChange:e=>y(e.target.value),placeholder:a(t,`system.network.publicKey`)}),(0,L.jsx)(A,{disabled:!c||!p||!v||C.isPending,onClick:()=>C.mutate(),children:a(t,`system.network.pair`)}),C.data?(0,L.jsx)(m,{result:C.data,successLabel:a(t,`system.network.pairDone`)}):null]})]}),(0,L.jsx)(x,{title:a(t,`system.network.peers`),result:s.data,className:`xl:col-span-2`,children:e=>(0,L.jsx)(`div`,{className:`grid gap-2`,children:o(e.peers).map(e=>{let i=String(e.peer_id||e.id);return(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`font-medium`,children:String(e.name||i)}),(0,L.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:String(e.base_url||``)})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsx)(T,{label:a(t,`system.network.pushWorkspace`),action:()=>n.pushPeer(i,r.getState().workspaceId)}),(0,L.jsx)(T,{label:a(t,`system.network.unpair`),action:()=>n.unpairPeer(i),invalidate:[`networkPeers`],variant:`destructive`})]})]},i)})})})]})}function U(){let e=l(),{theme:t,setTheme:i,mode:o,setMode:s}=r(),c=r(e=>e.language),u=d({queryKey:[`health`],queryFn:n.health}),p=d({queryKey:[`sysinfo`],queryFn:n.sysinfo}),h=d({queryKey:[`computerMemory`],queryFn:n.computerMemory}),v=d({queryKey:[`brainStorage`],queryFn:n.brainStorage}),C=d({queryKey:[`backupHealth`],queryFn:n.backupHealth}),[w,D]=I.useState(``),[O,k]=I.useState(`lattice_brain`),[j,M]=I.useState(!1),[N,R]=I.useState(``),[z,B]=I.useState(``),[V,ee]=I.useState(``),[H,te]=I.useState(!1),[U,W]=I.useState(!1),G=P({mutationFn:e=>n.dockerPostgres({consent:e,dry_run:!e,port:5432})}),K=P({mutationFn:()=>n.migratePostgres({dsn:w,schema_name:O||`lattice_brain`,dry_run:!0})}),q=P({mutationFn:()=>n.brainArchive({path:N.trim()||null,passphrase:V}),onSuccess:()=>e.invalidateQueries({queryKey:[`backupHealth`]})}),J=P({mutationFn:()=>n.brainArchiveInspect({path:z,passphrase:V||null})}),Y=P({mutationFn:()=>n.brainArchiveVerify({path:z,passphrase:V})}),X=P({mutationFn:()=>n.brainArchiveRestore({path:z,passphrase:V,dry_run:!0,confirm:!1})}),Z=P({mutationFn:()=>n.brainArchiveRestore({path:z,passphrase:V,dry_run:!1,confirm:H}),onSuccess:()=>{e.invalidateQueries({queryKey:[`brainStorage`]}),e.invalidateQueries({queryKey:[`backupHealth`]})}}),Q=P({mutationFn:()=>n.brainArchiveImport({path:z,passphrase:V,dry_run:!0,confirm:!1})}),$=P({mutationFn:()=>n.brainArchiveImport({path:z,passphrase:V,dry_run:!1,confirm:U}),onSuccess:()=>{e.invalidateQueries({queryKey:[`brainStorage`]}),e.invalidateQueries({queryKey:[`backupHealth`]})}});return(0,L.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-3`,children:[(0,L.jsxs)(S,{children:[(0,L.jsxs)(g,{children:[(0,L.jsx)(f,{children:a(c,`system.panel.appearance`)}),(0,L.jsx)(_,{children:a(c,`system.panel.appearance.hint`)})]}),(0,L.jsxs)(b,{className:`flex flex-wrap gap-2`,children:[(0,L.jsx)(A,{variant:t===`dark`?`default`:`outline`,onClick:()=>i(`dark`),children:a(c,`system.theme.dark`)}),(0,L.jsx)(A,{variant:t===`light`?`default`:`outline`,onClick:()=>i(`light`),children:a(c,`system.theme.light`)}),[`basic`,`advanced`,`admin`].map(e=>(0,L.jsx)(A,{variant:o===e?`default`:`outline`,onClick:()=>s(e),children:a(c,`shell.mode.${e}`)},e))]})]}),(0,L.jsx)(x,{title:o===`basic`?a(c,`system.panel.brainStatus`):a(c,`system.panel.serverHealth`),result:u.data,children:e=>(0,L.jsx)(ne,{data:e})}),(0,L.jsx)(x,{title:o===`basic`?a(c,`system.panel.readiness`):a(c,`system.panel.hostTelemetry`),result:p.data,children:e=>o===`basic`?(0,L.jsx)(y,{stats:[{label:a(c,`system.stat.cpu`),value:`${String(e.cpu_pct||`0`)}%`},{label:a(c,`system.stat.memory`),value:`${String(e.ram_pct||`0`)}%`},{label:a(c,`system.stat.gpu`),value:`${String(e.gpu_mem_pct||`0`)}%`},{label:a(c,`system.stat.localStatus`),value:a(c,`system.stat.ready`)}]}):(0,L.jsx)(E,{value:e})}),(0,L.jsx)(x,{title:o===`basic`?a(c,`system.storage.title`):a(c,`system.panel.brainStorage`),result:v.data,className:`xl:col-span-3`,children:e=>(0,L.jsx)(re,{data:e,mode:o,language:c})}),o===`basic`?null:(0,L.jsx)(x,{title:a(c,`system.backup.health`),result:C.data,className:`xl:col-span-3`,children:e=>(0,L.jsx)(ie,{data:e})}),o===`basic`?null:(0,L.jsxs)(S,{className:`xl:col-span-3`,children:[(0,L.jsxs)(g,{children:[(0,L.jsx)(f,{children:a(c,`system.archive.title`)}),(0,L.jsx)(_,{children:a(c,`system.archive.detail`)})]}),(0,L.jsxs)(b,{className:`grid gap-3`,children:[(0,L.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[1fr_1fr]`,children:[(0,L.jsx)(F,{value:N,onChange:e=>R(e.target.value),placeholder:a(c,`system.archive.exportPath`)}),(0,L.jsx)(F,{value:z,onChange:e=>B(e.target.value),placeholder:a(c,`system.archive.restorePath`)})]}),(0,L.jsx)(F,{type:`password`,value:V,onChange:e=>ee(e.target.value),placeholder:a(c,`system.archive.passphrase`)}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsx)(A,{onClick:()=>q.mutate(),disabled:!V||q.isPending,children:a(c,`system.archive.export`)}),(0,L.jsx)(A,{variant:`outline`,onClick:()=>J.mutate(),disabled:!z||J.isPending,children:a(c,`system.archive.inspect`)}),(0,L.jsx)(A,{variant:`outline`,onClick:()=>Y.mutate(),disabled:!z||!V||Y.isPending,children:a(c,`system.archive.verify`)}),(0,L.jsx)(A,{variant:`outline`,onClick:()=>X.mutate(),disabled:!z||!V||X.isPending,children:a(c,`system.archive.restoreDryRun`)}),(0,L.jsx)(A,{variant:`outline`,onClick:()=>Q.mutate(),disabled:!z||!V||Q.isPending,children:a(c,`system.archive.importDryRun`)}),(0,L.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm`,children:[(0,L.jsx)(`input`,{type:`checkbox`,checked:H,onChange:e=>te(e.target.checked)}),a(c,`system.archive.confirmRestore`)]}),(0,L.jsx)(A,{variant:`destructive`,onClick:()=>Z.mutate(),disabled:!z||!V||!H||Z.isPending,children:a(c,`system.archive.restore`)}),(0,L.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm`,children:[(0,L.jsx)(`input`,{type:`checkbox`,checked:U,onChange:e=>W(e.target.checked)}),a(c,`system.archive.confirmImport`)]}),(0,L.jsx)(A,{variant:`outline`,onClick:()=>$.mutate(),disabled:!z||!V||!U||$.isPending,children:a(c,`system.archive.import`)})]}),[q.data,J.data,Y.data,X.data,Z.data,Q.data,$.data].filter(Boolean).map((e,t)=>(0,L.jsx)(m,{result:e,successLabel:a(c,`system.archive.requestDone`)},t))]})]}),o===`basic`?null:(0,L.jsxs)(S,{className:`xl:col-span-3`,children:[(0,L.jsxs)(g,{children:[(0,L.jsx)(f,{children:a(c,`system.scale.title`)}),(0,L.jsx)(_,{children:a(c,`system.scale.detail`)})]}),(0,L.jsxs)(b,{className:`grid gap-3`,children:[(0,L.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[1fr_220px]`,children:[(0,L.jsx)(F,{value:w,onChange:e=>D(e.target.value),placeholder:a(c,`system.scale.dsn`)}),(0,L.jsx)(F,{value:O,onChange:e=>k(e.target.value),placeholder:a(c,`system.scale.schema`)})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsx)(A,{variant:`outline`,onClick:()=>G.mutate(!1),disabled:G.isPending,children:a(c,`system.scale.dockerPlan`)}),(0,L.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm`,children:[(0,L.jsx)(`input`,{type:`checkbox`,checked:j,onChange:e=>M(e.target.checked)}),a(c,`system.scale.dockerConsent`)]}),(0,L.jsx)(A,{onClick:()=>G.mutate(!0),disabled:!j||G.isPending,children:a(c,`system.scale.dockerStart`)}),(0,L.jsx)(A,{variant:`outline`,onClick:()=>K.mutate(),disabled:!w||K.isPending,children:a(c,`system.scale.migrationPlan`)})]}),G.data?(0,L.jsx)(m,{result:G.data,successLabel:a(c,`system.scale.dockerDone`)}):null,K.data?(0,L.jsx)(m,{result:K.data,successLabel:a(c,`system.scale.migrationDone`)}):null]})]}),o===`basic`?null:(0,L.jsx)(x,{title:a(c,`system.computerMemory.title`),result:h.data,className:`xl:col-span-3`,children:e=>(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(E,{value:e}),(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(T,{label:a(c,`system.computerMemory.enable`),action:()=>n.setComputerMemory(!0),invalidate:[`computerMemory`]}),(0,L.jsx)(T,{label:a(c,`system.computerMemory.disable`),action:()=>n.setComputerMemory(!1),invalidate:[`computerMemory`],variant:`destructive`})]})]})})]})}function W(e,t,n=a(e,`system.value.notReported`)){return t==null||t===``?n:typeof t==`boolean`?a(e,t?`system.value.enabled`:`system.value.disabled`):String(t)}function G({data:e}){let t=r(e=>e.language),n=o(e.presence||e.clients||e);return n.length?(0,L.jsx)(v,{items:n,titleKey:`user`,metaKey:`workspace_id`}):(0,L.jsx)(C,{title:a(t,`system.presence.empty`),detail:a(t,`system.presence.emptyDetail`)})}function K({data:e}){let t=r(e=>e.mode),n=r(e=>e.language),o=W(n,e.public_key,``);return t===`basic`?(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(q,{title:a(n,`system.device.thisMac`),status:a(n,`system.value.trusted`),detail:a(n,`system.device.thisMacDetail`)}),(0,L.jsx)(D,{variant:`muted`,children:W(n,e.algorithm,a(n,`system.value.localIdentity`))})]}):(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(D,{variant:`success`,children:a(n,`system.value.localDevice`)}),(0,L.jsx)(D,{variant:`muted`,children:W(n,e.algorithm,a(n,`system.value.identityKey`))})]}),(0,L.jsx)(p,{data:{device_id:e.device_id||e.id||a(n,`system.value.notReported`),fingerprint:e.fingerprint||a(n,`system.value.notReported`),public_key:o?i(o.replace(/\s+/g,` `),72):a(n,`system.value.notReported`)}})]})}function ne({data:e}){let t=r(e=>e.mode),n=r(e=>e.language);return t===`basic`?(0,L.jsx)(q,{title:a(n,`system.health.title`),status:a(n,`system.health.ok`),detail:a(n,`system.health.detail`)}):(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(y,{stats:[{label:a(n,`system.health.status`),value:e.status||e.ok||a(n,`system.value.reported`)},{label:a(n,`system.health.version`),value:e.version||a(n,`system.value.notReported`)},{label:a(n,`system.health.mode`),value:e.mode||e.environment||a(n,`system.value.local`)},{label:a(n,`system.health.port`),value:e.port||e.backend_port||a(n,`system.value.configured`)}]}),(0,L.jsx)(E,{value:e})]})}function re({data:e,mode:t=`advanced`,language:n=`en`}){let r=s(e.active)?e.active:e,i=s(e.postgres)?e.postgres:{},o=s(e.backup_health)?e.backup_health:{},c=r.vector_search||r.vector||e.vector_search||e.sqlite_vec,l=!!(i.available||i.connected||i.enabled),u=!!c&&String(c).toLowerCase()!==`not reported`;return t===`basic`?(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(q,{title:a(n,`system.storage.local.title`),status:a(n,`system.storage.local.badge`),detail:a(n,`system.storage.local.detail`)}),(0,L.jsx)(q,{title:a(n,`system.storage.search.title`),status:u?a(n,`system.storage.search.on`):a(n,`system.storage.search.pending`),detail:u?a(n,`system.storage.search.detailOn`):a(n,`system.storage.search.detailPending`)})]}):(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsx)(y,{stats:[{label:a(n,`system.storage.activeEngine`),value:r.engine||e.engine||a(n,`system.storage.sqlite`)},{label:a(n,`system.storage.sqliteDefault`),value:r.engine===`postgres`?a(n,`system.value.scaleMode`):a(n,`system.value.enabled`)},{label:a(n,`system.storage.vector`),value:c||a(n,`system.value.notReported`)},{label:a(n,`system.storage.postgres`),value:l?a(n,`system.value.available`):a(n,`system.value.optional`)}]}),(0,L.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-3`,children:[(0,L.jsx)(q,{title:a(n,`system.storage.sqlite`),status:r.available===!1?a(n,`system.value.unavailable`):a(n,`system.value.default`),detail:W(n,r.reason||r.path||e.path,a(n,`system.storage.sqliteDetail`))}),(0,L.jsx)(q,{title:a(n,`system.storage.vector`),status:W(n,c,a(n,`system.value.reported`)),detail:W(n,r.vector_reason||r.sqlite_vec_reason||e.vector_reason,a(n,`system.storage.vectorDetail`))}),(0,L.jsx)(q,{title:a(n,`system.storage.postgres`),status:l?a(n,`system.value.available`):a(n,`system.value.notEnabled`),detail:W(n,i.reason||i.dsn||i.status,a(n,`system.storage.postgresDetail`))})]}),Object.keys(o).length?(0,L.jsx)(E,{value:{backup_health:o}}):null]})}function ie({data:e}){let t=r(e=>e.language);return(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(y,{stats:[{label:a(t,`system.backup.available`),value:e.available===!1?a(t,`system.value.no`):a(t,`system.value.yes`)},{label:a(t,`system.backup.backups`),value:e.count||e.backups||0},{label:a(t,`system.backup.encrypted`),value:e.encrypted_archives||0},{label:a(t,`system.backup.zip`),value:e.zip_backups||0}]}),(0,L.jsx)(p,{data:{directory:e.directory||a(t,`system.value.notReported`),latest:e.latest||a(t,`system.value.noneReported`),last_verified:e.last_verified||e.verified_at||a(t,`system.value.notReported`),failure:e.error||e.reason||a(t,`system.value.noneReported`)}})]})}function q({title:e,status:t,detail:n}){let r=/unavailable|failed|denied|disabled|not enabled|사용 불가|실패|거부|비활성|활성화되지 않음/i.test(t)?`warning`:`success`;return(0,L.jsxs)(`div`,{className:`rounded-md border border-border bg-background p-3`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsx)(`div`,{className:`font-medium`,children:e}),(0,L.jsx)(D,{variant:r,children:t})]}),(0,L.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:n})]})}function J({data:e}){let t=r(e=>e.language),n=s(e.startup)?e.startup:{},i=s(e.privacy)?e.privacy:{},o=s(e.storage)?e.storage:{},c=s(e.backup)?e.backup:{},l=s(e.device_identity)?e.device_identity:{},u=s(e.permissions)?e.permissions:{};return(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(y,{stats:[{label:a(t,`system.hardening.version`),value:e.version||a(t,`system.value.reported`)},{label:a(t,`system.hardening.localOnly`),value:i.local_only_default??n.local_only_default??a(t,`system.value.reported`)},{label:a(t,`system.hardening.storage`),value:s(o.active)?o.active.engine:a(t,`system.value.reported`)},{label:a(t,`system.hardening.backups`),value:c.count||c.available||a(t,`system.value.reported`)}]}),(0,L.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,L.jsx)(q,{title:a(t,`system.hardening.startup`),status:a(t,n.network_exposed?`system.value.networkExposed`:`system.value.localOnly`),detail:a(t,`system.hardening.startupDetail`)}),(0,L.jsx)(q,{title:a(t,`system.hardening.integrations`),status:a(t,i.local_only_default===!1?`system.value.reviewRequired`:`system.value.optIn`),detail:a(t,`system.hardening.integrationsDetail`)}),(0,L.jsx)(q,{title:a(t,`system.hardening.identity`),status:W(t,l.algorithm||l.fingerprint,a(t,`system.value.reported`)),detail:W(t,l.storage,a(t,`system.hardening.identityStorage`))}),(0,L.jsx)(q,{title:a(t,`system.hardening.permissions`),status:a(t,u.destructive_restore_requires_confirmation===!1?`system.value.reviewRequired`:`system.value.guarded`),detail:a(t,`system.hardening.permissionsDetail`)})]})]})}function Y({data:e}){let t=r(e=>e.language),n=s(e.cards)?e.cards:{},i=s(e.severity_counts)?e.severity_counts:{};return(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(y,{stats:[{label:a(t,`system.security.eventsToday`),value:n.events_today||0},{label:a(t,`system.security.highRisk`),value:n.high_risk_events||i.high||0},{label:a(t,`system.security.review`),value:n.review_required||0},{label:a(t,`system.security.riskRate`),value:e.risk_rate||0}]}),(0,L.jsx)(E,{value:{severity_counts:i,sensitive_fields:e.field_counts||{}}})]})}function X(){let e=r(e=>e.mode),t=r(e=>e.language),i=d({queryKey:[`adminSummary`],queryFn:n.adminSummary}),o=d({queryKey:[`adminUsers`],queryFn:n.adminUsers}),s=d({queryKey:[`adminAudit`],queryFn:()=>n.adminAudit()}),c=d({queryKey:[`adminRoles`],queryFn:n.adminRoles}),l=d({queryKey:[`adminPolicies`],queryFn:n.adminPolicies}),u=d({queryKey:[`adminProductHardening`],queryFn:n.adminProductHardening}),f=d({queryKey:[`adminSecurity`],queryFn:n.adminSecurity}),m=d({queryKey:[`vpcStatus`],queryFn:n.vpcStatus});return e===`admin`?(0,L.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,L.jsx)(x,{title:a(t,`system.admin.summary`),result:i.data,children:e=>(0,L.jsx)(p,{data:e})}),(0,L.jsx)(x,{title:a(t,`system.admin.users`),result:o.data,children:e=>(0,L.jsx)(v,{items:e,titleKey:`email`,metaKey:`role`})}),(0,L.jsx)(x,{title:a(t,`system.admin.audit`),result:s.data,children:e=>(0,L.jsx)(v,{items:e.recent_events||e,titleKey:`act`,metaKey:`sev`})}),(0,L.jsx)(x,{title:a(t,`system.admin.roles`),result:c.data,children:e=>(0,L.jsx)(v,{items:e.roles||e,titleKey:`role`,metaKey:`members`})}),(0,L.jsx)(x,{title:a(t,`system.admin.policies`),result:l.data,children:e=>(0,L.jsx)(v,{items:e.policies||e,titleKey:`label`,metaKey:`enforced`})}),(0,L.jsx)(x,{title:a(t,`system.admin.hardening`),result:u.data,children:e=>(0,L.jsx)(J,{data:e})}),(0,L.jsx)(x,{title:a(t,`system.admin.security`),result:f.data,children:e=>(0,L.jsx)(Y,{data:e})}),(0,L.jsx)(x,{title:a(t,`system.admin.vpc`),result:m.data,className:`xl:col-span-2`,children:e=>(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(D,{variant:`muted`,children:a(t,`system.admin.communityUnavailable`)}),(0,L.jsx)(E,{value:e})]})})]}):(0,L.jsx)(w,{title:a(t,`system.admin.controls`),detail:a(t,`system.admin.controlsDetail`),target:`admin`})}export{z as SystemPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as e}from"./i18n-BBMJshCW.js";var t=e(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as e}from"./i18n-BBMJshCW.js";var t=e(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as e}from"./i18n-BBMJshCW.js";var t=e(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as e}from"./i18n-BBMJshCW.js";var t=e(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as e}from"./i18n-BBMJshCW.js";var t=e(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as e}from"./i18n-BBMJshCW.js";var t=e(`earth`,[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),n=e(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),r=e(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]);export{n,t as r,r as t};
|