ocean-brain 0.6.2 → 0.7.0

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 (46) hide show
  1. package/dist/mcp.js +79 -24
  2. package/package.json +2 -1
  3. package/server/client/dist/assets/{Calendar-DbPut8EU.js → Calendar-B2_OJcHD.js} +1 -1
  4. package/server/client/dist/assets/{Callout-DfX-gIUB.js → Callout-BvXAlA5k.js} +1 -1
  5. package/server/client/dist/assets/{Graph-yHE9m5fy.js → Graph-DO35UCPM.js} +1 -1
  6. package/server/client/dist/assets/{Image.es-CtMc7BW4.js → Image.es-DLqLiGdW.js} +1 -1
  7. package/server/client/dist/assets/Note-AaTlS352.js +22 -0
  8. package/server/client/dist/assets/{Plus.es-BGVIIQtM.js → Plus.es-I7xuoJ9B.js} +1 -1
  9. package/server/client/dist/assets/{Reminders-CvEJf0eQ.js → Reminders-B0LJeSlu.js} +1 -1
  10. package/server/client/dist/assets/{Search-CKZhztuV.js → Search-xbDSlNOT.js} +1 -1
  11. package/server/client/dist/assets/{SurfaceCard-Bnfo5EOl.js → SurfaceCard-Brd1cMxi.js} +1 -1
  12. package/server/client/dist/assets/{Tag-C4oAwjs0.js → Tag-2PlhkjwY.js} +1 -1
  13. package/server/client/dist/assets/{TagNotes-Rl1ZSJP6.js → TagNotes-1yUBLqhX.js} +1 -1
  14. package/server/client/dist/assets/{Trash.es-BcwUz2yM.js → Trash.es-B-7U25B6.js} +1 -1
  15. package/server/client/dist/assets/{ViewNotes-B9Yc0A87.js → ViewNotes-D4X-MCTk.js} +1 -1
  16. package/server/client/dist/assets/{ViewSectionTableRenderer-C5yJBO7C.js → ViewSectionTableRenderer-FuqBpQts.js} +1 -1
  17. package/server/client/dist/assets/{Views-Bqq0pUEE.js → Views-CBEimWY8.js} +1 -1
  18. package/server/client/dist/assets/{image.api-CuGTgzyQ.js → image.api-BtadKO98.js} +1 -1
  19. package/server/client/dist/assets/{index-CDjYEIVf.css → index-BFkZTZ6v.css} +1 -1
  20. package/server/client/dist/assets/{index-B43ulIPo.js → index-BgnmVjeF.js} +45 -11
  21. package/server/client/dist/assets/{index-BQDR6hIA.js → index-sGhvnErO.js} +1 -1
  22. package/server/client/dist/assets/{manage-image-Bs4Kmevx.js → manage-image-B4UZ-ZQx.js} +1 -1
  23. package/server/client/dist/assets/{manage-image-detail-WARala-v.js → manage-image-detail-ejAh3nCL.js} +1 -1
  24. package/server/client/dist/assets/{mcp-C0Z3vKBa.js → mcp-aIwuouT9.js} +1 -1
  25. package/server/client/dist/assets/{placeholder-D080guzn.js → placeholder-B_9Hnm7h.js} +4 -4
  26. package/server/client/dist/assets/{properties-DbnmfbT5.js → properties-D8oLyTCD.js} +1 -1
  27. package/server/client/dist/assets/{trash-D5ZiZfTk.js → trash-w7Hhxckg.js} +1 -1
  28. package/server/client/dist/assets/{useReminderMutate-h7d_S_X2.js → useReminderMutate--RlAj_Gg.js} +1 -1
  29. package/server/client/dist/index.html +2 -2
  30. package/server/dist/features/note/graphql/note.query.resolver.js +88 -47
  31. package/server/dist/features/note/graphql/note.query.resolver.js.map +1 -1
  32. package/server/dist/features/note/graphql/note.type-defs.js +32 -0
  33. package/server/dist/features/note/graphql/note.type-defs.js.map +1 -1
  34. package/server/dist/features/note/http/mcp.js +32 -0
  35. package/server/dist/features/note/http/mcp.js.map +1 -1
  36. package/server/dist/features/note/services/markdown-intent-write.js +3 -3
  37. package/server/dist/features/note/services/markdown-intent-write.js.map +1 -1
  38. package/server/dist/features/note/services/markdown-patch.js +34 -4
  39. package/server/dist/features/note/services/markdown-patch.js.map +1 -1
  40. package/server/dist/features/note/services/snapshot.js +159 -0
  41. package/server/dist/features/note/services/snapshot.js.map +1 -1
  42. package/server/dist/modules/blocknote.js +274 -24
  43. package/server/dist/modules/blocknote.js.map +1 -1
  44. package/server/dist/routes/mcp.js +5 -0
  45. package/server/dist/routes/mcp.js.map +1 -1
  46. package/server/client/dist/assets/Note-BECn-AoI.js +0 -21
