@xopcai/xopc 0.0.245 → 0.0.246

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 (115) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DRQnogaU.js → agent-avatar-dicebear-CJJzpYYS.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-CpOxGbMD.js → agent-defaults-settings-panel-0dRjnL2s.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agents-flnXZLaT.js → agents-je3sRGmk.js} +1 -1
  6. package/dist/gateway/static/root/assets/{app-management-settings-panel-CZl6n2xi.js → app-management-settings-panel-Cnn3i00c.js} +1 -1
  7. package/dist/gateway/static/root/assets/{appearance-settings-Bglp-pn6.js → appearance-settings-BToQaw_v.js} +1 -1
  8. package/dist/gateway/static/root/assets/{apps-page-CmsWarVB.js → apps-page-EpUZsl4h.js} +1 -1
  9. package/dist/gateway/static/root/assets/{attachment-load-G0HenUmG.js → attachment-load-BFtcib5t.js} +1 -1
  10. package/dist/gateway/static/root/assets/{automations-page-B78bFjH2.js → automations-page-XS8wIl5o.js} +1 -1
  11. package/dist/gateway/static/root/assets/{automations-workspace-BMQGmn50.js → automations-workspace-BGQdHrip.js} +1 -1
  12. package/dist/gateway/static/root/assets/{binary-plugins-BbSQmXqn.js → binary-plugins-Xs7pLHxR.js} +1 -1
  13. package/dist/gateway/static/root/assets/{block-editor-DutTIH81.js → block-editor-BPdSzceB.js} +1 -1
  14. package/dist/gateway/static/root/assets/{browser-settings-page-CALiFKm4.js → browser-settings-page-DJGcm7rH.js} +1 -1
  15. package/dist/gateway/static/root/assets/{browser-workflows-page-DE5HPrHZ.js → browser-workflows-page-DUPPvE30.js} +1 -1
  16. package/dist/gateway/static/root/assets/{capabilities-settings-panel-Dts7XtP3.js → capabilities-settings-panel-cl9kYilL.js} +1 -1
  17. package/dist/gateway/static/root/assets/{channels-settings-CWEd3wzh.js → channels-settings-BcIr-_GM.js} +1 -1
  18. package/dist/gateway/static/root/assets/{chat-terminal-dock-Bp1fXQm1.js → chat-terminal-dock-DKW1M6aJ.js} +1 -1
  19. package/dist/gateway/static/root/assets/{connectors-page-CQ6wVNLm.js → connectors-page-DNHqaZfX.js} +1 -1
  20. package/dist/gateway/static/root/assets/{cron-expression-B8HA5IRb.js → cron-expression-Bijb0ZQu.js} +1 -1
  21. package/dist/gateway/static/root/assets/{date-picker-DD8b7oad.js → date-picker-BZuHw-SY.js} +1 -1
  22. package/dist/gateway/static/root/assets/{dependency-picker-BC9zwIyH.js → dependency-picker-BsBD2JFY.js} +1 -1
  23. package/dist/gateway/static/root/assets/{desktop-pet-DsrsPZTW.js → desktop-pet-Ceuw3QKb.js} +1 -1
  24. package/dist/gateway/static/root/assets/{desktop-pet-settings-D7gp_HNA.js → desktop-pet-settings-DctOXexM.js} +1 -1
  25. package/dist/gateway/static/root/assets/{extension-debug-page-BoKbOX7x.js → extension-debug-page-BNlMPATK.js} +1 -1
  26. package/dist/gateway/static/root/assets/{extension-page-BegL4FW8.js → extension-page-CK4Uvzge.js} +1 -1
  27. package/dist/gateway/static/root/assets/{extension-settings-page-CjPqq57s.js → extension-settings-page-CpnXXemw.js} +1 -1
  28. package/dist/gateway/static/root/assets/{gateway-config-api-DaG57o4X.js → gateway-config-api-C_mlpe-r.js} +1 -1
  29. package/dist/gateway/static/root/assets/{gateway-settings-DkJGpgm6.js → gateway-settings-DSSW17ed.js} +1 -1
  30. package/dist/gateway/static/root/assets/{heartbeat-settings-BLZ48kSU.js → heartbeat-settings-hbmIZTpg.js} +1 -1
  31. package/dist/gateway/static/root/assets/{home-page-Dtw7Ipt1.js → home-page-CaVvW77l.js} +1 -1
  32. package/dist/gateway/static/root/assets/{index-DG5CfYat.js → index-eZjksPvq.js} +9 -9
  33. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-D2Has7-N.js → keyboard-shortcuts-settings-BQrDwwgi.js} +1 -1
  34. package/dist/gateway/static/root/assets/{local-app-workbench-page-BWidWY93.js → local-app-workbench-page-D3K1XmOM.js} +1 -1
  35. package/dist/gateway/static/root/assets/{local-apps-page-Bkekjoxf.js → local-apps-page-D-YWD6LS.js} +1 -1
  36. package/dist/gateway/static/root/assets/{logs-page-C5zSSgvA.js → logs-page-DvLc9l59.js} +1 -1
  37. package/dist/gateway/static/root/assets/{management-settings-B8c62vRS.js → management-settings-DsULLUUv.js} +1 -1
  38. package/dist/gateway/static/root/assets/{markdown-split-3kxTTGO7.js → markdown-split-CjqlP6IB.js} +1 -1
  39. package/dist/gateway/static/root/assets/{media-plugins-BW8J1nCG.js → media-plugins-DQL029DU.js} +1 -1
  40. package/dist/gateway/static/root/assets/{mobile-pairing-wizard-nwQ8iUcd.js → mobile-pairing-wizard-gauprAae.js} +1 -1
  41. package/dist/gateway/static/root/assets/{notes-page-DdybD0QM.js → notes-page-AsEfLZt9.js} +1 -1
  42. package/dist/gateway/static/root/assets/{notes-workbench-IYfpy2Jx.js → notes-workbench-CI30cDh3.js} +2 -2
  43. package/dist/gateway/static/root/assets/{project-detail-page-4wjw-b7h.js → project-detail-page-jO_4I5zN.js} +1 -1
  44. package/dist/gateway/static/root/assets/{projects-page-CCMj9PeL.js → projects-page-BrTGFME0.js} +1 -1
  45. package/dist/gateway/static/root/assets/{remote-access-hub-DsBJqWIk.js → remote-access-hub-CH70D5SH.js} +1 -1
  46. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-B4IDcqx0.js → runtime-tools-settings-panel-DH6EilMV.js} +1 -1
  47. package/dist/gateway/static/root/assets/{schema-form-DiGUUjO6.js → schema-form-DYHmEZeZ.js} +1 -1
  48. package/dist/gateway/static/root/assets/{sessions-page-BwGj0t-2.js → sessions-page-hbfUNtNs.js} +1 -1
  49. package/dist/gateway/static/root/assets/settings-advanced-gate-Vg3_jua6.js +1 -0
  50. package/dist/gateway/static/root/assets/{settings-page-CVQUsAhd.js → settings-page-BHwPd_M3.js} +1 -1
  51. package/dist/gateway/static/root/assets/{setup-status-panel-CQACRh1i.js → setup-status-panel-DkcpWSss.js} +1 -1
  52. package/dist/gateway/static/root/assets/{share-preview-page-DTP1dtuS.js → share-preview-page-BjwrS03F.js} +1 -1
  53. package/dist/gateway/static/root/assets/{shares-settings-D_YPh6Rw.js → shares-settings-BL4DEt6p.js} +1 -1
  54. package/dist/gateway/static/root/assets/{skill-reload-api-B43xlJlX.js → skill-reload-api-CafhNktn.js} +1 -1
  55. package/dist/gateway/static/root/assets/{skills-page-Czpn7Y28.js → skills-page-OHyK25op.js} +1 -1
  56. package/dist/gateway/static/root/assets/{skills-page.utils-d39rm3hb.js → skills-page.utils-DQx9ulmg.js} +1 -1
  57. package/dist/gateway/static/root/assets/{system-settings-panel-CXXySCSp.js → system-settings-panel-wO7DWv4C.js} +1 -1
  58. package/dist/gateway/static/root/assets/{task-detail-page-DHiOqQMx.js → task-detail-page-anyomXsu.js} +1 -1
  59. package/dist/gateway/static/root/assets/{tunnel-api-BiBGK7O2.js → tunnel-api-CVC8BHZu.js} +1 -1
  60. package/dist/gateway/static/root/assets/{use-autosave-DjpzpeIm.js → use-autosave-DMvRu2XZ.js} +1 -1
  61. package/dist/gateway/static/root/assets/{user-context-page-1XBRV5gX.js → user-context-page-BBk9YdBn.js} +1 -1
  62. package/dist/gateway/static/root/assets/{voice-api-key-field-CUIPNmOc.js → voice-api-key-field-DuBK2NDG.js} +1 -1
  63. package/dist/gateway/static/root/assets/{work-discovery-overlay-DVNxhb1x.js → work-discovery-overlay-B7VXWpDr.js} +1 -1
  64. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-HxxFQFY7.js → workflow-run-setup-panel-BokVAsWN.js} +1 -1
  65. package/dist/gateway/static/root/assets/{workflows-page-BCgL7PRm.js → workflows-page-RUTv0yvR.js} +1 -1
  66. package/dist/gateway/static/root/index.html +1 -1
  67. package/dist/package.js +1 -1
  68. package/dist/src/agent/agent-manager.js +4 -4
  69. package/dist/src/agent/background-review/run-background-review.js +1 -1
  70. package/dist/src/agent/embedded/model-runtime.js +1 -1
  71. package/dist/src/agent/embedded/run-for-session.js +1 -1
  72. package/dist/src/agent/image/tool-model-config.js +1 -1
  73. package/dist/src/agent/ipc/inbox.js +1 -1
  74. package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
  75. package/dist/src/agent/service.js +2 -2
  76. package/dist/src/agent/session/session-inspector.js +1 -1
  77. package/dist/src/agent/skills/hub-lock.js +1 -1
  78. package/dist/src/agent/tasks/task-judge-service.js +3 -3
  79. package/dist/src/ai-assist/text-assist.js +1 -1
  80. package/dist/src/auth/credentials.js +2 -2
  81. package/dist/src/auth/profiles/store.js +1 -1
  82. package/dist/src/auth/sync-provider-auth.js +2 -2
  83. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  84. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  85. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  86. package/dist/src/cli/commands/models.js +1 -1
  87. package/dist/src/config/index.js +4 -4
  88. package/dist/src/config/loader.js +1 -1
  89. package/dist/src/config/models-json.js +1 -1
  90. package/dist/src/extensions/lockfile.js +1 -1
  91. package/dist/src/extensions/update.js +1 -1
  92. package/dist/src/gateway/agents-admin.js +1 -1
  93. package/dist/src/gateway/file-path-classifier.js +1 -1
  94. package/dist/src/gateway/heartbeat/service.js +1 -1
  95. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  96. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  97. package/dist/src/gateway/hono/routes/models.js +1 -1
  98. package/dist/src/gateway/service/config-coordinator.js +2 -2
  99. package/dist/src/gateway/service.js +4 -4
  100. package/dist/src/heartbeat/index.js +1 -1
  101. package/dist/src/infra/update-runner.js +1 -1
  102. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  103. package/dist/src/providers/index.js +2 -2
  104. package/dist/src/providers/model-registry.js +1 -1
  105. package/dist/src/providers/register-runtime-providers.js +1 -1
  106. package/dist/src/share/hosted-session-share.js +1 -1
  107. package/dist/src/tui/tui-startup-resources.js +1 -1
  108. package/dist/src/tui/tui.js +1 -1
  109. package/dist/src/voice/realtime/agentEngine.d.ts +1 -1
  110. package/dist/src/voice/realtime/runtime.d.ts +3 -68
  111. package/dist/src/voice/realtime/runtime.types.d.ts +69 -0
  112. package/dist/src/voice/realtime/runtime.types.js +1 -0
  113. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  114. package/package.json +3 -3
  115. package/dist/gateway/static/root/assets/settings-advanced-gate-BJCfUghk.js +0 -1
