ocean-brain 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/index.js +5 -0
  2. package/package.json +4 -1
  3. package/server/client/dist/assets/{Calendar-CSXEuWmQ.js → Calendar-DI0PhQTq.js} +1 -1
  4. package/server/client/dist/assets/{Callout-Ap1OcxWN.js → Callout-BAqbXI0L.js} +1 -1
  5. package/server/client/dist/assets/{Graph-C0Ax9qjI.js → Graph-Dhuog4tc.js} +1 -1
  6. package/server/client/dist/assets/{Image-CSbcG-5a.js → Image-DlJ4MDo3.js} +1 -1
  7. package/server/client/dist/assets/{Image.es-Fbe7aDDo.js → Image.es-COwqkQuh.js} +1 -1
  8. package/server/client/dist/assets/Note-ChUWU3Su.js +21 -0
  9. package/server/client/dist/assets/Plus.es-KeV96R_e.js +1 -0
  10. package/server/client/dist/assets/Reminders-D7MCTNxb.js +1 -0
  11. package/server/client/dist/assets/Search-B-fwTr5y.js +1 -0
  12. package/server/client/dist/assets/{SurfaceCard-Br6TjX5W.js → SurfaceCard-CHjcCuqZ.js} +1 -1
  13. package/server/client/dist/assets/Tag-BbV2z-Db.js +1 -0
  14. package/server/client/dist/assets/TagNotes-2HKF09Jm.js +1 -0
  15. package/server/client/dist/assets/{Trash.es-BfCEiL3-.js → Trash.es-BqRTZPrI.js} +1 -1
  16. package/server/client/dist/assets/ViewNotes-TfM3Uzbp.js +1 -0
  17. package/server/client/dist/assets/Views-CUwtnfa8.js +1 -0
  18. package/server/client/dist/assets/{image.api-DGXlQ_Ca.js → image.api-CMdQbCyN.js} +1 -1
  19. package/server/client/dist/assets/index-B4l2UvuC.js +232 -0
  20. package/server/client/dist/assets/{index-Bm9l_L20.css → index-D2gRB1ig.css} +1 -1
  21. package/server/client/dist/assets/{index-B28TO4FC.js → index-zhxZjg7V.js} +1 -1
  22. package/server/client/dist/assets/manage-image-DdXb5Bkj.js +1 -0
  23. package/server/client/dist/assets/{manage-image-detail-hk6jWyiB.js → manage-image-detail-CrrXCQIX.js} +1 -1
  24. package/server/client/dist/assets/{mcp-CSjmBjFR.js → mcp-DqGLZv90.js} +1 -1
  25. package/server/client/dist/assets/{note-vendor-5N5mRkIT.js → note-vendor-B0t5F04o.js} +3 -3
  26. package/server/client/dist/assets/{placeholder-Bmiowo28.js → placeholder-BXLtvdtN.js} +4 -4
  27. package/server/client/dist/assets/trash-3eUAjFRh.js +1 -0
  28. package/server/client/dist/assets/{useReminderMutate-DsIvVpCQ.js → useReminderMutate-v1EXqM90.js} +2 -2
  29. package/server/client/dist/assets/{view-dashboard-CP8nhfxQ.js → view-dashboard-T6gmohr-.js} +1 -1
  30. package/server/client/dist/index.html +3 -3
  31. package/server/dist/app.js +2 -2
  32. package/server/dist/app.js.map +1 -1
  33. package/server/dist/features/auth/http/api.js +2 -5
  34. package/server/dist/features/auth/http/api.js.map +1 -1
  35. package/server/dist/features/auth/http/login-page.js +11 -4
  36. package/server/dist/features/auth/http/login-page.js.map +1 -1
  37. package/server/dist/features/auth/http/pages.js +4 -3
  38. package/server/dist/features/auth/http/pages.js.map +1 -1
  39. package/server/dist/features/auth/service.js +11 -42
  40. package/server/dist/features/auth/service.js.map +1 -1
  41. package/server/dist/features/note/graphql/note.query.resolver.js +4 -1
  42. package/server/dist/features/note/graphql/note.query.resolver.js.map +1 -1
  43. package/server/dist/features/note/graphql/note.type-defs.js +3 -0
  44. package/server/dist/features/note/graphql/note.type-defs.js.map +1 -1
  45. package/server/dist/features/note/services/trash.js +37 -12
  46. package/server/dist/features/note/services/trash.js.map +1 -1
  47. package/server/dist/modules/auth-guard.js +31 -19
  48. package/server/dist/modules/auth-guard.js.map +1 -1
  49. package/server/dist/modules/auth-mode.js +16 -39
  50. package/server/dist/modules/auth-mode.js.map +1 -1
  51. package/server/dist/modules/error-handler.js +7 -0
  52. package/server/dist/modules/error-handler.js.map +1 -1
  53. package/server/dist/modules/rate-limit.js +18 -0
  54. package/server/dist/modules/rate-limit.js.map +1 -0
  55. package/server/dist/routes/api.js +2 -1
  56. package/server/dist/routes/api.js.map +1 -1
  57. package/server/dist/routes/auth-pages.js +2 -1
  58. package/server/dist/routes/auth-pages.js.map +1 -1
  59. package/server/dist/routes/client.js +2 -2
  60. package/server/dist/routes/client.js.map +1 -1
  61. package/server/client/dist/assets/ModalActionRow-DjI5b4bl.js +0 -1
  62. package/server/client/dist/assets/Note-BY6WgYLq.js +0 -1
  63. package/server/client/dist/assets/Reminders-vRksvSQE.js +0 -1
  64. package/server/client/dist/assets/Search-Cq4tuiJO.js +0 -1
  65. package/server/client/dist/assets/Tag-ARDLA-Pb.js +0 -1
  66. package/server/client/dist/assets/TagNotes-CDGVrCJU.js +0 -1
  67. package/server/client/dist/assets/ViewNotes-ZBOQ1adH.js +0 -1
  68. package/server/client/dist/assets/Views-DQHPfdwM.js +0 -1
  69. package/server/client/dist/assets/index-Bsx4P7EA.js +0 -210
  70. package/server/client/dist/assets/manage-image-Dg297A_h.js +0 -1
  71. package/server/client/dist/assets/trash-CM7SbVtW.js +0 -1
package/dist/index.js CHANGED
@@ -28,6 +28,11 @@ var ensurePasswordModeRequirements = (env) => {
28
28
  };