@@ -1 +1 @@
1
- import{j as e}from"./note-vendor-uuJO2MTD.js";import{p as h,a5 as p,P as f,T as t,L as c,aN as u,g as o,aw as v,aO as j,aI as M,aK as N,aP as E,aQ as w}from"./index-B43ulIPo.js";import{a}from"./graph-vendor-CUxe67Lr.js";import{c as y,n as H}from"./Trash.es-BcwUz2yM.js";import{I as b}from"./Image.es-CtMc7BW4.js";import"./note-core-DMZcZ4yV.js";const T=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M236.37,139.4a12,12,0,0,0-12-3A84.07,84.07,0,0,1,119.6,31.59a12,12,0,0,0-15-15A108.86,108.86,0,0,0,49.69,55.07,108,108,0,0,0,136,228a107.09,107.09,0,0,0,64.93-21.69,108.86,108.86,0,0,0,38.44-54.94A12,12,0,0,0,236.37,139.4Zm-49.88,47.74A84,84,0,0,1,68.86,69.51,84.93,84.93,0,0,1,92.27,48.29Q92,52.13,92,56A108.12,108.12,0,0,0,200,164q3.87,0,7.71-.27A84.79,84.79,0,0,1,186.49,187.14Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M227.89,147.89A96,96,0,1,1,108.11,28.11,96.09,96.09,0,0,0,227.89,147.89Z",opacity:"0.2"}),a.createElement("path",{d:"M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M235.54,150.21a104.84,104.84,0,0,1-37,52.91A104,104,0,0,1,32,120,103.09,103.09,0,0,1,52.88,57.48a104.84,104.84,0,0,1,52.91-37,8,8,0,0,1,10,10,88.08,88.08,0,0,0,109.8,109.8,8,8,0,0,1,10,10Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M232.13,143.64a6,6,0,0,0-6-1.49A90.07,90.07,0,0,1,113.86,29.85a6,6,0,0,0-7.49-7.48A102.88,102.88,0,0,0,54.48,58.68,102,102,0,0,0,197.32,201.52a102.88,102.88,0,0,0,36.31-51.89A6,6,0,0,0,232.13,143.64Zm-42,48.29a90,90,0,0,1-126-126A90.9,90.9,0,0,1,99.65,37.66,102.06,102.06,0,0,0,218.34,156.35,90.9,90.9,0,0,1,190.1,191.93Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M230.72,145.06a4,4,0,0,0-4-1A92.08,92.08,0,0,1,111.94,29.27a4,4,0,0,0-5-5A100.78,100.78,0,0,0,56.08,59.88a100,100,0,0,0,140,140,100.78,100.78,0,0,0,35.59-50.87A4,4,0,0,0,230.72,145.06ZM191.3,193.53A92,92,0,0,1,62.47,64.7a93,93,0,0,1,39.88-30.35,100.09,100.09,0,0,0,119.3,119.3A93,93,0,0,1,191.3,193.53Z"}))]]),F=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M203.57,51A107.9,107.9,0,0,0,20,128c0,44.72,27.6,82.25,72,97.94A36,36,0,0,0,140,192a12,12,0,0,1,12-12h46.21a35.79,35.79,0,0,0,35.1-28A108.6,108.6,0,0,0,236,127.09,107.23,107.23,0,0,0,203.57,51Zm6.34,95.67a11.91,11.91,0,0,1-11.7,9.3H152a36,36,0,0,0-36,36,12,12,0,0,1-16,11.3c-16.65-5.88-30.65-15.76-40.48-28.56A76,76,0,0,1,44,128a84,84,0,0,1,83.13-84H128a84.35,84.35,0,0,1,84,83.29A84.72,84.72,0,0,1,209.91,146.71ZM144,76a16,16,0,1,1-16-16A16,16,0,0,1,144,76Zm-44,24A16,16,0,1,1,84,84,16,16,0,0,1,100,100Zm0,56a16,16,0,1,1-16-16A16,16,0,0,1,100,156Zm88-56a16,16,0,1,1-16-16A16,16,0,0,1,188,100Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M224,127.17a96.48,96.48,0,0,1-2.39,22.18A24,24,0,0,1,198.21,168H152a24,24,0,0,0-24,24,24,24,0,0,1-32,22.61C58.73,201.44,32,169.81,32,128a96,96,0,0,1,95-96C179.84,31.47,223.55,74.35,224,127.17Z",opacity:"0.2"}),a.createElement("path",{d:"M200.77,53.89A103.27,103.27,0,0,0,128,24h-1.07A104,104,0,0,0,24,128c0,43,26.58,79.06,69.36,94.17A32,32,0,0,0,136,192a16,16,0,0,1,16-16h46.21a31.81,31.81,0,0,0,31.2-24.88,104.43,104.43,0,0,0,2.59-24A103.28,103.28,0,0,0,200.77,53.89Zm13,93.71A15.89,15.89,0,0,1,198.21,160H152a32,32,0,0,0-32,32,16,16,0,0,1-21.31,15.07C62.49,194.3,40,164,40,128a88,88,0,0,1,87.09-88h.9a88.35,88.35,0,0,1,88,87.25A88.86,88.86,0,0,1,213.81,147.6ZM140,76a12,12,0,1,1-12-12A12,12,0,0,1,140,76ZM96,100A12,12,0,1,1,84,88,12,12,0,0,1,96,100Zm0,56a12,12,0,1,1-12-12A12,12,0,0,1,96,156Zm88-56a12,12,0,1,1-12-12A12,12,0,0,1,184,100Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M200.77,53.89A103.27,103.27,0,0,0,128,24h-1.07A104,104,0,0,0,24,128c0,43,26.58,79.06,69.36,94.17A32,32,0,0,0,136,192a16,16,0,0,1,16-16h46.21a31.81,31.81,0,0,0,31.2-24.88,104.43,104.43,0,0,0,2.59-24A103.28,103.28,0,0,0,200.77,53.89ZM84,168a12,12,0,1,1,12-12A12,12,0,0,1,84,168Zm0-56a12,12,0,1,1,12-12A12,12,0,0,1,84,112Zm44-24a12,12,0,1,1,12-12A12,12,0,0,1,128,88Zm44,24a12,12,0,1,1,12-12A12,12,0,0,1,172,112Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M199.37,55.31A101.32,101.32,0,0,0,128,26h-1A102,102,0,0,0,26,128c0,42.09,26.07,77.44,68,92.26A30.21,30.21,0,0,0,104.11,222,30.06,30.06,0,0,0,134,192a18,18,0,0,1,18-18h46.21a29.82,29.82,0,0,0,29.25-23.31A102.71,102.71,0,0,0,230,127.11,101.25,101.25,0,0,0,199.37,55.31ZM215.76,148a17.89,17.89,0,0,1-17.55,14H152a30,30,0,0,0-30,30,18,18,0,0,1-24,17C61,195.86,38,164.85,38,128a90,90,0,0,1,89.07-90H128a90.34,90.34,0,0,1,90,89.22A90.46,90.46,0,0,1,215.76,148ZM138,76a10,10,0,1,1-10-10A10,10,0,0,1,138,76ZM94,100A10,10,0,1,1,84,90,10,10,0,0,1,94,100Zm0,56a10,10,0,1,1-10-10A10,10,0,0,1,94,156Zm88-56a10,10,0,1,1-10-10A10,10,0,0,1,182,100Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M200.77,53.89A103.27,103.27,0,0,0,128,24h-1.07A104,104,0,0,0,24,128c0,43,26.58,79.06,69.36,94.17A32,32,0,0,0,136,192a16,16,0,0,1,16-16h46.21a31.81,31.81,0,0,0,31.2-24.88,104.43,104.43,0,0,0,2.59-24A103.28,103.28,0,0,0,200.77,53.89Zm13,93.71A15.89,15.89,0,0,1,198.21,160H152a32,32,0,0,0-32,32,16,16,0,0,1-21.31,15.07C62.49,194.3,40,164,40,128a88,88,0,0,1,87.09-88h.9a88.35,88.35,0,0,1,88,87.25A88.86,88.86,0,0,1,213.81,147.6ZM140,76a12,12,0,1,1-12-12A12,12,0,0,1,140,76ZM96,100A12,12,0,1,1,84,88,12,12,0,0,1,96,100Zm0,56a12,12,0,1,1-12-12A12,12,0,0,1,96,156Zm88-56a12,12,0,1,1-12-12A12,12,0,0,1,184,100Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M198,56.74A99.31,99.31,0,0,0,128,28h-1A100,100,0,0,0,28,128c0,41.22,25.55,75.85,66.69,90.38a28.34,28.34,0,0,0,9.42,1.63A28,28,0,0,0,132,192a20,20,0,0,1,20-20h46.21a27.84,27.84,0,0,0,27.3-21.76,100.37,100.37,0,0,0,2.49-23.1A99.26,99.26,0,0,0,198,56.74Zm19.74,91.72A19.89,19.89,0,0,1,198.21,164H152a28,28,0,0,0-28,28,20,20,0,0,1-26.64,18.83C59.51,197.46,36,165.72,36,128a92,92,0,0,1,91.05-92H128a92,92,0,0,1,89.72,112.46ZM136,76a8,8,0,1,1-8-8A8,8,0,0,1,136,76ZM92,100a8,8,0,1,1-8-8A8,8,0,0,1,92,100Zm0,56a8,8,0,1,1-8-8A8,8,0,0,1,92,156Zm88-56a8,8,0,1,1-8-8A8,8,0,0,1,180,100Z"}))]]),V=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M116,36V20a12,12,0,0,1,24,0V36a12,12,0,0,1-24,0Zm80,92a68,68,0,1,1-68-68A68.07,68.07,0,0,1,196,128Zm-24,0a44,44,0,1,0-44,44A44.05,44.05,0,0,0,172,128ZM51.51,68.49a12,12,0,1,0,17-17l-12-12a12,12,0,0,0-17,17Zm0,119-12,12a12,12,0,0,0,17,17l12-12a12,12,0,1,0-17-17ZM196,72a12,12,0,0,0,8.49-3.51l12-12a12,12,0,0,0-17-17l-12,12A12,12,0,0,0,196,72Zm8.49,115.51a12,12,0,0,0-17,17l12,12a12,12,0,0,0,17-17ZM48,128a12,12,0,0,0-12-12H20a12,12,0,0,0,0,24H36A12,12,0,0,0,48,128Zm80,80a12,12,0,0,0-12,12v16a12,12,0,0,0,24,0V220A12,12,0,0,0,128,208Zm108-92H220a12,12,0,0,0,0,24h16a12,12,0,0,0,0-24Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M184,128a56,56,0,1,1-56-56A56,56,0,0,1,184,128Z",opacity:"0.2"}),a.createElement("path",{d:"M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm8,24a64,64,0,1,0,64,64A64.07,64.07,0,0,0,128,64ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M122,40V16a6,6,0,0,1,12,0V40a6,6,0,0,1-12,0Zm68,88a62,62,0,1,1-62-62A62.07,62.07,0,0,1,190,128Zm-12,0a50,50,0,1,0-50,50A50.06,50.06,0,0,0,178,128ZM59.76,68.24a6,6,0,1,0,8.48-8.48l-16-16a6,6,0,0,0-8.48,8.48Zm0,119.52-16,16a6,6,0,1,0,8.48,8.48l16-16a6,6,0,1,0-8.48-8.48ZM192,70a6,6,0,0,0,4.24-1.76l16-16a6,6,0,0,0-8.48-8.48l-16,16A6,6,0,0,0,192,70Zm4.24,117.76a6,6,0,0,0-8.48,8.48l16,16a6,6,0,0,0,8.48-8.48ZM46,128a6,6,0,0,0-6-6H16a6,6,0,0,0,0,12H40A6,6,0,0,0,46,128Zm82,82a6,6,0,0,0-6,6v24a6,6,0,0,0,12,0V216A6,6,0,0,0,128,210Zm112-88H216a6,6,0,0,0,0,12h24a6,6,0,0,0,0-12Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M124,40V16a4,4,0,0,1,8,0V40a4,4,0,0,1-8,0Zm64,88a60,60,0,1,1-60-60A60.07,60.07,0,0,1,188,128Zm-8,0a52,52,0,1,0-52,52A52.06,52.06,0,0,0,180,128ZM61.17,66.83a4,4,0,0,0,5.66-5.66l-16-16a4,4,0,0,0-5.66,5.66Zm0,122.34-16,16a4,4,0,0,0,5.66,5.66l16-16a4,4,0,0,0-5.66-5.66ZM192,68a4,4,0,0,0,2.83-1.17l16-16a4,4,0,1,0-5.66-5.66l-16,16A4,4,0,0,0,192,68Zm2.83,121.17a4,4,0,0,0-5.66,5.66l16,16a4,4,0,0,0,5.66-5.66ZM40,124H16a4,4,0,0,0,0,8H40a4,4,0,0,0,0-8Zm88,88a4,4,0,0,0-4,4v24a4,4,0,0,0,8,0V216A4,4,0,0,0,128,212Zm112-88H216a4,4,0,0,0,0,8h24a4,4,0,0,0,0-8Z"}))]]),A=a.forwardRef((s,r)=>a.createElement(h,{ref:r,...s,weights:T}));A.displayName="MoonIcon";const S=A,g=a.forwardRef((s,r)=>a.createElement(h,{ref:r,...s,weights:F}));g.displayName="PaletteIcon";const k=g,Z=a.forwardRef((s,r)=>a.createElement(h,{ref:r,...s,weights:V}));Z.displayName="SunIcon";const C=Z,G=()=>{const{theme:s,toggleTheme:r}=p(x=>x),l="focus-ring-soft surface-base group flex items-start justify-between gap-3.5 px-4 py-3.5 text-left text-fg-default outline-none transition-colors hover:bg-hover-subtle",n="inline-flex h-12 w-12 shrink-0 items-center justify-center rounded-[15px] border border-border-subtle bg-muted text-fg-secondary transition-colors group-hover:border-border-secondary/70 group-hover:text-fg-default",m="h-6 w-6",d="text-fg-tertiary",i="min-w-0 flex flex-col gap-0.5 pt-0.5";return e.jsx(f,{title:"Settings",description:"Manage appearance, integrations, and workspace tools",children:e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsxs("section",{className:"flex flex-col gap-3",children:[e.jsx(t,{as:"p",variant:"label",weight:"medium",className:d,children:"Appearance"}),e.jsxs("button",{type:"button",className:l,onClick:r,children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[e.jsx("span",{className:n,children:e.jsx(k,{className:m})}),e.jsxs("div",{className:i,children:[e.jsx(t,{as:"div",variant:"body",weight:"medium",children:"Theme"}),e.jsx(t,{as:"div",variant:"meta",tone:"secondary",children:"Switch between light and dark mode."})]})]}),e.jsxs("div",{className:"mt-0.5 flex shrink-0 items-center gap-2 text-fg-tertiary",children:[e.jsx(t,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:s==="dark"?"Dark":"Light"}),s==="dark"?e.jsx(S,{className:"h-4 w-4",weight:"fill"}):e.jsx(C,{className:"h-4 w-4",weight:"fill"})]})]})]}),e.jsxs("section",{className:"flex flex-col gap-3",children:[e.jsx(t,{as:"p",variant:"label",weight:"medium",className:d,children:"Integrations"}),e.jsxs(c,{to:u,className:l,children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[e.jsx("span",{className:n,children:e.jsx(y,{className:m})}),e.jsxs("div",{className:i,children:[e.jsx(t,{as:"div",variant:"body",weight:"medium",children:"MCP"}),e.jsx(t,{as:"div",variant:"meta",tone:"secondary",children:"Manage AI integration access."})]})]}),e.jsx(o,{className:"mt-0.5 h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-hover:translate-x-0.5 group-hover:text-fg-secondary"})]})]}),e.jsxs("section",{className:"flex flex-col gap-3",children:[e.jsx(t,{as:"p",variant:"label",weight:"medium",className:d,children:"Workspace"}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[e.jsxs(c,{to:v,search:{page:1},className:l,children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[e.jsx("span",{className:n,children:e.jsx(H,{className:m})}),e.jsxs("div",{className:i,children:[e.jsx(t,{as:"div",variant:"body",weight:"medium",children:"Trash"}),e.jsx(t,{as:"div",variant:"meta",tone:"secondary",children:"Restore deleted notes."})]})]}),e.jsx(o,{className:"mt-0.5 h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-hover:translate-x-0.5 group-hover:text-fg-secondary"})]}),e.jsxs(c,{to:j,search:{page:1},className:l,children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[e.jsx("span",{className:n,children:e.jsx(b,{className:m})}),e.jsxs("div",{className:i,children:[e.jsx(t,{as:"div",variant:"body",weight:"medium",children:"Images"}),e.jsx(t,{as:"div",variant:"meta",tone:"secondary",children:"Upload and organize images."})]})]}),e.jsx(o,{className:"mt-0.5 h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-hover:translate-x-0.5 group-hover:text-fg-secondary"})]}),e.jsxs(c,{to:M,search:{page:1},className:l,children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[e.jsx("span",{className:n,children:e.jsx(N,{className:m})}),e.jsxs("div",{className:i,children:[e.jsx(t,{as:"div",variant:"body",weight:"medium",children:"Properties"}),e.jsx(t,{as:"div",variant:"meta",tone:"secondary",children:"Define shared fields for notes and future views."})]})]}),e.jsx(o,{className:"mt-0.5 h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-hover:translate-x-0.5 group-hover:text-fg-secondary"})]}),e.jsxs(c,{to:E,search:{page:1},className:l,children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[e.jsx("span",{className:n,children:e.jsx(w,{className:m})}),e.jsxs("div",{className:i,children:[e.jsx(t,{as:"div",variant:"body",weight:"medium",children:"Placeholders"}),e.jsx(t,{as:"div",variant:"meta",tone:"secondary",children:"Manage template variables."})]})]}),e.jsx(o,{className:"mt-0.5 h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-hover:translate-x-0.5 group-hover:text-fg-secondary"})]})]})]})]})})};export{G as default};
1
+ import{j as e}from"./note-vendor-uuJO2MTD.js";import{p as h,a5 as p,P as f,T as t,L as c,aO as u,g as o,ax as v,aP as j,aJ as M,aL as E,aQ as N,aR as w}from"./index-BgnmVjeF.js";import{a}from"./graph-vendor-CUxe67Lr.js";import{c as y,n as H}from"./Trash.es-B-7U25B6.js";import{I as b}from"./Image.es-DLqLiGdW.js";import"./note-core-DMZcZ4yV.js";const T=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M236.37,139.4a12,12,0,0,0-12-3A84.07,84.07,0,0,1,119.6,31.59a12,12,0,0,0-15-15A108.86,108.86,0,0,0,49.69,55.07,108,108,0,0,0,136,228a107.09,107.09,0,0,0,64.93-21.69,108.86,108.86,0,0,0,38.44-54.94A12,12,0,0,0,236.37,139.4Zm-49.88,47.74A84,84,0,0,1,68.86,69.51,84.93,84.93,0,0,1,92.27,48.29Q92,52.13,92,56A108.12,108.12,0,0,0,200,164q3.87,0,7.71-.27A84.79,84.79,0,0,1,186.49,187.14Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M227.89,147.89A96,96,0,1,1,108.11,28.11,96.09,96.09,0,0,0,227.89,147.89Z",opacity:"0.2"}),a.createElement("path",{d:"M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M235.54,150.21a104.84,104.84,0,0,1-37,52.91A104,104,0,0,1,32,120,103.09,103.09,0,0,1,52.88,57.48a104.84,104.84,0,0,1,52.91-37,8,8,0,0,1,10,10,88.08,88.08,0,0,0,109.8,109.8,8,8,0,0,1,10,10Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M232.13,143.64a6,6,0,0,0-6-1.49A90.07,90.07,0,0,1,113.86,29.85a6,6,0,0,0-7.49-7.48A102.88,102.88,0,0,0,54.48,58.68,102,102,0,0,0,197.32,201.52a102.88,102.88,0,0,0,36.31-51.89A6,6,0,0,0,232.13,143.64Zm-42,48.29a90,90,0,0,1-126-126A90.9,90.9,0,0,1,99.65,37.66,102.06,102.06,0,0,0,218.34,156.35,90.9,90.9,0,0,1,190.1,191.93Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M230.72,145.06a4,4,0,0,0-4-1A92.08,92.08,0,0,1,111.94,29.27a4,4,0,0,0-5-5A100.78,100.78,0,0,0,56.08,59.88a100,100,0,0,0,140,140,100.78,100.78,0,0,0,35.59-50.87A4,4,0,0,0,230.72,145.06ZM191.3,193.53A92,92,0,0,1,62.47,64.7a93,93,0,0,1,39.88-30.35,100.09,100.09,0,0,0,119.3,119.3A93,93,0,0,1,191.3,193.53Z"}))]]),F=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M203.57,51A107.9,107.9,0,0,0,20,128c0,44.72,27.6,82.25,72,97.94A36,36,0,0,0,140,192a12,12,0,0,1,12-12h46.21a35.79,35.79,0,0,0,35.1-28A108.6,108.6,0,0,0,236,127.09,107.23,107.23,0,0,0,203.57,51Zm6.34,95.67a11.91,11.91,0,0,1-11.7,9.3H152a36,36,0,0,0-36,36,12,12,0,0,1-16,11.3c-16.65-5.88-30.65-15.76-40.48-28.56A76,76,0,0,1,44,128a84,84,0,0,1,83.13-84H128a84.35,84.35,0,0,1,84,83.29A84.72,84.72,0,0,1,209.91,146.71ZM144,76a16,16,0,1,1-16-16A16,16,0,0,1,144,76Zm-44,24A16,16,0,1,1,84,84,16,16,0,0,1,100,100Zm0,56a16,16,0,1,1-16-16A16,16,0,0,1,100,156Zm88-56a16,16,0,1,1-16-16A16,16,0,0,1,188,100Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M224,127.17a96.48,96.48,0,0,1-2.39,22.18A24,24,0,0,1,198.21,168H152a24,24,0,0,0-24,24,24,24,0,0,1-32,22.61C58.73,201.44,32,169.81,32,128a96,96,0,0,1,95-96C179.84,31.47,223.55,74.35,224,127.17Z",opacity:"0.2"}),a.createElement("path",{d:"M200.77,53.89A103.27,103.27,0,0,0,128,24h-1.07A104,104,0,0,0,24,128c0,43,26.58,79.06,69.36,94.17A32,32,0,0,0,136,192a16,16,0,0,1,16-16h46.21a31.81,31.81,0,0,0,31.2-24.88,104.43,104.43,0,0,0,2.59-24A103.28,103.28,0,0,0,200.77,53.89Zm13,93.71A15.89,15.89,0,0,1,198.21,160H152a32,32,0,0,0-32,32,16,16,0,0,1-21.31,15.07C62.49,194.3,40,164,40,128a88,88,0,0,1,87.09-88h.9a88.35,88.35,0,0,1,88,87.25A88.86,88.86,0,0,1,213.81,147.6ZM140,76a12,12,0,1,1-12-12A12,12,0,0,1,140,76ZM96,100A12,12,0,1,1,84,88,12,12,0,0,1,96,100Zm0,56a12,12,0,1,1-12-12A12,12,0,0,1,96,156Zm88-56a12,12,0,1,1-12-12A12,12,0,0,1,184,100Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M200.77,53.89A103.27,103.27,0,0,0,128,24h-1.07A104,104,0,0,0,24,128c0,43,26.58,79.06,69.36,94.17A32,32,0,0,0,136,192a16,16,0,0,1,16-16h46.21a31.81,31.81,0,0,0,31.2-24.88,104.43,104.43,0,0,0,2.59-24A103.28,103.28,0,0,0,200.77,53.89ZM84,168a12,12,0,1,1,12-12A12,12,0,0,1,84,168Zm0-56a12,12,0,1,1,12-12A12,12,0,0,1,84,112Zm44-24a12,12,0,1,1,12-12A12,12,0,0,1,128,88Zm44,24a12,12,0,1,1,12-12A12,12,0,0,1,172,112Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M199.37,55.31A101.32,101.32,0,0,0,128,26h-1A102,102,0,0,0,26,128c0,42.09,26.07,77.44,68,92.26A30.21,30.21,0,0,0,104.11,222,30.06,30.06,0,0,0,134,192a18,18,0,0,1,18-18h46.21a29.82,29.82,0,0,0,29.25-23.31A102.71,102.71,0,0,0,230,127.11,101.25,101.25,0,0,0,199.37,55.31ZM215.76,148a17.89,17.89,0,0,1-17.55,14H152a30,30,0,0,0-30,30,18,18,0,0,1-24,17C61,195.86,38,164.85,38,128a90,90,0,0,1,89.07-90H128a90.34,90.34,0,0,1,90,89.22A90.46,90.46,0,0,1,215.76,148ZM138,76a10,10,0,1,1-10-10A10,10,0,0,1,138,76ZM94,100A10,10,0,1,1,84,90,10,10,0,0,1,94,100Zm0,56a10,10,0,1,1-10-10A10,10,0,0,1,94,156Zm88-56a10,10,0,1,1-10-10A10,10,0,0,1,182,100Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M200.77,53.89A103.27,103.27,0,0,0,128,24h-1.07A104,104,0,0,0,24,128c0,43,26.58,79.06,69.36,94.17A32,32,0,0,0,136,192a16,16,0,0,1,16-16h46.21a31.81,31.81,0,0,0,31.2-24.88,104.43,104.43,0,0,0,2.59-24A103.28,103.28,0,0,0,200.77,53.89Zm13,93.71A15.89,15.89,0,0,1,198.21,160H152a32,32,0,0,0-32,32,16,16,0,0,1-21.31,15.07C62.49,194.3,40,164,40,128a88,88,0,0,1,87.09-88h.9a88.35,88.35,0,0,1,88,87.25A88.86,88.86,0,0,1,213.81,147.6ZM140,76a12,12,0,1,1-12-12A12,12,0,0,1,140,76ZM96,100A12,12,0,1,1,84,88,12,12,0,0,1,96,100Zm0,56a12,12,0,1,1-12-12A12,12,0,0,1,96,156Zm88-56a12,12,0,1,1-12-12A12,12,0,0,1,184,100Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M198,56.74A99.31,99.31,0,0,0,128,28h-1A100,100,0,0,0,28,128c0,41.22,25.55,75.85,66.69,90.38a28.34,28.34,0,0,0,9.42,1.63A28,28,0,0,0,132,192a20,20,0,0,1,20-20h46.21a27.84,27.84,0,0,0,27.3-21.76,100.37,100.37,0,0,0,2.49-23.1A99.26,99.26,0,0,0,198,56.74Zm19.74,91.72A19.89,19.89,0,0,1,198.21,164H152a28,28,0,0,0-28,28,20,20,0,0,1-26.64,18.83C59.51,197.46,36,165.72,36,128a92,92,0,0,1,91.05-92H128a92,92,0,0,1,89.72,112.46ZM136,76a8,8,0,1,1-8-8A8,8,0,0,1,136,76ZM92,100a8,8,0,1,1-8-8A8,8,0,0,1,92,100Zm0,56a8,8,0,1,1-8-8A8,8,0,0,1,92,156Zm88-56a8,8,0,1,1-8-8A8,8,0,0,1,180,100Z"}))]]),V=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M116,36V20a12,12,0,0,1,24,0V36a12,12,0,0,1-24,0Zm80,92a68,68,0,1,1-68-68A68.07,68.07,0,0,1,196,128Zm-24,0a44,44,0,1,0-44,44A44.05,44.05,0,0,0,172,128ZM51.51,68.49a12,12,0,1,0,17-17l-12-12a12,12,0,0,0-17,17Zm0,119-12,12a12,12,0,0,0,17,17l12-12a12,12,0,1,0-17-17ZM196,72a12,12,0,0,0,8.49-3.51l12-12a12,12,0,0,0-17-17l-12,12A12,12,0,0,0,196,72Zm8.49,115.51a12,12,0,0,0-17,17l12,12a12,12,0,0,0,17-17ZM48,128a12,12,0,0,0-12-12H20a12,12,0,0,0,0,24H36A12,12,0,0,0,48,128Zm80,80a12,12,0,0,0-12,12v16a12,12,0,0,0,24,0V220A12,12,0,0,0,128,208Zm108-92H220a12,12,0,0,0,0,24h16a12,12,0,0,0,0-24Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M184,128a56,56,0,1,1-56-56A56,56,0,0,1,184,128Z",opacity:"0.2"}),a.createElement("path",{d:"M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm8,24a64,64,0,1,0,64,64A64.07,64.07,0,0,0,128,64ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M122,40V16a6,6,0,0,1,12,0V40a6,6,0,0,1-12,0Zm68,88a62,62,0,1,1-62-62A62.07,62.07,0,0,1,190,128Zm-12,0a50,50,0,1,0-50,50A50.06,50.06,0,0,0,178,128ZM59.76,68.24a6,6,0,1,0,8.48-8.48l-16-16a6,6,0,0,0-8.48,8.48Zm0,119.52-16,16a6,6,0,1,0,8.48,8.48l16-16a6,6,0,1,0-8.48-8.48ZM192,70a6,6,0,0,0,4.24-1.76l16-16a6,6,0,0,0-8.48-8.48l-16,16A6,6,0,0,0,192,70Zm4.24,117.76a6,6,0,0,0-8.48,8.48l16,16a6,6,0,0,0,8.48-8.48ZM46,128a6,6,0,0,0-6-6H16a6,6,0,0,0,0,12H40A6,6,0,0,0,46,128Zm82,82a6,6,0,0,0-6,6v24a6,6,0,0,0,12,0V216A6,6,0,0,0,128,210Zm112-88H216a6,6,0,0,0,0,12h24a6,6,0,0,0,0-12Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M124,40V16a4,4,0,0,1,8,0V40a4,4,0,0,1-8,0Zm64,88a60,60,0,1,1-60-60A60.07,60.07,0,0,1,188,128Zm-8,0a52,52,0,1,0-52,52A52.06,52.06,0,0,0,180,128ZM61.17,66.83a4,4,0,0,0,5.66-5.66l-16-16a4,4,0,0,0-5.66,5.66Zm0,122.34-16,16a4,4,0,0,0,5.66,5.66l16-16a4,4,0,0,0-5.66-5.66ZM192,68a4,4,0,0,0,2.83-1.17l16-16a4,4,0,1,0-5.66-5.66l-16,16A4,4,0,0,0,192,68Zm2.83,121.17a4,4,0,0,0-5.66,5.66l16,16a4,4,0,0,0,5.66-5.66ZM40,124H16a4,4,0,0,0,0,8H40a4,4,0,0,0,0-8Zm88,88a4,4,0,0,0-4,4v24a4,4,0,0,0,8,0V216A4,4,0,0,0,128,212Zm112-88H216a4,4,0,0,0,0,8h24a4,4,0,0,0,0-8Z"}))]]),A=a.forwardRef((s,r)=>a.createElement(h,{ref:r,...s,weights:T}));A.displayName="MoonIcon";const S=A,g=a.forwardRef((s,r)=>a.createElement(h,{ref:r,...s,weights:F}));g.displayName="PaletteIcon";const k=g,x=a.forwardRef((s,r)=>a.createElement(h,{ref:r,...s,weights:V}));x.displayName="SunIcon";const C=x,$=()=>{const{theme:s,toggleTheme:r}=p(Z=>Z),l="focus-ring-soft surface-base group flex items-start justify-between gap-3.5 px-4 py-3.5 text-left text-fg-default outline-none transition-colors hover:bg-hover-subtle",n="inline-flex h-12 w-12 shrink-0 items-center justify-center rounded-[15px] border border-border-subtle bg-muted text-fg-secondary transition-colors group-hover:border-border-secondary/70 group-hover:text-fg-default",m="h-6 w-6",d="text-fg-tertiary",i="min-w-0 flex flex-col gap-0.5 pt-0.5";return e.jsx(f,{title:"Settings",description:"Manage appearance, integrations, and workspace tools",children:e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsxs("section",{className:"flex flex-col gap-3",children:[e.jsx(t,{as:"p",variant:"label",weight:"medium",className:d,children:"Appearance"}),e.jsxs("button",{type:"button",className:l,onClick:r,children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[e.jsx("span",{className:n,children:e.jsx(k,{className:m})}),e.jsxs("div",{className:i,children:[e.jsx(t,{as:"div",variant:"body",weight:"medium",children:"Theme"}),e.jsx(t,{as:"div",variant:"meta",tone:"secondary",children:"Switch between light and dark mode."})]})]}),e.jsxs("div",{className:"mt-0.5 flex shrink-0 items-center gap-2 text-fg-tertiary",children:[e.jsx(t,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:s==="dark"?"Dark":"Light"}),s==="dark"?e.jsx(S,{className:"h-4 w-4",weight:"fill"}):e.jsx(C,{className:"h-4 w-4",weight:"fill"})]})]})]}),e.jsxs("section",{className:"flex flex-col gap-3",children:[e.jsx(t,{as:"p",variant:"label",weight:"medium",className:d,children:"Integrations"}),e.jsxs(c,{to:u,className:l,children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[e.jsx("span",{className:n,children:e.jsx(y,{className:m})}),e.jsxs("div",{className:i,children:[e.jsx(t,{as:"div",variant:"body",weight:"medium",children:"MCP"}),e.jsx(t,{as:"div",variant:"meta",tone:"secondary",children:"Manage AI integration access."})]})]}),e.jsx(o,{className:"mt-0.5 h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-hover:translate-x-0.5 group-hover:text-fg-secondary"})]})]}),e.jsxs("section",{className:"flex flex-col gap-3",children:[e.jsx(t,{as:"p",variant:"label",weight:"medium",className:d,children:"Workspace"}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[e.jsxs(c,{to:v,search:{page:1},className:l,children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[e.jsx("span",{className:n,children:e.jsx(H,{className:m})}),e.jsxs("div",{className:i,children:[e.jsx(t,{as:"div",variant:"body",weight:"medium",children:"Trash"}),e.jsx(t,{as:"div",variant:"meta",tone:"secondary",children:"Restore deleted notes."})]})]}),e.jsx(o,{className:"mt-0.5 h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-hover:translate-x-0.5 group-hover:text-fg-secondary"})]}),e.jsxs(c,{to:j,search:{page:1},className:l,children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[e.jsx("span",{className:n,children:e.jsx(b,{className:m})}),e.jsxs("div",{className:i,children:[e.jsx(t,{as:"div",variant:"body",weight:"medium",children:"Images"}),e.jsx(t,{as:"div",variant:"meta",tone:"secondary",children:"Upload and organize images."})]})]}),e.jsx(o,{className:"mt-0.5 h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-hover:translate-x-0.5 group-hover:text-fg-secondary"})]}),e.jsxs(c,{to:M,search:{page:1},className:l,children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[e.jsx("span",{className:n,children:e.jsx(E,{className:m})}),e.jsxs("div",{className:i,children:[e.jsx(t,{as:"div",variant:"body",weight:"medium",children:"Properties"}),e.jsx(t,{as:"div",variant:"meta",tone:"secondary",children:"Define shared fields for notes and future views."})]})]}),e.jsx(o,{className:"mt-0.5 h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-hover:translate-x-0.5 group-hover:text-fg-secondary"})]}),e.jsxs(c,{to:N,search:{page:1},className:l,children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[e.jsx("span",{className:n,children:e.jsx(w,{className:m})}),e.jsxs("div",{className:i,children:[e.jsx(t,{as:"div",variant:"body",weight:"medium",children:"Placeholders"}),e.jsx(t,{as:"div",variant:"meta",tone:"secondary",children:"Manage template variables."})]})]}),e.jsx(o,{className:"mt-0.5 h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-hover:translate-x-0.5 group-hover:text-fg-secondary"})]})]})]})]})})};export{$ as default};
@@ -1 +1 @@
1
- import{j as e}from"./note-vendor-uuJO2MTD.js";import{a6 as L,q as T,y as G,k as S,ah as C,a0 as F,P as N,J as k,L as q,aY as B,T as O,B as D,a1 as z,i as h,j as K,aO as Q}from"./index-B43ulIPo.js";import{f as U,d as W}from"./image.api-CuGTgzyQ.js";import{a as x}from"./graph-vendor-CUxe67Lr.js";import{I as H}from"./Image-DK0lnaK2.js";import{S as M}from"./SurfaceCard-Bnfo5EOl.js";import{c as $,n as J}from"./Trash.es-BcwUz2yM.js";import"./note-core-DMZcZ4yV.js";const V=n=>{const{data:a}=L({queryKey:T.images.list(n.searchParams),async queryFn(){const s=await U({offset:n.searchParams.offset,limit:n.searchParams.limit});if(s.type==="error")throw s;return s.allImages}});return n.render(a)},b=16;function X(n,a,s){return Math.max(Math.floor((Math.max(n,0)+s)/(a+s)),1)}function _(n,a,s){return n*a+(n-1)*s}function Y({minItemWidth:n,gap:a,rows:s,fallback:l,override:g}){const[i,w]=x.useState(null),[v,p]=x.useState(l??s),r=x.useRef(null),o=x.useCallback(t=>{w(t)},[]),d=g==null,y=d?v:g;return x.useLayoutEffect(()=>{if(!d){r.current=null;return}if(!i){r.current=null,p(c=>c===(l??s)?c:l??s);return}let t=null;const I=()=>{const c=i.offsetWidth,E=X(c,n,a),u=r.current;let j=E;if(u!==null&&u!==E)if(E>u){const f=_(u+1,n,a);c<f+b&&(j=u)}else{const f=_(u,n,a);c>f-b&&(j=u)}r.current=j;const A=Math.max(j*s,s);p(f=>f===A?f:A)},m=()=>{t===null&&(t=window.requestAnimationFrame(()=>{t=null,I()}))};if(m(),typeof ResizeObserver<"u"){const c=new ResizeObserver(()=>{m()});return c.observe(i),()=>{c.disconnect(),t!==null&&window.cancelAnimationFrame(t)}}return window.addEventListener("resize",m),window.addEventListener("orientationchange",m),()=>{window.removeEventListener("resize",m),window.removeEventListener("orientationchange",m),t!==null&&window.cancelAnimationFrame(t)}},[i,l,a,d,n,s]),{containerRef:o,limit:y,isAutoLimit:d}}const Z=240,ee=20,te=4,R=192,P=K(Q),de=()=>{const n=G(),a=S(),s=P.useNavigate(),{page:l}=P.useSearch(),{containerRef:g,limit:i}=Y({minItemWidth:Z,gap:ee,rows:te}),w=C({mutationFn:W,onSuccess:r=>{if(r.type==="error")throw r;a.invalidateQueries({queryKey:T.images.listAll(),exact:!1})}}),v=async r=>{await n("Delete this image? It is not referenced by any notes.")&&w.mutate(r)},p=r=>r===1?"1 reference":`${r} references`;return e.jsx("div",{ref:g,children:e.jsx(F,{fallback:e.jsx(N,{title:"Images",variant:"default",heading:e.jsx(h,{width:136,height:24,className:"rounded-full"}),description:e.jsx(h,{width:232,height:16,className:"rounded-full"}),children:e.jsx("div",{className:"flex flex-col gap-4",children:e.jsx("div",{className:"grid-auto-cards grid gap-4",children:Array.from({length:3},(r,o)=>e.jsxs(M,{flush:!0,children:[e.jsx("div",{className:"flex items-center justify-center bg-muted/25 p-3",style:{height:R},children:e.jsx(h,{width:"100%",height:R-24,className:"rounded-[12px]"})}),e.jsxs("div",{className:"flex items-center justify-between gap-3 border-t border-border-subtle px-3 py-2.5",children:[e.jsx(h,{width:92,height:14,className:"rounded-full"}),e.jsx(h,{width:32,height:32,className:"rounded-[12px]"})]})]},o))})})}),errorTitle:"Failed to load images",errorDescription:"Retry loading uploaded image metadata",resetKeys:[l,i],children:e.jsx(V,{searchParams:{offset:(l-1)*i,limit:i},render:({images:r,totalCount:o})=>{const d=o>0?`Images (${o})`:void 0,y="Review and manage the images you uploaded inside notes";return r.length===0?e.jsx(N,{title:"Images",variant:"default",heading:d,description:y,children:e.jsx(k,{title:"There are no images",description:"Upload an image in any note and it will appear here"})}):e.jsx(N,{title:"Images",variant:"default",heading:d,description:y,children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"grid-auto-cards grid gap-4",children:r.map(t=>e.jsxs(M,{flush:!0,children:[e.jsx(q,{to:B,params:{id:t.id},className:"focus-ring-soft block overflow-hidden rounded-t-[18px] outline-none",children:e.jsx("div",{className:"flex items-center justify-center bg-muted/25 p-3",style:{height:R},children:e.jsx(H,{className:"h-full w-full rounded-[12px] object-contain transition-transform duration-200 hover:scale-[1.02]",src:t.url,alt:t.id})})}),e.jsxs("div",{className:"flex items-center justify-between gap-3 border-t border-border-subtle px-3 py-2.5",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-fg-secondary",children:[e.jsx($,{className:"h-3.5 w-3.5 shrink-0 text-fg-tertiary"}),e.jsx(O,{as:"span",variant:"meta",weight:"medium",tone:"secondary",className:"truncate",children:p(t.referenceCount)})]}),e.jsx(D,{variant:"ghost",size:"icon-sm",disabled:t.referenceCount>0,onClick:()=>v(t.id),children:e.jsx(J,{className:"h-4 w-4"})})]})]},t.id))}),o&&i<o&&e.jsx(z,{page:l,last:Math.ceil(o/i),onChange:t=>{s({search:I=>({...I,page:t})})}})]})})}})})})};export{de as default};
1
+ import{j as e}from"./note-vendor-uuJO2MTD.js";import{a6 as L,q as T,y as G,k as S,ah as C,a0 as F,P as N,J as k,L as q,aZ as B,T as D,B as O,a1 as z,i as h,j as K,aP as Q}from"./index-BgnmVjeF.js";import{f as U,d as W}from"./image.api-BtadKO98.js";import{a as x}from"./graph-vendor-CUxe67Lr.js";import{I as H}from"./Image-DK0lnaK2.js";import{S as M}from"./SurfaceCard-Brd1cMxi.js";import{c as $,n as J}from"./Trash.es-B-7U25B6.js";import"./note-core-DMZcZ4yV.js";const V=n=>{const{data:a}=L({queryKey:T.images.list(n.searchParams),async queryFn(){const s=await U({offset:n.searchParams.offset,limit:n.searchParams.limit});if(s.type==="error")throw s;return s.allImages}});return n.render(a)},b=16;function X(n,a,s){return Math.max(Math.floor((Math.max(n,0)+s)/(a+s)),1)}function _(n,a,s){return n*a+(n-1)*s}function Z({minItemWidth:n,gap:a,rows:s,fallback:l,override:g}){const[i,w]=x.useState(null),[v,p]=x.useState(l??s),r=x.useRef(null),o=x.useCallback(t=>{w(t)},[]),d=g==null,y=d?v:g;return x.useLayoutEffect(()=>{if(!d){r.current=null;return}if(!i){r.current=null,p(c=>c===(l??s)?c:l??s);return}let t=null;const I=()=>{const c=i.offsetWidth,E=X(c,n,a),u=r.current;let j=E;if(u!==null&&u!==E)if(E>u){const f=_(u+1,n,a);c<f+b&&(j=u)}else{const f=_(u,n,a);c>f-b&&(j=u)}r.current=j;const A=Math.max(j*s,s);p(f=>f===A?f:A)},m=()=>{t===null&&(t=window.requestAnimationFrame(()=>{t=null,I()}))};if(m(),typeof ResizeObserver<"u"){const c=new ResizeObserver(()=>{m()});return c.observe(i),()=>{c.disconnect(),t!==null&&window.cancelAnimationFrame(t)}}return window.addEventListener("resize",m),window.addEventListener("orientationchange",m),()=>{window.removeEventListener("resize",m),window.removeEventListener("orientationchange",m),t!==null&&window.cancelAnimationFrame(t)}},[i,l,a,d,n,s]),{containerRef:o,limit:y,isAutoLimit:d}}const Y=240,ee=20,te=4,R=192,P=K(Q),de=()=>{const n=G(),a=S(),s=P.useNavigate(),{page:l}=P.useSearch(),{containerRef:g,limit:i}=Z({minItemWidth:Y,gap:ee,rows:te}),w=C({mutationFn:W,onSuccess:r=>{if(r.type==="error")throw r;a.invalidateQueries({queryKey:T.images.listAll(),exact:!1})}}),v=async r=>{await n("Delete this image? It is not referenced by any notes.")&&w.mutate(r)},p=r=>r===1?"1 reference":`${r} references`;return e.jsx("div",{ref:g,children:e.jsx(F,{fallback:e.jsx(N,{title:"Images",variant:"default",heading:e.jsx(h,{width:136,height:24,className:"rounded-full"}),description:e.jsx(h,{width:232,height:16,className:"rounded-full"}),children:e.jsx("div",{className:"flex flex-col gap-4",children:e.jsx("div",{className:"grid-auto-cards grid gap-4",children:Array.from({length:3},(r,o)=>e.jsxs(M,{flush:!0,children:[e.jsx("div",{className:"flex items-center justify-center bg-muted/25 p-3",style:{height:R},children:e.jsx(h,{width:"100%",height:R-24,className:"rounded-[12px]"})}),e.jsxs("div",{className:"flex items-center justify-between gap-3 border-t border-border-subtle px-3 py-2.5",children:[e.jsx(h,{width:92,height:14,className:"rounded-full"}),e.jsx(h,{width:32,height:32,className:"rounded-[12px]"})]})]},o))})})}),errorTitle:"Failed to load images",errorDescription:"Retry loading uploaded image metadata",resetKeys:[l,i],children:e.jsx(V,{searchParams:{offset:(l-1)*i,limit:i},render:({images:r,totalCount:o})=>{const d=o>0?`Images (${o})`:void 0,y="Review and manage the images you uploaded inside notes";return r.length===0?e.jsx(N,{title:"Images",variant:"default",heading:d,description:y,children:e.jsx(k,{title:"There are no images",description:"Upload an image in any note and it will appear here"})}):e.jsx(N,{title:"Images",variant:"default",heading:d,description:y,children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"grid-auto-cards grid gap-4",children:r.map(t=>e.jsxs(M,{flush:!0,children:[e.jsx(q,{to:B,params:{id:t.id},className:"focus-ring-soft block overflow-hidden rounded-t-[18px] outline-none",children:e.jsx("div",{className:"flex items-center justify-center bg-muted/25 p-3",style:{height:R},children:e.jsx(H,{className:"h-full w-full rounded-[12px] object-contain transition-transform duration-200 hover:scale-[1.02]",src:t.url,alt:t.id})})}),e.jsxs("div",{className:"flex items-center justify-between gap-3 border-t border-border-subtle px-3 py-2.5",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-fg-secondary",children:[e.jsx($,{className:"h-3.5 w-3.5 shrink-0 text-fg-tertiary"}),e.jsx(D,{as:"span",variant:"meta",weight:"medium",tone:"secondary",className:"truncate",children:p(t.referenceCount)})]}),e.jsx(O,{variant:"ghost",size:"icon-sm",disabled:t.referenceCount>0,onClick:()=>v(t.id),children:e.jsx(J,{className:"h-4 w-4"})})]})]},t.id))}),o&&i<o&&e.jsx(z,{page:l,last:Math.ceil(o/i),onChange:t=>{s({search:I=>({...I,page:t})})}})]})})}})})})};export{de as default};
@@ -1 +1 @@
1
- import{j as e}from"./note-vendor-uuJO2MTD.js";import{p as D,T as r,t as F,L as p,N as _,ad as R,aZ as Z,aO as E,f as q,a0 as B,j as G,aY as L,y as O,k as z,a6 as b,q as x,a_ as H,ah as v,a$ as K,b0 as P,B as w,i as l,m as Q}from"./index-B43ulIPo.js";import{a as U,d as $}from"./image.api-CuGTgzyQ.js";import{a as t}from"./graph-vendor-CUxe67Lr.js";import{I as V}from"./Image-DK0lnaK2.js";import{S as g}from"./SurfaceCard-Bnfo5EOl.js";import{c as W,n as Y}from"./Trash.es-BcwUz2yM.js";import{I as J}from"./Image.es-CtMc7BW4.js";import"./note-core-DMZcZ4yV.js";const X=new Map([["bold",t.createElement(t.Fragment,null,t.createElement("path",{d:"M178,36c-20.09,0-37.92,7.93-50,21.56C115.92,43.93,98.09,36,78,36a66.08,66.08,0,0,0-66,66c0,72.34,105.81,130.14,110.31,132.57a12,12,0,0,0,11.38,0C138.19,232.14,244,174.34,244,102A66.08,66.08,0,0,0,178,36Zm-5.49,142.36A328.69,328.69,0,0,1,128,210.16a328.69,328.69,0,0,1-44.51-31.8C61.82,159.77,36,131.42,36,102A42,42,0,0,1,78,60c17.8,0,32.7,9.4,38.89,24.54a12,12,0,0,0,22.22,0C145.3,69.4,160.2,60,178,60a42,42,0,0,1,42,42C220,131.42,194.18,159.77,172.51,178.36Z"}))],["duotone",t.createElement(t.Fragment,null,t.createElement("path",{d:"M232,102c0,66-104,122-104,122S24,168,24,102A54,54,0,0,1,78,48c22.59,0,41.94,12.31,50,32,8.06-19.69,27.41-32,50-32A54,54,0,0,1,232,102Z",opacity:"0.2"}),t.createElement("path",{d:"M178,40c-20.65,0-38.73,8.88-50,23.89C116.73,48.88,98.65,40,78,40a62.07,62.07,0,0,0-62,62c0,70,103.79,126.66,108.21,129a8,8,0,0,0,7.58,0C136.21,228.66,240,172,240,102A62.07,62.07,0,0,0,178,40ZM128,214.8C109.74,204.16,32,155.69,32,102A46.06,46.06,0,0,1,78,56c19.45,0,35.78,10.36,42.6,27a8,8,0,0,0,14.8,0c6.82-16.67,23.15-27,42.6-27a46.06,46.06,0,0,1,46,46C224,155.61,146.24,204.15,128,214.8Z"}))],["fill",t.createElement(t.Fragment,null,t.createElement("path",{d:"M240,102c0,70-103.79,126.66-108.21,129a8,8,0,0,1-7.58,0C119.79,228.66,16,172,16,102A62.07,62.07,0,0,1,78,40c20.65,0,38.73,8.88,50,23.89C139.27,48.88,157.35,40,178,40A62.07,62.07,0,0,1,240,102Z"}))],["light",t.createElement(t.Fragment,null,t.createElement("path",{d:"M178,42c-21,0-39.26,9.47-50,25.34C117.26,51.47,99,42,78,42a60.07,60.07,0,0,0-60,60c0,29.2,18.2,59.59,54.1,90.31a334.68,334.68,0,0,0,53.06,37,6,6,0,0,0,5.68,0,334.68,334.68,0,0,0,53.06-37C219.8,161.59,238,131.2,238,102A60.07,60.07,0,0,0,178,42ZM128,217.11C111.59,207.64,30,157.72,30,102A48.05,48.05,0,0,1,78,54c20.28,0,37.31,10.83,44.45,28.27a6,6,0,0,0,11.1,0C140.69,64.83,157.72,54,178,54a48.05,48.05,0,0,1,48,48C226,157.72,144.41,207.64,128,217.11Z"}))],["regular",t.createElement(t.Fragment,null,t.createElement("path",{d:"M178,40c-20.65,0-38.73,8.88-50,23.89C116.73,48.88,98.65,40,78,40a62.07,62.07,0,0,0-62,62c0,70,103.79,126.66,108.21,129a8,8,0,0,0,7.58,0C136.21,228.66,240,172,240,102A62.07,62.07,0,0,0,178,40ZM128,214.8C109.74,204.16,32,155.69,32,102A46.06,46.06,0,0,1,78,56c19.45,0,35.78,10.36,42.6,27a8,8,0,0,0,14.8,0c6.82-16.67,23.15-27,42.6-27a46.06,46.06,0,0,1,46,46C224,155.61,146.24,204.15,128,214.8Z"}))],["thin",t.createElement(t.Fragment,null,t.createElement("path",{d:"M178,44c-21.44,0-39.92,10.19-50,27.07C117.92,54.19,99.44,44,78,44a58.07,58.07,0,0,0-58,58c0,28.59,18,58.47,53.4,88.79a333.81,333.81,0,0,0,52.7,36.73,4,4,0,0,0,3.8,0,333.81,333.81,0,0,0,52.7-36.73C218,160.47,236,130.59,236,102A58.07,58.07,0,0,0,178,44ZM128,219.42c-14-8-100-59.35-100-117.42A50.06,50.06,0,0,1,78,52c21.11,0,38.85,11.31,46.3,29.51a4,4,0,0,0,7.4,0C139.15,63.31,156.89,52,178,52a50.06,50.06,0,0,1,50,50C228,160,142,211.46,128,219.42Z"}))]]),A=t.forwardRef((a,n)=>t.createElement(D,{ref:n,...a,weights:X}));A.displayName="HeartIcon";const ee=A;function ae({name:a}){return e.jsx(r,{as:"div",variant:"label",weight:"medium",tone:"secondary",className:"inline-flex items-center rounded-full border border-border-subtle bg-hover-subtle px-2.5 py-1",children:a})}function se({id:a,title:n,tags:i,createdAt:u,updatedAt:d}){const o=new Date(Number(u)),m=F(Number(d));return e.jsx("div",{className:"border-b-2 border-dashed border-border-subtle last:border-b-0",children:e.jsxs("div",{className:"py-4 flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(r,{variant:"label",weight:"medium",tone:"tertiary",children:m}),e.jsxs(r,{variant:"label",tone:"placeholder",children:["(",o.toDateString(),")"]})]}),e.jsx(r,{as:"div",variant:"body",weight:"bold",tracking:"tight",children:e.jsx(p,{className:"transition-colors hover:text-accent-primary",to:_,params:{id:a},children:n||"Untitled"})}),i&&i.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.map(c=>e.jsx(p,{to:R,params:{id:c.id},search:{page:1},children:e.jsx(ae,{name:c.name})},c.id))})]})})}const I=G(L),j=352,te="mb-4 inline-flex items-center gap-1 text-fg-secondary transition-colors hover:text-fg-default",T="flex items-center justify-center bg-muted/25 p-3",re="h-full w-full rounded-[12px] object-contain",M="mb-3 flex flex-wrap items-start justify-between gap-3 border-b border-border-subtle pb-3",S="space-y-1",ne=a=>a===1?"1 reference":`${a} references`,C=(a,n)=>typeof a=="object"&&a!==null&&"errors"in a&&Array.isArray(a.errors)&&typeof a.errors[0]?.message=="string"?a.errors[0].message:a instanceof Error&&a.message?a.message:n,ie=()=>e.jsxs("div",{className:"flex flex-col gap-6 lg:flex-row",children:[e.jsx("div",{className:"w-full lg:w-[400px] lg:flex-shrink-0",children:e.jsxs(g,{flush:!0,children:[e.jsx("div",{className:T,style:{height:j},children:e.jsx(l,{width:"100%",height:j-24,className:"rounded-[12px]"})}),e.jsxs("div",{className:"flex flex-col gap-4 border-t border-border-subtle p-4",children:[e.jsx(l,{width:96,height:14,className:"rounded-full"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(l,{height:32,className:"flex-1 rounded-[12px]"}),e.jsx(l,{height:32,className:"flex-1 rounded-[12px]"})]})]})]})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs(g,{children:[e.jsxs("div",{className:M,children:[e.jsxs("div",{className:S,children:[e.jsx(l,{width:140,height:18}),e.jsx(l,{width:220,height:14,className:"rounded-full"})]}),e.jsx(l,{width:84,height:14,className:"rounded-full"})]}),e.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:3},(a,n)=>e.jsx(l,{height:72,className:"rounded-[16px]"},n))})]})})]}),le=({id:a})=>{const n=O(),i=Q(),u=I.useNavigate(),d=z(),{data:o}=b({queryKey:x.images.detail(a),queryFn:async()=>{const s=await U(a);if(s.type==="error")throw s;return s.image}}),{data:m}=b({queryKey:x.images.notes(a),queryFn:async()=>{const s=await H(o.url);if(s.type==="error")throw s;return s.imageNotes}}),c=m.length,y=ne(c),h=c===0,f=v({mutationFn:async()=>{const s=await $(a);if(s.type==="error")throw s;if(!s.deleteImage)throw new Error("Failed to delete image");return s.deleteImage},onSuccess:async()=>{await d.invalidateQueries({queryKey:x.images.listAll(),exact:!1}),i("Image deleted"),u({to:E,search:{page:1}})},onError:s=>{i(C(s,"Failed to delete image"))}}),N=v({mutationFn:async()=>{const s=await K("heroBanner",o.url);if(s.type==="error")throw s},onSuccess:async()=>{await d.invalidateQueries({queryKey:x.ui.heroBanner(),exact:!0}),i("Hero banner updated")},onError:s=>{i(C(s,"Failed to update hero banner"))}}),k=async()=>{!h||f.isPending||await n("Delete this image? It is not referenced by any notes.")&&f.mutate()};return e.jsxs("div",{className:"flex flex-col gap-6 lg:flex-row",children:[e.jsx("div",{className:"w-full lg:w-[400px] lg:flex-shrink-0",children:e.jsxs(g,{flush:!0,children:[e.jsx("div",{className:T,style:{height:j},children:e.jsx(V,{className:re,src:o.url,alt:`Image ${o.id}`})}),e.jsxs("div",{className:"flex flex-col gap-4 border-t border-border-subtle p-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(W,{size:14,className:"text-fg-tertiary"}),e.jsx(r,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:y})]}),e.jsx(r,{as:"p",variant:"meta",tone:"tertiary",children:h?"Delete is available because no notes reference this image":"Remove this image from notes before deleting it"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(P,{content:h?"Delete this image":"Cannot delete while referenced by notes",side:"bottom",children:e.jsxs(w,{variant:"soft-danger",size:"sm",className:"flex-1",disabled:!h,isLoading:f.isPending,onClick:k,children:[e.jsx(Y,{size:16}),"Delete"]})}),e.jsxs(w,{variant:"primary",size:"sm",className:"flex-1",isLoading:N.isPending,onClick:()=>N.mutate(),children:[e.jsx(ee,{size:16}),"Set hero banner"]})]})]})]})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs(g,{children:[e.jsxs("div",{className:M,children:[e.jsxs("div",{className:S,children:[e.jsx(r,{as:"h2",variant:"subheading",weight:"medium",tracking:"tight",children:"Referenced Notes"}),e.jsx(r,{as:"p",variant:"meta",tone:"secondary",children:"Notes currently using this image"})]}),e.jsx(r,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:y})]}),c>0?e.jsx("ul",{className:"flex flex-col",children:m.map(s=>e.jsx("li",{children:e.jsx(se,{...s})},s.id))}):e.jsxs("div",{className:"flex items-start gap-3 py-1",children:[e.jsx("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-[10px] bg-muted/25 text-fg-disabled",children:e.jsx(J,{size:18})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(r,{as:"p",variant:"body",weight:"medium",tone:"secondary",children:"No notes reference this image"}),e.jsx(r,{as:"p",variant:"meta",tone:"secondary",children:"This image can be deleted or reused in another note"})]})]})]})})]})},pe=()=>{const{id:a}=I.useParams();return e.jsxs(e.Fragment,{children:[e.jsx(Z,{children:e.jsx("title",{children:"Image Detail | Ocean Brain"})}),e.jsxs(p,{to:E,search:{page:1},className:te,children:[e.jsx(q,{size:16}),e.jsx(r,{as:"span",variant:"meta",weight:"medium",className:"text-current",children:"Back to Images"})]}),e.jsx(r,{as:"h1",variant:"heading",weight:"bold",tracking:"tighter",className:"sr-only",children:"Image Detail"}),e.jsx(B,{fallback:e.jsx(ie,{}),errorTitle:"Failed to load image detail",errorDescription:"Retry loading the image preview and its referenced notes",resetKeys:[a],children:e.jsx(le,{id:a})})]})};export{pe as default};
1
+ import{j as e}from"./note-vendor-uuJO2MTD.js";import{p as D,T as r,t as F,L as p,N as _,ad as R,a_ as Z,aP as E,f as q,a0 as B,j as G,aZ as L,y as z,k as H,a6 as b,q as x,a$ as O,ah as v,b0 as K,b1 as P,B as w,i as l,m as Q}from"./index-BgnmVjeF.js";import{a as U,d as $}from"./image.api-BtadKO98.js";import{a as t}from"./graph-vendor-CUxe67Lr.js";import{I as V}from"./Image-DK0lnaK2.js";import{S as g}from"./SurfaceCard-Brd1cMxi.js";import{c as W,n as J}from"./Trash.es-B-7U25B6.js";import{I as X}from"./Image.es-DLqLiGdW.js";import"./note-core-DMZcZ4yV.js";const Y=new Map([["bold",t.createElement(t.Fragment,null,t.createElement("path",{d:"M178,36c-20.09,0-37.92,7.93-50,21.56C115.92,43.93,98.09,36,78,36a66.08,66.08,0,0,0-66,66c0,72.34,105.81,130.14,110.31,132.57a12,12,0,0,0,11.38,0C138.19,232.14,244,174.34,244,102A66.08,66.08,0,0,0,178,36Zm-5.49,142.36A328.69,328.69,0,0,1,128,210.16a328.69,328.69,0,0,1-44.51-31.8C61.82,159.77,36,131.42,36,102A42,42,0,0,1,78,60c17.8,0,32.7,9.4,38.89,24.54a12,12,0,0,0,22.22,0C145.3,69.4,160.2,60,178,60a42,42,0,0,1,42,42C220,131.42,194.18,159.77,172.51,178.36Z"}))],["duotone",t.createElement(t.Fragment,null,t.createElement("path",{d:"M232,102c0,66-104,122-104,122S24,168,24,102A54,54,0,0,1,78,48c22.59,0,41.94,12.31,50,32,8.06-19.69,27.41-32,50-32A54,54,0,0,1,232,102Z",opacity:"0.2"}),t.createElement("path",{d:"M178,40c-20.65,0-38.73,8.88-50,23.89C116.73,48.88,98.65,40,78,40a62.07,62.07,0,0,0-62,62c0,70,103.79,126.66,108.21,129a8,8,0,0,0,7.58,0C136.21,228.66,240,172,240,102A62.07,62.07,0,0,0,178,40ZM128,214.8C109.74,204.16,32,155.69,32,102A46.06,46.06,0,0,1,78,56c19.45,0,35.78,10.36,42.6,27a8,8,0,0,0,14.8,0c6.82-16.67,23.15-27,42.6-27a46.06,46.06,0,0,1,46,46C224,155.61,146.24,204.15,128,214.8Z"}))],["fill",t.createElement(t.Fragment,null,t.createElement("path",{d:"M240,102c0,70-103.79,126.66-108.21,129a8,8,0,0,1-7.58,0C119.79,228.66,16,172,16,102A62.07,62.07,0,0,1,78,40c20.65,0,38.73,8.88,50,23.89C139.27,48.88,157.35,40,178,40A62.07,62.07,0,0,1,240,102Z"}))],["light",t.createElement(t.Fragment,null,t.createElement("path",{d:"M178,42c-21,0-39.26,9.47-50,25.34C117.26,51.47,99,42,78,42a60.07,60.07,0,0,0-60,60c0,29.2,18.2,59.59,54.1,90.31a334.68,334.68,0,0,0,53.06,37,6,6,0,0,0,5.68,0,334.68,334.68,0,0,0,53.06-37C219.8,161.59,238,131.2,238,102A60.07,60.07,0,0,0,178,42ZM128,217.11C111.59,207.64,30,157.72,30,102A48.05,48.05,0,0,1,78,54c20.28,0,37.31,10.83,44.45,28.27a6,6,0,0,0,11.1,0C140.69,64.83,157.72,54,178,54a48.05,48.05,0,0,1,48,48C226,157.72,144.41,207.64,128,217.11Z"}))],["regular",t.createElement(t.Fragment,null,t.createElement("path",{d:"M178,40c-20.65,0-38.73,8.88-50,23.89C116.73,48.88,98.65,40,78,40a62.07,62.07,0,0,0-62,62c0,70,103.79,126.66,108.21,129a8,8,0,0,0,7.58,0C136.21,228.66,240,172,240,102A62.07,62.07,0,0,0,178,40ZM128,214.8C109.74,204.16,32,155.69,32,102A46.06,46.06,0,0,1,78,56c19.45,0,35.78,10.36,42.6,27a8,8,0,0,0,14.8,0c6.82-16.67,23.15-27,42.6-27a46.06,46.06,0,0,1,46,46C224,155.61,146.24,204.15,128,214.8Z"}))],["thin",t.createElement(t.Fragment,null,t.createElement("path",{d:"M178,44c-21.44,0-39.92,10.19-50,27.07C117.92,54.19,99.44,44,78,44a58.07,58.07,0,0,0-58,58c0,28.59,18,58.47,53.4,88.79a333.81,333.81,0,0,0,52.7,36.73,4,4,0,0,0,3.8,0,333.81,333.81,0,0,0,52.7-36.73C218,160.47,236,130.59,236,102A58.07,58.07,0,0,0,178,44ZM128,219.42c-14-8-100-59.35-100-117.42A50.06,50.06,0,0,1,78,52c21.11,0,38.85,11.31,46.3,29.51a4,4,0,0,0,7.4,0C139.15,63.31,156.89,52,178,52a50.06,50.06,0,0,1,50,50C228,160,142,211.46,128,219.42Z"}))]]),A=t.forwardRef((a,n)=>t.createElement(D,{ref:n,...a,weights:Y}));A.displayName="HeartIcon";const ee=A;function ae({name:a}){return e.jsx(r,{as:"div",variant:"label",weight:"medium",tone:"secondary",className:"inline-flex items-center rounded-full border border-border-subtle bg-hover-subtle px-2.5 py-1",children:a})}function se({id:a,title:n,tags:i,createdAt:u,updatedAt:d}){const o=new Date(Number(u)),m=F(Number(d));return e.jsx("div",{className:"border-b-2 border-dashed border-border-subtle last:border-b-0",children:e.jsxs("div",{className:"py-4 flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(r,{variant:"label",weight:"medium",tone:"tertiary",children:m}),e.jsxs(r,{variant:"label",tone:"placeholder",children:["(",o.toDateString(),")"]})]}),e.jsx(r,{as:"div",variant:"body",weight:"bold",tracking:"tight",children:e.jsx(p,{className:"transition-colors hover:text-accent-primary",to:_,params:{id:a},children:n||"Untitled"})}),i&&i.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.map(c=>e.jsx(p,{to:R,params:{id:c.id},search:{page:1},children:e.jsx(ae,{name:c.name})},c.id))})]})})}const I=G(L),j=352,te="mb-4 inline-flex items-center gap-1 text-fg-secondary transition-colors hover:text-fg-default",T="flex items-center justify-center bg-muted/25 p-3",re="h-full w-full rounded-[12px] object-contain",M="mb-3 flex flex-wrap items-start justify-between gap-3 border-b border-border-subtle pb-3",S="space-y-1",ne=a=>a===1?"1 reference":`${a} references`,C=(a,n)=>typeof a=="object"&&a!==null&&"errors"in a&&Array.isArray(a.errors)&&typeof a.errors[0]?.message=="string"?a.errors[0].message:a instanceof Error&&a.message?a.message:n,ie=()=>e.jsxs("div",{className:"flex flex-col gap-6 lg:flex-row",children:[e.jsx("div",{className:"w-full lg:w-[400px] lg:flex-shrink-0",children:e.jsxs(g,{flush:!0,children:[e.jsx("div",{className:T,style:{height:j},children:e.jsx(l,{width:"100%",height:j-24,className:"rounded-[12px]"})}),e.jsxs("div",{className:"flex flex-col gap-4 border-t border-border-subtle p-4",children:[e.jsx(l,{width:96,height:14,className:"rounded-full"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(l,{height:32,className:"flex-1 rounded-[12px]"}),e.jsx(l,{height:32,className:"flex-1 rounded-[12px]"})]})]})]})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs(g,{children:[e.jsxs("div",{className:M,children:[e.jsxs("div",{className:S,children:[e.jsx(l,{width:140,height:18}),e.jsx(l,{width:220,height:14,className:"rounded-full"})]}),e.jsx(l,{width:84,height:14,className:"rounded-full"})]}),e.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:3},(a,n)=>e.jsx(l,{height:72,className:"rounded-[16px]"},n))})]})})]}),le=({id:a})=>{const n=z(),i=Q(),u=I.useNavigate(),d=H(),{data:o}=b({queryKey:x.images.detail(a),queryFn:async()=>{const s=await U(a);if(s.type==="error")throw s;return s.image}}),{data:m}=b({queryKey:x.images.notes(a),queryFn:async()=>{const s=await O(o.url);if(s.type==="error")throw s;return s.imageNotes}}),c=m.length,y=ne(c),h=c===0,f=v({mutationFn:async()=>{const s=await $(a);if(s.type==="error")throw s;if(!s.deleteImage)throw new Error("Failed to delete image");return s.deleteImage},onSuccess:async()=>{await d.invalidateQueries({queryKey:x.images.listAll(),exact:!1}),i("Image deleted"),u({to:E,search:{page:1}})},onError:s=>{i(C(s,"Failed to delete image"))}}),N=v({mutationFn:async()=>{const s=await K("heroBanner",o.url);if(s.type==="error")throw s},onSuccess:async()=>{await d.invalidateQueries({queryKey:x.ui.heroBanner(),exact:!0}),i("Hero banner updated")},onError:s=>{i(C(s,"Failed to update hero banner"))}}),k=async()=>{!h||f.isPending||await n("Delete this image? It is not referenced by any notes.")&&f.mutate()};return e.jsxs("div",{className:"flex flex-col gap-6 lg:flex-row",children:[e.jsx("div",{className:"w-full lg:w-[400px] lg:flex-shrink-0",children:e.jsxs(g,{flush:!0,children:[e.jsx("div",{className:T,style:{height:j},children:e.jsx(V,{className:re,src:o.url,alt:`Image ${o.id}`})}),e.jsxs("div",{className:"flex flex-col gap-4 border-t border-border-subtle p-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(W,{size:14,className:"text-fg-tertiary"}),e.jsx(r,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:y})]}),e.jsx(r,{as:"p",variant:"meta",tone:"tertiary",children:h?"Delete is available because no notes reference this image":"Remove this image from notes before deleting it"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(P,{content:h?"Delete this image":"Cannot delete while referenced by notes",side:"bottom",children:e.jsxs(w,{variant:"soft-danger",size:"sm",className:"flex-1",disabled:!h,isLoading:f.isPending,onClick:k,children:[e.jsx(J,{size:16}),"Delete"]})}),e.jsxs(w,{variant:"primary",size:"sm",className:"flex-1",isLoading:N.isPending,onClick:()=>N.mutate(),children:[e.jsx(ee,{size:16}),"Set hero banner"]})]})]})]})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs(g,{children:[e.jsxs("div",{className:M,children:[e.jsxs("div",{className:S,children:[e.jsx(r,{as:"h2",variant:"subheading",weight:"medium",tracking:"tight",children:"Referenced Notes"}),e.jsx(r,{as:"p",variant:"meta",tone:"secondary",children:"Notes currently using this image"})]}),e.jsx(r,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:y})]}),c>0?e.jsx("ul",{className:"flex flex-col",children:m.map(s=>e.jsx("li",{children:e.jsx(se,{...s})},s.id))}):e.jsxs("div",{className:"flex items-start gap-3 py-1",children:[e.jsx("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-[10px] bg-muted/25 text-fg-disabled",children:e.jsx(X,{size:18})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(r,{as:"p",variant:"body",weight:"medium",tone:"secondary",children:"No notes reference this image"}),e.jsx(r,{as:"p",variant:"meta",tone:"secondary",children:"This image can be deleted or reused in another note"})]})]})]})})]})},pe=()=>{const{id:a}=I.useParams();return e.jsxs(e.Fragment,{children:[e.jsx(Z,{children:e.jsx("title",{children:"Image Detail | Ocean Brain"})}),e.jsxs(p,{to:E,search:{page:1},className:te,children:[e.jsx(q,{size:16}),e.jsx(r,{as:"span",variant:"meta",weight:"medium",className:"text-current",children:"Back to Images"})]}),e.jsx(r,{as:"h1",variant:"heading",weight:"bold",tracking:"tighter",className:"sr-only",children:"Image Detail"}),e.jsx(B,{fallback:e.jsx(ie,{}),errorTitle:"Failed to load image detail",errorDescription:"Retry loading the image preview and its referenced notes",resetKeys:[a],children:e.jsx(le,{id:a})})]})};export{pe as default};
@@ -1 +1 @@
1
- import{j as e}from"./note-vendor-uuJO2MTD.js";import{aR as r,k as Q,u as B,ah as p,P as E,T as t,aS as G,B as M,n as w,w as J,I as K,o as O,r as T,m as U}from"./index-B43ulIPo.js";import{a as h}from"./graph-vendor-CUxe67Lr.js";import{S as x}from"./SurfaceCard-Bnfo5EOl.js";import"./note-core-DMZcZ4yV.js";const D=async()=>{const{data:s}=await r.get("/api/mcp-admin/status");return s},z=async s=>{const{data:n}=await r.post("/api/mcp-admin/enabled",{enabled:s});return n},V=async()=>{const{data:s}=await r.post("/api/mcp-admin/token/rotate");return s},H=async()=>{const{data:s}=await r.post("/api/mcp-admin/token/revoke");return s},o=["mcp-admin","status"],W=s=>JSON.stringify({mcpServers:{"ocean-brain":{command:"npx",args:["-y","ocean-brain","mcp","--server",s,"--token-file","/path/to/token.txt"]}}},null,2),X=s=>JSON.stringify({mcpServers:{"ocean-brain":{command:"npx",args:["-y","ocean-brain","mcp","--server",s,"--token","your-token-here"]}}},null,2),se=()=>{const s=U(),n=Q(),[c,S]=h.useState(()=>window.location.origin),[v,g]=h.useState(""),[k,P]=h.useState("token-file"),{data:y,isLoading:A}=B({queryKey:o,queryFn:D}),b=p({mutationFn:z,onSuccess:a=>{n.setQueryData(o,a),s(a.enabled?"MCP access enabled.":"MCP access disabled.")}}),j=p({mutationFn:V,onSuccess:async({token:a})=>{g(a),s("A new MCP token has been issued."),await n.invalidateQueries({queryKey:o})}}),f=p({mutationFn:H,onSuccess:a=>{g(""),n.setQueryData(o,a),s("The active MCP token has been revoked.")}}),l=y?.enabled??!1,d=y?.hasActiveToken??!1,I=!A&&!b.isPending,i="space-y-1",N="space-y-4.5",F="inline-flex items-center gap-3 rounded-[14px] border border-border-subtle bg-muted px-3 py-2",L="rounded-full border border-border-subtle bg-hover-subtle px-2.5 py-1",R="space-y-3 rounded-[16px] border border-border-subtle bg-surface px-4 py-3",q="overflow-x-auto rounded-[14px] border border-border-subtle bg-surface px-4 py-3 text-xs text-fg-secondary",u={variant:"subheading",weight:"medium",tracking:"tight"},C="font-medium text-fg-tertiary",m=k==="token-file"?{title:"Token file",description:"Recommended. Keeps the token out of config.",snippet:W(c)}:{title:"Inline token",description:"Useful for quick local testing.",snippet:X(c)};return e.jsx(E,{title:"MCP",variant:"default",description:"Manage MCP access, tokens, and connection details",children:e.jsxs("div",{className:"grid grid-cols-1 gap-4",children:[e.jsx(x,{tone:"elevated",children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:i,children:[e.jsx(t,{as:"h2",...u,children:"MCP Access"}),e.jsx(t,{as:"p",variant:"meta",tone:"secondary",children:"Allow or block MCP requests at the server level."})]}),e.jsxs("div",{className:F,children:[e.jsx(t,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:l?"Enabled":"Disabled"}),e.jsx(G,{"aria-label":"Allow MCP access",checked:l,disabled:!I,onCheckedChange:()=>{b.mutate(!l)}})]})]})}),e.jsx(x,{tone:"elevated",children:e.jsxs("div",{className:N,children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:i,children:[e.jsx(t,{as:"h2",...u,children:"Token Management"}),e.jsx(t,{as:"p",variant:"meta",tone:"secondary",className:"max-w-[64ch]",children:"Ocean Brain supports one active MCP token at a time. Rotating immediately invalidates the previous one."})]}),e.jsx(t,{as:"span",variant:"meta",weight:"medium",tone:d?"secondary":"tertiary",className:L,children:d?"1 active token":"No active token"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2.5",children:[e.jsx(M,{onClick:()=>j.mutate(void 0),isLoading:j.isPending,children:"Rotate token"}),e.jsx(M,{variant:"soft-danger",onClick:()=>f.mutate(),isLoading:f.isPending,disabled:!d,children:"Revoke token"})]}),v&&e.jsxs("div",{className:"space-y-2.5",children:[e.jsx(w,{htmlFor:"issued-mcp-token",className:C,children:"Issued token"}),e.jsx(J,{id:"issued-mcp-token",rows:3,readOnly:!0,value:v})]})]})}),e.jsx(x,{tone:"elevated",children:e.jsxs("div",{className:N,children:[e.jsxs("div",{className:i,children:[e.jsx(t,{as:"h2",...u,children:"Connection Guide"}),e.jsx(t,{as:"p",variant:"meta",tone:"secondary",children:"Connect your MCP client with either a token file or an inline token."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{htmlFor:"mcp-server-url",className:C,children:"Server URL"}),e.jsx(K,{id:"mcp-server-url",value:c,onChange:a=>S(a.target.value)})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(O,{type:"single",variant:"pills",size:"sm",value:k,onValueChange:a=>{(a==="token-file"||a==="inline-token")&&P(a)},children:[e.jsx(T,{value:"token-file",children:"Token file"}),e.jsx(T,{value:"inline-token",children:"Inline token"})]}),e.jsxs("div",{className:R,children:[e.jsxs("div",{className:i,children:[e.jsx(t,{as:"p",variant:"meta",weight:"semibold",children:m.title}),e.jsx(t,{as:"p",variant:"meta",tone:"secondary",children:m.description})]}),e.jsx("pre",{className:q,children:m.snippet})]})]})]})})]})})};export{se as default};
1
+ import{j as e}from"./note-vendor-uuJO2MTD.js";import{aS as r,k as R,u as B,ah as p,P as E,T as t,aT as G,B as M,n as T,w as J,I as K,o as O,r as w,m as U}from"./index-BgnmVjeF.js";import{a as h}from"./graph-vendor-CUxe67Lr.js";import{S as x}from"./SurfaceCard-Brd1cMxi.js";import"./note-core-DMZcZ4yV.js";const D=async()=>{const{data:s}=await r.get("/api/mcp-admin/status");return s},z=async s=>{const{data:n}=await r.post("/api/mcp-admin/enabled",{enabled:s});return n},V=async()=>{const{data:s}=await r.post("/api/mcp-admin/token/rotate");return s},H=async()=>{const{data:s}=await r.post("/api/mcp-admin/token/revoke");return s},o=["mcp-admin","status"],W=s=>JSON.stringify({mcpServers:{"ocean-brain":{command:"npx",args:["-y","ocean-brain","mcp","--server",s,"--token-file","/path/to/token.txt"]}}},null,2),X=s=>JSON.stringify({mcpServers:{"ocean-brain":{command:"npx",args:["-y","ocean-brain","mcp","--server",s,"--token","your-token-here"]}}},null,2),se=()=>{const s=U(),n=R(),[c,S]=h.useState(()=>window.location.origin),[v,g]=h.useState(""),[k,P]=h.useState("token-file"),{data:y,isLoading:A}=B({queryKey:o,queryFn:D}),b=p({mutationFn:z,onSuccess:a=>{n.setQueryData(o,a),s(a.enabled?"MCP access enabled.":"MCP access disabled.")}}),j=p({mutationFn:V,onSuccess:async({token:a})=>{g(a),s("A new MCP token has been issued."),await n.invalidateQueries({queryKey:o})}}),f=p({mutationFn:H,onSuccess:a=>{g(""),n.setQueryData(o,a),s("The active MCP token has been revoked.")}}),l=y?.enabled??!1,d=y?.hasActiveToken??!1,I=!A&&!b.isPending,i="space-y-1",N="space-y-4.5",F="inline-flex items-center gap-3 rounded-[14px] border border-border-subtle bg-muted px-3 py-2",L="rounded-full border border-border-subtle bg-hover-subtle px-2.5 py-1",q="space-y-3 rounded-[16px] border border-border-subtle bg-surface px-4 py-3",Q="overflow-x-auto rounded-[14px] border border-border-subtle bg-surface px-4 py-3 text-xs text-fg-secondary",u={variant:"subheading",weight:"medium",tracking:"tight"},C="font-medium text-fg-tertiary",m=k==="token-file"?{title:"Token file",description:"Recommended. Keeps the token out of config.",snippet:W(c)}:{title:"Inline token",description:"Useful for quick local testing.",snippet:X(c)};return e.jsx(E,{title:"MCP",variant:"default",description:"Manage MCP access, tokens, and connection details",children:e.jsxs("div",{className:"grid grid-cols-1 gap-4",children:[e.jsx(x,{tone:"elevated",children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:i,children:[e.jsx(t,{as:"h2",...u,children:"MCP Access"}),e.jsx(t,{as:"p",variant:"meta",tone:"secondary",children:"Allow or block MCP requests at the server level."})]}),e.jsxs("div",{className:F,children:[e.jsx(t,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:l?"Enabled":"Disabled"}),e.jsx(G,{"aria-label":"Allow MCP access",checked:l,disabled:!I,onCheckedChange:()=>{b.mutate(!l)}})]})]})}),e.jsx(x,{tone:"elevated",children:e.jsxs("div",{className:N,children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:i,children:[e.jsx(t,{as:"h2",...u,children:"Token Management"}),e.jsx(t,{as:"p",variant:"meta",tone:"secondary",className:"max-w-[64ch]",children:"Ocean Brain supports one active MCP token at a time. Rotating immediately invalidates the previous one."})]}),e.jsx(t,{as:"span",variant:"meta",weight:"medium",tone:d?"secondary":"tertiary",className:L,children:d?"1 active token":"No active token"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2.5",children:[e.jsx(M,{onClick:()=>j.mutate(void 0),isLoading:j.isPending,children:"Rotate token"}),e.jsx(M,{variant:"soft-danger",onClick:()=>f.mutate(),isLoading:f.isPending,disabled:!d,children:"Revoke token"})]}),v&&e.jsxs("div",{className:"space-y-2.5",children:[e.jsx(T,{htmlFor:"issued-mcp-token",className:C,children:"Issued token"}),e.jsx(J,{id:"issued-mcp-token",rows:3,readOnly:!0,value:v})]})]})}),e.jsx(x,{tone:"elevated",children:e.jsxs("div",{className:N,children:[e.jsxs("div",{className:i,children:[e.jsx(t,{as:"h2",...u,children:"Connection Guide"}),e.jsx(t,{as:"p",variant:"meta",tone:"secondary",children:"Connect your MCP client with either a token file or an inline token."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"mcp-server-url",className:C,children:"Server URL"}),e.jsx(K,{id:"mcp-server-url",value:c,onChange:a=>S(a.target.value)})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(O,{type:"single",variant:"pills",size:"sm",value:k,onValueChange:a=>{(a==="token-file"||a==="inline-token")&&P(a)},children:[e.jsx(w,{value:"token-file",children:"Token file"}),e.jsx(w,{value:"inline-token",children:"Inline token"})]}),e.jsxs("div",{className:q,children:[e.jsxs("div",{className:i,children:[e.jsx(t,{as:"p",variant:"meta",weight:"semibold",children:m.title}),e.jsx(t,{as:"p",variant:"meta",tone:"secondary",children:m.description})]}),e.jsx("pre",{className:Q,children:m.snippet})]})]})]})})]})})};export{se as default};
@@ -1,4 +1,4 @@
1
- import{j as e}from"./note-vendor-uuJO2MTD.js";import{p as J,h as P,k as V,q as v,b4 as W,u as ee,ah as M,P as ae,T as s,al as te,b5 as j,b6 as N,B as C,a8 as se,M as m,n as b,I as w,x as le,ac as ne,a1 as re,i as $,j as ce,aP as ie,m as oe}from"./index-B43ulIPo.js";import{a}from"./graph-vendor-CUxe67Lr.js";import{S as D}from"./SurfaceCard-Bnfo5EOl.js";import{n as de}from"./Plus.es-BGVIIQtM.js";import"./note-core-DMZcZ4yV.js";const me=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M208,160H48l80-80Z",opacity:"0.2"}),a.createElement("path",{d:"M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z"}))]]),k=a.forwardRef((l,c)=>a.createElement(J,{ref:c,...l,weights:me}));k.displayName="CaretUpIcon";const he=k,O=["id","name","template","replacement","createdAt","updatedAt"],ue=new Set(O),pe=`query FetchPlaceholders(
1
+ import{j as e}from"./note-vendor-uuJO2MTD.js";import{p as J,h as E,k as V,q as v,b5 as W,u as ee,ah as M,P as ae,T as s,am as te,b6 as j,b7 as N,B as C,a8 as se,M as m,n as b,I as w,x as le,ac as ne,a1 as re,i as $,j as ce,aQ as ie,m as oe}from"./index-BgnmVjeF.js";import{a}from"./graph-vendor-CUxe67Lr.js";import{S as D}from"./SurfaceCard-Brd1cMxi.js";import{n as de}from"./Plus.es-I7xuoJ9B.js";import"./note-core-DMZcZ4yV.js";const me=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M208,160H48l80-80Z",opacity:"0.2"}),a.createElement("path",{d:"M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z"}))]]),k=a.forwardRef((l,c)=>a.createElement(J,{ref:c,...l,weights:me}));k.displayName="CaretUpIcon";const he=k,O=["id","name","template","replacement","createdAt","updatedAt"],ue=new Set(O),pe=`query FetchPlaceholders(
2
2
  $searchFilter: SearchFilterInput,
3
3
  $pagination: PaginationInput
4
4
  ) {
@@ -12,7 +12,7 @@ __PLACEHOLDER_FIELDS__ }
12
12
  }
13
13
  }`,xe=l=>{const c=l&&l.length>0?l.filter(r=>ue.has(r)):O;return Array.from(new Set(c)).map(r=>" "+r).join(`
14
14
  `)+`
15
- `},ge=async({limit:l=25,offset:c=0,query:h="",fields:r}={})=>{const g=xe(r),i=pe.replace("__PLACEHOLDER_FIELDS__",g);return P(i,{searchFilter:{query:h},pagination:{limit:l,offset:c}})},ye=l=>P(`mutation CreatePlaceholder(
15
+ `},ge=async({limit:l=25,offset:c=0,query:h="",fields:r}={})=>{const g=xe(r),i=pe.replace("__PLACEHOLDER_FIELDS__",g);return E(i,{searchFilter:{query:h},pagination:{limit:l,offset:c}})},ye=l=>E(`mutation CreatePlaceholder(
16
16
  $name: String!,
17
17
  $template: String!,
18
18
  $replacement: String!
@@ -29,6 +29,6 @@ __PLACEHOLDER_FIELDS__ }
29
29
  createdAt
30
30
  updatedAt
31
31
  }
32
- }`,l),fe=l=>P(`mutation DeletePlaceholder($id: ID!) {
32
+ }`,l),fe=l=>E(`mutation DeletePlaceholder($id: ID!) {
33
33
  deletePlaceholder(id: $id)
34
- }`,{id:l}),I=ce(ie),Ee=()=>{const l=oe(),c=V(),h=I.useNavigate(),{page:r}=I.useSearch(),[g,i]=a.useState(!1),[y,H]=a.useState(!0),[n,u]=a.useState({name:"",template:"",replacement:""}),o=25,T=v.placeholders.list({limit:o,offset:(r-1)*o}),[E]=a.useState(W),{data:d,isLoading:p}=ee({queryKey:T,queryFn:async()=>{const t=await ge({offset:(r-1)*o,limit:o});if(t.type==="error")throw t;return t.allPlaceholders}}),F=M({mutationFn:ye,onSuccess:async()=>{l("Placeholder added successfully"),i(!1),u({name:"",template:"",replacement:""}),await c.invalidateQueries({queryKey:v.placeholders.listAll(),exact:!1})}}),q=M({mutationFn:fe,onSuccess:async()=>{l("Placeholder deleted successfully"),await c.invalidateQueries({queryKey:v.placeholders.listAll(),exact:!1})}}),B=E.length,x=d?.totalCount??0,Z=d?.placeholders??[],f="font-medium text-fg-tertiary",L="leading-[1.2]",A="break-all leading-[1.2]",S="leading-[1.2]",_="flex flex-col gap-px",R="space-y-px",Q="focus-ring-soft inline-flex items-center gap-2 rounded-[12px] border border-transparent px-2.5 py-1.5 text-fg-tertiary outline-none transition-colors hover:bg-hover-subtle hover:text-fg-default",K="relative",U="absolute right-2 top-2",G="focus-ring-soft surface-base group flex flex-col items-center justify-center gap-0.5 px-4 py-4 text-center text-fg-secondary outline-none transition-colors hover:bg-hover-subtle hover:text-fg-default",X="inline-flex h-[34px] w-[34px] items-center justify-center rounded-full border border-border-subtle bg-surface text-current transition-colors group-hover:border-border-secondary/70",z=x>0?`Placeholders (${x})`:void 0;return e.jsxs(ae,{title:"Placeholders",variant:"default",heading:p?e.jsx($,{width:244,height:24,className:"rounded-full"}):z,description:p?e.jsx($,{width:260,height:16,className:"rounded-full"}):"Create tokens that get replaced with values when you clone a note",children:[e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs("section",{className:"space-y-3 border-b border-border-subtle/80 pb-5",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(s,{as:"p",variant:"body",weight:"medium",children:"System placeholders"}),e.jsx(s,{as:"p",variant:"meta",tone:"secondary",children:"Built-in tokens for date and time that are always available when cloning notes"})]}),e.jsxs("button",{type:"button",onClick:()=>H(!y),className:Q,children:[e.jsxs(s,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:[B," items"]}),y?e.jsx(he,{className:"h-4 w-4"}):e.jsx(te,{className:"h-4 w-4"})]})]}),y&&e.jsx("div",{className:"grid-auto-cards grid gap-5",children:E.map(t=>e.jsx(D,{children:e.jsxs("div",{className:_,children:[e.jsx(s,{as:"div",variant:"body",weight:"medium",className:L,children:t.name}),e.jsxs("div",{className:R,children:[e.jsxs(s,{as:"div",variant:"meta",weight:"medium",tone:"secondary",className:A,children:[j,t.template,N]}),e.jsxs(s,{as:"div",variant:"label",weight:"medium",tone:"tertiary",className:S,children:["Current value: ",t.replacement]})]})]})},t.name))})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(s,{as:"p",variant:"body",weight:"medium",children:"Custom placeholders"}),e.jsx(s,{as:"p",variant:"meta",tone:"secondary",children:"Custom tokens you define once and reuse whenever you clone a note"})]}),!p&&e.jsx(s,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:x===1?"1 item":`${x} items`})]}),!p&&e.jsxs("div",{className:"grid-auto-cards grid gap-5",children:[Z.map(t=>e.jsxs(D,{className:K,children:[e.jsx(C,{variant:"ghost",size:"icon-sm",className:U,onClick:()=>q.mutate(t.id.toString()),children:e.jsx(se,{className:"h-4 w-4"})}),e.jsxs("div",{className:_,children:[e.jsx(s,{as:"div",variant:"body",weight:"medium",className:`min-w-0 pr-8 ${L}`,children:t.name}),e.jsxs("div",{className:R,children:[e.jsxs(s,{as:"div",variant:"meta",weight:"medium",tone:"secondary",className:A,children:[j,t.template,N]}),e.jsxs(s,{as:"div",variant:"label",weight:"medium",tone:"tertiary",className:S,children:["Replaces with: ",t.replacement]})]})]})]},t.id)),e.jsxs("button",{type:"button",onClick:()=>i(!0),className:G,children:[e.jsx("span",{className:X,children:e.jsx(de,{className:"h-4.5 w-4.5"})}),e.jsx(s,{as:"div",variant:"meta",weight:"medium",tone:"secondary",className:"text-current",children:"New custom"})]})]})]})]}),e.jsxs(m,{isOpen:g,onClose:()=>i(!1),variant:"form",children:[e.jsx(m.Header,{title:"Add Placeholder",onClose:()=>i(!1)}),e.jsxs(m.Body,{children:[e.jsx(m.Description,{className:"mb-4",children:"Create a token that swaps in a value when you clone a note"}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"name",className:f,children:"Name"}),e.jsx(w,{id:"name",type:"text",value:n.name,onChange:t=>u({...n,name:t.target.value}),placeholder:"Description of this placeholder"}),e.jsx(s,{as:"p",variant:"meta",tone:"secondary",children:"A readable label so you can find this placeholder later"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"template",className:f,children:"Placeholder"}),e.jsx(w,{id:"template",type:"text",value:n.template,onChange:t=>u({...n,template:t.target.value}),placeholder:"note_app"}),e.jsxs(s,{as:"p",variant:"meta",tone:"secondary",children:["Use it in a note as ",j,"your_placeholder",N]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"replacement",className:f,children:"Replacement"}),e.jsx(w,{id:"replacement",type:"text",value:n.replacement,onChange:t=>u({...n,replacement:t.target.value}),placeholder:"Ocean Brain"}),e.jsx(s,{as:"p",variant:"meta",tone:"secondary",children:"This value is inserted when the placeholder is replaced during cloning"})]})]})]}),e.jsx(m.Footer,{children:e.jsxs(le,{children:[e.jsx(C,{variant:"ghost",onClick:()=>i(!1),children:"Cancel"}),e.jsx(C,{variant:"primary",isLoading:F.isPending,onClick:()=>{if(!n.name||!n.template||!n.replacement){l("All fields are required");return}F.mutate({name:n.name,template:n.template,replacement:n.replacement})},children:"Add"})]})})]}),e.jsx(ne,{fallback:null,children:d?.totalCount&&o<d.totalCount&&e.jsx(re,{page:r,last:Math.ceil(d.totalCount/o),onChange:t=>{h({search:Y=>({...Y,page:t})})}})})]})};export{Ee as default};
34
+ }`,{id:l}),I=ce(ie),Pe=()=>{const l=oe(),c=V(),h=I.useNavigate(),{page:r}=I.useSearch(),[g,i]=a.useState(!1),[y,H]=a.useState(!0),[n,u]=a.useState({name:"",template:"",replacement:""}),o=25,T=v.placeholders.list({limit:o,offset:(r-1)*o}),[P]=a.useState(W),{data:d,isLoading:p}=ee({queryKey:T,queryFn:async()=>{const t=await ge({offset:(r-1)*o,limit:o});if(t.type==="error")throw t;return t.allPlaceholders}}),F=M({mutationFn:ye,onSuccess:async()=>{l("Placeholder added successfully"),i(!1),u({name:"",template:"",replacement:""}),await c.invalidateQueries({queryKey:v.placeholders.listAll(),exact:!1})}}),q=M({mutationFn:fe,onSuccess:async()=>{l("Placeholder deleted successfully"),await c.invalidateQueries({queryKey:v.placeholders.listAll(),exact:!1})}}),B=P.length,x=d?.totalCount??0,Q=d?.placeholders??[],f="font-medium text-fg-tertiary",L="leading-[1.2]",A="break-all leading-[1.2]",S="leading-[1.2]",_="flex flex-col gap-px",R="space-y-px",Z="focus-ring-soft inline-flex items-center gap-2 rounded-[12px] border border-transparent px-2.5 py-1.5 text-fg-tertiary outline-none transition-colors hover:bg-hover-subtle hover:text-fg-default",K="relative",U="absolute right-2 top-2",G="focus-ring-soft surface-base group flex flex-col items-center justify-center gap-0.5 px-4 py-4 text-center text-fg-secondary outline-none transition-colors hover:bg-hover-subtle hover:text-fg-default",X="inline-flex h-[34px] w-[34px] items-center justify-center rounded-full border border-border-subtle bg-surface text-current transition-colors group-hover:border-border-secondary/70",z=x>0?`Placeholders (${x})`:void 0;return e.jsxs(ae,{title:"Placeholders",variant:"default",heading:p?e.jsx($,{width:244,height:24,className:"rounded-full"}):z,description:p?e.jsx($,{width:260,height:16,className:"rounded-full"}):"Create tokens that get replaced with values when you clone a note",children:[e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs("section",{className:"space-y-3 border-b border-border-subtle/80 pb-5",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(s,{as:"p",variant:"body",weight:"medium",children:"System placeholders"}),e.jsx(s,{as:"p",variant:"meta",tone:"secondary",children:"Built-in tokens for date and time that are always available when cloning notes"})]}),e.jsxs("button",{type:"button",onClick:()=>H(!y),className:Z,children:[e.jsxs(s,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:[B," items"]}),y?e.jsx(he,{className:"h-4 w-4"}):e.jsx(te,{className:"h-4 w-4"})]})]}),y&&e.jsx("div",{className:"grid-auto-cards grid gap-5",children:P.map(t=>e.jsx(D,{children:e.jsxs("div",{className:_,children:[e.jsx(s,{as:"div",variant:"body",weight:"medium",className:L,children:t.name}),e.jsxs("div",{className:R,children:[e.jsxs(s,{as:"div",variant:"meta",weight:"medium",tone:"secondary",className:A,children:[j,t.template,N]}),e.jsxs(s,{as:"div",variant:"label",weight:"medium",tone:"tertiary",className:S,children:["Current value: ",t.replacement]})]})]})},t.name))})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(s,{as:"p",variant:"body",weight:"medium",children:"Custom placeholders"}),e.jsx(s,{as:"p",variant:"meta",tone:"secondary",children:"Custom tokens you define once and reuse whenever you clone a note"})]}),!p&&e.jsx(s,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:x===1?"1 item":`${x} items`})]}),!p&&e.jsxs("div",{className:"grid-auto-cards grid gap-5",children:[Q.map(t=>e.jsxs(D,{className:K,children:[e.jsx(C,{variant:"ghost",size:"icon-sm",className:U,onClick:()=>q.mutate(t.id.toString()),children:e.jsx(se,{className:"h-4 w-4"})}),e.jsxs("div",{className:_,children:[e.jsx(s,{as:"div",variant:"body",weight:"medium",className:`min-w-0 pr-8 ${L}`,children:t.name}),e.jsxs("div",{className:R,children:[e.jsxs(s,{as:"div",variant:"meta",weight:"medium",tone:"secondary",className:A,children:[j,t.template,N]}),e.jsxs(s,{as:"div",variant:"label",weight:"medium",tone:"tertiary",className:S,children:["Replaces with: ",t.replacement]})]})]})]},t.id)),e.jsxs("button",{type:"button",onClick:()=>i(!0),className:G,children:[e.jsx("span",{className:X,children:e.jsx(de,{className:"h-4.5 w-4.5"})}),e.jsx(s,{as:"div",variant:"meta",weight:"medium",tone:"secondary",className:"text-current",children:"New custom"})]})]})]})]}),e.jsxs(m,{isOpen:g,onClose:()=>i(!1),variant:"form",children:[e.jsx(m.Header,{title:"Add Placeholder",onClose:()=>i(!1)}),e.jsxs(m.Body,{children:[e.jsx(m.Description,{className:"mb-4",children:"Create a token that swaps in a value when you clone a note"}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"name",className:f,children:"Name"}),e.jsx(w,{id:"name",type:"text",value:n.name,onChange:t=>u({...n,name:t.target.value}),placeholder:"Description of this placeholder"}),e.jsx(s,{as:"p",variant:"meta",tone:"secondary",children:"A readable label so you can find this placeholder later"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"template",className:f,children:"Placeholder"}),e.jsx(w,{id:"template",type:"text",value:n.template,onChange:t=>u({...n,template:t.target.value}),placeholder:"note_app"}),e.jsxs(s,{as:"p",variant:"meta",tone:"secondary",children:["Use it in a note as ",j,"your_placeholder",N]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"replacement",className:f,children:"Replacement"}),e.jsx(w,{id:"replacement",type:"text",value:n.replacement,onChange:t=>u({...n,replacement:t.target.value}),placeholder:"Ocean Brain"}),e.jsx(s,{as:"p",variant:"meta",tone:"secondary",children:"This value is inserted when the placeholder is replaced during cloning"})]})]})]}),e.jsx(m.Footer,{children:e.jsxs(le,{children:[e.jsx(C,{variant:"ghost",onClick:()=>i(!1),children:"Cancel"}),e.jsx(C,{variant:"primary",isLoading:F.isPending,onClick:()=>{if(!n.name||!n.template||!n.replacement){l("All fields are required");return}F.mutate({name:n.name,template:n.template,replacement:n.replacement})},children:"Add"})]})})]}),e.jsx(ne,{fallback:null,children:d?.totalCount&&o<d.totalCount&&e.jsx(re,{page:r,last:Math.ceil(d.totalCount/o),onChange:t=>{h({search:Y=>({...Y,page:t})})}})})]})};export{Pe as default};
@@ -1 +1 @@
1
- import{j as e}from"./note-vendor-uuJO2MTD.js";import{k as oe,u as de,H as ce,q as x,ah as M,b1 as ue,b2 as me,b3 as pe,P as he,T as s,B as o,M as d,I as v,S as xe,e as be,x as q,m as ve,j as ye,aI as ge}from"./index-B43ulIPo.js";import{a as p}from"./graph-vendor-CUxe67Lr.js";import"./note-core-DMZcZ4yV.js";const fe=ye(ge),W=[{value:"text",label:"Text",description:"Short status or label values."},{value:"url",label:"URL",description:"External sources, issues, docs, or references."},{value:"number",label:"Number",description:"Priority, score, or count values."},{value:"date",label:"Date",description:"Due dates and milestones."},{value:"boolean",label:"Boolean",description:"True or false flags."},{value:"select",label:"Select",description:"Choose one option from a controlled list."}],je=l=>!l.id&&!l.label.trim()&&!l.value.trim(),Ne=l=>(l.value.trim()||l.label.trim()).toLowerCase().replace(/\s+/g,"-"),Ce=l=>/^[a-z0-9][a-z0-9_-]*$/.test(l),X=l=>l.filter(r=>r.id||r.label.trim()).map((r,F)=>({...r.id?{id:r.id}:{},label:r.label.trim(),value:r.value.trim()||r.label.trim(),color:r.color??null,order:r.order??F}));function Ee(){const l=ve(),r=oe(),F=fe.useSearch(),Z=Number(F.page??1),R=50,V=Math.max(0,Z-1)*R,[k,I]=p.useState(""),[Q,A]=p.useState(""),[y,H]=p.useState("text"),[D,j]=p.useState([{label:"",value:""}]),[u,N]=p.useState(null),[i,$]=p.useState(null),[O,L]=p.useState(""),[E,g]=p.useState([{label:"",value:""}]),[ee,C]=p.useState(!1),S=()=>{I(""),A(""),H("text"),j([{label:"",value:""}])},ae=a=>{$(a),L(a.name),g(a.options.length>0?a.options.map(t=>({id:t.id,label:t.label,value:t.value,color:t.color,order:t.order})):[{label:"",value:""}])},T=()=>{$(null),L(""),g([{label:"",value:""}])},_=de({queryKey:x.notes.propertyKeys({limit:R,offset:V}),queryFn:async()=>{const a=await ce({limit:R,offset:V});if(a.type==="error")throw a;return a.notePropertyKeys}}),w=M({mutationFn:async()=>ue({key:k,name:Q||k,valueType:y,...y==="select"?{options:D.map((a,t)=>({label:a.label.trim(),value:a.value.trim()||a.label.trim(),order:t})).filter(a=>a.label)}:{}}),onSuccess:a=>{if(a.type==="error"){l(a.errors[0]?.message??"Failed to create property.");return}S(),C(!1),r.invalidateQueries({queryKey:x.notes.propertyKeysAll(),exact:!1}),l("Property created.")},onError:()=>{l("Failed to create property.")}}),h=M({mutationFn:async()=>{if(!i)throw new Error("Property to edit is missing.");return me({key:i.key,name:O||i.key,...i.valueType==="select"?{options:X(E)}:{}})},onSuccess:a=>{if(a.type==="error"){l(a.errors[0]?.message??"Failed to update property.");return}T(),r.invalidateQueries({queryKey:x.notes.propertyKeysAll(),exact:!1}),r.invalidateQueries({queryKey:x.notes.all(),exact:!1}),r.invalidateQueries({queryKey:x.views.all(),exact:!1}),l("Property updated.")},onError:()=>{l("Failed to update property.")}}),f=M({mutationFn:async({propertyKey:a,confirmImpact:t})=>pe({key:a.key,confirmImpact:t}),onSuccess:a=>{if(a.type==="error"){l(a.errors[0]?.message??"Failed to delete property.");return}r.invalidateQueries({queryKey:x.notes.propertyKeysAll(),exact:!1}),r.invalidateQueries({queryKey:x.notes.all(),exact:!1}),r.invalidateQueries({queryKey:x.views.all(),exact:!1}),N(null),l(a.deleteNotePropertyKey.affectedNoteCount>0?`Property deleted from ${a.deleteNotePropertyKey.affectedNoteCount} note(s).`:"Property deleted.")},onError:()=>{l("Failed to delete property.")}}),P=_.data?.keys??[],se=y!=="select"||D.some(a=>a.label.trim()),z=i?.valueType==="select"?E.filter(a=>!je(a)):[],B=z.map(Ne),K=B.find((a,t)=>B.indexOf(a)!==t),U=B.find(a=>!Ce(a)),J=z.some(a=>!!a.id&&!a.label.trim()),Y=z.some(a=>!a.id&&!a.label.trim()),te=!i||i.valueType!=="select"||z.length>0&&!J&&!Y&&!K&&!U,le=!!i&&O.trim()!==i?.name,re=i?.valueType==="select"&&JSON.stringify(X(E))!==JSON.stringify(i.options.map(a=>({id:a.id,label:a.label,value:a.value,color:a.color??null,order:a.order}))),ie=le||!!re,G=J?"Existing option labels cannot be empty.":Y?"New options need a label.":K?`Option value “${K}” is duplicated.`:U?"Option values must use letters, numbers, dashes, or underscores.":"",ne=()=>{u&&f.mutate({propertyKey:u,confirmImpact:u.noteCount>0})};return e.jsxs(he,{title:"Properties",description:"Define shared note fields before using them in notes and future views.",headerRight:e.jsx(o,{type:"button",size:"md",variant:"primary",className:"w-full sm:w-auto",onClick:()=>C(!0),children:"New property"}),children:[e.jsxs("section",{className:"flex flex-col gap-3","aria-labelledby":"shared-properties-heading",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(s,{id:"shared-properties-heading",as:"h2",variant:"label",weight:"medium",className:"text-fg-tertiary",children:"Shared fields"}),!_.isLoading&&P.length>0&&e.jsxs(s,{as:"span",variant:"meta",tone:"tertiary",children:[P.length," field",P.length===1?"":"s"]})]}),_.isLoading?e.jsx(s,{as:"p",variant:"body",tone:"tertiary",className:"surface-base px-4 py-3.5",children:"Loading properties..."}):P.length===0?e.jsxs("div",{className:"surface-base border-dashed p-6 text-center",children:[e.jsx(s,{as:"p",variant:"body",weight:"medium",children:"No shared properties yet."}),e.jsx(s,{as:"p",variant:"label",tone:"tertiary",children:"Create one here, then attach it from the note screen."})]}):e.jsx("div",{className:"flex flex-col gap-3",children:P.map(a=>e.jsxs("article",{className:"surface-base grid gap-3 px-4 py-3.5 md:grid-cols-[minmax(0,1fr)_120px_120px_auto] md:items-center",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(s,{as:"h3",variant:"body",weight:"semibold",className:"truncate",children:a.name}),e.jsx(s,{as:"p",variant:"micro",tone:"tertiary",className:"font-mono",children:a.key}),a.options.length>0&&e.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[a.options.slice(0,6).map(t=>e.jsx("span",{className:"rounded-full border border-border-subtle bg-subtle px-2 py-0.5 text-xs font-medium text-fg-secondary",children:t.label},t.id)),a.options.length>6&&e.jsxs("span",{className:"rounded-full border border-border-subtle bg-subtle px-2 py-0.5 text-xs font-medium text-fg-tertiary",children:["+",a.options.length-6]})]})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx(s,{as:"span",variant:"micro",tone:"tertiary",className:"block md:hidden",children:"Type"}),e.jsx(s,{as:"span",variant:"label",tone:"secondary",className:"capitalize",children:a.valueType})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx(s,{as:"span",variant:"micro",tone:"tertiary",className:"block md:hidden",children:"Used in"}),e.jsxs(s,{as:"span",variant:"label",tone:"tertiary",children:[a.noteCount," note",a.noteCount===1?"":"s"]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 justify-self-start md:justify-self-end",children:[e.jsx(o,{type:"button",size:"sm",variant:"subtle",disabled:h.isPending||f.isPending,onClick:()=>ae(a),children:"Edit"}),e.jsx(o,{type:"button",size:"sm",variant:"soft-danger",disabled:f.isPending||h.isPending,onClick:()=>N(a),children:"Delete"})]})]},a.key))})]}),e.jsxs(d,{isOpen:ee,onClose:()=>{w.isPending||(C(!1),S())},variant:"form",children:[e.jsx(d.Header,{title:"New property",onClose:()=>{C(!1),S()}}),e.jsx(d.Body,{children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(s,{as:"p",variant:"label",tone:"tertiary",children:"Create a shared field that notes can use for values and future views."}),e.jsxs("label",{className:"flex flex-col gap-1.5",children:[e.jsx(s,{as:"span",variant:"label",weight:"medium",children:"Key"}),e.jsx(v,{size:"md",placeholder:"status",value:k,onChange:a=>I(a.target.value)})]}),e.jsxs("label",{className:"flex flex-col gap-1.5",children:[e.jsx(s,{as:"span",variant:"label",weight:"medium",children:"Name"}),e.jsx(v,{size:"md",placeholder:"Status",value:Q,onChange:a=>A(a.target.value)})]}),e.jsxs("label",{className:"flex flex-col gap-1.5",children:[e.jsx(s,{as:"span",variant:"label",weight:"medium",children:"Type"}),e.jsx(xe,{value:y,onValueChange:a=>H(a),children:W.map(a=>e.jsx(be,{value:a.value,children:a.label},a.value))})]}),y==="select"&&e.jsxs("div",{className:"rounded-[14px] border border-border-subtle bg-subtle/50 p-3",children:[e.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[e.jsx(s,{as:"span",variant:"label",weight:"semibold",children:"Options"}),e.jsx(o,{type:"button",size:"sm",variant:"subtle",onClick:()=>j(a=>[...a,{label:"",value:""}]),children:"Add option"})]}),e.jsx("div",{className:"flex flex-col gap-2",children:D.map((a,t)=>e.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_1fr_auto]",children:[e.jsx(v,{size:"sm",placeholder:"Label",value:a.label,onChange:c=>j(m=>m.map((n,b)=>b===t?{...n,label:c.target.value}:n))}),e.jsx(v,{size:"sm",placeholder:"value",value:a.value,onChange:c=>j(m=>m.map((n,b)=>b===t?{...n,value:c.target.value}:n))}),e.jsx(o,{type:"button",size:"sm",variant:"soft-danger",onClick:()=>j(c=>c.filter((m,n)=>n!==t)),children:"Remove"})]},t))})]}),e.jsx(s,{as:"p",variant:"micro",tone:"tertiary",children:W.find(a=>a.value===y)?.description})]})}),e.jsx(d.Footer,{children:e.jsxs(q,{children:[e.jsx(o,{type:"button",variant:"ghost",size:"sm",disabled:w.isPending,onClick:()=>{C(!1),S()},children:"Cancel"}),e.jsx(o,{type:"button",variant:"primary",size:"sm",disabled:!k.trim()||!se||w.isPending,isLoading:w.isPending,onClick:()=>w.mutate(),children:"Create property"})]})})]}),e.jsxs(d,{isOpen:!!i,onClose:()=>{h.isPending||T()},variant:"form",children:[e.jsx(d.Header,{title:"Edit property",onClose:()=>{h.isPending||T()}}),e.jsx(d.Body,{children:i&&e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(s,{as:"p",variant:"label",tone:"tertiary",children:"Rename the display label or add select options. Key, type, and existing option values stay fixed so notes and views remain stable."}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[14px] border border-border-subtle bg-subtle/50 px-3 py-2",children:[e.jsx(s,{as:"span",variant:"micro",tone:"tertiary",className:"block",children:"Key"}),e.jsx(s,{as:"span",variant:"label",weight:"medium",className:"font-mono",children:i.key})]}),e.jsxs("div",{className:"rounded-[14px] border border-border-subtle bg-subtle/50 px-3 py-2",children:[e.jsx(s,{as:"span",variant:"micro",tone:"tertiary",className:"block",children:"Type"}),e.jsx(s,{as:"span",variant:"label",weight:"medium",className:"capitalize",children:i.valueType})]})]}),e.jsxs("label",{className:"flex flex-col gap-1.5",children:[e.jsx(s,{as:"span",variant:"label",weight:"medium",children:"Display name"}),e.jsx(v,{size:"md",placeholder:"Workflow state",value:O,onChange:a=>L(a.target.value)})]}),i.valueType==="select"&&e.jsxs("div",{className:"rounded-[14px] border border-border-subtle bg-subtle/50 p-3",children:[e.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx(s,{as:"span",variant:"label",weight:"semibold",children:"Options"}),e.jsx(s,{as:"p",variant:"micro",tone:"tertiary",className:"mt-0.5",children:"Existing option values are locked. Removing existing options needs an impact-aware delete flow."})]}),e.jsx(o,{type:"button",size:"sm",variant:"subtle",onClick:()=>g(a=>[...a,{label:"",value:""}]),children:"Add option"})]}),e.jsx("div",{className:"flex flex-col gap-2",children:E.map((a,t)=>e.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_1fr_auto]",children:[e.jsx(v,{size:"sm",placeholder:"Label",value:a.label,onChange:c=>g(m=>m.map((n,b)=>b===t?{...n,label:c.target.value}:n))}),e.jsx(v,{size:"sm",placeholder:a.id?"Locked value":"value",value:a.value,disabled:!!a.id,onChange:c=>g(m=>m.map((n,b)=>b===t?{...n,value:c.target.value}:n))}),a.id?e.jsx(s,{as:"span",variant:"meta",tone:"tertiary",className:"flex h-8 items-center px-3",children:"Locked"}):e.jsx(o,{type:"button",size:"sm",variant:"soft-danger",onClick:()=>g(c=>c.filter((m,n)=>n!==t)),children:"Remove"})]},a.id??`new-${t}`))}),G&&e.jsx(s,{as:"p",variant:"micro",tone:"error",className:"mt-2",children:G})]})]})}),e.jsx(d.Footer,{children:e.jsxs(q,{children:[e.jsx(o,{type:"button",variant:"ghost",size:"sm",disabled:h.isPending,onClick:T,children:"Cancel"}),e.jsx(o,{type:"button",variant:"primary",size:"sm",disabled:!O.trim()||!ie||!te||h.isPending,isLoading:h.isPending,onClick:()=>h.mutate(),children:"Save changes"})]})})]}),e.jsxs(d,{isOpen:!!u,onClose:()=>{f.isPending||N(null)},variant:"confirm",children:[e.jsx(d.Header,{title:"Delete property",onClose:()=>N(null)}),e.jsx(d.Body,{children:u&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs(s,{as:"p",variant:"body",weight:"medium",children:["Delete “",u.name,"”?"]}),u.noteCount>0?e.jsxs("div",{className:"rounded-[14px] border border-border-subtle bg-subtle p-3",children:[e.jsxs(s,{as:"p",variant:"label",tone:"secondary",children:["This property is used by ",u.noteCount," note",u.noteCount===1?"":"s","."]}),e.jsx(s,{as:"p",variant:"micro",tone:"tertiary",className:"mt-1 leading-5",children:"Deleting it removes this value from those notes. Future views using this property will need configuration."})]}):e.jsx(s,{as:"p",variant:"label",tone:"tertiary",children:"This property is not used by any note yet."})]})}),e.jsx(d.Footer,{children:e.jsxs(q,{children:[e.jsx(o,{type:"button",variant:"ghost",size:"sm",disabled:f.isPending,onClick:()=>N(null),children:"Cancel"}),e.jsx(o,{type:"button",variant:"danger",size:"sm",isLoading:f.isPending,onClick:ne,children:"Delete"})]})})]})]})}export{Ee as default};
1
+ import{j as e}from"./note-vendor-uuJO2MTD.js";import{k as oe,u as de,H as ce,q as x,ah as M,b2 as ue,b3 as me,b4 as pe,P as he,T as s,B as o,M as d,I as v,S as xe,e as be,x as q,m as ve,j as ye,aJ as ge}from"./index-BgnmVjeF.js";import{a as p}from"./graph-vendor-CUxe67Lr.js";import"./note-core-DMZcZ4yV.js";const fe=ye(ge),W=[{value:"text",label:"Text",description:"Short status or label values."},{value:"url",label:"URL",description:"External sources, issues, docs, or references."},{value:"number",label:"Number",description:"Priority, score, or count values."},{value:"date",label:"Date",description:"Due dates and milestones."},{value:"boolean",label:"Boolean",description:"True or false flags."},{value:"select",label:"Select",description:"Choose one option from a controlled list."}],je=l=>!l.id&&!l.label.trim()&&!l.value.trim(),Ne=l=>(l.value.trim()||l.label.trim()).toLowerCase().replace(/\s+/g,"-"),Ce=l=>/^[a-z0-9][a-z0-9_-]*$/.test(l),X=l=>l.filter(r=>r.id||r.label.trim()).map((r,F)=>({...r.id?{id:r.id}:{},label:r.label.trim(),value:r.value.trim()||r.label.trim(),color:r.color??null,order:r.order??F}));function Ee(){const l=ve(),r=oe(),F=fe.useSearch(),Z=Number(F.page??1),R=50,V=Math.max(0,Z-1)*R,[k,Q]=p.useState(""),[I,A]=p.useState(""),[y,H]=p.useState("text"),[D,j]=p.useState([{label:"",value:""}]),[u,N]=p.useState(null),[i,$]=p.useState(null),[O,L]=p.useState(""),[E,g]=p.useState([{label:"",value:""}]),[ee,C]=p.useState(!1),S=()=>{Q(""),A(""),H("text"),j([{label:"",value:""}])},ae=a=>{$(a),L(a.name),g(a.options.length>0?a.options.map(t=>({id:t.id,label:t.label,value:t.value,color:t.color,order:t.order})):[{label:"",value:""}])},T=()=>{$(null),L(""),g([{label:"",value:""}])},_=de({queryKey:x.notes.propertyKeys({limit:R,offset:V}),queryFn:async()=>{const a=await ce({limit:R,offset:V});if(a.type==="error")throw a;return a.notePropertyKeys}}),w=M({mutationFn:async()=>ue({key:k,name:I||k,valueType:y,...y==="select"?{options:D.map((a,t)=>({label:a.label.trim(),value:a.value.trim()||a.label.trim(),order:t})).filter(a=>a.label)}:{}}),onSuccess:a=>{if(a.type==="error"){l(a.errors[0]?.message??"Failed to create property.");return}S(),C(!1),r.invalidateQueries({queryKey:x.notes.propertyKeysAll(),exact:!1}),l("Property created.")},onError:()=>{l("Failed to create property.")}}),h=M({mutationFn:async()=>{if(!i)throw new Error("Property to edit is missing.");return me({key:i.key,name:O||i.key,...i.valueType==="select"?{options:X(E)}:{}})},onSuccess:a=>{if(a.type==="error"){l(a.errors[0]?.message??"Failed to update property.");return}T(),r.invalidateQueries({queryKey:x.notes.propertyKeysAll(),exact:!1}),r.invalidateQueries({queryKey:x.notes.all(),exact:!1}),r.invalidateQueries({queryKey:x.views.all(),exact:!1}),l("Property updated.")},onError:()=>{l("Failed to update property.")}}),f=M({mutationFn:async({propertyKey:a,confirmImpact:t})=>pe({key:a.key,confirmImpact:t}),onSuccess:a=>{if(a.type==="error"){l(a.errors[0]?.message??"Failed to delete property.");return}r.invalidateQueries({queryKey:x.notes.propertyKeysAll(),exact:!1}),r.invalidateQueries({queryKey:x.notes.all(),exact:!1}),r.invalidateQueries({queryKey:x.views.all(),exact:!1}),N(null),l(a.deleteNotePropertyKey.affectedNoteCount>0?`Property deleted from ${a.deleteNotePropertyKey.affectedNoteCount} note(s).`:"Property deleted.")},onError:()=>{l("Failed to delete property.")}}),P=_.data?.keys??[],se=y!=="select"||D.some(a=>a.label.trim()),z=i?.valueType==="select"?E.filter(a=>!je(a)):[],B=z.map(Ne),K=B.find((a,t)=>B.indexOf(a)!==t),J=B.find(a=>!Ce(a)),U=z.some(a=>!!a.id&&!a.label.trim()),Y=z.some(a=>!a.id&&!a.label.trim()),te=!i||i.valueType!=="select"||z.length>0&&!U&&!Y&&!K&&!J,le=!!i&&O.trim()!==i?.name,re=i?.valueType==="select"&&JSON.stringify(X(E))!==JSON.stringify(i.options.map(a=>({id:a.id,label:a.label,value:a.value,color:a.color??null,order:a.order}))),ie=le||!!re,G=U?"Existing option labels cannot be empty.":Y?"New options need a label.":K?`Option value “${K}” is duplicated.`:J?"Option values must use letters, numbers, dashes, or underscores.":"",ne=()=>{u&&f.mutate({propertyKey:u,confirmImpact:u.noteCount>0})};return e.jsxs(he,{title:"Properties",description:"Define shared note fields before using them in notes and future views.",headerRight:e.jsx(o,{type:"button",size:"md",variant:"primary",className:"w-full sm:w-auto",onClick:()=>C(!0),children:"New property"}),children:[e.jsxs("section",{className:"flex flex-col gap-3","aria-labelledby":"shared-properties-heading",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(s,{id:"shared-properties-heading",as:"h2",variant:"label",weight:"medium",className:"text-fg-tertiary",children:"Shared fields"}),!_.isLoading&&P.length>0&&e.jsxs(s,{as:"span",variant:"meta",tone:"tertiary",children:[P.length," field",P.length===1?"":"s"]})]}),_.isLoading?e.jsx(s,{as:"p",variant:"body",tone:"tertiary",className:"surface-base px-4 py-3.5",children:"Loading properties..."}):P.length===0?e.jsxs("div",{className:"surface-base border-dashed p-6 text-center",children:[e.jsx(s,{as:"p",variant:"body",weight:"medium",children:"No shared properties yet."}),e.jsx(s,{as:"p",variant:"label",tone:"tertiary",children:"Create one here, then attach it from the note screen."})]}):e.jsx("div",{className:"flex flex-col gap-3",children:P.map(a=>e.jsxs("article",{className:"surface-base grid gap-3 px-4 py-3.5 md:grid-cols-[minmax(0,1fr)_120px_120px_auto] md:items-center",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(s,{as:"h3",variant:"body",weight:"semibold",className:"truncate",children:a.name}),e.jsx(s,{as:"p",variant:"micro",tone:"tertiary",className:"font-mono",children:a.key}),a.options.length>0&&e.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[a.options.slice(0,6).map(t=>e.jsx("span",{className:"rounded-full border border-border-subtle bg-subtle px-2 py-0.5 text-xs font-medium text-fg-secondary",children:t.label},t.id)),a.options.length>6&&e.jsxs("span",{className:"rounded-full border border-border-subtle bg-subtle px-2 py-0.5 text-xs font-medium text-fg-tertiary",children:["+",a.options.length-6]})]})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx(s,{as:"span",variant:"micro",tone:"tertiary",className:"block md:hidden",children:"Type"}),e.jsx(s,{as:"span",variant:"label",tone:"secondary",className:"capitalize",children:a.valueType})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx(s,{as:"span",variant:"micro",tone:"tertiary",className:"block md:hidden",children:"Used in"}),e.jsxs(s,{as:"span",variant:"label",tone:"tertiary",children:[a.noteCount," note",a.noteCount===1?"":"s"]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 justify-self-start md:justify-self-end",children:[e.jsx(o,{type:"button",size:"sm",variant:"subtle",disabled:h.isPending||f.isPending,onClick:()=>ae(a),children:"Edit"}),e.jsx(o,{type:"button",size:"sm",variant:"soft-danger",disabled:f.isPending||h.isPending,onClick:()=>N(a),children:"Delete"})]})]},a.key))})]}),e.jsxs(d,{isOpen:ee,onClose:()=>{w.isPending||(C(!1),S())},variant:"form",children:[e.jsx(d.Header,{title:"New property",onClose:()=>{C(!1),S()}}),e.jsx(d.Body,{children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(s,{as:"p",variant:"label",tone:"tertiary",children:"Create a shared field that notes can use for values and future views."}),e.jsxs("label",{className:"flex flex-col gap-1.5",children:[e.jsx(s,{as:"span",variant:"label",weight:"medium",children:"Key"}),e.jsx(v,{size:"md",placeholder:"status",value:k,onChange:a=>Q(a.target.value)})]}),e.jsxs("label",{className:"flex flex-col gap-1.5",children:[e.jsx(s,{as:"span",variant:"label",weight:"medium",children:"Name"}),e.jsx(v,{size:"md",placeholder:"Status",value:I,onChange:a=>A(a.target.value)})]}),e.jsxs("label",{className:"flex flex-col gap-1.5",children:[e.jsx(s,{as:"span",variant:"label",weight:"medium",children:"Type"}),e.jsx(xe,{value:y,onValueChange:a=>H(a),children:W.map(a=>e.jsx(be,{value:a.value,children:a.label},a.value))})]}),y==="select"&&e.jsxs("div",{className:"rounded-[14px] border border-border-subtle bg-subtle/50 p-3",children:[e.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[e.jsx(s,{as:"span",variant:"label",weight:"semibold",children:"Options"}),e.jsx(o,{type:"button",size:"sm",variant:"subtle",onClick:()=>j(a=>[...a,{label:"",value:""}]),children:"Add option"})]}),e.jsx("div",{className:"flex flex-col gap-2",children:D.map((a,t)=>e.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_1fr_auto]",children:[e.jsx(v,{size:"sm",placeholder:"Label",value:a.label,onChange:c=>j(m=>m.map((n,b)=>b===t?{...n,label:c.target.value}:n))}),e.jsx(v,{size:"sm",placeholder:"value",value:a.value,onChange:c=>j(m=>m.map((n,b)=>b===t?{...n,value:c.target.value}:n))}),e.jsx(o,{type:"button",size:"sm",variant:"soft-danger",onClick:()=>j(c=>c.filter((m,n)=>n!==t)),children:"Remove"})]},t))})]}),e.jsx(s,{as:"p",variant:"micro",tone:"tertiary",children:W.find(a=>a.value===y)?.description})]})}),e.jsx(d.Footer,{children:e.jsxs(q,{children:[e.jsx(o,{type:"button",variant:"ghost",size:"sm",disabled:w.isPending,onClick:()=>{C(!1),S()},children:"Cancel"}),e.jsx(o,{type:"button",variant:"primary",size:"sm",disabled:!k.trim()||!se||w.isPending,isLoading:w.isPending,onClick:()=>w.mutate(),children:"Create property"})]})})]}),e.jsxs(d,{isOpen:!!i,onClose:()=>{h.isPending||T()},variant:"form",children:[e.jsx(d.Header,{title:"Edit property",onClose:()=>{h.isPending||T()}}),e.jsx(d.Body,{children:i&&e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(s,{as:"p",variant:"label",tone:"tertiary",children:"Rename the display label or add select options. Key, type, and existing option values stay fixed so notes and views remain stable."}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[14px] border border-border-subtle bg-subtle/50 px-3 py-2",children:[e.jsx(s,{as:"span",variant:"micro",tone:"tertiary",className:"block",children:"Key"}),e.jsx(s,{as:"span",variant:"label",weight:"medium",className:"font-mono",children:i.key})]}),e.jsxs("div",{className:"rounded-[14px] border border-border-subtle bg-subtle/50 px-3 py-2",children:[e.jsx(s,{as:"span",variant:"micro",tone:"tertiary",className:"block",children:"Type"}),e.jsx(s,{as:"span",variant:"label",weight:"medium",className:"capitalize",children:i.valueType})]})]}),e.jsxs("label",{className:"flex flex-col gap-1.5",children:[e.jsx(s,{as:"span",variant:"label",weight:"medium",children:"Display name"}),e.jsx(v,{size:"md",placeholder:"Workflow state",value:O,onChange:a=>L(a.target.value)})]}),i.valueType==="select"&&e.jsxs("div",{className:"rounded-[14px] border border-border-subtle bg-subtle/50 p-3",children:[e.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx(s,{as:"span",variant:"label",weight:"semibold",children:"Options"}),e.jsx(s,{as:"p",variant:"micro",tone:"tertiary",className:"mt-0.5",children:"Existing option values are locked. Removing existing options needs an impact-aware delete flow."})]}),e.jsx(o,{type:"button",size:"sm",variant:"subtle",onClick:()=>g(a=>[...a,{label:"",value:""}]),children:"Add option"})]}),e.jsx("div",{className:"flex flex-col gap-2",children:E.map((a,t)=>e.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_1fr_auto]",children:[e.jsx(v,{size:"sm",placeholder:"Label",value:a.label,onChange:c=>g(m=>m.map((n,b)=>b===t?{...n,label:c.target.value}:n))}),e.jsx(v,{size:"sm",placeholder:a.id?"Locked value":"value",value:a.value,disabled:!!a.id,onChange:c=>g(m=>m.map((n,b)=>b===t?{...n,value:c.target.value}:n))}),a.id?e.jsx(s,{as:"span",variant:"meta",tone:"tertiary",className:"flex h-8 items-center px-3",children:"Locked"}):e.jsx(o,{type:"button",size:"sm",variant:"soft-danger",onClick:()=>g(c=>c.filter((m,n)=>n!==t)),children:"Remove"})]},a.id??`new-${t}`))}),G&&e.jsx(s,{as:"p",variant:"micro",tone:"error",className:"mt-2",children:G})]})]})}),e.jsx(d.Footer,{children:e.jsxs(q,{children:[e.jsx(o,{type:"button",variant:"ghost",size:"sm",disabled:h.isPending,onClick:T,children:"Cancel"}),e.jsx(o,{type:"button",variant:"primary",size:"sm",disabled:!O.trim()||!ie||!te||h.isPending,isLoading:h.isPending,onClick:()=>h.mutate(),children:"Save changes"})]})})]}),e.jsxs(d,{isOpen:!!u,onClose:()=>{f.isPending||N(null)},variant:"confirm",children:[e.jsx(d.Header,{title:"Delete property",onClose:()=>N(null)}),e.jsx(d.Body,{children:u&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs(s,{as:"p",variant:"body",weight:"medium",children:["Delete “",u.name,"”?"]}),u.noteCount>0?e.jsxs("div",{className:"rounded-[14px] border border-border-subtle bg-subtle p-3",children:[e.jsxs(s,{as:"p",variant:"label",tone:"secondary",children:["This property is used by ",u.noteCount," note",u.noteCount===1?"":"s","."]}),e.jsx(s,{as:"p",variant:"micro",tone:"tertiary",className:"mt-1 leading-5",children:"Deleting it removes this value from those notes. Future views using this property will need configuration."})]}):e.jsx(s,{as:"p",variant:"label",tone:"tertiary",children:"This property is not used by any note yet."})]})}),e.jsx(d.Footer,{children:e.jsxs(q,{children:[e.jsx(o,{type:"button",variant:"ghost",size:"sm",disabled:f.isPending,onClick:()=>N(null),children:"Cancel"}),e.jsx(o,{type:"button",variant:"danger",size:"sm",isLoading:f.isPending,onClick:ne,children:"Delete"})]})})]})]})}export{Ee as default};
@@ -1 +1 @@
1
- import{j as e}from"./note-vendor-uuJO2MTD.js";import{a0 as M,j as Q,aw as F,k as L,y as _,a6 as I,aT as K,q as i,ah as E,aU as B,N as O,aV as W,P as N,J as H,T as d,ax as U,B as j,a1 as V,aW as Y,i as l,m as $,d as z,ak as G,u as J,aX as X,M as y}from"./index-B43ulIPo.js";import{a as k}from"./graph-vendor-CUxe67Lr.js";import{S as C}from"./SurfaceCard-Bnfo5EOl.js";import"./note-core-DMZcZ4yV.js";const m=25,v=Q(F),S=30,R=`Deleted notes stay here for ${S} days before permanent removal`,g={title:"Permanently delete note?",description:"This note is referenced by the notes below. If you permanently delete it, those links will stay broken. Other notes will not be edited automatically.",confirmLabel:"Delete now",confirmVariant:"danger"},P=a=>z(a).format("YYYY-MM-DD HH:mm"),Z=({note:a,onClose:o})=>{const s=a?.id??"",c=a?.title||"Untitled note",r=J({queryKey:i.notes.trashDetail(s),enabled:!!a,queryFn:async()=>{const h=await X(s);if(h.type==="error")throw h;if(!h.trashedNote)throw new Error("Trashed note not found");return h.trashedNote}}),f=r.data?.contentAsMarkdown.trim()??"";return e.jsxs(y,{isOpen:!!a,onClose:o,variant:"inspect",children:[e.jsx(y.Header,{title:c,onClose:o}),e.jsx(y.Body,{children:e.jsxs("div",{className:"flex flex-col gap-3",children:[a&&e.jsxs(d,{as:"p",variant:"meta",tone:"secondary",children:["Deleted ",P(a.deletedAt)]}),r.isLoading&&e.jsx(d,{as:"p",variant:"meta",tone:"secondary",children:"Loading deleted note content..."}),r.isError&&e.jsx(d,{as:"p",variant:"meta",tone:"error",children:"Failed to load deleted note content."}),!r.isLoading&&!r.isError&&f&&e.jsx("pre",{className:"max-h-[60vh] overflow-auto whitespace-pre-wrap break-words rounded-[14px] border border-border-subtle bg-hover-subtle/50 px-4 py-3 text-sm leading-6 text-fg-secondary",children:f}),!r.isLoading&&!r.isError&&!f&&e.jsx(d,{as:"p",variant:"meta",tone:"secondary",className:"rounded-[14px] border border-border-subtle bg-hover-subtle/50 px-4 py-3",children:"No readable content was found for this deleted note."})]})}),e.jsx(y.Footer,{children:e.jsx(j,{variant:"ghost",size:"sm",onClick:o,children:"Close"})})]})},ee=()=>e.jsx(N,{title:"Trash",variant:"default",heading:e.jsx(l,{width:118,height:24,className:"rounded-full"}),description:e.jsx(l,{width:352,height:16,className:"rounded-full"}),children:e.jsx("div",{className:"grid gap-3",children:Array.from({length:3},(a,o)=>e.jsx(C,{padding:"compact",children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[e.jsx(l,{width:"40%",height:18,className:"rounded-full"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(l,{width:168,height:14,className:"rounded-full"}),e.jsx(l,{width:176,height:14,className:"rounded-full"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(l,{width:56,height:24,className:"rounded-full"}),e.jsx(l,{width:72,height:24,className:"rounded-full"})]})]}),e.jsx(l,{width:92,height:32,className:"rounded-[12px]"})]})},o))})}),te=()=>{const{page:a}=v.useSearch(),o=v.useNavigate(),s=L(),c=$(),r=_(),[f,h]=k.useState(null),[x,b]=k.useState(null),{data:u}=I({queryKey:i.notes.trash({limit:m,offset:(a-1)*m}),queryFn:async()=>{const t=await K({limit:m,offset:(a-1)*m});if(t.type==="error")throw t;return t.trashedNotes}}),w=E({mutationFn:B,onSuccess:async t=>{if(t.type==="error")throw t;await Promise.all([s.invalidateQueries({queryKey:i.notes.all(),exact:!1}),s.invalidateQueries({queryKey:i.tags.all(),exact:!1}),s.invalidateQueries({queryKey:i.reminders.all(),exact:!1}),s.invalidateQueries({queryKey:i.images.all(),exact:!1}),s.invalidateQueries({queryKey:i.calendar.all(),exact:!1})]),c("The note has been restored."),o({to:O,params:{id:t.restoreTrashedNote.id}})},onError:()=>{c("Failed to restore the note.")}}),p=E({mutationFn:W,onSuccess:async t=>{if(t.type==="error")throw t;await s.invalidateQueries({queryKey:i.notes.trashAll(),exact:!1}),c("The note has been permanently deleted.")},onError:()=>{c("Failed to permanently delete the note.")}}),D=()=>{if(!x)return;const{id:t}=x;b(null),p.mutate(t)},q=async t=>{const n=await G(t);if(n.type==="error"){c("Failed to check linked notes before permanently deleting this note.");return}if(s.setQueryData(i.notes.backReferences(t),n.backReferences),n.backReferences.length>0){b({id:t,backReferences:n.backReferences});return}await r("Permanently delete this note? This cannot be undone.")&&p.mutate(t)},T=u.totalCount>0?`Trash (${u.totalCount})`:void 0,A=u.notes.find(t=>t.id===f)??null;return u.notes.length===0?e.jsx(N,{title:"Trash",variant:"default",heading:T,description:R,children:e.jsx(H,{title:"Trash is empty",description:`Delete a note and you can restore it here for ${S} days before permanent removal`})}):e.jsxs(N,{title:"Trash",variant:"default",heading:T,description:R,children:[e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"grid gap-3",children:u.notes.map(t=>e.jsx(C,{padding:"compact",children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-1.5",children:[e.jsx(d,{as:"h2",variant:"body",weight:"medium",className:"min-w-0 flex-1 break-words leading-[1.25]",children:t.title||"Untitled note"}),t.pinned&&e.jsx("span",{title:"Pinned",className:"inline-flex h-5 w-5 shrink-0 items-center justify-center text-fg-tertiary",children:e.jsx(U,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1",children:e.jsxs(d,{as:"div",variant:"meta",weight:"medium",tone:"secondary",children:["Deleted ",P(t.deletedAt)]})}),t.tagNames.length>0&&e.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:t.tagNames.map(n=>e.jsx(d,{as:"span",variant:"label",weight:"medium",tone:"tertiary",className:"rounded-full border border-border-subtle bg-hover-subtle px-2 py-0.5",children:n},`${t.id}-${n}`))}),t.contentPreview&&e.jsx("div",{className:"mt-3 rounded-[14px] border border-border-subtle bg-hover-subtle/50 px-3 py-2",children:e.jsx(d,{as:"p",variant:"meta",tone:"secondary",className:"line-clamp-3 whitespace-pre-wrap break-words",children:t.contentPreview})})]}),e.jsxs("div",{className:"flex shrink-0 flex-wrap gap-2 sm:justify-end",children:[e.jsx(j,{variant:"subtle",size:"sm",onClick:()=>h(t.id),children:"View content"}),e.jsx(j,{variant:"subtle",size:"sm",isLoading:w.isPending&&w.variables===t.id,onClick:()=>w.mutate(t.id),children:"Restore"}),e.jsx(j,{variant:"soft-danger",size:"sm",isLoading:p.isPending&&p.variables===t.id,onClick:()=>q(t.id),children:"Delete now"})]})]})},t.id))}),u.totalCount>m&&e.jsx(V,{page:a,last:Math.ceil(u.totalCount/m),onChange:t=>{o({search:n=>({...n,page:t})})}})]}),e.jsx(Z,{note:A,onClose:()=>h(null)}),e.jsx(Y,{isOpen:!!x,title:g.title,description:g.description,references:x?.backReferences??[],confirmLabel:g.confirmLabel,confirmVariant:g.confirmVariant,onClose:()=>b(null),onConfirm:D})]})},oe=()=>{const{page:a}=v.useSearch();return e.jsx(M,{fallback:e.jsx(ee,{}),errorTitle:"Failed to load trash",errorDescription:"Retry loading deleted notes",resetKeys:[a],children:e.jsx(te,{})})};export{oe as default};
1
+ import{j as e}from"./note-vendor-uuJO2MTD.js";import{a0 as M,j as Q,ax as F,k as L,y as _,a6 as I,aU as K,q as i,ah as E,aV as B,N as O,aW as W,P as w,J as Y,T as d,ay as H,B as j,a1 as U,aX as V,i as l,m as $,d as z,al as G,u as J,aY as X,M as y}from"./index-BgnmVjeF.js";import{a as k}from"./graph-vendor-CUxe67Lr.js";import{S as C}from"./SurfaceCard-Brd1cMxi.js";import"./note-core-DMZcZ4yV.js";const m=25,v=Q(F),S=30,R=`Deleted notes stay here for ${S} days before permanent removal`,g={title:"Permanently delete note?",description:"This note is referenced by the notes below. If you permanently delete it, those links will stay broken. Other notes will not be edited automatically.",confirmLabel:"Delete now",confirmVariant:"danger"},P=a=>z(a).format("YYYY-MM-DD HH:mm"),Z=({note:a,onClose:o})=>{const s=a?.id??"",c=a?.title||"Untitled note",r=J({queryKey:i.notes.trashDetail(s),enabled:!!a,queryFn:async()=>{const h=await X(s);if(h.type==="error")throw h;if(!h.trashedNote)throw new Error("Trashed note not found");return h.trashedNote}}),f=r.data?.contentAsMarkdown.trim()??"";return e.jsxs(y,{isOpen:!!a,onClose:o,variant:"inspect",children:[e.jsx(y.Header,{title:c,onClose:o}),e.jsx(y.Body,{children:e.jsxs("div",{className:"flex flex-col gap-3",children:[a&&e.jsxs(d,{as:"p",variant:"meta",tone:"secondary",children:["Deleted ",P(a.deletedAt)]}),r.isLoading&&e.jsx(d,{as:"p",variant:"meta",tone:"secondary",children:"Loading deleted note content..."}),r.isError&&e.jsx(d,{as:"p",variant:"meta",tone:"error",children:"Failed to load deleted note content."}),!r.isLoading&&!r.isError&&f&&e.jsx("pre",{className:"max-h-[60vh] overflow-auto whitespace-pre-wrap break-words rounded-[14px] border border-border-subtle bg-hover-subtle/50 px-4 py-3 text-sm leading-6 text-fg-secondary",children:f}),!r.isLoading&&!r.isError&&!f&&e.jsx(d,{as:"p",variant:"meta",tone:"secondary",className:"rounded-[14px] border border-border-subtle bg-hover-subtle/50 px-4 py-3",children:"No readable content was found for this deleted note."})]})}),e.jsx(y.Footer,{children:e.jsx(j,{variant:"ghost",size:"sm",onClick:o,children:"Close"})})]})},ee=()=>e.jsx(w,{title:"Trash",variant:"default",heading:e.jsx(l,{width:118,height:24,className:"rounded-full"}),description:e.jsx(l,{width:352,height:16,className:"rounded-full"}),children:e.jsx("div",{className:"grid gap-3",children:Array.from({length:3},(a,o)=>e.jsx(C,{padding:"compact",children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[e.jsx(l,{width:"40%",height:18,className:"rounded-full"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(l,{width:168,height:14,className:"rounded-full"}),e.jsx(l,{width:176,height:14,className:"rounded-full"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(l,{width:56,height:24,className:"rounded-full"}),e.jsx(l,{width:72,height:24,className:"rounded-full"})]})]}),e.jsx(l,{width:92,height:32,className:"rounded-[12px]"})]})},o))})}),te=()=>{const{page:a}=v.useSearch(),o=v.useNavigate(),s=L(),c=$(),r=_(),[f,h]=k.useState(null),[x,b]=k.useState(null),{data:u}=I({queryKey:i.notes.trash({limit:m,offset:(a-1)*m}),queryFn:async()=>{const t=await K({limit:m,offset:(a-1)*m});if(t.type==="error")throw t;return t.trashedNotes}}),N=E({mutationFn:B,onSuccess:async t=>{if(t.type==="error")throw t;await Promise.all([s.invalidateQueries({queryKey:i.notes.all(),exact:!1}),s.invalidateQueries({queryKey:i.tags.all(),exact:!1}),s.invalidateQueries({queryKey:i.reminders.all(),exact:!1}),s.invalidateQueries({queryKey:i.images.all(),exact:!1}),s.invalidateQueries({queryKey:i.calendar.all(),exact:!1})]),c("The note has been restored."),o({to:O,params:{id:t.restoreTrashedNote.id}})},onError:()=>{c("Failed to restore the note.")}}),p=E({mutationFn:W,onSuccess:async t=>{if(t.type==="error")throw t;await s.invalidateQueries({queryKey:i.notes.trashAll(),exact:!1}),c("The note has been permanently deleted.")},onError:()=>{c("Failed to permanently delete the note.")}}),D=()=>{if(!x)return;const{id:t}=x;b(null),p.mutate(t)},q=async t=>{const n=await G(t);if(n.type==="error"){c("Failed to check linked notes before permanently deleting this note.");return}if(s.setQueryData(i.notes.backReferences(t),n.backReferences),n.backReferences.length>0){b({id:t,backReferences:n.backReferences});return}await r("Permanently delete this note? This cannot be undone.")&&p.mutate(t)},T=u.totalCount>0?`Trash (${u.totalCount})`:void 0,A=u.notes.find(t=>t.id===f)??null;return u.notes.length===0?e.jsx(w,{title:"Trash",variant:"default",heading:T,description:R,children:e.jsx(Y,{title:"Trash is empty",description:`Delete a note and you can restore it here for ${S} days before permanent removal`})}):e.jsxs(w,{title:"Trash",variant:"default",heading:T,description:R,children:[e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"grid gap-3",children:u.notes.map(t=>e.jsx(C,{padding:"compact",children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-1.5",children:[e.jsx(d,{as:"h2",variant:"body",weight:"medium",className:"min-w-0 flex-1 break-words leading-[1.25]",children:t.title||"Untitled note"}),t.pinned&&e.jsx("span",{title:"Pinned",className:"inline-flex h-5 w-5 shrink-0 items-center justify-center text-fg-tertiary",children:e.jsx(H,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1",children:e.jsxs(d,{as:"div",variant:"meta",weight:"medium",tone:"secondary",children:["Deleted ",P(t.deletedAt)]})}),t.tagNames.length>0&&e.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:t.tagNames.map(n=>e.jsx(d,{as:"span",variant:"label",weight:"medium",tone:"tertiary",className:"rounded-full border border-border-subtle bg-hover-subtle px-2 py-0.5",children:n},`${t.id}-${n}`))}),t.contentPreview&&e.jsx("div",{className:"mt-3 rounded-[14px] border border-border-subtle bg-hover-subtle/50 px-3 py-2",children:e.jsx(d,{as:"p",variant:"meta",tone:"secondary",className:"line-clamp-3 whitespace-pre-wrap break-words",children:t.contentPreview})})]}),e.jsxs("div",{className:"flex shrink-0 flex-wrap gap-2 sm:justify-end",children:[e.jsx(j,{variant:"subtle",size:"sm",onClick:()=>h(t.id),children:"View content"}),e.jsx(j,{variant:"subtle",size:"sm",isLoading:N.isPending&&N.variables===t.id,onClick:()=>N.mutate(t.id),children:"Restore"}),e.jsx(j,{variant:"soft-danger",size:"sm",isLoading:p.isPending&&p.variables===t.id,onClick:()=>q(t.id),children:"Delete now"})]})]})},t.id))}),u.totalCount>m&&e.jsx(U,{page:a,last:Math.ceil(u.totalCount/m),onChange:t=>{o({search:n=>({...n,page:t})})}})]}),e.jsx(Z,{note:A,onClose:()=>h(null)}),e.jsx(V,{isOpen:!!x,title:g.title,description:g.description,references:x?.backReferences??[],confirmLabel:g.confirmLabel,confirmVariant:g.confirmVariant,onClose:()=>b(null),onConfirm:D})]})},oe=()=>{const{page:a}=v.useSearch();return e.jsx(M,{fallback:e.jsx(ee,{}),errorTitle:"Failed to load trash",errorDescription:"Retry loading deleted notes",resetKeys:[a],children:e.jsx(te,{})})};export{oe as default};
@@ -1,4 +1,4 @@
1
- import{j as y}from"./note-vendor-uuJO2MTD.js";import{h as u,a6 as f,q as n,k as R,m as $}from"./index-B43ulIPo.js";import{a as l}from"./graph-vendor-CUxe67Lr.js";const g=(e={})=>({limit:e.limit??10,offset:e.offset??0}),D=async(e,t)=>u(`
1
+ import{j as y}from"./note-vendor-uuJO2MTD.js";import{h as u,a6 as f,q as n,k as R,m as $}from"./index-BgnmVjeF.js";import{a as l}from"./graph-vendor-CUxe67Lr.js";const g=(e={})=>({limit:e.limit??10,offset:e.offset??0}),D=async(e,t)=>u(`
2
2
  query FetchNoteReminders($noteId: ID!, $pagination: PaginationInput) {
3
3
  noteReminders(noteId: $noteId, pagination: $pagination) {
4
4
  totalCount
@@ -6,11 +6,11 @@
6
6
  <link rel="icon" type="image/png" href="/icon.png" />
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
8
  <title>Ocean Brain</title>
9
- <script type="module" crossorigin src="/assets/index-B43ulIPo.js"></script>
9
+ <script type="module" crossorigin src="/assets/index-BgnmVjeF.js"></script>
10
10
  <link rel="modulepreload" crossorigin href="/assets/graph-vendor-CUxe67Lr.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/note-core-DMZcZ4yV.js">
12
12
  <link rel="modulepreload" crossorigin href="/assets/note-vendor-uuJO2MTD.js">
13
- <link rel="stylesheet" crossorigin href="/assets/index-CDjYEIVf.css">
13
+ <link rel="stylesheet" crossorigin href="/assets/index-BFkZTZ6v.css">
14
14
  </head>
15
15
 
16
16
  <body>
@@ -13,7 +13,7 @@ import {
13
13
  NOTE_SEARCH_TEXT_SCHEMA_VERSION,
14
14
  parseNoteSearchQuery
15
15
  } from "../../../features/note/services/search.js";
16
- import { getNoteSnapshot, listNoteSnapshots } from "../../../features/note/services/snapshot.js";
16
+ import { diffNoteSnapshot, getNoteSnapshot, listNoteSnapshots } from "../../../features/note/services/snapshot.js";
17
17
  import {
18
18
  buildNoteTagNamesWhere,
19
19
  normalizeNoteTagNames
@@ -21,6 +21,14 @@ import {
21
21
  import { getTrashedNoteById, listTrashedNotes } from "../../../features/note/services/trash.js";
22
22
  import models from "../../../models.js";
23
23
  import { runDataMaintenanceInBackground } from "../../../modules/data-maintenance.js";
24
+ const MAX_SQLITE_INT_ID = 2147483647;
25
+ const isValidNoteIdString = (id) => {
26
+ if (!/^[1-9]\d*$/.test(id)) {
27
+ return false;
28
+ }
29
+ const numericId = Number(id);
30
+ return Number.isSafeInteger(numericId) && numericId <= MAX_SQLITE_INT_ID;
31
+ };
24
32
  const buildAllNotesOrderBy = (searchFilter) => {
25
33
  const sortBy = searchFilter.sortBy || "updatedAt";
26
34
  const sortOrder = searchFilter.sortOrder || "desc";
@@ -212,6 +220,67 @@ const createNoteGraphQueryResolver = (deps = {
212
220
  return buildNoteGraph(notes);
213
221
  };
214
222
  };
223
+ const createNoteQueryResolver = (deps = {
224
+ findNote: (id) => models.note.findUnique({ where: { id } }),
225
+ findReferenceNotes: (ids) => models.note.findMany({ where: { id: { in: ids } } }),
226
+ updateNoteContent: ({ id, updatedAt, content, searchableText, searchableTextVersion }) => models.note.update({
227
+ where: {
228
+ id,
229
+ updatedAt
230
+ },
231
+ data: {
232
+ content,
233
+ searchableText,
234
+ searchableTextVersion
235
+ }
236
+ }),
237
+ isRecordNotFoundError
238
+ }) => {
239
+ return async (_, { id }) => {
240
+ const note = await deps.findNote(Number(id));
241
+ if (!note) {
242
+ throw "NOT FOUND";
243
+ }
244
+ if (!note.content) {
245
+ return note;
246
+ }
247
+ const blocks = extractReferenceBlocksFromContent(note.content);
248
+ if (blocks.length === 0) {
249
+ return note;
250
+ }
251
+ const referenceIds = Array.from(
252
+ new Set(
253
+ blocks.map((block) => normalizeReferenceId(block.props?.id)).filter(
254
+ (referenceId) => referenceId !== null && isValidNoteIdString(referenceId)
255
+ ).map(Number)
256
+ )
257
+ );
258
+ const references = await deps.findReferenceNotes(referenceIds);
259
+ const titlesById = new Map(
260
+ references.map((referenceNote) => [String(referenceNote.id), referenceNote.title])
261
+ );
262
+ const newContent = syncReferenceTitlesInContent(note.content, titlesById);
263
+ if (!newContent || newContent === note.content) {
264
+ return note;
265
+ }
266
+ try {
267
+ return await deps.updateNoteContent({
268
+ id: note.id,
269
+ updatedAt: note.updatedAt,
270
+ content: newContent,
271
+ ...buildNoteSearchProjection({
272
+ title: note.title,
273
+ content: newContent
274
+ })
275
+ });
276
+ } catch (error) {
277
+ if (deps.isRecordNotFoundError(error)) {
278
+ return note;
279
+ }
280
+ throw error;
281
+ }
282
+ };
283
+ };
215
284
  const noteQueryResolvers = {
216
285
  allNotes: createAllNotesQueryResolver(),
217
286
  notesInDateRange: async (_, {
@@ -287,52 +356,7 @@ const noteQueryResolvers = {
287
356
  where: { content: { contains: src } }
288
357
  }),
289
358
  backReferences: createBackReferencesQueryResolver(),
290
- note: async (_, { id }) => {
291
- const note = await models.note.findUnique({ where: { id: Number(id) } });
292
- if (!note) {
293
- throw "NOT FOUND";
294
- }
295
- if (!note.content) {
296
- return note;
297
- }
298
- const blocks = extractReferenceBlocksFromContent(note.content);
299
- if (blocks.length === 0) {
300
- return note;
301
- }
302
- const referenceIds = Array.from(
303
- new Set(
304
- blocks.map((block) => normalizeReferenceId(block.props?.id)).filter((referenceId) => referenceId !== null).map(Number).filter(Number.isFinite)
305
- )
306
- );
307
- const references = await models.note.findMany({ where: { id: { in: referenceIds } } });
308
- const titlesById = new Map(
309
- references.map((referenceNote) => [String(referenceNote.id), referenceNote.title])
310
- );
311
- const newContent = syncReferenceTitlesInContent(note.content, titlesById);
312
- if (!newContent || newContent === note.content) {
313
- return note;
314
- }
315
- try {
316
- return await models.note.update({
317
- where: {
318
- id: note.id,
319
- updatedAt: note.updatedAt
320
- },
321
- data: {
322
- content: newContent,
323
- ...buildNoteSearchProjection({
324
- title: note.title,
325
- content: newContent
326
- })
327
- }
328
- });
329
- } catch (error) {
330
- if (isRecordNotFoundError(error)) {
331
- return note;
332
- }
333
- throw error;
334
- }
335
- },
359
+ note: createNoteQueryResolver(),
336
360
  noteCleanupCandidates: async (_, {
337
361
  query,
338
362
  pagination = {
@@ -359,6 +383,22 @@ const noteQueryResolvers = {
359
383
  noteSnapshot: async (_, { id }) => {
360
384
  return getNoteSnapshot(Number(id));
361
385
  },
386
+ noteSnapshotDiff: async (_, {
387
+ id,
388
+ compareToSnapshotId,
389
+ target,
390
+ contextLines
391
+ }) => {
392
+ const normalizedContextLines = contextLines ?? 3;
393
+ if (normalizedContextLines < 0 || normalizedContextLines > 20) {
394
+ throw new Error("INVALID_SNAPSHOT_DIFF_CONTEXT_LINES");
395
+ }
396
+ return diffNoteSnapshot(Number(id), {
397
+ ...compareToSnapshotId !== void 0 ? { compareToSnapshotId: Number(compareToSnapshotId) } : {},
398
+ ...target !== void 0 ? { target: target.toLowerCase() } : {},
399
+ contextLines: normalizedContextLines
400
+ });
401
+ },
362
402
  notePropertyKeys: async (_, {
363
403
  query,
364
404
  pagination = {
@@ -392,6 +432,7 @@ export {
392
432
  createAllNotesQueryResolver,
393
433
  createBackReferencesQueryResolver,
394
434
  createNoteGraphQueryResolver,
435
+ createNoteQueryResolver,
395
436
  noteQueryResolvers
396
437
  };
397
438
  //# sourceMappingURL=note.query.resolver.js.map