@xopcai/xopc 0.0.221 → 0.0.222

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 (135) 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-B8SBTGg3.js → agent-avatar-dicebear-DsR_2U9-.js} +1 -1
  4. package/dist/gateway/static/root/assets/agents-DijFbC4G.js +68 -0
  5. package/dist/gateway/static/root/assets/{app-management-settings-panel-BtmPXaqu.js → app-management-settings-panel-BCzVX09V.js} +1 -1
  6. package/dist/gateway/static/root/assets/{appearance-settings-t7HoJyNN.js → appearance-settings-DgSpwqQI.js} +1 -1
  7. package/dist/gateway/static/root/assets/{apps-page-DJ_Dsb1j.js → apps-page-BFAmf9hq.js} +1 -1
  8. package/dist/gateway/static/root/assets/{attachment-load-CsLXzas8.js → attachment-load-BQHcAR6J.js} +1 -1
  9. package/dist/gateway/static/root/assets/{automations-page-D-zgoAKz.js → automations-page-CswK3HFb.js} +1 -1
  10. package/dist/gateway/static/root/assets/automations-workspace-B8us5JBf.js +6 -0
  11. package/dist/gateway/static/root/assets/{binary-plugins-B-MjP_22.js → binary-plugins-BlpyTJ1b.js} +1 -1
  12. package/dist/gateway/static/root/assets/{block-editor-i4CfDqLG.js → block-editor-C3mwGsms.js} +4 -4
  13. package/dist/gateway/static/root/assets/browser-settings-page-BeBd17-3.js +8 -0
  14. package/dist/gateway/static/root/assets/{browser-workflows-page-EEFHUm1i.js → browser-workflows-page-CZNOOQY4.js} +2 -2
  15. package/dist/gateway/static/root/assets/capabilities-settings-panel-Bv0z3KRq.js +7 -0
  16. package/dist/gateway/static/root/assets/capability-presets-settings-panel-BczD-pWE.js +3 -0
  17. package/dist/gateway/static/root/assets/{channels-settings-Je-9a5ZC.js → channels-settings-2KQYq6xl.js} +1 -1
  18. package/dist/gateway/static/root/assets/{chat-terminal-dock-DT-OFl4r.js → chat-terminal-dock-2fpzufzt.js} +1 -1
  19. package/dist/gateway/static/root/assets/connectors-page-PB1boaNy.js +2 -0
  20. package/dist/gateway/static/root/assets/{cron-expression-MZ_AJqrm.js → cron-expression-VePLfPUR.js} +1 -1
  21. package/dist/gateway/static/root/assets/{date-picker-Bv9hZLuD.js → date-picker-CJegmPTJ.js} +1 -1
  22. package/dist/gateway/static/root/assets/{dependency-picker-D-6oO_Vk.js → dependency-picker-B2o9unBk.js} +1 -1
  23. package/dist/gateway/static/root/assets/{desktop-pet-CiI5caKj.js → desktop-pet-BH4Np-ay.js} +1 -1
  24. package/dist/gateway/static/root/assets/{desktop-pet-settings-DhkSOy4K.js → desktop-pet-settings-Duu3ctxD.js} +1 -1
  25. package/dist/gateway/static/root/assets/{directory-picker-path-field-C4s4Pz8I.js → directory-picker-path-field-BBCUZOg2.js} +1 -1
  26. package/dist/gateway/static/root/assets/{extension-debug-page-DE7J1-6W.js → extension-debug-page-DS_o3F97.js} +1 -1
  27. package/dist/gateway/static/root/assets/{extension-page-DSnACD7E.js → extension-page-BTLBZdCq.js} +1 -1
  28. package/dist/gateway/static/root/assets/{extension-settings-page-Dk7k2Pok.js → extension-settings-page-KTGrYbgk.js} +1 -1
  29. package/dist/gateway/static/root/assets/{gateway-config-api-IOA1OlHx.js → gateway-config-api-D3YJVfzY.js} +1 -1
  30. package/dist/gateway/static/root/assets/{gateway-settings-FX7QsgSQ.js → gateway-settings-B8--s3yC.js} +1 -1
  31. package/dist/gateway/static/root/assets/heartbeat-settings-5YQ5BUwp.js +1 -0
  32. package/dist/gateway/static/root/assets/home-page-DfIVWJl3.js +1 -0
  33. package/dist/gateway/static/root/assets/{index-Dcj5KJRg.css → index-BXGC3VFm.css} +1 -1
  34. package/dist/gateway/static/root/assets/{index-EvA8c7fo.js → index-jqDCfet4.js} +47 -47
  35. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BjYiM4xq.js → keyboard-shortcuts-settings-D-Ib-suu.js} +1 -1
  36. package/dist/gateway/static/root/assets/local-app-workbench-page-CAb0odzu.js +2 -0
  37. package/dist/gateway/static/root/assets/{local-apps-page-7DHvwSgA.js → local-apps-page-Bsy1lvAc.js} +1 -1
  38. package/dist/gateway/static/root/assets/logs-page-CFxKbDZl.js +2 -0
  39. package/dist/gateway/static/root/assets/{management-settings-BSxppo9Z.js → management-settings-D-akydG4.js} +1 -1
  40. package/dist/gateway/static/root/assets/{markdown-split-D4oDjZtl.js → markdown-split-DHH4Cu2i.js} +1 -1
  41. package/dist/gateway/static/root/assets/{media-plugins-BPNTGROA.js → media-plugins-BwHtUXkj.js} +1 -1
  42. package/dist/gateway/static/root/assets/{notes-page-DU5tKPTq.js → notes-page-BxM1p6hz.js} +1 -1
  43. package/dist/gateway/static/root/assets/notes-workbench-BGjEC89c.js +4 -0
  44. package/dist/gateway/static/root/assets/{product-open-page-CPoQvD6P.js → product-open-page-DrfWH1ir.js} +1 -1
  45. package/dist/gateway/static/root/assets/project-detail-page-Dj9kEQwg.js +1 -0
  46. package/dist/gateway/static/root/assets/{projects-page-CitO1LMc.js → projects-page-CBRy5Ezz.js} +1 -1
  47. package/dist/gateway/static/root/assets/remote-access-hub-DSwz9RBh.js +1 -0
  48. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-xqnWcvIv.js → runtime-tools-settings-panel-DF7syQRd.js} +1 -1
  49. package/dist/gateway/static/root/assets/{schema-form-CuIDPYu6.js → schema-form-BQ_qRIsM.js} +1 -1
  50. package/dist/gateway/static/root/assets/sessions-page-WtattyVX.js +1 -0
  51. package/dist/gateway/static/root/assets/settings-advanced-gate-CNAz_q1F.js +1 -0
  52. package/dist/gateway/static/root/assets/{settings-form-section-DkAv9ncE.js → settings-form-section-BBHGOQHU.js} +1 -1
  53. package/dist/gateway/static/root/assets/{settings-loading-skeleton-BJUQiEKb.js → settings-loading-skeleton-CiwjP2-b.js} +1 -1
  54. package/dist/gateway/static/root/assets/{settings-page-KHRbLwmw.js → settings-page-Rl9waapk.js} +1 -1
  55. package/dist/gateway/static/root/assets/setup-status-panel-CNo4Ajhn.js +1 -0
  56. package/dist/gateway/static/root/assets/{share-preview-page-WCVtJ3sX.js → share-preview-page-B7PI3yZ6.js} +1 -1
  57. package/dist/gateway/static/root/assets/shares-settings-DpOH0zWB.js +1 -0
  58. package/dist/gateway/static/root/assets/{skill-reload-api-C_4cG30x.js → skill-reload-api-BOf4xCat.js} +1 -1
  59. package/dist/gateway/static/root/assets/{skills-page-CKhR9J81.js → skills-page-YbtR_zEU.js} +1 -1
  60. package/dist/gateway/static/root/assets/{skills-page.utils-AYX-e5sD.js → skills-page.utils-DTmx2Zza.js} +1 -1
  61. package/dist/gateway/static/root/assets/{system-settings-panel-IIF-K9ML.js → system-settings-panel-BZDJcKdS.js} +1 -1
  62. package/dist/gateway/static/root/assets/task-detail-page-DrMX5Yhj.js +1 -0
  63. package/dist/gateway/static/root/assets/{use-autosave-DcktF1j1.js → use-autosave-Be9aR9qA.js} +1 -1
  64. package/dist/gateway/static/root/assets/user-context-page-ewIK2ddC.js +1 -0
  65. package/dist/gateway/static/root/assets/{voice-api-key-field-BMkNTHHE.js → voice-api-key-field-IMc3Ua6C.js} +1 -1
  66. package/dist/gateway/static/root/assets/{work-discovery-overlay-DVoiXekA.js → work-discovery-overlay-TC-xQenr.js} +1 -1
  67. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Cw4LQjuM.js → workflow-run-setup-panel-B2auxcRv.js} +2 -2
  68. package/dist/gateway/static/root/assets/workflows-page-Bdn82kFQ.js +5 -0
  69. package/dist/gateway/static/root/index.html +2 -2
  70. package/dist/package.js +1 -1
  71. package/dist/src/agent/agent-manager.js +4 -4
  72. package/dist/src/agent/embedded/model-runtime.js +1 -1
  73. package/dist/src/agent/embedded/run-for-session.js +1 -1
  74. package/dist/src/agent/image/tool-model-config.js +1 -1
  75. package/dist/src/agent/ipc/inbox.js +1 -1
  76. package/dist/src/agent/memory/create-memory-manager.js +1 -1
  77. package/dist/src/agent/service.js +2 -2
  78. package/dist/src/agent/session/session-inspector.js +1 -1
  79. package/dist/src/agent/skills/hub-lock.js +1 -1
  80. package/dist/src/agent/tasks/task-judge-service.js +3 -3
  81. package/dist/src/agent-runtime/index.js +1 -1
  82. package/dist/src/agent-runtime/runtime-profile.js +1 -1
  83. package/dist/src/ai-assist/text-assist.js +1 -1
  84. package/dist/src/auth/credentials.js +2 -2
  85. package/dist/src/auth/profiles/store.js +1 -1
  86. package/dist/src/auth/sync-provider-auth.js +2 -2
  87. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  88. package/dist/src/channels/attachments/voice-stt-webchat.js +20 -3
  89. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  90. package/dist/src/cli/commands/models.js +1 -1
  91. package/dist/src/config/agent-profile.js +1 -1
  92. package/dist/src/config/index.js +4 -4
  93. package/dist/src/config/loader.js +1 -1
  94. package/dist/src/config/models-json.js +1 -1
  95. package/dist/src/connectors/learning-coordinator.js +3 -19
  96. package/dist/src/extensions/lockfile.js +1 -1
  97. package/dist/src/gateway/agents-admin.js +2 -2
  98. package/dist/src/gateway/file-path-classifier.js +1 -1
  99. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  100. package/dist/src/gateway/hono/routes/models.js +1 -1
  101. package/dist/src/gateway/hono/routes/voice.js +8 -1
  102. package/dist/src/gateway/hono/routes/workflows.js +2 -2
  103. package/dist/src/gateway/service/config-coordinator.js +1 -1
  104. package/dist/src/gateway/service.js +9 -9
  105. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  106. package/dist/src/providers/index.js +2 -2
  107. package/dist/src/providers/model-registry.js +1 -1
  108. package/dist/src/providers/register-runtime-providers.js +1 -1
  109. package/dist/src/tui/tui-startup-resources.js +1 -1
  110. package/dist/src/tui/tui.js +1 -1
  111. package/dist/src/voice/audio/normalize.d.ts +7 -0
  112. package/dist/src/voice/audio/normalize.js +30 -4
  113. package/dist/src/voice/local/runtime-worker.js +26 -6
  114. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  115. package/package.json +7 -13
  116. package/dist/gateway/static/root/assets/agents-Brs2-m6t.js +0 -68
  117. package/dist/gateway/static/root/assets/automations-workspace-DehLRXfd.js +0 -6
  118. package/dist/gateway/static/root/assets/browser-settings-page-C3QIO4Ti.js +0 -8
  119. package/dist/gateway/static/root/assets/capabilities-settings-panel-BHhUp7FW.js +0 -7
  120. package/dist/gateway/static/root/assets/capability-presets-settings-panel-DoClNVLz.js +0 -3
  121. package/dist/gateway/static/root/assets/connectors-page-D8z9Trw4.js +0 -2
  122. package/dist/gateway/static/root/assets/heartbeat-settings-D5CGVyci.js +0 -1
  123. package/dist/gateway/static/root/assets/home-page-DzfZFZx5.js +0 -1
  124. package/dist/gateway/static/root/assets/local-app-workbench-page-hPyTaVYU.js +0 -2
  125. package/dist/gateway/static/root/assets/logs-page-DW0xMKWP.js +0 -2
  126. package/dist/gateway/static/root/assets/notes-workbench-D669d98r.js +0 -4
  127. package/dist/gateway/static/root/assets/project-detail-page-CpsQ9PTA.js +0 -1
  128. package/dist/gateway/static/root/assets/remote-access-hub-C9-bL4V6.js +0 -1
  129. package/dist/gateway/static/root/assets/sessions-page-CPSARi4y.js +0 -1
  130. package/dist/gateway/static/root/assets/settings-advanced-gate-BxT80Fmr.js +0 -1
  131. package/dist/gateway/static/root/assets/setup-status-panel-C8jd20Db.js +0 -1
  132. package/dist/gateway/static/root/assets/shares-settings-DrQ_cOXh.js +0 -1
  133. package/dist/gateway/static/root/assets/task-detail-page-CYjsecEr.js +0 -1
  134. package/dist/gateway/static/root/assets/user-context-page-Cy1D2hkt.js +0 -1
  135. package/dist/gateway/static/root/assets/workflows-page-DKKH1_Yt.js +0 -5