@@ -1 +1 @@
1
- import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{a,i as o,o as s,r as c,s as l,t as u}from"./dist-CpzYSoz7.js";import{t as d}from"./circle-check-C23XjkUj.js";import{t as f}from"./x-B_N4OPjy.js";import{t as p}from"./messages-BbdwoxVo.js";import{n as m}from"./locale-store-CBoCuIMx.js";import{t as h}from"./cn-JdwAhgNB.js";import{i as g}from"./vendor-swr-BIWyz7Rc.js";import{t as _}from"./button-CtTvuElV.js";import{t as v}from"./skeleton-BwbyijEw.js";import{i as y,o as b}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{a as x,n as S,r as C}from"./oauth-api-BjSUDIgq.js";import{Hr as w,aa as T}from"./index-DG5CfYat.js";import{_ as E,c as D,f as O,g as ee,i as k,l as A,m as j,n as M,o as N,p as te,r as P,t as F}from"./tunnel-api-BiBGK7O2.js";import{t as I}from"./browser-BLJWD7WI.js";import{n as L,r as R,t as z}from"./oauth-authorization-window-Cdolr2wE.js";var B=e(n(),1),V=r(),H=e(I(),1),U={width:216,margin:4,errorCorrectionLevel:`M`,color:{dark:`#000000ff`,light:`#ffffffff`}};async function ne(e){let t=await H.toString(e,{...U,type:`svg`});return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}var W=i();function re(){let e=p(m(e=>e.language)),t=e.endpointToolsSettings.mobileAccess.flow,n=e.tunnelSettings,{data:r,error:i,mutate:a}=g(`tunnel-status`,F,{refreshInterval:1500}),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(!0),[f,h]=(0,B.useState)(`idle`),[y,b]=(0,B.useState)(!1),[w,T]=(0,B.useState)(``),E=(0,B.useRef)(!0);(0,B.useEffect)(()=>(E.current=!0,()=>{E.current=!1}),[]);let D=async()=>{if(!r)return;if(r.consentRequired&&!o){l(!0);return}let e=r.registrationSecret?.configured?null:R(),t,n=!1;b(!1);try{if(r.consentRequired&&await k(),!r.registrationSecret?.configured){h(`authorizing`);let r=sessionStorage.getItem(`mobile-pairing-oauth`),i=r?JSON.parse(r):null;t=i&&i.expiresAt>Date.now()?i.sessionId:(await x(`xopc-tunnel`)).sessionId,sessionStorage.setItem(`mobile-pairing-oauth`,JSON.stringify({sessionId:t,expiresAt:i&&i.expiresAt>Date.now()?i.expiresAt:Date.now()+5*6e4}));let a=``,o=Date.now()+5*6e4,s=!1;for(;E.current&&Date.now()<o;){let r=await C(t);if(r.authUrl&&r.authUrl!==a&&(a=r.authUrl,await L(a,e)||T(a)),r.status===`completed`){s=!0,n=!0;break}if(r.status===`failed`||r.status===`cancelled`)throw Error(`Authorization cancelled`);await new Promise(e=>setTimeout(e,1e3))}if(!E.current)return;if(!s)throw Error(`Authorization expired`);await P()}if(!E.current)return;h(`starting`),await N(),u&&await M({autoStart:!0}),await a(),n=!0}catch{n=!0,E.current&&b(!0)}finally{z(e),n&&(sessionStorage.removeItem(`mobile-pairing-oauth`),t&&S(t).catch(()=>{})),E.current&&(h(`idle`),T(``))}};if(!r&&!i)return(0,W.jsxs)(`div`,{className:`space-y-5`,children:[(0,W.jsx)(v,{className:`h-5 w-4/5`}),(0,W.jsx)(v,{className:`h-24 w-full`})]});let O=f===`starting`||r?.state===`connecting`||r?.state===`reconnecting`;return(0,W.jsxs)(`div`,{className:`flex min-h-full flex-col`,children:[(0,W.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:O?t.preparingHint:f===`authorizing`?t.authorizing:t.enableHint}),w&&f===`authorizing`?(0,W.jsx)(`a`,{href:w,target:`_blank`,rel:`noopener noreferrer`,className:`mt-4 inline-flex min-h-11 items-center text-sm text-accent`,children:t.openAuthorization}):null,O?(0,W.jsxs)(`div`,{className:`mt-8 space-y-3`,"aria-label":t.preparing,children:[(0,W.jsx)(v,{className:`h-2 w-full`}),(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.preparing})]}):null,(c||r?.consentRequired)&&f===`idle`?(0,W.jsxs)(`div`,{className:`mt-6 space-y-4`,children:[(0,W.jsxs)(`details`,{open:c,className:`text-sm text-fg-muted`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t.details}),(0,W.jsx)(`p`,{className:`mt-2`,children:n.consentIntro}),(0,W.jsx)(`ul`,{className:`mt-3 list-disc space-y-2 pl-5`,children:[n.consentBullet1,n.consentBullet2,n.consentBullet3].map(e=>(0,W.jsx)(`li`,{children:e},e))})]}),(0,W.jsxs)(`label`,{className:`flex items-start gap-3 text-sm text-fg`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked),className:`mt-1 size-4 accent-accent`}),n.consentCheckbox]})]}):null,y||i||r?.state===`error`?(0,W.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:t.failed}):null,(0,W.jsx)(`div`,{className:`flex-1`}),(0,W.jsxs)(`label`,{className:`my-5 flex items-center gap-3 text-sm text-fg-muted`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:u,disabled:f!==`idle`,onChange:e=>d(e.target.checked),className:`size-4 accent-accent`}),t.autoStart]}),(0,W.jsx)(_,{className:`w-full`,variant:`primary`,disabled:!r||f!==`idle`||O||c&&!o,onClick:()=>void D(),children:f===`authorizing`?t.authorizing:O?t.preparing:y?t.retry:t.enable}),i&&!r?(0,W.jsx)(_,{variant:`ghost`,onClick:()=>void a(),children:t.retry}):null]})}var G=t({MobilePairingWizard:()=>K});function K(e){let t=(0,V.c)(8),{open:n,onOpenChange:r,onPaired:i}=e,a;t[0]!==r||t[1]!==i||t[2]!==n?(a=n?(0,W.jsx)(q,{onClose:()=>r(!1),onPaired:i}):null,t[0]=r,t[1]=i,t[2]=n,t[3]=a):a=t[3];let o;return t[4]!==r||t[5]!==n||t[6]!==a?(o=(0,W.jsx)(u,{open:n,onOpenChange:r,children:a}),t[4]=r,t[5]=n,t[6]=a,t[7]=o):o=t[7],o}function q({onClose:e,onPaired:t}){let n=p(m(e=>e.language)),r=n.endpointToolsSettings.mobileAccess,i=r.flow,u=g(`mobile-pairing-readiness`,ee,{refreshInterval:1500}),[x,S]=(0,B.useState)(),[C,k]=(0,B.useState)(!1),[M,N]=(0,B.useState)(!1),[P,F]=(0,B.useState)(Date.now()),[I,L]=(0,B.useState)(null),R=(0,B.useRef)(!0),z=(0,B.useRef)(null),V=(0,B.useRef)(!1),H=(0,B.useRef)(!1),U=g(x?[`mobile-pairing-setup`,x.id]:null,()=>E(x.id),{refreshInterval:1500}),G=U.data?.request,K=G?.status===`completed`,q=g(K&&window.electronAPI?.system?`system-behavior`:null,()=>window.electronAPI.system.getBehavior()),J=T(()=>ne(x?.universalLink??``),[x?.universalLink],{enabled:!!x,initial:null,errorData:null});(0,B.useEffect)(()=>{R.current=!0;let e=setInterval(()=>F(Date.now()),1e3);return()=>{R.current=!1,clearInterval(e),z.current&&O(z.current).catch(()=>{})}},[]);let Y=(0,B.useCallback)(async()=>{if(!V.current){V.current=!0,N(!0),k(!1);try{z.current&&await O(z.current),z.current=null,S(void 0);let e=await te();if(e.kind===`ready`){if(!R.current){await O(e.setup.id);return}z.current=e.setup.id,S(e.setup)}else await u.mutate()}catch{R.current&&k(!0)}finally{V.current=!1,R.current&&N(!1)}}},[u]);(0,B.useEffect)(()=>{u.data?.ready&&u.data.protocolVersions?.includes(3)&&!x&&!C&&!V.current&&Y()},[u.data,x,C,Y]),(0,B.useEffect)(()=>{K&&!H.current&&(H.current=!0,t?.())},[K,t]);let X=async e=>{if(G){N(!0),k(!1);try{await j(G,e),await U.mutate()}catch{k(!0),await U.mutate()}finally{R.current&&N(!1)}}},Z=(0,B.useRef)(0);(0,B.useEffect)(()=>{U.data&&(Z.current=U.data.serverTime-Date.now())},[U.data]);let Q=P+Z.current,$=x&&Q>=x.expiresAt&&!G,ie=G&&[`expired`,`rejected`,`cancelled`].includes(G.status),ae=u.data&&!u.data.protocolVersions?.includes(3),oe=K?i.success:G?.status===`pending`?i.allowTitle:G?.status===`approved`?i.waiting:x?i.scan:i.title;return(0,W.jsxs)(s,{children:[(0,W.jsx)(a,{className:h(`fixed inset-0 bg-scrim backdrop-blur-[1px]`,b)}),(0,W.jsxs)(c,{className:h(`fixed left-1/2 top-1/2 flex h-[min(600px,calc(100dvh-48px))] w-[min(560px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover`,y),children:[(0,W.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-6 py-3`,children:[(0,W.jsx)(`span`,{className:`text-lg font-semibold tracking-tight text-fg`,children:`xopc`}),(0,W.jsx)(`button`,{type:`button`,className:`flex size-10 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":i.cancel,onClick:e,children:(0,W.jsx)(f,{className:`size-4`})})]}),(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-8 py-7`,children:[K?(0,W.jsx)(d,{className:`mb-5 size-7 text-success`}):null,(0,W.jsx)(l,{className:`text-xl font-semibold tracking-tight text-fg`,children:oe}),(0,W.jsx)(o,{className:`mt-2 text-sm leading-relaxed text-fg-muted`,children:K?i.successHint:G?G.displayName:x?i.scanHint:i.intro}),C||u.error||U.error||J.error?(0,W.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:i.failed}):null,ae?(0,W.jsx)(`p`,{className:`mt-8 text-sm text-fg-muted`,children:i.update}):u.data?K?(0,W.jsxs)(W.Fragment,{children:[q.data?(0,W.jsxs)(`label`,{className:`mt-8 flex items-center justify-between gap-4 border-y border-edge-subtle py-5 text-sm text-fg`,children:[i.background,(0,W.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":q.data.runInBackground??!1,disabled:!q.data.backgroundSupported,checked:q.data.runInBackground??!1,className:`size-5 accent-accent`,onChange:e=>{window.electronAPI.system.setBehavior({runInBackground:e.target.checked}).then(e=>q.mutate(e.behavior)).catch(()=>k(!0))}})]}):null,(0,W.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:i.sleep})]}):ie||$?(0,W.jsxs)(`div`,{className:`mt-10 space-y-5`,children:[(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:$||G?.status===`expired`?i.expired:i.declined}),(0,W.jsx)(_,{variant:`primary`,onClick:()=>void Y(),disabled:M,children:i.refresh})]}):G?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:i.scope}),(0,W.jsxs)(`p`,{className:`mt-10 font-mono text-4xl tracking-[0.16em] text-fg`,"aria-live":`polite`,children:[G.confirmationCode.slice(0,3),` `,G.confirmationCode.slice(3)]}),(0,W.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:i.compare}),(0,W.jsxs)(`details`,{className:`mt-6 text-xs text-fg-muted`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer py-2`,children:i.access}),(0,W.jsx)(`p`,{children:i.accessHint})]})]}):x?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`my-6 flex justify-center`,children:J.data?(0,W.jsx)(`img`,{src:J.data,alt:r.qrAlt,width:216,height:216,className:`size-[216px] max-w-full rounded-lg bg-white`}):(0,W.jsx)(v,{className:`size-[216px]`})}),(0,W.jsx)(`p`,{className:`text-center text-xs text-fg-muted`,children:x.expiresAt-Q<6e4?`${Math.max(0,Math.ceil((x.expiresAt-Q)/1e3))}s`:i.valid}),(0,W.jsxs)(`details`,{className:`mt-5 text-xs text-fg-muted`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer py-2`,children:i.fallback}),(0,W.jsx)(w,{text:x.universalLink,labels:{copy:r.copy,copied:r.copied,copyFailed:n.clipboard.copyFailed}})]})]}):u.data.ready?(0,W.jsx)(`div`,{className:`mt-8`,children:(0,W.jsx)(v,{className:`mx-auto size-[216px]`})}):(0,W.jsxs)(`div`,{className:`mt-6 flex flex-1 flex-col`,children:[I===`tailscale`?(0,W.jsx)(A,{embedded:!0}):I===`https`?(0,W.jsx)(D,{}):I===`choices`?(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(_,{variant:`secondary`,className:`w-full`,onClick:()=>L(`tailscale`),children:r.useTailscale}),(0,W.jsx)(_,{variant:`secondary`,className:`w-full`,onClick:()=>L(`https`),children:r.useOwnHttps})]}):(0,W.jsx)(re,{}),(0,W.jsx)(_,{variant:`ghost`,className:`mt-3 w-full`,onClick:()=>L(I?null:`choices`),children:I?i.back:i.existing})]}):(0,W.jsxs)(`div`,{className:`mt-8 space-y-4`,children:[(0,W.jsx)(v,{className:`h-5 w-3/4`}),(0,W.jsx)(v,{className:`h-40 w-full`})]})]}),K||G?.status===`pending`||C?(0,W.jsx)(`footer`,{className:`shrink-0 px-8 pb-6`,children:K?(0,W.jsx)(_,{className:`w-full`,variant:`primary`,onClick:e,children:i.done}):G?.status===`pending`?(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsx)(_,{className:`w-full`,variant:`primary`,disabled:M,onClick:()=>void X(`approve`),children:i.allow}),(0,W.jsx)(_,{className:`w-full`,variant:`ghost`,disabled:M,onClick:()=>void X(`reject`),children:i.cancel})]}):(0,W.jsx)(_,{className:`w-full`,variant:`primary`,disabled:M,onClick:()=>void Y(),children:i.retry})}):null]})]})}export{G as n,K as t};
1
+ import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{a,i as o,o as s,r as c,s as l,t as u}from"./dist-CpzYSoz7.js";import{t as d}from"./circle-check-C23XjkUj.js";import{t as f}from"./x-B_N4OPjy.js";import{t as p}from"./messages-BbdwoxVo.js";import{n as m}from"./locale-store-CBoCuIMx.js";import{t as h}from"./cn-JdwAhgNB.js";import{i as g}from"./vendor-swr-BIWyz7Rc.js";import{t as _}from"./button-CtTvuElV.js";import{t as v}from"./skeleton-BwbyijEw.js";import{i as y,o as b}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{a as x,n as S,r as C}from"./oauth-api-BjSUDIgq.js";import{Hr as w,aa as T}from"./index-eZjksPvq.js";import{_ as E,c as D,f as O,g as ee,i as k,l as A,m as j,n as M,o as N,p as te,r as P,t as F}from"./tunnel-api-CVC8BHZu.js";import{t as I}from"./browser-BLJWD7WI.js";import{n as L,r as R,t as z}from"./oauth-authorization-window-Cdolr2wE.js";var B=e(n(),1),V=r(),H=e(I(),1),U={width:216,margin:4,errorCorrectionLevel:`M`,color:{dark:`#000000ff`,light:`#ffffffff`}};async function ne(e){let t=await H.toString(e,{...U,type:`svg`});return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}var W=i();function re(){let e=p(m(e=>e.language)),t=e.endpointToolsSettings.mobileAccess.flow,n=e.tunnelSettings,{data:r,error:i,mutate:a}=g(`tunnel-status`,F,{refreshInterval:1500}),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(!0),[f,h]=(0,B.useState)(`idle`),[y,b]=(0,B.useState)(!1),[w,T]=(0,B.useState)(``),E=(0,B.useRef)(!0);(0,B.useEffect)(()=>(E.current=!0,()=>{E.current=!1}),[]);let D=async()=>{if(!r)return;if(r.consentRequired&&!o){l(!0);return}let e=r.registrationSecret?.configured?null:R(),t,n=!1;b(!1);try{if(r.consentRequired&&await k(),!r.registrationSecret?.configured){h(`authorizing`);let r=sessionStorage.getItem(`mobile-pairing-oauth`),i=r?JSON.parse(r):null;t=i&&i.expiresAt>Date.now()?i.sessionId:(await x(`xopc-tunnel`)).sessionId,sessionStorage.setItem(`mobile-pairing-oauth`,JSON.stringify({sessionId:t,expiresAt:i&&i.expiresAt>Date.now()?i.expiresAt:Date.now()+5*6e4}));let a=``,o=Date.now()+5*6e4,s=!1;for(;E.current&&Date.now()<o;){let r=await C(t);if(r.authUrl&&r.authUrl!==a&&(a=r.authUrl,await L(a,e)||T(a)),r.status===`completed`){s=!0,n=!0;break}if(r.status===`failed`||r.status===`cancelled`)throw Error(`Authorization cancelled`);await new Promise(e=>setTimeout(e,1e3))}if(!E.current)return;if(!s)throw Error(`Authorization expired`);await P()}if(!E.current)return;h(`starting`),await N(),u&&await M({autoStart:!0}),await a(),n=!0}catch{n=!0,E.current&&b(!0)}finally{z(e),n&&(sessionStorage.removeItem(`mobile-pairing-oauth`),t&&S(t).catch(()=>{})),E.current&&(h(`idle`),T(``))}};if(!r&&!i)return(0,W.jsxs)(`div`,{className:`space-y-5`,children:[(0,W.jsx)(v,{className:`h-5 w-4/5`}),(0,W.jsx)(v,{className:`h-24 w-full`})]});let O=f===`starting`||r?.state===`connecting`||r?.state===`reconnecting`;return(0,W.jsxs)(`div`,{className:`flex min-h-full flex-col`,children:[(0,W.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:O?t.preparingHint:f===`authorizing`?t.authorizing:t.enableHint}),w&&f===`authorizing`?(0,W.jsx)(`a`,{href:w,target:`_blank`,rel:`noopener noreferrer`,className:`mt-4 inline-flex min-h-11 items-center text-sm text-accent`,children:t.openAuthorization}):null,O?(0,W.jsxs)(`div`,{className:`mt-8 space-y-3`,"aria-label":t.preparing,children:[(0,W.jsx)(v,{className:`h-2 w-full`}),(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.preparing})]}):null,(c||r?.consentRequired)&&f===`idle`?(0,W.jsxs)(`div`,{className:`mt-6 space-y-4`,children:[(0,W.jsxs)(`details`,{open:c,className:`text-sm text-fg-muted`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t.details}),(0,W.jsx)(`p`,{className:`mt-2`,children:n.consentIntro}),(0,W.jsx)(`ul`,{className:`mt-3 list-disc space-y-2 pl-5`,children:[n.consentBullet1,n.consentBullet2,n.consentBullet3].map(e=>(0,W.jsx)(`li`,{children:e},e))})]}),(0,W.jsxs)(`label`,{className:`flex items-start gap-3 text-sm text-fg`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked),className:`mt-1 size-4 accent-accent`}),n.consentCheckbox]})]}):null,y||i||r?.state===`error`?(0,W.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:t.failed}):null,(0,W.jsx)(`div`,{className:`flex-1`}),(0,W.jsxs)(`label`,{className:`my-5 flex items-center gap-3 text-sm text-fg-muted`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:u,disabled:f!==`idle`,onChange:e=>d(e.target.checked),className:`size-4 accent-accent`}),t.autoStart]}),(0,W.jsx)(_,{className:`w-full`,variant:`primary`,disabled:!r||f!==`idle`||O||c&&!o,onClick:()=>void D(),children:f===`authorizing`?t.authorizing:O?t.preparing:y?t.retry:t.enable}),i&&!r?(0,W.jsx)(_,{variant:`ghost`,onClick:()=>void a(),children:t.retry}):null]})}var G=t({MobilePairingWizard:()=>K});function K(e){let t=(0,V.c)(8),{open:n,onOpenChange:r,onPaired:i}=e,a;t[0]!==r||t[1]!==i||t[2]!==n?(a=n?(0,W.jsx)(q,{onClose:()=>r(!1),onPaired:i}):null,t[0]=r,t[1]=i,t[2]=n,t[3]=a):a=t[3];let o;return t[4]!==r||t[5]!==n||t[6]!==a?(o=(0,W.jsx)(u,{open:n,onOpenChange:r,children:a}),t[4]=r,t[5]=n,t[6]=a,t[7]=o):o=t[7],o}function q({onClose:e,onPaired:t}){let n=p(m(e=>e.language)),r=n.endpointToolsSettings.mobileAccess,i=r.flow,u=g(`mobile-pairing-readiness`,ee,{refreshInterval:1500}),[x,S]=(0,B.useState)(),[C,k]=(0,B.useState)(!1),[M,N]=(0,B.useState)(!1),[P,F]=(0,B.useState)(Date.now()),[I,L]=(0,B.useState)(null),R=(0,B.useRef)(!0),z=(0,B.useRef)(null),V=(0,B.useRef)(!1),H=(0,B.useRef)(!1),U=g(x?[`mobile-pairing-setup`,x.id]:null,()=>E(x.id),{refreshInterval:1500}),G=U.data?.request,K=G?.status===`completed`,q=g(K&&window.electronAPI?.system?`system-behavior`:null,()=>window.electronAPI.system.getBehavior()),J=T(()=>ne(x?.universalLink??``),[x?.universalLink],{enabled:!!x,initial:null,errorData:null});(0,B.useEffect)(()=>{R.current=!0;let e=setInterval(()=>F(Date.now()),1e3);return()=>{R.current=!1,clearInterval(e),z.current&&O(z.current).catch(()=>{})}},[]);let Y=(0,B.useCallback)(async()=>{if(!V.current){V.current=!0,N(!0),k(!1);try{z.current&&await O(z.current),z.current=null,S(void 0);let e=await te();if(e.kind===`ready`){if(!R.current){await O(e.setup.id);return}z.current=e.setup.id,S(e.setup)}else await u.mutate()}catch{R.current&&k(!0)}finally{V.current=!1,R.current&&N(!1)}}},[u]);(0,B.useEffect)(()=>{u.data?.ready&&u.data.protocolVersions?.includes(3)&&!x&&!C&&!V.current&&Y()},[u.data,x,C,Y]),(0,B.useEffect)(()=>{K&&!H.current&&(H.current=!0,t?.())},[K,t]);let X=async e=>{if(G){N(!0),k(!1);try{await j(G,e),await U.mutate()}catch{k(!0),await U.mutate()}finally{R.current&&N(!1)}}},Z=(0,B.useRef)(0);(0,B.useEffect)(()=>{U.data&&(Z.current=U.data.serverTime-Date.now())},[U.data]);let Q=P+Z.current,$=x&&Q>=x.expiresAt&&!G,ie=G&&[`expired`,`rejected`,`cancelled`].includes(G.status),ae=u.data&&!u.data.protocolVersions?.includes(3),oe=K?i.success:G?.status===`pending`?i.allowTitle:G?.status===`approved`?i.waiting:x?i.scan:i.title;return(0,W.jsxs)(s,{children:[(0,W.jsx)(a,{className:h(`fixed inset-0 bg-scrim backdrop-blur-[1px]`,b)}),(0,W.jsxs)(c,{className:h(`fixed left-1/2 top-1/2 flex h-[min(600px,calc(100dvh-48px))] w-[min(560px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover`,y),children:[(0,W.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-6 py-3`,children:[(0,W.jsx)(`span`,{className:`text-lg font-semibold tracking-tight text-fg`,children:`xopc`}),(0,W.jsx)(`button`,{type:`button`,className:`flex size-10 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":i.cancel,onClick:e,children:(0,W.jsx)(f,{className:`size-4`})})]}),(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-8 py-7`,children:[K?(0,W.jsx)(d,{className:`mb-5 size-7 text-success`}):null,(0,W.jsx)(l,{className:`text-xl font-semibold tracking-tight text-fg`,children:oe}),(0,W.jsx)(o,{className:`mt-2 text-sm leading-relaxed text-fg-muted`,children:K?i.successHint:G?G.displayName:x?i.scanHint:i.intro}),C||u.error||U.error||J.error?(0,W.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:i.failed}):null,ae?(0,W.jsx)(`p`,{className:`mt-8 text-sm text-fg-muted`,children:i.update}):u.data?K?(0,W.jsxs)(W.Fragment,{children:[q.data?(0,W.jsxs)(`label`,{className:`mt-8 flex items-center justify-between gap-4 border-y border-edge-subtle py-5 text-sm text-fg`,children:[i.background,(0,W.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":q.data.runInBackground??!1,disabled:!q.data.backgroundSupported,checked:q.data.runInBackground??!1,className:`size-5 accent-accent`,onChange:e=>{window.electronAPI.system.setBehavior({runInBackground:e.target.checked}).then(e=>q.mutate(e.behavior)).catch(()=>k(!0))}})]}):null,(0,W.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:i.sleep})]}):ie||$?(0,W.jsxs)(`div`,{className:`mt-10 space-y-5`,children:[(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:$||G?.status===`expired`?i.expired:i.declined}),(0,W.jsx)(_,{variant:`primary`,onClick:()=>void Y(),disabled:M,children:i.refresh})]}):G?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:i.scope}),(0,W.jsxs)(`p`,{className:`mt-10 font-mono text-4xl tracking-[0.16em] text-fg`,"aria-live":`polite`,children:[G.confirmationCode.slice(0,3),` `,G.confirmationCode.slice(3)]}),(0,W.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:i.compare}),(0,W.jsxs)(`details`,{className:`mt-6 text-xs text-fg-muted`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer py-2`,children:i.access}),(0,W.jsx)(`p`,{children:i.accessHint})]})]}):x?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`my-6 flex justify-center`,children:J.data?(0,W.jsx)(`img`,{src:J.data,alt:r.qrAlt,width:216,height:216,className:`size-[216px] max-w-full rounded-lg bg-white`}):(0,W.jsx)(v,{className:`size-[216px]`})}),(0,W.jsx)(`p`,{className:`text-center text-xs text-fg-muted`,children:x.expiresAt-Q<6e4?`${Math.max(0,Math.ceil((x.expiresAt-Q)/1e3))}s`:i.valid}),(0,W.jsxs)(`details`,{className:`mt-5 text-xs text-fg-muted`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer py-2`,children:i.fallback}),(0,W.jsx)(w,{text:x.universalLink,labels:{copy:r.copy,copied:r.copied,copyFailed:n.clipboard.copyFailed}})]})]}):u.data.ready?(0,W.jsx)(`div`,{className:`mt-8`,children:(0,W.jsx)(v,{className:`mx-auto size-[216px]`})}):(0,W.jsxs)(`div`,{className:`mt-6 flex flex-1 flex-col`,children:[I===`tailscale`?(0,W.jsx)(A,{embedded:!0}):I===`https`?(0,W.jsx)(D,{}):I===`choices`?(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(_,{variant:`secondary`,className:`w-full`,onClick:()=>L(`tailscale`),children:r.useTailscale}),(0,W.jsx)(_,{variant:`secondary`,className:`w-full`,onClick:()=>L(`https`),children:r.useOwnHttps})]}):(0,W.jsx)(re,{}),(0,W.jsx)(_,{variant:`ghost`,className:`mt-3 w-full`,onClick:()=>L(I?null:`choices`),children:I?i.back:i.existing})]}):(0,W.jsxs)(`div`,{className:`mt-8 space-y-4`,children:[(0,W.jsx)(v,{className:`h-5 w-3/4`}),(0,W.jsx)(v,{className:`h-40 w-full`})]})]}),K||G?.status===`pending`||C?(0,W.jsx)(`footer`,{className:`shrink-0 px-8 pb-6`,children:K?(0,W.jsx)(_,{className:`w-full`,variant:`primary`,onClick:e,children:i.done}):G?.status===`pending`?(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsx)(_,{className:`w-full`,variant:`primary`,disabled:M,onClick:()=>void X(`approve`),children:i.allow}),(0,W.jsx)(_,{className:`w-full`,variant:`ghost`,disabled:M,onClick:()=>void X(`reject`),children:i.cancel})]}):(0,W.jsx)(_,{className:`w-full`,variant:`primary`,disabled:M,onClick:()=>void Y(),children:i.retry})}):null]})]})}export{G as n,K as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{d as n}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as r}from"./notes-workbench-IYfpy2Jx.js";var i=e(),a=t();function o(){let e=(0,i.c)(2),{noteId:t}=n(),o;return e[0]===t?o=e[1]:(o=(0,a.jsx)(r,{selectedNoteId:t,basePath:`/notes`,managePageHeader:!0,showLibrary:!0,allowMediaCapture:!0,listWidthStorageKey:`xopc.notes.listWidth`}),e[0]=t,e[1]=o),o}export{o as NotesPage};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{d as n}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as r}from"./notes-workbench-CI30cDh3.js";var i=e(),a=t();function o(){let e=(0,i.c)(2),{noteId:t}=n(),o;return e[0]===t?o=e[1]:(o=(0,a.jsx)(r,{selectedNoteId:t,basePath:`/notes`,managePageHeader:!0,showLibrary:!0,allowMediaCapture:!0,listWidthStorageKey:`xopc.notes.listWidth`}),e[0]=t,e[1]=o),o}export{o as NotesPage};
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-DutTIH81.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-DG5CfYat.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-BvLh9GaE.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-DBS3OB8K.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-BXsHghJd.js","assets/dist-CpzYSoz7.js","assets/chunk-KS7C4IRE-BaASWQor.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/locale-store-CBoCuIMx.js","assets/messages-BbdwoxVo.js","assets/cn-JdwAhgNB.js","assets/product-delivery-CV4pDOtG.js","assets/schemas-BHS7bo06.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-Y68dCxuc.css","assets/dist-DLmwHyAh.js","assets/vendor-swr-BIWyz7Rc.js","assets/check-DUBLcKHA.js","assets/popover-select-C-Hj-nXR.js","assets/skeleton-BwbyijEw.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/settings-shell-layer-context-DCp6ykjQ.js","assets/circle-check-C23XjkUj.js","assets/cloud-C4-yfnnk.js","assets/copy-Dv6d4Dvw.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/eye-off-DEAzt3g1.js","assets/eye-CABVeTq0.js","assets/folder-open-CyzJ19I9.js","assets/globe-DSSGFWFn.js","assets/link-2-D_ZKYUW7.js","assets/loader-circle-CifKLtgG.js","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/pencil-DmIY3Oa-.js","assets/rotate-cw-LIg3Am9S.js","assets/search-DA7gz22f.js","assets/middleware-Pd0e8Igk.js","assets/files-D6vf3S30.js","assets/tool-activity-R8V9l6nk.js","assets/button-CtTvuElV.js","assets/registry-api-BhGKnvLP.js","assets/gateway-startup-retry-DyvcAIMm.js","assets/config-reload-event-Bjh2zoKp.js","assets/gateway-config-swr-826dipyU.js","assets/models-hub-cache-88f4fzYS.js","assets/oauth-api-BjSUDIgq.js","assets/electron-env-DH5wF8X8.js","assets/form-field-width-DJw_jULe.js","assets/interaction-BmQogeqz.js","assets/is-masked-secret-DOkL5b_X.js","assets/activity-store-BlxqErph.js","assets/theme-store-hybK3oC9.js","assets/index-Dbh5SXyV.css","assets/vendor-codemirror--gTq3YAI.js","assets/with-selector-aYPsXwdl.js","assets/block-editor-D4ZIVQbk.css","assets/markdown-editor-nDLmA_LF.js","assets/code-editor-D4_k-6QN.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{l as a}from"./chunk-KS7C4IRE-BaASWQor.js";import{a as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./dist-CpzYSoz7.js";import{t as p}from"./check-DUBLcKHA.js";import{n as m,r as h}from"./popover-select-C-Hj-nXR.js";import{t as g}from"./circle-check-C23XjkUj.js";import{t as _}from"./copy-Dv6d4Dvw.js";import{t as v}from"./external-link-DjqjBmc3.js";import{t as y}from"./eye-CABVeTq0.js";import{t as b}from"./loader-circle-CifKLtgG.js";import{t as x}from"./pencil-DmIY3Oa-.js";import{t as S}from"./plus-Q2yW6OE7.js";import{t as C}from"./search-DA7gz22f.js";import{t as w}from"./x-B_N4OPjy.js";import{t as T}from"./copy-to-clipboard-HOJ79TWv.js";import{t as E}from"./messages-BbdwoxVo.js";import{d as D,n as O,s as k}from"./locale-store-CBoCuIMx.js";import{t as A}from"./cn-JdwAhgNB.js";import{i as j}from"./vendor-swr-BIWyz7Rc.js";import{t as M}from"./button-CtTvuElV.js";import{i as N}from"./theme-store-hybK3oC9.js";import{t as P}from"./skeleton-BwbyijEw.js";import{Bn as F,Bs as I,Cn as L,Dn as R,Ds as z,En as B,Es as V,Fc as H,Fn as U,Gc as W,In as ee,Ir as te,Is as ne,Ji as re,Kl as G,Li as ie,Ln as ae,Mn as oe,Ns as K,On as q,Os as se,Rn as ce,Rr as le,Sn as ue,Tn as de,Ts as fe,Vn as pe,Yc as me,Zl as he,Zs as J,_n as Y,a as ge,an as _e,bn as ve,c as ye,cc as be,cn as xe,dc as Se,dn as Ce,ec as we,eu as X,fl as Te,fn as Ee,gn as De,hc as Oe,hn as ke,in as Ae,jn as je,kn as Me,kt as Ne,l as Pe,ll as Fe,ln as Ie,mn as Le,no as Re,nu as ze,o as Be,oa as Ve,on as He,pc as Ue,pn as We,qc as Ge,qs as Ke,s as qe,sn as Je,tu as Ye,uc as Xe,un as Ze,vn as Qe,wc as $e,wn as et,xc as tt,xn as nt,yl as rt,yn as it,zn as at,zs as ot}from"./index-DG5CfYat.js";var Z=n(),Q=e(t(),1),$=r(),st=(0,Q.createContext)(null);function ct(){let e=(0,Z.c)(1),t=(0,Q.useContext)(st);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:lt},e[0]=t):t=e[0],t}return t}function lt(){}function ut(e){let t=(0,Z.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,s]=(0,Q.useState)(null),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(e,t)=>{s({src:e,alt:t})},t[0]=p):p=t[0];let m=p,h;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h={openImage:m},t[1]=h):h=t[1];let g=h,_=a!==null,v;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{e||s(null)},t[2]=v):v=t[2];let y;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(o,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=y):y=t[3];let b;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(b=A(`fixed inset-0 z-[71] flex items-center justify-center p-4 outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out`),t[4]=b):b=t[4];let x=a?.alt||`Image preview`,S;t[5]===x?S=t[6]:(S=(0,$.jsx)(d,{className:`sr-only`,children:x}),t[5]=x,t[6]=S);let C;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(w,{className:`size-5`,"aria-hidden":!0}),t[7]=C):C=t[7];let T;t[8]===i?T=t[9]:(T=(0,$.jsx)(c,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":i,className:`absolute right-4 top-4 z-10 rounded-lg bg-surface-panel/80 p-2 text-fg-muted backdrop-blur transition-colors hover:bg-surface-hover hover:text-fg`,children:C})}),t[8]=i,t[9]=T);let E;t[10]===a?E=t[11]:(E=a?(0,$.jsx)(`img`,{src:a.src,alt:a.alt??``,className:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`}):null,t[10]=a,t[11]=E);let D;t[12]!==T||t[13]!==E||t[14]!==S?(D=(0,$.jsxs)(l,{children:[y,(0,$.jsxs)(u,{className:b,"aria-describedby":void 0,children:[S,T,E]})]}),t[12]=T,t[13]=E,t[14]=S,t[15]=D):D=t[15];let O;t[16]!==D||t[17]!==_?(O=(0,$.jsx)(f,{open:_,onOpenChange:v,children:D}),t[16]=D,t[17]=_,t[18]=O):O=t[18];let k;return t[19]!==n||t[20]!==O?(k=(0,$.jsxs)(st.Provider,{value:g,children:[n,O]}),t[19]=n,t[20]=O,t[21]=k):k=t[21],k}function dt(e){let t=(0,Z.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,Q.useState)(!1),s;t[0]!==r||t[1]!==n?(s=pe(n,r),t[0]=r,t[1]=n,t[2]=s):s=t[2];let c=s;if(a){let e;t[3]===i?e=t[4]:(e=A(`flex size-12 shrink-0 items-center justify-center rounded-lg border border-edge-subtle bg-surface-hover text-fg-muted`,i),t[3]=i,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(Ge,{className:`size-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,$.jsx)(`div`,{className:e,"aria-hidden":!0,children:n}),t[6]=e,t[7]=r),r}let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>o(!0),t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=A(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=u);let d;return t[11]!==n||t[12]!==c||t[13]!==u?(d=(0,$.jsx)(oe,{src:c,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:l,className:u}),t[11]=n,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}var ft=6e4,pt=36e5,mt=864e5;function ht(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function gt(e,t,n){let r=t-e;if(r<ft)return n.justNow;if(r<pt){let e=Math.floor(r/ft);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=ht(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(e>=i-mt)return n.yesterday+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(r<7*mt){let e=Math.floor(r/mt);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(n.locale,{month:`short`,day:`numeric`})}function _t(e,t,n){let r=ht(t);if(e>=r)return n.today;if(e>=r-mt)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(n.locale,{month:`long`,day:`numeric`}):i.toLocaleDateString(n.locale,{year:`numeric`,month:`long`,day:`numeric`})}function vt(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function yt(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,`0`)}`}function bt(e){let t=(0,Z.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=ce(),f=ce(St),p=u===n&&d===r,m=p&&o,h=p&&s,g=p?c:0,_=p&&l>0?l:i??0,v=_>0?Math.min(g/_*100,100):0,y;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==f?(y=e=>{e.stopPropagation(),f(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=f,t[4]=y):y=t[4];let x=y,S;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==f?(S=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),f(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=f,t[9]=S):S=t[9];let C=S,w;t[10]===a?w=t[11]:(w=A(`flex items-center gap-2`,a),t[10]=a,t[11]=w);let T=m?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,E;t[12]===T?E=t[13]:(E=A(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,T),t[12]=T,t[13]=E);let D=m?`Pause`:`Play`,O;t[14]!==h||t[15]!==m?(O=h?(0,$.jsx)(b,{className:`size-3.5 animate-spin`}):m?(0,$.jsx)(Ue,{className:`size-3.5`}):(0,$.jsx)(be,{className:`size-3.5 ml-0.5`}),t[14]=h,t[15]=m,t[16]=O):O=t[16];let k;t[17]!==x||t[18]!==C||t[19]!==E||t[20]!==D||t[21]!==O?(k=(0,$.jsx)(`button`,{type:`button`,onClick:x,onKeyDown:C,className:E,"aria-label":D,children:O}),t[17]=x,t[18]=C,t[19]=E,t[20]=D,t[21]=O,t[22]=k):k=t[22];let j=`${v}%`,M;t[23]===j?M=t[24]:(M=(0,$.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,$.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-200 ease-linear`,style:{width:j}})}),t[23]=j,t[24]=M);let N;t[25]!==_||t[26]!==p||t[27]!==g?(N=yt(p&&g>0?g:_),t[25]=_,t[26]=p,t[27]=g,t[28]=N):N=t[28];let P;t[29]===N?P=t[30]:(P=(0,$.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:N}),t[29]=N,t[30]=P);let F;t[31]!==M||t[32]!==P?(F=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[M,P]}),t[31]=M,t[32]=P,t[33]=F):F=t[33];let I;return t[34]!==F||t[35]!==w||t[36]!==k?(I=(0,$.jsxs)(`div`,{className:w,onClick:xt,children:[k,F]}),t[34]=F,t[35]=w,t[36]=k,t[37]=I):I=t[37],I}function xt(e){return e.stopPropagation()}function St(e){return e.toggle}function Ct(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function wt(e){let t=(0,Z.c)(88),{note:n,selected:r,onPress:i,onPin:a,onArchive:o,onDelete:s,labels:c,timeLabels:l}=e,u=r===void 0?!1:r,d;t[0]!==c||t[1]!==n?(d=Ct(n,c),t[0]=c,t[1]=n,t[2]=d):d=t[2];let f=d,p=!n.snippet?.trim(),[m]=(0,Q.useState)(jt),h;t[3]!==n.createdAt||t[4]!==m||t[5]!==l?(h=gt(n.createdAt,m,l),t[3]=n.createdAt,t[4]=m,t[5]=l,t[6]=h):h=t[6];let g=h,_,v;t[7]!==n.id||t[8]!==i?(_=()=>i(n.id),v=e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),i(n.id))},t[7]=n.id,t[8]=i,t[9]=_,t[10]=v):(_=t[9],v=t[10]);let y=u?`bg-surface-active hover:bg-surface-active`:`bg-transparent hover:bg-surface-panel/70`,b;t[11]===y?b=t[12]:(b=A(`group relative flex cursor-pointer flex-col gap-2 overflow-hidden rounded-lg px-3 py-2.5`,`transition-colors duration-150 ease-out`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-rail`,y),t[11]=y,t[12]=b);let x=u?`true`:void 0,S;t[13]===u?S=t[14]:(S=u?(0,$.jsx)(`span`,{className:`pointer-events-none absolute inset-y-2 left-0 w-0.5 rounded-r-pill bg-accent`,"aria-hidden":!0}):null,t[13]=u,t[14]=S);let C;t[15]!==n.coverAttachmentId||t[16]!==n.id||t[17]!==n.kind||t[18]!==n.voiceAttachmentId||t[19]!==n.voiceDurationSec?(C=n.coverAttachmentId?(0,$.jsx)(dt,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(bt,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-28 shrink-0`}):null,t[15]=n.coverAttachmentId,t[16]=n.id,t[17]=n.kind,t[18]=n.voiceAttachmentId,t[19]=n.voiceDurationSec,t[20]=C):C=t[20];let w;t[21]===n.title?w=t[22]:(w=n.title&&(0,$.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[21]=n.title,t[22]=w);let T=n.title?`text-fg-muted`:p?`italic text-fg-muted`:`text-fg`,E;t[23]===T?E=t[24]:(E=A(`truncate text-sm leading-5`,T),t[23]=T,t[24]=E);let D;t[25]!==f||t[26]!==E?(D=(0,$.jsx)(`p`,{className:E,children:f}),t[25]=f,t[26]=E,t[27]=D):D=t[27];let O;t[28]!==w||t[29]!==D?(O=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[w,D]}),t[28]=w,t[29]=D,t[30]=O):O=t[30];let k;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(Te,{className:`size-4`}),t[31]=k):k=t[31];let j;t[32]===c.actions?j=t[33]:(j=(0,$.jsx)(Ie,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:At,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-100 transition-opacity hover:bg-surface-panel focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:opacity-0 lg:group-hover:opacity-100 lg:focus-visible:opacity-100`,"aria-label":c.actions,title:c.actions,children:k})}),t[32]=c.actions,t[33]=j);let M;t[34]!==n.id||t[35]!==n.pinned||t[36]!==a?(M=()=>{a(n.id,!n.pinned).catch(Ot)},t[34]=n.id,t[35]=n.pinned,t[36]=a,t[37]=M):M=t[37];let N;t[38]===n.pinned?N=t[39]:(N=n.pinned?(0,$.jsx)(Xe,{className:`size-4`}):(0,$.jsx)(Se,{className:`size-4`}),t[38]=n.pinned,t[39]=N);let P=n.pinned?c.unpin:c.pin,F;t[40]!==M||t[41]!==N||t[42]!==P?(F=(0,$.jsxs)(_e,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:M,children:[N,P]}),t[40]=M,t[41]=N,t[42]=P,t[43]=F):F=t[43];let I;t[44]!==n.id||t[45]!==o?(I=()=>{o(n.id).catch(Dt)},t[44]=n.id,t[45]=o,t[46]=I):I=t[46];let L;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(ze,{className:`size-4`}),t[47]=L):L=t[47];let R;t[48]!==c.archive||t[49]!==I?(R=(0,$.jsxs)(_e,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:I,children:[L,c.archive]}),t[48]=c.archive,t[49]=I,t[50]=R):R=t[50];let z;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(xe,{className:`my-1 h-px bg-edge-subtle`}),t[51]=z):z=t[51];let B;t[52]!==n.id||t[53]!==s?(B=()=>{s(n.id).catch(Et)},t[52]=n.id,t[53]=s,t[54]=B):B=t[54];let H;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(V,{className:`size-4`}),t[55]=H):H=t[55];let U;t[56]!==c.delete||t[57]!==B?(U=(0,$.jsxs)(_e,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-500 outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:B,children:[H,c.delete]}),t[56]=c.delete,t[57]=B,t[58]=U):U=t[58];let W;t[59]!==F||t[60]!==R||t[61]!==U?(W=(0,$.jsx)(He,{children:(0,$.jsxs)(Ae,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:kt,children:[F,R,z,U]})}),t[59]=F,t[60]=R,t[61]=U,t[62]=W):W=t[62];let ee;t[63]!==j||t[64]!==W?(ee=(0,$.jsxs)(Je,{children:[j,W]}),t[63]=j,t[64]=W,t[65]=ee):ee=t[65];let te;t[66]!==C||t[67]!==O||t[68]!==ee?(te=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[C,O,ee]}),t[66]=C,t[67]=O,t[68]=ee,t[69]=te):te=t[69];let ne;t[70]===n.pinned?ne=t[71]:(ne=n.pinned&&(0,$.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 text-xs font-medium text-accent`,children:(0,$.jsx)(Se,{className:`size-3`})}),t[70]=n.pinned,t[71]=ne);let re;t[72]===n.tags?re=t[73]:(re=n.tags?.slice(0,2).map(Tt),t[72]=n.tags,t[73]=re);let G;t[74]===g?G=t[75]:(G=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:g}),t[74]=g,t[75]=G);let ie;t[76]!==ne||t[77]!==re||t[78]!==G?(ie=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[ne,re,G]}),t[76]=ne,t[77]=re,t[78]=G,t[79]=ie):ie=t[79];let ae;return t[80]!==te||t[81]!==ie||t[82]!==_||t[83]!==v||t[84]!==b||t[85]!==x||t[86]!==S?(ae=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:_,onKeyDown:v,className:b,"aria-current":x,children:[S,te,ie]}),t[80]=te,t[81]=ie,t[82]=_,t[83]=v,t[84]=b,t[85]=x,t[86]=S,t[87]=ae):ae=t[87],ae}function Tt(e){return(0,$.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e)}function Et(){}function Dt(){}function Ot(){}function kt(e){return e.stopPropagation()}function At(e){return e.stopPropagation()}function jt(){return Date.now()}function Mt(e){let t=(0,Z.c)(45),{title:n,description:r,prompt:i,coverage:o,className:s,variant:c}=e,l=c===void 0?`card`:c,u=O(Ft),d=E(u).automations.suggestions,f=E(u).automations,p=a(),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=m):m=t[0];let{data:h}=j(o?`automation-suggestion-coverage`:null,Pt,m),_=o?h?.automations.find(e=>ye(e,o)):void 0,v=_?Be(_,f):[];if(l===`titleAction`){if(_){let e;t[1]===s?e=t[2]:(e=A(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,s),t[1]=s,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(g,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let r;return t[4]===p?r=t[5]:(r=()=>p(`/automations`),t[4]=p,t[5]=r),(0,$.jsxs)(`section`,{className:e,children:[n,(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:d.coveredTitle}),(0,$.jsx)(M,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:d.manage})]})}let e;t[6]===s?e=t[7]:(e=A(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,s),t[6]=s,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(H,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=a):a=t[8];let o;t[9]!==r||t[10]!==n?(o=(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:r,children:n}),t[9]=r,t[10]=n,t[11]=o):o=t[11];let c;t[12]!==p||t[13]!==i?(c=()=>{p(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[12]=p,t[13]=i,t[14]=c):c=t[14];let l;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(I,{className:`size-3.5`,"aria-hidden":!0}),t[15]=l):l=t[15],(0,$.jsxs)(`section`,{className:e,children:[a,o,(0,$.jsxs)(M,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[l,d.setup]})]})}if(_){let e;t[16]===s?e=t[17]:(e=A(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,s),t[16]=s,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(g,{className:`mt-0.5 size-4 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[18]=n):n=t[18];let r;t[19]===p?r=t[20]:(r=()=>p(`/automations`),t[19]=p,t[20]=r);let i;return t[21]!==d||t[22]!==r?(i=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsx)(M,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:d.manage})}),t[21]=d,t[22]=r,t[23]=i):i=t[23],(0,$.jsxs)(`section`,{className:e,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:d.coveredTitle}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:qe(d.coveredDescription,{name:_.name})})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:f.explain.whyCovered}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:v.map(Nt)})]}),i]})}let y;t[24]===s?y=t[25]:(y=A(`rounded-lg bg-surface-panel p-3 shadow-surface`,s),t[24]=s,t[25]=y);let b;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(H,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=b):b=t[26];let x;t[27]===n?x=t[28]:(x=(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=x);let S;t[29]===r?S=t[30]:(S=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=S);let C;t[31]!==x||t[32]!==S?(C=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[b,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S]})]}),t[31]=x,t[32]=S,t[33]=C):C=t[33];let w;t[34]!==p||t[35]!==i?(w=()=>{p(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[34]=p,t[35]=i,t[36]=w):w=t[36];let T;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(I,{className:`size-3.5`,"aria-hidden":!0}),t[37]=T):T=t[37];let D;t[38]!==d.create||t[39]!==w?(D=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsxs)(M,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:w,children:[T,d.create]})}),t[38]=d.create,t[39]=w,t[40]=D):D=t[40];let k;return t[41]!==D||t[42]!==y||t[43]!==C?(k=(0,$.jsxs)(`section`,{className:y,children:[C,D]}),t[41]=D,t[42]=y,t[43]=C,t[44]=k):k=t[44],k}function Nt(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function Pt(){return Pe.list()}function Ft(e){return e.language}function It(e){let t=(0,Z.c)(4),{values:n}=e;if(n.length===0)return null;let r;t[0]===n?r=t[1]:(r=n.map(Lt),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:r}),t[2]=r,t[3]=i),i}function Lt(e,t){return(0,$.jsx)(`li`,{children:e},`${t}:${e}`)}function Rt(e){let t=(0,Z.c)(10),{noteId:n,attachmentId:r,label:i,unavailableLabel:a}=e,[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(!1),u,d;if(t[0]!==r||t[1]!==n?(u=()=>{let e=!1,t=!1;return s(null),l(!1),at(n,r).then(i=>{if(e=!0,t){F(n,r);return}s(i)}).catch(()=>{t||l(!0)}),()=>{t=!0,e&&F(n,r)}},d=[r,n],t[0]=r,t[1]=n,t[2]=u,t[3]=d):(u=t[2],d=t[3]),(0,Q.useEffect)(u,d),c){let e;return t[4]===a?e=t[5]:(e=(0,$.jsx)(`p`,{className:`text-xs text-danger`,children:a}),t[4]=a,t[5]=e),e}if(!o){let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(P,{className:`h-10 w-full max-w-md`}),t[6]=e):e=t[6],e}let f;return t[7]!==i||t[8]!==o?(f=(0,$.jsx)(`audio`,{controls:!0,preload:`metadata`,src:o,className:`w-full max-w-md`,"aria-label":i}),t[7]=i,t[8]=o,t[9]=f):f=t[9],f}function zt(e){let t=(0,Z.c)(39),{noteId:n}=e,r=E(O(Ht)).notes.discussionCapture,i,a;t[0]===n?(i=t[1],a=t[2]):(i=[`note-discussion-document`,n],a=()=>Ne(n),t[0]=n,t[1]=i,t[2]=a);let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[3]=o):o=t[3];let{data:s,mutate:c}=j(i,a,o),l,u;if(t[4]===c?(l=t[5],u=t[6]):(l=()=>{let e=e=>{let t=e.detail;t&&c(e=>{if(!e||e.discussion.id!==t.discussionId)return e;let n=e.transcript.segments.filter(e=>e.sequence!==t.segment.sequence).concat(t.segment).sort(Vt);return{...e,discussion:{...e.discussion,transcriptRevision:t.transcriptRevision},transcript:{...e.transcript,revision:t.transcriptRevision,segments:n,text:t.text,stats:t.stats}}},{revalidate:!1})},t=()=>void c();return window.addEventListener(`discussion-segment-updated`,e),window.addEventListener(`discussion-updated`,t),()=>{window.removeEventListener(`discussion-segment-updated`,e),window.removeEventListener(`discussion-updated`,t)}},u=[c],t[4]=c,t[5]=l,t[6]=u),(0,Q.useEffect)(l,u),!s)return null;let{discussion:d,transcript:f}=s,p=s.organization?.organization,m=[`stopping`,`sealing`,`organizing`].includes(d.status),h=f.stats.uploaded+f.stats.transcribing,_=f.stats.failed>0?r.failedSegments.replace(`{{count}}`,String(f.stats.failed)):h>0?r.processingSegments.replace(`{{count}}`,String(h)):m?r.finalizing:d.status===`completed`?r.transcriptReady:null,v;t[7]!==r.actionItems||t[8]!==r.decisions||t[9]!==r.openQuestions||t[10]!==r.organization||t[11]!==r.risks||t[12]!==p?(v=p?(0,$.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-5`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-accent-fg`,children:[(0,$.jsx)(I,{className:`size-4`,"aria-hidden":!0}),r.organization]}),(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:p.summary}),(0,$.jsxs)(`div`,{className:`mt-4 grid gap-4 text-sm leading-6 text-fg sm:grid-cols-2 xl:grid-cols-1`,children:[p.decisions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.decisions}),(0,$.jsx)(It,{values:p.decisions})]}):null,p.actionItems.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.actionItems}),(0,$.jsx)(It,{values:p.actionItems.map(Bt)})]}):null,p.risks.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.risks}),(0,$.jsx)(It,{values:p.risks})]}):null,p.openQuestions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.openQuestions}),(0,$.jsx)(It,{values:p.openQuestions})]}):null]})]}):null,t[7]=r.actionItems,t[8]=r.decisions,t[9]=r.openQuestions,t[10]=r.organization,t[11]=r.risks,t[12]=p,t[13]=v):v=t[13];let y;t[14]!==r.recordingAudio||t[15]!==r.recordingUnavailable||t[16]!==d.audioAttachmentId||t[17]!==n?(y=d.audioAttachmentId?(0,$.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(tt,{className:`size-4 text-accent`,"aria-hidden":!0}),r.recordingAudio]}),(0,$.jsx)(Rt,{noteId:n,attachmentId:d.audioAttachmentId,label:r.recordingAudio,unavailableLabel:r.recordingUnavailable})]}):null,t[14]=r.recordingAudio,t[15]=r.recordingUnavailable,t[16]=d.audioAttachmentId,t[17]=n,t[18]=y):y=t[18];let b;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(tt,{className:`size-4 text-accent`,"aria-hidden":!0}),t[19]=b):b=t[19];let x=d.status===`recording`?r.draftTranscript:r.fullTranscript,S;t[20]===x?S=t[21]:(S=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[b,x]}),t[20]=x,t[21]=S);let C;t[22]===d.status?C=t[23]:(C=d.status===`needs_attention`?(0,$.jsx)(fe,{className:`size-3.5 text-danger`}):d.status===`completed`?(0,$.jsx)(g,{className:`size-3.5 text-success`}):null,t[22]=d.status,t[23]=C);let w=d.status===`needs_attention`?d.failureMessage:_,T;t[24]!==C||t[25]!==w?(T=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-fg-muted`,children:[C,w]}),t[24]=C,t[25]=w,t[26]=T):T=t[26];let D;t[27]!==S||t[28]!==T?(D=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[S,T]}),t[27]=S,t[28]=T,t[29]=D):D=t[29];let k=f.text||r.waitingTranscript,A;t[30]===k?A=t[31]:(A=(0,$.jsx)(`div`,{className:`mt-3 max-h-48 overflow-y-auto whitespace-pre-wrap text-sm leading-6 text-fg-muted xl:max-h-none xl:overflow-visible`,children:k}),t[30]=k,t[31]=A);let M;t[32]!==D||t[33]!==A?(M=(0,$.jsxs)(`section`,{className:`px-6 py-4`,children:[D,A]}),t[32]=D,t[33]=A,t[34]=M):M=t[34];let N;return t[35]!==M||t[36]!==v||t[37]!==y?(N=(0,$.jsxs)(`aside`,{className:`max-h-[45%] shrink-0 overflow-y-auto border-b border-edge-subtle xl:h-full xl:max-h-none xl:w-[clamp(20rem,34%,27rem)] xl:border-r xl:border-b-0`,children:[v,y,M]}),t[35]=M,t[36]=v,t[37]=y,t[38]=N):N=t[38],N}function Bt(e){return e.title}function Vt(e,t){return e.sequence-t.sequence}function Ht(e){return e.language}var Ut={edit:x,ai_edit:I,sync:we,restore:Ye};function Wt(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function Gt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=O(e=>e.language),o=E(a).notes,s={justNow:o.justNow,minutesAgo:o.minutesAgo,today:o.today,yesterday:o.yesterday,daysAgo:o.daysAgo,locale:D(a)},{data:c}=j(e?[`note-history`,e]:null,()=>Y(e)),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null),h=(0,Q.useCallback)(async t=>{u(!0),m(null);try{await q(e,t),f(null),i()}catch{m(o.restoreFailed)}finally{u(!1)}},[e,o.restoreSuccess,o.restoreFailed,i]),g=Date.now();return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(me,{className:`size-4`,"aria-hidden":!0}),o.history]}),(0,$.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg p-1 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,$.jsx)(w,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[p?(0,$.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:p}):null,c?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:c.map(e=>{let r=Ut[e.trigger]??x,i=t===e.timestamp,a=d===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:A(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:Wt(e.trigger,o)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:gt(e.timestamp,g,s)})]}),e.snippet&&(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,$.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:a?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:o.restoreConfirm}),(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),h(e.timestamp)},disabled:l,className:`shrink-0 rounded-lg bg-accent px-3 py-1 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:opacity-50`,children:l?`...`:o.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),f(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),f(e.timestamp)},className:`rounded-lg bg-surface-hover px-3 py-1 text-xs font-medium text-fg transition-colors hover:bg-accent hover:text-on-accent`,children:o.restore})})]},e.timestamp)})}):(0,$.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:o.historyEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:o.historyEmptyDescription})]})]})]})}function Kt({noteId:e,note:t,catalyzing:n,onCatalyze:r,onClose:i,noteThreads:o,openingChat:s,onOpenChat:c,onOpenNewChat:l}){let u=E(O(e=>e.language)).notes,d=a(),f=t?.aiDeep?.catalysis,p=f?.report??null,[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(!1),{data:v,mutate:y,isLoading:b}=j(e?[`note-agent-context-status`,e]:null,()=>ke(e),{revalidateOnFocus:!1}),x=(0,Q.useCallback)(async()=>{if(!g){_(!0),h(null);try{await y(()=>de(e),{revalidate:!1})}catch(e){h(`${u.contextRebuildFailed}: ${e instanceof Error?e.message:u.quickCaptureFailedHint}`)}finally{_(!1)}}},[g,y,u.contextRebuildFailed,u.quickCaptureFailedHint,e]),S=(0,Q.useCallback)(async t=>{try{await B(e,t)}catch{}},[e]);return(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(I,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:u.catalysisSectionTitle})]}),(0,$.jsx)(`button`,{type:`button`,onClick:i,"aria-label":u.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,$.jsx)(X,{className:`size-4 rotate-180`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,$.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:u.catalysisSectionDescription}),v?(0,$.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void x(),disabled:b||g,className:`rounded-md px-1.5 py-0.5 text-[11px] font-medium text-accent transition-colors hover:bg-accent/10 disabled:cursor-not-allowed disabled:opacity-50`,children:g?u.processing:u.contextRebuild}),(0,$.jsx)(`span`,{className:A(`rounded-full px-2 py-0.5 text-[11px] font-medium`,v.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:v.status===`partial`?`bg-amber-500/10 text-amber-600 dark:text-amber-300`:`bg-red-500/10 text-red-600 dark:text-red-300`),children:v.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:u.contextStatusDetail.replace(`{{attachments}}`,String(v.attachments.length)).replace(`{{tokens}}`,String(v.tokenEstimate??0))}),m?(0,$.jsx)(`p`,{className:`mt-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:m}):null,v.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:v.attachments.slice(0,5).map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId))}):null]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:r,disabled:n,className:`w-full rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:n?u.processing:p?u.recatalyze:u.catalyzeAction}),p?(0,$.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:p.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:p.targetUsers.slice(0,5).map(e=>(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.keyQuestions.slice(0,3).map(e=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,$.jsx)(`span`,{children:e})]},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.mvpPath.slice(0,3).map((e,t)=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,$.jsx)(`span`,{children:e})]},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.risks.slice(0,3).map(e=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,$.jsx)(`span`,{children:e})]},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.nextActions.slice(0,4).map(e=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,$.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`))})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:u.confidenceLabel.replace(`{{percent}}`,String(Math.round(p.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void S(`helpful`),className:A(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,f?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackHelpfulAria,children:(0,$.jsx)(z,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void S(`not_helpful`),className:A(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,f?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackNotHelpfulAria,children:(0,$.jsx)(se,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,$.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:u.noCatalysisReportHint}),(0,$.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)($e,{className:`size-4 text-accent`,"aria-hidden":!0}),u.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:u.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:c,disabled:s,className:`rounded-lg border border-edge px-2.5 py-1.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,children:s?u.openingChat:u.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:l,disabled:s,className:`rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:u.newThread})]})]}),o.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:o.slice(0,5).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>d(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||u.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:u.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,$.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:u.noThreads})]})]})]})}var qt=[{value:`86400000`,zh:`24 小时`,en:`24 hours`},{value:`604800000`,zh:`7 天`,en:`7 days`},{value:`2592000000`,zh:`30 天`,en:`30 days`}];function Jt({open:e,onOpenChange:t,note:n}){let r=O(e=>e.language)===`zh`,i=r?Zt:Qt,{data:a,mutate:g}=j(e?[`note-shares`,n.id]:null,()=>Qe(n.id)),[y,x]=(0,Q.useState)(new Set),[S,C]=(0,Q.useState)(`86400000`),[E,D]=(0,Q.useState)(``),[k,A]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(null),[L,z]=(0,Q.useState)(null),[B,V]=(0,Q.useState)(!1),[H,U]=(0,Q.useState)(null),W=(0,Q.useMemo)(()=>{let e=new Set;return n.markdown.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^\s)]+)/gi,(t,r,i)=>{try{decodeURIComponent(r)===n.id&&e.add(decodeURIComponent(i))}catch{}return t}),(n.attachments??[]).filter(t=>e.has(t.id))},[n.attachments,n.id,n.markdown]);(0,Q.useEffect)(()=>{e&&(x(new Set(W.map(e=>e.id))),z(null),V(!1),U(null))},[e,W]);let ee=async()=>{P(!0),U(null);try{z((await Ee(n.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...y],ttlMs:Number(S),maxViews:E.trim()?Number(E):null,description:k.trim()||void 0})).payload.shareUrl),await g()}catch(e){U(e instanceof Error?e.message:String(e))}finally{P(!1)}},ne=async(e,t)=>{I(e.id),U(null);try{t===`refresh`?await R(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...y]}):t===`extend`?await te(e.id,864e5):await le(e.id),await g()}catch(e){U(e instanceof Error?e.message:String(e))}finally{I(null)}},re=async e=>{U(null);try{if(!await T(e)){V(!1),U(i.copyFailed);return}V(!0),window.setTimeout(()=>V(!1),1500)}catch{V(!1),U(i.copyFailed)}};return(0,$.jsx)(f,{open:e,onOpenChange:t,children:(0,$.jsxs)(l,{children:[(0,$.jsx)(o,{className:`fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(u,{className:`fixed left-1/2 top-1/2 z-[71] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(d,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(Ke,{className:`size-4`}),i.title]}),(0,$.jsx)(s,{className:`mt-1 text-xs text-fg-muted`,children:i.description})]}),(0,$.jsx)(c,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-fg-muted hover:bg-surface-hover`,"aria-label":i.close,children:(0,$.jsx)(w,{className:`size-4`})})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,$.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-subtle p-4`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.title||i.untitled}),(0,$.jsx)(`p`,{className:`mt-2 line-clamp-4 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.markdown||i.empty}),(0,$.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:i.privateExcluded})]}),W.length>0?(0,$.jsxs)(`section`,{className:`mt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.attachments}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:W.map(e=>(0,$.jsxs)(`label`,{className:`flex items-center gap-3 rounded-lg border border-edge-subtle px-3 py-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:y.has(e.id),onChange:()=>x(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),className:`accent-accent`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.fileName}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Xt(e.size)})]},e.id))})]}):null,(0,$.jsxs)(`section`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.expires,(0,$.jsx)(m,{value:S,onChange:e=>C(e.target.value),children:qt.map(e=>(0,$.jsx)(h,{value:e.value,children:r?e.zh:e.en},e.value))})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.maxViews,(0,$.jsx)(`input`,{type:`number`,min:1,max:1e3,value:E,onChange:e=>D(e.target.value),placeholder:i.unlimited,className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.publicDescription,(0,$.jsx)(`input`,{value:k,onChange:e=>A(e.target.value),className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]})]}),L?(0,$.jsx)(`div`,{className:`mt-5 rounded-lg border border-success/25 bg-success-soft p-3`,children:(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(`input`,{readOnly:!0,value:L,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none`}),(0,$.jsxs)(M,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void re(L),children:[B?(0,$.jsx)(p,{className:`size-4`}):(0,$.jsx)(_,{className:`size-4`}),B?i.copied:i.copy]}),(0,$.jsxs)(M,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>window.open(L,`_blank`,`noopener,noreferrer`),children:[(0,$.jsx)(v,{className:`size-4`}),i.open]})]})}):null,H?(0,$.jsx)(`p`,{className:`mt-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,children:H}):null,(a?.items.length??0)>0?(0,$.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.activeLinks}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:a.items.map(e=>(0,$.jsx)(Yt,{share:e,busy:F===e.id,t:i,onCopy:re,onAction:ne},e.id))})]}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-edge px-5 py-3`,children:[(0,$.jsx)(c,{asChild:!0,children:(0,$.jsx)(M,{type:`button`,variant:`ghost`,children:i.close})}),(0,$.jsxs)(M,{type:`button`,onClick:()=>void ee(),disabled:N,children:[N?(0,$.jsx)(b,{className:`size-4 animate-spin`}):(0,$.jsx)(Ke,{className:`size-4`}),N?i.creating:i.create]})]})]})]})})}function Yt(e){let t=(0,Z.c)(68),{share:n,busy:r,t:i,onCopy:a,onAction:o}=e,s=n.revoked||n.expired,c=s&&`opacity-60`,l;t[0]===c?l=t[1]:(l=A(`rounded-lg border border-edge-subtle p-3`,c),t[0]=c,t[1]=l);let u=n.stale&&!s?i.stale:s?i.inactive:i.active,d;t[2]===u?d=t[3]:(d=(0,$.jsx)(`span`,{children:u}),t[2]=u,t[3]=d);let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`span`,{children:`·`}),t[4]=f):f=t[4];let p=n.maxViews===null?``:` / ${n.maxViews}`,m;t[5]!==n.viewCount||t[6]!==i.views||t[7]!==p?(m=(0,$.jsxs)(`span`,{children:[i.views,` `,n.viewCount,p]}),t[5]=n.viewCount,t[6]=i.views,t[7]=p,t[8]=m):m=t[8];let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(`span`,{children:`·`}),t[9]=h):h=t[9];let g;t[10]===n.expiresAt?g=t[11]:(g=new Date(n.expiresAt).toLocaleDateString(),t[10]=n.expiresAt,t[11]=g);let y;t[12]===g?y=t[13]:(y=(0,$.jsx)(`span`,{children:g}),t[12]=g,t[13]=y);let x;t[14]!==y||t[15]!==d||t[16]!==m?(x=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[d,f,m,h,y]}),t[14]=y,t[15]=d,t[16]=m,t[17]=x):x=t[17];let S;t[18]===n.shareUrl?S=t[19]:(S=(0,$.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[18]=n.shareUrl,t[19]=S);let C;t[20]!==x||t[21]!==S?(C=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[x,S]}),t[20]=x,t[21]=S,t[22]=C):C=t[22];let w;t[23]===r?w=t[24]:(w=r?(0,$.jsx)(b,{className:`size-4 animate-spin text-fg-muted`}):null,t[23]=r,t[24]=w);let T;t[25]!==C||t[26]!==w?(T=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[C,w]}),t[25]=C,t[26]=w,t[27]=T):T=t[27];let E;t[28]!==a||t[29]!==n.shareUrl?(E=()=>void a(n.shareUrl),t[28]=a,t[29]=n.shareUrl,t[30]=E):E=t[30];let D;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(_,{className:`size-3.5`}),t[31]=D):D=t[31];let O;t[32]!==i.copy||t[33]!==E?(O=(0,$.jsxs)(M,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:E,children:[D,i.copy]}),t[32]=i.copy,t[33]=E,t[34]=O):O=t[34];let k;t[35]===n.shareUrl?k=t[36]:(k=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=k);let j;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(v,{className:`size-3.5`}),t[37]=j):j=t[37];let N;t[38]!==i.open||t[39]!==k?(N=(0,$.jsxs)(M,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:k,children:[j,i.open]}),t[38]=i.open,t[39]=k,t[40]=N):N=t[40];let P;t[41]!==r||t[42]!==s||t[43]!==o||t[44]!==n||t[45]!==i.refresh?(P=n.stale&&!s?(0,$.jsxs)(M,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,$.jsx)(we,{className:`size-3.5`}),i.refresh]}):null,t[41]=r,t[42]=s,t[43]=o,t[44]=n,t[45]=i.refresh,t[46]=P):P=t[46];let F;t[47]!==r||t[48]!==s||t[49]!==o||t[50]!==n||t[51]!==i.extend?(F=s?null:(0,$.jsx)(M,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`extend`),children:i.extend}),t[47]=r,t[48]=s,t[49]=o,t[50]=n,t[51]=i.extend,t[52]=F):F=t[52];let I;t[53]!==r||t[54]!==o||t[55]!==n||t[56]!==i.revoke?(I=n.revoked?null:(0,$.jsxs)(M,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,$.jsx)(V,{className:`size-3.5`}),i.revoke]}),t[53]=r,t[54]=o,t[55]=n,t[56]=i.revoke,t[57]=I):I=t[57];let L;t[58]!==O||t[59]!==N||t[60]!==P||t[61]!==F||t[62]!==I?(L=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[O,N,P,F,I]}),t[58]=O,t[59]=N,t[60]=P,t[61]=F,t[62]=I,t[63]=L):L=t[63];let R;return t[64]!==T||t[65]!==l||t[66]!==L?(R=(0,$.jsxs)(`div`,{className:l,children:[T,L]}),t[64]=T,t[65]=l,t[66]=L,t[67]=R):R=t[67],R}function Xt(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}var Zt={title:`分享笔记`,description:`创建一个无需登录即可查看的只读快照。`,close:`关闭`,untitled:`无标题笔记`,empty:`空笔记`,privateExcluded:`不会分享标签、AI 元数据、项目、讨论、历史版本或未引用附件。`,attachments:`包含的附件`,expires:`有效期`,maxViews:`最多查看次数`,unlimited:`不限`,publicDescription:`公开说明(可选)`,create:`创建分享链接`,creating:`创建中…`,copy:`复制`,copied:`已复制`,open:`打开`,activeLinks:`这条笔记的分享`,copyFailed:`无法复制到剪贴板,请手动选择链接并复制。`,stale:`旧版本`,inactive:`已失效`,active:`有效`,views:`查看`,refresh:`更新快照`,extend:`延长 24 小时`,revoke:`撤销`},Qt={title:`Share Note`,description:`Create a read-only snapshot that opens without sign-in.`,close:`Close`,untitled:`Untitled Note`,empty:`Empty Note`,privateExcluded:`Tags, AI metadata, projects, discussions, history, and unreferenced attachments are excluded.`,attachments:`Included attachments`,expires:`Expires`,maxViews:`Maximum views`,unlimited:`Unlimited`,publicDescription:`Public description (optional)`,create:`Create share link`,creating:`Creating…`,copy:`Copy`,copied:`Copied`,open:`Open`,activeLinks:`Shares for this Note`,copyFailed:`Could not copy to the clipboard. Select the link and copy it manually.`,stale:`Older version`,inactive:`Inactive`,active:`Active`,views:`Views`,refresh:`Update snapshot`,extend:`Extend 24 hours`,revoke:`Revoke`},$t=()=>i(()=>import(`./block-editor-DutTIH81.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65])),en=()=>i(()=>import(`./markdown-editor-nDLmA_LF.js`),__vite__mapDeps([66,1,3,63,5,67])),tn=(0,Q.lazy)(()=>$t().then(e=>({default:e.BlockEditor}))),nn=(0,Q.lazy)(()=>en().then(e=>({default:e.MarkdownEditor})));function rn(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,$.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function an(e){let t=(0,Z.c)(14),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:Fe},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:rt},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:y},t[4]=i.preview,t[5]=s);let c;t[6]!==a||t[7]!==o||t[8]!==s?(c=[a,o,s],t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9];let l=c,u;return t[10]!==n||t[11]!==l||t[12]!==r?(u=(0,$.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg border border-edge p-0.5`,children:l.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(t),onMouseEnter:()=>{t===`wysiwyg`&&$t(),t===`source`&&en()},onFocus:()=>{t===`wysiwyg`&&$t(),t===`source`&&en()},className:A(`inline-flex items-center gap-1 rounded-lg px-2 py-1 text-xs font-medium transition-colors`,n===t?`bg-surface-hover text-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,$.jsx)(a,{className:`size-3.5`,"aria-hidden":!0}),i]},t)})}),t[10]=n,t[11]=l,t[12]=r,t[13]=u):u=t[13],u}function on(e){let t=(0,Z.c)(15),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:s,onOpenSearch:c,autoFocus:l,onAutoFocusConsumed:u}=e,d=a===void 0?!0:a,f=s===void 0?!0:s,p=l===void 0?!1:l,m=O(sn),h;t[0]===m?h=t[1]:(h=E(m),t[0]=m,t[1]=h);let g=h.notes.lightboxClose,_;t[2]!==p||t[3]!==o||t[4]!==f||t[5]!==n||t[6]!==u||t[7]!==r||t[8]!==c||t[9]!==i||t[10]!==d?(_=(0,$.jsx)(cn,{noteId:n,onBack:r,onSaved:i,showBackButton:d,backButtonClassName:o,clearHeaderOnCleanup:f,onOpenSearch:c,autoFocus:p,onAutoFocusConsumed:u}),t[2]=p,t[3]=o,t[4]=f,t[5]=n,t[6]=u,t[7]=r,t[8]=c,t[9]=i,t[10]=d,t[11]=_):_=t[11];let v;return t[12]!==g||t[13]!==_?(v=(0,$.jsx)(ut,{closeLabel:g,children:_}),t[12]=g,t[13]=_,t[14]=v):v=t[14],v}function sn(e){return e.language}function cn({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:o=!0,onOpenSearch:s,autoFocus:c=!1,onAutoFocusConsumed:l}){let u=O(e=>e.language),d=E(u).notes,f=E(u).automations.suggestions,p=a(),m=N(e=>e.resolved)===`dark`,{openImage:h}=ct(),[g,_]=(0,Q.useState)(`wysiwyg`),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(null),[S,w]=(0,Q.useState)(!1),[T,D]=(0,Q.useState)(``),[k,M]=(0,Q.useState)(360),[P,F]=(0,Q.useState)(!1),[L,R]=(0,Q.useState)(!1),[z,B]=(0,Q.useState)(!1),[V,H]=(0,Q.useState)(null),[W,te]=(0,Q.useState)(!1),[ne,re]=(0,Q.useState)(null),G=(0,Q.useRef)(!1),ie=(0,Q.useRef)(!1),oe=(0,Q.useRef)(null),K=(0,Q.useRef)(null),q=(0,Q.useRef)(null),se=(0,Q.useRef)(null),ce=(0,Q.useRef)(null),le=(0,Q.useRef)(null),ue=(0,Q.useRef)(null),de=(0,Q.useRef)(null),fe=(0,Q.useRef)(null),pe=Ve(e=>e.setPageHeader),he=Ve(e=>e.clearPageHeader),{data:J,mutate:Y}=j(e?[`note-detail`,e]:null,()=>Le(e)),{data:_e=[],mutate:ve}=j(e?[`note-threads`,e]:null,()=>it(e),{revalidateOnFocus:!1}),ye=b!==null,be=(0,Q.useCallback)(e=>{H(`${d.refreshFailed}: ${e instanceof Error?e.message:d.quickCaptureFailedHint}`)},[d.quickCaptureFailedHint,d.refreshFailed]);(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&Y().catch(be)};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[Y,e,be]),(0,Q.useEffect)(()=>{G.current=!1,D(``),x(null),y(null),ie.current=!1,fe.current=null},[e]),(0,Q.useEffect)(()=>{!J||G.current||(D(J.title??``),G.current=!0)},[J]),(0,Q.useEffect)(()=>{if(!c||!J||ye||fe.current===e)return;let t=window.requestAnimationFrame(()=>{de.current?.focus(),l?.()});return fe.current=e,()=>window.cancelAnimationFrame(t)},[c,ye,J,e,l]);let xe=J?new Date(J.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,Se=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":d.back,className:A(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,Re,i),children:(0,$.jsx)(X,{className:`size-4`,"aria-hidden":!0})}):null,[i,d.back,t,r]),Ce=(0,Q.useCallback)(t=>{D(t),e&&(se.current=t,K.current&&clearTimeout(K.current),K.current=setTimeout(async()=>{let t=se.current;if(se.current=null,t!==null){w(!0);try{await Me(e,{title:t}),await Y(),n?.()}catch{}finally{w(!1)}}},600))},[e,Y,n]),we=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:A(`flex min-w-0 items-center gap-2`,Re),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:T||xe||void 0,children:T||xe}),S?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:d.saving}):null]}),[d.saving,S,xe,T]),Te=(0,Q.useCallback)(async(t=!1)=>{B(!0),H(null);try{let n=await nt(e,{forceNew:t});await Y(),await ve(),p(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){H(`${d.chatOpenFailedTitle}: ${e instanceof Error?e.message:d.chatOpenFailedMessage}`)}finally{B(!1)}},[Y,ve,p,e,d.chatOpenFailedMessage,d.chatOpenFailedTitle]),Ee=(0,Q.useCallback)(async()=>{R(!0),H(null);try{await Ze(e),await Y()}catch(e){H(`${d.catalysisFailed}: ${e instanceof Error?e.message:d.chatOpenFailedMessage}`)}finally{R(!1)}},[Y,e]),Oe=(0,Q.useCallback)(()=>{y(v===`breakdown`?null:`breakdown`),!J?.aiDeep?.catalysis?.report&&!L&&Ee()},[v,L,Ee,J?.aiDeep?.catalysis?.report]),ke=(0,Q.useCallback)(()=>{let t=b?.markdown??q.current??J?.markdown??``,n=b?.title??T,r=ee([n,t].filter(Boolean).join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-BPdSzceB.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-eZjksPvq.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-BvLh9GaE.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-DBS3OB8K.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-BXsHghJd.js","assets/dist-CpzYSoz7.js","assets/chunk-KS7C4IRE-BaASWQor.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/locale-store-CBoCuIMx.js","assets/messages-BbdwoxVo.js","assets/cn-JdwAhgNB.js","assets/product-delivery-CV4pDOtG.js","assets/schemas-BHS7bo06.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-Y68dCxuc.css","assets/dist-DLmwHyAh.js","assets/vendor-swr-BIWyz7Rc.js","assets/check-DUBLcKHA.js","assets/popover-select-C-Hj-nXR.js","assets/skeleton-BwbyijEw.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/settings-shell-layer-context-DCp6ykjQ.js","assets/circle-check-C23XjkUj.js","assets/cloud-C4-yfnnk.js","assets/copy-Dv6d4Dvw.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/eye-off-DEAzt3g1.js","assets/eye-CABVeTq0.js","assets/folder-open-CyzJ19I9.js","assets/globe-DSSGFWFn.js","assets/link-2-D_ZKYUW7.js","assets/loader-circle-CifKLtgG.js","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/pencil-DmIY3Oa-.js","assets/rotate-cw-LIg3Am9S.js","assets/search-DA7gz22f.js","assets/middleware-Pd0e8Igk.js","assets/files-D6vf3S30.js","assets/tool-activity-R8V9l6nk.js","assets/button-CtTvuElV.js","assets/registry-api-BhGKnvLP.js","assets/gateway-startup-retry-DyvcAIMm.js","assets/config-reload-event-Bjh2zoKp.js","assets/gateway-config-swr-826dipyU.js","assets/models-hub-cache-88f4fzYS.js","assets/oauth-api-BjSUDIgq.js","assets/electron-env-DH5wF8X8.js","assets/form-field-width-DJw_jULe.js","assets/interaction-BmQogeqz.js","assets/is-masked-secret-DOkL5b_X.js","assets/activity-store-BlxqErph.js","assets/theme-store-hybK3oC9.js","assets/index-Dbh5SXyV.css","assets/vendor-codemirror--gTq3YAI.js","assets/with-selector-aYPsXwdl.js","assets/block-editor-D4ZIVQbk.css","assets/markdown-editor-nDLmA_LF.js","assets/code-editor-D4_k-6QN.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{l as a}from"./chunk-KS7C4IRE-BaASWQor.js";import{a as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./dist-CpzYSoz7.js";import{t as p}from"./check-DUBLcKHA.js";import{n as m,r as h}from"./popover-select-C-Hj-nXR.js";import{t as g}from"./circle-check-C23XjkUj.js";import{t as _}from"./copy-Dv6d4Dvw.js";import{t as v}from"./external-link-DjqjBmc3.js";import{t as y}from"./eye-CABVeTq0.js";import{t as b}from"./loader-circle-CifKLtgG.js";import{t as x}from"./pencil-DmIY3Oa-.js";import{t as S}from"./plus-Q2yW6OE7.js";import{t as C}from"./search-DA7gz22f.js";import{t as w}from"./x-B_N4OPjy.js";import{t as T}from"./copy-to-clipboard-HOJ79TWv.js";import{t as E}from"./messages-BbdwoxVo.js";import{d as D,n as O,s as k}from"./locale-store-CBoCuIMx.js";import{t as A}from"./cn-JdwAhgNB.js";import{i as j}from"./vendor-swr-BIWyz7Rc.js";import{t as M}from"./button-CtTvuElV.js";import{i as N}from"./theme-store-hybK3oC9.js";import{t as P}from"./skeleton-BwbyijEw.js";import{Bn as F,Bs as I,Cn as L,Dn as R,Ds as z,En as B,Es as V,Fc as H,Fn as U,Gc as W,In as ee,Ir as te,Is as ne,Ji as re,Kl as G,Li as ie,Ln as ae,Mn as oe,Ns as K,On as q,Os as se,Rn as ce,Rr as le,Sn as ue,Tn as de,Ts as fe,Vn as pe,Yc as me,Zl as he,Zs as J,_n as Y,a as ge,an as _e,bn as ve,c as ye,cc as be,cn as xe,dc as Se,dn as Ce,ec as we,eu as X,fl as Te,fn as Ee,gn as De,hc as Oe,hn as ke,in as Ae,jn as je,kn as Me,kt as Ne,l as Pe,ll as Fe,ln as Ie,mn as Le,no as Re,nu as ze,o as Be,oa as Ve,on as He,pc as Ue,pn as We,qc as Ge,qs as Ke,s as qe,sn as Je,tu as Ye,uc as Xe,un as Ze,vn as Qe,wc as $e,wn as et,xc as tt,xn as nt,yl as rt,yn as it,zn as at,zs as ot}from"./index-eZjksPvq.js";var Z=n(),Q=e(t(),1),$=r(),st=(0,Q.createContext)(null);function ct(){let e=(0,Z.c)(1),t=(0,Q.useContext)(st);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:lt},e[0]=t):t=e[0],t}return t}function lt(){}function ut(e){let t=(0,Z.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,s]=(0,Q.useState)(null),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(e,t)=>{s({src:e,alt:t})},t[0]=p):p=t[0];let m=p,h;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h={openImage:m},t[1]=h):h=t[1];let g=h,_=a!==null,v;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{e||s(null)},t[2]=v):v=t[2];let y;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(o,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=y):y=t[3];let b;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(b=A(`fixed inset-0 z-[71] flex items-center justify-center p-4 outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out`),t[4]=b):b=t[4];let x=a?.alt||`Image preview`,S;t[5]===x?S=t[6]:(S=(0,$.jsx)(d,{className:`sr-only`,children:x}),t[5]=x,t[6]=S);let C;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(w,{className:`size-5`,"aria-hidden":!0}),t[7]=C):C=t[7];let T;t[8]===i?T=t[9]:(T=(0,$.jsx)(c,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":i,className:`absolute right-4 top-4 z-10 rounded-lg bg-surface-panel/80 p-2 text-fg-muted backdrop-blur transition-colors hover:bg-surface-hover hover:text-fg`,children:C})}),t[8]=i,t[9]=T);let E;t[10]===a?E=t[11]:(E=a?(0,$.jsx)(`img`,{src:a.src,alt:a.alt??``,className:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`}):null,t[10]=a,t[11]=E);let D;t[12]!==T||t[13]!==E||t[14]!==S?(D=(0,$.jsxs)(l,{children:[y,(0,$.jsxs)(u,{className:b,"aria-describedby":void 0,children:[S,T,E]})]}),t[12]=T,t[13]=E,t[14]=S,t[15]=D):D=t[15];let O;t[16]!==D||t[17]!==_?(O=(0,$.jsx)(f,{open:_,onOpenChange:v,children:D}),t[16]=D,t[17]=_,t[18]=O):O=t[18];let k;return t[19]!==n||t[20]!==O?(k=(0,$.jsxs)(st.Provider,{value:g,children:[n,O]}),t[19]=n,t[20]=O,t[21]=k):k=t[21],k}function dt(e){let t=(0,Z.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,Q.useState)(!1),s;t[0]!==r||t[1]!==n?(s=pe(n,r),t[0]=r,t[1]=n,t[2]=s):s=t[2];let c=s;if(a){let e;t[3]===i?e=t[4]:(e=A(`flex size-12 shrink-0 items-center justify-center rounded-lg border border-edge-subtle bg-surface-hover text-fg-muted`,i),t[3]=i,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(Ge,{className:`size-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,$.jsx)(`div`,{className:e,"aria-hidden":!0,children:n}),t[6]=e,t[7]=r),r}let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>o(!0),t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=A(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=u);let d;return t[11]!==n||t[12]!==c||t[13]!==u?(d=(0,$.jsx)(oe,{src:c,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:l,className:u}),t[11]=n,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}var ft=6e4,pt=36e5,mt=864e5;function ht(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function gt(e,t,n){let r=t-e;if(r<ft)return n.justNow;if(r<pt){let e=Math.floor(r/ft);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=ht(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(e>=i-mt)return n.yesterday+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(r<7*mt){let e=Math.floor(r/mt);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(n.locale,{month:`short`,day:`numeric`})}function _t(e,t,n){let r=ht(t);if(e>=r)return n.today;if(e>=r-mt)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(n.locale,{month:`long`,day:`numeric`}):i.toLocaleDateString(n.locale,{year:`numeric`,month:`long`,day:`numeric`})}function vt(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function yt(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,`0`)}`}function bt(e){let t=(0,Z.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=ce(),f=ce(St),p=u===n&&d===r,m=p&&o,h=p&&s,g=p?c:0,_=p&&l>0?l:i??0,v=_>0?Math.min(g/_*100,100):0,y;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==f?(y=e=>{e.stopPropagation(),f(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=f,t[4]=y):y=t[4];let x=y,S;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==f?(S=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),f(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=f,t[9]=S):S=t[9];let C=S,w;t[10]===a?w=t[11]:(w=A(`flex items-center gap-2`,a),t[10]=a,t[11]=w);let T=m?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,E;t[12]===T?E=t[13]:(E=A(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,T),t[12]=T,t[13]=E);let D=m?`Pause`:`Play`,O;t[14]!==h||t[15]!==m?(O=h?(0,$.jsx)(b,{className:`size-3.5 animate-spin`}):m?(0,$.jsx)(Ue,{className:`size-3.5`}):(0,$.jsx)(be,{className:`size-3.5 ml-0.5`}),t[14]=h,t[15]=m,t[16]=O):O=t[16];let k;t[17]!==x||t[18]!==C||t[19]!==E||t[20]!==D||t[21]!==O?(k=(0,$.jsx)(`button`,{type:`button`,onClick:x,onKeyDown:C,className:E,"aria-label":D,children:O}),t[17]=x,t[18]=C,t[19]=E,t[20]=D,t[21]=O,t[22]=k):k=t[22];let j=`${v}%`,M;t[23]===j?M=t[24]:(M=(0,$.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,$.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-200 ease-linear`,style:{width:j}})}),t[23]=j,t[24]=M);let N;t[25]!==_||t[26]!==p||t[27]!==g?(N=yt(p&&g>0?g:_),t[25]=_,t[26]=p,t[27]=g,t[28]=N):N=t[28];let P;t[29]===N?P=t[30]:(P=(0,$.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:N}),t[29]=N,t[30]=P);let F;t[31]!==M||t[32]!==P?(F=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[M,P]}),t[31]=M,t[32]=P,t[33]=F):F=t[33];let I;return t[34]!==F||t[35]!==w||t[36]!==k?(I=(0,$.jsxs)(`div`,{className:w,onClick:xt,children:[k,F]}),t[34]=F,t[35]=w,t[36]=k,t[37]=I):I=t[37],I}function xt(e){return e.stopPropagation()}function St(e){return e.toggle}function Ct(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function wt(e){let t=(0,Z.c)(88),{note:n,selected:r,onPress:i,onPin:a,onArchive:o,onDelete:s,labels:c,timeLabels:l}=e,u=r===void 0?!1:r,d;t[0]!==c||t[1]!==n?(d=Ct(n,c),t[0]=c,t[1]=n,t[2]=d):d=t[2];let f=d,p=!n.snippet?.trim(),[m]=(0,Q.useState)(jt),h;t[3]!==n.createdAt||t[4]!==m||t[5]!==l?(h=gt(n.createdAt,m,l),t[3]=n.createdAt,t[4]=m,t[5]=l,t[6]=h):h=t[6];let g=h,_,v;t[7]!==n.id||t[8]!==i?(_=()=>i(n.id),v=e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),i(n.id))},t[7]=n.id,t[8]=i,t[9]=_,t[10]=v):(_=t[9],v=t[10]);let y=u?`bg-surface-active hover:bg-surface-active`:`bg-transparent hover:bg-surface-panel/70`,b;t[11]===y?b=t[12]:(b=A(`group relative flex cursor-pointer flex-col gap-2 overflow-hidden rounded-lg px-3 py-2.5`,`transition-colors duration-150 ease-out`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-rail`,y),t[11]=y,t[12]=b);let x=u?`true`:void 0,S;t[13]===u?S=t[14]:(S=u?(0,$.jsx)(`span`,{className:`pointer-events-none absolute inset-y-2 left-0 w-0.5 rounded-r-pill bg-accent`,"aria-hidden":!0}):null,t[13]=u,t[14]=S);let C;t[15]!==n.coverAttachmentId||t[16]!==n.id||t[17]!==n.kind||t[18]!==n.voiceAttachmentId||t[19]!==n.voiceDurationSec?(C=n.coverAttachmentId?(0,$.jsx)(dt,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(bt,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-28 shrink-0`}):null,t[15]=n.coverAttachmentId,t[16]=n.id,t[17]=n.kind,t[18]=n.voiceAttachmentId,t[19]=n.voiceDurationSec,t[20]=C):C=t[20];let w;t[21]===n.title?w=t[22]:(w=n.title&&(0,$.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[21]=n.title,t[22]=w);let T=n.title?`text-fg-muted`:p?`italic text-fg-muted`:`text-fg`,E;t[23]===T?E=t[24]:(E=A(`truncate text-sm leading-5`,T),t[23]=T,t[24]=E);let D;t[25]!==f||t[26]!==E?(D=(0,$.jsx)(`p`,{className:E,children:f}),t[25]=f,t[26]=E,t[27]=D):D=t[27];let O;t[28]!==w||t[29]!==D?(O=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[w,D]}),t[28]=w,t[29]=D,t[30]=O):O=t[30];let k;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(Te,{className:`size-4`}),t[31]=k):k=t[31];let j;t[32]===c.actions?j=t[33]:(j=(0,$.jsx)(Ie,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:At,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-100 transition-opacity hover:bg-surface-panel focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:opacity-0 lg:group-hover:opacity-100 lg:focus-visible:opacity-100`,"aria-label":c.actions,title:c.actions,children:k})}),t[32]=c.actions,t[33]=j);let M;t[34]!==n.id||t[35]!==n.pinned||t[36]!==a?(M=()=>{a(n.id,!n.pinned).catch(Ot)},t[34]=n.id,t[35]=n.pinned,t[36]=a,t[37]=M):M=t[37];let N;t[38]===n.pinned?N=t[39]:(N=n.pinned?(0,$.jsx)(Xe,{className:`size-4`}):(0,$.jsx)(Se,{className:`size-4`}),t[38]=n.pinned,t[39]=N);let P=n.pinned?c.unpin:c.pin,F;t[40]!==M||t[41]!==N||t[42]!==P?(F=(0,$.jsxs)(_e,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:M,children:[N,P]}),t[40]=M,t[41]=N,t[42]=P,t[43]=F):F=t[43];let I;t[44]!==n.id||t[45]!==o?(I=()=>{o(n.id).catch(Dt)},t[44]=n.id,t[45]=o,t[46]=I):I=t[46];let L;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(ze,{className:`size-4`}),t[47]=L):L=t[47];let R;t[48]!==c.archive||t[49]!==I?(R=(0,$.jsxs)(_e,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:I,children:[L,c.archive]}),t[48]=c.archive,t[49]=I,t[50]=R):R=t[50];let z;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(xe,{className:`my-1 h-px bg-edge-subtle`}),t[51]=z):z=t[51];let B;t[52]!==n.id||t[53]!==s?(B=()=>{s(n.id).catch(Et)},t[52]=n.id,t[53]=s,t[54]=B):B=t[54];let H;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(V,{className:`size-4`}),t[55]=H):H=t[55];let U;t[56]!==c.delete||t[57]!==B?(U=(0,$.jsxs)(_e,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-500 outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:B,children:[H,c.delete]}),t[56]=c.delete,t[57]=B,t[58]=U):U=t[58];let W;t[59]!==F||t[60]!==R||t[61]!==U?(W=(0,$.jsx)(He,{children:(0,$.jsxs)(Ae,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:kt,children:[F,R,z,U]})}),t[59]=F,t[60]=R,t[61]=U,t[62]=W):W=t[62];let ee;t[63]!==j||t[64]!==W?(ee=(0,$.jsxs)(Je,{children:[j,W]}),t[63]=j,t[64]=W,t[65]=ee):ee=t[65];let te;t[66]!==C||t[67]!==O||t[68]!==ee?(te=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[C,O,ee]}),t[66]=C,t[67]=O,t[68]=ee,t[69]=te):te=t[69];let ne;t[70]===n.pinned?ne=t[71]:(ne=n.pinned&&(0,$.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 text-xs font-medium text-accent`,children:(0,$.jsx)(Se,{className:`size-3`})}),t[70]=n.pinned,t[71]=ne);let re;t[72]===n.tags?re=t[73]:(re=n.tags?.slice(0,2).map(Tt),t[72]=n.tags,t[73]=re);let G;t[74]===g?G=t[75]:(G=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:g}),t[74]=g,t[75]=G);let ie;t[76]!==ne||t[77]!==re||t[78]!==G?(ie=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[ne,re,G]}),t[76]=ne,t[77]=re,t[78]=G,t[79]=ie):ie=t[79];let ae;return t[80]!==te||t[81]!==ie||t[82]!==_||t[83]!==v||t[84]!==b||t[85]!==x||t[86]!==S?(ae=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:_,onKeyDown:v,className:b,"aria-current":x,children:[S,te,ie]}),t[80]=te,t[81]=ie,t[82]=_,t[83]=v,t[84]=b,t[85]=x,t[86]=S,t[87]=ae):ae=t[87],ae}function Tt(e){return(0,$.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e)}function Et(){}function Dt(){}function Ot(){}function kt(e){return e.stopPropagation()}function At(e){return e.stopPropagation()}function jt(){return Date.now()}function Mt(e){let t=(0,Z.c)(45),{title:n,description:r,prompt:i,coverage:o,className:s,variant:c}=e,l=c===void 0?`card`:c,u=O(Ft),d=E(u).automations.suggestions,f=E(u).automations,p=a(),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=m):m=t[0];let{data:h}=j(o?`automation-suggestion-coverage`:null,Pt,m),_=o?h?.automations.find(e=>ye(e,o)):void 0,v=_?Be(_,f):[];if(l===`titleAction`){if(_){let e;t[1]===s?e=t[2]:(e=A(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,s),t[1]=s,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(g,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let r;return t[4]===p?r=t[5]:(r=()=>p(`/automations`),t[4]=p,t[5]=r),(0,$.jsxs)(`section`,{className:e,children:[n,(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:d.coveredTitle}),(0,$.jsx)(M,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:d.manage})]})}let e;t[6]===s?e=t[7]:(e=A(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,s),t[6]=s,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(H,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=a):a=t[8];let o;t[9]!==r||t[10]!==n?(o=(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:r,children:n}),t[9]=r,t[10]=n,t[11]=o):o=t[11];let c;t[12]!==p||t[13]!==i?(c=()=>{p(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[12]=p,t[13]=i,t[14]=c):c=t[14];let l;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(I,{className:`size-3.5`,"aria-hidden":!0}),t[15]=l):l=t[15],(0,$.jsxs)(`section`,{className:e,children:[a,o,(0,$.jsxs)(M,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[l,d.setup]})]})}if(_){let e;t[16]===s?e=t[17]:(e=A(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,s),t[16]=s,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(g,{className:`mt-0.5 size-4 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[18]=n):n=t[18];let r;t[19]===p?r=t[20]:(r=()=>p(`/automations`),t[19]=p,t[20]=r);let i;return t[21]!==d||t[22]!==r?(i=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsx)(M,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:d.manage})}),t[21]=d,t[22]=r,t[23]=i):i=t[23],(0,$.jsxs)(`section`,{className:e,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:d.coveredTitle}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:qe(d.coveredDescription,{name:_.name})})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:f.explain.whyCovered}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:v.map(Nt)})]}),i]})}let y;t[24]===s?y=t[25]:(y=A(`rounded-lg bg-surface-panel p-3 shadow-surface`,s),t[24]=s,t[25]=y);let b;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(H,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=b):b=t[26];let x;t[27]===n?x=t[28]:(x=(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=x);let S;t[29]===r?S=t[30]:(S=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=S);let C;t[31]!==x||t[32]!==S?(C=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[b,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S]})]}),t[31]=x,t[32]=S,t[33]=C):C=t[33];let w;t[34]!==p||t[35]!==i?(w=()=>{p(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[34]=p,t[35]=i,t[36]=w):w=t[36];let T;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(I,{className:`size-3.5`,"aria-hidden":!0}),t[37]=T):T=t[37];let D;t[38]!==d.create||t[39]!==w?(D=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsxs)(M,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:w,children:[T,d.create]})}),t[38]=d.create,t[39]=w,t[40]=D):D=t[40];let k;return t[41]!==D||t[42]!==y||t[43]!==C?(k=(0,$.jsxs)(`section`,{className:y,children:[C,D]}),t[41]=D,t[42]=y,t[43]=C,t[44]=k):k=t[44],k}function Nt(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function Pt(){return Pe.list()}function Ft(e){return e.language}function It(e){let t=(0,Z.c)(4),{values:n}=e;if(n.length===0)return null;let r;t[0]===n?r=t[1]:(r=n.map(Lt),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:r}),t[2]=r,t[3]=i),i}function Lt(e,t){return(0,$.jsx)(`li`,{children:e},`${t}:${e}`)}function Rt(e){let t=(0,Z.c)(10),{noteId:n,attachmentId:r,label:i,unavailableLabel:a}=e,[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(!1),u,d;if(t[0]!==r||t[1]!==n?(u=()=>{let e=!1,t=!1;return s(null),l(!1),at(n,r).then(i=>{if(e=!0,t){F(n,r);return}s(i)}).catch(()=>{t||l(!0)}),()=>{t=!0,e&&F(n,r)}},d=[r,n],t[0]=r,t[1]=n,t[2]=u,t[3]=d):(u=t[2],d=t[3]),(0,Q.useEffect)(u,d),c){let e;return t[4]===a?e=t[5]:(e=(0,$.jsx)(`p`,{className:`text-xs text-danger`,children:a}),t[4]=a,t[5]=e),e}if(!o){let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(P,{className:`h-10 w-full max-w-md`}),t[6]=e):e=t[6],e}let f;return t[7]!==i||t[8]!==o?(f=(0,$.jsx)(`audio`,{controls:!0,preload:`metadata`,src:o,className:`w-full max-w-md`,"aria-label":i}),t[7]=i,t[8]=o,t[9]=f):f=t[9],f}function zt(e){let t=(0,Z.c)(39),{noteId:n}=e,r=E(O(Ht)).notes.discussionCapture,i,a;t[0]===n?(i=t[1],a=t[2]):(i=[`note-discussion-document`,n],a=()=>Ne(n),t[0]=n,t[1]=i,t[2]=a);let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[3]=o):o=t[3];let{data:s,mutate:c}=j(i,a,o),l,u;if(t[4]===c?(l=t[5],u=t[6]):(l=()=>{let e=e=>{let t=e.detail;t&&c(e=>{if(!e||e.discussion.id!==t.discussionId)return e;let n=e.transcript.segments.filter(e=>e.sequence!==t.segment.sequence).concat(t.segment).sort(Vt);return{...e,discussion:{...e.discussion,transcriptRevision:t.transcriptRevision},transcript:{...e.transcript,revision:t.transcriptRevision,segments:n,text:t.text,stats:t.stats}}},{revalidate:!1})},t=()=>void c();return window.addEventListener(`discussion-segment-updated`,e),window.addEventListener(`discussion-updated`,t),()=>{window.removeEventListener(`discussion-segment-updated`,e),window.removeEventListener(`discussion-updated`,t)}},u=[c],t[4]=c,t[5]=l,t[6]=u),(0,Q.useEffect)(l,u),!s)return null;let{discussion:d,transcript:f}=s,p=s.organization?.organization,m=[`stopping`,`sealing`,`organizing`].includes(d.status),h=f.stats.uploaded+f.stats.transcribing,_=f.stats.failed>0?r.failedSegments.replace(`{{count}}`,String(f.stats.failed)):h>0?r.processingSegments.replace(`{{count}}`,String(h)):m?r.finalizing:d.status===`completed`?r.transcriptReady:null,v;t[7]!==r.actionItems||t[8]!==r.decisions||t[9]!==r.openQuestions||t[10]!==r.organization||t[11]!==r.risks||t[12]!==p?(v=p?(0,$.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-5`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-accent-fg`,children:[(0,$.jsx)(I,{className:`size-4`,"aria-hidden":!0}),r.organization]}),(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:p.summary}),(0,$.jsxs)(`div`,{className:`mt-4 grid gap-4 text-sm leading-6 text-fg sm:grid-cols-2 xl:grid-cols-1`,children:[p.decisions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.decisions}),(0,$.jsx)(It,{values:p.decisions})]}):null,p.actionItems.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.actionItems}),(0,$.jsx)(It,{values:p.actionItems.map(Bt)})]}):null,p.risks.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.risks}),(0,$.jsx)(It,{values:p.risks})]}):null,p.openQuestions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.openQuestions}),(0,$.jsx)(It,{values:p.openQuestions})]}):null]})]}):null,t[7]=r.actionItems,t[8]=r.decisions,t[9]=r.openQuestions,t[10]=r.organization,t[11]=r.risks,t[12]=p,t[13]=v):v=t[13];let y;t[14]!==r.recordingAudio||t[15]!==r.recordingUnavailable||t[16]!==d.audioAttachmentId||t[17]!==n?(y=d.audioAttachmentId?(0,$.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(tt,{className:`size-4 text-accent`,"aria-hidden":!0}),r.recordingAudio]}),(0,$.jsx)(Rt,{noteId:n,attachmentId:d.audioAttachmentId,label:r.recordingAudio,unavailableLabel:r.recordingUnavailable})]}):null,t[14]=r.recordingAudio,t[15]=r.recordingUnavailable,t[16]=d.audioAttachmentId,t[17]=n,t[18]=y):y=t[18];let b;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(tt,{className:`size-4 text-accent`,"aria-hidden":!0}),t[19]=b):b=t[19];let x=d.status===`recording`?r.draftTranscript:r.fullTranscript,S;t[20]===x?S=t[21]:(S=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[b,x]}),t[20]=x,t[21]=S);let C;t[22]===d.status?C=t[23]:(C=d.status===`needs_attention`?(0,$.jsx)(fe,{className:`size-3.5 text-danger`}):d.status===`completed`?(0,$.jsx)(g,{className:`size-3.5 text-success`}):null,t[22]=d.status,t[23]=C);let w=d.status===`needs_attention`?d.failureMessage:_,T;t[24]!==C||t[25]!==w?(T=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-fg-muted`,children:[C,w]}),t[24]=C,t[25]=w,t[26]=T):T=t[26];let D;t[27]!==S||t[28]!==T?(D=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[S,T]}),t[27]=S,t[28]=T,t[29]=D):D=t[29];let k=f.text||r.waitingTranscript,A;t[30]===k?A=t[31]:(A=(0,$.jsx)(`div`,{className:`mt-3 max-h-48 overflow-y-auto whitespace-pre-wrap text-sm leading-6 text-fg-muted xl:max-h-none xl:overflow-visible`,children:k}),t[30]=k,t[31]=A);let M;t[32]!==D||t[33]!==A?(M=(0,$.jsxs)(`section`,{className:`px-6 py-4`,children:[D,A]}),t[32]=D,t[33]=A,t[34]=M):M=t[34];let N;return t[35]!==M||t[36]!==v||t[37]!==y?(N=(0,$.jsxs)(`aside`,{className:`max-h-[45%] shrink-0 overflow-y-auto border-b border-edge-subtle xl:h-full xl:max-h-none xl:w-[clamp(20rem,34%,27rem)] xl:border-r xl:border-b-0`,children:[v,y,M]}),t[35]=M,t[36]=v,t[37]=y,t[38]=N):N=t[38],N}function Bt(e){return e.title}function Vt(e,t){return e.sequence-t.sequence}function Ht(e){return e.language}var Ut={edit:x,ai_edit:I,sync:we,restore:Ye};function Wt(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function Gt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=O(e=>e.language),o=E(a).notes,s={justNow:o.justNow,minutesAgo:o.minutesAgo,today:o.today,yesterday:o.yesterday,daysAgo:o.daysAgo,locale:D(a)},{data:c}=j(e?[`note-history`,e]:null,()=>Y(e)),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null),h=(0,Q.useCallback)(async t=>{u(!0),m(null);try{await q(e,t),f(null),i()}catch{m(o.restoreFailed)}finally{u(!1)}},[e,o.restoreSuccess,o.restoreFailed,i]),g=Date.now();return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(me,{className:`size-4`,"aria-hidden":!0}),o.history]}),(0,$.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg p-1 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,$.jsx)(w,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[p?(0,$.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:p}):null,c?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:c.map(e=>{let r=Ut[e.trigger]??x,i=t===e.timestamp,a=d===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:A(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:Wt(e.trigger,o)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:gt(e.timestamp,g,s)})]}),e.snippet&&(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,$.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:a?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:o.restoreConfirm}),(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),h(e.timestamp)},disabled:l,className:`shrink-0 rounded-lg bg-accent px-3 py-1 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:opacity-50`,children:l?`...`:o.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),f(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),f(e.timestamp)},className:`rounded-lg bg-surface-hover px-3 py-1 text-xs font-medium text-fg transition-colors hover:bg-accent hover:text-on-accent`,children:o.restore})})]},e.timestamp)})}):(0,$.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:o.historyEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:o.historyEmptyDescription})]})]})]})}function Kt({noteId:e,note:t,catalyzing:n,onCatalyze:r,onClose:i,noteThreads:o,openingChat:s,onOpenChat:c,onOpenNewChat:l}){let u=E(O(e=>e.language)).notes,d=a(),f=t?.aiDeep?.catalysis,p=f?.report??null,[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(!1),{data:v,mutate:y,isLoading:b}=j(e?[`note-agent-context-status`,e]:null,()=>ke(e),{revalidateOnFocus:!1}),x=(0,Q.useCallback)(async()=>{if(!g){_(!0),h(null);try{await y(()=>de(e),{revalidate:!1})}catch(e){h(`${u.contextRebuildFailed}: ${e instanceof Error?e.message:u.quickCaptureFailedHint}`)}finally{_(!1)}}},[g,y,u.contextRebuildFailed,u.quickCaptureFailedHint,e]),S=(0,Q.useCallback)(async t=>{try{await B(e,t)}catch{}},[e]);return(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(I,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:u.catalysisSectionTitle})]}),(0,$.jsx)(`button`,{type:`button`,onClick:i,"aria-label":u.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,$.jsx)(X,{className:`size-4 rotate-180`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,$.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:u.catalysisSectionDescription}),v?(0,$.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void x(),disabled:b||g,className:`rounded-md px-1.5 py-0.5 text-[11px] font-medium text-accent transition-colors hover:bg-accent/10 disabled:cursor-not-allowed disabled:opacity-50`,children:g?u.processing:u.contextRebuild}),(0,$.jsx)(`span`,{className:A(`rounded-full px-2 py-0.5 text-[11px] font-medium`,v.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:v.status===`partial`?`bg-amber-500/10 text-amber-600 dark:text-amber-300`:`bg-red-500/10 text-red-600 dark:text-red-300`),children:v.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:u.contextStatusDetail.replace(`{{attachments}}`,String(v.attachments.length)).replace(`{{tokens}}`,String(v.tokenEstimate??0))}),m?(0,$.jsx)(`p`,{className:`mt-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:m}):null,v.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:v.attachments.slice(0,5).map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId))}):null]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:r,disabled:n,className:`w-full rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:n?u.processing:p?u.recatalyze:u.catalyzeAction}),p?(0,$.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:p.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:p.targetUsers.slice(0,5).map(e=>(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.keyQuestions.slice(0,3).map(e=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,$.jsx)(`span`,{children:e})]},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.mvpPath.slice(0,3).map((e,t)=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,$.jsx)(`span`,{children:e})]},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.risks.slice(0,3).map(e=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,$.jsx)(`span`,{children:e})]},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.nextActions.slice(0,4).map(e=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,$.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`))})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:u.confidenceLabel.replace(`{{percent}}`,String(Math.round(p.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void S(`helpful`),className:A(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,f?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackHelpfulAria,children:(0,$.jsx)(z,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void S(`not_helpful`),className:A(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,f?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackNotHelpfulAria,children:(0,$.jsx)(se,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,$.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:u.noCatalysisReportHint}),(0,$.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)($e,{className:`size-4 text-accent`,"aria-hidden":!0}),u.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:u.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:c,disabled:s,className:`rounded-lg border border-edge px-2.5 py-1.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,children:s?u.openingChat:u.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:l,disabled:s,className:`rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:u.newThread})]})]}),o.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:o.slice(0,5).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>d(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||u.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:u.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,$.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:u.noThreads})]})]})]})}var qt=[{value:`86400000`,zh:`24 小时`,en:`24 hours`},{value:`604800000`,zh:`7 天`,en:`7 days`},{value:`2592000000`,zh:`30 天`,en:`30 days`}];function Jt({open:e,onOpenChange:t,note:n}){let r=O(e=>e.language)===`zh`,i=r?Zt:Qt,{data:a,mutate:g}=j(e?[`note-shares`,n.id]:null,()=>Qe(n.id)),[y,x]=(0,Q.useState)(new Set),[S,C]=(0,Q.useState)(`86400000`),[E,D]=(0,Q.useState)(``),[k,A]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(null),[L,z]=(0,Q.useState)(null),[B,V]=(0,Q.useState)(!1),[H,U]=(0,Q.useState)(null),W=(0,Q.useMemo)(()=>{let e=new Set;return n.markdown.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^\s)]+)/gi,(t,r,i)=>{try{decodeURIComponent(r)===n.id&&e.add(decodeURIComponent(i))}catch{}return t}),(n.attachments??[]).filter(t=>e.has(t.id))},[n.attachments,n.id,n.markdown]);(0,Q.useEffect)(()=>{e&&(x(new Set(W.map(e=>e.id))),z(null),V(!1),U(null))},[e,W]);let ee=async()=>{P(!0),U(null);try{z((await Ee(n.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...y],ttlMs:Number(S),maxViews:E.trim()?Number(E):null,description:k.trim()||void 0})).payload.shareUrl),await g()}catch(e){U(e instanceof Error?e.message:String(e))}finally{P(!1)}},ne=async(e,t)=>{I(e.id),U(null);try{t===`refresh`?await R(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...y]}):t===`extend`?await te(e.id,864e5):await le(e.id),await g()}catch(e){U(e instanceof Error?e.message:String(e))}finally{I(null)}},re=async e=>{U(null);try{if(!await T(e)){V(!1),U(i.copyFailed);return}V(!0),window.setTimeout(()=>V(!1),1500)}catch{V(!1),U(i.copyFailed)}};return(0,$.jsx)(f,{open:e,onOpenChange:t,children:(0,$.jsxs)(l,{children:[(0,$.jsx)(o,{className:`fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(u,{className:`fixed left-1/2 top-1/2 z-[71] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(d,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(Ke,{className:`size-4`}),i.title]}),(0,$.jsx)(s,{className:`mt-1 text-xs text-fg-muted`,children:i.description})]}),(0,$.jsx)(c,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-fg-muted hover:bg-surface-hover`,"aria-label":i.close,children:(0,$.jsx)(w,{className:`size-4`})})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,$.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-subtle p-4`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.title||i.untitled}),(0,$.jsx)(`p`,{className:`mt-2 line-clamp-4 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.markdown||i.empty}),(0,$.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:i.privateExcluded})]}),W.length>0?(0,$.jsxs)(`section`,{className:`mt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.attachments}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:W.map(e=>(0,$.jsxs)(`label`,{className:`flex items-center gap-3 rounded-lg border border-edge-subtle px-3 py-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:y.has(e.id),onChange:()=>x(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),className:`accent-accent`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.fileName}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Xt(e.size)})]},e.id))})]}):null,(0,$.jsxs)(`section`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.expires,(0,$.jsx)(m,{value:S,onChange:e=>C(e.target.value),children:qt.map(e=>(0,$.jsx)(h,{value:e.value,children:r?e.zh:e.en},e.value))})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.maxViews,(0,$.jsx)(`input`,{type:`number`,min:1,max:1e3,value:E,onChange:e=>D(e.target.value),placeholder:i.unlimited,className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.publicDescription,(0,$.jsx)(`input`,{value:k,onChange:e=>A(e.target.value),className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]})]}),L?(0,$.jsx)(`div`,{className:`mt-5 rounded-lg border border-success/25 bg-success-soft p-3`,children:(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(`input`,{readOnly:!0,value:L,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none`}),(0,$.jsxs)(M,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void re(L),children:[B?(0,$.jsx)(p,{className:`size-4`}):(0,$.jsx)(_,{className:`size-4`}),B?i.copied:i.copy]}),(0,$.jsxs)(M,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>window.open(L,`_blank`,`noopener,noreferrer`),children:[(0,$.jsx)(v,{className:`size-4`}),i.open]})]})}):null,H?(0,$.jsx)(`p`,{className:`mt-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,children:H}):null,(a?.items.length??0)>0?(0,$.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.activeLinks}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:a.items.map(e=>(0,$.jsx)(Yt,{share:e,busy:F===e.id,t:i,onCopy:re,onAction:ne},e.id))})]}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-edge px-5 py-3`,children:[(0,$.jsx)(c,{asChild:!0,children:(0,$.jsx)(M,{type:`button`,variant:`ghost`,children:i.close})}),(0,$.jsxs)(M,{type:`button`,onClick:()=>void ee(),disabled:N,children:[N?(0,$.jsx)(b,{className:`size-4 animate-spin`}):(0,$.jsx)(Ke,{className:`size-4`}),N?i.creating:i.create]})]})]})]})})}function Yt(e){let t=(0,Z.c)(68),{share:n,busy:r,t:i,onCopy:a,onAction:o}=e,s=n.revoked||n.expired,c=s&&`opacity-60`,l;t[0]===c?l=t[1]:(l=A(`rounded-lg border border-edge-subtle p-3`,c),t[0]=c,t[1]=l);let u=n.stale&&!s?i.stale:s?i.inactive:i.active,d;t[2]===u?d=t[3]:(d=(0,$.jsx)(`span`,{children:u}),t[2]=u,t[3]=d);let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`span`,{children:`·`}),t[4]=f):f=t[4];let p=n.maxViews===null?``:` / ${n.maxViews}`,m;t[5]!==n.viewCount||t[6]!==i.views||t[7]!==p?(m=(0,$.jsxs)(`span`,{children:[i.views,` `,n.viewCount,p]}),t[5]=n.viewCount,t[6]=i.views,t[7]=p,t[8]=m):m=t[8];let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(`span`,{children:`·`}),t[9]=h):h=t[9];let g;t[10]===n.expiresAt?g=t[11]:(g=new Date(n.expiresAt).toLocaleDateString(),t[10]=n.expiresAt,t[11]=g);let y;t[12]===g?y=t[13]:(y=(0,$.jsx)(`span`,{children:g}),t[12]=g,t[13]=y);let x;t[14]!==y||t[15]!==d||t[16]!==m?(x=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[d,f,m,h,y]}),t[14]=y,t[15]=d,t[16]=m,t[17]=x):x=t[17];let S;t[18]===n.shareUrl?S=t[19]:(S=(0,$.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[18]=n.shareUrl,t[19]=S);let C;t[20]!==x||t[21]!==S?(C=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[x,S]}),t[20]=x,t[21]=S,t[22]=C):C=t[22];let w;t[23]===r?w=t[24]:(w=r?(0,$.jsx)(b,{className:`size-4 animate-spin text-fg-muted`}):null,t[23]=r,t[24]=w);let T;t[25]!==C||t[26]!==w?(T=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[C,w]}),t[25]=C,t[26]=w,t[27]=T):T=t[27];let E;t[28]!==a||t[29]!==n.shareUrl?(E=()=>void a(n.shareUrl),t[28]=a,t[29]=n.shareUrl,t[30]=E):E=t[30];let D;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(_,{className:`size-3.5`}),t[31]=D):D=t[31];let O;t[32]!==i.copy||t[33]!==E?(O=(0,$.jsxs)(M,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:E,children:[D,i.copy]}),t[32]=i.copy,t[33]=E,t[34]=O):O=t[34];let k;t[35]===n.shareUrl?k=t[36]:(k=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=k);let j;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(v,{className:`size-3.5`}),t[37]=j):j=t[37];let N;t[38]!==i.open||t[39]!==k?(N=(0,$.jsxs)(M,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:k,children:[j,i.open]}),t[38]=i.open,t[39]=k,t[40]=N):N=t[40];let P;t[41]!==r||t[42]!==s||t[43]!==o||t[44]!==n||t[45]!==i.refresh?(P=n.stale&&!s?(0,$.jsxs)(M,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,$.jsx)(we,{className:`size-3.5`}),i.refresh]}):null,t[41]=r,t[42]=s,t[43]=o,t[44]=n,t[45]=i.refresh,t[46]=P):P=t[46];let F;t[47]!==r||t[48]!==s||t[49]!==o||t[50]!==n||t[51]!==i.extend?(F=s?null:(0,$.jsx)(M,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`extend`),children:i.extend}),t[47]=r,t[48]=s,t[49]=o,t[50]=n,t[51]=i.extend,t[52]=F):F=t[52];let I;t[53]!==r||t[54]!==o||t[55]!==n||t[56]!==i.revoke?(I=n.revoked?null:(0,$.jsxs)(M,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,$.jsx)(V,{className:`size-3.5`}),i.revoke]}),t[53]=r,t[54]=o,t[55]=n,t[56]=i.revoke,t[57]=I):I=t[57];let L;t[58]!==O||t[59]!==N||t[60]!==P||t[61]!==F||t[62]!==I?(L=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[O,N,P,F,I]}),t[58]=O,t[59]=N,t[60]=P,t[61]=F,t[62]=I,t[63]=L):L=t[63];let R;return t[64]!==T||t[65]!==l||t[66]!==L?(R=(0,$.jsxs)(`div`,{className:l,children:[T,L]}),t[64]=T,t[65]=l,t[66]=L,t[67]=R):R=t[67],R}function Xt(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}var Zt={title:`分享笔记`,description:`创建一个无需登录即可查看的只读快照。`,close:`关闭`,untitled:`无标题笔记`,empty:`空笔记`,privateExcluded:`不会分享标签、AI 元数据、项目、讨论、历史版本或未引用附件。`,attachments:`包含的附件`,expires:`有效期`,maxViews:`最多查看次数`,unlimited:`不限`,publicDescription:`公开说明(可选)`,create:`创建分享链接`,creating:`创建中…`,copy:`复制`,copied:`已复制`,open:`打开`,activeLinks:`这条笔记的分享`,copyFailed:`无法复制到剪贴板,请手动选择链接并复制。`,stale:`旧版本`,inactive:`已失效`,active:`有效`,views:`查看`,refresh:`更新快照`,extend:`延长 24 小时`,revoke:`撤销`},Qt={title:`Share Note`,description:`Create a read-only snapshot that opens without sign-in.`,close:`Close`,untitled:`Untitled Note`,empty:`Empty Note`,privateExcluded:`Tags, AI metadata, projects, discussions, history, and unreferenced attachments are excluded.`,attachments:`Included attachments`,expires:`Expires`,maxViews:`Maximum views`,unlimited:`Unlimited`,publicDescription:`Public description (optional)`,create:`Create share link`,creating:`Creating…`,copy:`Copy`,copied:`Copied`,open:`Open`,activeLinks:`Shares for this Note`,copyFailed:`Could not copy to the clipboard. Select the link and copy it manually.`,stale:`Older version`,inactive:`Inactive`,active:`Active`,views:`Views`,refresh:`Update snapshot`,extend:`Extend 24 hours`,revoke:`Revoke`},$t=()=>i(()=>import(`./block-editor-BPdSzceB.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65])),en=()=>i(()=>import(`./markdown-editor-nDLmA_LF.js`),__vite__mapDeps([66,1,3,63,5,67])),tn=(0,Q.lazy)(()=>$t().then(e=>({default:e.BlockEditor}))),nn=(0,Q.lazy)(()=>en().then(e=>({default:e.MarkdownEditor})));function rn(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,$.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function an(e){let t=(0,Z.c)(14),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:Fe},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:rt},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:y},t[4]=i.preview,t[5]=s);let c;t[6]!==a||t[7]!==o||t[8]!==s?(c=[a,o,s],t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9];let l=c,u;return t[10]!==n||t[11]!==l||t[12]!==r?(u=(0,$.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg border border-edge p-0.5`,children:l.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(t),onMouseEnter:()=>{t===`wysiwyg`&&$t(),t===`source`&&en()},onFocus:()=>{t===`wysiwyg`&&$t(),t===`source`&&en()},className:A(`inline-flex items-center gap-1 rounded-lg px-2 py-1 text-xs font-medium transition-colors`,n===t?`bg-surface-hover text-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,$.jsx)(a,{className:`size-3.5`,"aria-hidden":!0}),i]},t)})}),t[10]=n,t[11]=l,t[12]=r,t[13]=u):u=t[13],u}function on(e){let t=(0,Z.c)(15),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:s,onOpenSearch:c,autoFocus:l,onAutoFocusConsumed:u}=e,d=a===void 0?!0:a,f=s===void 0?!0:s,p=l===void 0?!1:l,m=O(sn),h;t[0]===m?h=t[1]:(h=E(m),t[0]=m,t[1]=h);let g=h.notes.lightboxClose,_;t[2]!==p||t[3]!==o||t[4]!==f||t[5]!==n||t[6]!==u||t[7]!==r||t[8]!==c||t[9]!==i||t[10]!==d?(_=(0,$.jsx)(cn,{noteId:n,onBack:r,onSaved:i,showBackButton:d,backButtonClassName:o,clearHeaderOnCleanup:f,onOpenSearch:c,autoFocus:p,onAutoFocusConsumed:u}),t[2]=p,t[3]=o,t[4]=f,t[5]=n,t[6]=u,t[7]=r,t[8]=c,t[9]=i,t[10]=d,t[11]=_):_=t[11];let v;return t[12]!==g||t[13]!==_?(v=(0,$.jsx)(ut,{closeLabel:g,children:_}),t[12]=g,t[13]=_,t[14]=v):v=t[14],v}function sn(e){return e.language}function cn({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:o=!0,onOpenSearch:s,autoFocus:c=!1,onAutoFocusConsumed:l}){let u=O(e=>e.language),d=E(u).notes,f=E(u).automations.suggestions,p=a(),m=N(e=>e.resolved)===`dark`,{openImage:h}=ct(),[g,_]=(0,Q.useState)(`wysiwyg`),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(null),[S,w]=(0,Q.useState)(!1),[T,D]=(0,Q.useState)(``),[k,M]=(0,Q.useState)(360),[P,F]=(0,Q.useState)(!1),[L,R]=(0,Q.useState)(!1),[z,B]=(0,Q.useState)(!1),[V,H]=(0,Q.useState)(null),[W,te]=(0,Q.useState)(!1),[ne,re]=(0,Q.useState)(null),G=(0,Q.useRef)(!1),ie=(0,Q.useRef)(!1),oe=(0,Q.useRef)(null),K=(0,Q.useRef)(null),q=(0,Q.useRef)(null),se=(0,Q.useRef)(null),ce=(0,Q.useRef)(null),le=(0,Q.useRef)(null),ue=(0,Q.useRef)(null),de=(0,Q.useRef)(null),fe=(0,Q.useRef)(null),pe=Ve(e=>e.setPageHeader),he=Ve(e=>e.clearPageHeader),{data:J,mutate:Y}=j(e?[`note-detail`,e]:null,()=>Le(e)),{data:_e=[],mutate:ve}=j(e?[`note-threads`,e]:null,()=>it(e),{revalidateOnFocus:!1}),ye=b!==null,be=(0,Q.useCallback)(e=>{H(`${d.refreshFailed}: ${e instanceof Error?e.message:d.quickCaptureFailedHint}`)},[d.quickCaptureFailedHint,d.refreshFailed]);(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&Y().catch(be)};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[Y,e,be]),(0,Q.useEffect)(()=>{G.current=!1,D(``),x(null),y(null),ie.current=!1,fe.current=null},[e]),(0,Q.useEffect)(()=>{!J||G.current||(D(J.title??``),G.current=!0)},[J]),(0,Q.useEffect)(()=>{if(!c||!J||ye||fe.current===e)return;let t=window.requestAnimationFrame(()=>{de.current?.focus(),l?.()});return fe.current=e,()=>window.cancelAnimationFrame(t)},[c,ye,J,e,l]);let xe=J?new Date(J.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,Se=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":d.back,className:A(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,Re,i),children:(0,$.jsx)(X,{className:`size-4`,"aria-hidden":!0})}):null,[i,d.back,t,r]),Ce=(0,Q.useCallback)(t=>{D(t),e&&(se.current=t,K.current&&clearTimeout(K.current),K.current=setTimeout(async()=>{let t=se.current;if(se.current=null,t!==null){w(!0);try{await Me(e,{title:t}),await Y(),n?.()}catch{}finally{w(!1)}}},600))},[e,Y,n]),we=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:A(`flex min-w-0 items-center gap-2`,Re),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:T||xe||void 0,children:T||xe}),S?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:d.saving}):null]}),[d.saving,S,xe,T]),Te=(0,Q.useCallback)(async(t=!1)=>{B(!0),H(null);try{let n=await nt(e,{forceNew:t});await Y(),await ve(),p(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){H(`${d.chatOpenFailedTitle}: ${e instanceof Error?e.message:d.chatOpenFailedMessage}`)}finally{B(!1)}},[Y,ve,p,e,d.chatOpenFailedMessage,d.chatOpenFailedTitle]),Ee=(0,Q.useCallback)(async()=>{R(!0),H(null);try{await Ze(e),await Y()}catch(e){H(`${d.catalysisFailed}: ${e instanceof Error?e.message:d.chatOpenFailedMessage}`)}finally{R(!1)}},[Y,e]),Oe=(0,Q.useCallback)(()=>{y(v===`breakdown`?null:`breakdown`),!J?.aiDeep?.catalysis?.report&&!L&&Ee()},[v,L,Ee,J?.aiDeep?.catalysis?.report]),ke=(0,Q.useCallback)(()=>{let t=b?.markdown??q.current??J?.markdown??``,n=b?.title??T,r=ee([n,t].filter(Boolean).join(`
3
3
 
4
4
  `));return{source:{type:`note`,id:e,title:n||d.titlePlaceholder},text:r,language:ae(r,u)}},[u,d.titlePlaceholder,J?.markdown,e,b,T]),Ae=(0,Q.useCallback)(async()=>{oe.current&&clearTimeout(oe.current),K.current&&clearTimeout(K.current),oe.current=null,K.current=null;let t=q.current,r=se.current;q.current=null,se.current=null;let i={};if(t!==null&&(i.markdown=t),r!==null&&(i.title=r),Object.keys(i).length===0)return J??null;w(!0);try{let t=await Me(e,i);return await Y(t,{revalidate:!1}),n?.(),t}catch(e){return H(`${d.saveFailed}: ${e instanceof Error?e.message:d.saveFailedHint}`),null}finally{w(!1)}},[Y,d.saveFailed,d.saveFailedHint,J,e,n]),Ne=(0,Q.useCallback)(async()=>{H(null);let e=await Ae();e&&(re(e),te(!0))},[Ae]),Pe=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:A(`flex items-center gap-2`,Re),children:[s?(0,$.jsx)(`button`,{type:`button`,onClick:s,"aria-label":d.searchDialogTitle,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(C,{className:`size-4`,"aria-hidden":!0})}):null,(0,$.jsx)(U,{input:ke,labels:{read:d.readAloud,preparing:d.readAloudPreparing,pause:d.readAloudPause,resume:d.readAloudResume,retry:d.readAloudRetry},showLabel:!0}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void Ne(),className:`inline-flex items-center gap-1.5 rounded-lg border border-edge px-2.5 py-1.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:[(0,$.jsx)(Ke,{className:`size-3.5`,"aria-hidden":!0}),u===`zh`?`分享`:`Share`]}),(0,$.jsxs)(`button`,{type:`button`,onClick:Oe,disabled:L,"aria-label":d.catalysisSectionTitle,className:A(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50`,v===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,$.jsx)(I,{className:`size-3.5`,"aria-hidden":!0}),L?d.catalyzing:d.catalyzeButton]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Te(!1),disabled:z,className:A(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,`border border-edge text-fg-muted hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,$.jsx)($e,{className:`size-3.5`,"aria-hidden":!0}),z?d.openingChat:d.openChatButton]}),(0,$.jsx)(an,{mode:g,onModeChange:_,labels:{edit:d.modeEdit,source:d.modeSource,preview:d.modePreview}}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>y(v===`history`?null:`history`),"aria-label":d.history,className:A(`rounded-lg p-1.5 transition-colors`,v===`history`?`bg-accent/10 text-accent`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:(0,$.jsx)(me,{className:`size-4`,"aria-hidden":!0})})]}),[L,Oe,Te,g,d.history,d.modeEdit,d.modePreview,d.modeSource,z,v,s,d.searchDialogTitle,d.readAloud,d.readAloudPause,d.readAloudPreparing,d.readAloudResume,d.readAloudRetry,ke,Ne,u]);(0,Q.useLayoutEffect)(()=>(pe({startExtra:Se,main:J?we:null,end:J?Pe:null}),()=>{o&&he()}),[o,he,Pe,we,Se,J,pe]);let Fe=(0,Q.useCallback)(t=>{e&&(q.current=t,oe.current&&clearTimeout(oe.current),oe.current=setTimeout(async()=>{let t=q.current;if(q.current=null,t!==null){w(!0),H(null);try{await Me(e,{markdown:t}),await Y(),n?.()}catch(e){H(`${d.saveFailed}: ${e instanceof Error?e.message:d.saveFailedHint}`)}finally{w(!1)}}},600))},[e,Y,d.saveFailed,d.saveFailedHint,n]),Ie=(0,Q.useCallback)(t=>{De(e,t.timestamp).then(e=>{e&&x(e)})},[e]),ze=(0,Q.useCallback)(()=>{y(null),x(null)},[]),Be=(0,Q.useCallback)(()=>{y(null),x(null),Y().catch(be),n?.()},[Y,n,be]);if((0,Q.useEffect)(()=>()=>{oe.current&&clearTimeout(oe.current),K.current&&clearTimeout(K.current);let t=q.current,n=se.current;q.current=null,se.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&Me(e,r).catch(()=>void 0)},[e]),J===void 0)return(0,$.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,$.jsx)(`div`,{className:`size-6 animate-spin rounded-full border-2 border-accent border-t-transparent`})});if(J===null)return(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:d.notFoundTitle}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d.notFoundDescription}),(0,$.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-lg border border-edge px-3 py-1.5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:d.back})]});let He=ye?b.title??``:T,Ue=ye?b.markdown??``:J.markdown??``,We=new Date(J.createdAt).getTime(),Ge=Number.isFinite(We)&&Date.now()-We<3600*1e3?(0,$.jsx)(Mt,{title:f.noteCreatedTitle,description:f.noteCreatedDescription,prompt:f.noteCreatedPrompt,coverage:{eventType:`note.created`,source:`notes`,eventPayload:{noteId:e}},variant:`titleAction`,className:`ml-3 hidden max-w-[18rem] shrink-0 md:flex`}):null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`mx-auto flex min-h-0 min-w-0 w-full max-w-[60rem] flex-1 flex-col`,children:[V?(0,$.jsx)(`p`,{className:`mb-3 shrink-0 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:V}):null,(0,$.jsx)(ge,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsx)(ge,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsxs)(`div`,{ref:ce,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel xl:flex-row`,children:[(0,$.jsx)(zt,{noteId:e}),(0,$.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1`,children:ye?(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,children:[He&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:He}),Ue?(0,$.jsx)(je,{noteId:e,content:Ue,className:`opacity-80`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:d.emptyPreview})]}):(0,$.jsxs)($.Fragment,{children:[g===`wysiwyg`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:de,type:`text`,value:T,onChange:e=>Ce(e.target.value),onCompositionStart:()=>{ie.current=!0},onCompositionEnd:()=>{ie.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!ie.current&&!t.isComposing&&(e.preventDefault(),(ce.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:d.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Ge]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(rn,{}),children:(0,$.jsx)(tn,{initialContent:J.markdown??``,onChange:Fe,noteId:e},`wysiwyg-${e}`)})})]}),g===`source`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:de,type:`text`,value:T,onChange:e=>Ce(e.target.value),placeholder:d.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Ge]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(rn,{}),children:(0,$.jsx)(nn,{initialContent:J.markdown??``,onChange:Fe,isDark:m},`source-${e}`)})})]}),g===`preview`&&(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&h(t.currentSrc||t.src,t.alt)},children:[T&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:T}),J.markdown?(0,$.jsx)(je,{noteId:e,content:J.markdown,className:`[&_img]:cursor-zoom-in`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:d.emptyPreview})]})]})})]})]}),(0,$.jsx)(`div`,{ref:le,className:A(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!P&&`transition-[width] duration-300 ease-in-out`),style:{width:v?k:0},children:(0,$.jsxs)(`div`,{ref:ue,className:`flex min-h-0 flex-1 flex-col`,style:{width:k},children:[(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),F(!0);let n=e.clientX,r=k,i=e.pointerId,a=0,o=k,s=k,c=()=>{a=0,s=o,v&&le.current?.style.setProperty(`width`,`${s}px`),ue.current?.style.setProperty(`width`,`${s}px`)},l=e=>{let t=r-(e.clientX-n);o=Math.max(280,Math.min(600,Math.round(t))),a===0&&(a=window.requestAnimationFrame(c))},u=()=>{a!==0&&(window.cancelAnimationFrame(a),c());try{t.releasePointerCapture(i)}catch{}F(!1),M(s),window.removeEventListener(`pointermove`,l),window.removeEventListener(`pointerup`,u),window.removeEventListener(`pointercancel`,u)};window.addEventListener(`pointermove`,l),window.addEventListener(`pointerup`,u),window.addEventListener(`pointercancel`,u)},className:A(`absolute left-0 top-0 z-10 h-full w-2 -translate-x-1/2 cursor-col-resize`,`before:content-[''] before:pointer-events-none before:absolute before:left-1/2 before:top-0 before:h-full before:w-px before:-translate-x-1/2`,`before:bg-transparent before:transition-[background-color] before:duration-150`,`hover:before:bg-edge/65 dark:hover:before:bg-edge/75`,P&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:v===`history`?(0,$.jsx)(Gt,{noteId:e,activeTimestamp:b?.timestamp??null,onSelect:Ie,onClose:ze,onRestored:Be}):v===`breakdown`?(0,$.jsx)(Kt,{noteId:e,note:J??null,catalyzing:L,onCatalyze:Ee,onClose:()=>y(null),noteThreads:_e,openingChat:z,onOpenChat:()=>Te(!1),onOpenNewChat:()=>Te(!0)}):null})]})})]}),ne?(0,$.jsx)(Jt,{open:W,onOpenChange:te,note:ne}):null]})}var ln=3e4;function un(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function dn({placeholder:e,submitLabel:t,actionsLabel:n,imageLabel:r,voiceLabel:i,stopRecordingLabel:a,onCapture:o,onImagePick:s,onVoiceCapture:c,onVoiceError:l,recordingLabel:u,imageDisabled:d=!1,voiceDisabled:f=!1,onDiscussionCapture:p,discussionCaptureLabel:m}){let[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),[x,C]=(0,Q.useState)(0),[w,T]=(0,Q.useState)(!1),E=(0,Q.useRef)(null),D=(0,Q.useRef)(null),O=(0,Q.useRef)(null),k=(0,Q.useRef)([]),j=(0,Q.useRef)(0),M=(0,Q.useRef)(null),N=(0,Q.useRef)(null),P=(0,Q.useCallback)(()=>{M.current&&=(clearInterval(M.current),null),N.current&&=(clearTimeout(N.current),null),O.current?.getTracks().forEach(e=>e.stop()),O.current=null,D.current=null,k.current=[],b(!1),C(0)},[]);(0,Q.useEffect)(()=>()=>P(),[P]);let F=(0,Q.useCallback)(async()=>{let e=D.current;if(!e||e.state!==`recording`)return;T(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-j.current)/1e3)),n=e.mimeType||un()||`audio/webm`,r=new Blob(k.current,{type:n});if(P(),r.size>0&&c){let e=n.includes(`mp4`)?`m4a`:n.includes(`ogg`)?`ogg`:`webm`,i=new File([r],`voice-${Date.now()}.${e}`,{type:n});try{await c(i,t)}finally{T(!1)}return}T(!1)},[P,c]),I=(0,Q.useCallback)(async()=>{if(!(!c||w||y)){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){l?.();return}try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});O.current=e;let t=un(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);D.current=n,k.current=[],j.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&k.current.push(e.data)},n.start(),b(!0),C(0),M.current=setInterval(()=>{C(Math.round((Date.now()-j.current)/1e3))},250),N.current=setTimeout(()=>{F()},ln)}catch{P(),l?.()}}},[P,c,l,y,F,w]),L=(0,Q.useCallback)(async()=>{let e=h.trim();if(!(!e||_)){v(!0),g(``);try{await o(e)}catch{g(e)}finally{v(!1),E.current?.focus()}}},[h,_,o]),R=(0,Q.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),L())},[L]),z=_||w,B=!!(s||c||p);return(0,$.jsxs)(`div`,{className:A(`flex items-center gap-1.5 rounded-2xl border border-edge bg-surface-panel p-2 shadow-float dark:shadow-elevated`,`focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,y&&`border-danger ring-1 ring-danger/40`),"aria-busy":z,children:[y?(0,$.jsx)(`button`,{type:`button`,onClick:()=>void F(),disabled:w,className:`shrink-0 rounded-lg bg-danger-soft p-2 text-danger transition-colors hover:bg-danger-soft disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":a,title:a,"aria-pressed":`true`,children:(0,$.jsx)(ne,{className:`size-4 fill-current`,"aria-hidden":!0})}):B?(0,$.jsxs)(Je,{children:[(0,$.jsx)(Ie,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,disabled:z,className:`shrink-0 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":n,title:n,children:(0,$.jsx)(S,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(He,{children:(0,$.jsxs)(Ae,{side:`top`,align:`start`,sideOffset:8,className:`z-50 min-w-44 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[s?(0,$.jsxs)(_e,{disabled:d,onSelect:s,className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,$.jsx)(W,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),r]}):null,c?(0,$.jsxs)(_e,{disabled:f,onSelect:()=>void I(),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,$.jsx)(tt,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i]}):null,p?(0,$.jsxs)(_e,{onSelect:p,className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,$.jsx)(he,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),m]}):null]})})]}):null,y?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:u.replace(`{{seconds}}`,String(x))}):(0,$.jsx)(`textarea`,{ref:E,value:h,onChange:e=>g(e.target.value),onKeyDown:R,placeholder:e,"aria-label":e,rows:1,disabled:z,className:`max-h-28 min-h-8 flex-1 resize-none overflow-y-auto bg-transparent py-1.5 text-sm leading-5 text-fg placeholder:text-fg-muted focus:outline-none disabled:opacity-60`,style:{fieldSizing:`content`}}),(0,$.jsx)(`button`,{type:`button`,disabled:!h.trim()||z||y,onClick:()=>void L(),"aria-label":t,title:t,className:A(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,h.trim()&&!z&&!y?`bg-accent text-white hover:bg-accent-hover`:`text-fg-disabled`),children:(0,$.jsx)(J,{className:`size-4`,"aria-hidden":!0})})]})}var fn={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},pn=240,mn=320,hn=520,gn=560;function _n(e){if(globalThis.localStorage===void 0)return mn;try{let t=globalThis.localStorage.getItem(e);if(!t)return mn;let n=Number(t);return Number.isFinite(n)?n:mn}catch{return mn}}function vn(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var yn={thought:K,todo:ot,voice:tt,media:W,bookmark:G,mixed:K,task:ot};function bn(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function xn(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function Sn(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function Cn({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:i=!0,projectId:p,listTitle:g,listDescription:_,emptyText:v,emptyDescription:y,listWidthStorageKey:b=`xopc.notes.listWidth`}){let x=O(e=>e.language),T=E(x).notes,M=!!k(e=>e.token),[N,P]=(0,Q.useReducer)(ie,fn),[F,I]=(0,Q.useState)(!1),[R,z]=(0,Q.useState)(``),[B,V]=(0,Q.useState)(0),[H,U]=(0,Q.useState)(()=>_n(b)),[W,ee]=(0,Q.useState)(!1),[te,ne]=(0,Q.useState)(!1),[G,ae]=(0,Q.useState)(!1),[oe,q]=(0,Q.useState)(null),[se,ce]=(0,Q.useState)(null),le=(0,Q.useRef)(null),de=(0,Q.useRef)(null),[fe]=(0,Q.useState)(()=>Date.now()),pe=a(),me=(0,Q.useCallback)(e=>{let t=le.current?.clientWidth??window.innerWidth,n=Math.max(pn,t-gn);return Math.max(pn,Math.min(Math.min(hn,n),e))},[]),he=(0,Q.useCallback)(e=>{let t=me(e);U(t),vn(b,t)},[me,b]);(0,Q.useLayoutEffect)(()=>{U(e=>me(e))},[me]);let{data:J,mutate:Y,isLoading:ge}=j((0,Q.useMemo)(()=>M?[`notes-list`,p,N.statusFilter,N.kindFilter,N.pinnedOnly]:null,[M,p,N.statusFilter,N.kindFilter,N.pinnedOnly]),()=>ve({status:N.statusFilter===`all`?void 0:N.statusFilter,kind:N.kindFilter===`all`?void 0:N.kindFilter,projectId:p,pinned:N.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),_e=ge&&!J,ye=J?.items??[],be=J?.total??0,xe=R.trim(),{data:Se,isLoading:we}=j(M&&F&&xe?[`notes-search`,p,xe]:null,()=>ve({search:xe,projectId:p,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),X=Se?.items??[],Te=e?ye.some(t=>t.id===e):!0;(0,Q.useEffect)(()=>{V(0)},[xe]),(0,Q.useEffect)(()=>{B>=X.length&&V(Math.max(0,X.length-1))},[B,X.length]),(0,Q.useEffect)(()=>{let e=()=>{Y().catch(e=>{q(`${T.refreshFailed}: ${e instanceof Error?e.message:T.quickCaptureFailedHint}`)})};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[Y,T.quickCaptureFailedHint,T.refreshFailed]);let Ee=Ve(e=>e.setPageHeader),De=Ve(e=>e.clearPageHeader),ke=T.noteCount.replace(`{{count}}`,String(be)),Ae=!r&&be===0&&_?_:ke,je=T.searchDialogTitle,Ne=T.searchClose,Pe=T.searchClear,Fe=(0,Q.useMemo)(()=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>I(!0),className:A(`inline-flex h-9 items-center gap-2 rounded-lg border border-edge bg-surface-base px-3 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,Re),"aria-label":je,children:[(0,$.jsx)(C,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:je})]}),[je]);(0,Q.useLayoutEffect)(()=>{if(n)return M?(Ee({startExtra:null,main:(0,$.jsxs)(`div`,{className:A(`flex min-w-0 items-center gap-2`,Re),children:[(0,$.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:g??T.title}),ke?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:ke}):null]}),end:Fe}),()=>De()):(De(),()=>De())},[De,M,Fe,g,n,T.title,ke,e,Ee]);let Ie=(0,Q.useMemo)(()=>({justNow:T.justNow,minutesAgo:T.minutesAgo,today:T.today,yesterday:T.yesterday,daysAgo:T.daysAgo,locale:D(x)}),[x,T.justNow,T.minutesAgo,T.today,T.yesterday,T.daysAgo]),Le=(0,Q.useMemo)(()=>[{id:`recent`,label:T.viewRecent,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:T.filterInbox,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:T.pinned,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:T.viewTasks,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:T.kindVoice,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:T.kindMedia,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:T.kindBookmark,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:T.filterProcessed,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:T.filterArchived,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[T.filterArchived,T.filterInbox,T.filterProcessed,T.kindBookmark,T.kindMedia,T.kindVoice,T.pinned,T.viewRecent,T.viewTasks]),ze=Le.find(e=>xn(N,e))??Le[0],Be=g??ze.label,He=(0,Q.useCallback)(async e=>{q(null);try{let n=p?await Ce({markdown:e,kind:`thought`,projectId:p,channel:`web`}):await ue(e,`web`);await Y(),pe(Sn(t,n.id))}catch(e){throw q(`${T.quickCaptureFailed}: ${e instanceof Error?e.message:T.quickCaptureFailedHint}`),e}},[t,Y,T.quickCaptureFailed,T.quickCaptureFailedHint,pe,p]),Ue=(0,Q.useCallback)(async()=>{if(!G){ae(!0),q(null);try{let e=await Ce({markdown:``,kind:`thought`,projectId:p,channel:`web`});P({type:`patch`,patch:fn}),await Y(),ce(e.id),pe(Sn(t,e.id))}catch(e){q(`${T.createBlankFailed}: ${e instanceof Error?e.message:T.createBlankFailedHint}`)}finally{ae(!1)}}},[t,G,Y,T.createBlankFailed,T.createBlankFailedHint,pe,p]),Ge=(0,Q.useCallback)(()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let t=e.files?.[0];if(t)try{q(null),await L(t,`web`),await Y()}catch(e){q(`${T.imageUploadFailed}: ${e instanceof Error?e.message:T.imageUploadFailedHint}`)}},e.click()},[Y,T.imageUploadFailed,T.imageUploadFailedHint]),Ke=(0,Q.useCallback)(async(e,t)=>{try{q(null),await et(e,t,`web`),await Y()}catch(e){q(`${T.voiceUploadFailed}: ${e instanceof Error?e.message:T.voiceUploadFailedHint}`)}},[Y,T.voiceUploadFailed,T.voiceUploadFailedHint]),qe=(0,Q.useCallback)(()=>{q(`${T.voiceCaptureFailed}: ${T.voiceCaptureFailedHint}`)},[T.voiceCaptureFailed,T.voiceCaptureFailedHint]),Je=(0,Q.useCallback)(async(e,t)=>{q(null);try{await Me(e,{pinned:t}),await Y()}catch(e){q(`${T.actionFailed}: ${e instanceof Error?e.message:T.quickCaptureFailedHint}`)}},[Y,T.actionFailed,T.quickCaptureFailedHint]),Ye=(0,Q.useCallback)(async e=>{q(null);try{await Me(e,{status:`archived`}),await Y()}catch(e){q(`${T.actionFailed}: ${e instanceof Error?e.message:T.quickCaptureFailedHint}`)}},[Y,T.actionFailed,T.quickCaptureFailedHint]),Xe=(0,Q.useCallback)(async e=>{q(null);try{await We(e),await Y()}catch(e){q(`${T.actionFailed}: ${e instanceof Error?e.message:T.quickCaptureFailedHint}`)}},[Y,T.actionFailed,T.quickCaptureFailedHint]),Ze=(0,Q.useCallback)(e=>{pe(Sn(t,e))},[t,pe]),Qe=(0,Q.useCallback)(e=>{pe(Sn(t,e)),I(!1)},[t,pe]),$e=(0,Q.useCallback)(e=>{if(X.length){if(e.key===`ArrowDown`)e.preventDefault(),V(e=>Math.min(X.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),V(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=X[B]??X[0];t&&Qe(t.id)}}},[B,Qe,X]),tt=(0,Q.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=de.current;t.setPointerCapture(e.pointerId),ee(!0);let r=le.current?.clientWidth??window.innerWidth,i=Math.max(pn,r-gn),a=Math.min(hn,i),o=e=>Math.max(pn,Math.min(a,e)),s=e.clientX,c=o(H),l=e.pointerId,u=0,d=c,f=c;n&&(n.style.transition=`none`,n.style.width=`${c}px`);let p=()=>{u=0,f=d,n&&(n.style.width=`${f}px`)},m=e=>{d=o(c+e.clientX-s),u===0&&(u=window.requestAnimationFrame(p))},h=()=>{u!==0&&(window.cancelAnimationFrame(u),p());try{t.releasePointerCapture(l)}catch{}ee(!1),le.current?.style.setProperty(`--notes-list-width`,`${f}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),U(f),vn(b,f),window.removeEventListener(`pointermove`,m),window.removeEventListener(`pointerup`,h),window.removeEventListener(`pointercancel`,h)};window.addEventListener(`pointermove`,m),window.addEventListener(`pointerup`,h),window.addEventListener(`pointercancel`,h)},[b,H]);(0,Q.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),Ue())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Ue]);let nt=(0,Q.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),he(H-16)):e.key===`ArrowRight`?(e.preventDefault(),he(H+16)):e.key===`Home`?(e.preventDefault(),he(pn)):e.key===`End`&&(e.preventDefault(),he(hn))},[he,H]);return M?(0,$.jsxs)(`div`,{ref:le,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-base`,style:{"--notes-list-width":`${H}px`},children:[(0,$.jsxs)(`section`,{ref:de,className:A(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden border-r border-edge bg-surface-rail`,!W&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,te?`lg:w-0 lg:min-w-0 lg:max-w-0 lg:pointer-events-none`:`lg:w-[var(--notes-list-width)]`,e&&`hidden lg:flex`),"aria-hidden":te?!0:void 0,children:[(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:[oe?(0,$.jsx)(`p`,{className:`mb-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:oe}):null,(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r?(0,$.jsx)(m,{value:ze.id,onChange:e=>{let t=Le.find(t=>t.id===e.target.value);t&&P({type:`patch`,patch:t.patch})},className:`-ml-1 h-7 w-full max-w-44 rounded-lg border border-transparent bg-transparent px-2 text-sm font-semibold text-fg transition-colors hover:border-edge hover:bg-surface-base focus:border-accent focus:bg-surface-base focus:outline-none focus:ring-1 focus:ring-accent`,"aria-label":T.libraryTitle,children:Le.map(e=>(0,$.jsx)(h,{value:e.id,children:e.label},e.id))}):(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Be}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:Ae})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>ne(!0),className:`hidden size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":T.collapseNotesList,title:T.collapseNotesList,children:(0,$.jsx)(Oe,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:Ue,disabled:G,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":T.createBlankNote,title:T.createBlankShortcut,children:(0,$.jsx)(S,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>I(!0),className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":T.searchDialogTitle,title:T.searchDialogTitle,children:(0,$.jsx)(C,{className:`size-4`,"aria-hidden":!0})})]})]})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 py-3 [scrollbar-gutter:stable]`,children:_e?(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3,4].map(e=>(0,$.jsx)(`div`,{className:`h-20 animate-pulse rounded-lg bg-surface-hover`},e))}):ye.length===0?(0,$.jsxs)(`div`,{className:`flex h-full min-h-48 flex-col items-center justify-center gap-2 px-6 py-10 text-center`,children:[(0,$.jsx)(`span`,{className:`mb-1 inline-flex size-12 items-center justify-center rounded-xl border border-edge-subtle bg-surface-base text-fg-muted`,children:(0,$.jsx)(K,{className:`size-6`,"aria-hidden":!0})}),(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:e&&!Te?T.noteOutsideCurrentView:v??T.noNotes}),e&&!Te?null:(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:y??T.noNotesDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!Te?(0,$.jsx)(`div`,{className:`mb-2 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 text-xs leading-5 text-fg-muted`,children:T.noteOutsideCurrentView}):null,ye.map((t,n)=>{let r=n>0?vt(ye[n-1].createdAt):null;return(0,$.jsxs)(`div`,{children:[vt(t.createdAt)!==r&&(0,$.jsx)(`div`,{className:A(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:_t(t.createdAt,fe,Ie)}),(0,$.jsx)(wt,{note:t,selected:t.id===e,onPress:Ze,onPin:Je,onArchive:Ye,onDelete:Xe,timeLabels:Ie,labels:{pin:T.pin,unpin:T.unpin,archive:T.archive,delete:T.delete,actions:T.noteActions,imageNote:T.imageNote,noText:T.noText}})]},t.id)})]})}),(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(dn,{placeholder:T.quickCapturePlaceholder,submitLabel:T.quickCaptureSubmit,actionsLabel:T.quickCaptureActions,imageLabel:T.quickCaptureImage,voiceLabel:T.quickCaptureVoice,stopRecordingLabel:T.stopRecording,onCapture:He,onImagePick:i?Ge:void 0,onVoiceCapture:i?Ke:void 0,onVoiceError:qe,recordingLabel:T.recording,discussionCaptureLabel:T.discussionCapture.title,onDiscussionCapture:()=>re(p)})})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":T.resizeNotesList,"aria-valuemin":pn,"aria-valuemax":hn,"aria-valuenow":Math.round(H),tabIndex:0,onPointerDown:tt,onDoubleClick:()=>he(mn),onKeyDown:nt,title:T.resizeNotesList,className:A(`group relative z-10 hidden shrink-0 cursor-col-resize touch-none select-none items-center justify-center bg-surface-base lg:flex`,`lg:transition-[width,opacity] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,te?`lg:w-0 lg:opacity-0 lg:pointer-events-none`:`lg:w-2 lg:opacity-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-0`),children:(0,$.jsx)(`span`,{"aria-hidden":!0,className:A(`h-full w-px bg-edge transition-[background-color,transform] duration-150`,`group-hover:bg-accent/70 group-focus-visible:bg-accent`,W&&`bg-accent scale-x-[2]`)})}),(0,$.jsxs)(`section`,{className:A(`relative min-w-0 flex-1 bg-surface-base`,!e&&`hidden lg:flex`),children:[te?(0,$.jsx)(`button`,{type:`button`,onClick:()=>ne(!1),className:`absolute left-3 top-3 z-10 hidden size-8 items-center justify-center rounded-lg border border-edge bg-surface-base text-fg-muted shadow-surface transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":T.expandNotesList,title:T.expandNotesList,children:(0,$.jsx)(Oe,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,$.jsx)(on,{noteId:e,onBack:()=>pe(t),onSaved:()=>{Y().catch(e=>{q(`${T.refreshFailed}: ${e instanceof Error?e.message:T.quickCaptureFailedHint}`)})},backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>I(!0),autoFocus:e===se,onAutoFocusConsumed:()=>ce(null)}):(0,$.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 items-center justify-center px-8 text-center`,children:(0,$.jsxs)(`div`,{className:`max-w-sm`,children:[(0,$.jsx)(K,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:T.emptyEditorTitle}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:T.emptyEditorDescription}),(0,$.jsxs)(`button`,{type:`button`,onClick:Ue,disabled:G,className:`mt-5 inline-flex items-center gap-2 rounded-lg bg-accent px-3 py-2 text-sm font-medium text-white transition-colors hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,$.jsx)(S,{className:`size-4`,"aria-hidden":!0}),G?T.creatingBlankNote:T.createBlankNote]})]})})]}),(0,$.jsx)(f,{open:F,onOpenChange:I,children:(0,$.jsxs)(l,{children:[(0,$.jsx)(o,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(u,{className:`fixed left-1/2 top-24 z-[90] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(d,{className:`text-sm font-semibold text-fg`,children:je}),(0,$.jsx)(s,{className:`sr-only`,children:T.searchPlaceholder}),(0,$.jsx)(c,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":Ne,children:(0,$.jsx)(w,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(C,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`input`,{type:`search`,value:R,onChange:e=>z(e.target.value),onKeyDown:$e,placeholder:T.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-10 text-sm text-fg placeholder:text-fg-muted focus:border-accent focus:outline-none focus:ring-1 focus:ring-accent`}),R?(0,$.jsx)(`button`,{type:`button`,onClick:()=>z(``),className:`absolute right-2 top-1/2 inline-flex size-7 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Pe,children:(0,$.jsx)(w,{className:`size-3.5`,"aria-hidden":!0})}):null]}),(0,$.jsx)(`div`,{className:`mt-4 max-h-[min(28rem,calc(100vh-14rem))] overflow-y-auto [scrollbar-gutter:stable]`,children:xe?we&&!Se?(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3].map(e=>(0,$.jsx)(`div`,{className:`h-16 animate-pulse rounded-lg bg-surface-hover`},e))}):X.length===0?(0,$.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,$.jsx)(K,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:T.searchNoResults}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:T.searchNoResultsDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`p`,{className:`px-2 pb-1 text-xs text-fg-muted`,children:T.searchResultsCount.replace(`{{count}}`,String(Se?.total??X.length))}),X.map((e,t)=>{let n=yn[e.kind]||K,r=bn(e,{imageNote:T.imageNote,noText:T.noText});return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Qe(e.id),onMouseEnter:()=>V(t),className:A(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===B?`bg-surface-active`:`hover:bg-surface-hover`),children:[(0,$.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title||r}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:gt(e.updatedAt,fe,Ie)})]}),e.title?(0,$.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:r}):null,e.tags?.length?(0,$.jsx)(`span`,{className:`mt-1 flex min-w-0 flex-wrap gap-1`,children:e.tags.slice(0,3).map(e=>(0,$.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e))}):null]})]},e.id)})]}):(0,$.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,$.jsx)(C,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:T.searchEmptyTitle}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:T.searchEmptyDescription})]})})]})]})]})})]}):(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,$.jsx)(K,{className:`size-10 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:T.needToken})]})}export{ct as n,Cn as t};