diff --git a/internal/records/native_bm25.go b/internal/records/native_bm25.go index 090de8da..510eebd5 100644 --- a/internal/records/native_bm25.go +++ b/internal/records/native_bm25.go @@ -30,7 +30,9 @@ func (s *Store) nativeLexical(ctx context.Context, v *querySelection, query stri if len(terms) == 0 { return ids, true, nil } - rows, err := s.readDB().QueryContext(ctx, `SELECT rowid FROM lexical_fts WHERE lexical_fts MATCH ? ORDER BY bm25(lexical_fts)`, strings.Join(terms, " OR ")) + // rowid breaks bm25() ties, so records of one score keep the write order + // whatever the timing of the index's background build (segment layout). + rows, err := s.readDB().QueryContext(ctx, `SELECT rowid FROM lexical_fts WHERE lexical_fts MATCH ? ORDER BY bm25(lexical_fts), rowid`, strings.Join(terms, " OR ")) if err != nil { return nil, false, err } diff --git a/web/dist/assets/GraphView-CNp1jlCw.js b/web/dist/assets/GraphView-CNp1jlCw.js deleted file mode 100644 index d7ff1cc5..00000000 --- a/web/dist/assets/GraphView-CNp1jlCw.js +++ /dev/null @@ -1,26 +0,0 @@ -import{c as v,u as _,f as L,s as V,a as I,j as e,P as U,F as Z,h as q,X as S,C as z,Q as A,L as D,t as k,b as w,r as b,E as G,d as T,e as y,g as $,i as O,A as Q,N as B}from"./index-CXicYQ-x.js";import{c as H}from"./cytoscape-G6xtpWZq.js";/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const K=v("Expand",[["path",{d:"m21 21-6-6m6 6v-4.8m0 4.8h-4.8",key:"1c15vz"}],["path",{d:"M3 16.2V21m0 0h4.8M3 21l6-6",key:"1fsnz2"}],["path",{d:"M21 7.8V3m0 0h-4.8M21 3l-6 6",key:"hawz9i"}],["path",{d:"M3 7.8V3m0 0h4.8M3 3l6 6",key:"u9ee12"}]]);/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const W=v("Focus",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["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"}]]);/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const X=v("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const J=v("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Y=v("RotateCcw",[["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"}]]);function R(){const s=getComputedStyle(document.documentElement),c=(a,d)=>s.getPropertyValue(a).trim()||d;return{label:c("--graph-label","#55555f"),edge:c("--graph-edge","#b8b8c2"),selected:c("--graph-selection","#202024"),outline:c("--graph-outline","#ffffff")}}function M(s){return[{selector:"node",style:{"background-color":"data(color)",label:"data(label)",width:"data(size)",height:"data(size)","font-size":10,"font-family":"Space Grotesk, sans-serif",color:s.label,"text-valign":"bottom","text-margin-y":8,"text-max-width":"120px","text-wrap":"ellipsis","border-width":4,"border-color":s.outline,"border-opacity":.9}},{selector:"node:selected",style:{"border-color":s.selected,"border-width":5,"text-outline-color":s.outline,"text-outline-width":3,color:s.selected}},{selector:"edge",style:{width:1.25,"line-color":s.edge,"target-arrow-color":s.edge,"target-arrow-shape":"triangle","curve-style":"bezier","arrow-scale":.7,opacity:.8}},{selector:'edge[supersedes = "yes"]',style:{"line-color":"#c19857","target-arrow-color":"#c19857","line-style":"dashed",color:s.label,label:"data(label)","font-size":9,"text-rotation":"autorotate","text-background-color":s.outline,"text-background-opacity":1,"text-background-padding":"3px"}}]}function ee({data:s,selected:c,onSelect:a,focus:d}){const{resolved:h}=T(),l=y.useRef(null),n=y.useRef(null),m=y.useRef(a);return m.current=a,y.useEffect(()=>{if(!l.current)return;const r=R(),p=new Set(s.nodes.map(o=>o.id)),u=H({container:l.current,elements:[...s.nodes.map(o=>({data:{id:o.id,label:k(o.content).slice(0,36),color:$(o.category),size:20+o.importance*5}})),...(s.edges||[]).filter(o=>p.has(o.source_id)&&p.has(o.target_id)).map((o,j)=>({data:{id:`edge-${j}`,source:o.source_id,target:o.target_id,label:o.edge_type,supersedes:o.edge_type==="supersedes"?"yes":"no"}}))],style:M(r),layout:{name:"cose",animate:!1,padding:55,nodeRepulsion:()=>7e3,idealEdgeLength:()=>95,randomize:!1},minZoom:.15,maxZoom:3,wheelSensitivity:.25});n.current=u,u.on("tap","node",o=>m.current(o.target.id()));const x=new ResizeObserver(()=>u.resize());return x.observe(l.current),()=>{x.disconnect(),u.destroy(),n.current=null}},[s]),y.useEffect(()=>{const r=n.current;if(!r)return;const p=R();r.style(M(p))},[h,s]),y.useEffect(()=>{const r=n.current;r&&(r.nodes().unselect(),c&&r.getElementById(c).select())},[c,s]),e.jsxs("div",{className:"graph-surface",children:[e.jsx("div",{className:"graph-canvas",ref:l,role:"img","aria-label":"Interactive memory graph. Drag nodes to rearrange, scroll to zoom, and drag the background to pan. The memory list below provides keyboard access."}),e.jsxs("div",{className:"graph-instructions",children:[e.jsx("span",{className:"live-dot"}),d?"Focused neighborhood":"Knowledge graph",e.jsx("span",{children:"Drag to explore · Scroll to zoom"})]}),e.jsxs("div",{className:"graph-controls",children:[e.jsx("button",{"aria-label":"Zoom in",title:"Zoom in",onClick:()=>{const r=n.current;r&&r.zoom({level:r.zoom()*1.3,renderedPosition:{x:r.width()/2,y:r.height()/2}})},children:e.jsx(J,{size:18})}),e.jsx("button",{"aria-label":"Zoom out",title:"Zoom out",onClick:()=>{const r=n.current;r&&r.zoom({level:r.zoom()/1.3,renderedPosition:{x:r.width()/2,y:r.height()/2}})},children:e.jsx(X,{size:18})}),e.jsx("button",{"aria-label":"Fit graph",title:"Fit graph",onClick:()=>{var r;return(r=n.current)==null?void 0:r.fit(void 0,55)},children:e.jsx(K,{size:17})}),e.jsx("button",{"aria-label":"Reset graph layout",title:"Reset graph layout",onClick:()=>{var r;return(r=n.current)==null?void 0:r.layout({name:"cose",animate:!1,padding:55,randomize:!0}).run()},children:e.jsx(Y,{size:16})})]})]})}function oe({meta:s,refresh:c}){var N;const{route:a,navigate:d}=_(),h=L(a.search),l=new URLSearchParams(a.search),n=l.get("focus")||"",m=l.get("edge_type")||"";h.set("limit","200"),n&&h.set("focus",n),m&&h.set("edge_type",m);const r=V(a.store,"graph",h),p=I(r,c),u=l.has("selected")?l.get("selected"):n,x=t=>j("selected",t),o=(N=p.data)==null?void 0:N.nodes.find(t=>t.id===u);function j(t,f){const g=new URLSearchParams(a.search);f||t==="selected"?g.set(t,f):g.delete(t),t==="focus"&&g.delete("selected"),d(b(a.store,"graph",g.toString()))}return e.jsxs(e.Fragment,{children:[e.jsx(U,{eyebrow:"Relationships",title:"Knowledge graph",description:"Follow the stored relationships between memories."}),e.jsx(Z,{meta:s,graph:!0}),e.jsxs("div",{className:"graph-toolbar",children:[e.jsxs("label",{children:["Relationship",e.jsxs("select",{"aria-label":"Relationship type",value:m,onChange:t=>j("edge_type",t.target.value),children:[e.jsx("option",{value:"",children:"All relationships"}),s.edge_types.map(t=>e.jsx("option",{value:t,children:q(t)},t))]})]}),n&&e.jsxs("button",{className:"button subtle",onClick:()=>j("focus",""),children:[e.jsx(S,{size:14}),"Clear neighborhood focus"]}),e.jsx("div",{className:"graph-legend",children:s.categories.map(t=>e.jsx(z,{value:t},t))})]}),e.jsx(A,{query:p,children:t=>{var f,g,C;return e.jsx(e.Fragment,{children:(f=t.nodes)!=null&&f.length?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`graph-workspace ${o?"has-selection":""}`,children:[e.jsx(ee,{data:t,selected:u,onSelect:x,focus:n}),o&&e.jsx(se,{memory:o,onClose:()=>x(""),onExpand:()=>j("focus",o.id)})]}),e.jsxs("div",{className:"results-line",children:[e.jsxs("span",{children:[t.nodes.length," of ",t.total," memories ·"," ",((g=t.edges)==null?void 0:g.length)||0," stored connections"]}),e.jsx(D,{value:t.updated_at,loading:p.loading})]}),t.truncated&&e.jsx("p",{className:"notice",children:"Showing a bounded neighborhood (up to 200 memories). Use filters or expand a selected memory to explore further."}),e.jsxs("details",{className:"graph-list",open:!0,children:[e.jsxs("summary",{children:["Browse graph memories ",e.jsx("span",{children:t.nodes.length})]}),e.jsx("div",{className:"graph-node-list",children:t.nodes.map(i=>e.jsxs("button",{className:u===i.id?"active":"",onClick:()=>x(i.id),"aria-pressed":u===i.id,children:[e.jsx(z,{value:i.category}),e.jsx("span",{children:k(i.content)}),e.jsx(W,{size:14})]},i.id))})]}),!!((C=t.edges)!=null&&C.length)&&e.jsxs("details",{className:"graph-list",children:[e.jsxs("summary",{children:["Stored relationships ",e.jsx("span",{children:t.edges.length})]}),e.jsx("div",{className:"relationship-list",children:t.edges.map((i,E)=>e.jsxs("div",{children:[e.jsx(w,{href:b(a.store,"memories","",i.source_id),children:i.source_id}),e.jsxs("span",{children:[" → ",i.edge_type," → "]}),e.jsx(w,{href:b(a.store,"memories","",i.target_id),children:i.target_id}),e.jsxs("small",{children:["Weight ",i.weight,Object.entries(i.metadata||{}).map(([P,F])=>` · ${P}: ${F}`).join("")]})]},E))})]})]}):e.jsx(G,{title:"No connections in this view",icon:"search",children:e.jsx("p",{children:"Try broader filters, or explore a memory with stored relationships."})})})}})]})}function se({memory:s,onClose:c,onExpand:a}){var h;const{route:d}=_();return e.jsxs("aside",{className:"graph-preview",children:[e.jsxs("div",{className:"section-heading",children:[e.jsx("span",{className:"eyebrow",children:"Selected memory"}),e.jsx("button",{className:"icon-button","aria-label":"Close selected memory",onClick:c,children:e.jsx(S,{size:17})})]}),e.jsx(z,{value:s.category}),e.jsx("h2",{children:k(s.content)}),e.jsx("p",{children:O(s.content)}),e.jsxs("dl",{children:[e.jsx("dt",{children:"Source"}),e.jsx("dd",{children:s.source||"Not recorded"})]}),e.jsxs(w,{className:"button primary",href:b(d.store,"memories",d.search,s.id),children:["Read full memory",e.jsx(Q,{size:15})]}),e.jsxs("button",{className:"button",onClick:a,children:[e.jsx(B,{size:15}),"Expand neighborhood"]}),!!((h=s.entities)!=null&&h.length)&&e.jsx("div",{className:"chip-list",children:s.entities.map(l=>e.jsx(w,{href:b(d.store,"library",new URLSearchParams({entity:l}).toString()),children:l},l))})]})}export{oe as GraphView,M as graphStyle}; diff --git a/web/dist/assets/GraphView-LqJspvLW.js b/web/dist/assets/GraphView-LqJspvLW.js new file mode 100644 index 00000000..6bf06424 --- /dev/null +++ b/web/dist/assets/GraphView-LqJspvLW.js @@ -0,0 +1,26 @@ +import{c as v,u as E,a as C,f as V,s as A,b as O,j as e,P as U,F as q,h as G,X as L,C as N,Q as T,L as $,t as M,d as k,r as b,E as H,e as Q,g as f,i as D,k as Z,A as B,N as X}from"./index-DZRLQ9ap.js";import{c as J}from"./cytoscape-G6xtpWZq.js";/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const K=v("Expand",[["path",{d:"m21 21-6-6m6 6v-4.8m0 4.8h-4.8",key:"1c15vz"}],["path",{d:"M3 16.2V21m0 0h4.8M3 21l6-6",key:"1fsnz2"}],["path",{d:"M21 7.8V3m0 0h-4.8M21 3l-6 6",key:"hawz9i"}],["path",{d:"M3 7.8V3m0 0h4.8M3 3l6 6",key:"u9ee12"}]]);/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const W=v("Focus",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["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"}]]);/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Y=v("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ee=v("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const se=v("RotateCcw",[["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"}]]);function _(){const s=getComputedStyle(document.documentElement),c=(o,p)=>s.getPropertyValue(o).trim()||p;return{label:c("--graph-label","#55555f"),edge:c("--graph-edge","#b8b8c2"),selected:c("--graph-selection","#202024"),outline:c("--graph-outline","#ffffff")}}function P(s){return[{selector:"node",style:{"background-color":"data(color)",label:"data(label)",width:"data(size)",height:"data(size)","font-size":10,"font-family":"Space Grotesk, sans-serif",color:s.label,"text-valign":"bottom","text-margin-y":8,"text-max-width":"120px","text-wrap":"ellipsis","border-width":4,"border-color":s.outline,"border-opacity":.9}},{selector:"node:selected",style:{"border-color":s.selected,"border-width":5,"text-outline-color":s.outline,"text-outline-width":3,color:s.selected}},{selector:"edge",style:{width:1.25,"line-color":s.edge,"target-arrow-color":s.edge,"target-arrow-shape":"triangle","curve-style":"bezier","arrow-scale":.7,opacity:.8}},{selector:'edge[supersedes = "yes"]',style:{"line-color":"#c19857","target-arrow-color":"#c19857","line-style":"dashed",color:s.label,label:"data(label)","font-size":9,"text-rotation":"autorotate","text-background-color":s.outline,"text-background-opacity":1,"text-background-padding":"3px"}}]}function te({data:s,selected:c,onSelect:o,focus:p}){const{resolved:a}=Q(),n=C(),h=f.useRef(n);h.current=n;const u=f.useRef(null),d=f.useRef(null),w=f.useRef(o);return w.current=o,f.useEffect(()=>{if(!u.current)return;const t=_(),g=new Set(s.nodes.map(i=>i.id)),x=J({container:u.current,elements:[...s.nodes.map(i=>({data:{id:i.id,label:M(i.content).slice(0,36)||h.current("state.untitled"),color:D(i.category),size:20+i.importance*5}})),...(s.edges||[]).filter(i=>g.has(i.source_id)&&g.has(i.target_id)).map((i,z)=>({data:{id:`edge-${z}`,source:i.source_id,target:i.target_id,label:i.edge_type,supersedes:i.edge_type==="supersedes"?"yes":"no"}}))],style:P(t),layout:{name:"cose",animate:!1,padding:55,nodeRepulsion:()=>7e3,idealEdgeLength:()=>95,randomize:!1},minZoom:.15,maxZoom:3,wheelSensitivity:.25});d.current=x,x.on("tap","node",i=>w.current(i.target.id()));const m=new ResizeObserver(()=>x.resize());return m.observe(u.current),()=>{m.disconnect(),x.destroy(),d.current=null}},[s]),f.useEffect(()=>{const t=d.current;if(!t)return;const g=_();t.style(P(g))},[a,s]),f.useEffect(()=>{const t=d.current;t&&(t.nodes().unselect(),c&&t.getElementById(c).select())},[c,s]),e.jsxs("div",{className:"graph-surface",children:[e.jsx("div",{className:"graph-canvas",ref:u,role:"img","aria-label":n("graph.canvasAria")}),e.jsxs("div",{className:"graph-instructions",children:[e.jsx("span",{className:"live-dot"}),n(p?"graph.focused":"graph.full"),e.jsx("span",{children:n("graph.dragHint")})]}),e.jsxs("div",{className:"graph-controls",children:[e.jsx("button",{"aria-label":n("graph.zoomIn"),title:n("graph.zoomIn"),onClick:()=>{const t=d.current;t&&t.zoom({level:t.zoom()*1.3,renderedPosition:{x:t.width()/2,y:t.height()/2}})},children:e.jsx(ee,{size:18})}),e.jsx("button",{"aria-label":n("graph.zoomOut"),title:n("graph.zoomOut"),onClick:()=>{const t=d.current;t&&t.zoom({level:t.zoom()/1.3,renderedPosition:{x:t.width()/2,y:t.height()/2}})},children:e.jsx(Y,{size:18})}),e.jsx("button",{"aria-label":n("graph.fit"),title:n("graph.fit"),onClick:()=>{var t;return(t=d.current)==null?void 0:t.fit(void 0,55)},children:e.jsx(K,{size:17})}),e.jsx("button",{"aria-label":n("graph.resetLayout"),title:n("graph.resetLayout"),onClick:()=>{var t;return(t=d.current)==null?void 0:t.layout({name:"cose",animate:!1,padding:55,randomize:!0}).run()},children:e.jsx(se,{size:16})})]})]})}function ie({meta:s,refresh:c}){var z;const{route:o,navigate:p}=E(),a=C(),n=V(o.search),h=new URLSearchParams(o.search),u=h.get("focus")||"",d=h.get("edge_type")||"";n.set("limit","200"),u&&n.set("focus",u),d&&n.set("edge_type",d);const w=A(o.store,"graph",n),t=O(w,c),g=h.has("selected")?h.get("selected"):u,x=r=>i("selected",r),m=(z=t.data)==null?void 0:z.nodes.find(r=>r.id===g);function i(r,y){const j=new URLSearchParams(o.search);y||r==="selected"?j.set(r,y):j.delete(r),r==="focus"&&j.delete("selected"),p(b(o.store,"graph",j.toString()))}return e.jsxs(e.Fragment,{children:[e.jsx(U,{eyebrow:a("graph.eyebrow"),title:a("graph.title"),description:a("graph.description")}),e.jsx(q,{meta:s,graph:!0}),e.jsxs("div",{className:"graph-toolbar",children:[e.jsxs("label",{children:[a("graph.relationship"),e.jsxs("select",{"aria-label":a("graph.relationshipAria"),value:d,onChange:r=>i("edge_type",r.target.value),children:[e.jsx("option",{value:"",children:a("graph.allRelationships")}),s.edge_types.map(r=>e.jsx("option",{value:r,children:G(r)},r))]})]}),u&&e.jsxs("button",{className:"button subtle",onClick:()=>i("focus",""),children:[e.jsx(L,{size:14}),a("graph.clearFocus")]}),e.jsx("div",{className:"graph-legend",children:s.categories.map(r=>e.jsx(N,{value:r},r))})]}),e.jsx(T,{query:t,children:r=>{var y,j,R;return e.jsx(e.Fragment,{children:(y=r.nodes)!=null&&y.length?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`graph-workspace ${m?"has-selection":""}`,children:[e.jsx(te,{data:r,selected:g,onSelect:x,focus:u}),m&&e.jsx(re,{memory:m,onClose:()=>x(""),onExpand:()=>i("focus",m.id)})]}),e.jsxs("div",{className:"results-line",children:[e.jsx("span",{children:a("graph.resultLine",{shown:r.nodes.length,total:r.total,edges:((j=r.edges)==null?void 0:j.length)||0})}),e.jsx($,{value:r.updated_at,loading:t.loading})]}),r.truncated&&e.jsx("p",{className:"notice",children:a("graph.bounded")}),e.jsxs("details",{className:"graph-list",open:!0,children:[e.jsxs("summary",{children:[a("graph.browseMemories")," ",e.jsx("span",{children:r.nodes.length})]}),e.jsx("div",{className:"graph-node-list",children:r.nodes.map(l=>e.jsxs("button",{className:g===l.id?"active":"",onClick:()=>x(l.id),"aria-pressed":g===l.id,children:[e.jsx(N,{value:l.category}),e.jsx("span",{children:M(l.content)||a("state.untitled")}),e.jsx(W,{size:14})]},l.id))})]}),!!((R=r.edges)!=null&&R.length)&&e.jsxs("details",{className:"graph-list",children:[e.jsxs("summary",{children:[a("graph.storedRelationships")," ",e.jsx("span",{children:r.edges.length})]}),e.jsx("div",{className:"relationship-list",children:r.edges.map((l,S)=>e.jsxs("div",{children:[e.jsx(k,{href:b(o.store,"memories","",l.source_id),children:l.source_id}),e.jsxs("span",{children:[" → ",l.edge_type," → "]}),e.jsx(k,{href:b(o.store,"memories","",l.target_id),children:l.target_id}),e.jsxs("small",{children:[a("graph.weight",{value:l.weight}),Object.entries(l.metadata||{}).map(([F,I])=>` · ${F}: ${I}`).join("")]})]},S))})]})]}):e.jsx(H,{title:a("graph.noConnections"),icon:"search",children:e.jsx("p",{children:a("graph.noConnectionsText")})})})}})]})}function re({memory:s,onClose:c,onExpand:o}){var n;const{route:p}=E(),a=C();return e.jsxs("aside",{className:"graph-preview",children:[e.jsxs("div",{className:"section-heading",children:[e.jsx("span",{className:"eyebrow",children:a("graph.selectedMemory")}),e.jsx("button",{className:"icon-button","aria-label":a("graph.closeSelected"),onClick:c,children:e.jsx(L,{size:17})})]}),e.jsx(N,{value:s.category}),e.jsx("h2",{children:M(s.content)||a("state.untitled")}),e.jsx("p",{children:Z(s.content)}),e.jsxs("dl",{children:[e.jsx("dt",{children:a("reader.source")}),e.jsx("dd",{children:s.source||a("state.notRecorded")})]}),e.jsxs(k,{className:"button primary",href:b(p.store,"memories",p.search,s.id),children:[a("graph.readFullMemory"),e.jsx(B,{size:15})]}),e.jsxs("button",{className:"button",onClick:o,children:[e.jsx(X,{size:15}),a("graph.expandNeighborhood")]}),!!((n=s.entities)!=null&&n.length)&&e.jsx("div",{className:"chip-list",children:s.entities.map(h=>e.jsx(k,{href:b(p.store,"library",new URLSearchParams({entity:h}).toString()),children:h},h))})]})}export{ie as GraphView,P as graphStyle}; diff --git a/web/dist/assets/index-CXicYQ-x.js b/web/dist/assets/index-CXicYQ-x.js deleted file mode 100644 index 06dc9327..00000000 --- a/web/dist/assets/index-CXicYQ-x.js +++ /dev/null @@ -1,229 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GraphView-CNp1jlCw.js","assets/cytoscape-G6xtpWZq.js"])))=>i.map(i=>d[i]); -(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))u(s);new MutationObserver(s=>{for(const f of s)if(f.type==="childList")for(const h of f.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&u(h)}).observe(document,{childList:!0,subtree:!0});function r(s){const f={};return s.integrity&&(f.integrity=s.integrity),s.referrerPolicy&&(f.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?f.credentials="include":s.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function u(s){if(s.ep)return;s.ep=!0;const f=r(s);fetch(s.href,f)}})();function Up(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Os={exports:{}},Sa={};/** - * @license React - * react-jsx-runtime.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Rm;function ax(){if(Rm)return Sa;Rm=1;var n=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function r(u,s,f){var h=null;if(f!==void 0&&(h=""+f),s.key!==void 0&&(h=""+s.key),"key"in s){f={};for(var d in s)d!=="key"&&(f[d]=s[d])}else f=s;return s=f.ref,{$$typeof:n,type:u,key:h,ref:s!==void 0?s:null,props:f}}return Sa.Fragment=a,Sa.jsx=r,Sa.jsxs=r,Sa}var Om;function rx(){return Om||(Om=1,Os.exports=ax()),Os.exports}var x=rx(),Ns={exports:{}},ge={};/** - * @license React - * react.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Nm;function ux(){if(Nm)return ge;Nm=1;var n=Symbol.for("react.transitional.element"),a=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),h=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.iterator;function E(v){return v===null||typeof v!="object"?null:(v=y&&v[y]||v["@@iterator"],typeof v=="function"?v:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},z=Object.assign,_={};function H(v,G,P){this.props=v,this.context=G,this.refs=_,this.updater=P||k}H.prototype.isReactComponent={},H.prototype.setState=function(v,G){if(typeof v!="object"&&typeof v!="function"&&v!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,v,G,"setState")},H.prototype.forceUpdate=function(v){this.updater.enqueueForceUpdate(this,v,"forceUpdate")};function j(){}j.prototype=H.prototype;function Q(v,G,P){this.props=v,this.context=G,this.refs=_,this.updater=P||k}var V=Q.prototype=new j;V.constructor=Q,z(V,H.prototype),V.isPureReactComponent=!0;var ue=Array.isArray,Z={H:null,A:null,T:null,S:null,V:null},B=Object.prototype.hasOwnProperty;function ee(v,G,P,w,ne,xe){return P=xe.ref,{$$typeof:n,type:v,key:G,ref:P!==void 0?P:null,props:xe}}function se(v,G){return ee(v.type,G,void 0,void 0,void 0,v.props)}function Ae(v){return typeof v=="object"&&v!==null&&v.$$typeof===n}function U(v){var G={"=":"=0",":":"=2"};return"$"+v.replace(/[=:]/g,function(P){return G[P]})}var $=/\/+/g;function W(v,G){return typeof v=="object"&&v!==null&&v.key!=null?U(""+v.key):G.toString(36)}function Se(){}function ae(v){switch(v.status){case"fulfilled":return v.value;case"rejected":throw v.reason;default:switch(typeof v.status=="string"?v.then(Se,Se):(v.status="pending",v.then(function(G){v.status==="pending"&&(v.status="fulfilled",v.value=G)},function(G){v.status==="pending"&&(v.status="rejected",v.reason=G)})),v.status){case"fulfilled":return v.value;case"rejected":throw v.reason}}throw v}function I(v,G,P,w,ne){var xe=typeof v;(xe==="undefined"||xe==="boolean")&&(v=null);var le=!1;if(v===null)le=!0;else switch(xe){case"bigint":case"string":case"number":le=!0;break;case"object":switch(v.$$typeof){case n:case a:le=!0;break;case g:return le=v._init,I(le(v._payload),G,P,w,ne)}}if(le)return ne=ne(v),le=w===""?"."+W(v,0):w,ue(ne)?(P="",le!=null&&(P=le.replace($,"$&/")+"/"),I(ne,G,P,"",function(xt){return xt})):ne!=null&&(Ae(ne)&&(ne=se(ne,P+(ne.key==null||v&&v.key===ne.key?"":(""+ne.key).replace($,"$&/")+"/")+le)),G.push(ne)),1;le=0;var We=w===""?".":w+":";if(ue(v))for(var je=0;je>>1,v=O[Ee];if(0>>1;Ees(w,ie))nes(xe,w)?(O[Ee]=xe,O[ne]=ie,Ee=ne):(O[Ee]=w,O[P]=ie,Ee=P);else if(nes(xe,ie))O[Ee]=xe,O[ne]=ie,Ee=ne;else break e}}return J}function s(O,J){var ie=O.sortIndex-J.sortIndex;return ie!==0?ie:O.id-J.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;n.unstable_now=function(){return f.now()}}else{var h=Date,d=h.now();n.unstable_now=function(){return h.now()-d}}var p=[],m=[],g=1,y=null,E=3,k=!1,z=!1,_=!1,H=!1,j=typeof setTimeout=="function"?setTimeout:null,Q=typeof clearTimeout=="function"?clearTimeout:null,V=typeof setImmediate<"u"?setImmediate:null;function ue(O){for(var J=r(m);J!==null;){if(J.callback===null)u(m);else if(J.startTime<=O)u(m),J.sortIndex=J.expirationTime,a(p,J);else break;J=r(m)}}function Z(O){if(_=!1,ue(O),!z)if(r(p)!==null)z=!0,B||(B=!0,W());else{var J=r(m);J!==null&&I(Z,J.startTime-O)}}var B=!1,ee=-1,se=5,Ae=-1;function U(){return H?!0:!(n.unstable_now()-AeO&&U());){var Ee=y.callback;if(typeof Ee=="function"){y.callback=null,E=y.priorityLevel;var v=Ee(y.expirationTime<=O);if(O=n.unstable_now(),typeof v=="function"){y.callback=v,ue(O),J=!0;break t}y===r(p)&&u(p),ue(O)}else u(p);y=r(p)}if(y!==null)J=!0;else{var G=r(m);G!==null&&I(Z,G.startTime-O),J=!1}}break e}finally{y=null,E=ie,k=!1}J=void 0}}finally{J?W():B=!1}}}var W;if(typeof V=="function")W=function(){V($)};else if(typeof MessageChannel<"u"){var Se=new MessageChannel,ae=Se.port2;Se.port1.onmessage=$,W=function(){ae.postMessage(null)}}else W=function(){j($,0)};function I(O,J){ee=j(function(){O(n.unstable_now())},J)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(O){O.callback=null},n.unstable_forceFrameRate=function(O){0>O||125Ee?(O.sortIndex=ie,a(m,O),r(p)===null&&O===r(m)&&(_?(Q(ee),ee=-1):_=!0,I(Z,ie-Ee))):(O.sortIndex=v,a(p,O),z||k||(z=!0,B||(B=!0,W()))),O},n.unstable_shouldYield=U,n.unstable_wrapCallback=function(O){var J=E;return function(){var ie=E;E=J;try{return O.apply(this,arguments)}finally{E=ie}}}})(Bs)),Bs}var Bm;function sx(){return Bm||(Bm=1,Us.exports=ox()),Us.exports}var Hs={exports:{}},mt={};/** - * @license React - * react-dom.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Hm;function cx(){if(Hm)return mt;Hm=1;var n=vc();function a(p){var m="https://react.dev/errors/"+p;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(a){console.error(a)}}return n(),Hs.exports=cx(),Hs.exports}/** - * @license React - * react-dom-client.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Ym;function hx(){if(Ym)return ka;Ym=1;var n=sx(),a=vc(),r=fx();function u(e){var t="https://react.dev/errors/"+e;if(1v||(e.current=Ee[v],Ee[v]=null,v--)}function w(e,t){v++,Ee[v]=e.current,e.current=t}var ne=G(null),xe=G(null),le=G(null),We=G(null);function je(e,t){switch(w(le,t),w(xe,e),w(ne,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?um(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=um(t),e=om(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}P(ne),w(ne,e)}function xt(){P(ne),P(xe),P(le)}function ln(e){e.memoizedState!==null&&w(We,e);var t=ne.current,l=om(t,e.type);t!==l&&(w(xe,e),w(ne,l))}function Dn(e){xe.current===e&&(P(ne),P(xe)),We.current===e&&(P(We),ga._currentValue=ie)}var Rl=Object.prototype.hasOwnProperty,wi=n.unstable_scheduleCallback,Ti=n.unstable_cancelCallback,bu=n.unstable_shouldYield,Ua=n.unstable_requestPaint,_t=n.unstable_now,Ba=n.unstable_getCurrentPriorityLevel,Ha=n.unstable_ImmediatePriority,Ai=n.unstable_UserBlockingPriority,al=n.unstable_NormalPriority,vu=n.unstable_LowPriority,qa=n.unstable_IdlePriority,Su=n.log,ku=n.unstable_setDisableYieldValue,rl=null,L=null;function K(e){if(typeof Su=="function"&&ku(e),L&&typeof L.setStrictMode=="function")try{L.setStrictMode(rl,e)}catch{}}var re=Math.clz32?Math.clz32:Ue,pe=Math.log,ct=Math.LN2;function Ue(e){return e>>>=0,e===0?32:31-(pe(e)/ct|0)|0}var et=256,bt=4194304;function Mt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function an(e,t,l){var i=e.pendingLanes;if(i===0)return 0;var o=0,c=e.suspendedLanes,b=e.pingedLanes;e=e.warmLanes;var S=i&134217727;return S!==0?(i=S&~c,i!==0?o=Mt(i):(b&=S,b!==0?o=Mt(b):l||(l=S&~e,l!==0&&(o=Mt(l))))):(S=i&~c,S!==0?o=Mt(S):b!==0?o=Mt(b):l||(l=i&~e,l!==0&&(o=Mt(l)))),o===0?0:t!==0&&t!==o&&(t&c)===0&&(c=o&-o,l=t&-t,c>=l||c===32&&(l&4194048)!==0)?t:o}function It(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ya(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ol(){var e=et;return et<<=1,(et&4194048)===0&&(et=256),e}function ft(){var e=bt;return bt<<=1,(bt&62914560)===0&&(bt=4194304),e}function rn(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function vt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Kg(e,t,l,i,o,c){var b=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var S=e.entanglements,T=e.expirationTimes,D=e.hiddenUpdates;for(l=b&~l;0)":-1o||T[i]!==D[o]){var q=` -`+T[i].replace(" at new "," at ");return e.displayName&&q.includes("")&&(q=q.replace("",e.displayName)),q}while(1<=i&&0<=o);break}}}finally{ju=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?ql(l):""}function Wg(e){switch(e.tag){case 26:case 27:case 5:return ql(e.type);case 16:return ql("Lazy");case 13:return ql("Suspense");case 19:return ql("SuspenseList");case 0:case 15:return Cu(e.type,!1);case 11:return Cu(e.type.render,!1);case 1:return Cu(e.type,!0);case 31:return ql("Activity");default:return""}}function ef(e){try{var t="";do t+=Wg(e),e=e.return;while(e);return t}catch(l){return` -Error generating stack: `+l.message+` -`+l.stack}}function qt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function tf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ey(e){var t=tf(e)?"checked":"value",l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),i=""+e[t];if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var o=l.get,c=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(b){i=""+b,c.call(this,b)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return i},setValue:function(b){i=""+b},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Xa(e){e._valueTracker||(e._valueTracker=ey(e))}function nf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),i="";return e&&(i=tf(e)?e.checked?"true":"false":e.value),e=i,e!==l?(t.setValue(e),!0):!1}function Qa(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var ty=/[\n"\\]/g;function Yt(e){return e.replace(ty,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function _u(e,t,l,i,o,c,b,S){e.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.type=b:e.removeAttribute("type"),t!=null?b==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+qt(t)):e.value!==""+qt(t)&&(e.value=""+qt(t)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),t!=null?Mu(e,b,qt(t)):l!=null?Mu(e,b,qt(l)):i!=null&&e.removeAttribute("value"),o==null&&c!=null&&(e.defaultChecked=!!c),o!=null&&(e.checked=o&&typeof o!="function"&&typeof o!="symbol"),S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?e.name=""+qt(S):e.removeAttribute("name")}function lf(e,t,l,i,o,c,b,S){if(c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"&&(e.type=c),t!=null||l!=null){if(!(c!=="submit"&&c!=="reset"||t!=null))return;l=l!=null?""+qt(l):"",t=t!=null?""+qt(t):l,S||t===e.value||(e.value=t),e.defaultValue=t}i=i??o,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=S?e.checked:!!i,e.defaultChecked=!!i,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(e.name=b)}function Mu(e,t,l){t==="number"&&Qa(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function Yl(e,t,l,i){if(e=e.options,t){t={};for(var o=0;o"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Lu=!1;if(pn)try{var _i={};Object.defineProperty(_i,"passive",{get:function(){Lu=!0}}),window.addEventListener("test",_i,_i),window.removeEventListener("test",_i,_i)}catch{Lu=!1}var On=null,Uu=null,Ka=null;function ff(){if(Ka)return Ka;var e,t=Uu,l=t.length,i,o="value"in On?On.value:On.textContent,c=o.length;for(e=0;e=Ri),yf=" ",xf=!1;function bf(e,t){switch(e){case"keyup":return Cy.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function vf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ql=!1;function My(e,t){switch(e){case"compositionend":return vf(t);case"keypress":return t.which!==32?null:(xf=!0,yf);case"textInput":return e=t.data,e===yf&&xf?null:e;default:return null}}function Dy(e,t){if(Ql)return e==="compositionend"||!Vu&&bf(e,t)?(e=ff(),Ka=Uu=On=null,Ql=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:l,offset:t-e};e=i}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=jf(l)}}function _f(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?_f(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Mf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Qa(e.document);t instanceof e.HTMLIFrameElement;){try{var l=typeof t.contentWindow.location.href=="string"}catch{l=!1}if(l)e=t.contentWindow;else break;t=Qa(e.document)}return t}function Qu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var qy=pn&&"documentMode"in document&&11>=document.documentMode,Zl=null,Zu=null,Ui=null,Ku=!1;function Df(e,t,l){var i=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Ku||Zl==null||Zl!==Qa(i)||(i=Zl,"selectionStart"in i&&Qu(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Ui&&Li(Ui,i)||(Ui=i,i=Ur(Zu,"onSelect"),0>=b,o-=b,yn=1<<32-re(t)+o|l<c?c:8;var b=O.T,S={};O.T=S,Ro(e,!1,t,l);try{var T=o(),D=O.S;if(D!==null&&D(S,T),T!==null&&typeof T=="object"&&typeof T.then=="function"){var q=Jy(T,i);Pi(e,t,q,Ut(e))}else Pi(e,t,i,Ut(e))}catch(X){Pi(e,t,{then:function(){},status:"rejected",reason:X},Ut())}finally{J.p=c,O.T=b}}function e1(){}function Mo(e,t,l,i){if(e.tag!==5)throw Error(u(476));var o=Rh(e).queue;Dh(e,o,t,ie,l===null?e1:function(){return Oh(e),l(i)})}function Rh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sn,lastRenderedState:ie},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sn,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Oh(e){var t=Rh(e).next.queue;Pi(e,t,{},Ut())}function Do(){return dt(ga)}function Nh(){return $e().memoizedState}function Lh(){return $e().memoizedState}function t1(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=Ut();e=Un(l);var i=Bn(t,e,l);i!==null&&(Bt(i,t,l),Zi(i,t,l)),t={cache:uo()},e.payload=t;return}t=t.return}}function n1(e,t,l){var i=Ut();l={lane:i,revertLane:0,action:l,hasEagerState:!1,eagerState:null,next:null},yr(e)?Bh(t,l):(l=$u(e,t,l,i),l!==null&&(Bt(l,e,i),Hh(l,t,i)))}function Uh(e,t,l){var i=Ut();Pi(e,t,l,i)}function Pi(e,t,l,i){var o={lane:i,revertLane:0,action:l,hasEagerState:!1,eagerState:null,next:null};if(yr(e))Bh(t,o);else{var c=e.alternate;if(e.lanes===0&&(c===null||c.lanes===0)&&(c=t.lastRenderedReducer,c!==null))try{var b=t.lastRenderedState,S=c(b,l);if(o.hasEagerState=!0,o.eagerState=S,Dt(S,b))return er(e,t,o,0),Ye===null&&Wa(),!1}catch{}finally{}if(l=$u(e,t,o,i),l!==null)return Bt(l,e,i),Hh(l,t,i),!0}return!1}function Ro(e,t,l,i){if(i={lane:2,revertLane:fs(),action:i,hasEagerState:!1,eagerState:null,next:null},yr(e)){if(t)throw Error(u(479))}else t=$u(e,l,i,2),t!==null&&Bt(t,e,2)}function yr(e){var t=e.alternate;return e===be||t!==null&&t===be}function Bh(e,t){ni=fr=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function Hh(e,t,l){if((l&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,l|=i,t.lanes=l,Zc(e,l)}}var xr={readContext:dt,use:dr,useCallback:Fe,useContext:Fe,useEffect:Fe,useImperativeHandle:Fe,useLayoutEffect:Fe,useInsertionEffect:Fe,useMemo:Fe,useReducer:Fe,useRef:Fe,useState:Fe,useDebugValue:Fe,useDeferredValue:Fe,useTransition:Fe,useSyncExternalStore:Fe,useId:Fe,useHostTransitionStatus:Fe,useFormState:Fe,useActionState:Fe,useOptimistic:Fe,useMemoCache:Fe,useCacheRefresh:Fe},qh={readContext:dt,use:dr,useCallback:function(e,t){return Tt().memoizedState=[e,t===void 0?null:t],e},useContext:dt,useEffect:Eh,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,gr(4194308,4,zh.bind(null,t,e),l)},useLayoutEffect:function(e,t){return gr(4194308,4,e,t)},useInsertionEffect:function(e,t){gr(4,2,e,t)},useMemo:function(e,t){var l=Tt();t=t===void 0?null:t;var i=e();if(bl){K(!0);try{e()}finally{K(!1)}}return l.memoizedState=[i,t],i},useReducer:function(e,t,l){var i=Tt();if(l!==void 0){var o=l(t);if(bl){K(!0);try{l(t)}finally{K(!1)}}}else o=t;return i.memoizedState=i.baseState=o,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:o},i.queue=e,e=e.dispatch=n1.bind(null,be,e),[i.memoizedState,e]},useRef:function(e){var t=Tt();return e={current:e},t.memoizedState=e},useState:function(e){e=zo(e);var t=e.queue,l=Uh.bind(null,be,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:Co,useDeferredValue:function(e,t){var l=Tt();return _o(l,e,t)},useTransition:function(){var e=zo(!1);return e=Dh.bind(null,be,e.queue,!0,!1),Tt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var i=be,o=Tt();if(Me){if(l===void 0)throw Error(u(407));l=l()}else{if(l=t(),Ye===null)throw Error(u(349));(ze&124)!==0||uh(i,t,l)}o.memoizedState=l;var c={value:l,getSnapshot:t};return o.queue=c,Eh(sh.bind(null,i,c,e),[e]),i.flags|=2048,ii(9,pr(),oh.bind(null,i,c,l,t),null),l},useId:function(){var e=Tt(),t=Ye.identifierPrefix;if(Me){var l=xn,i=yn;l=(i&~(1<<32-re(i)-1)).toString(32)+l,t="«"+t+"R"+l,l=hr++,0he?(rt=oe,oe=null):rt=oe.sibling;var Ce=R(C,oe,M[he],Y);if(Ce===null){oe===null&&(oe=rt);break}e&&oe&&Ce.alternate===null&&t(C,oe),A=c(Ce,A,he),ke===null?te=Ce:ke.sibling=Ce,ke=Ce,oe=rt}if(he===M.length)return l(C,oe),Me&&dl(C,he),te;if(oe===null){for(;hehe?(rt=oe,oe=null):rt=oe.sibling;var tl=R(C,oe,Ce.value,Y);if(tl===null){oe===null&&(oe=rt);break}e&&oe&&tl.alternate===null&&t(C,oe),A=c(tl,A,he),ke===null?te=tl:ke.sibling=tl,ke=tl,oe=rt}if(Ce.done)return l(C,oe),Me&&dl(C,he),te;if(oe===null){for(;!Ce.done;he++,Ce=M.next())Ce=X(C,Ce.value,Y),Ce!==null&&(A=c(Ce,A,he),ke===null?te=Ce:ke.sibling=Ce,ke=Ce);return Me&&dl(C,he),te}for(oe=i(oe);!Ce.done;he++,Ce=M.next())Ce=N(oe,C,he,Ce.value,Y),Ce!==null&&(e&&Ce.alternate!==null&&oe.delete(Ce.key===null?he:Ce.key),A=c(Ce,A,he),ke===null?te=Ce:ke.sibling=Ce,ke=Ce);return e&&oe.forEach(function(ix){return t(C,ix)}),Me&&dl(C,he),te}function Le(C,A,M,Y){if(typeof M=="object"&&M!==null&&M.type===z&&M.key===null&&(M=M.props.children),typeof M=="object"&&M!==null){switch(M.$$typeof){case E:e:{for(var te=M.key;A!==null;){if(A.key===te){if(te=M.type,te===z){if(A.tag===7){l(C,A.sibling),Y=o(A,M.props.children),Y.return=C,C=Y;break e}}else if(A.elementType===te||typeof te=="object"&&te!==null&&te.$$typeof===se&&Vh(te)===A.type){l(C,A.sibling),Y=o(A,M.props),ea(Y,M),Y.return=C,C=Y;break e}l(C,A);break}else t(C,A);A=A.sibling}M.type===z?(Y=fl(M.props.children,C.mode,Y,M.key),Y.return=C,C=Y):(Y=nr(M.type,M.key,M.props,null,C.mode,Y),ea(Y,M),Y.return=C,C=Y)}return b(C);case k:e:{for(te=M.key;A!==null;){if(A.key===te)if(A.tag===4&&A.stateNode.containerInfo===M.containerInfo&&A.stateNode.implementation===M.implementation){l(C,A.sibling),Y=o(A,M.children||[]),Y.return=C,C=Y;break e}else{l(C,A);break}else t(C,A);A=A.sibling}Y=eo(M,C.mode,Y),Y.return=C,C=Y}return b(C);case se:return te=M._init,M=te(M._payload),Le(C,A,M,Y)}if(I(M))return de(C,A,M,Y);if(W(M)){if(te=W(M),typeof te!="function")throw Error(u(150));return M=te.call(M),ce(C,A,M,Y)}if(typeof M.then=="function")return Le(C,A,br(M),Y);if(M.$$typeof===V)return Le(C,A,rr(C,M),Y);vr(C,M)}return typeof M=="string"&&M!==""||typeof M=="number"||typeof M=="bigint"?(M=""+M,A!==null&&A.tag===6?(l(C,A.sibling),Y=o(A,M),Y.return=C,C=Y):(l(C,A),Y=Wu(M,C.mode,Y),Y.return=C,C=Y),b(C)):l(C,A)}return function(C,A,M,Y){try{Wi=0;var te=Le(C,A,M,Y);return ai=null,te}catch(oe){if(oe===Xi||oe===or)throw oe;var ke=Rt(29,oe,null,C.mode);return ke.lanes=Y,ke.return=C,ke}finally{}}}var ri=Gh(!0),Xh=Gh(!1),Zt=G(null),on=null;function qn(e){var t=e.alternate;w(nt,nt.current&1),w(Zt,e),on===null&&(t===null||ti.current!==null||t.memoizedState!==null)&&(on=e)}function Qh(e){if(e.tag===22){if(w(nt,nt.current),w(Zt,e),on===null){var t=e.alternate;t!==null&&t.memoizedState!==null&&(on=e)}}else Yn()}function Yn(){w(nt,nt.current),w(Zt,Zt.current)}function kn(e){P(Zt),on===e&&(on=null),P(nt)}var nt=G(0);function Sr(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||l.data==="$?"||Es(l)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function Oo(e,t,l,i){t=e.memoizedState,l=l(i,t),l=l==null?t:g({},t,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var No={enqueueSetState:function(e,t,l){e=e._reactInternals;var i=Ut(),o=Un(i);o.payload=t,l!=null&&(o.callback=l),t=Bn(e,o,i),t!==null&&(Bt(t,e,i),Zi(t,e,i))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var i=Ut(),o=Un(i);o.tag=1,o.payload=t,l!=null&&(o.callback=l),t=Bn(e,o,i),t!==null&&(Bt(t,e,i),Zi(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=Ut(),i=Un(l);i.tag=2,t!=null&&(i.callback=t),t=Bn(e,i,l),t!==null&&(Bt(t,e,l),Zi(t,e,l))}};function Zh(e,t,l,i,o,c,b){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,c,b):t.prototype&&t.prototype.isPureReactComponent?!Li(l,i)||!Li(o,c):!0}function Kh(e,t,l,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(l,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(l,i),t.state!==e&&No.enqueueReplaceState(t,t.state,null)}function vl(e,t){var l=t;if("ref"in t){l={};for(var i in t)i!=="ref"&&(l[i]=t[i])}if(e=e.defaultProps){l===t&&(l=g({},l));for(var o in e)l[o]===void 0&&(l[o]=e[o])}return l}var kr=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)};function Fh(e){kr(e)}function Jh(e){console.error(e)}function Ih(e){kr(e)}function Er(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function $h(e,t,l){try{var i=e.onCaughtError;i(l.value,{componentStack:l.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(o){setTimeout(function(){throw o})}}function Lo(e,t,l){return l=Un(l),l.tag=3,l.payload={element:null},l.callback=function(){Er(e,t)},l}function Ph(e){return e=Un(e),e.tag=3,e}function Wh(e,t,l,i){var o=l.type.getDerivedStateFromError;if(typeof o=="function"){var c=i.value;e.payload=function(){return o(c)},e.callback=function(){$h(t,l,i)}}var b=l.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){$h(t,l,i),typeof o!="function"&&(Kn===null?Kn=new Set([this]):Kn.add(this));var S=i.stack;this.componentDidCatch(i.value,{componentStack:S!==null?S:""})})}function i1(e,t,l,i,o){if(l.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(t=l.alternate,t!==null&&Yi(t,l,o,!0),l=Zt.current,l!==null){switch(l.tag){case 13:return on===null?rs():l.alternate===null&&Ke===0&&(Ke=3),l.flags&=-257,l.flags|=65536,l.lanes=o,i===co?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([i]):t.add(i),os(e,i,o)),!1;case 22:return l.flags|=65536,i===co?l.flags|=16384:(t=l.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},l.updateQueue=t):(l=t.retryQueue,l===null?t.retryQueue=new Set([i]):l.add(i)),os(e,i,o)),!1}throw Error(u(435,l.tag))}return os(e,i,o),rs(),!1}if(Me)return t=Zt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=o,i!==lo&&(e=Error(u(422),{cause:i}),qi(Vt(e,l)))):(i!==lo&&(t=Error(u(423),{cause:i}),qi(Vt(t,l))),e=e.current.alternate,e.flags|=65536,o&=-o,e.lanes|=o,i=Vt(i,l),o=Lo(e.stateNode,i,o),mo(e,o),Ke!==4&&(Ke=2)),!1;var c=Error(u(520),{cause:i});if(c=Vt(c,l),ua===null?ua=[c]:ua.push(c),Ke!==4&&(Ke=2),t===null)return!0;i=Vt(i,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=o&-o,l.lanes|=e,e=Lo(l.stateNode,i,e),mo(l,e),!1;case 1:if(t=l.type,c=l.stateNode,(l.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||c!==null&&typeof c.componentDidCatch=="function"&&(Kn===null||!Kn.has(c))))return l.flags|=65536,o&=-o,l.lanes|=o,o=Ph(o),Wh(o,e,l,i),mo(l,o),!1}l=l.return}while(l!==null);return!1}var ed=Error(u(461)),it=!1;function ut(e,t,l,i){t.child=e===null?Xh(t,null,l,i):ri(t,e.child,l,i)}function td(e,t,l,i,o){l=l.render;var c=t.ref;if("ref"in i){var b={};for(var S in i)S!=="ref"&&(b[S]=i[S])}else b=i;return yl(t),i=bo(e,t,l,b,c,o),S=vo(),e!==null&&!it?(So(e,t,o),En(e,t,o)):(Me&&S&&to(t),t.flags|=1,ut(e,t,i,o),t.child)}function nd(e,t,l,i,o){if(e===null){var c=l.type;return typeof c=="function"&&!Pu(c)&&c.defaultProps===void 0&&l.compare===null?(t.tag=15,t.type=c,ld(e,t,c,i,o)):(e=nr(l.type,null,i,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(c=e.child,!Xo(e,o)){var b=c.memoizedProps;if(l=l.compare,l=l!==null?l:Li,l(b,i)&&e.ref===t.ref)return En(e,t,o)}return t.flags|=1,e=gn(c,i),e.ref=t.ref,e.return=t,t.child=e}function ld(e,t,l,i,o){if(e!==null){var c=e.memoizedProps;if(Li(c,i)&&e.ref===t.ref)if(it=!1,t.pendingProps=i=c,Xo(e,o))(e.flags&131072)!==0&&(it=!0);else return t.lanes=e.lanes,En(e,t,o)}return Uo(e,t,l,i,o)}function id(e,t,l){var i=t.pendingProps,o=i.children,c=e!==null?e.memoizedState:null;if(i.mode==="hidden"){if((t.flags&128)!==0){if(i=c!==null?c.baseLanes|l:l,e!==null){for(o=t.child=e.child,c=0;o!==null;)c=c|o.lanes|o.childLanes,o=o.sibling;t.childLanes=c&~i}else t.childLanes=0,t.child=null;return ad(e,t,i,l)}if((l&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ur(t,c!==null?c.cachePool:null),c!==null?lh(t,c):go(),Qh(t);else return t.lanes=t.childLanes=536870912,ad(e,t,c!==null?c.baseLanes|l:l,l)}else c!==null?(ur(t,c.cachePool),lh(t,c),Yn(),t.memoizedState=null):(e!==null&&ur(t,null),go(),Yn());return ut(e,t,o,l),t.child}function ad(e,t,l,i){var o=so();return o=o===null?null:{parent:tt._currentValue,pool:o},t.memoizedState={baseLanes:l,cachePool:o},e!==null&&ur(t,null),go(),Qh(t),e!==null&&Yi(e,t,i,!0),null}function wr(e,t){var l=t.ref;if(l===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(u(284));(e===null||e.ref!==l)&&(t.flags|=4194816)}}function Uo(e,t,l,i,o){return yl(t),l=bo(e,t,l,i,void 0,o),i=vo(),e!==null&&!it?(So(e,t,o),En(e,t,o)):(Me&&i&&to(t),t.flags|=1,ut(e,t,l,o),t.child)}function rd(e,t,l,i,o,c){return yl(t),t.updateQueue=null,l=ah(t,i,l,o),ih(e),i=vo(),e!==null&&!it?(So(e,t,c),En(e,t,c)):(Me&&i&&to(t),t.flags|=1,ut(e,t,l,c),t.child)}function ud(e,t,l,i,o){if(yl(t),t.stateNode===null){var c=Il,b=l.contextType;typeof b=="object"&&b!==null&&(c=dt(b)),c=new l(i,c),t.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=No,t.stateNode=c,c._reactInternals=t,c=t.stateNode,c.props=i,c.state=t.memoizedState,c.refs={},fo(t),b=l.contextType,c.context=typeof b=="object"&&b!==null?dt(b):Il,c.state=t.memoizedState,b=l.getDerivedStateFromProps,typeof b=="function"&&(Oo(t,l,b,i),c.state=t.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof c.getSnapshotBeforeUpdate=="function"||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(b=c.state,typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount(),b!==c.state&&No.enqueueReplaceState(c,c.state,null),Fi(t,i,c,o),Ki(),c.state=t.memoizedState),typeof c.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){c=t.stateNode;var S=t.memoizedProps,T=vl(l,S);c.props=T;var D=c.context,q=l.contextType;b=Il,typeof q=="object"&&q!==null&&(b=dt(q));var X=l.getDerivedStateFromProps;q=typeof X=="function"||typeof c.getSnapshotBeforeUpdate=="function",S=t.pendingProps!==S,q||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(S||D!==b)&&Kh(t,c,i,b),Ln=!1;var R=t.memoizedState;c.state=R,Fi(t,i,c,o),Ki(),D=t.memoizedState,S||R!==D||Ln?(typeof X=="function"&&(Oo(t,l,X,i),D=t.memoizedState),(T=Ln||Zh(t,l,T,i,R,D,b))?(q||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount()),typeof c.componentDidMount=="function"&&(t.flags|=4194308)):(typeof c.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=D),c.props=i,c.state=D,c.context=b,i=T):(typeof c.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{c=t.stateNode,ho(e,t),b=t.memoizedProps,q=vl(l,b),c.props=q,X=t.pendingProps,R=c.context,D=l.contextType,T=Il,typeof D=="object"&&D!==null&&(T=dt(D)),S=l.getDerivedStateFromProps,(D=typeof S=="function"||typeof c.getSnapshotBeforeUpdate=="function")||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(b!==X||R!==T)&&Kh(t,c,i,T),Ln=!1,R=t.memoizedState,c.state=R,Fi(t,i,c,o),Ki();var N=t.memoizedState;b!==X||R!==N||Ln||e!==null&&e.dependencies!==null&&ar(e.dependencies)?(typeof S=="function"&&(Oo(t,l,S,i),N=t.memoizedState),(q=Ln||Zh(t,l,q,i,R,N,T)||e!==null&&e.dependencies!==null&&ar(e.dependencies))?(D||typeof c.UNSAFE_componentWillUpdate!="function"&&typeof c.componentWillUpdate!="function"||(typeof c.componentWillUpdate=="function"&&c.componentWillUpdate(i,N,T),typeof c.UNSAFE_componentWillUpdate=="function"&&c.UNSAFE_componentWillUpdate(i,N,T)),typeof c.componentDidUpdate=="function"&&(t.flags|=4),typeof c.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof c.componentDidUpdate!="function"||b===e.memoizedProps&&R===e.memoizedState||(t.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&R===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=N),c.props=i,c.state=N,c.context=T,i=q):(typeof c.componentDidUpdate!="function"||b===e.memoizedProps&&R===e.memoizedState||(t.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&R===e.memoizedState||(t.flags|=1024),i=!1)}return c=i,wr(e,t),i=(t.flags&128)!==0,c||i?(c=t.stateNode,l=i&&typeof l.getDerivedStateFromError!="function"?null:c.render(),t.flags|=1,e!==null&&i?(t.child=ri(t,e.child,null,o),t.child=ri(t,null,l,o)):ut(e,t,l,o),t.memoizedState=c.state,e=t.child):e=En(e,t,o),e}function od(e,t,l,i){return Hi(),t.flags|=256,ut(e,t,l,i),t.child}var Bo={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ho(e){return{baseLanes:e,cachePool:Jf()}}function qo(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=Kt),e}function sd(e,t,l){var i=t.pendingProps,o=!1,c=(t.flags&128)!==0,b;if((b=c)||(b=e!==null&&e.memoizedState===null?!1:(nt.current&2)!==0),b&&(o=!0,t.flags&=-129),b=(t.flags&32)!==0,t.flags&=-33,e===null){if(Me){if(o?qn(t):Yn(),Me){var S=Ze,T;if(T=S){e:{for(T=S,S=un;T.nodeType!==8;){if(!S){S=null;break e}if(T=Wt(T.nextSibling),T===null){S=null;break e}}S=T}S!==null?(t.memoizedState={dehydrated:S,treeContext:hl!==null?{id:yn,overflow:xn}:null,retryLane:536870912,hydrationErrors:null},T=Rt(18,null,null,0),T.stateNode=S,T.return=t,t.child=T,St=t,Ze=null,T=!0):T=!1}T||pl(t)}if(S=t.memoizedState,S!==null&&(S=S.dehydrated,S!==null))return Es(S)?t.lanes=32:t.lanes=536870912,null;kn(t)}return S=i.children,i=i.fallback,o?(Yn(),o=t.mode,S=Tr({mode:"hidden",children:S},o),i=fl(i,o,l,null),S.return=t,i.return=t,S.sibling=i,t.child=S,o=t.child,o.memoizedState=Ho(l),o.childLanes=qo(e,b,l),t.memoizedState=Bo,i):(qn(t),Yo(t,S))}if(T=e.memoizedState,T!==null&&(S=T.dehydrated,S!==null)){if(c)t.flags&256?(qn(t),t.flags&=-257,t=Vo(e,t,l)):t.memoizedState!==null?(Yn(),t.child=e.child,t.flags|=128,t=null):(Yn(),o=i.fallback,S=t.mode,i=Tr({mode:"visible",children:i.children},S),o=fl(o,S,l,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,ri(t,e.child,null,l),i=t.child,i.memoizedState=Ho(l),i.childLanes=qo(e,b,l),t.memoizedState=Bo,t=o);else if(qn(t),Es(S)){if(b=S.nextSibling&&S.nextSibling.dataset,b)var D=b.dgst;b=D,i=Error(u(419)),i.stack="",i.digest=b,qi({value:i,source:null,stack:null}),t=Vo(e,t,l)}else if(it||Yi(e,t,l,!1),b=(l&e.childLanes)!==0,it||b){if(b=Ye,b!==null&&(i=l&-l,i=(i&42)!==0?1:Eu(i),i=(i&(b.suspendedLanes|l))!==0?0:i,i!==0&&i!==T.retryLane))throw T.retryLane=i,Jl(e,i),Bt(b,e,i),ed;S.data==="$?"||rs(),t=Vo(e,t,l)}else S.data==="$?"?(t.flags|=192,t.child=e.child,t=null):(e=T.treeContext,Ze=Wt(S.nextSibling),St=t,Me=!0,ml=null,un=!1,e!==null&&(Xt[Qt++]=yn,Xt[Qt++]=xn,Xt[Qt++]=hl,yn=e.id,xn=e.overflow,hl=t),t=Yo(t,i.children),t.flags|=4096);return t}return o?(Yn(),o=i.fallback,S=t.mode,T=e.child,D=T.sibling,i=gn(T,{mode:"hidden",children:i.children}),i.subtreeFlags=T.subtreeFlags&65011712,D!==null?o=gn(D,o):(o=fl(o,S,l,null),o.flags|=2),o.return=t,i.return=t,i.sibling=o,t.child=i,i=o,o=t.child,S=e.child.memoizedState,S===null?S=Ho(l):(T=S.cachePool,T!==null?(D=tt._currentValue,T=T.parent!==D?{parent:D,pool:D}:T):T=Jf(),S={baseLanes:S.baseLanes|l,cachePool:T}),o.memoizedState=S,o.childLanes=qo(e,b,l),t.memoizedState=Bo,i):(qn(t),l=e.child,e=l.sibling,l=gn(l,{mode:"visible",children:i.children}),l.return=t,l.sibling=null,e!==null&&(b=t.deletions,b===null?(t.deletions=[e],t.flags|=16):b.push(e)),t.child=l,t.memoizedState=null,l)}function Yo(e,t){return t=Tr({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Tr(e,t){return e=Rt(22,e,null,t),e.lanes=0,e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},e}function Vo(e,t,l){return ri(t,e.child,null,l),e=Yo(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function cd(e,t,l){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),ao(e.return,t,l)}function Go(e,t,l,i,o){var c=e.memoizedState;c===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:l,tailMode:o}:(c.isBackwards=t,c.rendering=null,c.renderingStartTime=0,c.last=i,c.tail=l,c.tailMode=o)}function fd(e,t,l){var i=t.pendingProps,o=i.revealOrder,c=i.tail;if(ut(e,t,i.children,l),i=nt.current,(i&2)!==0)i=i&1|2,t.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&cd(e,l,t);else if(e.tag===19)cd(e,l,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}i&=1}switch(w(nt,i),o){case"forwards":for(l=t.child,o=null;l!==null;)e=l.alternate,e!==null&&Sr(e)===null&&(o=l),l=l.sibling;l=o,l===null?(o=t.child,t.child=null):(o=l.sibling,l.sibling=null),Go(t,!1,o,l,c);break;case"backwards":for(l=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&Sr(e)===null){t.child=o;break}e=o.sibling,o.sibling=l,l=o,o=e}Go(t,!0,l,null,c);break;case"together":Go(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function En(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),Zn|=t.lanes,(l&t.childLanes)===0)if(e!==null){if(Yi(e,t,l,!1),(l&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(u(153));if(t.child!==null){for(e=t.child,l=gn(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=gn(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function Xo(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&ar(e)))}function a1(e,t,l){switch(t.tag){case 3:je(t,t.stateNode.containerInfo),Nn(t,tt,e.memoizedState.cache),Hi();break;case 27:case 5:ln(t);break;case 4:je(t,t.stateNode.containerInfo);break;case 10:Nn(t,t.type,t.memoizedProps.value);break;case 13:var i=t.memoizedState;if(i!==null)return i.dehydrated!==null?(qn(t),t.flags|=128,null):(l&t.child.childLanes)!==0?sd(e,t,l):(qn(t),e=En(e,t,l),e!==null?e.sibling:null);qn(t);break;case 19:var o=(e.flags&128)!==0;if(i=(l&t.childLanes)!==0,i||(Yi(e,t,l,!1),i=(l&t.childLanes)!==0),o){if(i)return fd(e,t,l);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),w(nt,nt.current),i)break;return null;case 22:case 23:return t.lanes=0,id(e,t,l);case 24:Nn(t,tt,e.memoizedState.cache)}return En(e,t,l)}function hd(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)it=!0;else{if(!Xo(e,l)&&(t.flags&128)===0)return it=!1,a1(e,t,l);it=(e.flags&131072)!==0}else it=!1,Me&&(t.flags&1048576)!==0&&Vf(t,ir,t.index);switch(t.lanes=0,t.tag){case 16:e:{e=t.pendingProps;var i=t.elementType,o=i._init;if(i=o(i._payload),t.type=i,typeof i=="function")Pu(i)?(e=vl(i,e),t.tag=1,t=ud(null,t,i,e,l)):(t.tag=0,t=Uo(null,t,i,e,l));else{if(i!=null){if(o=i.$$typeof,o===ue){t.tag=11,t=td(null,t,i,e,l);break e}else if(o===ee){t.tag=14,t=nd(null,t,i,e,l);break e}}throw t=ae(i)||i,Error(u(306,t,""))}}return t;case 0:return Uo(e,t,t.type,t.pendingProps,l);case 1:return i=t.type,o=vl(i,t.pendingProps),ud(e,t,i,o,l);case 3:e:{if(je(t,t.stateNode.containerInfo),e===null)throw Error(u(387));i=t.pendingProps;var c=t.memoizedState;o=c.element,ho(e,t),Fi(t,i,null,l);var b=t.memoizedState;if(i=b.cache,Nn(t,tt,i),i!==c.cache&&ro(t,[tt],l,!0),Ki(),i=b.element,c.isDehydrated)if(c={element:i,isDehydrated:!1,cache:b.cache},t.updateQueue.baseState=c,t.memoizedState=c,t.flags&256){t=od(e,t,i,l);break e}else if(i!==o){o=Vt(Error(u(424)),t),qi(o),t=od(e,t,i,l);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Ze=Wt(e.firstChild),St=t,Me=!0,ml=null,un=!0,l=Xh(t,null,i,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(Hi(),i===o){t=En(e,t,l);break e}ut(e,t,i,l)}t=t.child}return t;case 26:return wr(e,t),e===null?(l=gm(t.type,null,t.pendingProps,null))?t.memoizedState=l:Me||(l=t.type,e=t.pendingProps,i=Hr(le.current).createElement(l),i[ht]=t,i[Et]=e,st(i,l,e),lt(i),t.stateNode=i):t.memoizedState=gm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ln(t),e===null&&Me&&(i=t.stateNode=dm(t.type,t.pendingProps,le.current),St=t,un=!0,o=Ze,In(t.type)?(ws=o,Ze=Wt(i.firstChild)):Ze=o),ut(e,t,t.pendingProps.children,l),wr(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Me&&((o=i=Ze)&&(i=R1(i,t.type,t.pendingProps,un),i!==null?(t.stateNode=i,St=t,Ze=Wt(i.firstChild),un=!1,o=!0):o=!1),o||pl(t)),ln(t),o=t.type,c=t.pendingProps,b=e!==null?e.memoizedProps:null,i=c.children,vs(o,c)?i=null:b!==null&&vs(o,b)&&(t.flags|=32),t.memoizedState!==null&&(o=bo(e,t,$y,null,null,l),ga._currentValue=o),wr(e,t),ut(e,t,i,l),t.child;case 6:return e===null&&Me&&((e=l=Ze)&&(l=O1(l,t.pendingProps,un),l!==null?(t.stateNode=l,St=t,Ze=null,e=!0):e=!1),e||pl(t)),null;case 13:return sd(e,t,l);case 4:return je(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=ri(t,null,i,l):ut(e,t,i,l),t.child;case 11:return td(e,t,t.type,t.pendingProps,l);case 7:return ut(e,t,t.pendingProps,l),t.child;case 8:return ut(e,t,t.pendingProps.children,l),t.child;case 12:return ut(e,t,t.pendingProps.children,l),t.child;case 10:return i=t.pendingProps,Nn(t,t.type,i.value),ut(e,t,i.children,l),t.child;case 9:return o=t.type._context,i=t.pendingProps.children,yl(t),o=dt(o),i=i(o),t.flags|=1,ut(e,t,i,l),t.child;case 14:return nd(e,t,t.type,t.pendingProps,l);case 15:return ld(e,t,t.type,t.pendingProps,l);case 19:return fd(e,t,l);case 31:return i=t.pendingProps,l=t.mode,i={mode:i.mode,children:i.children},e===null?(l=Tr(i,l),l.ref=t.ref,t.child=l,l.return=t,t=l):(l=gn(e.child,i),l.ref=t.ref,t.child=l,l.return=t,t=l),t;case 22:return id(e,t,l);case 24:return yl(t),i=dt(tt),e===null?(o=so(),o===null&&(o=Ye,c=uo(),o.pooledCache=c,c.refCount++,c!==null&&(o.pooledCacheLanes|=l),o=c),t.memoizedState={parent:i,cache:o},fo(t),Nn(t,tt,o)):((e.lanes&l)!==0&&(ho(e,t),Fi(t,null,null,l),Ki()),o=e.memoizedState,c=t.memoizedState,o.parent!==i?(o={parent:i,cache:i},t.memoizedState=o,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=o),Nn(t,tt,i)):(i=c.cache,Nn(t,tt,i),i!==o.cache&&ro(t,[tt],l,!0))),ut(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(u(156,t.tag))}function wn(e){e.flags|=4}function dd(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Sm(t)){if(t=Zt.current,t!==null&&((ze&4194048)===ze?on!==null:(ze&62914560)!==ze&&(ze&536870912)===0||t!==on))throw Qi=co,If;e.flags|=8192}}function Ar(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?ft():536870912,e.lanes|=t,ci|=t)}function ta(e,t){if(!Me)switch(e.tailMode){case"hidden":t=e.tail;for(var l=null;t!==null;)t.alternate!==null&&(l=t),t=t.sibling;l===null?e.tail=null:l.sibling=null;break;case"collapsed":l=e.tail;for(var i=null;l!==null;)l.alternate!==null&&(i=l),l=l.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function Xe(e){var t=e.alternate!==null&&e.alternate.child===e.child,l=0,i=0;if(t)for(var o=e.child;o!==null;)l|=o.lanes|o.childLanes,i|=o.subtreeFlags&65011712,i|=o.flags&65011712,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)l|=o.lanes|o.childLanes,i|=o.subtreeFlags,i|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=i,e.childLanes=l,t}function r1(e,t,l){var i=t.pendingProps;switch(no(t),t.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Xe(t),null;case 1:return Xe(t),null;case 3:return l=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),vn(tt),xt(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(Bi(t)?wn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Qf())),Xe(t),null;case 26:return l=t.memoizedState,e===null?(wn(t),l!==null?(Xe(t),dd(t,l)):(Xe(t),t.flags&=-16777217)):l?l!==e.memoizedState?(wn(t),Xe(t),dd(t,l)):(Xe(t),t.flags&=-16777217):(e.memoizedProps!==i&&wn(t),Xe(t),t.flags&=-16777217),null;case 27:Dn(t),l=le.current;var o=t.type;if(e!==null&&t.stateNode!=null)e.memoizedProps!==i&&wn(t);else{if(!i){if(t.stateNode===null)throw Error(u(166));return Xe(t),null}e=ne.current,Bi(t)?Gf(t):(e=dm(o,i,l),t.stateNode=e,wn(t))}return Xe(t),null;case 5:if(Dn(t),l=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&wn(t);else{if(!i){if(t.stateNode===null)throw Error(u(166));return Xe(t),null}if(e=ne.current,Bi(t))Gf(t);else{switch(o=Hr(le.current),e){case 1:e=o.createElementNS("http://www.w3.org/2000/svg",l);break;case 2:e=o.createElementNS("http://www.w3.org/1998/Math/MathML",l);break;default:switch(l){case"svg":e=o.createElementNS("http://www.w3.org/2000/svg",l);break;case"math":e=o.createElementNS("http://www.w3.org/1998/Math/MathML",l);break;case"script":e=o.createElement("div"),e.innerHTML=" + diff --git a/web/src/App.tsx b/web/src/App.tsx index 478f7e3a..ad97f1ef 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -6,6 +6,7 @@ import { ChevronRight, CircleHelp, Hash, + Languages, LayoutDashboard, Menu, Monitor, @@ -17,7 +18,8 @@ import { X, } from "lucide-react"; import { useQuery } from "./api"; -import { Empty, humanize, QueryView } from "./components"; +import { Empty, QueryView } from "./components"; +import { useI18n, useT, type Dictionary, type Locale } from "./i18n"; import { filtersOnly, Link, routeURL, useRouter } from "./router"; import type { Meta, Page } from "./types"; import { useTheme, type ThemeMode } from "./theme"; @@ -34,12 +36,16 @@ const GraphView = lazy(() => ); const navigation = [ - { page: "overview", label: "Overview", icon: LayoutDashboard }, - { page: "library", label: "Memory library", icon: BookOpen }, - { page: "graph", label: "Knowledge graph", icon: Network }, - { page: "entities", label: "Entities", icon: Hash }, - { page: "activity", label: "Activity", icon: Activity }, -] as const; + { page: "overview", label: "nav.overview", icon: LayoutDashboard }, + { page: "library", label: "nav.library", icon: BookOpen }, + { page: "graph", label: "nav.graph", icon: Network }, + { page: "entities", label: "nav.entities", icon: Hash }, + { page: "activity", label: "nav.activity", icon: Activity }, +] as const satisfies ReadonlyArray<{ + page: Page; + label: keyof Dictionary; + icon: typeof LayoutDashboard; +}>; export function App() { const meta = useQuery("/api/meta"); return ( @@ -48,6 +54,7 @@ export function App() { } function Workspace({ meta }: { meta: Meta }) { const { route, navigate } = useRouter(); + const t = useT(); const stores = useQuery<{ stores: string[] }>("/api/stores"); const [refresh, setRefresh] = useState(0); const [sidebar, setSidebar] = useState(false); @@ -80,24 +87,24 @@ function Workspace({ meta }: { meta: Meta }) { return () => window.removeEventListener("keydown", handler); }, []); const activePage = route.page === "memories" ? "library" : route.page; - const label = - navigation.find((item) => item.page === activePage)?.label || "Workspace"; + const currentNav = navigation.find((item) => item.page === activePage); + const label = currentNav ? t(currentNav.label) : t("nav.workspace"); const storeList = stores.data?.stores || []; return (
- Skip to content + {t("shell.skipToContent")} {sidebar && (
mnemon {meta.version} @@ -200,20 +207,20 @@ function Workspace({ meta }: { meta: Meta }) {
- {route.store || "Workspace"} + {route.store || t("nav.workspace")} {label} {route.page === "memories" && ( <> - Memory + {t("nav.memory")} )}
@@ -236,19 +243,19 @@ function Workspace({ meta }: { meta: Meta }) { > setSearch(event.target.value)} /> - + - Local workspace + {t("topbar.localStatus")}
@@ -271,27 +279,27 @@ function Workspace({ meta }: { meta: Meta }) { > {stores.error && (
- Store discovery failed: {stores.error.message} - + {t("state.storeDiscoveryFailed", { + message: stores.error.message, + })} +
)} {route.page === "missing" ? ( - +

- Return to your workspace overview. + {t("missing.return")}{" "} + {t("missing.returnLink")}.

) : !route.store ? ( {() => ( - -

- No memory stores were found. Create a store with Mnemon to - get started, then refresh this workspace. -

+ +

{t("missing.homeText")}

)} @@ -306,8 +314,8 @@ function Workspace({ meta }: { meta: Meta }) { )}
- Knowledge accumulated. Context preserved. - Mnemon · Knowledge workspace + {t("shell.footerTagline")} + {t("shell.footerBrand")}
{help && ( @@ -330,7 +338,7 @@ function Workspace({ meta }: { meta: Meta }) { )} @@ -91,7 +93,7 @@ export function Filters({ onClick={() => setExpanded(!expanded)} > - Filters + {t("filters.toggle")} {active.length > 0 && ( {active.length} )} @@ -100,11 +102,11 @@ export function Filters({ {expanded && (
)} diff --git a/web/src/GraphView.test.tsx b/web/src/GraphView.test.tsx index 8f147f50..f67b8c35 100644 --- a/web/src/GraphView.test.tsx +++ b/web/src/GraphView.test.tsx @@ -3,6 +3,7 @@ import { expect, it, vi } from "vitest"; import { GraphView, graphStyle } from "./GraphView"; import { Router } from "./router"; import type { Insight, Meta } from "./types"; +import { I18nProvider } from "./i18n"; import { ThemeProvider } from "./theme"; vi.mock("cytoscape", () => ({ @@ -107,11 +108,13 @@ it("supports keyboard-equivalent graph selection, reader links, URL focus, and B })), ); render( - - - - - , + + + + + + + , ); const node = await screen.findByRole("button", { name: /A connected thought/, diff --git a/web/src/GraphView.tsx b/web/src/GraphView.tsx index 3c1b9a99..6b3142b7 100644 --- a/web/src/GraphView.tsx +++ b/web/src/GraphView.tsx @@ -23,6 +23,7 @@ import { title, } from "./components"; import { Filters } from "./Filters"; +import { useT } from "./i18n"; import { filtersOnly, Link, routeURL, useRouter } from "./router"; import type { GraphData, Insight, Meta } from "./types"; import { useTheme } from "./theme"; @@ -114,6 +115,9 @@ function GraphCanvas({ focus: string; }) { const { resolved } = useTheme(); + const t = useT(); + const tRef = useRef(t); + tRef.current = t; const container = useRef(null); const graph = useRef(null); const selectCallback = useRef(onSelect); @@ -128,7 +132,9 @@ function GraphCanvas({ ...data.nodes.map((node) => ({ data: { id: node.id, - label: title(node.content).slice(0, 36), + label: + title(node.content).slice(0, 36) || + tRef.current("state.untitled"), color: categoryColor(node.category), size: 20 + node.importance * 5, }, @@ -192,17 +198,17 @@ function GraphCanvas({ className="graph-canvas" ref={container} role="img" - aria-label="Interactive memory graph. Drag nodes to rearrange, scroll to zoom, and drag the background to pan. The memory list below provides keyboard access." + aria-label={t("graph.canvasAria")} />
- {focus ? "Focused neighborhood" : "Knowledge graph"} - Drag to explore · Scroll to zoom + {focus ? t("graph.focused") : t("graph.full")} + {t("graph.dragHint")}
@@ -585,7 +590,7 @@ export function EntitiesView({ refresh }: { refresh: number }) { <>
- {data.total} entities + {data.total} {t("entities.unit")}
@@ -598,8 +603,12 @@ export function EntitiesView({ refresh }: { refresh: number }) {

{entity.name}

- {entity.count}{" "} - {entity.count === 1 ? "memory" : "memories"} + {t( + entity.count === 1 + ? "entities.memoryCountOne" + : "entities.memoryCountMany", + { count: entity.count }, + )}

- View memories + {t("entities.viewMemories")} ) : (

- {term - ? "Try another name or concept." - : "Entities attached to your memories will appear here."} + {term ? t("entities.noMatchText") : t("entities.emptyText")}

)} @@ -649,7 +660,9 @@ export function EntitiesView({ refresh }: { refresh: number }) { disabled={query.loading || query.loadingMore} onClick={query.loadMore} > - {query.loadingMore ? "Loading…" : "Load more entities"} + {query.loadingMore + ? t("state.loadingMore") + : t("entities.loadMore")}
)} @@ -661,6 +674,7 @@ export function EntitiesView({ refresh }: { refresh: number }) { } export function ActivityView({ refresh }: { refresh: number }) { const { route } = useRouter(); + const t = useT(); const query = useQuery( storeAPI(route.store, "activity", new URLSearchParams({ limit: "50" })), refresh, @@ -669,15 +683,15 @@ export function ActivityView({ refresh }: { refresh: number }) { return ( <> {(data) => ( <>
- Operation log + {t("activity.operationLog")}
{data.items?.length ? ( @@ -693,19 +707,20 @@ export function ActivityView({ refresh }: { refresh: number }) { ) : ( - Memory unavailable {item.insight_id} + {t("state.memoryUnavailable")}{" "} + {item.insight_id} )} ))} ) : ( - -

No operations have been recorded in this space yet.

+ +

{t("activity.quietText")}

)} {data.next_cursor && ( @@ -715,7 +730,9 @@ export function ActivityView({ refresh }: { refresh: number }) { disabled={query.loading || query.loadingMore} onClick={query.loadMore} > - {query.loadingMore ? "Loading…" : "Load earlier activity"} + {query.loadingMore + ? t("state.loadingMore") + : t("activity.loadMore")} )} diff --git a/web/src/components.test.tsx b/web/src/components.test.tsx index bb0a3819..414ba66d 100644 --- a/web/src/components.test.tsx +++ b/web/src/components.test.tsx @@ -2,15 +2,18 @@ import { fireEvent, render, screen } from "@testing-library/react"; import { describe, expect, it, vi } from "vitest"; import { APIError } from "./api"; import { Category, Markdown, QueryView } from "./components"; +import { I18nProvider } from "./i18n"; describe("private Markdown reader", () => { it("renders Chinese, GFM tables, code, and safe links without creating HTML or remote image requests", () => { const { container } = render( - alert("bad")\n\n\n\n[Unsafe](javascript:alert%281%29) [Reference](https://example.com)' - } - />, + + alert("bad")\n\n\n\n[Unsafe](javascript:alert%281%29) [Reference](https://example.com)' + } + /> + , ); expect( screen.getByRole("heading", { name: "记忆与 context" }), @@ -36,19 +39,21 @@ describe("request states", () => { it("shows an unavailable reader and retry instead of rendering absent memory data", () => { const retry = vi.fn(); render( - - {() =>

Secret old content

} -
, + + + {() =>

Secret old content

} +
+
, ); expect( screen.getByRole("heading", { name: "Memory unavailable" }), @@ -60,19 +65,21 @@ describe("request states", () => { it("labels retained same-scope data as stale with a usable retry action", () => { const retry = vi.fn(); render( - - {(data) =>

{data.content}

} -
, + + + {(data) =>

{data.content}

} +
+
, ); expect(screen.getByRole("alert")).toHaveTextContent( "Showing previously loaded data.", @@ -82,7 +89,11 @@ describe("request states", () => { expect(retry).toHaveBeenCalledOnce(); }); it("renders unknown authoritative categories with a neutral fallback", () => { - const { container } = render(); + const { container } = render( + + + , + ); expect(screen.getByText("New category")).toBeVisible(); expect(container.querySelector(".category-dot")).toHaveStyle({ background: "#93918c", diff --git a/web/src/components.tsx b/web/src/components.tsx index c0868d77..53a3ff65 100644 --- a/web/src/components.tsx +++ b/web/src/components.tsx @@ -13,6 +13,7 @@ import { import ReactMarkdown from "react-markdown"; import remarkGfm from "remark-gfm"; import type { Query } from "./api"; +import { useT } from "./i18n"; import type { Insight } from "./types"; import { Link, routeURL, useRouter } from "./router"; @@ -39,7 +40,7 @@ export function title(content: string) { .replace(/[*_`>\[\]]/g, "") .split("\n") .find((line) => line.trim()) - ?.slice(0, 110) || "Untitled memory" + ?.slice(0, 110) || "" ); } export function excerpt(content: string) { @@ -49,7 +50,7 @@ export function excerpt(content: string) { .slice(0, 230); } export function date(value: string, full = false) { - if (!value) return "Unknown date"; + if (!value) return ""; const parsed = new Date(value); if (Number.isNaN(parsed.getTime())) return value; return new Intl.DateTimeFormat( @@ -71,12 +72,10 @@ export function Category({ value }: { value: string }) { ); } export function Importance({ value }: { value: number }) { + const t = useT(); + const label = t("component.importanceLabel", { value }); return ( - + {[1, 2, 3, 4, 5].map((level) => ( ))} @@ -117,11 +116,12 @@ export function QueryView({ children: (data: T) => ReactNode; unavailable?: boolean; }) { + const t = useT(); if (!query.data && query.loading) return (
- Opening your knowledge… + {t("state.loadingKnowledge")}
@@ -130,13 +130,15 @@ export function QueryView({ if (!query.data && query.error) return (

{query.error.message}

); @@ -147,10 +149,10 @@ export function QueryView({
- Showing previously loaded data. Refresh failed:{" "} - {query.error.message} + {t("state.staleData")}{" "} + {t("state.refreshFailed", { message: query.error.message })}
- +
)} {children(query.data)} @@ -186,10 +188,13 @@ export function LastUpdated({ value: string; loading?: boolean; }) { + const t = useT(); return ( - {loading ? "Refreshing…" : `Updated ${date(value, true)}`} + {loading + ? t("state.refreshing") + : t("state.updated", { date: date(value, true) })} ); } @@ -201,6 +206,7 @@ export function MemoryCard({ compact?: boolean; }) { const { route } = useRouter(); + const t = useT(); return (
-

{title(memory.content)}

+

{title(memory.content) || t("state.untitled")}

{!compact &&

{excerpt(memory.content)}

}
- {memory.source || "No source recorded"} + {memory.source || t("state.noSource")} - +
{!compact && !!memory.entities?.length && (
@@ -234,18 +242,19 @@ export function MemoryCard({ export function SectionTitle({ children, href, - label = "View all", + label, }: { children: ReactNode; href?: string; label?: string; }) { + const t = useT(); return (

{children}

{href && ( - {label} + {label ?? t("component.viewAll")} )} @@ -253,6 +262,7 @@ export function SectionTitle({ ); } export function CopyButton({ value, label }: { value: string; label: string }) { + const t = useT(); const [state, setState] = useState<"idle" | "done" | "error">("idle"); return ( ); } export function Markdown({ content }: { content: string }) { + const t = useT(); return (

{children}

, img: ({ alt }) => ( - [Image hidden for privacy{alt ? `: ${alt}` : ""}] + {t("component.imageHidden", { alt: alt ? `: ${alt}` : "" })} ), a: ({ href, children }) => ( diff --git a/web/src/i18n/en.ts b/web/src/i18n/en.ts new file mode 100644 index 00000000..1187d28b --- /dev/null +++ b/web/src/i18n/en.ts @@ -0,0 +1,264 @@ +export const en = { + // Navigation and shell + "nav.overview": "Overview", + "nav.library": "Memory library", + "nav.graph": "Knowledge graph", + "nav.entities": "Entities", + "nav.activity": "Activity", + "nav.knowledge": "Knowledge", + "nav.workspace": "Workspace", + "nav.memory": "Memory", + "shell.skipToContent": "Skip to content", + "shell.closeNavigation": "Close navigation", + "shell.openNavigation": "Open navigation", + "shell.workspaceNavigation": "Workspace navigation", + "shell.selectStore": "Select memory store", + "shell.chooseSpace": "Choose a space", + "shell.localPrivate": "Local & private", + "shell.localWorkspace": "Local workspace", + "shell.noteLine1": "Your agents’ knowledge,", + "shell.noteLine2": "ready to explore.", + "shell.readOnlyWorkspace": "Read-only workspace", + "shell.aboutButton": "About this workspace", + "shell.version": "mnemon {version}", + "shell.footerTagline": "Knowledge accumulated. Context preserved.", + "shell.footerBrand": "Mnemon · Knowledge workspace", + + // Topbar + "search.placeholder": "Find a memory…", + "search.ariaAllMemories": "Search all memories in this store", + "search.ariaSubmitStore": "Search this store", + "search.submit": "Search", + "topbar.refresh": "Refresh current view", + "topbar.localStatus": "Local workspace", + + // Appearance and language + "appearance.label": "Appearance", + "appearance.system": "System", + "appearance.light": "Light", + "appearance.dark": "Dark", + "language.label": "Language", + "language.en": "English", + "language.zh": "中文", + + // Shared states + "state.loadingKnowledge": "Opening your knowledge…", + "state.loadingGraph": "Opening your knowledge graph…", + "state.refreshing": "Refreshing…", + "state.updated": "Updated {date}", + "state.memoryUnavailable": "Memory unavailable", + "state.unableToOpen": "Unable to open this view", + "state.tryAgain": "Try again", + "state.retry": "Retry", + "state.staleData": "Showing previously loaded data.", + "state.refreshFailed": "Refresh failed: {message}", + "state.storeDiscoveryFailed": "Store discovery failed: {message}", + "state.loadingMore": "Loading…", + "state.untitled": "Untitled memory", + "state.unknownDate": "Unknown date", + "state.noSource": "No source recorded", + "state.notRecorded": "Not recorded", + "state.noneRecorded": "None recorded", + + // Memory cards and shared components + "component.importanceLabel": "Importance {value} out of 5", + "component.viewAll": "View all", + "component.copied": "Copied", + "component.copyUnavailable": "Copy unavailable", + "component.imageHidden": "[Image hidden for privacy{alt}]", + + // Page titles + "pages.overview": "Overview", + "pages.library": "Library", + "pages.graph": "Graph", + "pages.entities": "Entities", + "pages.activity": "Activity", + "pages.memories": "Memory", + + // Filters + "filters.searchMemories": "Search memories", + "filters.searchPlaceholder": "Search your memories…", + "filters.submitSearch": "Submit search", + "filters.category": "Category", + "filters.allCategories": "All categories", + "filters.sortMemories": "Sort memories", + "filters.sortNewest": "Newest first", + "filters.sortUpdated": "Recently updated", + "filters.sortImportance": "Importance", + "filters.sortRelevance": "Relevance", + "filters.toggle": "Filters", + "filters.entity": "Entity", + "filters.entityPlaceholder": "Entity name", + "filters.tag": "Tag", + "filters.tagPlaceholder": "Any tag", + "filters.source": "Source", + "filters.sourcePlaceholder": "Any source", + "filters.importance": "Importance", + "filters.anyImportance": "Any importance", + "filters.since": "Since", + "filters.until": "Until", + "filters.searchChip": "Search: {value}", + "filters.clear": "Clear filters", + + // Overview page + "overview.eyebrow": "Workspace overview", + "overview.title": "Your knowledge, connected.", + "overview.description": + "Explore what your agents have learned, decided, and remembered.", + "overview.explore": "Explore memories", + "overview.bannerTitle": "Memory becomes shared knowledge.", + "overview.bannerText": + "Read the source. Follow a connection. Keep the context.", + "overview.statMemories": "Memories", + "overview.statMemoriesHint": "Pieces of durable knowledge", + "overview.statConnections": "Connections", + "overview.statConnectionsHint": "Relationships between memories", + "overview.statCategories": "Categories", + "overview.statCategoriesHint": "Different ways of knowing", + "overview.byCategory": "By category", + "overview.recentSection": "Recently remembered", + "overview.recentEmptyTitle": "A fresh start", + "overview.recentEmptyText": "Memories added by your agents will appear here.", + "overview.entitiesSection": "Connected entities", + "overview.noEntities": "No entities recorded yet.", + "overview.followConnections": "Follow the connections.", + "overview.seeGraph": "See your knowledge graph", + "overview.activitySection": "Recent activity", + "overview.noActivity": "No activity recorded yet.", + "overview.footerNote": "Read-only · Your memories stay yours", + + // Library page + "library.eyebrow": "Collection", + "library.title": "Memory library", + "library.description": + "Search decisions, discoveries, and context across your memory store.", + "library.unitOne": "memory", + "library.unitMany": "memories", + "library.matchingView": "matching this view", + "library.inThisSpace": "in this space", + "library.bounded": + "This search uses a bounded candidate set. Narrow your filters to explore more precisely.", + "library.noMatchTitle": "No matching memories", + "library.readyTitle": "Your library is ready", + "library.noMatchText": + "Try a different search or clear a filter to open things up.", + "library.readyText": + "When your agents remember something, you’ll find it here.", + "library.loadMore": "Load more memories", + "library.showing": "Showing {shown} of {total} · Live results may change", + + // Reader page + "reader.backToLibrary": "Back to library", + "reader.kicker": "MEMORY", + "reader.replacedTitle": "This memory has been replaced.", + "reader.replacedText": "Read the newer memory for the current information.", + "reader.copyContent": "Copy content", + "reader.copyId": "Copy ID", + "reader.relatedSection": "Related memories", + "reader.noRelated": "No related memories recorded.", + "reader.relatedBounded": + "The related memory list is bounded. Explore the graph for more context.", + "reader.detailsHeading": "Memory details", + "reader.category": "Category", + "reader.source": "Source", + "reader.importance": "Importance", + "reader.importanceOf": "{value} / 5", + "reader.created": "Created", + "reader.updated": "Updated", + "reader.accessCount": "Access count", + "reader.memoryId": "Memory ID", + "reader.entities": "Entities", + "reader.tags": "Tags", + "reader.replaces": "Replaces", + "reader.replacesHint": "This memory corrects or supersedes:", + "reader.replacedBy": "Replaced by", + "reader.exploreNeighborhood": "Explore neighborhood", + "reader.storedRelationships": "Stored relationships", + "reader.weight": "Weight: {value}", + + // Entities page + "entities.eyebrow": "Connections", + "entities.title": "Entities", + "entities.description": + "People, projects, and concepts that bring your memories together.", + "entities.searchAria": "Search entities", + "entities.searchPlaceholder": "Find a person, project, or concept…", + "entities.unit": "entities", + "entities.memoryCountOne": "{count} memory", + "entities.memoryCountMany": "{count} memories", + "entities.viewMemories": "View memories", + "entities.exploreInGraph": "Explore {name} in graph", + "entities.noMatchTitle": "No matching entities", + "entities.emptyTitle": "Connections start here", + "entities.noMatchText": "Try another name or concept.", + "entities.emptyText": "Entities attached to your memories will appear here.", + "entities.loadMore": "Load more entities", + + // Activity page + "activity.eyebrow": "A GROWING BODY OF KNOWLEDGE", + "activity.title": "Activity", + "activity.description": + "The recorded operations in this space, as they happened.", + "activity.operationLog": "Operation log", + "activity.quietTitle": "A quiet moment", + "activity.quietText": "No operations have been recorded in this space yet.", + "activity.loadMore": "Load earlier activity", + + // Graph page + "graph.eyebrow": "Relationships", + "graph.title": "Knowledge graph", + "graph.description": "Follow the stored relationships between memories.", + "graph.canvasAria": + "Interactive memory graph. Drag nodes to rearrange, scroll to zoom, and drag the background to pan. The memory list below provides keyboard access.", + "graph.focused": "Focused neighborhood", + "graph.full": "Knowledge graph", + "graph.dragHint": "Drag to explore · Scroll to zoom", + "graph.zoomIn": "Zoom in", + "graph.zoomOut": "Zoom out", + "graph.fit": "Fit graph", + "graph.resetLayout": "Reset graph layout", + "graph.relationship": "Relationship", + "graph.relationshipAria": "Relationship type", + "graph.allRelationships": "All relationships", + "graph.clearFocus": "Clear neighborhood focus", + "graph.resultLine": + "{shown} of {total} memories · {edges} stored connections", + "graph.bounded": + "Showing a bounded neighborhood (up to 200 memories). Use filters or expand a selected memory to explore further.", + "graph.browseMemories": "Browse graph memories", + "graph.storedRelationships": "Stored relationships", + "graph.weight": "Weight {value}", + "graph.noConnections": "No connections in this view", + "graph.noConnectionsText": + "Try broader filters, or explore a memory with stored relationships.", + "graph.selectedMemory": "Selected memory", + "graph.closeSelected": "Close selected memory", + "graph.readFullMemory": "Read full memory", + "graph.expandNeighborhood": "Expand neighborhood", + + // Missing page and empty store + "missing.title": "This page isn’t here", + "missing.return": "Return to your ", + "missing.returnLink": "workspace overview", + "missing.homeTitle": "A home for your memories", + "missing.homeText": + "No memory stores were found. Create a store with Mnemon to get started, then refresh this workspace.", + "missing.refreshStores": "Refresh stores", + + // About dialog + "about.close": "Close workspace information", + "about.title": "Your memory workspace", + "about.paragraph1": + "Mnemon is a local, read-only window into the memories your agents have stored. Browsing does not change your memories or their access counts.", + "about.paragraph2": + "Views refresh every 15 seconds while this tab is visible. You can refresh manually at any time. Source values reflect stored metadata.", + "about.paragraph3": + "All application assets are bundled locally. Markdown images stay hidden to keep browsing private.", + "about.version": "Version {version}", + + // Document title + "doc.title": "{page} · Mnemon", + "doc.workspaceTitle": "Mnemon · Knowledge workspace", +}; + +export type Dictionary = typeof en; diff --git a/web/src/i18n/i18n.test.tsx b/web/src/i18n/i18n.test.tsx new file mode 100644 index 00000000..ec1cd6dc --- /dev/null +++ b/web/src/i18n/i18n.test.tsx @@ -0,0 +1,123 @@ +import { act, fireEvent, render, screen } from "@testing-library/react"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { Filters } from "../Filters"; +import { I18nProvider, useI18n, useT } from "./index"; +import { Router } from "../router"; +import type { Meta } from "../types"; +import { LibraryView } from "../Views"; + +const meta: Meta = { + version: "test", + initial_store: "alpha", + categories: ["fact"], + edge_types: ["semantic"], +}; + +function LanguageSwitch() { + const { locale, setLocale } = useI18n(); + return ( + + ); +} + +afterEach(() => { + window.localStorage.clear(); + window.history.replaceState(null, "", "/"); + vi.unstubAllGlobals(); +}); + +describe("i18n", () => { + it("defaults to English for non-Chinese browsers", () => { + expect(window.navigator.language.startsWith("zh")).toBe(false); + render( + + + , + ); + expect(screen.getByRole("button", { name: "switch" })).toBeVisible(); + }); + + it("follows a stored language preference before the browser language", async () => { + window.localStorage.setItem("mnemon-language", "zh"); + window.history.replaceState(null, "", "/s/alpha/library"); + vi.stubGlobal( + "fetch", + vi.fn(() => + Promise.resolve({ + ok: true, + status: 200, + json: async () => ({ + items: [], + total: 0, + next_cursor: "", + updated_at: "2026-10-18T09:00:00Z", + }), + } as Response), + ), + ); + render( + + + + + , + ); + expect(await screen.findByText("记忆库已就绪")).toBeVisible(); + expect(screen.getByLabelText("搜索记忆")).toBeVisible(); + }); + + it("switches languages at runtime and persists the choice", () => { + window.history.replaceState(null, "", "/s/alpha/library"); + vi.stubGlobal( + "fetch", + vi.fn(() => + Promise.resolve({ + ok: true, + status: 200, + json: async () => ({ + items: [], + total: 0, + next_cursor: "", + updated_at: "2026-10-18T09:00:00Z", + }), + } as Response), + ), + ); + function Probe() { + const t = useT(); + return

{t("library.readyTitle")}

; + } + render( + + + + , + ); + expect(screen.getByText("Your library is ready")).toBeVisible(); + act(() => { + fireEvent.click(screen.getByRole("button", { name: "switch" })); + }); + expect(screen.getByText("记忆库已就绪")).toBeVisible(); + expect(window.localStorage.getItem("mnemon-language")).toBe("zh"); + }); + + it("translates filter labels into Chinese", () => { + window.localStorage.setItem("mnemon-language", "zh"); + window.history.replaceState(null, "", "/s/alpha/library"); + render( + + + + + , + ); + expect(screen.getByText("筛选")).toBeVisible(); + expect(screen.getByRole("option", { name: "全部分类" })).toBeVisible(); + expect(screen.getByLabelText("搜索记忆")).toHaveAttribute( + "placeholder", + "搜索你的记忆…", + ); + }); +}); diff --git a/web/src/i18n/index.tsx b/web/src/i18n/index.tsx new file mode 100644 index 00000000..cbfbd0b7 --- /dev/null +++ b/web/src/i18n/index.tsx @@ -0,0 +1,118 @@ +import { + createContext, + useCallback, + useContext, + useEffect, + useState, + type ReactNode, +} from "react"; +import { en, type Dictionary } from "./en"; +import { zh } from "./zh"; + +export type { Dictionary } from "./en"; + +export type Locale = "en" | "zh"; + +type I18n = { + locale: Locale; + setLocale: (locale: Locale) => void; +}; + +const dictionaries: Record = { en, zh }; +const storageKey = "mnemon-language"; +const I18nContext = createContext(null); + +function parseLocale(value: string | null): Locale | null { + return value === "en" || value === "zh" ? value : null; +} + +function readStoredLocale(): Locale | null { + try { + return parseLocale(window.localStorage.getItem(storageKey)); + } catch { + return null; + } +} + +function detectLocale(): Locale { + const preferred = readStoredLocale(); + if (preferred) return preferred; + try { + const languages = window.navigator.languages?.length + ? window.navigator.languages + : [window.navigator.language]; + return languages.some((tag) => tag?.toLowerCase().startsWith("zh")) + ? "zh" + : "en"; + } catch { + return "en"; + } +} + +function interpolate( + template: string, + params?: Record, +): string { + if (!params) return template; + return template.replace(/\{(\w+)\}/g, (match, name: string) => + name in params ? String(params[name]) : match, + ); +} + +export function I18nProvider({ children }: { children: ReactNode }) { + const [locale, setLocaleState] = useState(detectLocale); + + useEffect(() => { + document.documentElement.lang = locale === "zh" ? "zh-CN" : "en"; + }, [locale]); + + useEffect(() => { + const sync = (event: StorageEvent) => { + if (event.key !== storageKey && event.key !== null) return; + try { + if (event.storageArea && event.storageArea !== window.localStorage) + return; + } catch { + // Storage access may be denied while event delivery remains available. + } + setLocaleState( + event.key === null + ? detectLocale() + : (parseLocale(event.newValue) ?? detectLocale()), + ); + }; + window.addEventListener("storage", sync); + return () => window.removeEventListener("storage", sync); + }, []); + + const setLocale = useCallback((next: Locale) => { + setLocaleState(next); + try { + window.localStorage.setItem(storageKey, next); + } catch { + // The choice still applies to this tab when persistence is unavailable. + } + }, []); + + return ( + + {children} + + ); +} + +export function useI18n(): I18n { + const value = useContext(I18nContext); + if (!value) throw new Error("useI18n must be used within I18nProvider"); + return value; +} + +export function useT() { + const { locale } = useI18n(); + const dictionary = dictionaries[locale]; + return useCallback( + (key: keyof Dictionary, params?: Record) => + interpolate(dictionary[key], params), + [dictionary], + ); +} diff --git a/web/src/i18n/zh.ts b/web/src/i18n/zh.ts new file mode 100644 index 00000000..0acc349d --- /dev/null +++ b/web/src/i18n/zh.ts @@ -0,0 +1,254 @@ +import type { Dictionary } from "./en"; + +export const zh: Dictionary = { + // Navigation and shell + "nav.overview": "总览", + "nav.library": "记忆库", + "nav.graph": "知识图谱", + "nav.entities": "实体", + "nav.activity": "活动", + "nav.knowledge": "知识", + "nav.workspace": "工作区", + "nav.memory": "记忆", + "shell.skipToContent": "跳到正文", + "shell.closeNavigation": "关闭导航", + "shell.openNavigation": "打开导航", + "shell.workspaceNavigation": "工作区导航", + "shell.selectStore": "选择记忆库", + "shell.chooseSpace": "选择一个空间", + "shell.localPrivate": "本地 · 私有", + "shell.localWorkspace": "本地工作区", + "shell.noteLine1": "你的 agents 的知识,", + "shell.noteLine2": "随时待览。", + "shell.readOnlyWorkspace": "只读工作区", + "shell.aboutButton": "关于本工作区", + "shell.version": "mnemon {version}", + "shell.footerTagline": "知识在积累,上下文不丢失。", + "shell.footerBrand": "Mnemon · 知识工作区", + + // Topbar + "search.placeholder": "查找记忆…", + "search.ariaAllMemories": "在此记忆库中搜索全部记忆", + "search.ariaSubmitStore": "搜索此记忆库", + "search.submit": "搜索", + "topbar.refresh": "刷新当前视图", + "topbar.localStatus": "本地工作区", + + // Appearance and language + "appearance.label": "外观", + "appearance.system": "跟随系统", + "appearance.light": "浅色", + "appearance.dark": "深色", + "language.label": "语言", + "language.en": "English", + "language.zh": "中文", + + // Shared states + "state.loadingKnowledge": "正在打开你的知识…", + "state.loadingGraph": "正在打开你的知识图谱…", + "state.refreshing": "刷新中…", + "state.updated": "更新于 {date}", + "state.memoryUnavailable": "记忆不可用", + "state.unableToOpen": "无法打开此视图", + "state.tryAgain": "重试", + "state.retry": "重试", + "state.staleData": "当前显示的是之前加载的数据。", + "state.refreshFailed": "刷新失败:{message}", + "state.storeDiscoveryFailed": "记忆库发现失败:{message}", + "state.loadingMore": "加载中…", + "state.untitled": "无标题记忆", + "state.unknownDate": "未知日期", + "state.noSource": "未记录来源", + "state.notRecorded": "未记录", + "state.noneRecorded": "暂无记录", + + // Memory cards and shared components + "component.importanceLabel": "重要性 {value} / 5", + "component.viewAll": "查看全部", + "component.copied": "已复制", + "component.copyUnavailable": "复制不可用", + "component.imageHidden": "[图片已隐藏以保护隐私{alt}]", + + // Page titles + "pages.overview": "总览", + "pages.library": "记忆库", + "pages.graph": "知识图谱", + "pages.entities": "实体", + "pages.activity": "活动", + "pages.memories": "记忆", + + // Filters + "filters.searchMemories": "搜索记忆", + "filters.searchPlaceholder": "搜索你的记忆…", + "filters.submitSearch": "提交搜索", + "filters.category": "分类", + "filters.allCategories": "全部分类", + "filters.sortMemories": "记忆排序", + "filters.sortNewest": "最新优先", + "filters.sortUpdated": "最近更新", + "filters.sortImportance": "重要性", + "filters.sortRelevance": "相关性", + "filters.toggle": "筛选", + "filters.entity": "实体", + "filters.entityPlaceholder": "实体名称", + "filters.tag": "标签", + "filters.tagPlaceholder": "任意标签", + "filters.source": "来源", + "filters.sourcePlaceholder": "任意来源", + "filters.importance": "重要性", + "filters.anyImportance": "任意重要性", + "filters.since": "起始日期", + "filters.until": "结束日期", + "filters.searchChip": "搜索:{value}", + "filters.clear": "清除筛选", + + // Overview page + "overview.eyebrow": "工作区总览", + "overview.title": "你的知识,彼此相连。", + "overview.description": + "探索你的 agents 学到了什么、决定了什么、记住了什么。", + "overview.explore": "探索记忆", + "overview.bannerTitle": "记忆汇成共享知识。", + "overview.bannerText": "阅读原文,顺着连接走,把上下文留住。", + "overview.statMemories": "记忆", + "overview.statMemoriesHint": "持久知识条目", + "overview.statConnections": "连接", + "overview.statConnectionsHint": "记忆之间的关系", + "overview.statCategories": "分类", + "overview.statCategoriesHint": "认识世界的不同方式", + "overview.byCategory": "按分类", + "overview.recentSection": "最近记住", + "overview.recentEmptyTitle": "崭新的开始", + "overview.recentEmptyText": "你的 agents 添加的记忆会出现在这里。", + "overview.entitiesSection": "相关实体", + "overview.noEntities": "尚未记录实体。", + "overview.followConnections": "顺着连接探索。", + "overview.seeGraph": "查看知识图谱", + "overview.activitySection": "最近活动", + "overview.noActivity": "尚未记录活动。", + "overview.footerNote": "只读 · 记忆始终属于你", + + // Library page + "library.eyebrow": "收藏", + "library.title": "记忆库", + "library.description": "在记忆库中搜索决策、发现与上下文。", + "library.unitOne": "条记忆", + "library.unitMany": "条记忆", + "library.matchingView": "匹配当前视图", + "library.inThisSpace": "在此空间", + "library.bounded": "此搜索基于有限的候选集。收窄筛选条件可以更精确地探索。", + "library.noMatchTitle": "没有匹配的记忆", + "library.readyTitle": "记忆库已就绪", + "library.noMatchText": "换个搜索词或清除筛选条件,扩大范围试试。", + "library.readyText": "当你的 agents 记住新内容时,会在这里出现。", + "library.loadMore": "加载更多记忆", + "library.showing": "已显示 {shown} / {total} · 实时结果可能变化", + + // Reader page + "reader.backToLibrary": "返回记忆库", + "reader.kicker": "记忆", + "reader.replacedTitle": "此记忆已被取代。", + "reader.replacedText": "请阅读较新的记忆获取当前信息。", + "reader.copyContent": "复制内容", + "reader.copyId": "复制 ID", + "reader.relatedSection": "相关记忆", + "reader.noRelated": "尚未记录相关记忆。", + "reader.relatedBounded": "相关记忆列表有数量上限。可探索图谱获取更多上下文。", + "reader.detailsHeading": "记忆详情", + "reader.category": "分类", + "reader.source": "来源", + "reader.importance": "重要性", + "reader.importanceOf": "{value} / 5", + "reader.created": "创建时间", + "reader.updated": "更新时间", + "reader.accessCount": "访问次数", + "reader.memoryId": "记忆 ID", + "reader.entities": "实体", + "reader.tags": "标签", + "reader.replaces": "取代", + "reader.replacesHint": "此记忆修正或取代:", + "reader.replacedBy": "被取代于", + "reader.exploreNeighborhood": "探索邻域", + "reader.storedRelationships": "已存储的关系", + "reader.weight": "权重:{value}", + + // Entities page + "entities.eyebrow": "连接", + "entities.title": "实体", + "entities.description": "把记忆串联起来的人物、项目与概念。", + "entities.searchAria": "搜索实体", + "entities.searchPlaceholder": "查找人物、项目或概念…", + "entities.unit": "个实体", + "entities.memoryCountOne": "{count} 条记忆", + "entities.memoryCountMany": "{count} 条记忆", + "entities.viewMemories": "查看记忆", + "entities.exploreInGraph": "在图谱中探索 {name}", + "entities.noMatchTitle": "没有匹配的实体", + "entities.emptyTitle": "连接从这里开始", + "entities.noMatchText": "换个名字或概念试试。", + "entities.emptyText": "附着在记忆上的实体会出现在这里。", + "entities.loadMore": "加载更多实体", + + // Activity page + "activity.eyebrow": "不断增长的知识体", + "activity.title": "活动", + "activity.description": "此空间中按时间顺序记录的操作。", + "activity.operationLog": "操作日志", + "activity.quietTitle": "风平浪静", + "activity.quietText": "此空间尚未记录任何操作。", + "activity.loadMore": "加载更早的活动", + + // Graph page + "graph.eyebrow": "关系", + "graph.title": "知识图谱", + "graph.description": "顺着记忆之间已存储的关系探索。", + "graph.canvasAria": + "交互式记忆图谱。拖动节点重新布局,滚动缩放,拖动背景平移。下方的记忆列表支持键盘访问。", + "graph.focused": "聚焦邻域", + "graph.full": "知识图谱", + "graph.dragHint": "拖动探索 · 滚动缩放", + "graph.zoomIn": "放大", + "graph.zoomOut": "缩小", + "graph.fit": "适应画布", + "graph.resetLayout": "重置布局", + "graph.relationship": "关系", + "graph.relationshipAria": "关系类型", + "graph.allRelationships": "全部关系", + "graph.clearFocus": "清除邻域聚焦", + "graph.resultLine": "已显示 {shown} / {total} 条记忆 · {edges} 条已存储连接", + "graph.bounded": + "当前显示的是有限邻域(最多 200 条记忆)。使用筛选或展开选中的记忆可以继续探索。", + "graph.browseMemories": "浏览图谱中的记忆", + "graph.storedRelationships": "已存储的关系", + "graph.weight": "权重 {value}", + "graph.noConnections": "此视图中没有连接", + "graph.noConnectionsText": "试试放宽筛选条件,或探索一条有存储关系的记忆。", + "graph.selectedMemory": "选中的记忆", + "graph.closeSelected": "关闭选中的记忆", + "graph.readFullMemory": "阅读完整记忆", + "graph.expandNeighborhood": "展开邻域", + + // Missing page and empty store + "missing.title": "页面不在这里", + "missing.return": "返回", + "missing.returnLink": "工作区总览", + "missing.homeTitle": "记忆的家", + "missing.homeText": + "未找到记忆库。先用 Mnemon 创建一个记忆库,然后刷新本工作区。", + "missing.refreshStores": "刷新记忆库列表", + + // About dialog + "about.close": "关闭工作区信息", + "about.title": "你的记忆工作区", + "about.paragraph1": + "Mnemon 是一个本地只读窗口,展示你的 agents 已存储的记忆。浏览不会修改你的记忆,也不会影响它们的访问计数。", + "about.paragraph2": + "页面在此标签页可见时每 15 秒自动刷新,你也可以随时手动刷新。来源字段反映存储的元数据。", + "about.paragraph3": + "所有应用资源均打包在本地。Markdown 图片保持隐藏以确保浏览私密。", + "about.version": "版本 {version}", + + // Document title + "doc.title": "{page} · Mnemon", + "doc.workspaceTitle": "Mnemon · 知识工作区", +}; diff --git a/web/src/main.tsx b/web/src/main.tsx index 065aad53..50120505 100644 --- a/web/src/main.tsx +++ b/web/src/main.tsx @@ -1,16 +1,19 @@ import { StrictMode } from "react"; import { createRoot } from "react-dom/client"; import { App } from "./App"; +import { I18nProvider } from "./i18n"; import { Router } from "./router"; import { ThemeProvider } from "./theme"; import "./styles.css"; createRoot(document.getElementById("root")!).render( - - - - - + + + + + + + , );