29
29
  var resolveServeAuthEnvironment = (options, env) => {
30
30
  const allowInsecureNoAuth = options.allowInsecureNoAuth || isTruthy(env.OCEAN_BRAIN_ALLOW_INSECURE_NO_AUTH);
31
+ if (allowInsecureNoAuth && env.OCEAN_BRAIN_PASSWORD) {
32
+ throw new Error(
33
+ "Conflicting auth config. OCEAN_BRAIN_ALLOW_INSECURE_NO_AUTH enables open mode while OCEAN_BRAIN_PASSWORD is also set."
34
+ );
35
+ }
31
36
  if (!allowInsecureNoAuth && env.OCEAN_BRAIN_PASSWORD) {
32
37
  ensurePasswordModeRequirements(env);
33
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ocean-brain",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,6 +30,7 @@
30
30
  "type-check": "tsc --noEmit"
31
31
  },
32
32
  "dependencies": {
33
+ "@baejino/auth": "0.1.1",
33
34
  "@blocknote/server-util": "^0.46.2",
34
35
  "@graphql-tools/schema": "^10.0.31",
35
36
  "@graphql-tools/utils": "^11.0.0",
@@ -37,9 +38,11 @@
37
38
  "@prisma/client": "^6.19.3",
38
39
  "commander": "^14.0.3",
39
40
  "express": "^5.2.1",
41
+ "express-rate-limit": "8.5.1",
40
42
  "express-session": "^1.19.0",
41
43
  "express-winston": "^4.2.0",
42
44
  "graphql-http": "^1.22.4",
45
+ "lusca": "^1.7.0",
43
46
  "prisma": "^6.19.3",
44
47
  "sqlite3": "^6.0.1",
45
48
  "winston": "^3.19.0",
@@ -1,4 +1,4 @@
1
- import{j as e}from"./note-vendor-5N5mRkIT.js";import{T as b,L as te,N as se,c as q,d as f,s as re,a as ae,M as S,b as ne,S as oe,e as F,B as O,f as ie,g as ce,u as H,q as z,h as K,P as le,i as de,j as ue,C as me}from"./index-Bsx4P7EA.js";import{a as d}from"./graph-vendor-CUxe67Lr.js";import{C as he}from"./Callout-Ap1OcxWN.js";import"./note-core-GgFcksAF.js";const ge=({day:r,cellClassName:t,dayNumberClassName:s,isCurrentMonth:i,items:o,overflowCount:c,onOpenOverflow:m})=>e.jsxs("div",{className:`min-h-[196px] rounded-[16px] border p-2.5 ${t}`.trim(),children:[e.jsx("div",{className:"mb-2.5 flex justify-end",children:e.jsx(b,{as:"span",variant:"label",className:`flex h-7 w-7 items-center justify-center rounded-[10px] ${s}`.trim(),children:r})}),i&&o.length>0?e.jsxs("div",{className:"flex flex-col gap-1.5",children:[o,c>0?e.jsxs("button",{type:"button",onClick:m,className:"focus-ring-soft w-full rounded-[10px] border border-dashed border-border-subtle/70 bg-subtle/70 py-1 text-center text-micro font-semibold text-fg-tertiary outline-none transition-colors hover:border-border-secondary/70 hover:bg-hover-subtle hover:text-fg-secondary",children:["+",c," more"]}):null]}):null]}),V=({params:r,toneClassName:t="",header:s,title:i,meta:o,titleClassName:c=""})=>e.jsx(te,{to:se,params:r,className:"focus-ring-soft group block rounded-[8px] outline-none",children:e.jsxs("div",{className:q("flex items-start gap-1.5 rounded-[8px] px-1.5 py-1 transition-colors group-hover:bg-hover-subtle",t),children:[s?e.jsx("span",{className:"mt-[2px] flex h-4 w-4 shrink-0 items-center justify-center text-fg-tertiary",children:s}):e.jsx("span",{"aria-hidden":"true",className:"mt-[6px] h-1.5 w-1.5 shrink-0 rounded-full bg-fg-placeholder"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(b,{as:"div",variant:"label",weight:"medium",tone:"secondary",className:q("line-clamp-1",c),children:i}),o?e.jsx(b,{as:"div",variant:"micro",weight:"medium",tone:"tertiary",className:"mt-0.5",children:o}):null]})]})}),xe=({note:r,type:t})=>e.jsx(V,{params:{id:r.id},header:e.jsx(re,{size:12}),title:r.title,meta:f(Number(t==="create"?r.createdAt:r.updatedAt)).format("HH:mm")}),pe=({reminder:r})=>e.jsx(V,{params:{id:String(r.note?.id??r.noteId)},header:e.jsx(ae,{size:12}),title:r.content||r.note?.title||"No title",titleClassName:r.completed?"line-through":"",meta:f(Number(r.reminderDate)).format("HH:mm")}),L=3,Q=(r,t)=>r.map(s=>s.type==="note"?e.jsx(xe,{note:s.item,type:t},`note-${s.item.id}`):e.jsx(pe,{reminder:s.item},`reminder-${s.item.id}`)),ye=({year:r,month:t,day:s,isCurrentMonth:i,isSunday:o,isToday:c,isPast:m,notes:h,reminders:g,type:N})=>{const[M,v]=d.useState(!1),p=d.useMemo(()=>{const a=h.map(u=>({type:"note",item:u})),l=g.map(u=>({type:"reminder",item:u}));return m?[...a,...l]:[...l,...a]},[m,h,g]),D=p.length>L,w=d.useMemo(()=>Q(p.slice(0,L),N),[p,N]),$=d.useMemo(()=>Q(p,N),[p,N]),k=d.useCallback(()=>v(!0),[]),C=d.useCallback(()=>v(!1),[]),E=()=>i?c?"border-border-secondary/70 bg-[color:color-mix(in_srgb,var(--surface)_88%,var(--accent-soft-primary)_12%)]":"bg-surface border-border-subtle":"bg-muted/18 border-border-subtle/70",I=()=>c?"bg-cta text-fg-on-filled font-semibold":i?o?"text-fg-weekend font-bold":"text-fg-secondary font-bold":"text-fg-disabled opacity-55";return e.jsxs(e.Fragment,{children:[e.jsx(ge,{day:s,cellClassName:E(),dayNumberClassName:I(),isCurrentMonth:i,items:w,overflowCount:D?p.length-L:0,onOpenOverflow:k}),D&&e.jsxs(S,{isOpen:M,onClose:C,variant:"inspect",children:[e.jsx(S.Header,{title:`${r}/${String(t).padStart(2,"0")}/${String(s).padStart(2,"0")}`,onClose:C}),e.jsxs(S.Body,{children:[e.jsxs(S.Description,{className:"sr-only",children:["View all notes and reminders scheduled for day ",s,"."]}),e.jsx("div",{className:"flex max-h-[60vh] flex-col gap-2 overflow-y-auto",children:$})]})]})]})},fe=d.memo(ye),be=["January","February","March","April","May","June","July","August","September","October","November","December"],je=({month:r,year:t,type:s,onPrevMonth:i,onNextMonth:o,onToday:c,onTypeChange:m})=>e.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex flex-wrap items-end gap-x-2.5 gap-y-1",children:[e.jsx(b,{as:"h1",variant:"display",weight:"bold",tracking:"tighter",className:"text-2xl leading-none sm:text-[2.15rem]",children:be[r-1]}),e.jsx(b,{as:"span",variant:"subheading",weight:"medium",tone:"secondary",tracking:"tight",className:"pb-0.5",children:t})]}),e.jsx(b,{as:"p",variant:"meta",weight:"medium",tone:"secondary",children:"Track note activity and reminders across the month"})]}),e.jsx("div",{className:"flex lg:justify-end",children:e.jsxs("div",{className:"surface-base inline-flex flex-wrap items-center gap-3 rounded-[16px] px-3.5 py-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{className:"h-4 w-4 shrink-0 text-fg-tertiary"}),e.jsx(b,{as:"span",variant:"label",weight:"medium",tone:"tertiary",children:"Note date"}),e.jsxs(oe,{value:s,onValueChange:g=>m(g),variant:"ghost",size:"sm",children:[e.jsx(F,{value:"create",children:"Created"}),e.jsx(F,{value:"update",children:"Updated"})]})]}),e.jsx("div",{className:"h-5 w-px bg-divider"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(O,{variant:"ghost",size:"sm",onClick:c,children:"Today"}),e.jsx(O,{variant:"ghost",size:"icon-sm",onClick:i,children:e.jsx(ie,{width:18,height:18})}),e.jsx(O,{variant:"ghost",size:"icon-sm",onClick:o,children:e.jsx(ce,{width:18,height:18})})]})]})})]}),Ne=`
1
+ import{j as e}from"./note-vendor-B0t5F04o.js";import{T as b,L as te,N as se,c as q,d as f,s as re,a as ae,M as S,b as ne,S as oe,e as F,B as O,f as ie,g as ce,u as H,q as z,h as K,P as le,i as de,j as ue,C as me}from"./index-B4l2UvuC.js";import{a as d}from"./graph-vendor-CUxe67Lr.js";import{C as he}from"./Callout-BAqbXI0L.js";import"./note-core-GgFcksAF.js";const ge=({day:r,cellClassName:t,dayNumberClassName:s,isCurrentMonth:i,items:o,overflowCount:c,onOpenOverflow:m})=>e.jsxs("div",{className:`min-h-[196px] rounded-[16px] border p-2.5 ${t}`.trim(),children:[e.jsx("div",{className:"mb-2.5 flex justify-end",children:e.jsx(b,{as:"span",variant:"label",className:`flex h-7 w-7 items-center justify-center rounded-[10px] ${s}`.trim(),children:r})}),i&&o.length>0?e.jsxs("div",{className:"flex flex-col gap-1.5",children:[o,c>0?e.jsxs("button",{type:"button",onClick:m,className:"focus-ring-soft w-full rounded-[10px] border border-dashed border-border-subtle/70 bg-subtle/70 py-1 text-center text-micro font-semibold text-fg-tertiary outline-none transition-colors hover:border-border-secondary/70 hover:bg-hover-subtle hover:text-fg-secondary",children:["+",c," more"]}):null]}):null]}),V=({params:r,toneClassName:t="",header:s,title:i,meta:o,titleClassName:c=""})=>e.jsx(te,{to:se,params:r,className:"focus-ring-soft group block rounded-[8px] outline-none",children:e.jsxs("div",{className:q("flex items-start gap-1.5 rounded-[8px] px-1.5 py-1 transition-colors group-hover:bg-hover-subtle",t),children:[s?e.jsx("span",{className:"mt-[2px] flex h-4 w-4 shrink-0 items-center justify-center text-fg-tertiary",children:s}):e.jsx("span",{"aria-hidden":"true",className:"mt-[6px] h-1.5 w-1.5 shrink-0 rounded-full bg-fg-placeholder"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(b,{as:"div",variant:"label",weight:"medium",tone:"secondary",className:q("line-clamp-1",c),children:i}),o?e.jsx(b,{as:"div",variant:"micro",weight:"medium",tone:"tertiary",className:"mt-0.5",children:o}):null]})]})}),xe=({note:r,type:t})=>e.jsx(V,{params:{id:r.id},header:e.jsx(re,{size:12}),title:r.title,meta:f(Number(t==="create"?r.createdAt:r.updatedAt)).format("HH:mm")}),pe=({reminder:r})=>e.jsx(V,{params:{id:String(r.note?.id??r.noteId)},header:e.jsx(ae,{size:12}),title:r.content||r.note?.title||"No title",titleClassName:r.completed?"line-through":"",meta:f(Number(r.reminderDate)).format("HH:mm")}),L=3,Q=(r,t)=>r.map(s=>s.type==="note"?e.jsx(xe,{note:s.item,type:t},`note-${s.item.id}`):e.jsx(pe,{reminder:s.item},`reminder-${s.item.id}`)),ye=({year:r,month:t,day:s,isCurrentMonth:i,isSunday:o,isToday:c,isPast:m,notes:h,reminders:g,type:N})=>{const[M,v]=d.useState(!1),p=d.useMemo(()=>{const a=h.map(u=>({type:"note",item:u})),l=g.map(u=>({type:"reminder",item:u}));return m?[...a,...l]:[...l,...a]},[m,h,g]),D=p.length>L,w=d.useMemo(()=>Q(p.slice(0,L),N),[p,N]),$=d.useMemo(()=>Q(p,N),[p,N]),k=d.useCallback(()=>v(!0),[]),C=d.useCallback(()=>v(!1),[]),E=()=>i?c?"border-border-secondary/70 bg-[color:color-mix(in_srgb,var(--surface)_88%,var(--accent-soft-primary)_12%)]":"bg-surface border-border-subtle":"bg-muted/18 border-border-subtle/70",I=()=>c?"bg-cta text-fg-on-filled font-semibold":i?o?"text-fg-weekend font-bold":"text-fg-secondary font-bold":"text-fg-disabled opacity-55";return e.jsxs(e.Fragment,{children:[e.jsx(ge,{day:s,cellClassName:E(),dayNumberClassName:I(),isCurrentMonth:i,items:w,overflowCount:D?p.length-L:0,onOpenOverflow:k}),D&&e.jsxs(S,{isOpen:M,onClose:C,variant:"inspect",children:[e.jsx(S.Header,{title:`${r}/${String(t).padStart(2,"0")}/${String(s).padStart(2,"0")}`,onClose:C}),e.jsxs(S.Body,{children:[e.jsxs(S.Description,{className:"sr-only",children:["View all notes and reminders scheduled for day ",s,"."]}),e.jsx("div",{className:"flex max-h-[60vh] flex-col gap-2 overflow-y-auto",children:$})]})]})]})},fe=d.memo(ye),be=["January","February","March","April","May","June","July","August","September","October","November","December"],je=({month:r,year:t,type:s,onPrevMonth:i,onNextMonth:o,onToday:c,onTypeChange:m})=>e.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex flex-wrap items-end gap-x-2.5 gap-y-1",children:[e.jsx(b,{as:"h1",variant:"display",weight:"bold",tracking:"tighter",className:"text-2xl leading-none sm:text-[2.15rem]",children:be[r-1]}),e.jsx(b,{as:"span",variant:"subheading",weight:"medium",tone:"secondary",tracking:"tight",className:"pb-0.5",children:t})]}),e.jsx(b,{as:"p",variant:"meta",weight:"medium",tone:"secondary",children:"Track note activity and reminders across the month"})]}),e.jsx("div",{className:"flex lg:justify-end",children:e.jsxs("div",{className:"surface-base inline-flex flex-wrap items-center gap-3 rounded-[16px] px-3.5 py-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{className:"h-4 w-4 shrink-0 text-fg-tertiary"}),e.jsx(b,{as:"span",variant:"label",weight:"medium",tone:"tertiary",children:"Note date"}),e.jsxs(oe,{value:s,onValueChange:g=>m(g),variant:"ghost",size:"sm",children:[e.jsx(F,{value:"create",children:"Created"}),e.jsx(F,{value:"update",children:"Updated"})]})]}),e.jsx("div",{className:"h-5 w-px bg-divider"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(O,{variant:"ghost",size:"sm",onClick:c,children:"Today"}),e.jsx(O,{variant:"ghost",size:"icon-sm",onClick:i,children:e.jsx(ie,{width:18,height:18})}),e.jsx(O,{variant:"ghost",size:"icon-sm",onClick:o,children:e.jsx(ce,{width:18,height:18})})]})]})})]}),Ne=`
2
2
  query NotesInDateRange($dateRange: DateRangeInput) {
3
3
  notesInDateRange(dateRange: $dateRange) {
4
4
  id
@@ -1 +1 @@
1
- import{j as r}from"./note-vendor-5N5mRkIT.js";import{p as n,T as l}from"./index-Bsx4P7EA.js";import{a as e}from"./graph-vendor-CUxe67Lr.js";const o=new Map([["bold",e.createElement(e.Fragment,null,e.createElement("path",{d:"M108,84a16,16,0,1,1,16,16A16,16,0,0,1,108,84Zm128,44A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Zm-72,36.68V132a20,20,0,0,0-20-20,12,12,0,0,0-4,23.32V168a20,20,0,0,0,20,20,12,12,0,0,0,4-23.32Z"}))],["duotone",e.createElement(e.Fragment,null,e.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),e.createElement("path",{d:"M144,176a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176Zm88-48A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128ZM124,96a12,12,0,1,0-12-12A12,12,0,0,0,124,96Z"}))],["fill",e.createElement(e.Fragment,null,e.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-4,48a12,12,0,1,1-12,12A12,12,0,0,1,124,72Zm12,112a16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40a8,8,0,0,1,0,16Z"}))],["light",e.createElement(e.Fragment,null,e.createElement("path",{d:"M142,176a6,6,0,0,1-6,6,14,14,0,0,1-14-14V128a2,2,0,0,0-2-2,6,6,0,0,1,0-12,14,14,0,0,1,14,14v40a2,2,0,0,0,2,2A6,6,0,0,1,142,176ZM124,94a10,10,0,1,0-10-10A10,10,0,0,0,124,94Zm106,34A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z"}))],["regular",e.createElement(e.Fragment,null,e.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"}))],["thin",e.createElement(e.Fragment,null,e.createElement("path",{d:"M140,176a4,4,0,0,1-4,4,12,12,0,0,1-12-12V128a4,4,0,0,0-4-4,4,4,0,0,1,0-8,12,12,0,0,1,12,12v40a4,4,0,0,0,4,4A4,4,0,0,1,140,176ZM124,92a8,8,0,1,0-8-8A8,8,0,0,0,124,92Zm104,36A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z"}))]]),m=e.forwardRef((a,t)=>e.createElement(n,{ref:t,...a,weights:o}));m.displayName="InfoIcon";const c=m,d=({children:a,className:t=""})=>r.jsxs("div",{className:`flex items-center gap-2.5 rounded-[12px] border border-border-subtle bg-hover-subtle/50 px-4 py-3 ${t}`,children:[r.jsx(c,{className:"h-4 w-4 shrink-0 text-fg-tertiary"}),r.jsx(l,{as:"div",variant:"meta",weight:"medium",tone:"secondary",children:a})]});export{d as C};
1
+ import{j as r}from"./note-vendor-B0t5F04o.js";import{p as n,T as l}from"./index-B4l2UvuC.js";import{a as e}from"./graph-vendor-CUxe67Lr.js";const o=new Map([["bold",e.createElement(e.Fragment,null,e.createElement("path",{d:"M108,84a16,16,0,1,1,16,16A16,16,0,0,1,108,84Zm128,44A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Zm-72,36.68V132a20,20,0,0,0-20-20,12,12,0,0,0-4,23.32V168a20,20,0,0,0,20,20,12,12,0,0,0,4-23.32Z"}))],["duotone",e.createElement(e.Fragment,null,e.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),e.createElement("path",{d:"M144,176a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176Zm88-48A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128ZM124,96a12,12,0,1,0-12-12A12,12,0,0,0,124,96Z"}))],["fill",e.createElement(e.Fragment,null,e.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-4,48a12,12,0,1,1-12,12A12,12,0,0,1,124,72Zm12,112a16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40a8,8,0,0,1,0,16Z"}))],["light",e.createElement(e.Fragment,null,e.createElement("path",{d:"M142,176a6,6,0,0,1-6,6,14,14,0,0,1-14-14V128a2,2,0,0,0-2-2,6,6,0,0,1,0-12,14,14,0,0,1,14,14v40a2,2,0,0,0,2,2A6,6,0,0,1,142,176ZM124,94a10,10,0,1,0-10-10A10,10,0,0,0,124,94Zm106,34A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z"}))],["regular",e.createElement(e.Fragment,null,e.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"}))],["thin",e.createElement(e.Fragment,null,e.createElement("path",{d:"M140,176a4,4,0,0,1-4,4,12,12,0,0,1-12-12V128a4,4,0,0,0-4-4,4,4,0,0,1,0-8,12,12,0,0,1,12,12v40a4,4,0,0,0,4,4A4,4,0,0,1,140,176ZM124,92a8,8,0,1,0-8-8A8,8,0,0,0,124,92Zm104,36A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z"}))]]),m=e.forwardRef((a,t)=>e.createElement(n,{ref:t,...a,weights:o}));m.displayName="InfoIcon";const c=m,d=({children:a,className:t=""})=>r.jsxs("div",{className:`flex items-center gap-2.5 rounded-[12px] border border-border-subtle bg-hover-subtle/50 px-4 py-3 ${t}`,children:[r.jsx(c,{className:"h-4 w-4 shrink-0 text-fg-tertiary"}),r.jsx(l,{as:"div",variant:"meta",weight:"medium",tone:"secondary",children:a})]});export{d as C};
@@ -1 +1 @@
1
- import{j as t}from"./note-vendor-5N5mRkIT.js";import{_ as Q,P as C,a1 as U,i as G,a2 as Y,a3 as J,a4 as X,a5 as ee,q as ne,N as te,F as re,T as N,a6 as oe}from"./index-Bsx4P7EA.js";import{a as i,F as se}from"./graph-vendor-CUxe67Lr.js";import"./note-core-GgFcksAF.js";const ae=s=>{let a=0;for(let r=0;r<s.length;r++)a+=s.charCodeAt(r);return a},ie={background:"#f4f6f8",nodeHub:"#2c2f36",nodeSelected:"#111318",nodeConnected:"#636b76",nodeDefault:["#d6dbe1","#c8ced6","#b7bec7","#a7afb9"],nodeDimmed:["rgba(214,219,225,0.28)","rgba(200,206,214,0.24)","rgba(183,190,199,0.24)","rgba(167,175,185,0.2)"],nodeHubDimmed:"rgba(44,47,54,0.16)",nodeStroke:"#eef1f4",nodeSelectedStroke:"#a6b0bc",labelBackground:"rgba(246,248,250,0.92)",labelText:"#222831",labelFontFamily:"Pretendard Variable, Pretendard, system-ui, sans-serif",linkIdle:"rgba(99, 107, 117, 0.34)",linkConnected:"#68717c",linkDimmed:"rgba(127, 136, 146, 0.12)",legendHub:"#2c2f36"},le={background:"#121316",nodeHub:"#d6dce3",nodeSelected:"#eef1f5",nodeConnected:"#9099a4",nodeDefault:["#343a43","#2d333c","#262c35","#20262f"],nodeDimmed:["rgba(52,58,67,0.28)","rgba(45,51,60,0.24)","rgba(38,44,53,0.22)","rgba(32,38,47,0.2)"],nodeHubDimmed:"rgba(214,220,227,0.16)",nodeStroke:"#171c23",nodeSelectedStroke:"#7f8a97",labelBackground:"rgba(16,18,22,0.9)",labelText:"#eef2f6",labelFontFamily:"Pretendard Variable, Pretendard, system-ui, sans-serif",linkIdle:"rgba(118, 127, 138, 0.42)",linkConnected:"#a2abb6",linkDimmed:"rgba(118, 127, 138, 0.1)",legendHub:"#d6dce3"};function D(s){return s==="dark"?le:ie}function de(s,a){const r=D(s),{connections:g,colorIndex:y,selectedNodeId:d,nodeId:b,isConnected:c}=a,h=d===b;return d!==null&&!h&&!c?g>3?r.nodeHubDimmed:r.nodeDimmed[y%r.nodeDimmed.length]:h?r.nodeSelected:c?r.nodeConnected:g>3?r.nodeHub:r.nodeDefault[y%r.nodeDefault.length]}function ce(s,a){const r=D(s);return a.selectedNodeId!==null&&!a.isConnected?r.linkDimmed:a.isConnected?r.linkConnected:r.linkIdle}function ue(s,a){const r=D(s);return`${a.emphasize?"700":"400"} ${a.fontSize}px ${r.labelFontFamily}`}function z(s){return s<=1?3.5:s<=3?4.5:s<=6?5.5:Math.min(7,5.5+Math.sqrt(s)*.5)}const fe=t.jsx(C,{title:"Knowledge Graph",description:t.jsx(G,{width:184,height:16,className:"rounded-full"}),children:t.jsx("div",{className:"flex h-[600px] items-center justify-center",children:t.jsx(G,{width:"100%",height:"100%"})})});function he(){const s=Y(),a=i.useRef(null),r=i.useRef(null),[g,y]=i.useState({width:800,height:600}),[d,b]=i.useState(null),{theme:c}=J(e=>e),h=D(c),v=i.useRef(h);v.current=h;const{data:w}=X({queryKey:ne.notes.graph(),queryFn:async()=>{const e=await ee();if(e.type==="error")throw e;return e.noteGraph}}),l=i.useMemo(()=>{if(w.nodes.length===0)return null;const e=w.nodes.filter(o=>o.connections>0);if(e.length===0)return null;const n=new Set(e.map(o=>o.id));return{nodes:e,links:w.links.filter(o=>n.has(o.source)&&n.has(o.target))}},[w]);i.useEffect(()=>{if(!l)return;const e=()=>{if(!a.current)return;const n=a.current.getBoundingClientRect();y({width:n.width,height:Math.max(600,window.innerHeight-150)})};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[l]),i.useEffect(()=>{if(!l||!r.current)return;const e=window.setTimeout(()=>{r.current?.zoomToFit(400,50)},500);return()=>window.clearTimeout(e)},[l]);const R=i.useRef(d);R.current=d;const B=i.useCallback(e=>{if(R.current===e.id){s({to:te,params:{id:e.id}});return}b(e.id)},[s]),L=i.useCallback(()=>{b(null)},[]),K=i.useCallback(e=>{a.current&&(a.current.style.cursor=e?"pointer":"default")},[]),I=i.useRef(!1),q=i.useCallback(()=>{I.current||(I.current=!0,r.current?.enableZoomInteraction(!1))},[]),A=i.useCallback(()=>{I.current=!1,r.current?.enableZoomInteraction(!0)},[]),H=i.useRef(new Map),O=i.useMemo(()=>{const e=new Map;if(l)for(const n of l.links)e.has(n.source)||e.set(n.source,new Set),e.has(n.target)||e.set(n.target,new Set),e.get(n.source)?.add(n.target),e.get(n.target)?.add(n.source);return e},[l]);H.current=O;const Z=i.useCallback((e,n,o)=>{const u=v.current,f=d,p=H.current,m=z(e.connections),x=e.x||0,S=e.y||0,k=f===e.id,T=f?p.get(f)?.has(e.id)??!1:!1,V=f!==null&&!k&&!T,W=ae(e.id);if(n.beginPath(),n.arc(x,S,m,0,Math.PI*2),n.fillStyle=de(c,{connections:e.connections,colorIndex:W,selectedNodeId:f,nodeId:e.id,isConnected:T}),n.fill(),V)return;n.strokeStyle=u.nodeStroke,n.lineWidth=(k?2:1)/o,n.stroke(),k&&(n.beginPath(),n.arc(x,S,m+2/o,0,Math.PI*2),n.strokeStyle=u.nodeSelectedStroke,n.lineWidth=1.5/o,n.stroke());const _=T&&e.connections>=4;if(k||_||o>2.5){const P=e.title||"Untitled",E=Math.max(10/o,2.5);n.font=ue(c,{fontSize:E,emphasize:k}),n.textAlign="center",n.textBaseline="top";const M=n.measureText(P).width,j=2/o,F=S+m+3/o;n.fillStyle=u.labelBackground,n.fillRect(x-M/2-j,F,M+j*2,E+j*2),n.fillStyle=u.labelText,n.fillText(P,x,F+j)}},[d,c]),$=i.useCallback((e,n,o)=>{const u=d,f=e.source,p=e.target,m=u?f.id===u||p.id===u:!1;n.beginPath(),n.moveTo(f.x||0,f.y||0),n.lineTo(p.x||0,p.y||0),n.strokeStyle=ce(c,{selectedNodeId:u,isConnected:m}),n.lineWidth=m?2/o:.5/o,n.stroke()},[d,c]);return l?t.jsx(C,{title:"Knowledge Graph",description:`${l.nodes.length} linked notes, ${l.links.length} connections`,children:t.jsxs("div",{ref:a,className:"surface-base graph-canvas relative overflow-hidden",style:{"--graph-bg":h.background},children:[d&&(()=>{const e=l.nodes.find(n=>n.id===d);return e?t.jsxs("div",{className:"surface-floating absolute top-3 left-3 z-10 flex items-center gap-2 px-3 py-2",children:[t.jsx(N,{as:"span",variant:"meta",weight:"semibold",truncate:!0,className:"max-w-48",children:e.title}),t.jsxs(N,{as:"span",variant:"label",tone:"tertiary",children:[e.connections," links"]}),t.jsx("button",{type:"button",onClick:()=>b(null),className:"focus-ring-soft ml-1 flex h-6 w-6 cursor-pointer items-center justify-center rounded-[8px] text-fg-tertiary transition-colors hover:bg-hover-subtle hover:text-fg-default","aria-label":"Deselect node",children:t.jsx(oe,{className:"h-3.5 w-3.5"})})]}):null})(),t.jsxs("div",{className:"surface-floating absolute top-3 right-3 z-10 flex flex-col gap-1.5 px-3 py-2.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"legend-dot h-2.5 w-2.5 shrink-0 rounded-full",style:{"--legend-color":h.legendHub}}),t.jsx(N,{as:"span",variant:"label",weight:"medium",tone:"secondary",children:"Hub notes (4+ connections)"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"legend-dot h-2.5 w-2.5 shrink-0 rounded-full",style:{"--legend-color":h.nodeConnected}}),t.jsx(N,{as:"span",variant:"label",weight:"medium",tone:"secondary",children:"Connected notes"})]})]}),t.jsx(se,{ref:r,graphData:l,width:g.width,height:g.height,nodeId:"id",nodeLabel:"",nodeCanvasObject:Z,nodePointerAreaPaint:(e,n,o)=>{o.beginPath(),o.arc(e.x||0,e.y||0,Math.max(z(e.connections)+4,10),0,2*Math.PI),o.fillStyle=n,o.fill()},linkCanvasObject:$,linkCanvasObjectMode:()=>"replace",linkDirectionalParticles:0,onNodeClick:B,onNodeHover:K,onBackgroundClick:L,onNodeDrag:q,onNodeDragEnd:A,warmupTicks:30,cooldownTicks:80,d3AlphaDecay:.05,d3VelocityDecay:.3,enableZoomInteraction:!0,enablePanInteraction:!0,minZoom:.3,maxZoom:5})]})}):t.jsx(C,{title:"Knowledge Graph",description:"0 linked notes, 0 connections",children:t.jsx(re,{title:"No constellations yet",description:"Link your notes together and watch your own starry sky unfold"})})}function ke(){return t.jsx(Q,{fallback:fe,errorTitle:"Failed to load graph",errorDescription:"Retry loading your linked note constellation",renderError:({error:s,retry:a})=>t.jsx(C,{title:"Knowledge Graph",children:t.jsx(U,{title:"Failed to load graph",description:"Retry loading your linked note constellation",error:s,onRetry:a})}),children:t.jsx(he,{})})}export{ke as default};
1
+ import{j as t}from"./note-vendor-B0t5F04o.js";import{$ as _,P as C,a2 as U,i as G,a3 as Y,a4 as J,a5 as X,a6 as ee,q as ne,N as te,F as re,T as N,a7 as oe}from"./index-B4l2UvuC.js";import{a as i,F as se}from"./graph-vendor-CUxe67Lr.js";import"./note-core-GgFcksAF.js";const ae=s=>{let a=0;for(let r=0;r<s.length;r++)a+=s.charCodeAt(r);return a},ie={background:"#f4f6f8",nodeHub:"#2c2f36",nodeSelected:"#111318",nodeConnected:"#636b76",nodeDefault:["#d6dbe1","#c8ced6","#b7bec7","#a7afb9"],nodeDimmed:["rgba(214,219,225,0.28)","rgba(200,206,214,0.24)","rgba(183,190,199,0.24)","rgba(167,175,185,0.2)"],nodeHubDimmed:"rgba(44,47,54,0.16)",nodeStroke:"#eef1f4",nodeSelectedStroke:"#a6b0bc",labelBackground:"rgba(246,248,250,0.92)",labelText:"#222831",labelFontFamily:"Pretendard Variable, Pretendard, system-ui, sans-serif",linkIdle:"rgba(99, 107, 117, 0.34)",linkConnected:"#68717c",linkDimmed:"rgba(127, 136, 146, 0.12)",legendHub:"#2c2f36"},le={background:"#121316",nodeHub:"#d6dce3",nodeSelected:"#eef1f5",nodeConnected:"#9099a4",nodeDefault:["#343a43","#2d333c","#262c35","#20262f"],nodeDimmed:["rgba(52,58,67,0.28)","rgba(45,51,60,0.24)","rgba(38,44,53,0.22)","rgba(32,38,47,0.2)"],nodeHubDimmed:"rgba(214,220,227,0.16)",nodeStroke:"#171c23",nodeSelectedStroke:"#7f8a97",labelBackground:"rgba(16,18,22,0.9)",labelText:"#eef2f6",labelFontFamily:"Pretendard Variable, Pretendard, system-ui, sans-serif",linkIdle:"rgba(118, 127, 138, 0.42)",linkConnected:"#a2abb6",linkDimmed:"rgba(118, 127, 138, 0.1)",legendHub:"#d6dce3"};function D(s){return s==="dark"?le:ie}function de(s,a){const r=D(s),{connections:g,colorIndex:y,selectedNodeId:d,nodeId:b,isConnected:c}=a,h=d===b;return d!==null&&!h&&!c?g>3?r.nodeHubDimmed:r.nodeDimmed[y%r.nodeDimmed.length]:h?r.nodeSelected:c?r.nodeConnected:g>3?r.nodeHub:r.nodeDefault[y%r.nodeDefault.length]}function ce(s,a){const r=D(s);return a.selectedNodeId!==null&&!a.isConnected?r.linkDimmed:a.isConnected?r.linkConnected:r.linkIdle}function ue(s,a){const r=D(s);return`${a.emphasize?"700":"400"} ${a.fontSize}px ${r.labelFontFamily}`}function z(s){return s<=1?3.5:s<=3?4.5:s<=6?5.5:Math.min(7,5.5+Math.sqrt(s)*.5)}const fe=t.jsx(C,{title:"Knowledge Graph",description:t.jsx(G,{width:184,height:16,className:"rounded-full"}),children:t.jsx("div",{className:"flex h-[600px] items-center justify-center",children:t.jsx(G,{width:"100%",height:"100%"})})});function he(){const s=Y(),a=i.useRef(null),r=i.useRef(null),[g,y]=i.useState({width:800,height:600}),[d,b]=i.useState(null),{theme:c}=J(e=>e),h=D(c),v=i.useRef(h);v.current=h;const{data:w}=X({queryKey:ne.notes.graph(),queryFn:async()=>{const e=await ee();if(e.type==="error")throw e;return e.noteGraph}}),l=i.useMemo(()=>{if(w.nodes.length===0)return null;const e=w.nodes.filter(o=>o.connections>0);if(e.length===0)return null;const n=new Set(e.map(o=>o.id));return{nodes:e,links:w.links.filter(o=>n.has(o.source)&&n.has(o.target))}},[w]);i.useEffect(()=>{if(!l)return;const e=()=>{if(!a.current)return;const n=a.current.getBoundingClientRect();y({width:n.width,height:Math.max(600,window.innerHeight-150)})};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[l]),i.useEffect(()=>{if(!l||!r.current)return;const e=window.setTimeout(()=>{r.current?.zoomToFit(400,50)},500);return()=>window.clearTimeout(e)},[l]);const R=i.useRef(d);R.current=d;const B=i.useCallback(e=>{if(R.current===e.id){s({to:te,params:{id:e.id}});return}b(e.id)},[s]),L=i.useCallback(()=>{b(null)},[]),K=i.useCallback(e=>{a.current&&(a.current.style.cursor=e?"pointer":"default")},[]),I=i.useRef(!1),$=i.useCallback(()=>{I.current||(I.current=!0,r.current?.enableZoomInteraction(!1))},[]),q=i.useCallback(()=>{I.current=!1,r.current?.enableZoomInteraction(!0)},[]),H=i.useRef(new Map),A=i.useMemo(()=>{const e=new Map;if(l)for(const n of l.links)e.has(n.source)||e.set(n.source,new Set),e.has(n.target)||e.set(n.target,new Set),e.get(n.source)?.add(n.target),e.get(n.target)?.add(n.source);return e},[l]);H.current=A;const O=i.useCallback((e,n,o)=>{const u=v.current,f=d,p=H.current,m=z(e.connections),x=e.x||0,S=e.y||0,k=f===e.id,T=f?p.get(f)?.has(e.id)??!1:!1,V=f!==null&&!k&&!T,W=ae(e.id);if(n.beginPath(),n.arc(x,S,m,0,Math.PI*2),n.fillStyle=de(c,{connections:e.connections,colorIndex:W,selectedNodeId:f,nodeId:e.id,isConnected:T}),n.fill(),V)return;n.strokeStyle=u.nodeStroke,n.lineWidth=(k?2:1)/o,n.stroke(),k&&(n.beginPath(),n.arc(x,S,m+2/o,0,Math.PI*2),n.strokeStyle=u.nodeSelectedStroke,n.lineWidth=1.5/o,n.stroke());const Q=T&&e.connections>=4;if(k||Q||o>2.5){const P=e.title||"Untitled",E=Math.max(10/o,2.5);n.font=ue(c,{fontSize:E,emphasize:k}),n.textAlign="center",n.textBaseline="top";const M=n.measureText(P).width,j=2/o,F=S+m+3/o;n.fillStyle=u.labelBackground,n.fillRect(x-M/2-j,F,M+j*2,E+j*2),n.fillStyle=u.labelText,n.fillText(P,x,F+j)}},[d,c]),Z=i.useCallback((e,n,o)=>{const u=d,f=e.source,p=e.target,m=u?f.id===u||p.id===u:!1;n.beginPath(),n.moveTo(f.x||0,f.y||0),n.lineTo(p.x||0,p.y||0),n.strokeStyle=ce(c,{selectedNodeId:u,isConnected:m}),n.lineWidth=m?2/o:.5/o,n.stroke()},[d,c]);return l?t.jsx(C,{title:"Knowledge Graph",description:`${l.nodes.length} linked notes, ${l.links.length} connections`,children:t.jsxs("div",{ref:a,className:"surface-base graph-canvas relative overflow-hidden",style:{"--graph-bg":h.background},children:[d&&(()=>{const e=l.nodes.find(n=>n.id===d);return e?t.jsxs("div",{className:"surface-floating absolute top-3 left-3 z-10 flex items-center gap-2 px-3 py-2",children:[t.jsx(N,{as:"span",variant:"meta",weight:"semibold",truncate:!0,className:"max-w-48",children:e.title}),t.jsxs(N,{as:"span",variant:"label",tone:"tertiary",children:[e.connections," links"]}),t.jsx("button",{type:"button",onClick:()=>b(null),className:"focus-ring-soft ml-1 flex h-6 w-6 cursor-pointer items-center justify-center rounded-[8px] text-fg-tertiary transition-colors hover:bg-hover-subtle hover:text-fg-default","aria-label":"Deselect node",children:t.jsx(oe,{className:"h-3.5 w-3.5"})})]}):null})(),t.jsxs("div",{className:"surface-floating absolute top-3 right-3 z-10 flex flex-col gap-1.5 px-3 py-2.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"legend-dot h-2.5 w-2.5 shrink-0 rounded-full",style:{"--legend-color":h.legendHub}}),t.jsx(N,{as:"span",variant:"label",weight:"medium",tone:"secondary",children:"Hub notes (4+ connections)"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"legend-dot h-2.5 w-2.5 shrink-0 rounded-full",style:{"--legend-color":h.nodeConnected}}),t.jsx(N,{as:"span",variant:"label",weight:"medium",tone:"secondary",children:"Connected notes"})]})]}),t.jsx(se,{ref:r,graphData:l,width:g.width,height:g.height,nodeId:"id",nodeLabel:"",nodeCanvasObject:O,nodePointerAreaPaint:(e,n,o)=>{o.beginPath(),o.arc(e.x||0,e.y||0,Math.max(z(e.connections)+4,10),0,2*Math.PI),o.fillStyle=n,o.fill()},linkCanvasObject:Z,linkCanvasObjectMode:()=>"replace",linkDirectionalParticles:0,onNodeClick:B,onNodeHover:K,onBackgroundClick:L,onNodeDrag:$,onNodeDragEnd:q,warmupTicks:30,cooldownTicks:80,d3AlphaDecay:.05,d3VelocityDecay:.3,enableZoomInteraction:!0,enablePanInteraction:!0,minZoom:.3,maxZoom:5})]})}):t.jsx(C,{title:"Knowledge Graph",description:"0 linked notes, 0 connections",children:t.jsx(re,{title:"No constellations yet",description:"Link your notes together and watch your own starry sky unfold"})})}function ke(){return t.jsx(_,{fallback:fe,errorTitle:"Failed to load graph",errorDescription:"Retry loading your linked note constellation",renderError:({error:s,retry:a})=>t.jsx(C,{title:"Knowledge Graph",children:t.jsx(U,{title:"Failed to load graph",description:"Retry loading your linked note constellation",error:s,onRetry:a})}),children:t.jsx(he,{})})}export{ke as default};
@@ -1 +1 @@
1
- import{j as e}from"./note-vendor-5N5mRkIT.js";import{a as g}from"./graph-vendor-CUxe67Lr.js";function u({src:r,alt:n,loading:t="lazy",className:i}){const s=g.useRef(null);return g.useEffect(()=>{if(!s.current||t!=="lazy"||!r)return;const a=new IntersectionObserver(([c])=>{if(c.isIntersecting){const A=c.target;A.src=A.dataset.src,a.unobserve(A)}});return a.observe(s.current),()=>{a.disconnect()}},[t,r]),e.jsx(e.Fragment,{children:t!=="lazy"?e.jsx("img",{src:r,alt:n,className:`${i??""} dark:brightness-[0.85] dark:saturate-[0.9]`.trim()}):e.jsx("img",{ref:s,src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQIW2O4evXqfwAIgQN/QHwrfwAAAABJRU5ErkJggg==",alt:n,"data-src":r,className:`${i??""} dark:brightness-[0.85] dark:saturate-[0.9]`.trim()})})}export{u as I};
1
+ import{j as e}from"./note-vendor-B0t5F04o.js";import{a as g}from"./graph-vendor-CUxe67Lr.js";function u({src:r,alt:n,loading:t="lazy",className:i}){const s=g.useRef(null);return g.useEffect(()=>{if(!s.current||t!=="lazy"||!r)return;const a=new IntersectionObserver(([c])=>{if(c.isIntersecting){const A=c.target;A.src=A.dataset.src,a.unobserve(A)}});return a.observe(s.current),()=>{a.disconnect()}},[t,r]),e.jsx(e.Fragment,{children:t!=="lazy"?e.jsx("img",{src:r,alt:n,className:`${i??""} dark:brightness-[0.85] dark:saturate-[0.9]`.trim()}):e.jsx("img",{ref:s,src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQIW2O4evXqfwAIgQN/QHwrfwAAAABJRU5ErkJggg==",alt:n,"data-src":r,className:`${i??""} dark:brightness-[0.85] dark:saturate-[0.9]`.trim()})})}export{u as I};
@@ -1 +1 @@
1
- import{a}from"./graph-vendor-CUxe67Lr.js";import{p as m}from"./index-Bsx4P7EA.js";const n=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M144,96a16,16,0,1,1,16,16A16,16,0,0,1,144,96Zm92-40V200a20,20,0,0,1-20,20H40a20,20,0,0,1-20-20V56A20,20,0,0,1,40,36H216A20,20,0,0,1,236,56ZM44,60v79.72l33.86-33.86a20,20,0,0,1,28.28,0L147.31,147l17.18-17.17a20,20,0,0,1,28.28,0L212,149.09V60Zm0,136H162.34L92,125.66l-48,48Zm168,0V183l-33.37-33.37L164.28,164l32,32Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M224,56V178.06l-39.72-39.72a8,8,0,0,0-11.31,0L147.31,164,97.66,114.34a8,8,0,0,0-11.32,0L32,168.69V56a8,8,0,0,1,8-8H216A8,8,0,0,1,224,56Z",opacity:"0.2"}),a.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,16V158.75l-26.07-26.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L40,149.37V56ZM40,172l52-52,80,80H40Zm176,28H194.63l-36-36,20-20L216,181.38V200ZM144,100a12,12,0,1,1,12,12A12,12,0,0,1,144,100Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM156,88a12,12,0,1,1-12,12A12,12,0,0,1,156,88Zm60,112H40V160.69l46.34-46.35a8,8,0,0,1,11.32,0h0L165,181.66a8,8,0,0,0,11.32-11.32l-17.66-17.65L173,138.34a8,8,0,0,1,11.31,0L216,170.07V200Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,42H40A14,14,0,0,0,26,56V200a14,14,0,0,0,14,14H216a14,14,0,0,0,14-14V56A14,14,0,0,0,216,42ZM40,54H216a2,2,0,0,1,2,2V163.57L188.53,134.1a14,14,0,0,0-19.8,0l-21.42,21.42L101.9,110.1a14,14,0,0,0-19.8,0L38,154.2V56A2,2,0,0,1,40,54ZM38,200V171.17l52.58-52.58a2,2,0,0,1,2.84,0L176.83,202H40A2,2,0,0,1,38,200Zm178,2H193.8l-38-38,21.41-21.42a2,2,0,0,1,2.83,0l38,38V200A2,2,0,0,1,216,202ZM146,100a10,10,0,1,1,10,10A10,10,0,0,1,146,100Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,16V158.75l-26.07-26.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L40,149.37V56ZM40,172l52-52,80,80H40Zm176,28H194.63l-36-36,20-20L216,181.38V200ZM144,100a12,12,0,1,1,12,12A12,12,0,0,1,144,100Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,44H40A12,12,0,0,0,28,56V200a12,12,0,0,0,12,12H216a12,12,0,0,0,12-12V56A12,12,0,0,0,216,44ZM40,52H216a4,4,0,0,1,4,4V168.4l-32.89-32.89a12,12,0,0,0-17,0l-22.83,22.83-46.82-46.83a12,12,0,0,0-17,0L36,159V56A4,4,0,0,1,40,52ZM36,200V170.34l53.17-53.17a4,4,0,0,1,5.66,0L181.66,204H40A4,4,0,0,1,36,200Zm180,4H193l-40-40,22.83-22.83a4,4,0,0,1,5.66,0L220,179.71V200A4,4,0,0,1,216,204ZM148,100a8,8,0,1,1,8,8A8,8,0,0,1,148,100Z"}))]]),e=a.forwardRef((l,t)=>a.createElement(m,{ref:t,...l,weights:n}));e.displayName="ImageIcon";const Z=e;export{Z as I};
1
+ import{a}from"./graph-vendor-CUxe67Lr.js";import{p as m}from"./index-B4l2UvuC.js";const n=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M144,96a16,16,0,1,1,16,16A16,16,0,0,1,144,96Zm92-40V200a20,20,0,0,1-20,20H40a20,20,0,0,1-20-20V56A20,20,0,0,1,40,36H216A20,20,0,0,1,236,56ZM44,60v79.72l33.86-33.86a20,20,0,0,1,28.28,0L147.31,147l17.18-17.17a20,20,0,0,1,28.28,0L212,149.09V60Zm0,136H162.34L92,125.66l-48,48Zm168,0V183l-33.37-33.37L164.28,164l32,32Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M224,56V178.06l-39.72-39.72a8,8,0,0,0-11.31,0L147.31,164,97.66,114.34a8,8,0,0,0-11.32,0L32,168.69V56a8,8,0,0,1,8-8H216A8,8,0,0,1,224,56Z",opacity:"0.2"}),a.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,16V158.75l-26.07-26.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L40,149.37V56ZM40,172l52-52,80,80H40Zm176,28H194.63l-36-36,20-20L216,181.38V200ZM144,100a12,12,0,1,1,12,12A12,12,0,0,1,144,100Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM156,88a12,12,0,1,1-12,12A12,12,0,0,1,156,88Zm60,112H40V160.69l46.34-46.35a8,8,0,0,1,11.32,0h0L165,181.66a8,8,0,0,0,11.32-11.32l-17.66-17.65L173,138.34a8,8,0,0,1,11.31,0L216,170.07V200Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,42H40A14,14,0,0,0,26,56V200a14,14,0,0,0,14,14H216a14,14,0,0,0,14-14V56A14,14,0,0,0,216,42ZM40,54H216a2,2,0,0,1,2,2V163.57L188.53,134.1a14,14,0,0,0-19.8,0l-21.42,21.42L101.9,110.1a14,14,0,0,0-19.8,0L38,154.2V56A2,2,0,0,1,40,54ZM38,200V171.17l52.58-52.58a2,2,0,0,1,2.84,0L176.83,202H40A2,2,0,0,1,38,200Zm178,2H193.8l-38-38,21.41-21.42a2,2,0,0,1,2.83,0l38,38V200A2,2,0,0,1,216,202ZM146,100a10,10,0,1,1,10,10A10,10,0,0,1,146,100Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,16V158.75l-26.07-26.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L40,149.37V56ZM40,172l52-52,80,80H40Zm176,28H194.63l-36-36,20-20L216,181.38V200ZM144,100a12,12,0,1,1,12,12A12,12,0,0,1,144,100Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,44H40A12,12,0,0,0,28,56V200a12,12,0,0,0,12,12H216a12,12,0,0,0,12-12V56A12,12,0,0,0,216,44ZM40,52H216a4,4,0,0,1,4,4V168.4l-32.89-32.89a12,12,0,0,0-17,0l-22.83,22.83-46.82-46.83a12,12,0,0,0-17,0L36,159V56A4,4,0,0,1,40,52ZM36,200V170.34l53.17-53.17a4,4,0,0,1,5.66,0L181.66,204H40A4,4,0,0,1,36,200Zm180,4H193l-40-40,22.83-22.83a4,4,0,0,1,5.66,0L220,179.71V200A4,4,0,0,1,216,204ZM148,100a8,8,0,1,1,8,8A8,8,0,0,1,148,100Z"}))]]),e=a.forwardRef((l,t)=>a.createElement(m,{ref:t,...l,weights:n}));e.displayName="ImageIcon";const Z=e;export{Z as I};
@@ -0,0 +1,21 @@
1
+ import{j as e,i as G,k as Ie,U as me,y as ue,v as Pe,X as _e,F as Ye}from"./note-vendor-B0t5F04o.js";import{p as W,T as p,c as H,M as v,r as X,B as C,w as ze,u as Ue,ae as qe,q as M,af as Ke,ag as Qe,d as N,W as pe,a5 as he,ah as Ge,l as _,I as We,m as Xe,n as Je,o as Y,g as et,ai as tt,_ as fe,D as xe,k as ge,aj as ye,ak as at,al as be,a3 as ve,N as J,ac as nt,x as st,am as rt,a4 as ot,$ as K,P as ee,a2 as Q,j as lt,i as V,an as it,ao as ct,ap as dt,aq as mt,ar as oe,as as ut,L as pt,at as le}from"./index-B4l2UvuC.js";import{a as n}from"./graph-vendor-CUxe67Lr.js";import{C as ht}from"./Callout-BAqbXI0L.js";import{u as ft,R as xt}from"./useReminderMutate-v1EXqM90.js";import{n as gt}from"./Plus.es-KeV96R_e.js";import{u as yt}from"./image.api-CMdQbCyN.js";import{A as bt,F as vt,a2 as je,a3 as jt}from"./note-core-GgFcksAF.js";const wt=new Map([["bold",n.createElement(n.Fragment,null,n.createElement("path",{d:"M216,28H88A12,12,0,0,0,76,40V76H40A12,12,0,0,0,28,88V216a12,12,0,0,0,12,12H168a12,12,0,0,0,12-12V180h36a12,12,0,0,0,12-12V40A12,12,0,0,0,216,28ZM156,204H52V100H156Zm48-48H180V88a12,12,0,0,0-12-12H100V52H204Z"}))],["duotone",n.createElement(n.Fragment,null,n.createElement("path",{d:"M216,40V168H168V88H88V40Z",opacity:"0.2"}),n.createElement("path",{d:"M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"}))],["fill",n.createElement(n.Fragment,null,n.createElement("path",{d:"M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32Zm-8,128H176V88a8,8,0,0,0-8-8H96V48H208Z"}))],["light",n.createElement(n.Fragment,null,n.createElement("path",{d:"M216,34H88a6,6,0,0,0-6,6V82H40a6,6,0,0,0-6,6V216a6,6,0,0,0,6,6H168a6,6,0,0,0,6-6V174h42a6,6,0,0,0,6-6V40A6,6,0,0,0,216,34ZM162,210H46V94H162Zm48-48H174V88a6,6,0,0,0-6-6H94V46H210Z"}))],["regular",n.createElement(n.Fragment,null,n.createElement("path",{d:"M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"}))],["thin",n.createElement(n.Fragment,null,n.createElement("path",{d:"M216,36H88a4,4,0,0,0-4,4V84H40a4,4,0,0,0-4,4V216a4,4,0,0,0,4,4H168a4,4,0,0,0,4-4V172h44a4,4,0,0,0,4-4V40A4,4,0,0,0,216,36ZM164,212H44V92H164Zm48-48H172V88a4,4,0,0,0-4-4H92V44H212Z"}))]]),Ct=new Map([["bold",n.createElement(n.Fragment,null,n.createElement("path",{d:"M216.49,79.52l-56-56A12,12,0,0,0,152,20H56A20,20,0,0,0,36,40V216a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V88A12,12,0,0,0,216.49,79.52ZM160,57l23,23H160ZM60,212V44h76V92a12,12,0,0,0,12,12h48V212Z"}))],["duotone",n.createElement(n.Fragment,null,n.createElement("path",{d:"M208,88H152V32Z",opacity:"0.2"}),n.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Z"}))],["fill",n.createElement(n.Fragment,null,n.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM152,88V44l44,44Z"}))],["light",n.createElement(n.Fragment,null,n.createElement("path",{d:"M212.24,83.76l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40V216a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V88A6,6,0,0,0,212.24,83.76ZM158,46.48,193.52,82H158ZM200,218H56a2,2,0,0,1-2-2V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50V216A2,2,0,0,1,200,218Z"}))],["regular",n.createElement(n.Fragment,null,n.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Z"}))],["thin",n.createElement(n.Fragment,null,n.createElement("path",{d:"M210.83,85.17l-56-56A4,4,0,0,0,152,28H56A12,12,0,0,0,44,40V216a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V88A4,4,0,0,0,210.83,85.17ZM156,41.65,198.34,84H156ZM200,220H56a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h92V88a4,4,0,0,0,4,4h52V216A4,4,0,0,1,200,220Z"}))]]),Nt=new Map([["bold",n.createElement(n.Fragment,null,n.createElement("path",{d:"M87.5,151.52l64-64a12,12,0,0,1,17,17l-64,64a12,12,0,0,1-17-17Zm131-114a60.08,60.08,0,0,0-84.87,0L103.51,67.61a12,12,0,0,0,17,17l30.07-30.06a36,36,0,0,1,50.93,50.92L171.4,135.52a12,12,0,1,0,17,17l30.08-30.06A60.09,60.09,0,0,0,218.45,37.55ZM135.52,171.4l-30.07,30.08a36,36,0,0,1-50.92-50.93l30.06-30.07a12,12,0,0,0-17-17L37.55,133.58a60,60,0,0,0,84.88,84.87l30.06-30.07a12,12,0,0,0-17-17Z"}))],["duotone",n.createElement(n.Fragment,null,n.createElement("path",{d:"M209.94,113.94l-96,96a48,48,0,0,1-67.88-67.88l96-96a48,48,0,0,1,67.88,67.88Z",opacity:"0.2"}),n.createElement("path",{d:"M165.66,90.34a8,8,0,0,1,0,11.32l-64,64a8,8,0,0,1-11.32-11.32l64-64A8,8,0,0,1,165.66,90.34ZM215.6,40.4a56,56,0,0,0-79.2,0L106.34,70.45a8,8,0,0,0,11.32,11.32l30.06-30a40,40,0,0,1,56.57,56.56l-30.07,30.06a8,8,0,0,0,11.31,11.32L215.6,119.6a56,56,0,0,0,0-79.2ZM138.34,174.22l-30.06,30.06a40,40,0,1,1-56.56-56.57l30.05-30.05a8,8,0,0,0-11.32-11.32L40.4,136.4a56,56,0,0,0,79.2,79.2l30.06-30.07a8,8,0,0,0-11.32-11.31Z"}))],["fill",n.createElement(n.Fragment,null,n.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM144.56,173.66l-21.45,21.45a44,44,0,0,1-62.22-62.22l21.45-21.46a8,8,0,0,1,11.32,11.31L72.2,144.2a28,28,0,0,0,39.6,39.6l21.45-21.46a8,8,0,0,1,11.31,11.32Zm-34.9-16a8,8,0,0,1-11.32-11.32l48-48a8,8,0,0,1,11.32,11.32Zm85.45-34.55-21.45,21.45a8,8,0,0,1-11.32-11.31L183.8,111.8a28,28,0,0,0-39.6-39.6L122.74,93.66a8,8,0,0,1-11.31-11.32l21.46-21.45a44,44,0,0,1,62.22,62.22Z"}))],["light",n.createElement(n.Fragment,null,n.createElement("path",{d:"M164.25,91.75a6,6,0,0,1,0,8.49l-64,64a6,6,0,0,1-8.49-8.48l64-64A6,6,0,0,1,164.25,91.75ZM214.2,41.8a54.07,54.07,0,0,0-76.38,0L107.75,71.85a6,6,0,0,0,8.49,8.49l30.07-30.06a42,42,0,0,1,59.41,59.41l-30.08,30.07a6,6,0,1,0,8.49,8.49l30.07-30.07A54,54,0,0,0,214.2,41.8ZM139.76,175.64l-30.07,30.08a42,42,0,0,1-59.41-59.41l30.06-30.07a6,6,0,0,0-8.49-8.49l-30,30.07a54,54,0,0,0,76.38,76.39l30.07-30.08a6,6,0,0,0-8.49-8.49Z"}))],["regular",n.createElement(n.Fragment,null,n.createElement("path",{d:"M165.66,90.34a8,8,0,0,1,0,11.32l-64,64a8,8,0,0,1-11.32-11.32l64-64A8,8,0,0,1,165.66,90.34ZM215.6,40.4a56,56,0,0,0-79.2,0L106.34,70.45a8,8,0,0,0,11.32,11.32l30.06-30a40,40,0,0,1,56.57,56.56l-30.07,30.06a8,8,0,0,0,11.31,11.32L215.6,119.6a56,56,0,0,0,0-79.2ZM138.34,174.22l-30.06,30.06a40,40,0,1,1-56.56-56.57l30.05-30.05a8,8,0,0,0-11.32-11.32L40.4,136.4a56,56,0,0,0,79.2,79.2l30.06-30.07a8,8,0,0,0-11.32-11.31Z"}))],["thin",n.createElement(n.Fragment,null,n.createElement("path",{d:"M162.84,93.16a4,4,0,0,1,0,5.66l-64,64a4,4,0,0,1-5.66-5.66l64-64A4,4,0,0,1,162.84,93.16Zm49.95-49.95a52.07,52.07,0,0,0-73.56,0L109.17,73.27a4,4,0,0,0,5.65,5.66l30.07-30.06a44,44,0,0,1,62.24,62.24l-30.07,30.06a4,4,0,0,0,5.66,5.66l30.07-30.06A52.07,52.07,0,0,0,212.79,43.21ZM141.17,177.06l-30.06,30.07a44,44,0,0,1-62.24-62.24l30.06-30.06a4,4,0,0,0-5.66-5.66L43.21,139.23a52,52,0,0,0,73.56,73.56l30.06-30.07a4,4,0,1,0-5.66-5.66Z"}))]]),we=n.forwardRef((t,a)=>n.createElement(W,{ref:a,...t,weights:wt}));we.displayName="CopyIcon";const kt=we,Ce=n.forwardRef((t,a)=>n.createElement(W,{ref:a,...t,weights:Ct}));Ce.displayName="FileIcon";const Mt=Ce,Ne=n.forwardRef((t,a)=>n.createElement(W,{ref:a,...t,weights:Nt}));Ne.displayName="LinkSimpleIcon";const Ht=Ne;function te({icon:t,title:a,className:s}){return e.jsxs("div",{className:H("flex items-center gap-2",s),children:[e.jsx("div",{className:"flex h-3.5 w-3.5 shrink-0 items-center justify-center text-current",children:t}),e.jsx(p,{as:"span",variant:"label",weight:"semibold",className:"text-current",children:a})]})}function D({title:t,description:a,selected:s=!1,onClick:o,children:r}){return e.jsxs("button",{type:"button","aria-pressed":s,className:`focus-ring-soft flex w-full items-start justify-between gap-3 p-3 text-left transition-colors sm:p-4 ${s?"surface-floating bg-elevated":"rounded-[14px] border border-border-subtle bg-transparent hover:border-border-secondary hover:bg-hover-subtle"}`,onClick:o,children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(p,{as:"div",variant:"body",weight:"semibold",tone:s?"default":"secondary",children:t}),e.jsx(p,{as:"div",variant:"meta",weight:"medium",tone:s?"secondary":"tertiary",className:"mt-1",children:a})]}),r?e.jsx("div",{className:"shrink-0",children:r}):null]})}const Et=[{value:"narrow",label:"Narrow",description:"Optimized for reading long-form content"},{value:"wide",label:"Wide",description:"Balanced width suitable for most content"},{value:"full",label:"Full Width",description:"Maximize screen space utilization"}];function At({isOpen:t,onClose:a,onSave:s,currentLayout:o="wide"}){const[r,c]=n.useState(o);n.useEffect(()=>{t&&c(o)},[t,o]);const i=()=>{s(r),a()};return e.jsxs(v,{isOpen:t,onClose:a,variant:"compact",children:[e.jsx(v.Header,{title:"Layout Settings",onClose:a}),e.jsx(v.Body,{children:e.jsx("div",{className:"flex flex-col gap-3 sm:gap-4",children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(p,{as:"div",variant:"body",weight:"semibold",tone:"secondary",children:"Note layout"}),e.jsx("div",{className:"flex flex-col gap-2",children:Et.map(l=>e.jsx(D,{title:l.label,description:l.description,selected:r===l.value,onClick:()=>c(l.value)},l.value))})]})})}),e.jsx(v.Footer,{children:e.jsxs(X,{children:[e.jsx(C,{variant:"ghost",size:"sm",onClick:a,children:"Cancel"}),e.jsx(C,{variant:"primary",size:"sm",onClick:i,children:"Apply"})]})})]})}const Tt=(t,a)=>t||(a==="mobile"?"Mobile browser":a==="mcp"?"MCP":"Web browser");function Rt({isOpen:t,noteId:a,onClose:s,onRestored:o}){const r=pe(),c=ze(),i=Ue({queryKey:M.notes.snapshots(a),queryFn:async()=>{const m=await qe(a);if(m.type==="error")throw m;return m.noteSnapshots},enabled:t}),l=Ke({mutationFn:Qe,onSuccess:async m=>{if(m.type==="error"){r(m.errors[0].message);return}await Promise.all([c.invalidateQueries({queryKey:M.notes.detail(a),exact:!0}),c.invalidateQueries({queryKey:M.notes.listAll(),exact:!1}),c.invalidateQueries({queryKey:M.notes.tagListAll(),exact:!1}),c.invalidateQueries({queryKey:M.notes.pinned(),exact:!0}),c.invalidateQueries({queryKey:M.notes.backReferences(a),exact:!0}),c.invalidateQueries({queryKey:M.notes.snapshots(a),exact:!1})]),r("Previous version restored."),o?.(m.restoreNoteSnapshot),s()}});return e.jsxs(v,{isOpen:t,onClose:s,variant:"inspect",children:[e.jsx(v.Header,{title:"Restore Previous Version",onClose:s}),e.jsx(v.Body,{children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(p,{as:"p",variant:"meta",tone:"secondary",children:"Choose a previous snapshot to restore this note back to that state."}),i.isLoading&&e.jsx(p,{as:"div",variant:"meta",tone:"secondary",children:"Loading previous versions..."}),!i.isLoading&&i.data?.length===0&&e.jsx(p,{as:"div",variant:"meta",tone:"secondary",className:"rounded-[14px] border border-border-subtle bg-hover-subtle/50 px-4 py-3",children:"A recovery snapshot appears before the first edit in a session. Up to five recent snapshots are kept automatically, and identical versions are skipped."}),!i.isLoading&&i.data&&i.data.length>0&&e.jsx("div",{className:"flex flex-col gap-2",children:i.data.map(m=>e.jsx("div",{className:"surface-base p-3",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs(p,{as:"p",variant:"body",weight:"semibold",children:["Before"," ",Tt(m.meta.label,m.meta.entrypoint)," ","edit"]}),e.jsx(p,{as:"p",variant:"meta",truncate:!0,tone:"secondary",children:m.title}),e.jsx(p,{as:"p",variant:"label",tone:"tertiary",children:N(m.createdAt).format("YYYY-MM-DD HH:mm:ss")})]}),e.jsx(C,{size:"sm",isLoading:l.isPending,onClick:()=>l.mutate(m.id),children:"Restore"})]})},m.id))})]})})]})}const St=t=>{const{data:a}=he({queryKey:M.notes.backReferences(t.noteId),async queryFn(){const s=await Ge(t.noteId);if(s.type==="error")throw s;return s.backReferences}});return t.render(a)};let Vt="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",Lt=(t=21)=>{let a="",s=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)a+=Vt[s[t]&63];return a};const ie={low:{active:"border-border-secondary bg-elevated text-fg-default",inactive:"border-transparent bg-transparent text-fg-muted hover:bg-hover-subtle"},medium:{active:"border-border-secondary bg-elevated text-fg-default",inactive:"border-transparent bg-transparent text-fg-muted hover:bg-hover-subtle"},high:{active:"border-border-secondary bg-elevated text-fg-default",inactive:"border-transparent bg-transparent text-fg-muted hover:bg-hover-subtle"}};function Ft({isOpen:t,onClose:a,onSave:s,reminder:o,mode:r}){const[c,i]=n.useState(new Date),[l,m]=n.useState("medium"),[j,f]=n.useState("");n.useEffect(()=>{t&&r==="edit"&&o?(i(new Date(Number(o.reminderDate))),m(o.priority||"medium"),f(o.content||"")):t&&r==="create"&&(i(new Date),m("medium"),f(""))},[t,r,o]);const E=()=>{s(c,l,j||void 0),a()},y=x=>l===x?ie[x].active:ie[x].inactive;return e.jsxs(v,{isOpen:t,onClose:a,variant:"form",children:[e.jsx(v.Header,{title:r==="create"?"Create Reminder":"Edit Reminder",onClose:a}),e.jsx(v.Body,{children:e.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(_,{children:"Date & Time"}),e.jsx(We,{type:"datetime-local",size:"sm",value:N(c).format("YYYY-MM-DDTHH:mm"),onChange:x=>i(new Date(x.target.value))})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(_,{children:"Content"}),e.jsx(Xe,{size:"sm",placeholder:"Enter reminder content (optional)",value:j,onChange:x=>f(x.target.value)})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(_,{children:"Priority"}),e.jsxs(Je,{type:"single",value:l,onValueChange:x=>x&&m(x),className:"gap-1.5 border-none rounded-[14px] bg-muted/70 p-1 sm:gap-2",children:[e.jsx(Y,{value:"low",className:`flex-1 rounded-[10px] border ${y("low")}`,children:e.jsx(p,{as:"span",weight:"medium",className:"text-current",children:"Low"})}),e.jsx(Y,{value:"medium",className:`flex-1 rounded-[10px] border ${y("medium")}`,children:e.jsx(p,{as:"span",weight:"medium",className:"text-current",children:"Medium"})}),e.jsx(Y,{value:"high",className:`flex-1 rounded-[10px] border ${y("high")}`,children:e.jsx(p,{as:"span",weight:"medium",className:"text-current",children:"High"})})]})]})]})}),e.jsx(v.Footer,{children:e.jsxs(X,{children:[e.jsx(C,{variant:"ghost",size:"sm",onClick:a,children:"Cancel"}),e.jsx(C,{variant:"primary",size:"sm",onClick:E,children:r==="create"?"Create":"Save"})]})})]})}function Dt({noteId:t}){const[a,s]=n.useState(!1),[o,r]=n.useState(!1),[c,i]=n.useState("create"),[l,m]=n.useState(void 0),{onCreate:j,onUpdate:f,onDelete:E}=ft(),y=()=>{i("create"),m(void 0),r(!0)},x=h=>{i("edit"),m(h),r(!0)},A=(h,b,u)=>{c==="create"?j(t,h,b,()=>{r(!1)},u):c==="edit"&&l&&f(l.id,t,{reminderDate:h,priority:b,content:u},()=>{r(!1)})},T=h=>{f(h.id,t,{completed:!h.completed})},S=h=>{const b=N(Number(h)),u=N();return b.isSame(u,"day")?`Today at ${b.format("HH:mm")}`:b.isSame(u.add(1,"day"),"day")?`Tomorrow at ${b.format("HH:mm")}`:b.format("YYYY-MM-DD HH:mm")},Z=h=>{const b=N(Number(h)),u=N(),w=b.diff(u,"hour");return w<=6?"high":w<=24?"medium":"low"},B=h=>{const b=N(Number(h)),u=N(),w=b.diff(u,"hour"),k=b.diff(u,"minute")%60;return w<0||k<0?"Overdue":w===0?`${k}m remaining`:`${w}h ${k}m remaining`};return e.jsxs("div",{className:"surface-base mb-5 p-4",children:[e.jsxs("div",{className:H("flex items-center justify-between",!a&&"mb-3"),children:[e.jsx("button",{type:"button",onClick:()=>s(!a),className:"focus-ring-soft flex items-center gap-2 rounded-[10px] px-2 py-1.5 text-fg-tertiary transition-colors hover:bg-hover-subtle hover:text-fg-default",children:e.jsx(te,{icon:a?e.jsx(et,{size:12}):e.jsx(tt,{size:12}),title:"Reminders"})}),!a&&e.jsxs(C,{size:"sm",variant:"ghost",onClick:y,children:[e.jsx(gt,{className:"w-3 h-3"}),e.jsx(p,{as:"span",variant:"label",className:"hidden sm:inline",children:"Add"})]})]}),!a&&e.jsx(xt,{noteId:t,searchParams:{offset:0,limit:9999},render:({reminders:h,totalCount:b})=>e.jsx("div",{className:"flex flex-col gap-2",children:h.length===0?e.jsx(p,{as:"p",variant:"meta",tone:"secondary",className:"py-3 text-center",children:b===0?"No reminders yet":"All reminders complete"}):e.jsx("div",{className:"flex flex-col",children:h.map(u=>{const w=u.priority||Z(u.reminderDate),k=B(u.reminderDate),L=k==="Overdue";return e.jsxs("div",{className:H("flex items-center gap-2.5 px-2 py-1.5"),children:[e.jsx(fe,{checked:u.completed,onChange:()=>T(u),size:"sm"}),e.jsx(p,{as:"div",variant:"body",weight:"medium",className:H("truncate flex-1 min-w-0",u.completed&&"line-through opacity-40"),children:u.content||S(u.reminderDate)}),e.jsxs("div",{className:H("shrink-0 flex items-center gap-1",u.completed&&"opacity-40"),children:[u.content&&e.jsx(p,{as:"span",variant:"meta",tone:"secondary",children:S(u.reminderDate)}),!u.completed&&e.jsx(p,{as:"span",variant:"label",weight:"medium",tone:L||w==="high"?"error":"tertiary",className:H(u.content&&'before:content-["·"] before:mr-1'),children:k})]}),e.jsx(xe,{button:e.jsx(ge,{label:"Reminder actions"}),items:[{name:"Edit",onClick:()=>x(u)},{name:"Delete",onClick:()=>E(u.id,t)}]})]},u.id)})})})}),e.jsx(Ft,{isOpen:o,onClose:()=>r(!1),onSave:A,reminder:l,mode:c})]})}const Zt=({editor:t})=>e.jsx(G,{triggerCharacter:"/",getItems:async a=>bt([...Ie(t).filter(s=>s.title!=="Audio"&&s.title!=="Video"&&s.title!=="File"),{title:"Table of Contents",subtext:"Insert a table of contents based on headings",onItemClick:()=>{t.insertBlocks([{type:"tableOfContents"}],t.getTextCursorPosition().block,"after")},aliases:["toc","table of contents","contents","outline","index"],group:"Other",icon:e.jsx(ye,{})}],a)}),Ot=(t,a)=>a?t.filter(s=>s.id!==a):t,$t=({currentNoteId:t,onClick:a})=>e.jsx(G,{triggerCharacter:"[",getItems:async s=>{const o=await at({query:s,limit:5});return o.type==="error"?[]:Ot(o.allNotes.notes,t).map(c=>({title:c.title,onItemClick:()=>a({type:"reference",props:{id:c.id,title:c.title}})}))}}),Bt="pointer-events-auto inline-flex h-7 cursor-pointer select-none items-center gap-1.5 rounded-[8px] border border-white/10 bg-white/10 px-2.5 text-xs font-medium text-white/60 opacity-75 shadow-[0_8px_18px_-14px_rgba(0,0,0,0.45)] backdrop-blur-sm transition-colors hover:bg-white/20 hover:text-white/90 hover:opacity-100 focus-ring-soft focus:text-white/90 focus:opacity-100",It={idle:"",copied:"text-accent-success hover:text-accent-success focus:text-accent-success",failed:"text-fg-error hover:text-fg-error focus:text-fg-error"},Pt={idle:"Copy",copied:"Copied",failed:"Copy failed"},_t=({getText:t,resetDelayMs:a=2e3})=>{const[s,o]=n.useState("idle"),r=n.useRef(null),c=n.useCallback(()=>{r.current&&(clearTimeout(r.current),r.current=null)},[]),i=n.useCallback(()=>{c(),r.current=setTimeout(()=>{o("idle"),r.current=null},a)},[c,a]);n.useEffect(()=>c,[c]);const l=f=>{f.stopPropagation()},m=f=>{f.preventDefault(),f.stopPropagation()},j=async f=>{l(f);try{await navigator.clipboard.writeText(t()),o("copied")}catch{o("failed")}i()};return e.jsx("div",{className:"pointer-events-none absolute right-3 top-2 z-[1]",contentEditable:!1,onMouseDown:m,children:e.jsxs("button",{type:"button",className:H(Bt,It[s]),contentEditable:!1,onClick:j,children:[e.jsx(kt,{className:"h-3.5 w-3.5"}),e.jsx("span",{"aria-live":"polite",children:Pt[s]})]})})},Yt=({contentRef:t})=>{const a=n.useRef(null),s=n.useCallback(o=>{a.current=o,t(o)},[t]);return e.jsxs(e.Fragment,{children:[e.jsx("pre",{children:e.jsx("code",{ref:s})}),e.jsx(_t,{getText:()=>a.current?.textContent?.trimEnd()??""})]})},zt="_Reference_102im_1",Ut={Reference:zt},qt=be.bind(Ut),Kt={type:"reference",propSchema:{id:{default:""},title:{default:"Unknown"}},content:"none"};function Qt(t){const a=ve(),s=()=>{t.editor.blur(),a({to:J,params:{id:t.inlineContent.props.id}})},o=r=>{r.preventDefault(),r.stopPropagation()};return e.jsx("span",{role:"link",tabIndex:0,contentEditable:!1,className:qt("Reference"),onMouseDown:o,onClick:r=>{o(r),s()},onKeyDown:r=>{r.key!=="Enter"&&r.key!==" "||(o(r),s())},children:e.jsxs("span",{children:["[",t.inlineContent.props.title,"]"]})})}const Gt=me(Kt,{render:t=>e.jsx(Qt,{...t})}),Wt=()=>{const t=Pe(),[a,s]=n.useState([]),o={1:"pl-3",2:"pl-[26px]",3:"pl-[40px]",4:"pl-[54px]",5:"pl-[68px]",6:"pl-[82px]"};n.useEffect(()=>{const i=()=>{const m=t.document,j=[],f=E=>{for(const y of E){if(y.type==="heading"){const x=y,A=x.props.level||1,T=x.content?.map(S=>S.text||"").join("")||"";T.trim()&&j.push({id:y.id,level:A,text:T})}y.children&&Array.isArray(y.children)&&f(y.children)}};f(m),s(j)};i();const l=t.onChange?.(i);return()=>{l&&l()}},[t]);const r=i=>{t.setTextCursorPosition(i);const l=document.querySelector(`[data-id="${i}"]`);l&&l.scrollIntoView({behavior:"smooth",block:"center"})},c=e.jsx(te,{icon:e.jsx(ye,{className:"h-3.5 w-3.5"}),title:"Table of Contents",className:"text-fg-tertiary"});return a.length===0?e.jsxs("div",{className:"surface-base w-full p-4",children:[c,e.jsx(p,{as:"p",variant:"meta",tone:"secondary",className:"mt-2",children:"Add headings to your document to generate a table of contents"})]}):e.jsxs("div",{className:"surface-base w-full p-4",children:[e.jsx("div",{className:"mb-2",children:c}),e.jsx("nav",{className:"space-y-0.5",children:a.map(i=>{const l=i.level===1;return e.jsxs("button",{type:"button",onClick:()=>r(i.id),className:H("focus-ring-soft","flex","w-full","items-center","gap-2","rounded-[10px]","px-2.5","py-1.5",o[i.level]??"pl-2.5","text-left","transition-colors","hover:bg-hover-subtle",l?"text-fg-default":"text-fg-secondary"),children:[e.jsxs(p,{as:"span",variant:"label",weight:"medium",tone:"tertiary",className:"min-w-[1.5rem]",children:["H",i.level]}),e.jsx(p,{as:"span",variant:"body",weight:l?"semibold":"medium",className:"line-clamp-2 text-current",children:i.text})]},i.id)})})]})},Xt=ue({type:"tableOfContents",propSchema:{},content:"none"},{render:()=>e.jsx(Wt,{})})(),Jt="_Tag_1gb8h_1",ea={Tag:Jt},ta=be.bind(ea),aa={type:"tag",propSchema:{id:{default:""},tag:{default:"@Unknown"}},content:"none"};function na(t){const a=ve(),s=()=>{t.editor.blur(),a({to:nt,params:{id:t.inlineContent.props.id},search:{page:1}})},o=r=>{r.preventDefault(),r.stopPropagation()};return e.jsx("span",{role:"link",tabIndex:0,contentEditable:!1,className:ta("Tag"),onMouseDown:o,onClick:r=>{o(r),s()},onKeyDown:r=>{r.key!=="Enter"&&r.key!==" "||(o(r),s())},children:e.jsx("span",{children:t.inlineContent.props.tag})})}const sa=me(aa,{render:t=>e.jsx(na,{...t})}),ra=t=>t,oa=t=>t,la=ra({tag:sa,reference:Gt}),ia=oa({tableOfContents:Xt}),R=je.codeBlock,ce=ue(R.config,{meta:R.implementation.meta,parse:R.implementation.parse,parseContent:R.implementation.parseContent,runsBefore:R.implementation.runsBefore,render:Yt})(),ca={...ce,extensions:R.extensions,implementation:{...ce.implementation,toExternalHTML:R.implementation.toExternalHTML}},da=vt.create({inlineContentSpecs:{...jt,...la},blockSpecs:{...je,codeBlock:ca,...ia}}),ma=(t,a)=>a.some(s=>s.name===`@${t}`),ua=({onClick:t})=>e.jsx(G,{triggerCharacter:"@",getItems:async a=>{const s=await st({query:a,limit:5});if(s.type==="error")return[];const{tags:o}=s.allTags,r=ma(a,o),c=[{title:"Add a new tag",onItemClick:async()=>{const i=await rt({name:"@"+a});if(i.type==="error")return;const{id:l,name:m}=i.createTag;t({type:"tag",props:{id:l,tag:m}})}}];return o.length===0?c:o.map(i=>({title:i.name,onItemClick:()=>t({type:"tag",props:{id:i.id,tag:i.name}})})).concat(a&&!r?c:[])}}),pa=new Set(["tableOfContents"]),ha="OCEAN_BRAIN_TAG_",fa="_TOKEN",xa=t=>`${ha}${t}${fa}`,ga=t=>!Array.isArray(t)&&t?.type==="tableContent",ya=(t,a)=>Array.isArray(t)?t.map(a):ga(t)?{...t,rows:t.rows?.map(s=>({...s,cells:s.cells?.map(o=>({...o,content:o.content?.map(a)}))}))}:t,ke=(t,a)=>t.filter(s=>!pa.has(s.type)).map(s=>({...s,content:a(s.content),children:s.children?.length?ke(s.children,a):[]}));function ba(t){const a=new Map;let s=0;return{blocks:ke(t,r=>ya(r,c=>{if(c.type==="reference")return{type:"text",text:`[[${c.props?.title||c.props?.id||""}]]`,styles:{}};if(c.type==="tag"){const i=c.props?.tag||"",l=xa(s);return s+=1,a.set(l,i),{type:"text",text:l,styles:{}}}return c})),placeholderToTag:a}}function va(t,a){let s=t;for(const[o,r]of a.entries())s=s.split(o).join(`[${r}]`);return s}async function ja(t){return new Promise((a,s)=>{const o=new FileReader;o.readAsDataURL(t),o.onload=()=>a(o.result),o.onerror=r=>s(r)})}const wa=n.forwardRef(({content:t,currentNoteId:a,editable:s,onChange:o},r)=>{const{theme:c}=ot(l=>l),i=_e({schema:da,initialContent:t&&JSON.parse(t)||void 0,uploadFile:async l=>yt({base64:await ja(l)})},[]);return n.useImperativeHandle(r,()=>({getContent:()=>JSON.stringify(i.document),getMarkdown:()=>{const l=ba(i.document),m=i.blocksToMarkdownLossy(l.blocks);return va(m,l.placeholderToTag)},getHtml:()=>i.blocksToHTMLLossy(i.document)})),e.jsxs(Ye,{slashMenu:!1,theme:c,editor:i,editable:s,onChange:o,children:[e.jsx(Zt,{editor:i}),e.jsx($t,{currentNoteId:a,onClick:l=>{i.insertInlineContent([l," "])}}),e.jsx(ua,{onClick:l=>{i.insertInlineContent([l," "])}})]})}),Ca=/[:{}[\],&*#?|<>=!%@`-]/,Na=t=>t.trim().toLowerCase().replace(/\s+/g,"-").replace(/[\\/:*?"<>|]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")||"untitled-note",ka=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),O=t=>t?Ca.test(t)||/^\s|\s$/.test(t)?JSON.stringify(t):t:'""',$=t=>{if(!t)return;const a=Number(t);return Number.isFinite(a)?new Date(a).toISOString():t},z=(t,a)=>`${Na(t)}.${a}`,Ma=({id:t,title:a,createdAt:s,updatedAt:o})=>{const r=["---",`title: ${O(a)}`,`note_id: ${O(t)}`],c=$(s),i=$(o);return c&&r.push(`created_at: ${O(c)}`),i&&r.push(`updated_at: ${O(i)}`),r.push("source: ocean-brain","---"),r.join(`
2
+ `)},Ha=(t,a,s=!1)=>s?`${Ma(a)}
3
+
4
+ ${t}`:t,Ea=(t,a,{includeMetadata:s=!1,mode:o="fragment"}={})=>{const r=s?`<!--
5
+ source: ocean-brain
6
+ note_id: ${a.id}
7
+ title: ${a.title}
8
+ created_at: ${$(a.createdAt)??""}
9
+ updated_at: ${$(a.updatedAt)??""}
10
+ -->
11
+ `:"";return o==="fragment"?`${r}${t}`:`<!doctype html>
12
+ <html lang="ko">
13
+ <head>
14
+ <meta charset="utf-8" />
15
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
16
+ <title>${ka(a.title)}</title>
17
+ </head>
18
+ <body>
19
+ ${r}${t}
20
+ </body>
21
+ </html>`},U=(t,a,s)=>{const o=new Blob([t],{type:s}),r=URL.createObjectURL(o),c=document.createElement("a");c.href=r,c.download=a,document.body.appendChild(c),c.click(),c.remove(),URL.revokeObjectURL(r)},Me=lt(J),de=t=>N(Number(t)).format("YYYY-MM-DD HH:mm:ss"),q=()=>Lt(),Aa={narrow:"max-w-[640px]",wide:"max-w-[896px]",full:"max-w-full px-4"},Ta=e.jsx(ee,{title:"Loading note",variant:"none",children:e.jsxs("main",{className:"mx-auto max-w-[896px]",children:[e.jsx(V,{className:"mb-8",height:"66px"}),e.jsx(V,{className:"ml-12 mb-8",height:"150px"}),e.jsx(V,{className:"mb-5",height:"80px"}),e.jsx(V,{height:"80px"})]})});function Ra({id:t}){const a=pe(),s=Me.useNavigate(),o=n.useRef(null),r=n.useRef(null),c=n.useRef(q()),i=he({queryKey:M.notes.detail(t),queryFn:async()=>{const d=await it(t);if(d.type==="error")throw d;return d.note},gcTime:0}),l=i.data,[m,j]=n.useState(l.title),[f,E]=n.useState(()=>de(l.updatedAt)),[y,x]=n.useState(l.pinned),[A,T]=n.useState(l.layout||"wide"),[S,Z]=n.useState(!1),[B,h]=n.useState(!1),[b,u]=n.useState(!1),[w,k]=n.useState("markdown"),[L,He]=n.useState(!1),[I,ae]=n.useState("fragment"),[P,F]=n.useState(null),[Ee,Ae]=ct(1e3);n.useEffect(()=>{j(l.title),x(l.pinned),T(l.layout||"wide"),E(de(l.updatedAt))},[l.layout,l.pinned,l.title,l.updatedAt]),n.useEffect(()=>{c.current=q(),F(null)},[t]),n.useEffect(()=>{F(d=>d?.type==="updated"&&d.updatedAt===l.updatedAt?null:d)},[l.updatedAt]),n.useEffect(()=>dt(d=>{if(d.noteId===t){if(d.type==="mcp.note.updated"){if(d.updatedAt===l.updatedAt)return;F({type:"updated",updatedAt:d.updatedAt});return}d.type==="mcp.note.deleted"&&F({type:"deleted"})}}),[t,l.updatedAt]);const ne=async({title:d="",content:g=""})=>{Ae(async()=>{const re=await le({id:t,title:d,content:g,editSessionId:c.current});if(re.type==="error"){a(re.errors[0].message);return}j(d),E(N().format("YYYY-MM-DD HH:mm:ss"))})},se=()=>{ne({title:m,content:o.current?.getContent()})},Te=d=>{j(d),ne({title:d,content:o.current?.getContent()})},Re=async d=>{const g=await le({id:t,layout:d,editSessionId:c.current});if(g.type==="error"){a(g.errors[0].message);return}T(d),a("Layout has been updated.")},Se=()=>({id:t,title:m,createdAt:l.createdAt,updatedAt:l.updatedAt}),Ve=async()=>{const d=o.current?.getMarkdown();if(d===void 0){a("Markdown is not ready yet.");return}try{await navigator.clipboard.writeText(d),a("Copied note as Markdown.")}catch{a("Failed to copy Markdown.")}},Le=()=>{const d=o.current?.getMarkdown();if(d===void 0){a("Markdown is not ready yet.");return}try{U(d,z(m,"md"),"text/markdown;charset=utf-8"),a("Downloaded note as Markdown.")}catch{a("Failed to download Markdown.")}},Fe=()=>{const d=Se();try{if(w==="markdown"){const g=o.current?.getMarkdown();if(g===void 0){a("Markdown is not ready yet.");return}U(Ha(g,d,L),z(m,"md"),"text/markdown;charset=utf-8")}else{const g=o.current?.getHtml();if(g===void 0){a("HTML is not ready yet.");return}U(Ea(g,d,{includeMetadata:L,mode:I}),z(m,"html"),"text/html;charset=utf-8")}u(!1),a("Downloaded note.")}catch{a("Failed to download note.")}},De=async()=>{const d=await i.refetch();if(d.error||!d.data){a("Failed to reload the latest note state.");return}F(null)},{onCreate:Ze,onDelete:Oe,onPinned:$e,deleteWarningDialog:Be}=mt();return e.jsx(ee,{title:m,variant:"none",children:e.jsxs("main",{className:H("mx-auto",Aa[A]),children:[e.jsx("div",{className:"surface-floating sticky top-20 z-[1001] mb-7 px-5 pt-4 pb-3.5",children:e.jsxs("div",{className:"flex flex-col gap-3.5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-5",children:[e.jsxs("div",{className:"min-w-0 flex-1 pt-0.5",children:[e.jsx(p,{as:"div",variant:"micro",weight:"semibold",tracking:"widest",transform:"uppercase",tone:"tertiary",className:"mb-1.5",children:"Thought in progress"}),e.jsx("input",{ref:r,placeholder:"Title",className:"text-heading sm:text-display w-full bg-transparent font-semibold leading-[1.25] tracking-[-0.02em] outline-none",type:"text",value:m,onChange:d=>Te(d.target.value)})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx(xe,{button:e.jsx(ge,{label:"Note actions",size:"lg"}),items:[{name:"Copy Markdown",onClick:Ve},{name:"Download Markdown",onClick:Le},{name:"Download in another format",onClick:()=>u(!0)},{type:"separator",key:"export-separator"},{name:y?"Unpin":"Pin",onClick:()=>$e(t,y,()=>{x(d=>!d)})},{name:"Change layout",onClick:()=>Z(!0)},{type:"separator"},{name:"Clone this note",onClick:()=>Ze(r.current?.value||"untitled",o.current?.getContent()||"",A)},{name:"Restore previous version",onClick:()=>h(!0)},{type:"separator"},{name:"Delete",onClick:()=>Oe(t,()=>{s({to:oe,search:{page:1}})})}]}),e.jsx(C,{size:"sm",variant:"subtle",isLoading:Ee,onClick:se,children:"Save"})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-t border-border-subtle/80 pt-3",children:[y&&e.jsxs(p,{as:"span",variant:"label",weight:"medium",tone:"secondary",className:"inline-flex items-center gap-1.5",children:[e.jsx(ut,{className:"h-3 w-3",weight:"fill"}),"Pinned"]}),y&&e.jsx("span",{className:"h-1 w-1 rounded-full bg-border-secondary"}),e.jsxs(p,{as:"span",variant:"label",weight:"medium",tone:"secondary",children:["Last saved ",f]})]})]})}),P&&e.jsx(ht,{className:"mb-6",children:e.jsxs("div",{className:"flex w-full flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("span",{children:P.type==="updated"?"This note changed in MCP. Reload to review the latest version.":"This note was moved to trash from MCP. Open trash to review it."}),P.type==="updated"?e.jsx(C,{type:"button",size:"sm",variant:"subtle",className:"self-start",isLoading:i.isRefetching,onClick:De,children:"Reload"}):e.jsx(C,{type:"button",size:"sm",variant:"subtle",className:"self-start",onClick:()=>s({to:oe,search:{page:1}}),children:"Open trash"})]})}),e.jsx(wa,{ref:o,content:l.content,currentNoteId:t,onChange:se},`${t}:${l.updatedAt}`),e.jsx(K,{fallback:e.jsx(V,{className:"mb-5",height:"80px"}),errorTitle:"Failed to load reminders",errorDescription:"Retry loading reminder details for this note.",renderError:({error:d,retry:g})=>e.jsx(Q,{title:"Failed to load reminders",description:"Retry loading reminder details for this note.",error:d,onRetry:g,showBackAction:!1,showHomeAction:!1}),children:e.jsx(Dt,{noteId:t})}),e.jsx(K,{fallback:e.jsx(V,{height:"80px"}),errorTitle:"Failed to load back references",errorDescription:"Retry loading notes that link back here.",renderError:({error:d,retry:g})=>e.jsx(Q,{title:"Failed to load back references",description:"Retry loading notes that link back here.",error:d,onRetry:g,showBackAction:!1,showHomeAction:!1}),children:e.jsx(St,{noteId:t,render:d=>d&&d.length>0&&e.jsxs("div",{className:"surface-base p-4",children:[e.jsx(te,{icon:e.jsx(Ht,{className:"h-3.5 w-3.5"}),title:"Back References",className:"mb-3 text-fg-tertiary"}),e.jsx("ul",{className:"flex flex-col",children:d.map(g=>e.jsx("li",{children:e.jsxs(pt,{to:J,params:{id:g.id},className:"flex items-center gap-2 rounded-[10px] px-2.5 py-1.5 text-fg-secondary transition-colors hover:bg-hover-subtle hover:text-fg-default",children:[e.jsx(Mt,{className:"h-3.5 w-3.5 shrink-0 text-fg-tertiary"}),e.jsx(p,{as:"span",variant:"body",weight:"medium",className:"text-current",children:g.title})]})},g.id))})]})})}),e.jsx(At,{isOpen:S,onClose:()=>Z(!1),onSave:Re,currentLayout:A}),e.jsxs(v,{isOpen:b,onClose:()=>u(!1),variant:"compact",children:[e.jsx(v.Header,{title:"Download in another format",onClose:()=>u(!1)}),e.jsx(v.Body,{children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(p,{as:"div",variant:"body",weight:"semibold",tone:"secondary",children:"Format"}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[e.jsx(D,{title:"Markdown",description:"Good for GitHub, static blogs, and other note apps.",selected:w==="markdown",onClick:()=>k("markdown")}),e.jsx(D,{title:"HTML",description:"Good for web documents or CMS editors.",selected:w==="html",onClick:()=>k("html")})]})]}),e.jsxs("div",{className:"flex items-start gap-3 rounded-[14px] border border-border-subtle bg-subtle/60 p-3",children:[e.jsx(fe,{size:"sm",checked:L,onChange:d=>He(d.target.checked),className:"mt-0.5","aria-label":"Include metadata"}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(p,{as:"span",variant:"body",weight:"semibold",children:"Include metadata"}),e.jsx(p,{as:"span",variant:"label",tone:"tertiary",children:"Add the title, note id, timestamps, and Ocean Brain source information."})]})]}),w==="html"&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(p,{as:"div",variant:"body",weight:"semibold",tone:"secondary",children:"HTML style"}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[e.jsx(D,{title:"Content only",description:"Save only the note body HTML.",selected:I==="fragment",onClick:()=>ae("fragment")}),e.jsx(D,{title:"Full HTML document",description:"Save a complete HTML file that opens in a browser.",selected:I==="standalone",onClick:()=>ae("standalone")})]})]})]})}),e.jsx(v.Footer,{children:e.jsxs(X,{children:[e.jsx(C,{variant:"ghost",size:"sm",onClick:()=>u(!1),children:"Cancel"}),e.jsx(C,{variant:"primary",size:"sm",onClick:Fe,children:"Download"})]})})]}),e.jsx(Rt,{isOpen:B,noteId:t,onClose:()=>h(!1),onRestored:()=>{c.current=q()}}),Be]})})}function Ba(){const{id:t}=Me.useParams();if(!t)throw new Error("Note id is required.");return e.jsx(K,{fallback:Ta,errorTitle:"Failed to load note",errorDescription:"Retry loading the note editor.",resetKeys:[t],renderError:({error:a,retry:s})=>e.jsx(ee,{title:"Note",variant:"none",children:e.jsx(Q,{title:"Failed to load note",description:"Retry loading the note editor.",error:a,onRetry:s})}),children:e.jsx(Ra,{id:t},t)})}export{Ba as default};
@@ -0,0 +1 @@
1
+ import{a as e}from"./graph-vendor-CUxe67Lr.js";import{p as l}from"./index-B4l2UvuC.js";const r=new Map([["bold",e.createElement(e.Fragment,null,e.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z"}))],["duotone",e.createElement(e.Fragment,null,e.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),e.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"}))],["fill",e.createElement(e.Fragment,null,e.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z"}))],["light",e.createElement(e.Fragment,null,e.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z"}))],["regular",e.createElement(e.Fragment,null,e.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"}))],["thin",e.createElement(e.Fragment,null,e.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z"}))]]),a=e.forwardRef((t,n)=>e.createElement(l,{ref:n,...t,weights:r}));a.displayName="PlusIcon";const c=a;export{c as n};
@@ -0,0 +1 @@
1
+ import{j as e}from"./note-vendor-B0t5F04o.js";import{_ as k,T as h,L as H,N as M,D as E,k as L,d as x,$ as S,P as w,F as O,a0 as C,i as o,j as U,a1 as I}from"./index-B4l2UvuC.js";import"./graph-vendor-CUxe67Lr.js";import{u as P,R as Y}from"./useReminderMutate-v1EXqM90.js";import"./note-core-GgFcksAF.js";const u={high:"bg-priority-high",medium:"bg-priority-medium",low:"bg-priority-low"};function B({reminder:t,onUpdate:l,onDelete:g}){const f=y=>{const r=x(Number(y)),m=x();return r.isSame(m,"day")?`Today at ${r.format("HH:mm")}`:r.isSame(m.add(1,"day"),"day")?`Tomorrow at ${r.format("HH:mm")}`:r.format("YYYY-MM-DD HH:mm")},a=y=>{const r=x(Number(y)),m=x(),N=r.diff(m,"hour"),b=r.diff(m,"minute")%60;return N<0||b<0?"Overdue":N===0?`${b}m remaining`:`${N}h ${b}m remaining`},d=a(t.reminderDate)==="Overdue",i=t.priority||"low",s=i==="high"?"High":i==="medium"?"Medium":"Low",p=u[i],c=t.noteId.toString(),n=d?"text-fg-error":"text-fg-tertiary",j=t.content?.trim()||t.note?.title||"Untitled reminder",R=t.note?.title||"Untitled note",T=!!(t.content?.trim()&&t.note?.title),D=a(t.reminderDate),$=f(t.reminderDate);return e.jsxs("div",{className:"surface-base flex flex-col gap-2.5 px-4 py-3 sm:flex-row sm:items-center sm:gap-4",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-2.5 sm:items-center",children:[e.jsx(k,{checked:t.completed,onChange:()=>l(t.id,c,{completed:!t.completed}),size:"sm"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(h,{as:"p",variant:"body",weight:"semibold",className:t.completed?"truncate line-through opacity-45":"truncate",children:j}),T&&e.jsx(h,{as:"div",variant:"meta",tone:"secondary",className:t.completed?"mt-0.5 truncate opacity-45":"mt-0.5 truncate",children:e.jsx(H,{to:M,params:{id:String(t.note?.id??t.noteId)},className:"transition-colors hover:text-fg-default hover:underline",children:R})})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 sm:shrink-0",children:[e.jsx("span",{className:`h-3 w-3 shrink-0 rounded-full border border-border-subtle ${p}`,"aria-label":`${s} priority`,title:`${s} priority`}),e.jsx(h,{as:"span",variant:"meta",weight:"medium",tone:"secondary",className:t.completed?"opacity-45":void 0,children:$}),e.jsx("span",{className:"h-1 w-1 rounded-full bg-border-secondary"}),e.jsx(h,{as:"span",variant:"label",weight:"medium",className:t.completed?"opacity-45":n,children:D})]}),e.jsx("div",{className:"flex items-center justify-end gap-1.5 sm:shrink-0",children:e.jsx(E,{button:e.jsx(L,{label:"Reminder actions",iconClassName:"h-5 w-5 text-current"}),items:[{name:"Delete",onClick:()=>g(t.id,c)}]})})]})}const v=U(I),_=[{label:"High",className:u.high},{label:"Medium",className:u.medium},{label:"Low",className:u.low}];function q(){const t=v.useNavigate(),{page:l}=v.useSearch(),{onUpdate:g,onDelete:f}=P(),a=25,d=e.jsx("div",{className:"flex flex-wrap items-center gap-3",children:_.map(({label:i,className:s})=>e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`h-2.5 w-2.5 rounded-full border border-border-subtle ${s}`,"aria-hidden":"true"}),e.jsx(h,{as:"span",variant:"label",weight:"medium",tone:"tertiary",children:i})]},i))});return e.jsx(S,{fallback:e.jsx(w,{title:"Reminders",heading:e.jsx(o,{width:164,height:24,className:"rounded-full"}),description:e.jsx(o,{width:224,height:16,className:"rounded-full"}),headerRight:d,children:e.jsxs("div",{className:"flex flex-col gap-2.5",children:[e.jsx(o,{height:"60px"}),e.jsx(o,{height:"60px"}),e.jsx(o,{height:"60px"}),e.jsx(o,{height:"60px"})]})}),errorTitle:"Failed to load reminders",errorDescription:"Retry loading the upcoming reminder list",resetKeys:[l,a],children:e.jsx(Y,{searchParams:{offset:(l-1)*a,limit:a},render:({reminders:i,totalCount:s})=>{const p=s>0?`Reminders (${s})`:void 0,c="Review reminders created from notes and mark them complete here";return i.length===0?e.jsx(w,{title:"Reminders",heading:p,description:c,headerRight:d,children:e.jsx(O,{title:"No upcoming reminders",description:"Add a reminder inside any note to see it here"})}):e.jsx(w,{title:"Reminders",heading:p,description:c,headerRight:d,children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"flex flex-col gap-2.5",children:i.map(n=>e.jsx(B,{reminder:n,onUpdate:g,onDelete:f},n.id))}),s&&a<s&&e.jsx(C,{page:l,last:Math.ceil(s/a),onChange:n=>{t({search:j=>({...j,page:n})})}})]})})}})})}export{q as default};
@@ -0,0 +1 @@
1
+ import{j as e}from"./note-vendor-B0t5F04o.js";import{P as m,F as f,$ as N,a8 as b,T as h,L as w,N as S,a0 as k,j as E,a9 as $,i as d}from"./index-B4l2UvuC.js";import{a as R}from"./graph-vendor-CUxe67Lr.js";import"./note-core-GgFcksAF.js";const L=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),g=({children:t,match:s})=>{const r=s.trim();if(!r)return e.jsx("span",{children:t});const a=L(r),n=new RegExp(`(${a})`,"gi"),c=new RegExp(`^${a}$`,"i"),l=t.split(n);return e.jsx("span",{children:l.map((i,o)=>c.test(i)?e.jsx("mark",{children:i},o):e.jsx(R.Fragment,{children:i},o))})},j=E($),v=180,x=t=>t.replace(/\s+/g," ").trim(),T=(t,s)=>{const r=x(t),a=x(s).toLowerCase();if(!a)return r;const n=r.toLowerCase().indexOf(a);if(n===-1)return r.length>v?`${r.slice(0,v-1).trimEnd()}…`:r;const c=Math.max(0,n-56),l=Math.min(r.length,n+a.length+84);let i=r.slice(c,l).trim();return c>0&&(i=`…${i}`),l<r.length&&(i=`${i}…`),i},A=t=>Array.isArray(t)?t.map(s=>{if(!s||typeof s!="object")return"";const r=s.text;return typeof r=="string"?r:""}).join(""):"",B=(t,s)=>t==="heading"?`Heading ${typeof s?.level=="number"?s.level:1}`:t==="bulletListItem"?"Bullet":t==="numberedListItem"?"Numbered":t==="checkListItem"?"Checklist":t==="quote"?"Quote":t==="codeBlock"?"Code":"Content",y=(t,s)=>{Array.isArray(t)&&t.forEach(r=>{if(!r||typeof r!="object")return;const a=typeof r.type=="string"?r.type:void 0,n=typeof r.props=="object"&&r.props?r.props:void 0,c=x(A(r.content));c&&s.push({label:B(a,n),text:c});const l=r.children;Array.isArray(l)&&y(l,s)})},C=(t,s)=>{try{const r=JSON.parse(t),a=[];if(y(r,a),a.length===0)return[];const n=x(s).toLowerCase(),c=n?a.filter(i=>i.text.toLowerCase().includes(n)):a;return(c.length>0?c:a).slice(0,2).map(i=>({...i,text:T(i.text,s)}))}catch{return[]}},P=t=>t===1?"1 result":`${t} results`,M=()=>"Open the note to inspect matching content.",z=(t,s)=>`${P(s)} for "${t}"`,I=()=>e.jsx(m,{title:"Search",variant:"default",description:e.jsx(d,{width:208,height:16,className:"rounded-full"}),children:e.jsx("main",{className:"flex flex-col gap-3",children:Array.from({length:2},(t,s)=>e.jsxs("div",{className:"surface-base flex flex-col gap-3 p-4",children:[e.jsx(d,{width:"34%",height:18,className:"rounded-full"}),e.jsx("div",{className:"rounded-[14px] bg-muted px-3 py-3",children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{children:[e.jsx(d,{width:84,height:12,className:"rounded-full"}),e.jsx(d,{width:"100%",height:14,className:"mt-2 rounded-full"}),e.jsx(d,{width:"82%",height:14,className:"mt-1.5 rounded-full"})]}),e.jsxs("div",{className:"border-t border-border-subtle pt-2",children:[e.jsx(d,{width:72,height:12,className:"rounded-full"}),e.jsx(d,{width:"94%",height:14,className:"mt-2 rounded-full"})]})]})})]},s))})});function F(){const t=j.useNavigate(),{page:s,query:r}=j.useSearch(),a=r.trim(),n=10;return a?e.jsx(N,{fallback:e.jsx(I,{}),errorTitle:"Failed to load search results",errorDescription:`Retry loading results for "${a}".`,resetKeys:[a,s],children:e.jsx(b,{searchParams:{query:a,limit:n,offset:(s-1)*n,fields:["content"]},render:({notes:c,totalCount:l})=>e.jsx(m,{title:"Search",description:z(a,l),variant:"default",children:e.jsxs("main",{className:"flex flex-col gap-4",children:[c.length>0?e.jsx("div",{className:"flex flex-col gap-3",children:c.map(i=>{const o=C(i.content,a);return e.jsxs("article",{className:"surface-base flex flex-col gap-3 p-4",children:[e.jsx(h,{as:"h2",variant:"body",weight:"semibold",tracking:"tight",children:e.jsx(w,{to:S,params:{id:i.id},className:"transition-colors hover:text-fg-default/85",children:e.jsx(g,{match:a,children:i.title||"Untitled"})})}),o.length>0?e.jsx("div",{className:"rounded-[14px] bg-muted px-3 py-3",children:e.jsx("div",{className:"flex flex-col gap-2",children:o.map((u,p)=>e.jsxs("div",{className:p>0?"border-t border-border-subtle pt-2":void 0,children:[e.jsx(h,{as:"div",variant:"micro",weight:"semibold",tracking:"wider",transform:"uppercase",tone:"tertiary",children:u.label}),e.jsx(h,{as:"p",variant:"meta",tone:"secondary",className:"mt-1 leading-[1.65]",children:e.jsx(g,{match:a,children:u.text})})]},`${i.id}:${u.label}:${p}`))})}):e.jsx(h,{as:"p",variant:"meta",tone:"secondary",className:"leading-[1.65]",children:M()})]},i.id)})}):e.jsx(f,{title:"No results found",description:"Try searching for a different word or phrase"}),l>n&&e.jsx(k,{page:s,last:Math.ceil(l/n),onChange:i=>{t({search:o=>({...o,page:i})})}})]})})})}):e.jsx(m,{title:"Search",description:"Search note titles and matching sections across your workspace",variant:"default",children:e.jsx("main",{children:e.jsx(f,{title:"Start searching",description:"Enter a keyword to look through note titles and matching content"})})})}export{F as default};
@@ -1 +1 @@
1
- import{j as f}from"./note-vendor-5N5mRkIT.js";import{aM as o}from"./index-Bsx4P7EA.js";const n=o("surface-base",{variants:{tone:{default:"",elevated:"surface-elevated"},padding:{default:"p-4",compact:"px-3 py-2.5",roomy:"p-6",flush:"overflow-hidden"}},defaultVariants:{tone:"default",padding:"default"}});function i({children:a,className:e,flush:t=!1,padding:d="default",tone:s="default"}){const r=t?"flush":d;return f.jsx("div",{className:n({tone:s,padding:r,className:e}),children:a})}export{i as S};
1
+ import{j as f}from"./note-vendor-B0t5F04o.js";import{aP as o}from"./index-B4l2UvuC.js";const n=o("surface-base",{variants:{tone:{default:"",elevated:"surface-elevated"},padding:{default:"p-4",compact:"px-3 py-2.5",roomy:"p-6",flush:"overflow-hidden"}},defaultVariants:{tone:"default",padding:"default"}});function i({children:a,className:e,flush:t=!1,padding:d="default",tone:s="default"}){const r=t?"flush":d;return f.jsx("div",{className:n({tone:s,padding:r,className:e}),children:a})}export{i as S};
@@ -0,0 +1 @@
1
+ import{j as e}from"./note-vendor-B0t5F04o.js";import{a5 as p,x as m,q as u,aa as f,$ as j,P as h,ab as o,L as y,ac as T,T as c,a0 as w,F as b,i as a,j as v,ad as N}from"./index-B4l2UvuC.js";import"./graph-vendor-CUxe67Lr.js";import"./note-core-GgFcksAF.js";const R=s=>{const{data:t}=p({queryKey:u.tags.list(s.searchParams),async queryFn(){const i=await m({offset:s.searchParams.offset,limit:s.searchParams.limit});if(i.type==="error")throw i;return i.allTags}});return s.render(t)},A=100,P=8,G=12,x=v(N);function q(){const s=x.useNavigate(),{page:t}=x.useSearch(),{containerRef:i,limit:n}=f({minItemWidth:A,gap:P,rows:G});return e.jsx("div",{ref:i,children:e.jsx(j,{fallback:e.jsx(h,{title:"Tags",heading:e.jsx(a,{width:120,height:24,className:"rounded-full"}),description:e.jsx(a,{width:188,height:16,className:"rounded-full"}),children:e.jsxs("div",{className:"flex flex-wrap gap-2.5",children:[e.jsx(a,{width:"90px",height:"36px"}),e.jsx(a,{width:"120px",height:"36px"}),e.jsx(a,{width:"80px",height:"36px"}),e.jsx(a,{width:"100px",height:"36px"}),e.jsx(a,{width:"110px",height:"36px"}),e.jsx(a,{width:"70px",height:"36px"})]})}),errorTitle:"Failed to load tags",errorDescription:"Retry loading the tag catalog",resetKeys:[t,n],children:e.jsx(R,{searchParams:{offset:(t-1)*n,limit:n},render:({tags:l,totalCount:d})=>e.jsx(h,{title:"Tags",heading:d>0?`Tags (${d})`:void 0,description:"Browse the tags you added with @ across your notes",children:e.jsx(o,{fallback:e.jsx(b,{title:"No tags yet",description:"Add @tags inside notes and they will appear here"}),children:l.length>0&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"flex flex-wrap gap-2.5",children:l.map(r=>e.jsxs(y,{to:T,params:{id:r.id},search:{page:1},className:"inline-flex items-center gap-1.5 rounded-full border border-border-subtle bg-hover-subtle px-3 py-1.5 text-fg-secondary transition-colors hover:border-border-secondary hover:bg-hover hover:text-fg-default",children:[e.jsx(c,{as:"span",variant:"meta",weight:"medium",className:"text-current",children:r.name}),e.jsx(c,{as:"span",variant:"label",weight:"medium",tone:"tertiary",className:"text-current/70",children:r.referenceCount})]},r.id))}),e.jsx(o,{fallback:null,children:d&&n<d&&e.jsx(w,{page:t,last:Math.ceil(d/n),onChange:r=>{s({search:g=>({...g,page:r})})}})})]})})})})})})}export{q as default};
@@ -0,0 +1 @@
1
+ import{j as e}from"./note-vendor-B0t5F04o.js";import{a5 as j,au as p,q as y,aq as N,$ as P,P as c,ab as h,av as T,a0 as v,F as q,i as d,j as w,ac as b}from"./index-B4l2UvuC.js";import"./graph-vendor-CUxe67Lr.js";import"./note-core-GgFcksAF.js";const k=s=>{const{data:r}=j({queryKey:y.notes.tagList(s.searchParams),async queryFn(){const t=await p({query:s.searchParams.query,offset:s.searchParams.offset,limit:s.searchParams.limit});if(t.type==="error")throw t;return t.tagNotes}});return s.render(r)},g=w(b);function S(){const s=g.useNavigate(),{id:r}=g.useParams(),{page:t}=g.useSearch(),i=25,{onDelete:u,onPinned:m,deleteWarningDialog:x}=N();return e.jsxs(P,{fallback:e.jsx(c,{title:"Tagged Notes",heading:e.jsx(d,{width:148,height:24,className:"rounded-full"}),description:e.jsx(d,{width:196,height:16,className:"rounded-full"}),variant:"default",children:e.jsxs("div",{className:"grid-auto-cards grid gap-5",children:[e.jsx(d,{height:"112px"}),e.jsx(d,{height:"112px"}),e.jsx(d,{height:"112px"})]})}),errorTitle:"Failed to load tagged notes",errorDescription:"Retry loading notes for this tag",resetKeys:[r,t,i],children:[e.jsx(k,{searchParams:{query:r,offset:(t-1)*i,limit:i},render:({notes:o,totalCount:n})=>{const l=o.flatMap(a=>a.tags).find(a=>a.id===r)?.name;return e.jsx(c,{title:l??"Tagged Notes",heading:l?n>0?`${l} (${n})`:l:"Tagged Notes",description:"Browse every note linked to this tag",variant:"default",children:e.jsx(h,{fallback:e.jsx(q,{title:"No tagged notes yet",description:"Notes tagged with this label will appear here"}),children:o.length>0&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"grid-auto-cards grid gap-5",children:o.map(a=>e.jsx(T,{...a,onPinned:()=>m(a.id,a.pinned),onDelete:()=>u(a.id)},a.id))}),e.jsx(h,{fallback:null,children:n&&i<n&&e.jsx(v,{page:t,last:Math.ceil(n/i),onChange:a=>{s({search:f=>({...f,page:a})})}})})]})})})}}),x]})}export{S as default};
@@ -1 +1 @@
1
- import{a}from"./graph-vendor-CUxe67Lr.js";import{p as l}from"./index-Bsx4P7EA.js";const r=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M117.18,188.74a12,12,0,0,1,0,17l-5.12,5.12A58.26,58.26,0,0,1,70.6,228h0A58.62,58.62,0,0,1,29.14,127.92L63.89,93.17a58.64,58.64,0,0,1,98.56,28.11,12,12,0,1,1-23.37,5.44,34.65,34.65,0,0,0-58.22-16.58L46.11,144.89A34.62,34.62,0,0,0,70.57,204h0a34.41,34.41,0,0,0,24.49-10.14l5.11-5.12A12,12,0,0,1,117.18,188.74ZM226.83,45.17a58.65,58.65,0,0,0-82.93,0l-5.11,5.11a12,12,0,0,0,17,17l5.12-5.12a34.63,34.63,0,1,1,49,49L175.1,145.86A34.39,34.39,0,0,1,150.61,156h0a34.63,34.63,0,0,1-33.69-26.72,12,12,0,0,0-23.38,5.44A58.64,58.64,0,0,0,150.56,180h.05a58.28,58.28,0,0,0,41.47-17.17l34.75-34.75a58.62,58.62,0,0,0,0-82.91Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M218.34,119.6,183.6,154.34a46.58,46.58,0,0,1-44.31,12.26c-.31.34-.62.67-.95,1L103.6,202.34A46.63,46.63,0,1,1,37.66,136.4L72.4,101.66A46.6,46.6,0,0,1,116.71,89.4c.31-.34.62-.67,1-1L152.4,53.66a46.63,46.63,0,0,1,65.94,65.94Z",opacity:"0.2"}),a.createElement("path",{d:"M240,88.23a54.43,54.43,0,0,1-16,37L189.25,160a54.27,54.27,0,0,1-38.63,16h-.05A54.63,54.63,0,0,1,96,119.84a8,8,0,0,1,16,.45A38.62,38.62,0,0,0,150.58,160h0a38.39,38.39,0,0,0,27.31-11.31l34.75-34.75a38.63,38.63,0,0,0-54.63-54.63l-11,11A8,8,0,0,1,135.7,59l11-11A54.65,54.65,0,0,1,224,48,54.86,54.86,0,0,1,240,88.23ZM109,185.66l-11,11A38.41,38.41,0,0,1,70.6,208h0a38.63,38.63,0,0,1-27.29-65.94L78,107.31A38.63,38.63,0,0,1,144,135.71a8,8,0,0,0,7.78,8.22H152a8,8,0,0,0,8-7.78A54.86,54.86,0,0,0,144,96a54.65,54.65,0,0,0-77.27,0L32,130.75A54.62,54.62,0,0,0,70.56,224h0a54.28,54.28,0,0,0,38.64-16l11-11A8,8,0,0,0,109,185.66Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM115.7,192.49a43.31,43.31,0,0,1-55-66.43l25.37-25.37a43.35,43.35,0,0,1,61.25,0,42.9,42.9,0,0,1,9.95,15.43,8,8,0,1,1-15,5.6A27.33,27.33,0,0,0,97.37,112L72,137.37a27.32,27.32,0,0,0,34.68,41.91,8,8,0,1,1,9,13.21Zm79.61-62.55-25.37,25.37A43,43,0,0,1,139.32,168h0a43.35,43.35,0,0,1-40.53-28.12,8,8,0,1,1,15-5.6A27.35,27.35,0,0,0,139.28,152h0a27.14,27.14,0,0,0,19.32-8L184,118.63a27.32,27.32,0,0,0-34.68-41.91,8,8,0,1,1-9-13.21,43.32,43.32,0,0,1,55,66.43Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M238,88.18a52.42,52.42,0,0,1-15.4,35.66l-34.75,34.75A52.28,52.28,0,0,1,150.62,174h-.05A52.63,52.63,0,0,1,98,119.9a6,6,0,0,1,6-5.84h.17a6,6,0,0,1,5.83,6.16A40.62,40.62,0,0,0,150.58,162h0a40.4,40.4,0,0,0,28.73-11.9l34.75-34.74A40.63,40.63,0,0,0,156.63,57.9l-11,11a6,6,0,0,1-8.49-8.49l11-11a52.62,52.62,0,0,1,74.43,0A52.83,52.83,0,0,1,238,88.18Zm-127.62,98.9-11,11A40.36,40.36,0,0,1,70.6,210h0a40.63,40.63,0,0,1-28.7-69.36L76.62,105.9A40.63,40.63,0,0,1,146,135.77a6,6,0,0,0,5.83,6.16H152a6,6,0,0,0,6-5.84A52.63,52.63,0,0,0,68.14,97.42L33.38,132.16A52.63,52.63,0,0,0,70.56,222h0a52.26,52.26,0,0,0,37.22-15.42l11-11a6,6,0,1,0-8.49-8.48Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M240,88.23a54.43,54.43,0,0,1-16,37L189.25,160a54.27,54.27,0,0,1-38.63,16h-.05A54.63,54.63,0,0,1,96,119.84a8,8,0,0,1,16,.45A38.62,38.62,0,0,0,150.58,160h0a38.39,38.39,0,0,0,27.31-11.31l34.75-34.75a38.63,38.63,0,0,0-54.63-54.63l-11,11A8,8,0,0,1,135.7,59l11-11A54.65,54.65,0,0,1,224,48,54.86,54.86,0,0,1,240,88.23ZM109,185.66l-11,11A38.41,38.41,0,0,1,70.6,208h0a38.63,38.63,0,0,1-27.29-65.94L78,107.31A38.63,38.63,0,0,1,144,135.71a8,8,0,0,0,16,.45A54.86,54.86,0,0,0,144,96a54.65,54.65,0,0,0-77.27,0L32,130.75A54.62,54.62,0,0,0,70.56,224h0a54.28,54.28,0,0,0,38.64-16l11-11A8,8,0,0,0,109,185.66Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M236,88.12a50.44,50.44,0,0,1-14.81,34.31l-34.75,34.74A50.33,50.33,0,0,1,150.62,172h-.05A50.63,50.63,0,0,1,100,120a4,4,0,0,1,4-3.89h.11a4,4,0,0,1,3.89,4.11A42.64,42.64,0,0,0,150.58,164h0a42.32,42.32,0,0,0,30.14-12.49l34.75-34.74a42.63,42.63,0,1,0-60.29-60.28l-11,11a4,4,0,0,1-5.66-5.65l11-11A50.64,50.64,0,0,1,236,88.12ZM111.78,188.49l-11,11A42.33,42.33,0,0,1,70.6,212h0a42.63,42.63,0,0,1-30.11-72.77l34.75-34.74A42.63,42.63,0,0,1,148,135.82a4,4,0,0,0,8,.23A50.64,50.64,0,0,0,69.55,98.83L34.8,133.57A50.63,50.63,0,0,0,70.56,220h0a50.33,50.33,0,0,0,35.81-14.83l11-11a4,4,0,1,0-5.65-5.66Z"}))]]),m=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z",opacity:"0.2"}),a.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z"}))]]),n=a.forwardRef((e,t)=>a.createElement(l,{ref:t,...e,weights:r}));n.displayName="LinkIcon";const V=n,h=a.forwardRef((e,t)=>a.createElement(l,{ref:t,...e,weights:m}));h.displayName="TrashIcon";const Z=h;export{V as c,Z as n};
1
+ import{a}from"./graph-vendor-CUxe67Lr.js";import{p as l}from"./index-B4l2UvuC.js";const r=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M117.18,188.74a12,12,0,0,1,0,17l-5.12,5.12A58.26,58.26,0,0,1,70.6,228h0A58.62,58.62,0,0,1,29.14,127.92L63.89,93.17a58.64,58.64,0,0,1,98.56,28.11,12,12,0,1,1-23.37,5.44,34.65,34.65,0,0,0-58.22-16.58L46.11,144.89A34.62,34.62,0,0,0,70.57,204h0a34.41,34.41,0,0,0,24.49-10.14l5.11-5.12A12,12,0,0,1,117.18,188.74ZM226.83,45.17a58.65,58.65,0,0,0-82.93,0l-5.11,5.11a12,12,0,0,0,17,17l5.12-5.12a34.63,34.63,0,1,1,49,49L175.1,145.86A34.39,34.39,0,0,1,150.61,156h0a34.63,34.63,0,0,1-33.69-26.72,12,12,0,0,0-23.38,5.44A58.64,58.64,0,0,0,150.56,180h.05a58.28,58.28,0,0,0,41.47-17.17l34.75-34.75a58.62,58.62,0,0,0,0-82.91Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M218.34,119.6,183.6,154.34a46.58,46.58,0,0,1-44.31,12.26c-.31.34-.62.67-.95,1L103.6,202.34A46.63,46.63,0,1,1,37.66,136.4L72.4,101.66A46.6,46.6,0,0,1,116.71,89.4c.31-.34.62-.67,1-1L152.4,53.66a46.63,46.63,0,0,1,65.94,65.94Z",opacity:"0.2"}),a.createElement("path",{d:"M240,88.23a54.43,54.43,0,0,1-16,37L189.25,160a54.27,54.27,0,0,1-38.63,16h-.05A54.63,54.63,0,0,1,96,119.84a8,8,0,0,1,16,.45A38.62,38.62,0,0,0,150.58,160h0a38.39,38.39,0,0,0,27.31-11.31l34.75-34.75a38.63,38.63,0,0,0-54.63-54.63l-11,11A8,8,0,0,1,135.7,59l11-11A54.65,54.65,0,0,1,224,48,54.86,54.86,0,0,1,240,88.23ZM109,185.66l-11,11A38.41,38.41,0,0,1,70.6,208h0a38.63,38.63,0,0,1-27.29-65.94L78,107.31A38.63,38.63,0,0,1,144,135.71a8,8,0,0,0,7.78,8.22H152a8,8,0,0,0,8-7.78A54.86,54.86,0,0,0,144,96a54.65,54.65,0,0,0-77.27,0L32,130.75A54.62,54.62,0,0,0,70.56,224h0a54.28,54.28,0,0,0,38.64-16l11-11A8,8,0,0,0,109,185.66Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM115.7,192.49a43.31,43.31,0,0,1-55-66.43l25.37-25.37a43.35,43.35,0,0,1,61.25,0,42.9,42.9,0,0,1,9.95,15.43,8,8,0,1,1-15,5.6A27.33,27.33,0,0,0,97.37,112L72,137.37a27.32,27.32,0,0,0,34.68,41.91,8,8,0,1,1,9,13.21Zm79.61-62.55-25.37,25.37A43,43,0,0,1,139.32,168h0a43.35,43.35,0,0,1-40.53-28.12,8,8,0,1,1,15-5.6A27.35,27.35,0,0,0,139.28,152h0a27.14,27.14,0,0,0,19.32-8L184,118.63a27.32,27.32,0,0,0-34.68-41.91,8,8,0,1,1-9-13.21,43.32,43.32,0,0,1,55,66.43Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M238,88.18a52.42,52.42,0,0,1-15.4,35.66l-34.75,34.75A52.28,52.28,0,0,1,150.62,174h-.05A52.63,52.63,0,0,1,98,119.9a6,6,0,0,1,6-5.84h.17a6,6,0,0,1,5.83,6.16A40.62,40.62,0,0,0,150.58,162h0a40.4,40.4,0,0,0,28.73-11.9l34.75-34.74A40.63,40.63,0,0,0,156.63,57.9l-11,11a6,6,0,0,1-8.49-8.49l11-11a52.62,52.62,0,0,1,74.43,0A52.83,52.83,0,0,1,238,88.18Zm-127.62,98.9-11,11A40.36,40.36,0,0,1,70.6,210h0a40.63,40.63,0,0,1-28.7-69.36L76.62,105.9A40.63,40.63,0,0,1,146,135.77a6,6,0,0,0,5.83,6.16H152a6,6,0,0,0,6-5.84A52.63,52.63,0,0,0,68.14,97.42L33.38,132.16A52.63,52.63,0,0,0,70.56,222h0a52.26,52.26,0,0,0,37.22-15.42l11-11a6,6,0,1,0-8.49-8.48Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M240,88.23a54.43,54.43,0,0,1-16,37L189.25,160a54.27,54.27,0,0,1-38.63,16h-.05A54.63,54.63,0,0,1,96,119.84a8,8,0,0,1,16,.45A38.62,38.62,0,0,0,150.58,160h0a38.39,38.39,0,0,0,27.31-11.31l34.75-34.75a38.63,38.63,0,0,0-54.63-54.63l-11,11A8,8,0,0,1,135.7,59l11-11A54.65,54.65,0,0,1,224,48,54.86,54.86,0,0,1,240,88.23ZM109,185.66l-11,11A38.41,38.41,0,0,1,70.6,208h0a38.63,38.63,0,0,1-27.29-65.94L78,107.31A38.63,38.63,0,0,1,144,135.71a8,8,0,0,0,16,.45A54.86,54.86,0,0,0,144,96a54.65,54.65,0,0,0-77.27,0L32,130.75A54.62,54.62,0,0,0,70.56,224h0a54.28,54.28,0,0,0,38.64-16l11-11A8,8,0,0,0,109,185.66Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M236,88.12a50.44,50.44,0,0,1-14.81,34.31l-34.75,34.74A50.33,50.33,0,0,1,150.62,172h-.05A50.63,50.63,0,0,1,100,120a4,4,0,0,1,4-3.89h.11a4,4,0,0,1,3.89,4.11A42.64,42.64,0,0,0,150.58,164h0a42.32,42.32,0,0,0,30.14-12.49l34.75-34.74a42.63,42.63,0,1,0-60.29-60.28l-11,11a4,4,0,0,1-5.66-5.65l11-11A50.64,50.64,0,0,1,236,88.12ZM111.78,188.49l-11,11A42.33,42.33,0,0,1,70.6,212h0a42.63,42.63,0,0,1-30.11-72.77l34.75-34.74A42.63,42.63,0,0,1,148,135.82a4,4,0,0,0,8,.23A50.64,50.64,0,0,0,69.55,98.83L34.8,133.57A50.63,50.63,0,0,0,70.56,220h0a50.33,50.33,0,0,0,35.81-14.83l11-11a4,4,0,1,0-5.65-5.66Z"}))]]),m=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z",opacity:"0.2"}),a.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z"}))]]),n=a.forwardRef((e,t)=>a.createElement(l,{ref:t,...e,weights:r}));n.displayName="LinkIcon";const V=n,h=a.forwardRef((e,t)=>a.createElement(l,{ref:t,...e,weights:m}));h.displayName="TrashIcon";const Z=h;export{V as c,Z as n};
@@ -0,0 +1 @@
1
+ import{j as e}from"./note-vendor-B0t5F04o.js";import{P as d,F as x,$ as N,i as n,j as v,V as b,aq as V,u as S,q as h,a5 as q,ab as p,av as C,a0 as R,T as k}from"./index-B4l2UvuC.js";import{q as T,f as D,a as E}from"./view-dashboard-T6gmohr-.js";import"./graph-vendor-CUxe67Lr.js";import"./note-core-GgFcksAF.js";const u=v(b);function F(){const o=u.useNavigate(),{page:i,sectionId:r}=u.useSearch(),{onDelete:g,onPinned:f,deleteWarningDialog:m}=V(),a=25,{data:c}=S({queryKey:h.views.section(r),async queryFn(){const t=await T(r);if(t.type==="error")throw t;return t.viewSection}}),{data:s}=q({queryKey:h.views.sectionNotes(r,{limit:a,offset:(i-1)*a}),async queryFn(){const t=await D(r,{limit:a,offset:(i-1)*a});if(t.type==="error")throw t;return t.viewSectionNotes}}),l=c?.title||"View Notes",j=c?.tagNames??[],w=c?.mode??"and";return e.jsxs(d,{title:l,heading:s.totalCount>0?`${l} (${s.totalCount})`:l,description:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(k,{as:"span",variant:"meta",tone:"tertiary",children:E(w)}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:j.map(t=>e.jsx("span",{className:"inline-flex items-center rounded-full border border-border-subtle bg-hover-subtle px-2.5 py-1 text-xs font-medium text-fg-secondary",children:t},t))})]}),children:[e.jsx(p,{fallback:e.jsx(x,{title:"No notes match this saved view",description:"Adjust the section tags or keep writing until matching notes appear."}),children:s.notes.length>0&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"grid-auto-cards grid gap-5",children:s.notes.map(t=>e.jsx(C,{...t,onPinned:()=>f(t.id,t.pinned),onDelete:()=>g(t.id)},t.id))}),e.jsx(p,{fallback:null,children:s.totalCount&&a<s.totalCount&&e.jsx(R,{page:i,last:Math.ceil(s.totalCount/a),onChange:t=>{o({search:y=>({...y,page:t})})}})})]})}),m]})}function Q(){const{sectionId:o,page:i}=u.useSearch();return o?e.jsx(N,{fallback:e.jsx(d,{title:"View Notes",heading:e.jsx(n,{width:180,height:24,className:"rounded-full"}),description:e.jsx(n,{width:220,height:16,className:"rounded-full"}),children:e.jsxs("div",{className:"grid-auto-cards grid gap-5",children:[e.jsx(n,{height:"112px"}),e.jsx(n,{height:"112px"}),e.jsx(n,{height:"112px"})]})}),errorTitle:"Failed to load view notes",errorDescription:"Retry loading notes for this saved view section",resetKeys:[i,o],children:e.jsx(F,{})}):e.jsx(d,{title:"View Notes",description:"Saved view note lists require a section id.",children:e.jsx(x,{title:"No section selected",description:"Return to Views and open a section from there."})})}export{Q as default};
@@ -0,0 +1 @@
1
+ import{j as e}from"./note-vendor-B0t5F04o.js";import{p as ue,u as O,q as N,T as u,L as H,V as P,D as te,k as se,B as w,N as pe,t as ge,M as S,l as D,I as ae,S as fe,e as F,m as be,n as ve,o as _,r as re,v as je,w as we,x as ye,y as Ne,z as K,A as Se,K as ke,E as Te,P as Ce,i as I,F as Z,G as Q,H as Ve,J as $,O as U,Q as Ee,R as De,U as Ae,W as ze,X as ie,Y as ne,c as R,Z as oe}from"./index-B4l2UvuC.js";import{a as r}from"./graph-vendor-CUxe67Lr.js";import{b as Me,f as Fe,g as Le,n as B,a as G,c as Re,d as We,E as He,s as Ie,e as qe,r as Oe,h as Pe,i as _e,j as Ke,k as Ze,u as Qe,l as $e,m as Ue,o as Be,p as Ge}from"./view-dashboard-T6gmohr-.js";import{S as A}from"./SurfaceCard-CHjcCuqZ.js";import{n as q}from"./Plus.es-KeV96R_e.js";import"./note-core-GgFcksAF.js";const Ye=new Map([["bold",r.createElement(r.Fragment,null,r.createElement("path",{d:"M224.49,136.49l-72,72a12,12,0,0,1-17-17L187,140H40a12,12,0,0,1,0-24H187L135.51,64.48a12,12,0,0,1,17-17l72,72A12,12,0,0,1,224.49,136.49Z"}))],["duotone",r.createElement(r.Fragment,null,r.createElement("path",{d:"M216,128l-72,72V56Z",opacity:"0.2"}),r.createElement("path",{d:"M221.66,122.34l-72-72A8,8,0,0,0,136,56v64H40a8,8,0,0,0,0,16h96v64a8,8,0,0,0,13.66,5.66l72-72A8,8,0,0,0,221.66,122.34ZM152,180.69V75.31L204.69,128Z"}))],["fill",r.createElement(r.Fragment,null,r.createElement("path",{d:"M221.66,133.66l-72,72A8,8,0,0,1,136,200V136H40a8,8,0,0,1,0-16h96V56a8,8,0,0,1,13.66-5.66l72,72A8,8,0,0,1,221.66,133.66Z"}))],["light",r.createElement(r.Fragment,null,r.createElement("path",{d:"M220.24,132.24l-72,72a6,6,0,0,1-8.48-8.48L201.51,134H40a6,6,0,0,1,0-12H201.51L139.76,60.24a6,6,0,0,1,8.48-8.48l72,72A6,6,0,0,1,220.24,132.24Z"}))],["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z"}))],["thin",r.createElement(r.Fragment,null,r.createElement("path",{d:"M218.83,130.83l-72,72a4,4,0,0,1-5.66-5.66L206.34,132H40a4,4,0,0,1,0-8H206.34L141.17,58.83a4,4,0,0,1,5.66-5.66l72,72A4,4,0,0,1,218.83,130.83Z"}))]]),le=r.forwardRef((s,i)=>r.createElement(ue,{ref:i,...s,weights:Ye}));le.displayName="ArrowRightIcon";const Je=le,Xe="flex items-start justify-between gap-3 rounded-[14px] border border-border-subtle/70 px-3 py-2.5 transition-colors hover:border-border-secondary hover:bg-hover-subtle";function et({section:s,onEdit:i,onDelete:n,dragHandle:c}){const x=Me(s),{data:l,isPending:m,isError:h,refetch:b}=O({queryKey:N.views.sectionNotes(s.id,{limit:s.limit,offset:0}),async queryFn(){const a=await Fe(s.id,{limit:s.limit,offset:0});if(a.type==="error")throw a;return a.viewSectionNotes}}),p=l?.notes??[],k=l?.totalCount??0,g=Le(s.mode);return e.jsxs(A,{className:"flex h-full flex-col gap-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[c&&e.jsx("div",{className:"-mr-1 shrink-0 self-center",children:c}),e.jsx("div",{className:"min-w-0",children:e.jsx(u,{as:"h2",variant:"subheading",weight:"semibold",tracking:"tight",className:"min-w-0",children:e.jsx(H,{to:P,search:x,className:"truncate hover:text-fg-default/85",children:s.title})})})]}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:s.tagNames.map((a,C)=>e.jsxs("div",{className:"flex items-center gap-1.5",children:[C>0&&e.jsx("span",{className:"px-0.5 text-[10px] font-semibold tracking-[0.08em] text-fg-tertiary/85",children:g}),e.jsx("span",{className:"inline-flex items-center rounded-full border border-border-subtle/80 bg-transparent px-2.5 py-1 text-xs font-medium text-fg-secondary",children:a})]},a))})]}),e.jsx("div",{className:"shrink-0",children:e.jsx(te,{button:e.jsx(se,{label:"Section actions"}),items:[{name:"Edit section",onClick:i},{type:"separator"},{name:"Delete section",onClick:n}]})})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-2.5",children:[m&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-14 animate-pulse rounded-[14px] bg-hover-subtle"}),e.jsx("div",{className:"h-14 animate-pulse rounded-[14px] bg-hover-subtle"}),e.jsx("div",{className:"h-14 animate-pulse rounded-[14px] bg-hover-subtle"})]}),h&&e.jsxs("div",{className:"rounded-[16px] border border-border-subtle bg-hover-subtle/70 p-4",children:[e.jsx(u,{as:"p",variant:"body",weight:"semibold",children:"Failed to load this section"}),e.jsx(u,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Retry to refresh the tag-based note block."}),e.jsx("div",{className:"mt-3",children:e.jsx(w,{type:"button",variant:"ghost",size:"sm",onClick:()=>b(),children:"Retry"})})]}),!m&&!h&&p.length===0&&e.jsxs("div",{className:"rounded-[16px] border border-dashed border-border-subtle px-4 py-5",children:[e.jsx(u,{as:"p",variant:"body",weight:"semibold",children:"No notes match yet"}),e.jsx(u,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Add more notes with these tags, or edit the section filter."})]}),!m&&!h&&p.map(a=>e.jsxs(H,{to:pe,params:{id:a.id},className:Xe,children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(u,{as:"div",variant:"body",weight:"semibold",className:"line-clamp-1",children:a.title||"Untitled"}),e.jsxs(u,{as:"div",variant:"meta",tone:"tertiary",className:"mt-1",children:["Updated ",ge(Number(a.updatedAt))]})]}),e.jsx(Je,{className:"mt-0.5 h-4 w-4 shrink-0 text-fg-tertiary"})]},a.id))]}),e.jsxs("div",{className:"flex items-center justify-between gap-3 border-t border-border-subtle/70 pt-4",children:[e.jsx(u,{as:"p",variant:"meta",tone:"tertiary",children:m?"Loading notes...":`Showing ${p.length} of ${k} notes`}),e.jsx(w,{asChild:!0,variant:"subtle",size:"sm",children:e.jsx(H,{to:P,search:x,children:"Open list"})})]})]})}const Y=s=>String(s?.limit??5),J=s=>s?.mode??"and",X=s=>s?s.tagNames.join(", "):"",ee=s=>s?.title??"";function tt({open:s,mode:i,initialSection:n=null,availableTags:c,isTagsLoading:x=!1,onClose:l,onSubmit:m}){const[h,b]=r.useState(ee(n)),[p,k]=r.useState(X(n)),[g,a]=r.useState(J(n)),[C,L]=r.useState(Y(n)),[V,E]=r.useState("");r.useEffect(()=>{s&&(b(ee(n)),k(X(n)),a(J(n)),L(Y(n)),E(""))},[n,s]);const f=B([p]),v=d=>{const y=f.includes(d)?f.filter(W=>W!==d):[...f,d];k(y.join(", ")),E("")};return e.jsxs(S,{isOpen:s,onClose:l,variant:"form",className:"sm:max-w-[640px]",children:[e.jsx(S.Header,{title:i==="create"?"Create section":"Edit section",onClose:l}),e.jsx(S.Body,{children:e.jsxs("form",{id:"view-section-form",className:"flex flex-col gap-5",onSubmit:d=>{d.preventDefault();const y=B([p]);if(y.length===0){E("Add at least one tag for this section.");return}m({title:h,tagNames:y,mode:g,limit:Number(C)})},children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-[minmax(0,1fr)_180px]",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(D,{htmlFor:"view-section-title",size:"md",children:"Section title"}),e.jsx(ae,{id:"view-section-title",value:h,onChange:d=>b(d.target.value),placeholder:"Agent work",autoFocus:!0})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(D,{htmlFor:"view-section-limit",size:"md",children:"Max notes"}),e.jsxs(fe,{value:C,onValueChange:L,children:[e.jsx(F,{value:"3",children:"3 notes"}),e.jsx(F,{value:"5",children:"5 notes"}),e.jsx(F,{value:"8",children:"8 notes"}),e.jsx(F,{value:"10",children:"10 notes"}),e.jsx(F,{value:"12",children:"12 notes"})]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(D,{htmlFor:"view-section-tags",size:"md",children:"Tags"}),e.jsx(be,{id:"view-section-tags",value:p,onChange:d=>{k(d.target.value),E("")},placeholder:"@OceanBrain, @todo",size:"sm"}),e.jsx(u,{as:"p",variant:"meta",tone:V?"default":"tertiary",className:V?"text-fg-error":void 0,children:V||"Separate tags with commas. Plain words become @tags automatically."})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(D,{size:"md",children:"Tag match"}),e.jsxs(ve,{type:"single",value:g,onValueChange:d=>{(d==="and"||d==="or")&&a(d)},variant:"quiet",size:"sm",className:"self-start",children:[e.jsx(_,{value:"and","aria-label":G("and"),children:"Match all"}),e.jsx(_,{value:"or","aria-label":G("or"),children:"Match any"})]})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(D,{size:"md",children:"Existing tags"}),e.jsx(u,{as:"span",variant:"meta",tone:"tertiary",children:x?"Loading tag catalog...":`${c.length} tags available`})]}),c.length>0?e.jsx("div",{className:"max-h-44 overflow-y-auto rounded-[18px] border border-border-subtle bg-hover-subtle/60 p-3",children:e.jsx("div",{className:"flex flex-wrap gap-2",children:c.map(d=>{const y=f.includes(d.name);return e.jsx("button",{type:"button",className:`inline-flex items-center rounded-full border px-3 py-1.5 text-sm font-medium transition-colors ${y?"border-border-secondary bg-elevated text-fg-default":"border-border-subtle bg-transparent text-fg-secondary hover:border-border-secondary hover:bg-elevated hover:text-fg-default"}`,onClick:()=>v(d.name),children:d.name},d.id)})})}):e.jsx(u,{as:"p",variant:"meta",tone:"tertiary",children:"No tags yet. You can still type tag names manually."})]})]})}),e.jsx(S.Footer,{children:e.jsxs(re,{children:[e.jsx(w,{type:"button",variant:"ghost",size:"sm",onClick:l,children:"Cancel"}),e.jsx(w,{type:"submit",size:"sm",form:"view-section-form",children:i==="create"?"Create section":"Save section"})]})})]})}function st({open:s,mode:i,initialTitle:n="",onClose:c,onSubmit:x}){const[l,m]=r.useState(n);return r.useEffect(()=>{s&&m(n)},[n,s]),e.jsxs(S,{isOpen:s,onClose:c,variant:"form",className:"sm:max-w-[480px]",children:[e.jsx(S.Header,{title:i==="create"?"Create view tab":"Rename view tab",onClose:c}),e.jsx(S.Body,{children:e.jsxs("form",{id:"view-tab-form",className:"flex flex-col gap-4",onSubmit:h=>{h.preventDefault(),x(l)},children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(D,{htmlFor:"view-tab-title",size:"md",children:"Tab name"}),e.jsx(ae,{id:"view-tab-title",value:l,onChange:h=>m(h.target.value),placeholder:"Now",autoFocus:!0})]}),e.jsx(u,{as:"p",variant:"meta",tone:"tertiary",children:"Each tab is one saved view inside the Views page."})]})}),e.jsx(S.Footer,{children:e.jsxs(re,{children:[e.jsx(w,{type:"button",variant:"ghost",size:"sm",onClick:c,children:"Cancel"}),e.jsx(w,{type:"submit",size:"sm",form:"view-tab-form",children:i==="create"?"Create tab":"Save tab"})]})})]})}const at="Save tag-based views and switch between them without leaving your notes.",rt="focus-ring-soft inline-flex h-8 w-8 items-center justify-center rounded-[10px] text-fg-default/70 outline-none transition-colors hover:bg-hover-subtle hover:text-fg-default touch-none",it="group relative -mb-px flex h-10 min-w-[92px] max-w-[118px] shrink-0 items-center gap-0.5 rounded-t-[12px] border border-b-0 px-1.5 transition-[background-color,border-color,color,box-shadow]",nt="focus-ring-soft inline-flex min-w-0 flex-1 items-center gap-1 rounded-[9px] px-0.5 py-1.5 text-[13px] font-medium outline-none",ot="focus-ring-soft inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-[8px] text-current/55 outline-none transition-[background-color,color,opacity] hover:bg-hover-subtle hover:text-current touch-none",lt="focus-ring-soft relative mb-0.5 inline-flex h-9 shrink-0 items-center gap-1 rounded-[10px] px-2.5 text-[13px] font-medium text-fg-secondary outline-none transition-colors hover:bg-hover-subtle/85 hover:text-fg-default",ct=({tab:s,isActive:i,onSelect:n})=>{const{attributes:c,listeners:x,setNodeRef:l,setActivatorNodeRef:m,transform:h,transition:b,isDragging:p}=ie({id:s.id});return e.jsxs("div",{ref:l,style:{transform:oe.Transform.toString(h),transition:b,opacity:p?.6:1},className:R(it,i?"z-10 border-border-secondary/75 bg-elevated text-fg-default shadow-[0_10px_18px_-20px_rgba(15,18,24,0.24)]":"border-transparent bg-hover-subtle/45 text-fg-secondary hover:bg-hover-subtle/75 hover:text-fg-default"),children:[e.jsx("button",{type:"button",ref:m,"aria-label":`Reorder view tab ${s.title}`,...c,...x,className:R(ot,p?"cursor-grabbing opacity-100":"cursor-grab opacity-70 group-hover:opacity-100"),children:e.jsx(ne,{className:"size-4"})}),e.jsxs("button",{type:"button",role:"tab","aria-selected":i,className:R(nt,i?"text-fg-default":"text-fg-secondary group-hover:text-fg-default"),onClick:n,children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:s.title}),e.jsx("span",{className:"inline-flex min-w-4 shrink-0 items-center justify-center rounded-full bg-hover-subtle/75 px-1 py-0 text-[10px] leading-4 text-current/70",children:s.sections.length})]})]})},dt=({section:s,onEdit:i,onDelete:n})=>{const{attributes:c,listeners:x,setNodeRef:l,setActivatorNodeRef:m,transform:h,transition:b,isDragging:p}=ie({id:s.id});return e.jsx("div",{ref:l,style:{transform:oe.Transform.toString(h),transition:b,opacity:p?.6:1},children:e.jsx(et,{section:s,onEdit:i,onDelete:n,dragHandle:e.jsx("button",{type:"button",ref:m,"aria-label":`Reorder section ${s.title}`,...c,...x,className:R(rt,p?"cursor-grabbing":"cursor-grab"),children:e.jsx(ne,{className:"size-4"})})})})};function bt(){const s=je(),i=ze(),n=we(),[c,x]=r.useState(null),[l,m]=r.useState(null),{data:h,isPending:b,isError:p,refetch:k}=O({queryKey:N.views.workspace(),async queryFn(){const t=await Re();if(t.type==="error")throw t;return t.viewWorkspace}}),g=h??He,a=We(g),{data:C,isPending:L}=O({queryKey:N.tags.list({limit:200}),async queryFn(){const t=await ye({limit:200});if(t.type==="error")throw t;return t.allTags}}),V=Ne(K(Te,{activationConstraint:{distance:8}}),K(ke,{coordinateGetter:Se})),E=C?.tags??[],f=t=>{n.setQueryData(N.views.workspace(),t)},v=async()=>{await n.invalidateQueries({queryKey:N.views.all(),exact:!1})},d=async({active:t,over:o})=>{if(!o||t.id===o.id)return;const T=n.getQueryData(N.views.workspace())??g,j=Oe(T,String(t.id),String(o.id));f(j);const z=await Pe(j.tabs.map(M=>M.id));if(z.type==="error"){f(T),i(z.errors[0].message);return}await v()},y=async({active:t,over:o})=>{if(!a||!o||t.id===o.id)return;const T=n.getQueryData(N.views.workspace())??g,j=_e(T,a.id,String(t.id),String(o.id));f(j);const z=await Ke(a.id,j.tabs.find(M=>M.id===a.id)?.sections.map(M=>M.id)??[]);if(z.type==="error"){f(T),i(z.errors[0].message);return}await v()},W=async t=>{const o=await Ze(t);if(o.type==="error"){i(o.errors[0].message);return}await v(),x(null)},ce=async t=>{if(!a)return;const o=await Qe(a.id,t);if(o.type==="error"){i(o.errors[0].message);return}await v(),x(null)},de=async()=>{if(!a||!await s("Delete this view tab and all of its sections?"))return;const t=await $e(a.id);if(t.type==="error"){i(t.errors[0].message);return}await v()},me=async t=>{if(!a)return;const o=await Ue(a.id,t);if(o.type==="error"){i(o.errors[0].message);return}await v(),m(null)},xe=async t=>{if(!a||!l||l.mode!=="edit")return;const o=await Be(l.section.id,t);if(o.type==="error"){i(o.errors[0].message);return}await v(),m(null)},he=async t=>{if(!a||!await s("Delete this section from the current view tab?"))return;const o=await Ge(t);if(o.type==="error"){i(o.errors[0].message);return}await v()};return e.jsxs(e.Fragment,{children:[e.jsx(Ce,{title:"Views",description:at,children:b&&!h?e.jsx(A,{className:"px-6 py-8 sm:px-8 sm:py-10",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(I,{height:20,width:180,className:"rounded-full"}),e.jsx(I,{height:16,width:260,className:"rounded-full"}),e.jsx(I,{height:44,width:140,className:"rounded-[12px]"})]})}):p?e.jsxs(A,{className:"px-6 py-8 sm:px-8 sm:py-10",children:[e.jsx(u,{as:"p",variant:"body",weight:"semibold",children:"Failed to load saved views"}),e.jsx(u,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Retry loading your saved view tabs."}),e.jsx("div",{className:"mt-4",children:e.jsx(w,{type:"button",variant:"ghost",size:"sm",onClick:()=>{k()},children:"Retry"})})]}):g.tabs.length===0?e.jsxs(A,{className:"px-6 py-8 sm:px-8 sm:py-10",children:[e.jsx(Z,{title:"Create your first view tab",description:"Start with a saved view tab, then add tag-based sections inside it."}),e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsxs(w,{type:"button",onClick:()=>x({mode:"create"}),children:[e.jsx(q,{className:"h-4 w-4"}),"Create first tab"]})})]}):e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx("div",{className:"border-b border-border-secondary/75",children:e.jsx(Q,{sensors:V,collisionDetection:$,modifiers:[Ve],onDragEnd:d,children:e.jsxs("div",{className:"flex items-end gap-1 overflow-x-auto overflow-y-hidden pb-px",children:[e.jsx(U,{items:g.tabs.map(t=>t.id),strategy:Ee,children:e.jsx("div",{role:"tablist","aria-label":"Views tab list",className:"flex min-w-0 items-end gap-1",children:g.tabs.map(t=>e.jsx(ct,{tab:t,isActive:t.id===a?.id,onSelect:async()=>{const o=n.getQueryData(N.views.workspace())??g,T=Ie(o,t.id);f(T);const j=await qe(t.id);if(j.type==="error"){f(o),i(j.errors[0].message);return}f(j.setActiveViewTab)}},t.id))})}),e.jsxs("button",{type:"button",className:lt,onClick:()=>x({mode:"create"}),children:[e.jsx(q,{className:"size-4"}),"Add tab"]})]})})}),a&&e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs(A,{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{children:[e.jsx(u,{as:"h2",variant:"heading",weight:"bold",tracking:"tight",children:a.title}),e.jsx(u,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:a.sections.length>0?`${a.sections.length} section${a.sections.length===1?"":"s"} in this view`:"Add sections to build this view"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsxs(w,{type:"button",size:"sm",onClick:()=>m({mode:"create"}),children:[e.jsx(q,{className:"h-4 w-4"}),"Add section"]}),e.jsx(te,{button:e.jsx(se,{label:"View tab actions"}),items:[{name:"Rename",onClick:()=>x({mode:"edit",tab:a})},{type:"separator"},{name:"Delete tab",onClick:()=>{de()}}]})]})]}),a.sections.length===0?e.jsx(A,{className:"px-6 py-8 sm:px-8 sm:py-10",children:e.jsx(Z,{title:"Add the first section to this tab",description:"Sections pull notes by tag."})}):e.jsx("div",{className:"flex flex-col",children:e.jsx(Q,{sensors:V,collisionDetection:$,modifiers:[De],onDragEnd:y,children:e.jsx(U,{items:a.sections.map(t=>t.id),strategy:Ae,children:e.jsx("div",{className:"flex flex-col gap-4",children:a.sections.map(t=>e.jsx(dt,{section:t,onEdit:()=>m({mode:"edit",section:t}),onDelete:()=>{he(t.id)}},t.id))})})})})]})]})}),e.jsx(st,{open:c!==null,mode:c?.mode??"create",initialTitle:c?.mode==="edit"?c.tab.title:"",onClose:()=>x(null),onSubmit:t=>{if(c?.mode==="edit"){ce(t);return}W(t)}}),e.jsx(tt,{open:l!==null,mode:l?.mode??"create",initialSection:l?.mode==="edit"?l.section:null,availableTags:E,isTagsLoading:L,onClose:()=>m(null),onSubmit:t=>{if(l?.mode==="edit"){xe(t);return}me(t)}})]})}export{bt as default};
@@ -1,4 +1,4 @@
1
- import{h as t,az as n}from"./index-Bsx4P7EA.js";function o({limit:a=50,offset:e=0}={}){return t(`query FetchImages($pagination: PaginationInput) {
1
+ import{h as t,aA as n}from"./index-B4l2UvuC.js";function o({limit:a=50,offset:e=0}={}){return t(`query FetchImages($pagination: PaginationInput) {
2
2
  allImages(pagination: $pagination) {
3
3
  totalCount
4
4
  images {