@@ -1,2 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{p as i}from"./chunk-KS7C4IRE-BaASWQor.js";import{d as a,f as o,n as s,p as c,r as l,u}from"./popover-select-BzdnTy3h.js";import{t as d}from"./download-Dk-ZjtO6.js";import{t as f}from"./search-DA7gz22f.js";import{t as p}from"./x-B_N4OPjy.js";import{t as m}from"./cn-JdwAhgNB.js";import{t as h}from"./button-CSEbl4zT.js";import{o as g,t as _}from"./form-field-width-DJw_jULe.js";import{t as v}from"./copy-to-clipboard-HOJ79TWv.js";import{t as y}from"./messages-kx5W39dO.js";import{l as b,n as x,r as S,s as C}from"./locale-store-iKjqemWG.js";import{i as w,o as T,s as E}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{a as D,n as O,o as k,r as A,s as j,t as M}from"./dist-BPoKqzeH.js";import{Ca as N,Kc as P,Sc as F,Us as I,Vn as L,Ya as R,ao as z,gl as B,kl as ee,ma as te,qc as V,tl as H,ys as U}from"./index-EvA8c7fo.js";var W=e(t(),1),G=n();function K(e){let t=new URLSearchParams;if(!e)return``;e.level?.length&&t.set(`level`,e.level.join(`,`)),e.from&&t.set(`from`,e.from),e.to&&t.set(`to`,e.to),e.q&&t.set(`q`,e.q),e.module&&t.set(`module`,e.module),e.requestId&&t.set(`requestId`,e.requestId),e.sessionKey&&t.set(`sessionKey`,e.sessionKey),e.sessionId&&t.set(`sessionId`,e.sessionId),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset));let n=t.toString();return n?`?${n}`:``}async function q(e){return C(S(`/api/logs${K(e)}`))}async function J(){return(await C(S(`/api/logs/files`))).files??[]}async function Y(){return(await C(S(`/api/logs/modules`))).modules??[]}async function X(){let e=await C(S(`/api/logs/stats`));return{byLevel:e.byLevel??{},runtime:e.runtime}}async function Z(){return(await C(S(`/api/logs/dir`))).dir??``}async function Q(){return(await C(S(`/api/logs/level`))).level??`info`}async function ne(e,t){return C(S(`/api/logs/level`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({level:e,...t==null?{}:{duration:String(t)}})})}async function re(e){let t=new URLSearchParams;e?.from&&t.set(`from`,e.from),e?.to&&t.set(`to`,e.to),e?.limit!=null&&t.set(`limit`,String(e.limit));let n=t.toString();return(await C(S(`/api/logs/errors/summary${n?`?${n}`:``}`))).items??[]}var ie=500,ae=class{_callbacks;_cleanup;constructor(e){this._callbacks=e}connect(e,t){this.disconnect();let n=new Set(e?.length?e:[`trace`,`debug`,`info`,`warn`,`error`,`fatal`]);this._cleanup=z(`logs`,{onEvent:e=>{if(e.event!==`log.entry`||!e.data||typeof e.data!=`object`)return;let r=e.data;!n.has(r.level)||t&&r.module!==t||this._callbacks.onEntry(r)},onGap:()=>this._callbacks.onError(`Live log replay gap; refresh the log query`)}),this._callbacks.onConnected()}disconnect(){this._cleanup?.(),this._cleanup=void 0}};function oe(e,t){let n=`${t.timestamp}-${t.requestId??``}-${t.message}`;return[t,...e.filter(e=>`${e.timestamp}-${e.requestId??``}-${e.message}`!==n)].slice(0,ie)}var se=[`trace`,`debug`,`info`,`warn`,`error`,`fatal`];function ce(e){let t=new Date(String(e.timestamp)).getTime();return Number.isFinite(t)?t:0}function le(e){return e.toSorted((e,t)=>ce(t)-ce(e))}var ue=new Set(se),de=[`error`,`fatal`],fe=[`warn`,`error`,`fatal`],pe=[`info`,`warn`,`error`,`fatal`];function me(e){if(!e)return new Set;let t=new Set;for(let n of e.split(`,`)){let e=n.trim();ue.has(e)&&t.add(e)}return t}function he(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function ge(e,t){return e.size===t.length?t.every(t=>e.has(t)):!1}function _e(e){return e.size===0?`all`:ge(e,de)?`errors`:ge(e,fe)?`warnPlus`:ge(e,pe)?`infoPlus`:e.size===se.length&&se.every(t=>e.has(t))?`verbose`:`custom`}function ve(e){let t=_e(e);return t===`custom`?`other`:t}function ye(e){switch(e){case`all`:return new Set;case`errors`:return new Set(de);case`warnPlus`:return new Set(fe);case`infoPlus`:return new Set(pe);case`verbose`:return new Set(se)}}function be(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function xe(e){return String(e.module||e.service||e.extension||`—`)}function Se(e){if(typeof e.message==`string`&&e.message)return e.message;try{return JSON.stringify(e)}catch{return``}}function Ce(e){try{return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}catch{return e}}function we(e){try{return new Date(e).toLocaleString()}catch{return e}}function Te(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Ee(e){let t=e.trim();return t.length<=10?t:`${t.slice(0,8)}…`}function De(e){return String(e).toLowerCase()}function Oe(e){let t=e.phase??e.meta?.phase;return typeof t==`string`&&t.trim()?t:`—`}function ke(e){return`${e.timestamp}-${e.requestId??``}-${e.message}`}function Ae(e){let t=e.err??e.meta?.err;if(!t||typeof t!=`object`)return null;let n=t;return{name:typeof n.name==`string`?n.name:void 0,message:typeof n.message==`string`?n.message:void 0,stack:typeof n.stack==`string`?n.stack:void 0}}function je(e,t){if(t.selectedLevels.size>0&&!t.selectedLevels.has(e.level)||t.moduleFilter&&xe(e)!==t.moduleFilter||t.requestIdFilter&&e.requestId!==t.requestIdFilter||t.sessionIdFilter&&e.sessionId!==t.sessionIdFilter&&e.sessionKey!==t.sessionIdFilter)return!1;if(t.dateFrom){let n=new Date(t.dateFrom).getTime(),r=new Date(String(e.timestamp)).getTime();if(Number.isFinite(n)&&Number.isFinite(r)&&r<n)return!1}if(t.dateTo){let n=new Date(t.dateTo).getTime(),r=new Date(String(e.timestamp)).getTime();if(Number.isFinite(n)&&Number.isFinite(r)&&r>n)return!1}if(t.debouncedSearch){let n=t.debouncedSearch.toLowerCase();if(![e.message,xe(e),Oe(e),e.requestId,e.sessionKey,e.sessionId,Ae(e)?.message,Ae(e)?.stack].filter(Boolean).map(String).join(` `).toLowerCase().includes(n))return!1}return!0}function Me(e,t){let n=[];for(let r of se){let i=e[r]??0;i>0&&n.push(`${t[r]} ${i}`)}return n.join(` · `)}function Ne(e,t){switch(t.type){case`setSearchInput`:return e.searchInput===t.value?e:{...e,searchInput:t.value};case`setDebouncedSearch`:return e.debouncedSearch===t.value?e:{...e,debouncedSearch:t.value};case`setLevels`:return he(e.selectedLevels,t.value)?e:{...e,selectedLevels:t.value};case`toggleLevel`:{let n=new Set(e.selectedLevels);return n.has(t.level)?n.delete(t.level):n.add(t.level),{...e,selectedLevels:n}}case`setModule`:return e.moduleFilter===t.value?e:{...e,moduleFilter:t.value};case`setRequestIdFilter`:return e.requestIdFilter===t.value?e:{...e,requestIdFilter:t.value};case`setSessionIdFilter`:return e.sessionIdFilter===t.value?e:{...e,sessionIdFilter:t.value};case`setDateFrom`:return e.dateFrom===t.value?e:{...e,dateFrom:t.value};case`setDateTo`:return e.dateTo===t.value?e:{...e,dateTo:t.value};case`setAutoRefresh`:return e.autoRefresh===t.value?e:{...e,autoRefresh:t.value};case`syncFromUrl`:{let n=t.payload;return e.searchInput===n.searchInput&&e.debouncedSearch===n.debouncedSearch&&he(e.selectedLevels,n.selectedLevels)&&e.moduleFilter===n.moduleFilter&&e.requestIdFilter===n.requestIdFilter&&e.sessionIdFilter===n.sessionIdFilter&&e.dateFrom===n.dateFrom&&e.dateTo===n.dateTo&&e.autoRefresh===n.autoRefresh?e:{...e,...n}}case`clearAll`:return{searchInput:``,debouncedSearch:``,selectedLevels:new Set,moduleFilter:``,requestIdFilter:``,sessionIdFilter:``,dateFrom:``,dateTo:``,autoRefresh:e.autoRefresh}}}var Pe={logs:[],loading:!1,error:null,hasMore:!1,modules:[],files:[],stats:null,logDir:null};function Fe(e,t){switch(t.type){case`queryStart`:return{...e,loading:!0,error:null,logs:[]};case`querySuccess`:return{...e,loading:!1,logs:le(t.logs),hasMore:t.hasMore};case`queryError`:return t.resetLogs?{...e,loading:!1,error:t.message,logs:[],hasMore:!1}:{...e,loading:!1,error:t.message};case`appendSuccess`:return{...e,loading:!1,logs:le([...e.logs,...t.logs]),hasMore:t.hasMore};case`metaSuccess`:return{...e,modules:t.modules,stats:t.stats,files:t.files};case`filesSuccess`:return{...e,files:t.files,logDir:t.logDir};case`filesClear`:return{...e,files:[]};case`liveTick`:return{...e,logs:le(t.logs),hasMore:t.hasMore,stats:t.stats};case`appendLiveEntry`:return{...e,logs:le(oe(e.logs,t.entry))};case`updateStats`:return{...e,stats:t.stats};case`refreshAllSuccess`:return{...e,loading:!1,logs:le(t.logs),hasMore:t.hasMore,stats:t.stats,files:t.files}}}function Ie(e){let t=y(e).logs,n=b(e=>e.token),r=!!n,[a,o]=i(),s=(0,W.useRef)(a),[c,l]=(0,W.useReducer)(Ne,void 0,()=>{let e=s.current,t=e.get(`q`)??``;return{searchInput:t,debouncedSearch:t.trim(),selectedLevels:me(e.get(`level`)),moduleFilter:e.get(`module`)??``,requestIdFilter:e.get(`requestId`)??``,sessionIdFilter:e.get(`sessionId`)??``,dateFrom:e.get(`from`)??``,dateTo:e.get(`to`)??``,autoRefresh:e.get(`live`)===`1`}}),[u,d]=(0,W.useReducer)(Fe,Pe),[f,p]=(0,W.useState)(null),[m,h]=(0,W.useState)(!1),[g,_]=(0,W.useState)(!1),[v,x]=(0,W.useState)(null),[S,C]=(0,W.useState)([]),[w,T]=(0,W.useState)(!1),{searchInput:E,debouncedSearch:D,selectedLevels:O,moduleFilter:k,requestIdFilter:A,sessionIdFilter:j,dateFrom:M,dateTo:P,autoRefresh:F}=c,{logs:I,loading:L,error:R,hasMore:z,modules:B,files:ee,stats:te,logDir:V}=u,H=(0,W.useCallback)(e=>l({type:`setSearchInput`,value:e}),[]),U=(0,W.useCallback)(e=>l({type:`setLevels`,value:e}),[]),G=(0,W.useCallback)(e=>l({type:`setModule`,value:e}),[]),K=(0,W.useCallback)(e=>l({type:`setRequestIdFilter`,value:e}),[]),Q=(0,W.useCallback)(e=>l({type:`setSessionIdFilter`,value:e}),[]),ne=(0,W.useCallback)(e=>l({type:`setDateFrom`,value:e}),[]),ie=(0,W.useCallback)(e=>l({type:`setDateTo`,value:e}),[]),oe=(0,W.useCallback)(e=>l({type:`setAutoRefresh`,value:e}),[]),se=(0,W.useMemo)(()=>ve(O),[O]),ce=e=>{if(e===`other`){_(!0);return}l({type:`setLevels`,value:ye(e)})},le=D.length>0||O.size>0||!!k||!!A||!!j||!!M||!!P,ue=+(D.length>0)+ +(O.size>0)+ +!!k+ +!!A+ +!!j+(M||P?1:0);(0,W.useEffect)(()=>{let e=setTimeout(()=>l({type:`setDebouncedSearch`,value:E.trim()}),300);return()=>clearTimeout(e)},[E]),(0,W.useEffect)(()=>{let e=a.get(`q`)??``;l({type:`syncFromUrl`,payload:{searchInput:e,debouncedSearch:e.trim(),selectedLevels:me(a.get(`level`)),moduleFilter:a.get(`module`)??``,requestIdFilter:a.get(`requestId`)??``,sessionIdFilter:a.get(`sessionId`)??``,dateFrom:a.get(`from`)??``,dateTo:a.get(`to`)??``,autoRefresh:a.get(`live`)===`1`}})},[a]),(0,W.useEffect)(()=>{let e=new URLSearchParams(a),t=D.trim();t?e.set(`q`,t):e.delete(`q`),O.size>0?e.set(`level`,Array.from(O).sort().join(`,`)):e.delete(`level`),k?e.set(`module`,k):e.delete(`module`),A?e.set(`requestId`,A):e.delete(`requestId`),j?e.set(`sessionId`,j):e.delete(`sessionId`),M?e.set(`from`,M):e.delete(`from`),P?e.set(`to`,P):e.delete(`to`),F?e.set(`live`,`1`):e.delete(`live`),e.toString()!==a.toString()&&o(e,{replace:!0})},[F,M,P,D,k,A,j,a,O,o]);let de=(0,W.useMemo)(()=>({q:D||void 0,level:O.size>0?Array.from(O):void 0,module:k||void 0,requestId:A||void 0,sessionId:j||void 0,from:M||void 0,to:P||void 0,limit:50}),[D,O,k,A,j,M,P]),fe=(0,W.useMemo)(()=>({debouncedSearch:D,selectedLevels:O,moduleFilter:k,requestIdFilter:A,sessionIdFilter:j,dateFrom:M,dateTo:P}),[D,O,k,A,j,M,P]),pe=(0,W.useRef)(fe);return pe.current=fe,(0,W.useEffect)(()=>{if(!r)return;let e=!1;return T(!0),re({from:M||void 0,to:P||void 0,limit:12}).then(t=>{e||C(t)}).catch(()=>{e||C([])}).finally(()=>{e||T(!1)}),()=>{e=!0}},[r,M,P]),(0,W.useEffect)(()=>{if(!r)return;let e=!1;return d({type:`queryStart`}),(async()=>{try{let t=await q({...de,offset:0});if(e)return;d({type:`querySuccess`,logs:t.logs,hasMore:t.logs.length===50})}catch(n){e||d({type:`queryError`,message:n instanceof Error?n.message:t.loadError,resetLogs:!0})}})(),()=>{e=!0}},[r,de,t.loadError]),(0,W.useEffect)(()=>{if(!r)return;let e=!1;return(async()=>{try{let[t,n,r]=await Promise.all([Y(),X(),J()]);e||d({type:`metaSuccess`,modules:t,stats:n,files:r})}catch{}})(),()=>{e=!0}},[r]),(0,W.useEffect)(()=>{if(!r||!m)return;let e=!1;return(async()=>{try{let[t,n]=await Promise.all([J(),Z()]);e||d({type:`filesSuccess`,files:t,logDir:n})}catch{e||d({type:`filesClear`})}})(),()=>{e=!0}},[r,m]),(0,W.useEffect)(()=>{if(!F||!r)return;let e=new ae({onConnected:()=>{},onEntry:e=>{je(e,pe.current)&&d({type:`appendLiveEntry`,entry:e})},onError:()=>{}});e.connect(O.size>0?Array.from(O):void 0,k||void 0);let t=window.setInterval(()=>{X().then(e=>{d({type:`updateStats`,stats:e})}).catch(()=>{})},3e4);return()=>{e.disconnect(),clearInterval(t)}},[F,r,n,O,k]),(0,W.useEffect)(()=>{if(!v)return;let e=window.setTimeout(()=>x(null),2e3);return()=>clearTimeout(e)},[v]),{L:t,hasToken:r,logs:I,loading:L,error:R,hasMore:z,searchInput:E,setSearchInput:H,selectedLevels:O,setSelectedLevels:U,moduleFilter:k,setModuleFilter:G,requestIdFilter:A,sessionIdFilter:j,dateFrom:M,setDateFrom:ne,dateTo:P,setDateTo:ie,modules:B,files:ee,stats:te,selectedLog:f,setSelectedLog:p,filesOpen:m,setFilesOpen:h,filtersOpen:g,setFiltersOpen:_,logDir:V,autoRefresh:F,setAutoRefresh:oe,copiedDetail:v,setCopiedDetail:x,hasActiveFilters:le,activeFilterCount:ue,clearFilters:()=>l({type:`clearAll`}),toggleDialogLevel:e=>l({type:`toggleLevel`,level:e}),handleLoadMore:()=>{L||!z||(async()=>{d({type:`queryStart`});try{let e=await q({...de,offset:I.length});d({type:`appendSuccess`,logs:e.logs,hasMore:e.logs.length===50})}catch(e){d({type:`queryError`,message:e instanceof Error?e.message:t.loadError})}})()},refreshAll:()=>{(async()=>{d({type:`queryStart`});try{let e=await q({...de,offset:0}),[t,n]=await Promise.all([X(),J()]);d({type:`refreshAllSuccess`,logs:e.logs,hasMore:e.logs.length===50,stats:t,files:n})}catch(e){d({type:`queryError`,message:e instanceof Error?e.message:t.loadError})}})()},levelSegment:se,handleLevelSegment:ce,filterByRequestId:(0,W.useCallback)(e=>{p(null),K(e)},[K]),filterBySessionId:(0,W.useCallback)(e=>{p(null),Q(e)},[Q]),filterByErrorSummary:(0,W.useCallback)(e=>{l({type:`setSearchInput`,value:e.errName}),l({type:`setDebouncedSearch`,value:e.errName}),e.module&&l({type:`setModule`,value:e.module}),l({type:`setLevels`,value:ye(`errors`)})},[]),openChatForSession:(0,W.useCallback)(e=>{let t=e.sessionKey?.trim();if(t){window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:t}}));return}let n=e.sessionId?.trim();n&&N({sessionId:n}).then(e=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:e.sessionKey}}))}).catch(()=>{})},[]),errorSummary:S,errorSummaryLoading:w}}var $=r();function Le(e){let t=(0,G.c)(36),{L:n,items:r,loading:i,onSelectItem:a}=e,[o,s]=(0,W.useState)(!1);if(!i&&r.length===0)return null;let c;t[0]===r?c=t[1]:(c=r.reduce(ze,0),t[0]=r,t[1]=c);let l=c,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>s(Re),t[2]=u):u=t[2];let d;t[3]===n.errorSummaryTitle?d=t[4]:(d=(0,$.jsx)(`h2`,{className:`text-sm font-semibold tracking-tight text-fg`,children:n.errorSummaryTitle}),t[3]=n.errorSummaryTitle,t[4]=d);let f;t[5]===n.errorSummaryHint?f=t[6]:(f=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-fg-muted`,children:n.errorSummaryHint}),t[5]=n.errorSummaryHint,t[6]=f);let p;t[7]!==d||t[8]!==f?(p=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[d,f]}),t[7]=d,t[8]=f,t[9]=p):p=t[9];let h;t[10]!==r.length||t[11]!==i||t[12]!==l?(h=i?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(R,{className:`h-5 w-8 rounded-md`}),(0,$.jsx)(R,{className:`h-5 w-10 rounded-md`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`rounded-md bg-red-500/10 px-2 py-0.5 text-xs tabular-nums text-red-600 dark:text-red-400`,children:r.length}),(0,$.jsxs)(`span`,{className:`rounded-md bg-surface-hover px-2 py-0.5 text-xs tabular-nums text-fg-muted`,children:[`×`,l]})]}),t[10]=r.length,t[11]=i,t[12]=l,t[13]=h):h=t[13];let g=o&&`rotate-180`,_;t[14]===g?_=t[15]:(_=m(`size-4 text-fg-muted transition-transform duration-150 ease-out motion-reduce:transition-none`,g),t[14]=g,t[15]=_);let v;t[16]===_?v=t[17]:(v=(0,$.jsx)(ee,{className:_,strokeWidth:1.75,"aria-hidden":!0}),t[16]=_,t[17]=v);let y;t[18]!==h||t[19]!==v?(y=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pt-0.5`,children:[h,v]}),t[18]=h,t[19]=v,t[20]=y):y=t[20];let b;t[21]!==o||t[22]!==y||t[23]!==p?(b=(0,$.jsxs)(`button`,{type:`button`,onClick:u,"aria-expanded":o,className:`flex w-full items-start justify-between gap-3 px-4 py-3 text-left transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-inset`,children:[p,y]}),t[21]=o,t[22]=y,t[23]=p,t[24]=b):b=t[24];let x;t[25]!==n.module||t[26]!==n.phase||t[27]!==n.time||t[28]!==o||t[29]!==r||t[30]!==i||t[31]!==a?(x=o&&!i&&r.length>0?(0,$.jsx)(`ul`,{className:`divide-y divide-edge-subtle border-t border-edge-subtle dark:divide-edge dark:border-edge`,children:r.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>a?.(e),className:m(`flex w-full flex-col gap-1 px-4 py-2.5 text-left transition-colors hover:bg-surface-hover`,a&&`cursor-pointer`),children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.errName}),(0,$.jsxs)(`span`,{className:`shrink-0 rounded-md bg-red-500/10 px-2 py-0.5 text-xs tabular-nums text-red-600 dark:text-red-400`,children:[`×`,e.count]})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[e.phase?(0,$.jsxs)(`span`,{children:[n.phase,`: `,e.phase]}):null,e.module?(0,$.jsxs)(`span`,{children:[n.module,`: `,e.module]}):null,(0,$.jsxs)(`span`,{children:[n.time,`: `,Ce(e.lastSeen)]})]}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-subtle`,children:e.sampleMessage})]})},e.key))}):null,t[25]=n.module,t[26]=n.phase,t[27]=n.time,t[28]=o,t[29]=r,t[30]=i,t[31]=a,t[32]=x):x=t[32];let S;return t[33]!==b||t[34]!==x?(S=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl bg-surface-panel shadow-surface`,children:[b,x]}),t[33]=b,t[34]=x,t[35]=S):S=t[35],S}function Re(e){return!e}function ze(e,t){return e+t.count}function Be(e){let t=(0,G.c)(75),{log:n,labels:r,onFilterByRequestId:i,onFilterBySessionId:a,onOpenChat:o}=e,s=n.level??`info`,c=typeof n.requestId==`string`?n.requestId:``,l=typeof n.sessionKey==`string`?n.sessionKey:``,u=typeof n.sessionId==`string`?n.sessionId:``,d;t[0]===n?d=t[1]:(d=Oe(n),t[0]=n,t[1]=d);let f=d,p;t[2]===n?p=t[3]:(p=Ae(n),t[2]=n,t[3]=p);let g=p,_=s===`error`||s===`fatal`,v;t[4]===r.message?v=t[5]:(v=(0,$.jsx)(`span`,{className:`text-xs font-sans font-medium text-fg-muted`,children:r.message}),t[4]=r.message,t[5]=v);let y=_&&`border-red-500/40`,b;t[6]===y?b=t[7]:(b=m(`mt-2 whitespace-pre-wrap break-words border border-edge bg-surface-base p-3 text-xs leading-relaxed text-fg dark:border-edge`,y),t[6]=y,t[7]=b);let x=n.message||`—`,S;t[8]!==b||t[9]!==x?(S=(0,$.jsx)(`pre`,{className:b,children:x}),t[8]=b,t[9]=x,t[10]=S):S=t[10];let C;t[11]!==v||t[12]!==S?(C=(0,$.jsxs)(`div`,{children:[v,S]}),t[11]=v,t[12]=S,t[13]=C):C=t[13];let w;t[14]!==g||t[15]!==r.stackTrace?(w=g?.stack?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`text-xs font-sans font-medium text-fg-muted`,children:r.stackTrace}),g.name?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-400`,children:g.name}):null,(0,$.jsx)(`pre`,{className:`mt-2 overflow-x-auto whitespace-pre-wrap break-words border border-red-500/30 bg-surface-base p-3 text-xs leading-relaxed text-fg dark:border-red-500/30`,children:g.stack})]}):null,t[14]=g,t[15]=r.stackTrace,t[16]=w):w=t[16];let T;t[17]===r.time?T=t[18]:(T=(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.time}),t[17]=r.time,t[18]=T);let E;t[19]===n.timestamp?E=t[20]:(E=(0,$.jsx)(`code`,{className:`break-all text-fg`,children:n.timestamp}),t[19]=n.timestamp,t[20]=E);let D;t[21]===r.level?D=t[22]:(D=(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.level}),t[21]=r.level,t[22]=D);let O=_&&`font-medium text-red-600 dark:text-red-400`,k;t[23]===O?k=t[24]:(k=m(`text-fg`,O),t[23]=O,t[24]=k);let A;t[25]===s?A=t[26]:(A=De(s),t[25]=s,t[26]=A);let j;t[27]!==k||t[28]!==A?(j=(0,$.jsx)(`span`,{className:k,children:A}),t[27]=k,t[28]=A,t[29]=j):j=t[29];let M;t[30]===r.module?M=t[31]:(M=(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.module}),t[30]=r.module,t[31]=M);let N;t[32]===n?N=t[33]:(N=xe(n),t[32]=n,t[33]=N);let P;t[34]===N?P=t[35]:(P=(0,$.jsx)(`code`,{className:`break-all text-fg`,children:N}),t[34]=N,t[35]=P);let F;t[36]!==r.phase||t[37]!==f?(F=f===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.phase}),(0,$.jsx)(`code`,{className:`break-all text-fg`,children:f})]}),t[36]=r.phase,t[37]=f,t[38]=F):F=t[38];let I;t[39]!==r.filterByRequestId||t[40]!==r.requestId||t[41]!==i||t[42]!==c?(I=c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.requestId}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`code`,{className:`break-all text-fg`,children:c}),i?(0,$.jsx)(h,{type:`button`,variant:`secondary`,className:`h-7 px-2 text-[11px]`,onClick:()=>i(c),children:r.filterByRequestId}):null]})]}):null,t[39]=r.filterByRequestId,t[40]=r.requestId,t[41]=i,t[42]=c,t[43]=I):I=t[43];let L;t[44]!==r.openChat||t[45]!==r.sessionKey||t[46]!==o||t[47]!==l?(L=l?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.sessionKey}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`code`,{className:`break-all text-fg`,children:l}),o?(0,$.jsx)(h,{type:`button`,variant:`secondary`,className:`h-7 px-2 text-[11px]`,onClick:()=>o({sessionKey:l}),children:r.openChat}):null]})]}):null,t[44]=r.openChat,t[45]=r.sessionKey,t[46]=o,t[47]=l,t[48]=L):L=t[48];let R;t[49]!==r.filterBySessionId||t[50]!==r.openChat||t[51]!==r.sessionId||t[52]!==a||t[53]!==o||t[54]!==u?(R=u?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.sessionId}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`code`,{className:`break-all text-fg`,children:u}),a?(0,$.jsx)(h,{type:`button`,variant:`secondary`,className:`h-7 px-2 text-[11px]`,onClick:()=>a(u),children:r.filterBySessionId}):null,o?(0,$.jsx)(h,{type:`button`,variant:`secondary`,className:`h-7 px-2 text-[11px]`,onClick:()=>o({sessionId:u}),children:r.openChat}):null]})]}):null,t[49]=r.filterBySessionId,t[50]=r.openChat,t[51]=r.sessionId,t[52]=a,t[53]=o,t[54]=u,t[55]=R):R=t[55];let z;t[56]!==T||t[57]!==E||t[58]!==D||t[59]!==j||t[60]!==M||t[61]!==P||t[62]!==F||t[63]!==I||t[64]!==L||t[65]!==R?(z=(0,$.jsxs)(`div`,{className:`grid grid-cols-[5.5rem_1fr] gap-x-3 gap-y-2 text-xs`,children:[T,E,D,j,M,P,F,I,L,R]}),t[56]=T,t[57]=E,t[58]=D,t[59]=j,t[60]=M,t[61]=P,t[62]=F,t[63]=I,t[64]=L,t[65]=R,t[66]=z):z=t[66];let B;t[67]!==r.metadata||t[68]!==n.meta?(B=n.meta&&Object.keys(n.meta).length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`text-xs font-sans font-medium text-fg-muted`,children:r.metadata}),(0,$.jsx)(`pre`,{className:`mt-2 overflow-x-auto whitespace-pre-wrap break-words border border-edge bg-surface-base p-3 text-xs leading-relaxed text-fg dark:border-edge`,children:JSON.stringify(n.meta,null,2)})]}):null,t[67]=r.metadata,t[68]=n.meta,t[69]=B):B=t[69];let ee;return t[70]!==z||t[71]!==B||t[72]!==C||t[73]!==w?(ee=(0,$.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[C,w,z,B]}),t[70]=z,t[71]=B,t[72]=C,t[73]=w,t[74]=ee):ee=t[74],ee}function Ve(e){let t=(0,G.c)(50),{L:n,log:r,onClose:i,copiedDetail:a,onCopiedMessage:o,onCopiedJson:s,onFilterByRequestId:c,onFilterBySessionId:l,onOpenChat:u}=e,d=r!==null,f;t[0]===i?f=t[1]:(f=e=>!e&&i(),t[0]=i,t[1]=f);let g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(D,{className:m(`xopc-dialog-overlay fixed inset-0 bg-scrim`,T)}),t[2]=g):g=t[2];let _;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=m(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-panel shadow-popover outline-none`,w,`dark:border-edge`),t[3]=_):_=t[3];let y;t[4]===n.details?y=t[5]:(y=(0,$.jsx)(j,{className:`text-base font-semibold tracking-tight text-fg`,children:n.details}),t[4]=n.details,t[5]=y);let b;t[6]!==n.copied||t[7]!==n.copyJson||t[8]!==n.copyMessage||t[9]!==a||t[10]!==r||t[11]!==s||t[12]!==o?(b=r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(h,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1 px-2 text-xs`,onClick:()=>{v(typeof r.message==`string`?r.message:``).then(e=>{e&&o()})},children:[(0,$.jsx)(B,{className:`size-3.5 shrink-0`,strokeWidth:1.75}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:a===`message`?n.copied:n.copyMessage})]}),(0,$.jsxs)(h,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1 px-2 text-xs`,onClick:()=>{v(JSON.stringify(r,null,2)).then(e=>{e&&s()})},children:[(0,$.jsx)(B,{className:`size-3.5 shrink-0`,strokeWidth:1.75}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:a===`json`?n.copied:n.copyJson})]})]}):null,t[6]=n.copied,t[7]=n.copyJson,t[8]=n.copyMessage,t[9]=a,t[10]=r,t[11]=s,t[12]=o,t[13]=b):b=t[13];let x;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(p,{className:`size-5`,strokeWidth:1.75}),t[14]=x):x=t[14];let S;t[15]===n.close?S=t[16]:(S=(0,$.jsx)(O,{asChild:!0,children:(0,$.jsx)(h,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":n.close,children:x})}),t[15]=n.close,t[16]=S);let C;t[17]!==b||t[18]!==S?(C=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[b,S]}),t[17]=b,t[18]=S,t[19]=C):C=t[19];let E;t[20]!==y||t[21]!==C?(E=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[y,C]}),t[20]=y,t[21]=C,t[22]=E):E=t[22];let N;t[23]!==n.filterByRequestId||t[24]!==n.filterBySessionId||t[25]!==n.level||t[26]!==n.message||t[27]!==n.metadata||t[28]!==n.module||t[29]!==n.openChat||t[30]!==n.phase||t[31]!==n.requestId||t[32]!==n.sessionId||t[33]!==n.sessionKey||t[34]!==n.stackTrace||t[35]!==n.time||t[36]!==r||t[37]!==c||t[38]!==l||t[39]!==u?(N=r?(0,$.jsx)(Be,{log:r,labels:{time:n.time,level:n.level,module:n.module,message:n.message,metadata:n.metadata,requestId:n.requestId,sessionKey:n.sessionKey,sessionId:n.sessionId,phase:n.phase,stackTrace:n.stackTrace,filterByRequestId:n.filterByRequestId,filterBySessionId:n.filterBySessionId,openChat:n.openChat},onFilterByRequestId:c,onFilterBySessionId:l,onOpenChat:u}):null,t[23]=n.filterByRequestId,t[24]=n.filterBySessionId,t[25]=n.level,t[26]=n.message,t[27]=n.metadata,t[28]=n.module,t[29]=n.openChat,t[30]=n.phase,t[31]=n.requestId,t[32]=n.sessionId,t[33]=n.sessionKey,t[34]=n.stackTrace,t[35]=n.time,t[36]=r,t[37]=c,t[38]=l,t[39]=u,t[40]=N):N=t[40];let P;t[41]===N?P=t[42]:(P=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4 font-mono text-sm leading-relaxed`,children:N}),t[41]=N,t[42]=P);let F;t[43]!==E||t[44]!==P?(F=(0,$.jsxs)(k,{children:[g,(0,$.jsxs)(A,{className:_,"aria-describedby":void 0,children:[E,P]})]}),t[43]=E,t[44]=P,t[45]=F):F=t[45];let I;return t[46]!==d||t[47]!==F||t[48]!==f?(I=(0,$.jsx)(M,{open:d,onOpenChange:f,children:F}),t[46]=d,t[47]=F,t[48]=f,t[49]=I):I=t[49],I}function He(e){let t=(0,G.c)(25),{L:n,open:r,onOpenChange:i,files:a,logDir:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(D,{className:m(`xopc-dialog-overlay fixed inset-0 bg-scrim`,T)}),t[0]=s):s=t[0];let c;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=m(`xopc-dialog-content fixed left-1/2 top-1/2 flex max-h-[min(32rem,85vh)] w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 flex-col rounded-xl border border-edge bg-surface-panel shadow-popover outline-none`,w,`dark:border-edge`),t[1]=c):c=t[1];let l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(V,{className:`size-4 text-fg-muted`,strokeWidth:1.75}),t[2]=l):l=t[2];let u;t[3]===n.logFiles?u=t[4]:(u=(0,$.jsxs)(j,{className:`flex items-center gap-2 text-base font-semibold tracking-tight text-fg`,children:[l,n.logFiles]}),t[3]=n.logFiles,t[4]=u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(p,{className:`size-5`,strokeWidth:1.75}),t[5]=d):d=t[5];let f;t[6]===n.close?f=t[7]:(f=(0,$.jsx)(O,{asChild:!0,children:(0,$.jsx)(h,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":n.close,children:d})}),t[6]=n.close,t[7]=f);let g;t[8]!==u||t[9]!==f?(g=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[u,f]}),t[8]=u,t[9]=f,t[10]=g):g=t[10];let _;t[11]!==n.filesEmpty||t[12]!==a?(_=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:a.length===0?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.filesEmpty}):(0,$.jsx)(`ul`,{className:`flex flex-col gap-2`,children:a.map(Ue)})}),t[11]=n.filesEmpty,t[12]=a,t[13]=_):_=t[13];let v;t[14]!==n.logDir||t[15]!==o?(v=o?(0,$.jsxs)(`div`,{className:`shrink-0 border-t border-edge-subtle px-4 py-2 text-xs text-fg-subtle dark:border-edge`,children:[(0,$.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[n.logDir,`: `]}),(0,$.jsx)(`code`,{className:`break-all text-fg-subtle`,children:o})]}):null,t[14]=n.logDir,t[15]=o,t[16]=v):v=t[16];let y;t[17]!==g||t[18]!==_||t[19]!==v?(y=(0,$.jsxs)(k,{children:[s,(0,$.jsxs)(A,{className:c,children:[g,_,v]})]}),t[17]=g,t[18]=_,t[19]=v,t[20]=y):y=t[20];let b;return t[21]!==i||t[22]!==r||t[23]!==y?(b=(0,$.jsx)(M,{open:r,onOpenChange:i,children:y}),t[21]=i,t[22]=r,t[23]=y,t[24]=b):b=t[24],b}function Ue(e){return(0,$.jsxs)(`li`,{className:`flex flex-col gap-1 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 dark:border-edge`,children:[(0,$.jsx)(`span`,{className:`break-all font-mono text-xs text-fg`,children:e.name}),(0,$.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-xs text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:Te(e.size)}),(0,$.jsx)(`span`,{children:we(e.modified)})]})]},e.name)}function We(e){let t=(0,G.c)(68),{L:n,open:r,onOpenChange:i,dateFrom:a,onDateFromChange:o,dateTo:s,onDateToChange:c,selectedLevels:l,onToggleLevel:u}=e,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(D,{className:m(`xopc-dialog-overlay fixed inset-0 bg-scrim`,T)}),t[0]=d):d=t[0];let f;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(f=m(`xopc-dialog-content fixed left-1/2 top-1/2 flex max-h-[min(32rem,90vh)] w-[min(100%-2rem,22rem)] -translate-x-1/2 -translate-y-1/2 flex-col rounded-xl border border-edge bg-surface-panel shadow-popover outline-none`,w,`dark:border-edge`),t[1]=f):f=t[1];let g;t[2]===n.filtersDialogTitle?g=t[3]:(g=(0,$.jsx)(j,{className:`text-base font-semibold tracking-tight text-fg`,children:n.filtersDialogTitle}),t[2]=n.filtersDialogTitle,t[3]=g);let _;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(p,{className:`size-5`,strokeWidth:1.75}),t[4]=_):_=t[4];let v;t[5]===n.close?v=t[6]:(v=(0,$.jsx)(O,{asChild:!0,children:(0,$.jsx)(h,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":n.close,children:_})}),t[5]=n.close,t[6]=v);let y;t[7]!==g||t[8]!==v?(y=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[g,v]}),t[7]=g,t[8]=v,t[9]=y):y=t[9];let b;t[10]===n.filtersDialogDesc?b=t[11]:(b=(0,$.jsx)(`div`,{id:`log-filters-desc`,className:`sr-only`,children:n.filtersDialogDesc}),t[10]=n.filtersDialogDesc,t[11]=b);let x;t[12]===n.timeRange?x=t[13]:(x=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n.timeRange}),t[12]=n.timeRange,t[13]=x);let S;t[14]===n.from?S=t[15]:(S=(0,$.jsx)(`label`,{htmlFor:`log-from-d`,className:`mb-1 block text-xs text-fg-muted`,children:n.from}),t[14]=n.from,t[15]=S);let C;t[16]===o?C=t[17]:(C=e=>o(e.target.value),t[16]=o,t[17]=C);let E;t[18]!==a||t[19]!==C?(E=(0,$.jsx)(`input`,{id:`log-from-d`,type:`datetime-local`,value:a,onChange:C,className:`w-full rounded-xl border border-edge bg-surface-base p-2 text-sm text-fg dark:border-edge`}),t[18]=a,t[19]=C,t[20]=E):E=t[20];let N;t[21]!==E||t[22]!==S?(N=(0,$.jsxs)(`div`,{children:[S,E]}),t[21]=E,t[22]=S,t[23]=N):N=t[23];let P;t[24]===n.to?P=t[25]:(P=(0,$.jsx)(`label`,{htmlFor:`log-to-d`,className:`mb-1 block text-xs text-fg-muted`,children:n.to}),t[24]=n.to,t[25]=P);let F;t[26]===c?F=t[27]:(F=e=>c(e.target.value),t[26]=c,t[27]=F);let I;t[28]!==s||t[29]!==F?(I=(0,$.jsx)(`input`,{id:`log-to-d`,type:`datetime-local`,value:s,onChange:F,className:`w-full rounded-xl border border-edge bg-surface-base p-2 text-sm text-fg dark:border-edge`}),t[28]=s,t[29]=F,t[30]=I):I=t[30];let L;t[31]!==P||t[32]!==I?(L=(0,$.jsxs)(`div`,{children:[P,I]}),t[31]=P,t[32]=I,t[33]=L):L=t[33];let R;t[34]!==N||t[35]!==L?(R=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-col gap-3`,children:[N,L]}),t[34]=N,t[35]=L,t[36]=R):R=t[36];let z;t[37]===n.levelCustom?z=t[38]:(z=(0,$.jsx)(`p`,{className:`mt-6 text-xs font-medium text-fg-muted`,children:n.levelCustom}),t[37]=n.levelCustom,t[38]=z);let B;t[39]===n.levelCustomHint?B=t[40]:(B=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:n.levelCustomHint}),t[39]=n.levelCustomHint,t[40]=B);let ee=n.level,te;t[41]!==n.levelNames||t[42]!==u||t[43]!==l?(te=se.map(e=>(0,$.jsx)(`button`,{type:`button`,className:m(`rounded-full border px-3 py-1.5 text-xs font-medium capitalize transition-[color,background-color,border-color] 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-panel`,l.has(e)?`border-edge bg-surface-active text-fg dark:border-edge`:`border-edge-subtle bg-surface-base text-fg-muted hover:bg-surface-hover dark:border-edge`),onClick:()=>u(e),children:n.levelNames[e]},e)),t[41]=n.levelNames,t[42]=u,t[43]=l,t[44]=te):te=t[44];let V;t[45]!==n.level||t[46]!==te?(V=(0,$.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,role:`group`,"aria-label":ee,children:te}),t[45]=n.level,t[46]=te,t[47]=V):V=t[47];let H;t[48]!==R||t[49]!==z||t[50]!==B||t[51]!==V||t[52]!==x?(H=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4`,children:[x,R,z,B,V]}),t[48]=R,t[49]=z,t[50]=B,t[51]=V,t[52]=x,t[53]=H):H=t[53];let U;t[54]===i?U=t[55]:(U=()=>i(!1),t[54]=i,t[55]=U);let W;t[56]!==n.filtersDone||t[57]!==U?(W=(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle px-4 py-3 dark:border-edge`,children:(0,$.jsx)(h,{type:`button`,className:`w-full rounded-xl`,onClick:U,children:n.filtersDone})}),t[56]=n.filtersDone,t[57]=U,t[58]=W):W=t[58];let K;t[59]!==H||t[60]!==W||t[61]!==y||t[62]!==b?(K=(0,$.jsxs)(k,{children:[d,(0,$.jsxs)(A,{className:f,"aria-describedby":`log-filters-desc`,children:[y,b,H,W]})]}),t[59]=H,t[60]=W,t[61]=y,t[62]=b,t[63]=K):K=t[63];let q;return t[64]!==i||t[65]!==r||t[66]!==K?(q=(0,$.jsx)(M,{open:r,onOpenChange:i,children:K}),t[64]=i,t[65]=r,t[66]=K,t[67]=q):q=t[67],q}var Ge=1;function Ke(e,t){let n=0,r=0,i=e;for(;i&&i!==t;)n+=i.offsetLeft,r+=i.offsetTop,i=i.offsetParent;return i===t?{x:n,y:r}:null}var qe=`pointer-events-none absolute left-0 top-0 z-[1] rounded-pill bg-surface-panel shadow-sm will-change-transform [backface-visibility:hidden] dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,Je=`relative z-[2] box-border flex h-6 min-h-0 min-w-0 flex-1 cursor-pointer items-center justify-center gap-1 rounded-pill border-0 bg-transparent px-2 py-0 text-center text-xs font-medium leading-none outline-none transition-[color,background-color,box-shadow] 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-panel active:scale-100 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`;function Ye({value:e,onChange:t,options:n,"aria-label":r,className:i,buttonClassName:a}){let o=(0,W.useRef)(null),s=(0,W.useRef)([]),[c,l]=(0,W.useState)({x:0,y:0,w:0,h:0}),[u,d]=(0,W.useState)(!1),[f,p]=(0,W.useState)(!1),h=(0,W.useCallback)(()=>{let t=o.current;if(!t)return;let r=n.findIndex(t=>t.value===e);if(r<0)return;let i=s.current[r];if(!i)return;let a=Ge,c=t.getBoundingClientRect(),u=i.getBoundingClientRect(),f=Ke(i,t),p,m;if(f)p=f.x,m=f.y;else{let e=getComputedStyle(t),n=parseFloat(e.borderLeftWidth)||0,r=parseFloat(e.borderTopWidth)||0;p=u.left-c.left-n,m=u.top-c.top-r}l({x:p+a,y:m+a,w:Math.max(0,u.width-a*2),h:Math.max(0,u.height-a*2)}),d(!0)},[n,e]),g=(0,W.useRef)(h);return g.current=h,(0,W.useLayoutEffect)(()=>{let e=requestAnimationFrame(()=>h());return()=>cancelAnimationFrame(e)},[h]),(0,W.useEffect)(()=>{let e=requestAnimationFrame(()=>{requestAnimationFrame(()=>p(!0))});return()=>cancelAnimationFrame(e)},[]),(0,W.useEffect)(()=>{let e=o.current;if(!e)return;let t=()=>{requestAnimationFrame(()=>g.current())},n=new ResizeObserver(t);return n.observe(e),window.addEventListener(`resize`,t),()=>{n.disconnect(),window.removeEventListener(`resize`,t)}},[]),(0,$.jsxs)(`div`,{ref:o,className:m(L,`relative isolate flex w-full max-w-full flex-row items-center`,i),role:`group`,"aria-label":r,children:[(0,$.jsx)(`div`,{"aria-hidden":!0,className:m(qe,`motion-reduce:!transition-none motion-reduce:!duration-0`,f&&`transition-[transform,width,height] duration-300 [transition-timing-function:cubic-bezier(0.32,0.72,0,1)]`),style:{width:c.w,height:c.h,transform:`translate3d(${c.x}px, ${c.y}px, 0)`,opacity:u&&c.w>0?1:0}}),n.map((n,r)=>{let i=n.icon,o=e===n.value;return(0,$.jsxs)(`button`,{ref:e=>{s.current[r]=e},type:`button`,"aria-pressed":o,title:n.title??n.label,onClick:()=>t(n.value),className:m(Je,o?`text-fg`:`text-fg-subtle`,a),children:[i?(0,$.jsx)(i,{className:`block size-3 shrink-0 opacity-80`,strokeWidth:1.75,"aria-hidden":!0}):null,(0,$.jsx)(`span`,{className:`min-w-0 shrink truncate leading-none`,children:n.label})]},n.value)})]})}function Xe(e){let t=(0,G.c)(76),{L:n,levelSegment:r,onLevelSegment:i,searchInput:a,onSearchInputChange:o,moduleFilter:c,onModuleFilterChange:u,modules:d,onOpenFilters:v,activeFilterCount:y,hasActiveFilters:b,onClearFilters:x,autoRefresh:S}=e,C=n.filters,w;t[0]===n.presetAll?w=t[1]:(w={value:`all`,label:n.presetAll},t[0]=n.presetAll,t[1]=w);let T;t[2]===n.presetErrors?T=t[3]:(T={value:`errors`,label:n.presetErrors},t[2]=n.presetErrors,t[3]=T);let E;t[4]===n.presetWarnPlus?E=t[5]:(E={value:`warnPlus`,label:n.presetWarnPlus},t[4]=n.presetWarnPlus,t[5]=E);let D;t[6]===n.presetInfoPlus?D=t[7]:(D={value:`infoPlus`,label:n.presetInfoPlus},t[6]=n.presetInfoPlus,t[7]=D);let O;t[8]===n.presetVerbose?O=t[9]:(O={value:`verbose`,label:n.presetVerbose},t[8]=n.presetVerbose,t[9]=O);let k;t[10]===n.presetOther?k=t[11]:(k={value:`other`,label:n.presetOther},t[10]=n.presetOther,t[11]=k);let A;t[12]!==w||t[13]!==T||t[14]!==E||t[15]!==D||t[16]!==O||t[17]!==k?(A=[w,T,E,D,O,k],t[12]=w,t[13]=T,t[14]=E,t[15]=D,t[16]=O,t[17]=k,t[18]=A):A=t[18];let j;t[19]!==n.levelPresetAria||t[20]!==r||t[21]!==i||t[22]!==A?(j=(0,$.jsx)(`div`,{className:`overflow-x-auto pb-1 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:(0,$.jsx)(`div`,{className:`min-w-[min(100%,36rem)]`,children:(0,$.jsx)(Ye,{"aria-label":n.levelPresetAria,value:r,onChange:i,options:A,buttonClassName:`h-8 px-1.5 text-[11px] sm:px-2 sm:text-xs`})})}),t[19]=n.levelPresetAria,t[20]=r,t[21]=i,t[22]=A,t[23]=j):j=t[23];let M;t[24]===n.searchPlaceholder?M=t[25]:(M=(0,$.jsx)(`span`,{className:`sr-only`,children:n.searchPlaceholder}),t[24]=n.searchPlaceholder,t[25]=M);let N;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(f,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[26]=N):N=t[26];let P;t[27]===o?P=t[28]:(P=e=>o(e.target.value),t[27]=o,t[28]=P);let I=n.searchPlaceholder,L;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(L=m(`h-10 w-full rounded-md border border-edge bg-surface-panel py-0 pl-10 pr-3 text-sm leading-5 text-fg placeholder:text-fg-subtle dark:border-edge`,_),t[29]=L):L=t[29];let R;t[30]!==n.searchPlaceholder||t[31]!==a||t[32]!==P?(R=(0,$.jsx)(`input`,{type:`search`,value:a,onChange:P,placeholder:I,autoComplete:`off`,spellCheck:!1,className:L}),t[30]=n.searchPlaceholder,t[31]=a,t[32]=P,t[33]=R):R=t[33];let z;t[34]!==M||t[35]!==R?(z=(0,$.jsxs)(`label`,{className:`relative min-w-0 flex-1 sm:min-w-[12rem]`,children:[M,N,R]}),t[34]=M,t[35]=R,t[36]=z):z=t[36];let B;t[37]===u?B=t[38]:(B=e=>u(e.target.value),t[37]=u,t[38]=B);let ee=n.module,te=n.module,V;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(V=m(g,`h-10 w-full min-w-0 rounded-md py-0 sm:w-[min(100%,14rem)] sm:shrink-0`),t[39]=V):V=t[39];let H;t[40]===n.allModules?H=t[41]:(H=(0,$.jsx)(l,{value:``,children:n.allModules}),t[40]=n.allModules,t[41]=H);let U;t[42]===d?U=t[43]:(U=d.map(Ze),t[42]=d,t[43]=U);let W;t[44]!==n.module||t[45]!==c||t[46]!==B||t[47]!==H||t[48]!==U?(W=(0,$.jsxs)(s,{id:`log-module`,value:c,onChange:B,"aria-label":ee,title:te,className:V,children:[H,U]}),t[44]=n.module,t[45]=c,t[46]=B,t[47]=H,t[48]=U,t[49]=W):W=t[49];let K;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(F,{className:`size-4`,strokeWidth:1.75}),t[50]=K):K=t[50];let q;t[51]===y?q=t[52]:(q=y>0?(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 text-xs tabular-nums text-fg-muted`,children:y}):null,t[51]=y,t[52]=q);let J;t[53]!==n.filtersMore||t[54]!==v||t[55]!==q?(J=(0,$.jsxs)(h,{type:`button`,variant:`secondary`,className:`h-10 min-h-[44px] gap-2 rounded-md sm:min-h-10`,onClick:v,children:[K,n.filtersMore,q]}),t[53]=n.filtersMore,t[54]=v,t[55]=q,t[56]=J):J=t[56];let Y;t[57]!==n.clear||t[58]!==b||t[59]!==x?(Y=b?(0,$.jsxs)(h,{type:`button`,variant:`ghost`,className:`h-10 min-h-[44px] gap-1 sm:min-h-10`,onClick:x,children:[(0,$.jsx)(p,{className:`size-4`,strokeWidth:1.75}),n.clear]}):null,t[57]=n.clear,t[58]=b,t[59]=x,t[60]=Y):Y=t[60];let X;t[61]!==J||t[62]!==Y?(X=(0,$.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center gap-2`,children:[J,Y]}),t[61]=J,t[62]=Y,t[63]=X):X=t[63];let Z;t[64]!==z||t[65]!==W||t[66]!==X?(Z=(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center`,children:[z,W,X]}),t[64]=z,t[65]=W,t[66]=X,t[67]=Z):Z=t[67];let Q;t[68]!==n.liveHint||t[69]!==S?(Q=S?(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:n.liveHint}):null,t[68]=n.liveHint,t[69]=S,t[70]=Q):Q=t[70];let ne;return t[71]!==n.filters||t[72]!==Z||t[73]!==Q||t[74]!==j?(ne=(0,$.jsxs)(`section`,{className:`flex flex-col gap-3`,"aria-label":C,children:[j,Z,Q]}),t[71]=n.filters,t[72]=Z,t[73]=Q,t[74]=j,t[75]=ne):ne=t[75],ne}function Ze(e){return(0,$.jsx)(l,{value:e,children:e},e)}function Qe(e){let t=(0,G.c)(20),{L:n,logs:r,loading:i,hasMore:a,onSelectLog:o,onLoadMore:s,onRefreshAll:c,onFilterByRequestId:l}=e,u;t[0]!==i||t[1]!==r.length?(u=i&&r.length===0?(0,$.jsx)(`div`,{className:`overflow-hidden rounded-xl bg-surface-panel shadow-surface`,"aria-busy":`true`,children:Array.from({length:8}).map($e)}):null,t[0]=i,t[1]=r.length,t[2]=u):u=t[2];let d;t[3]!==n||t[4]!==i||t[5]!==r.length||t[6]!==c?(d=!i&&r.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 rounded-xl bg-surface-base py-16 text-center`,children:[(0,$.jsx)(H,{className:`size-12 text-fg-subtle`,strokeWidth:1.5,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`text-base font-semibold tracking-tight text-fg`,children:n.noLogs}),(0,$.jsx)(`p`,{className:`max-w-sm text-sm leading-relaxed text-fg-muted`,children:n.noLogsDescription}),(0,$.jsxs)(h,{type:`button`,variant:`secondary`,className:`mt-4 gap-2`,onClick:c,children:[(0,$.jsx)(I,{className:`size-4`,strokeWidth:1.75}),n.refresh]})]}):null,t[3]=n,t[4]=i,t[5]=r.length,t[6]=c,t[7]=d):d=t[7];let f;t[8]!==n||t[9]!==a||t[10]!==i||t[11]!==r||t[12]!==l||t[13]!==s||t[14]!==o?(f=r.length>0?(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:[be(n.showingCount,{count:String(r.length)}),a?(0,$.jsxs)(`span`,{className:`text-fg-subtle`,children:[` · `,n.moreAvailable]}):null]}),(0,$.jsx)(`ul`,{className:`overflow-hidden rounded-xl bg-surface-panel font-mono text-sm leading-6 shadow-surface`,children:r.map(e=>{let t=e.level??`info`,r=typeof e.requestId==`string`?e.requestId.trim():``,i=Oe(e),a=t===`error`||t===`fatal`;return(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>o(e),className:m(`flex w-full min-w-0 items-center gap-3 px-3 py-2.5 text-left transition-colors duration-150 ease-out`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,a&&`border-l-2 border-l-red-500/70`),children:[(0,$.jsx)(`span`,{className:`w-[5.25rem] shrink-0 tabular-nums text-fg-subtle`,children:Ce(e.timestamp)}),(0,$.jsx)(`span`,{className:m(`w-[4.5rem] shrink-0 truncate`,a?`font-medium text-red-600 dark:text-red-400`:`text-fg-muted`),title:t,children:De(t)}),(0,$.jsx)(`span`,{className:`w-[4.5rem] shrink-0 truncate sm:w-[5.25rem]`,children:r?l?(0,$.jsx)(`span`,{role:`link`,tabIndex:0,className:`cursor-pointer text-accent hover:underline`,title:`${n.requestId}: ${r}`,onClick:e=>{e.stopPropagation(),l(r)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),l(r))},children:Ee(r)}):(0,$.jsx)(`span`,{className:`text-fg-subtle`,title:`${n.requestId}: ${r}`,children:Ee(r)}):(0,$.jsx)(`span`,{className:`text-fg-subtle`,children:`—`})}),(0,$.jsx)(`span`,{className:`hidden max-w-[6rem] shrink-0 truncate text-fg-subtle xl:inline`,title:i===`—`?void 0:i,children:i===`—`?`—`:i}),(0,$.jsx)(`span`,{className:`hidden max-w-[7rem] shrink-0 truncate text-fg-muted lg:inline`,title:xe(e),children:xe(e)}),(0,$.jsx)(`span`,{className:m(`min-w-0 flex-1 truncate`,`text-fg`),children:Se(e)})]})},ke(e))})}),a?(0,$.jsx)(`div`,{className:`flex justify-center pt-1`,children:(0,$.jsxs)(h,{type:`button`,variant:`secondary`,className:`gap-2`,disabled:i,onClick:s,children:[i?(0,$.jsx)(I,{className:`size-4 animate-spin motion-reduce:animate-none`,strokeWidth:1.75}):(0,$.jsx)(ee,{className:`size-4`,strokeWidth:1.75}),n.loadMore]})}):null]}):null,t[8]=n,t[9]=a,t[10]=i,t[11]=r,t[12]=l,t[13]=s,t[14]=o,t[15]=f):f=t[15];let p;return t[16]!==u||t[17]!==d||t[18]!==f?(p=(0,$.jsxs)($.Fragment,{children:[u,d,f]}),t[16]=u,t[17]=d,t[18]=f,t[19]=p):p=t[19],p}function $e(e,t){return(0,$.jsxs)(`div`,{className:`flex gap-3 px-3 py-2.5`,children:[(0,$.jsx)(`div`,{className:`h-4 w-16 shrink-0 bg-surface-hover motion-reduce:animate-none animate-pulse`}),(0,$.jsx)(`div`,{className:`h-4 w-12 shrink-0 bg-surface-hover motion-reduce:animate-none animate-pulse`}),(0,$.jsx)(`div`,{className:`h-4 w-20 shrink-0 bg-surface-hover motion-reduce:animate-none animate-pulse`}),(0,$.jsx)(`div`,{className:`h-4 min-w-0 flex-1 bg-surface-hover motion-reduce:animate-none animate-pulse`})]},t)}function et(e){let t=(0,G.c)(8),{L:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(U,{className:`mt-0.5 size-5 shrink-0 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=r):r=t[0];let i;t[1]===n.title?i=t[2]:(i=(0,$.jsx)(`h1`,{className:`text-base font-semibold tracking-tight text-fg`,children:n.title}),t[1]=n.title,t[2]=i);let a;t[3]===n.needToken?a=t[4]:(a=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:n.needToken}),t[3]=n.needToken,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,$.jsx)(`div`,{className:`flex w-full flex-col gap-3 px-3 py-10 sm:px-5 xl:px-6`,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl bg-surface-base p-6`,children:[r,(0,$.jsxs)(`div`,{children:[i,a]})]})}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function tt(e){return/[",\n\r]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function nt(e){let t=[`timestamp`,`level`,`module`,`phase`,`requestId`,`sessionId`,`message`],n=e.map(e=>{let t=String(e.module||``),n=String(e.phase??e.meta?.phase??``);return[e.timestamp,e.level,t,n,e.requestId??``,e.sessionId??``,e.message??``].map(e=>tt(String(e))).join(`,`)});return[t.join(`,`),...n].join(`
2
- `)}function rt(e,t,n){let r=new Blob([e],{type:n}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=t,a.click(),URL.revokeObjectURL(i)}function it(e,t){let n=new Date().toISOString().replace(/[:.]/g,`-`);if(t===`json`){rt(JSON.stringify(e,null,2),`xopc-logs-${n}.json`,`application/json`);return}rt(nt(e),`xopc-logs-${n}.csv`,`text/csv;charset=utf-8`)}function at(e){let t=(0,G.c)(32),{L:n,logs:r,disabled:i}=e,s=i||r.length===0,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(d,{className:`size-4`,strokeWidth:1.75}),t[0]=l):l=t[0];let f;t[1]===n.exportLogs?f=t[2]:(f=(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:n.exportLogs}),t[1]=n.exportLogs,t[2]=f);let p;t[3]!==n.exportLogs||t[4]!==s||t[5]!==f?(p=(0,$.jsx)(c,{asChild:!0,children:(0,$.jsxs)(h,{type:`button`,variant:`secondary`,className:`h-9 gap-2 px-3 text-xs`,disabled:s,title:n.exportLogs,children:[l,f]})}),t[3]=n.exportLogs,t[4]=s,t[5]=f,t[6]=p):p=t[6];let g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(g=m(`w-52 rounded-xl border border-edge bg-surface-panel p-2 shadow-popover outline-none`,E,`dark:border-edge`),t[7]=g):g=t[7];let _;t[8]===n.exportLogs?_=t[9]:(_=(0,$.jsx)(`p`,{className:`px-2 py-1 text-xs font-medium text-fg`,children:n.exportLogs}),t[8]=n.exportLogs,t[9]=_);let v;t[10]===n.exportHint?v=t[11]:(v=(0,$.jsx)(`p`,{className:`px-2 pb-2 text-xs leading-5 text-fg-muted`,children:n.exportHint}),t[10]=n.exportHint,t[11]=v);let y;t[12]===r?y=t[13]:(y=()=>it(r,`json`),t[12]=r,t[13]=y);let b;t[14]!==n.exportJson||t[15]!==y?(b=(0,$.jsx)(h,{type:`button`,variant:`ghost`,className:`h-8 justify-start px-2 text-xs`,onClick:y,children:n.exportJson}),t[14]=n.exportJson,t[15]=y,t[16]=b):b=t[16];let x;t[17]===r?x=t[18]:(x=()=>it(r,`csv`),t[17]=r,t[18]=x);let S;t[19]!==n.exportCsv||t[20]!==x?(S=(0,$.jsx)(h,{type:`button`,variant:`ghost`,className:`h-8 justify-start px-2 text-xs`,onClick:x,children:n.exportCsv}),t[19]=n.exportCsv,t[20]=x,t[21]=S):S=t[21];let C;t[22]!==S||t[23]!==b?(C=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[b,S]}),t[22]=S,t[23]=b,t[24]=C):C=t[24];let w;t[25]!==C||t[26]!==_||t[27]!==v?(w=(0,$.jsx)(a,{children:(0,$.jsxs)(u,{side:`bottom`,align:`end`,sideOffset:6,className:g,children:[_,v,C]})}),t[25]=C,t[26]=_,t[27]=v,t[28]=w):w=t[28];let T;return t[29]!==w||t[30]!==p?(T=(0,$.jsxs)(o,{children:[p,w]}),t[29]=w,t[30]=p,t[31]=T):T=t[31],T}function ot(e){let t=(0,G.c)(38),{L:n}=e,[r,i]=(0,W.useState)(!1),[s,l]=(0,W.useState)(`info`),[d,f]=(0,W.useState)(!1),[p,g]=(0,W.useState)(null),_,v;t[0]!==n.logLevelLoadError||t[1]!==r?(_=()=>{if(!r)return;let e=!1;return Q().then(t=>{e||l(t)}).catch(t=>{e||g(t instanceof Error?t.message:n.logLevelLoadError)}),()=>{e=!0}},v=[r,n.logLevelLoadError],t[0]=n.logLevelLoadError,t[1]=r,t[2]=_,t[3]=v):(_=t[2],v=t[3]),(0,W.useEffect)(_,v);let y;t[4]===n.logLevelSaveError?y=t[5]:(y=e=>{f(!0),g(null),ne(e).then(e=>{l(e.current),i(!1)}).catch(e=>{g(e instanceof Error?e.message:n.logLevelSaveError)}).finally(()=>f(!1))},t[4]=n.logLevelSaveError,t[5]=y);let b=y,x;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(P,{className:`size-4`,strokeWidth:1.75}),t[6]=x):x=t[6];let S;t[7]===n.logLevelTitle?S=t[8]:(S=(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:n.logLevelTitle}),t[7]=n.logLevelTitle,t[8]=S);let C;t[9]===s?C=t[10]:(C=(0,$.jsx)(`span`,{className:`tabular-nums text-fg-muted`,children:s}),t[9]=s,t[10]=C);let w;t[11]!==n.logLevelTitle||t[12]!==S||t[13]!==C?(w=(0,$.jsx)(c,{asChild:!0,children:(0,$.jsxs)(h,{type:`button`,variant:`secondary`,className:`h-9 gap-2 px-3 text-xs`,title:n.logLevelTitle,children:[x,S,C]})}),t[11]=n.logLevelTitle,t[12]=S,t[13]=C,t[14]=w):w=t[14];let T;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(T=m(`w-56 rounded-xl border border-edge bg-surface-panel p-3 shadow-popover outline-none`,E,`dark:border-edge`),t[15]=T):T=t[15];let D;t[16]===n.logLevelTitle?D=t[17]:(D=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:n.logLevelTitle}),t[16]=n.logLevelTitle,t[17]=D);let O;t[18]===n.logLevelHint?O=t[19]:(O=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.logLevelHint}),t[18]=n.logLevelHint,t[19]=O);let k;t[20]!==n.levelNames||t[21]!==b||t[22]!==s||t[23]!==d?(k=se.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,disabled:d,onClick:()=>b(e),className:m(`flex w-full items-center justify-between rounded-md px-2 py-1.5 text-left text-xs transition-colors`,s===e?`bg-accent/10 font-medium text-accent`:`text-fg hover:bg-surface-hover`),children:[(0,$.jsx)(`span`,{children:n.levelNames[e]}),(0,$.jsx)(`span`,{className:`font-mono text-[10px] uppercase text-fg-subtle`,children:e})]})},e)),t[20]=n.levelNames,t[21]=b,t[22]=s,t[23]=d,t[24]=k):k=t[24];let A;t[25]===k?A=t[26]:(A=(0,$.jsx)(`ul`,{className:`mt-3 flex flex-col gap-1`,children:k}),t[25]=k,t[26]=A);let j;t[27]===p?j=t[28]:(j=p?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-red-600 dark:text-red-400`,children:p}):null,t[27]=p,t[28]=j);let M;t[29]!==O||t[30]!==A||t[31]!==j||t[32]!==D?(M=(0,$.jsx)(a,{children:(0,$.jsxs)(u,{side:`bottom`,align:`end`,sideOffset:6,className:T,children:[D,O,A,j]})}),t[29]=O,t[30]=A,t[31]=j,t[32]=D,t[33]=M):M=t[33];let N;return t[34]!==r||t[35]!==M||t[36]!==w?(N=(0,$.jsxs)(o,{open:r,onOpenChange:i,children:[w,M]}),t[34]=r,t[35]=M,t[36]=w,t[37]=N):N=t[37],N}function st(e){let t=(0,G.c)(49),{L:n,autoRefresh:r,onAutoRefreshChange:i,fileCount:a,onOpenFiles:o,loading:s,onRefreshAll:c,logs:l}=e,u;t[0]===n.title?u=t[1]:(u=(0,$.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight text-fg`,children:n.title}),t[0]=n.title,t[1]=u);let d;t[2]===n.subtitle?d=t[3]:(d=(0,$.jsx)(`p`,{className:`mt-0.5 text-sm leading-relaxed text-fg-muted`,children:n.subtitle}),t[2]=n.subtitle,t[3]=d);let f;t[4]!==u||t[5]!==d?(f=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[u,d]}),t[4]=u,t[5]=d,t[6]=f):f=t[6];let p=r?`live`:`paused`,m;t[7]===i?m=t[8]:(m=e=>i(e===`live`),t[7]=i,t[8]=m);let g;t[9]===n.refreshManual?g=t[10]:(g={value:`paused`,label:n.refreshManual},t[9]=n.refreshManual,t[10]=g);let _;t[11]===n.refreshLive?_=t[12]:(_={value:`live`,label:n.refreshLive},t[11]=n.refreshLive,t[12]=_);let v;t[13]!==g||t[14]!==_?(v=[g,_],t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==n.refreshModeAria||t[17]!==p||t[18]!==m||t[19]!==v?(y=(0,$.jsx)(`div`,{className:`w-full sm:w-48`,children:(0,$.jsx)(Ye,{"aria-label":n.refreshModeAria,value:p,onChange:m,options:v,buttonClassName:`h-8`})}),t[16]=n.refreshModeAria,t[17]=p,t[18]=m,t[19]=v,t[20]=y):y=t[20];let b;t[21]===n?b=t[22]:(b=(0,$.jsx)(ot,{L:n}),t[21]=n,t[22]=b);let x;t[23]!==n||t[24]!==s||t[25]!==l?(x=(0,$.jsx)(at,{L:n,logs:l,disabled:s}),t[23]=n,t[24]=s,t[25]=l,t[26]=x):x=t[26];let S;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(V,{className:`size-4`,strokeWidth:1.75}),t[27]=S):S=t[27];let C;t[28]===a?C=t[29]:(C=a>0?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-1.5 text-xs text-fg-muted`,children:a}):null,t[28]=a,t[29]=C);let w;t[30]!==n.logFiles||t[31]!==o||t[32]!==C?(w=(0,$.jsxs)(h,{type:`button`,variant:`ghost`,className:`h-9 min-h-[44px] min-w-[44px] px-2 sm:min-h-9 sm:min-w-0`,title:n.logFiles,"aria-label":n.logFiles,onClick:o,children:[S,C]}),t[30]=n.logFiles,t[31]=o,t[32]=C,t[33]=w):w=t[33];let T;t[34]!==n.refresh||t[35]!==s||t[36]!==c?(T=(0,$.jsx)(te,{className:`h-9 min-h-[44px] min-w-[44px] px-2 sm:min-h-9 sm:min-w-0`,loading:s,label:n.refresh,onClick:c}),t[34]=n.refresh,t[35]=s,t[36]=c,t[37]=T):T=t[37];let E;t[38]!==b||t[39]!==x||t[40]!==w||t[41]!==T?(E=(0,$.jsxs)(`div`,{className:`flex items-center gap-1 self-end sm:self-center`,children:[b,x,w,T]}),t[38]=b,t[39]=x,t[40]=w,t[41]=T,t[42]=E):E=t[42];let D;t[43]!==E||t[44]!==y?(D=(0,$.jsxs)(`div`,{className:`flex w-full shrink-0 flex-col gap-2 sm:w-auto sm:max-w-md sm:flex-row sm:items-center sm:justify-end`,children:[y,E]}),t[43]=E,t[44]=y,t[45]=D):D=t[45];let O;return t[46]!==D||t[47]!==f?(O=(0,$.jsxs)(`header`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[f,D]}),t[46]=D,t[47]=f,t[48]=O):O=t[48],O}function ct(e){let t=(0,G.c)(33),{L:n,stats:r}=e,i;t[0]===r.byLevel?i=t[1]:(i=r.byLevel??{},t[0]=r.byLevel,t[1]=i);let s;t[2]!==n.levelNames||t[3]!==i?(s=Me(i,n.levelNames),t[2]=n.levelNames,t[3]=i,t[4]=s):s=t[4];let l=s,d=r.runtime?.errorsLast24h;if(!l&&d==null)return null;let f;t[5]===n.statsRegion?f=t[6]:(f=(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.statsRegion}),t[5]=n.statsRegion,t[6]=f);let p;t[7]===l?p=t[8]:(p=l?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`mx-1.5 text-fg-subtle`,children:`·`}),(0,$.jsx)(`span`,{className:`tabular-nums`,children:l})]}):null,t[7]=l,t[8]=p);let h;t[9]!==n.runtimeErrors||t[10]!==d?(h=d!=null&&d>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`mx-1.5 text-fg-subtle`,children:`·`}),(0,$.jsxs)(`span`,{className:`tabular-nums text-red-600 dark:text-red-400`,children:[n.runtimeErrors,` `,d]})]}):null,t[9]=n.runtimeErrors,t[10]=d,t[11]=h):h=t[11];let g;t[12]!==f||t[13]!==p||t[14]!==h?(g=(0,$.jsx)(c,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,className:`max-w-full truncate rounded-lg border border-transparent px-1 py-0.5 text-left text-xs leading-5 text-fg-subtle transition-colors duration-150 ease-out hover:border-edge-subtle hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel dark:hover:border-edge`,children:[f,p,h]})}),t[12]=f,t[13]=p,t[14]=h,t[15]=g):g=t[15];let _;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=m(`w-[min(calc(100vw-2rem),20rem)] rounded-xl border border-edge bg-surface-panel p-3 shadow-popover outline-none`,E,`dark:border-edge`),t[16]=_):_=t[16];let v;t[17]===n.statsDetailTitle?v=t[18]:(v=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:n.statsDetailTitle}),t[17]=n.statsDetailTitle,t[18]=v);let y;t[19]===n.statsHint?y=t[20]:(y=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.statsHint}),t[19]=n.statsHint,t[20]=y);let b;t[21]!==n.levelNames||t[22]!==r.byLevel?(b=se.map(e=>{let t=r.byLevel?.[e]??0;return t===0?null:(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-2 rounded-md border border-edge-subtle bg-surface-base px-2 py-1 text-xs dark:border-edge`,children:[(0,$.jsx)(`span`,{className:`font-medium capitalize text-fg`,children:n.levelNames[e]}),(0,$.jsx)(`span`,{className:`tabular-nums text-fg-muted`,children:t})]},e)}),t[21]=n.levelNames,t[22]=r.byLevel,t[23]=b):b=t[23];let x;t[24]===b?x=t[25]:(x=(0,$.jsx)(`ul`,{className:`mt-3 flex flex-col gap-1.5`,children:b}),t[24]=b,t[25]=x);let S;t[26]!==x||t[27]!==v||t[28]!==y?(S=(0,$.jsx)(a,{children:(0,$.jsxs)(u,{side:`bottom`,align:`start`,sideOffset:6,className:_,children:[v,y,x]})}),t[26]=x,t[27]=v,t[28]=y,t[29]=S):S=t[29];let C;return t[30]!==S||t[31]!==g?(C=(0,$.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,$.jsxs)(o,{children:[g,S]})}),t[30]=S,t[31]=g,t[32]=C):C=t[32],C}function lt(){let e=(0,G.c)(89),{L:t,hasToken:n,logs:r,loading:i,error:a,hasMore:o,searchInput:s,setSearchInput:c,selectedLevels:l,moduleFilter:u,setModuleFilter:d,dateFrom:f,setDateFrom:p,dateTo:m,setDateTo:h,modules:g,files:_,stats:v,selectedLog:y,setSelectedLog:b,filesOpen:S,setFilesOpen:C,filtersOpen:w,setFiltersOpen:T,logDir:E,autoRefresh:D,setAutoRefresh:O,copiedDetail:k,setCopiedDetail:A,hasActiveFilters:j,activeFilterCount:M,clearFilters:N,toggleDialogLevel:P,handleLoadMore:F,refreshAll:I,levelSegment:L,handleLevelSegment:R,filterByRequestId:z,filterBySessionId:B,filterByErrorSummary:ee,openChatForSession:te,errorSummary:V,errorSummaryLoading:H}=Ie(x(ut));if(!n){let n;return e[0]===t?n=e[1]:(n=(0,$.jsx)(et,{L:t}),e[0]=t,e[1]=n),n}let U;e[2]===C?U=e[3]:(U=()=>C(!0),e[2]=C,e[3]=U);let W;e[4]!==t||e[5]!==D||e[6]!==_.length||e[7]!==i||e[8]!==r||e[9]!==I||e[10]!==O||e[11]!==U?(W=(0,$.jsx)(st,{L:t,autoRefresh:D,onAutoRefreshChange:O,fileCount:_.length,onOpenFiles:U,loading:i,onRefreshAll:I,logs:r}),e[4]=t,e[5]=D,e[6]=_.length,e[7]=i,e[8]=r,e[9]=I,e[10]=O,e[11]=U,e[12]=W):W=e[12];let K;e[13]===a?K=e[14]:(K=a?(0,$.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg dark:border-edge`,role:`alert`,children:a}):null,e[13]=a,e[14]=K);let q;e[15]!==t||e[16]!==v?(q=v?(0,$.jsx)(ct,{L:t,stats:v}):null,e[15]=t,e[16]=v,e[17]=q):q=e[17];let J;e[18]!==t||e[19]!==V||e[20]!==H||e[21]!==ee?(J=(0,$.jsx)(Le,{L:t,items:V,loading:H,onSelectItem:ee}),e[18]=t,e[19]=V,e[20]=H,e[21]=ee,e[22]=J):J=e[22];let Y;e[23]===T?Y=e[24]:(Y=()=>T(!0),e[23]=T,e[24]=Y);let X;e[25]!==t||e[26]!==M||e[27]!==D||e[28]!==N||e[29]!==R||e[30]!==j||e[31]!==L||e[32]!==u||e[33]!==g||e[34]!==s||e[35]!==d||e[36]!==c||e[37]!==Y?(X=(0,$.jsx)(Xe,{L:t,levelSegment:L,onLevelSegment:R,searchInput:s,onSearchInputChange:c,moduleFilter:u,onModuleFilterChange:d,modules:g,onOpenFilters:Y,activeFilterCount:M,hasActiveFilters:j,onClearFilters:N,autoRefresh:D}),e[25]=t,e[26]=M,e[27]=D,e[28]=N,e[29]=R,e[30]=j,e[31]=L,e[32]=u,e[33]=g,e[34]=s,e[35]=d,e[36]=c,e[37]=Y,e[38]=X):X=e[38];let Z;e[39]!==t||e[40]!==z||e[41]!==F||e[42]!==o||e[43]!==i||e[44]!==r||e[45]!==I||e[46]!==b?(Z=(0,$.jsx)(Qe,{L:t,logs:r,loading:i,hasMore:o,onSelectLog:b,onLoadMore:F,onRefreshAll:I,onFilterByRequestId:z}),e[39]=t,e[40]=z,e[41]=F,e[42]=o,e[43]=i,e[44]=r,e[45]=I,e[46]=b,e[47]=Z):Z=e[47];let Q;e[48]!==t||e[49]!==f||e[50]!==m||e[51]!==w||e[52]!==l||e[53]!==p||e[54]!==h||e[55]!==T||e[56]!==P?(Q=(0,$.jsx)(We,{L:t,open:w,onOpenChange:T,dateFrom:f,onDateFromChange:p,dateTo:m,onDateToChange:h,selectedLevels:l,onToggleLevel:P}),e[48]=t,e[49]=f,e[50]=m,e[51]=w,e[52]=l,e[53]=p,e[54]=h,e[55]=T,e[56]=P,e[57]=Q):Q=e[57];let ne;e[58]===b?ne=e[59]:(ne=()=>b(null),e[58]=b,e[59]=ne);let re,ie;e[60]===A?(re=e[61],ie=e[62]):(re=()=>A(`message`),ie=()=>A(`json`),e[60]=A,e[61]=re,e[62]=ie);let ae;e[63]!==t||e[64]!==k||e[65]!==z||e[66]!==B||e[67]!==te||e[68]!==y||e[69]!==re||e[70]!==ie||e[71]!==ne?(ae=(0,$.jsx)(Ve,{L:t,log:y,onClose:ne,copiedDetail:k,onCopiedMessage:re,onCopiedJson:ie,onFilterByRequestId:z,onFilterBySessionId:B,onOpenChat:te}),e[63]=t,e[64]=k,e[65]=z,e[66]=B,e[67]=te,e[68]=y,e[69]=re,e[70]=ie,e[71]=ne,e[72]=ae):ae=e[72];let oe;e[73]!==t||e[74]!==_||e[75]!==S||e[76]!==E||e[77]!==C?(oe=(0,$.jsx)(He,{L:t,open:S,onOpenChange:C,files:_,logDir:E}),e[73]=t,e[74]=_,e[75]=S,e[76]=E,e[77]=C,e[78]=oe):oe=e[78];let se;return e[79]!==W||e[80]!==ae||e[81]!==oe||e[82]!==K||e[83]!==q||e[84]!==J||e[85]!==X||e[86]!==Z||e[87]!==Q?(se=(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-6 px-3 py-6 sm:px-5 xl:px-6`,children:[W,K,q,J,X,Z,Q,ae,oe]}),e[79]=W,e[80]=ae,e[81]=oe,e[82]=K,e[83]=q,e[84]=J,e[85]=X,e[86]=Z,e[87]=Q,e[88]=se):se=e[88],se}function ut(e){return e.language}export{lt as LogsPage};
@@ -1,4 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-i4CfDqLG.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-EvA8c7fo.js","assets/preload-helper-zJ_50EbN.js","assets/Combination-14nmIgxH.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-C230izr8.js","assets/markdown-view-DYkxMtJA.js","assets/dist-BPoKqzeH.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-iKjqemWG.js","assets/messages-kx5W39dO.js","assets/cn-JdwAhgNB.js","assets/product-delivery-tRr-7IxY.js","assets/schemas-zIBW3wiV.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-DD_PgVue.css","assets/dist-DY4Af0fY.js","assets/vendor-swr-BIWyz7Rc.js","assets/check-DUBLcKHA.js","assets/popover-select-BzdnTy3h.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-check-C23XjkUj.js","assets/copy-Dv6d4Dvw.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/eye-off-DEAzt3g1.js","assets/eye-CABVeTq0.js","assets/file-code-corner-byQA1VfD.js","assets/globe-DSSGFWFn.js","assets/notes-api-DJizatxh.js","assets/loader-circle-CifKLtgG.js","assets/rotate-cw-LIg3Am9S.js","assets/search-DA7gz22f.js","assets/middleware-Pd0e8Igk.js","assets/tool-activity-R8V9l6nk.js","assets/button-CSEbl4zT.js","assets/registry-api-Cx3JxXSL.js","assets/gateway-startup-retry-B2zpkNvi.js","assets/config-reload-event-Bjh2zoKp.js","assets/gateway-config-swr-BzTbnu4O.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-NItGQmvR.js","assets/theme-store-BOD2D0dJ.js","assets/index-Dcj5KJRg.css","assets/vendor-codemirror-DRr7hFaD.js","assets/with-selector-aYPsXwdl.js","assets/block-editor-D4ZIVQbk.css","assets/markdown-editor-TWGaF7Xa.js","assets/code-editor-dFzqyDXS.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{n as o,r as s}from"./popover-select-BzdnTy3h.js";import{t as c}from"./circle-check-C23XjkUj.js";import{t as l}from"./eye-CABVeTq0.js";import{E as u,O as d,S as f,T as p,_ as m,a as h,c as g,d as _,f as v,g as y,h as b,l as x,m as S,n as C,o as w,p as T,r as E,s as D,u as O,v as k,w as A,x as j,y as M}from"./notes-api-DJizatxh.js";import{t as N}from"./loader-circle-CifKLtgG.js";import{t as P}from"./plus-Q2yW6OE7.js";import{t as F}from"./search-DA7gz22f.js";import{t as I}from"./x-B_N4OPjy.js";import{t as L}from"./cn-JdwAhgNB.js";import{t as R}from"./button-CSEbl4zT.js";import{t as z}from"./messages-kx5W39dO.js";import{l as B,n as ee}from"./locale-store-iKjqemWG.js";import{i as te}from"./theme-store-BOD2D0dJ.js";import{a as ne,i as re,n as ie,o as ae,r as V,s as oe,t as H}from"./dist-BPoKqzeH.js";import{i as U}from"./vendor-swr-BIWyz7Rc.js";import{$l as se,$s as ce,As as le,Bs as ue,Cs as W,Ec as de,Es as G,Gr as fe,Hr as pe,Ic as me,Ii as he,Jr as ge,Kr as _e,Ll as K,Qa as q,Ul as J,Ur as ve,Us as ye,Vr as Y,Wr as be,Xl as xe,Xn as Se,Xr as Ce,Ya as we,Yl as Te,Yr as Ee,Zr as X,Zs as De,_s as Oe,ac as ke,c as Ae,d as je,dl as Me,ec as Ne,fc as Pe,gc as Fe,gs as Ie,hs as Le,il as Re,ks as ze,l as Be,ql as Ve,rc as He,s as Ue,tc as We,tl as Ge,u as Ke,uo as qe,vs as Je,zc as Ye}from"./index-EvA8c7fo.js";var Z=n(),Q=e(t(),1),$=r(),Xe=(0,Q.createContext)(null);function Ze(){let e=(0,Z.c)(1),t=(0,Q.useContext)(Xe);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:Qe},e[0]=t):t=e[0],t}return t}function Qe(){}function $e(e){let t=(0,Z.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,o]=(0,Q.useState)(null),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(e,t)=>{o({src:e,alt:t})},t[0]=s):s=t[0];let c=s,l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l={openImage:c},t[1]=l):l=t[1];let u=l,d=a!==null,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{e||o(null)},t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(ne,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=p):p=t[3];let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=L(`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]=m):m=t[4];let h=a?.alt||`Image preview`,g;t[5]===h?g=t[6]:(g=(0,$.jsx)(oe,{className:`sr-only`,children:h}),t[5]=h,t[6]=g);let _;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(I,{className:`size-5`,"aria-hidden":!0}),t[7]=_):_=t[7];let v;t[8]===i?v=t[9]:(v=(0,$.jsx)(ie,{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:_})}),t[8]=i,t[9]=v);let y;t[10]===a?y=t[11]:(y=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]=y);let b;t[12]!==v||t[13]!==y||t[14]!==g?(b=(0,$.jsxs)(ae,{children:[p,(0,$.jsxs)(V,{className:m,"aria-describedby":void 0,children:[g,v,y]})]}),t[12]=v,t[13]=y,t[14]=g,t[15]=b):b=t[15];let x;t[16]!==b||t[17]!==d?(x=(0,$.jsx)(H,{open:d,onOpenChange:f,children:b}),t[16]=b,t[17]=d,t[18]=x):x=t[18];let S;return t[19]!==n||t[20]!==x?(S=(0,$.jsxs)(Xe.Provider,{value:u,children:[n,x]}),t[19]=n,t[20]=x,t[21]=S):S=t[21],S}function et(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=u(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=L(`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)(d,{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 p;t[9]===i?p=t[10]:(p=L(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=p);let m;return t[11]!==n||t[12]!==c||t[13]!==p?(m=(0,$.jsx)(f,{src:c,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:l,className:p}),t[11]=n,t[12]=c,t[13]=p,t[14]=m):m=t[14],m}var tt=6e4,nt=36e5,rt=864e5;function it(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function at(e,t,n){let r=t-e;if(r<tt)return n.justNow;if(r<nt){let e=Math.floor(r/tt);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=it(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(e>=i-rt)return n.yesterday+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(r<7*rt){let e=Math.floor(r/rt);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function ot(e,t,n){let r=it(t);if(e>=r)return n.today;if(e>=r-rt)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(void 0,{month:`long`,day:`numeric`}):i.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function st(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function ct(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 lt(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}=X(),f=X(dt),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 b=y,x;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==f?(x=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]=x):x=t[9];let S=x,C;t[10]===a?C=t[11]:(C=L(`flex items-center gap-2`,a),t[10]=a,t[11]=C);let w=m?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,T;t[12]===w?T=t[13]:(T=L(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,w),t[12]=w,t[13]=T);let E=m?`Pause`:`Play`,D;t[14]!==h||t[15]!==m?(D=h?(0,$.jsx)(N,{className:`size-3.5 animate-spin`}):m?(0,$.jsx)(He,{className:`size-3.5`}):(0,$.jsx)(De,{className:`size-3.5 ml-0.5`}),t[14]=h,t[15]=m,t[16]=D):D=t[16];let O;t[17]!==b||t[18]!==S||t[19]!==T||t[20]!==E||t[21]!==D?(O=(0,$.jsx)(`button`,{type:`button`,onClick:b,onKeyDown:S,className:T,"aria-label":E,children:D}),t[17]=b,t[18]=S,t[19]=T,t[20]=E,t[21]=D,t[22]=O):O=t[22];let k=`${v}%`,A;t[23]===k?A=t[24]:(A=(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:k}})}),t[23]=k,t[24]=A);let j;t[25]!==_||t[26]!==p||t[27]!==g?(j=ct(p&&g>0?g:_),t[25]=_,t[26]=p,t[27]=g,t[28]=j):j=t[28];let M;t[29]===j?M=t[30]:(M=(0,$.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:j}),t[29]=j,t[30]=M);let P;t[31]!==A||t[32]!==M?(P=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[A,M]}),t[31]=A,t[32]=M,t[33]=P):P=t[33];let F;return t[34]!==P||t[35]!==C||t[36]!==O?(F=(0,$.jsxs)(`div`,{className:C,onClick:ut,children:[O,P]}),t[34]=P,t[35]=C,t[36]=O,t[37]=F):F=t[37],F}function ut(e){return e.stopPropagation()}function dt(e){return e.toggle}function ft(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function pt(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=ft(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)(_t),h;t[3]!==n.createdAt||t[4]!==m||t[5]!==l?(h=at(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=L(`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)(et,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(lt,{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=L(`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)(Re,{className:`size-4`}),t[31]=k):k=t[31];let A;t[32]===c.actions?A=t[33]:(A=(0,$.jsx)(_e,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:gt,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]=A);let j;t[34]!==n.id||t[35]!==n.pinned||t[36]!==a?(j=()=>a(n.id,!n.pinned),t[34]=n.id,t[35]=n.pinned,t[36]=a,t[37]=j):j=t[37];let M;t[38]===n.pinned?M=t[39]:(M=n.pinned?(0,$.jsx)(ce,{className:`size-4`}):(0,$.jsx)(Ne,{className:`size-4`}),t[38]=n.pinned,t[39]=M);let N=n.pinned?c.unpin:c.pin,P;t[40]!==j||t[41]!==M||t[42]!==N?(P=(0,$.jsxs)(pe,{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:j,children:[M,N]}),t[40]=j,t[41]=M,t[42]=N,t[43]=P):P=t[43];let F;t[44]!==n.id||t[45]!==o?(F=()=>o(n.id),t[44]=n.id,t[45]=o,t[46]=F):F=t[46];let I;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(xe,{className:`size-4`}),t[47]=I):I=t[47];let R;t[48]!==c.archive||t[49]!==F?(R=(0,$.jsxs)(pe,{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:F,children:[I,c.archive]}),t[48]=c.archive,t[49]=F,t[50]=R):R=t[50];let z;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(fe,{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),t[52]=n.id,t[53]=s,t[54]=B):B=t[54];let ee;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(Ie,{className:`size-4`}),t[55]=ee):ee=t[55];let te;t[56]!==c.delete||t[57]!==B?(te=(0,$.jsxs)(pe,{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:[ee,c.delete]}),t[56]=c.delete,t[57]=B,t[58]=te):te=t[58];let ne;t[59]!==P||t[60]!==R||t[61]!==te?(ne=(0,$.jsx)(ve,{children:(0,$.jsxs)(Y,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:ht,children:[P,R,z,te]})}),t[59]=P,t[60]=R,t[61]=te,t[62]=ne):ne=t[62];let re;t[63]!==A||t[64]!==ne?(re=(0,$.jsxs)(be,{children:[A,ne]}),t[63]=A,t[64]=ne,t[65]=re):re=t[65];let ie;t[66]!==C||t[67]!==O||t[68]!==re?(ie=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[C,O,re]}),t[66]=C,t[67]=O,t[68]=re,t[69]=ie):ie=t[69];let ae;t[70]===n.pinned?ae=t[71]:(ae=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)(Ne,{className:`size-3`})}),t[70]=n.pinned,t[71]=ae);let V;t[72]===n.tags?V=t[73]:(V=n.tags?.slice(0,2).map(mt),t[72]=n.tags,t[73]=V);let oe;t[74]===g?oe=t[75]:(oe=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:g}),t[74]=g,t[75]=oe);let H;t[76]!==ae||t[77]!==V||t[78]!==oe?(H=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[ae,V,oe]}),t[76]=ae,t[77]=V,t[78]=oe,t[79]=H):H=t[79];let U;return t[80]!==ie||t[81]!==H||t[82]!==_||t[83]!==v||t[84]!==b||t[85]!==x||t[86]!==S?(U=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:_,onKeyDown:v,className:b,"aria-current":x,children:[S,ie,H]}),t[80]=ie,t[81]=H,t[82]=_,t[83]=v,t[84]=b,t[85]=x,t[86]=S,t[87]=U):U=t[87],U}function mt(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 ht(e){return e.stopPropagation()}function gt(e){return e.stopPropagation()}function _t(){return Date.now()}function vt(e){let t=(0,Z.c)(45),{title:n,description:r,prompt:i,coverage:o,className:s,variant:l}=e,u=l===void 0?`card`:l,d=ee(xt),f=z(d).automations.suggestions,p=z(d).automations,m=a(),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=h):h=t[0];let{data:g}=U(o?`automation-suggestion-coverage`:null,bt,h),_=o?g?.automations.find(e=>Ke(e,o)):void 0,v=_?Ae(_,p):[];if(u===`titleAction`){if(_){let e;t[1]===s?e=t[2]:(e=L(`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)(c,{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]===m?r=t[5]:(r=()=>m(`/automations`),t[4]=m,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:f.coveredTitle}),(0,$.jsx)(R,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:f.manage})]})}let e;t[6]===s?e=t[7]:(e=L(`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)(de,{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 l;t[12]!==m||t[13]!==i?(l=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[12]=m,t[13]=i,t[14]=l):l=t[14];let u;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(le,{className:`size-3.5`,"aria-hidden":!0}),t[15]=u):u=t[15],(0,$.jsxs)(`section`,{className:e,children:[a,o,(0,$.jsxs)(R,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:l,children:[u,f.setup]})]})}if(_){let e;t[16]===s?e=t[17]:(e=L(`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)(c,{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]===m?r=t[20]:(r=()=>m(`/automations`),t[19]=m,t[20]=r);let i;return t[21]!==f||t[22]!==r?(i=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsx)(R,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:f.manage})}),t[21]=f,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:f.coveredTitle}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:Be(f.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:p.explain.whyCovered}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:v.map(yt)})]}),i]})}let y;t[24]===s?y=t[25]:(y=L(`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)(de,{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]!==m||t[35]!==i?(w=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[34]=m,t[35]=i,t[36]=w):w=t[36];let T;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(le,{className:`size-3.5`,"aria-hidden":!0}),t[37]=T):T=t[37];let E;t[38]!==f.create||t[39]!==w?(E=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsxs)(R,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:w,children:[T,f.create]})}),t[38]=f.create,t[39]=w,t[40]=E):E=t[40];let D;return t[41]!==E||t[42]!==y||t[43]!==C?(D=(0,$.jsxs)(`section`,{className:y,children:[C,E]}),t[41]=E,t[42]=y,t[43]=C,t[44]=D):D=t[44],D}function yt(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 bt(){return je.list()}function xt(e){return e.language}function St(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(Ct),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 Ct(e,t){return(0,$.jsx)(`li`,{children:e},`${t}:${e}`)}function wt(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),A(n,r).then(i=>{if(e=!0,t){p(n,r);return}s(i)}).catch(()=>{t||l(!0)}),()=>{t=!0,e&&p(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)(we,{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 Tt(e){let t=(0,Z.c)(39),{noteId:n}=e,r=z(ee(Ot)).notes.discussionCapture,i,a;t[0]===n?(i=t[1],a=t[2]):(i=[`note-discussion-document`,n],a=()=>Se(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:l}=U(i,a,o),u,d;if(t[4]===l?(u=t[5],d=t[6]):(u=()=>{let e=e=>{let t=e.detail;t&&l(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(Dt);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 l();return window.addEventListener(`discussion-segment-updated`,e),window.addEventListener(`discussion-updated`,t),()=>{window.removeEventListener(`discussion-segment-updated`,e),window.removeEventListener(`discussion-updated`,t)}},d=[l],t[4]=l,t[5]=u,t[6]=d),(0,Q.useEffect)(u,d),!s)return null;let{discussion:f,transcript:p}=s,m=s.organization?.organization,h=[`stopping`,`sealing`,`organizing`].includes(f.status),g=p.stats.uploaded+p.stats.transcribing,_=p.stats.failed>0?r.failedSegments.replace(`{{count}}`,String(p.stats.failed)):g>0?r.processingSegments.replace(`{{count}}`,String(g)):h?r.finalizing:f.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]!==m?(v=m?(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)(le,{className:`size-4`,"aria-hidden":!0}),r.organization]}),(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:m.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:[m.decisions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.decisions}),(0,$.jsx)(St,{values:m.decisions})]}):null,m.actionItems.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.actionItems}),(0,$.jsx)(St,{values:m.actionItems.map(Et)})]}):null,m.risks.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.risks}),(0,$.jsx)(St,{values:m.risks})]}):null,m.openQuestions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.openQuestions}),(0,$.jsx)(St,{values:m.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]=m,t[13]=v):v=t[13];let y;t[14]!==r.recordingAudio||t[15]!==r.recordingUnavailable||t[16]!==f.audioAttachmentId||t[17]!==n?(y=f.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)(Pe,{className:`size-4 text-accent`,"aria-hidden":!0}),r.recordingAudio]}),(0,$.jsx)(wt,{noteId:n,attachmentId:f.audioAttachmentId,label:r.recordingAudio,unavailableLabel:r.recordingUnavailable})]}):null,t[14]=r.recordingAudio,t[15]=r.recordingUnavailable,t[16]=f.audioAttachmentId,t[17]=n,t[18]=y):y=t[18];let b;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(Pe,{className:`size-4 text-accent`,"aria-hidden":!0}),t[19]=b):b=t[19];let x=f.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]===f.status?C=t[23]:(C=f.status===`needs_attention`?(0,$.jsx)(Le,{className:`size-3.5 text-danger`}):f.status===`completed`?(0,$.jsx)(c,{className:`size-3.5 text-success`}):null,t[22]=f.status,t[23]=C);let w=f.status===`needs_attention`?f.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 E;t[27]!==S||t[28]!==T?(E=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[S,T]}),t[27]=S,t[28]=T,t[29]=E):E=t[29];let D=p.text||r.waitingTranscript,O;t[30]===D?O=t[31]:(O=(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:D}),t[30]=D,t[31]=O);let k;t[32]!==E||t[33]!==O?(k=(0,$.jsxs)(`section`,{className:`px-6 py-4`,children:[E,O]}),t[32]=E,t[33]=O,t[34]=k):k=t[34];let A;return t[35]!==k||t[36]!==v||t[37]!==y?(A=(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,k]}),t[35]=k,t[36]=v,t[37]=y,t[38]=A):A=t[38],A}function Et(e){return e.title}function Dt(e,t){return e.sequence-t.sequence}function Ot(e){return e.language}var kt={edit:We,ai_edit:le,sync:ye,restore:Te};function At(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function jt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=z(ee(e=>e.language)).notes,o=a,{data:s}=U(e?[`note-history`,e]:null,()=>x(e)),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),m=(0,Q.useCallback)(async t=>{l(!0),p(null);try{await k(e,t),d(null),i()}catch{p(a.restoreFailed)}finally{l(!1)}},[e,a.restoreSuccess,a.restoreFailed,i]),h=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)(Ye,{className:`size-4`,"aria-hidden":!0}),a.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)(I,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[f?(0,$.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:f}):null,s?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:s.map(e=>{let r=kt[e.trigger]??We,i=t===e.timestamp,s=u===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:L(`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:At(e.trigger,a)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:at(e.timestamp,h,o)})]}),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:s?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:a.restoreConfirm}),(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),m(e.timestamp)},disabled:c,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:c?`...`:a.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),d(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(),d(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:a.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:a.historyEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:a.historyEmptyDescription})]})]})]})}function Mt(e){let t=(0,Z.c)(10),{noteId:n,note:r,catalyzing:i,onCatalyze:o,onClose:s,noteThreads:c,openingChat:l,onOpenChat:u,onOpenNewChat:d}=e,f=z(ee(zt)).notes,p=a(),h=r?.aiDeep?.catalysis,g=h?.report??null,_;t[0]===n?_=t[1]:(_=n?[`note-agent-context-status`,n]:null,t[0]=n,t[1]=_);let v;t[2]===n?v=t[3]:(v=()=>D(n),t[2]=n,t[3]=v);let b;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(b={revalidateOnFocus:!1},t[4]=b):b=t[4];let{data:x,mutate:S,isLoading:C}=U(_,v,b),w;t[5]===n?w=t[6]:(w=async e=>{try{await m(n,e)}catch{}},t[5]=n,t[6]=w);let T=w,E;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(le,{className:`size-4 text-accent`,"aria-hidden":!0}),t[7]=E):E=t[7];let O;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(Ve,{className:`size-4 rotate-180`,"aria-hidden":!0}),t[8]=O):O=t[8];let k;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(Fe,{className:`size-4 text-accent`,"aria-hidden":!0}),t[9]=k):k=t[9],(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:[E,(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:f.catalysisSectionTitle})]}),(0,$.jsx)(`button`,{type:`button`,onClick:s,"aria-label":f.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:O})]}),(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:f.catalysisSectionDescription}),x?(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:f.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void S(()=>y(n),{revalidate:!1}),disabled:C,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:f.contextRebuild}),(0,$.jsx)(`span`,{className:L(`rounded-full px-2 py-0.5 text-[11px] font-medium`,x.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:x.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:x.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:f.contextStatusDetail.replace(`{{attachments}}`,String(x.attachments.length)).replace(`{{tokens}}`,String(x.tokenEstimate??0))}),x.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:x.attachments.slice(0,5).map(Rt)}):null]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:o,disabled:i,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:i?f.processing:g?f.recatalyze:f.catalyzeAction}),g?(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:f.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:g.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:g.targetUsers.slice(0,5).map(Lt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:g.keyQuestions.slice(0,3).map(It)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:g.mvpPath.slice(0,3).map(Ft)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:g.risks.slice(0,3).map(Pt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:g.nextActions.slice(0,4).map(Nt)})]}),(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:f.confidenceLabel.replace(`{{percent}}`,String(Math.round(g.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void T(`helpful`),className:L(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,h?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":f.feedbackHelpfulAria,children:(0,$.jsx)(Oe,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void T(`not_helpful`),className:L(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,h?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":f.feedbackNotHelpfulAria,children:(0,$.jsx)(Je,{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:f.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:[k,f.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:f.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:u,disabled:l,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:l?f.openingChat:f.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:d,disabled:l,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:f.newThread})]})]}),c.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:c.slice(0,5).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>p(`/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||f.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:f.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:f.noThreads})]})]})]})}function Nt(e){return(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}`)}function Pt(e){return(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)}function Ft(e,t){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,$.jsx)(`span`,{children:e})]},e)}function It(e){return(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)}function Lt(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e)}function Rt(e){return(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)}function zt(e){return e.language}var Bt=()=>i(()=>import(`./block-editor-i4CfDqLG.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])),Vt=()=>i(()=>import(`./markdown-editor-TWGaF7Xa.js`).then(e=>e.n),__vite__mapDeps([56,1,3,53,5,57])),Ht=(0,Q.lazy)(()=>Bt().then(e=>({default:e.BlockEditor}))),Ut=(0,Q.lazy)(()=>Vt().then(e=>({default:e.MarkdownEditor})));function Wt(){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 Gt(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:Ge},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:Me},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:l},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 u=c,d;return t[10]!==n||t[11]!==u||t[12]!==r?(d=(0,$.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg border border-edge p-0.5`,children:u.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(t),onMouseEnter:()=>{t===`wysiwyg`&&Bt(),t===`source`&&Vt()},onFocus:()=>{t===`wysiwyg`&&Bt(),t===`source`&&Vt()},className:L(`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]=u,t[12]=r,t[13]=d):d=t[13],d}function Kt(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=ee(qt),h;t[0]===m?h=t[1]:(h=z(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)(Jt,{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)($e,{closeLabel:g,children:_}),t[12]=g,t[13]=_,t[14]=v):v=t[14],v}function qt(e){return e.language}function Jt({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:o=!0,onOpenSearch:s,autoFocus:c=!1,onAutoFocusConsumed:l}){let u=ee(e=>e.language),d=z(u).notes,f=z(u).automations.suggestions,p=a(),m=te(e=>e.resolved)===`dark`,{openImage:h}=Ze(),[_,y]=(0,Q.useState)(`wysiwyg`),[b,x]=(0,Q.useState)(null),[S,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(360),[I,R]=(0,Q.useState)(!1),[B,ne]=(0,Q.useState)(!1),[re,ie]=(0,Q.useState)(!1),[ae,V]=(0,Q.useState)(null),oe=(0,Q.useRef)(!1),H=(0,Q.useRef)(!1),ce=(0,Q.useRef)(null),ue=(0,Q.useRef)(null),W=(0,Q.useRef)(null),de=(0,Q.useRef)(null),G=(0,Q.useRef)(null),fe=(0,Q.useRef)(null),pe=(0,Q.useRef)(null),me=(0,Q.useRef)(null),he=(0,Q.useRef)(null),_e=qe(e=>e.setPageHeader),K=qe(e=>e.clearPageHeader),{data:q,mutate:J}=U(e?[`note-detail`,e]:null,()=>w(e)),{data:ve=[],mutate:ye}=U(e?[`note-threads`,e]:null,()=>O(e),{revalidateOnFocus:!1}),Y=S!==null;(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&J()};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[J,e]),(0,Q.useEffect)(()=>{oe.current=!1,A(``),T(null),x(null),H.current=!1,he.current=null},[e]),(0,Q.useEffect)(()=>{!q||oe.current||(A(q.title??``),oe.current=!0)},[q]),(0,Q.useEffect)(()=>{if(!c||!q||Y||he.current===e)return;let t=window.requestAnimationFrame(()=>{me.current?.focus(),l?.()});return he.current=e,()=>window.cancelAnimationFrame(t)},[c,Y,q,e,l]);let be=q?new Date(q.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,xe=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":d.back,className:L(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,se,i),children:(0,$.jsx)(Ve,{className:`size-4`,"aria-hidden":!0})}):null,[i,d.back,t,r]),Se=(0,Q.useCallback)(t=>{A(t),e&&(de.current=t,ue.current&&clearTimeout(ue.current),ue.current=setTimeout(async()=>{let t=de.current;if(de.current=null,t!==null){D(!0);try{await M(e,{title:t}),await J(),n?.()}catch{}finally{D(!1)}}},600))},[e,J,n]),we=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:L(`flex min-w-0 items-center gap-2`,se),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:k||be||void 0,children:k||be}),E?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:d.saving}):null]}),[d.saving,E,be,k]),Te=(0,Q.useCallback)(async(t=!1)=>{ie(!0),V(null);try{let n=await v(e,{forceNew:t});await J(),await ye(),p(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){V(`${d.chatOpenFailedTitle}: ${e instanceof Error?e.message:d.chatOpenFailedMessage}`)}finally{ie(!1)}},[J,ye,p,e,d.chatOpenFailedMessage,d.chatOpenFailedTitle]),X=(0,Q.useCallback)(async()=>{ne(!0),V(null);try{await C(e),await J()}catch(e){V(`${d.catalysisFailed}: ${e instanceof Error?e.message:d.chatOpenFailedMessage}`)}finally{ne(!1)}},[J,e]),De=(0,Q.useCallback)(()=>{x(b===`breakdown`?null:`breakdown`),!q?.aiDeep?.catalysis?.report&&!B&&X()},[b,B,X,q?.aiDeep?.catalysis?.report]),Oe=(0,Q.useCallback)(()=>{let t=S?.markdown??W.current??q?.markdown??``,n=S?.title??k,r=Ee([n,t].filter(Boolean).join(`
3
-
4
- `));return{source:{type:`note`,id:e,title:n||d.titlePlaceholder},text:r,language:Ce(r,u)}},[u,d.titlePlaceholder,q?.markdown,e,S,k]),ke=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:L(`flex items-center gap-2`,se),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)(F,{className:`size-4`,"aria-hidden":!0})}):null,(0,$.jsx)(ge,{input:Oe,labels:{read:d.readAloud,preparing:d.readAloudPreparing,pause:d.readAloudPause,resume:d.readAloudResume,retry:d.readAloudRetry},showLabel:!0}),(0,$.jsxs)(`button`,{type:`button`,onClick:De,disabled:B,"aria-label":d.catalysisSectionTitle,className:L(`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`,b===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,$.jsx)(le,{className:`size-3.5`,"aria-hidden":!0}),B?d.catalyzing:d.catalyzeButton]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Te(!1),disabled:re,className:L(`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)(Fe,{className:`size-3.5`,"aria-hidden":!0}),re?d.openingChat:d.openChatButton]}),(0,$.jsx)(Gt,{mode:_,onModeChange:y,labels:{edit:d.modeEdit,source:d.modeSource,preview:d.modePreview}}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>x(b===`history`?null:`history`),"aria-label":d.history,className:L(`rounded-lg p-1.5 transition-colors`,b===`history`?`bg-accent/10 text-accent`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:(0,$.jsx)(Ye,{className:`size-4`,"aria-hidden":!0})})]}),[B,De,Te,_,d.history,d.modeEdit,d.modePreview,d.modeSource,re,b,s,d.searchDialogTitle,d.readAloud,d.readAloudPause,d.readAloudPreparing,d.readAloudResume,d.readAloudRetry,Oe]);(0,Q.useLayoutEffect)(()=>(_e({startExtra:xe,main:q?we:null,end:q?ke:null}),()=>{o&&K()}),[o,K,ke,we,xe,q,_e]);let Ae=(0,Q.useCallback)(t=>{e&&(W.current=t,ce.current&&clearTimeout(ce.current),ce.current=setTimeout(async()=>{let t=W.current;if(W.current=null,t!==null){D(!0),V(null);try{await M(e,{markdown:t}),await J(),n?.()}catch(e){V(`${d.saveFailed}: ${e instanceof Error?e.message:d.saveFailedHint}`)}finally{D(!1)}}},600))},[e,J,d.saveFailed,d.saveFailedHint,n]),je=(0,Q.useCallback)(t=>{g(e,t.timestamp).then(e=>{e&&T(e)})},[e]),Me=(0,Q.useCallback)(()=>{x(null),T(null)},[]),Ne=(0,Q.useCallback)(()=>{x(null),T(null),J(),n?.()},[J,n]);if((0,Q.useEffect)(()=>()=>{ce.current&&clearTimeout(ce.current),ue.current&&clearTimeout(ue.current);let t=W.current,n=de.current;W.current=null,de.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&M(e,r)},[e]),q===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(q===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 Pe=Y?S.title??``:k,Ie=Y?S.markdown??``:q.markdown??``,Le=new Date(q.createdAt).getTime(),Re=Number.isFinite(Le)&&Date.now()-Le<3600*1e3?(0,$.jsx)(vt,{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)(`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:[ae?(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:ae}):null,(0,$.jsx)(Ue,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsx)(Ue,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsxs)(`div`,{ref:G,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)(Tt,{noteId:e}),(0,$.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1`,children:Y?(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,children:[Pe&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:Pe}),Ie?(0,$.jsx)(j,{noteId:e,content:Ie,className:`opacity-80`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:d.emptyPreview})]}):(0,$.jsxs)($.Fragment,{children:[_===`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:me,type:`text`,value:k,onChange:e=>Se(e.target.value),onCompositionStart:()=>{H.current=!0},onCompositionEnd:()=>{H.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!H.current&&!t.isComposing&&(e.preventDefault(),(G.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`}),Re]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Wt,{}),children:(0,$.jsx)(Ht,{initialContent:q.markdown??``,onChange:Ae,noteId:e},`wysiwyg-${e}`)})})]}),_===`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:me,type:`text`,value:k,onChange:e=>Se(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`}),Re]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Wt,{}),children:(0,$.jsx)(Ut,{initialContent:q.markdown??``,onChange:Ae,isDark:m},`source-${e}`)})})]}),_===`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:[k&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:k}),q.markdown?(0,$.jsx)(j,{noteId:e,content:q.markdown,className:`[&_img]:cursor-zoom-in`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:d.emptyPreview})]})]})})]})]}),(0,$.jsx)(`div`,{ref:fe,className:L(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!I&&`transition-[width] duration-300 ease-in-out`),style:{width:b?N:0},children:(0,$.jsxs)(`div`,{ref:pe,className:`flex min-h-0 flex-1 flex-col`,style:{width:N},children:[(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),R(!0);let n=e.clientX,r=N,i=e.pointerId,a=0,o=N,s=N,c=()=>{a=0,s=o,b&&fe.current?.style.setProperty(`width`,`${s}px`),pe.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{}R(!1),P(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:L(`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`,I&&`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:b===`history`?(0,$.jsx)(jt,{noteId:e,activeTimestamp:S?.timestamp??null,onSelect:je,onClose:Me,onRestored:Ne}):b===`breakdown`?(0,$.jsx)(Mt,{noteId:e,note:q??null,catalyzing:B,onCatalyze:X,onClose:()=>x(null),noteThreads:ve,openingChat:re,onOpenChat:()=>Te(!1),onOpenNewChat:()=>Te(!0)}):null})]})})]})}var Yt=3e4;function Xt(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function Zt({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,S]=(0,Q.useState)(0),[C,w]=(0,Q.useState)(!1),T=(0,Q.useRef)(null),E=(0,Q.useRef)(null),D=(0,Q.useRef)(null),O=(0,Q.useRef)([]),k=(0,Q.useRef)(0),A=(0,Q.useRef)(null),j=(0,Q.useRef)(null),M=(0,Q.useCallback)(()=>{A.current&&=(clearInterval(A.current),null),j.current&&=(clearTimeout(j.current),null),D.current?.getTracks().forEach(e=>e.stop()),D.current=null,E.current=null,O.current=[],b(!1),S(0)},[]);(0,Q.useEffect)(()=>()=>M(),[M]);let N=(0,Q.useCallback)(async()=>{let e=E.current;if(!e||e.state!==`recording`)return;w(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-k.current)/1e3)),n=e.mimeType||Xt()||`audio/webm`,r=new Blob(O.current,{type:n});if(M(),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{w(!1)}return}w(!1)},[M,c]),F=(0,Q.useCallback)(async()=>{if(!(!c||C||y)){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){l?.();return}try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});D.current=e;let t=Xt(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);E.current=n,O.current=[],k.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&O.current.push(e.data)},n.start(),b(!0),S(0),A.current=setInterval(()=>{S(Math.round((Date.now()-k.current)/1e3))},250),j.current=setTimeout(()=>{N()},Yt)}catch{M(),l?.()}}},[M,c,l,y,N,C]),I=(0,Q.useCallback)(async()=>{let e=h.trim();if(!(!e||_)){v(!0),g(``);try{await o(e)}catch{g(e)}finally{v(!1),T.current?.focus()}}},[h,_,o]),R=(0,Q.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),I())},[I]),z=_||C,B=!!(s||c||p);return(0,$.jsxs)(`div`,{className:L(`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 N(),disabled:C,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)(G,{className:`size-4 fill-current`,"aria-hidden":!0})}):B?(0,$.jsxs)(be,{children:[(0,$.jsx)(_e,{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)(P,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(ve,{children:(0,$.jsxs)(Y,{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)(pe,{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)(me,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),r]}):null,c?(0,$.jsxs)(pe,{disabled:f,onSelect:()=>void F(),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)(Pe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i]}):null,p?(0,$.jsxs)(pe,{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)(J,{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:T,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 I(),"aria-label":t,title:t,className:L(`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)(ue,{className:`size-4`,"aria-hidden":!0})})]})}var Qt={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},$t=240,en=320,tn=520,nn=560;function rn(e){if(globalThis.localStorage===void 0)return en;try{let t=globalThis.localStorage.getItem(e);if(!t)return en;let n=Number(t);return Number.isFinite(n)?n:en}catch{return en}}function an(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var on={thought:W,todo:ze,voice:Pe,media:me,bookmark:K,mixed:W,task:ze};function sn(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function cn(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function ln(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function un({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:i=!0,projectId:c,listTitle:l,listDescription:u,emptyText:d,emptyDescription:f,listWidthStorageKey:p=`xopc.notes.listWidth`}){let m=z(ee(e=>e.language)).notes,g=!!B(e=>e.token),[v,y]=(0,Q.useReducer)(he,Qt),[x,C]=(0,Q.useState)(!1),[w,D]=(0,Q.useState)(``),[O,k]=(0,Q.useState)(0),[A,j]=(0,Q.useState)(()=>rn(p)),[N,R]=(0,Q.useState)(!1),[te,ce]=(0,Q.useState)(!1),[le,ue]=(0,Q.useState)(!1),[de,G]=(0,Q.useState)(null),[fe,pe]=(0,Q.useState)(null),me=(0,Q.useRef)(null),ge=(0,Q.useRef)(null),[_e]=(0,Q.useState)(()=>Date.now()),K=a(),J=(0,Q.useCallback)(e=>{let t=me.current?.clientWidth??window.innerWidth,n=Math.max($t,t-nn);return Math.max($t,Math.min(Math.min(tn,n),e))},[]),ve=(0,Q.useCallback)(e=>{let t=J(e);j(t),an(p,t)},[J,p]);(0,Q.useLayoutEffect)(()=>{j(e=>J(e))},[J]);let{data:ye,mutate:Y,isLoading:be}=U((0,Q.useMemo)(()=>g?[`notes-list`,c,v.statusFilter,v.kindFilter,v.pinnedOnly]:null,[g,c,v.statusFilter,v.kindFilter,v.pinnedOnly]),()=>_({status:v.statusFilter===`all`?void 0:v.statusFilter,kind:v.kindFilter===`all`?void 0:v.kindFilter,projectId:c,pinned:v.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),xe=be&&!ye,Se=ye?.items??[],Ce=ye?.total??0,we=w.trim(),{data:Te,isLoading:Ee}=U(g&&x&&we?[`notes-search`,c,we]:null,()=>_({search:we,projectId:c,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),X=Te?.items??[],De=e?Se.some(t=>t.id===e):!0;(0,Q.useEffect)(()=>{k(0)},[we]),(0,Q.useEffect)(()=>{O>=X.length&&k(Math.max(0,X.length-1))},[O,X.length]),(0,Q.useEffect)(()=>{let e=()=>{Y()};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[Y]);let Oe=qe(e=>e.setPageHeader),Ae=qe(e=>e.clearPageHeader),je=m.noteCount.replace(`{{count}}`,String(Ce)),Me=!r&&Ce===0&&u?u:je,Ne=m.searchDialogTitle,Pe=m.searchClose,Fe=m.searchClear,Ie=(0,Q.useMemo)(()=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>C(!0),className:L(`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`,se),"aria-label":Ne,children:[(0,$.jsx)(F,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:Ne})]}),[Ne]);(0,Q.useLayoutEffect)(()=>{if(n)return g?(Oe({startExtra:null,main:(0,$.jsxs)(`div`,{className:L(`flex min-w-0 items-center gap-2`,se),children:[(0,$.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:l??m.title}),je?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:je}):null]}),end:Ie}),()=>Ae()):(Ae(),()=>Ae())},[Ae,g,Ie,l,n,m.title,je,e,Oe]);let Le=(0,Q.useMemo)(()=>({justNow:m.justNow,minutesAgo:m.minutesAgo,today:m.today,yesterday:m.yesterday,daysAgo:m.daysAgo}),[m.justNow,m.minutesAgo,m.today,m.yesterday,m.daysAgo]),Re=(0,Q.useMemo)(()=>[{id:`recent`,label:m.viewRecent,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:m.filterInbox,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:m.pinned,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:m.viewTasks,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:m.kindVoice,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:m.kindMedia,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:m.kindBookmark,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:m.filterProcessed,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:m.filterArchived,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[m.filterArchived,m.filterInbox,m.filterProcessed,m.kindBookmark,m.kindMedia,m.kindVoice,m.pinned,m.viewRecent,m.viewTasks]),ze=Re.find(e=>cn(v,e))??Re[0],Be=l??ze.label,Ve=(0,Q.useCallback)(async e=>{G(null);try{let n=c?await E({markdown:e,kind:`thought`,projectId:c,channel:`web`}):await T(e,`web`);await Y(),K(ln(t,n.id))}catch(e){throw G(`${m.quickCaptureFailed}: ${e instanceof Error?e.message:m.quickCaptureFailedHint}`),e}},[t,Y,m.quickCaptureFailed,m.quickCaptureFailedHint,K,c]),He=(0,Q.useCallback)(async()=>{if(!le){ue(!0),G(null);try{let e=await E({markdown:``,kind:`thought`,projectId:c,channel:`web`});y({type:`patch`,patch:Qt}),await Y(),pe(e.id),K(ln(t,e.id))}catch(e){G(`${m.createBlankFailed}: ${e instanceof Error?e.message:m.createBlankFailedHint}`)}finally{ue(!1)}}},[t,le,Y,m.createBlankFailed,m.createBlankFailedHint,K,c]),Ue=(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{G(null),await S(t,`web`),await Y()}catch(e){G(`${m.imageUploadFailed}: ${e instanceof Error?e.message:m.imageUploadFailedHint}`)}},e.click()},[Y,m.imageUploadFailed,m.imageUploadFailedHint]),We=(0,Q.useCallback)(async(e,t)=>{try{G(null),await b(e,t,`web`),await Y()}catch(e){G(`${m.voiceUploadFailed}: ${e instanceof Error?e.message:m.voiceUploadFailedHint}`)}},[Y,m.voiceUploadFailed,m.voiceUploadFailedHint]),Ge=(0,Q.useCallback)(()=>{G(`${m.voiceCaptureFailed}: ${m.voiceCaptureFailedHint}`)},[m.voiceCaptureFailed,m.voiceCaptureFailedHint]),Ke=(0,Q.useCallback)(async(e,t)=>{await M(e,{pinned:t}),await Y()},[Y]),Je=(0,Q.useCallback)(async e=>{await M(e,{status:`archived`}),await Y()},[Y]),Ye=(0,Q.useCallback)(async e=>{await h(e),await Y()},[Y]),Z=(0,Q.useCallback)(e=>{K(ln(t,e))},[t,K]),Xe=(0,Q.useCallback)(e=>{K(ln(t,e)),C(!1)},[t,K]),Ze=(0,Q.useCallback)(e=>{if(X.length){if(e.key===`ArrowDown`)e.preventDefault(),k(e=>Math.min(X.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),k(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=X[O]??X[0];t&&Xe(t.id)}}},[O,Xe,X]),Qe=(0,Q.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=ge.current;t.setPointerCapture(e.pointerId),R(!0);let r=me.current?.clientWidth??window.innerWidth,i=Math.max($t,r-nn),a=Math.min(tn,i),o=e=>Math.max($t,Math.min(a,e)),s=e.clientX,c=o(A),l=e.pointerId,u=0,d=c,f=c;n&&(n.style.transition=`none`,n.style.width=`${c}px`);let m=()=>{u=0,f=d,n&&(n.style.width=`${f}px`)},h=e=>{d=o(c+e.clientX-s),u===0&&(u=window.requestAnimationFrame(m))},g=()=>{u!==0&&(window.cancelAnimationFrame(u),m());try{t.releasePointerCapture(l)}catch{}R(!1),me.current?.style.setProperty(`--notes-list-width`,`${f}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),j(f),an(p,f),window.removeEventListener(`pointermove`,h),window.removeEventListener(`pointerup`,g),window.removeEventListener(`pointercancel`,g)};window.addEventListener(`pointermove`,h),window.addEventListener(`pointerup`,g),window.addEventListener(`pointercancel`,g)},[p,A]);(0,Q.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),He())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[He]);let $e=(0,Q.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),ve(A-16)):e.key===`ArrowRight`?(e.preventDefault(),ve(A+16)):e.key===`Home`?(e.preventDefault(),ve($t)):e.key===`End`&&(e.preventDefault(),ve(tn))},[ve,A]);return g?(0,$.jsxs)(`div`,{ref:me,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-base`,style:{"--notes-list-width":`${A}px`},children:[(0,$.jsxs)(`section`,{ref:ge,className:L(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden border-r border-edge bg-surface-rail`,!N&&`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:[de?(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:de}):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)(o,{value:ze.id,onChange:e=>{let t=Re.find(t=>t.id===e.target.value);t&&y({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":m.libraryTitle,children:Re.map(e=>(0,$.jsx)(s,{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:Me})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>ce(!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":m.collapseNotesList,title:m.collapseNotesList,children:(0,$.jsx)(ke,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:He,disabled:le,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":m.createBlankNote,title:m.createBlankShortcut,children:(0,$.jsx)(P,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>C(!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":m.searchDialogTitle,title:m.searchDialogTitle,children:(0,$.jsx)(F,{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:xe?(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))}):Se.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)(W,{className:`size-6`,"aria-hidden":!0})}),(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:e&&!De?m.noteOutsideCurrentView:d??m.noNotes}),e&&!De?null:(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:f??m.noNotesDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!De?(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:m.noteOutsideCurrentView}):null,Se.map((t,n)=>{let r=n>0?st(Se[n-1].createdAt):null;return(0,$.jsxs)(`div`,{children:[st(t.createdAt)!==r&&(0,$.jsx)(`div`,{className:L(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:ot(t.createdAt,_e,Le)}),(0,$.jsx)(pt,{note:t,selected:t.id===e,onPress:Z,onPin:Ke,onArchive:Je,onDelete:Ye,timeLabels:Le,labels:{pin:m.pin,unpin:m.unpin,archive:m.archive,delete:m.delete,actions:m.noteActions,imageNote:m.imageNote,noText:m.noText}})]},t.id)})]})}),(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(Zt,{placeholder:m.quickCapturePlaceholder,submitLabel:m.quickCaptureSubmit,actionsLabel:m.quickCaptureActions,imageLabel:m.quickCaptureImage,voiceLabel:m.quickCaptureVoice,stopRecordingLabel:m.stopRecording,onCapture:Ve,onImagePick:i?Ue:void 0,onVoiceCapture:i?We:void 0,onVoiceError:Ge,recordingLabel:m.recording,discussionCaptureLabel:m.discussionCapture.title,onDiscussionCapture:()=>q(c)})})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":m.resizeNotesList,"aria-valuemin":$t,"aria-valuemax":tn,"aria-valuenow":Math.round(A),tabIndex:0,onPointerDown:Qe,onDoubleClick:()=>ve(en),onKeyDown:$e,title:m.resizeNotesList,className:L(`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:L(`h-full w-px bg-edge transition-[background-color,transform] duration-150`,`group-hover:bg-accent/70 group-focus-visible:bg-accent`,N&&`bg-accent scale-x-[2]`)})}),(0,$.jsxs)(`section`,{className:L(`relative min-w-0 flex-1 bg-surface-base`,!e&&`hidden lg:flex`),children:[te?(0,$.jsx)(`button`,{type:`button`,onClick:()=>ce(!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":m.expandNotesList,title:m.expandNotesList,children:(0,$.jsx)(ke,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,$.jsx)(Kt,{noteId:e,onBack:()=>K(t),onSaved:()=>void Y(),backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>C(!0),autoFocus:e===fe,onAutoFocusConsumed:()=>pe(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)(W,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:m.emptyEditorTitle}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:m.emptyEditorDescription}),(0,$.jsxs)(`button`,{type:`button`,onClick:He,disabled:le,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)(P,{className:`size-4`,"aria-hidden":!0}),le?m.creatingBlankNote:m.createBlankNote]})]})})]}),(0,$.jsx)(H,{open:x,onOpenChange:C,children:(0,$.jsxs)(ae,{children:[(0,$.jsx)(ne,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(V,{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)(oe,{className:`text-sm font-semibold text-fg`,children:Ne}),(0,$.jsx)(re,{className:`sr-only`,children:m.searchPlaceholder}),(0,$.jsx)(ie,{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":Pe,children:(0,$.jsx)(I,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(F,{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:w,onChange:e=>D(e.target.value),onKeyDown:Ze,placeholder:m.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`}),w?(0,$.jsx)(`button`,{type:`button`,onClick:()=>D(``),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":Fe,children:(0,$.jsx)(I,{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:we?Ee&&!Te?(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)(W,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:m.searchNoResults}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:m.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:m.searchResultsCount.replace(`{{count}}`,String(Te?.total??X.length))}),X.map((e,t)=>{let n=on[e.kind]||W,r=sn(e,{imageNote:m.imageNote,noText:m.noText});return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Xe(e.id),onMouseEnter:()=>k(t),className:L(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===O?`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:at(e.updatedAt,_e,Le)})]}),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)(F,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:m.searchEmptyTitle}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:m.searchEmptyDescription})]})})]})]})]})})]}):(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,$.jsx)(W,{className:`size-10 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:m.needToken})]})}export{Ze as n,un as t};