@xopcai/xopc 0.0.153 → 0.0.155

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 (109) 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/{activity-store-XA9328eM.js → activity-store-Btmg10yU.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-E09Jv6kW.js → agent-avatar-dicebear-pdlJJov8.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agents-BA46Lyc7.js → agents-NDjTqOIb.js} +1 -1
  6. package/dist/gateway/static/root/assets/{api-kQEpNIa-.js → api-GGYxPxVF.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-BzrND8g7.js → app-management-settings-panel-BU9oSmtJ.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-CKMCWf75.js → appearance-settings-B2chSkbj.js} +1 -1
  9. package/dist/gateway/static/root/assets/{apps-page-DPP_gFCc.js → apps-page-DHvwQknj.js} +1 -1
  10. package/dist/gateway/static/root/assets/{archive-plugin-DNOroxSq.js → archive-plugin-BC83GwY1.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-PtKuOOfL.js → attachment-load-DWSH5325.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automation-suggestion-card-C7HQ5bAK.js → automation-suggestion-card-Bc25f4wz.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automations-page-BuMTtTYy.js → automations-page-32U6mfy-.js} +1 -1
  14. package/dist/gateway/static/root/assets/{binary-plugins-DDFoTNKm.js → binary-plugins-Kgu5yX35.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-CH_e8EXF.js → block-editor-B9gJmzdE.js} +4 -4
  16. package/dist/gateway/static/root/assets/{browser-settings-page-43uOCSrE.js → browser-settings-page-CTWycuu_.js} +1 -1
  17. package/dist/gateway/static/root/assets/{capability-presets-api-Cby6Utaf.js → capability-presets-api-6z36IfIC.js} +1 -1
  18. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-BZvp3H2p.js → capability-presets-settings-panel-Bqzl2UZ9.js} +1 -1
  19. package/dist/gateway/static/root/assets/{channel-recipient-api-COdmaOO4.js → channel-recipient-api-DEkm4HRd.js} +1 -1
  20. package/dist/gateway/static/root/assets/{channels-settings-BAPRTSF4.js → channels-settings-DdelF9BQ.js} +1 -1
  21. package/dist/gateway/static/root/assets/channels-status-swr-CBgr61Zt.js +1 -0
  22. package/dist/gateway/static/root/assets/{connector-logo-CinEws2y.js → connector-logo-DPriINR1.js} +1 -1
  23. package/dist/gateway/static/root/assets/{connectors-page-P-Ur9mlf.js → connectors-page-CO3ASIfE.js} +1 -1
  24. package/dist/gateway/static/root/assets/{desktop-pet-O3wyOYRG.js → desktop-pet-CG91Su8E.js} +1 -1
  25. package/dist/gateway/static/root/assets/{desktop-pet-settings-nbvEKluo.js → desktop-pet-settings-DUzETFxq.js} +1 -1
  26. package/dist/gateway/static/root/assets/{directory-picker-path-field-DyZJo5xz.js → directory-picker-path-field-XNbI2wM7.js} +1 -1
  27. package/dist/gateway/static/root/assets/{dreaming-settings-CruD-NNs.js → dreaming-settings-BsLa5Nr8.js} +1 -1
  28. package/dist/gateway/static/root/assets/{extension-debug-page-CV7SDe48.js → extension-debug-page-C-5Nyrdu.js} +1 -1
  29. package/dist/gateway/static/root/assets/{extension-page-DJCYwgB_.js → extension-page-BEocT43y.js} +1 -1
  30. package/dist/gateway/static/root/assets/{extension-settings-page-6kJQVKbq.js → extension-settings-page--XOHrL-O.js} +1 -1
  31. package/dist/gateway/static/root/assets/{gateway-config-api-DOewYtbP.js → gateway-config-api-DZrNmiR3.js} +1 -1
  32. package/dist/gateway/static/root/assets/{gateway-settings-BjjXod61.js → gateway-settings-DfBvlqb2.js} +1 -1
  33. package/dist/gateway/static/root/assets/{gateway-startup-retry-ewVb05iS.js → gateway-startup-retry-Cc5dxiD_.js} +1 -1
  34. package/dist/gateway/static/root/assets/{goal-create-dialog-BStw0m9M.js → goal-create-dialog-BRVB5I7f.js} +1 -1
  35. package/dist/gateway/static/root/assets/{goal-detail-page-BOChQ7i7.js → goal-detail-page-Drdz_llY.js} +1 -1
  36. package/dist/gateway/static/root/assets/{goals-config-api-CYNvVerg.js → goals-config-api-Cdghd3f3.js} +1 -1
  37. package/dist/gateway/static/root/assets/{goals-page-BrNRDv8T.js → goals-page-CEh2UTzg.js} +1 -1
  38. package/dist/gateway/static/root/assets/{goals-settings-CHZcm6es.js → goals-settings-CvOdikU6.js} +1 -1
  39. package/dist/gateway/static/root/assets/{heartbeat-settings-B5oMLvbo.js → heartbeat-settings-CvaxjdV_.js} +1 -1
  40. package/dist/gateway/static/root/assets/{index-B5cSZcER.js → index-C4HpPu1y.js} +62 -62
  41. package/dist/gateway/static/root/assets/index-DjvInkv6.css +1 -0
  42. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-Eb8IqcMd.js → keyboard-shortcuts-settings-BVt0deH6.js} +1 -1
  43. package/dist/gateway/static/root/assets/{local-app-workbench-page-L-MQ_dJY.js → local-app-workbench-page-Dcmb1Ruc.js} +1 -1
  44. package/dist/gateway/static/root/assets/{local-apps-page-Zb0f5eNc.js → local-apps-page-C0HGfwao.js} +1 -1
  45. package/dist/gateway/static/root/assets/{locale-store-CQDaFvDN.js → locale-store-Dt0pSudQ.js} +1 -1
  46. package/dist/gateway/static/root/assets/logs-page-BWdV-HsP.js +7 -0
  47. package/dist/gateway/static/root/assets/{markdown-split-RnzQRPvB.js → markdown-split-CjVg43Kl.js} +1 -1
  48. package/dist/gateway/static/root/assets/{media-plugins-BoX0SWrl.js → media-plugins-D-LkrsY6.js} +1 -1
  49. package/dist/gateway/static/root/assets/{messages--cnUi8Ld.js → messages-CqXpNawC.js} +4 -4
  50. package/dist/gateway/static/root/assets/{models-hub-panel-BQuynkNz.js → models-hub-panel-Du41WFC6.js} +1 -1
  51. package/dist/gateway/static/root/assets/{notes-page-CSOXTk0P.js → notes-page-BsoNcBQ3.js} +1 -1
  52. package/dist/gateway/static/root/assets/{notes-workbench-B7NIQBqd.js → notes-workbench-VeU2xG2r.js} +2 -2
  53. package/dist/gateway/static/root/assets/{page-tabs-Dl9G6Pm3.js → page-tabs-C9OfBAT6.js} +1 -1
  54. package/dist/gateway/static/root/assets/{preview-open-alternatives-B8R5o1uN.js → preview-open-alternatives-BCrigyTS.js} +1 -1
  55. package/dist/gateway/static/root/assets/{project-detail-page-DoN-qkzc.js → project-detail-page-B9QsnXWV.js} +1 -1
  56. package/dist/gateway/static/root/assets/{projects-page-BBOW0A-s.js → projects-page-BbplZbzF.js} +1 -1
  57. package/dist/gateway/static/root/assets/{remote-access-hub-BzXHX9bU.js → remote-access-hub-CfbuqKDd.js} +1 -1
  58. package/dist/gateway/static/root/assets/{save-bar-controls-D6OGeVDa.js → save-bar-controls-CnyZMYdJ.js} +1 -1
  59. package/dist/gateway/static/root/assets/{schedule-field-CKrch41X.js → schedule-field-Bez97_Ou.js} +1 -1
  60. package/dist/gateway/static/root/assets/{schema-form-FroNrvKO.js → schema-form-DbKY5jSv.js} +1 -1
  61. package/dist/gateway/static/root/assets/{sessions-page-c4n4TLc2.js → sessions-page-CSQLpHd4.js} +1 -1
  62. package/dist/gateway/static/root/assets/settings-advanced-gate-C25HTTPK.js +1 -0
  63. package/dist/gateway/static/root/assets/{settings-collapsible-section-1SeKT26L.js → settings-collapsible-section-4f60Dgw-.js} +1 -1
  64. package/dist/gateway/static/root/assets/{settings-form-section-Cz4xOOt4.js → settings-form-section-CCQ7MjdZ.js} +1 -1
  65. package/dist/gateway/static/root/assets/{settings-loading-skeleton-rBI7xqmM.js → settings-loading-skeleton-CQhjhb0F.js} +1 -1
  66. package/dist/gateway/static/root/assets/{settings-page-7SlGFgmR.js → settings-page-BZb-E5vI.js} +1 -1
  67. package/dist/gateway/static/root/assets/{settings-page-layout-C7B19AHf.js → settings-page-layout-C7sfPFaM.js} +1 -1
  68. package/dist/gateway/static/root/assets/{setup-status-panel-_x53a0I_.js → setup-status-panel-B1FSxWQ3.js} +1 -1
  69. package/dist/gateway/static/root/assets/{share-preview-page-DwcX1sXG.js → share-preview-page-DeErzPeg.js} +1 -1
  70. package/dist/gateway/static/root/assets/{shares-settings-BwfS4kkk.js → shares-settings-DDg5dL3k.js} +1 -1
  71. package/dist/gateway/static/root/assets/skill-reload-api-B-ocgAT-.js +1 -0
  72. package/dist/gateway/static/root/assets/{skills-page-sCuywwN5.js → skills-page-CtO4i9ds.js} +1 -1
  73. package/dist/gateway/static/root/assets/sliding-segmented-uWmrxE3P.js +1 -0
  74. package/dist/gateway/static/root/assets/{system-settings-panel-CZkASLIv.js → system-settings-panel-Dk1ZhfpM.js} +1 -1
  75. package/dist/gateway/static/root/assets/{theme-store-DP5WlsZg.js → theme-store-Cd_gY2Cb.js} +1 -1
  76. package/dist/gateway/static/root/assets/{typed-models-lib-C2TbyW3H.js → typed-models-lib-fe1xAgdw.js} +1 -1
  77. package/dist/gateway/static/root/assets/{use-channel-catalog-4WYXfEXk.js → use-channel-catalog-Cbo3s1uh.js} +1 -1
  78. package/dist/gateway/static/root/assets/{user-context-page-0MO96b3-.js → user-context-page-CqtVqiYz.js} +1 -1
  79. package/dist/gateway/static/root/assets/{user-profile-fields-editor-Cqalx8iJ.js → user-profile-fields-editor-DcnCOHwp.js} +1 -1
  80. package/dist/gateway/static/root/assets/{user-profile-settings-panel-CVbTC44o.js → user-profile-settings-panel-CTWZR6nV.js} +1 -1
  81. package/dist/gateway/static/root/assets/{utils-DOvyuYat.js → utils-BDzZMJls.js} +1 -1
  82. package/dist/gateway/static/root/assets/{voice-api-key-field-ClOb2PfC.js → voice-api-key-field-C9Psto-d.js} +1 -1
  83. package/dist/gateway/static/root/assets/{work-discovery-page-Ci_rGhsb.js → work-discovery-page-CNVeagdJ.js} +1 -1
  84. package/dist/gateway/static/root/assets/{work-item-detail-page-DnJeDqJB.js → work-item-detail-page-DKSNc1SH.js} +1 -1
  85. package/dist/gateway/static/root/assets/work-page-Bwbg1Ht-.js +1 -0
  86. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-pNCz37MS.js → workflow-run-setup-panel-ZKbrdYmp.js} +1 -1
  87. package/dist/gateway/static/root/assets/{workflows-page-BFTxMEH6.js → workflows-page-DBHqpZ76.js} +1 -1
  88. package/dist/gateway/static/root/index.html +7 -7
  89. package/dist/package.js +1 -1
  90. package/dist/src/agent/embedded/run-turn.js +2 -2
  91. package/dist/src/agent/embedded/session-runner.js +3 -3
  92. package/dist/src/agent/embedded/xopc-stream-bridge.d.ts +1 -1
  93. package/dist/src/agent/embedded/xopc-stream-bridge.js +1 -1
  94. package/dist/src/config/agent-profile.js +1 -1
  95. package/dist/src/gateway/agents-admin.js +1 -1
  96. package/dist/src/gateway/heartbeat/service.js +1 -1
  97. package/dist/src/heartbeat/index.js +1 -1
  98. package/dist/src/infra/update-restart.d.ts +1 -0
  99. package/dist/src/infra/update-restart.js +20 -0
  100. package/dist/src/infra/update-runner.js +1 -0
  101. package/dist/src/infra/update-service-refresh.d.ts +14 -0
  102. package/dist/src/infra/update-service-refresh.js +66 -0
  103. package/package.json +5 -5
  104. package/dist/gateway/static/root/assets/channels-status-swr-DvB_8J5B.js +0 -1
  105. package/dist/gateway/static/root/assets/index-CNr0KWZU.css +0 -1
  106. package/dist/gateway/static/root/assets/logs-page-ToUMpW7t.js +0 -7
  107. package/dist/gateway/static/root/assets/settings-advanced-gate-BEsX3iAM.js +0 -1
  108. package/dist/gateway/static/root/assets/skill-reload-api-BkjO4n_a.js +0 -1
  109. package/dist/gateway/static/root/assets/work-page-n9XZM9PY.js +0 -1
@@ -1,7 +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{d as i}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as a}from"./cn-BQ_8x0bT.js";import{t as o}from"./copy-to-clipboard-HOJ79TWv.js";import{t as s}from"./messages--cnUi8Ld.js";import{l as c,n as l,r as u,s as d}from"./locale-store-CQDaFvDN.js";import{$o as f,Cs as p,El as m,Fl as h,Fo as g,Jc as _,Kl as v,Lo as y,No as b,Po as x,Ro as S,Rs as C,Yo as w,Zo as T,_s as E,ac as D,as as O,au as k,ba as A,bl as j,da as M,es as N,fc as P,is as F,lo as I,ms as L,os as R,rs as z,ts as B,yl as ee,ys as V,zo as te}from"./index-B5cSZcER.js";import{r as H}from"./segmented-styles-BL8oLBEp.js";var U=e(t(),1),W=n();function G(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 K(e){return d(u(`/api/logs${G(e)}`))}async function q(){return(await d(u(`/api/logs/files`))).files??[]}async function J(){return(await d(u(`/api/logs/modules`))).modules??[]}async function Y(){let e=await d(u(`/api/logs/stats`));return{byLevel:e.byLevel??{},runtime:e.runtime}}async function ne(){return(await d(u(`/api/logs/dir`))).dir??``}async function X(){return(await d(u(`/api/logs/level`))).level??`info`}async function Z(e,t){return d(u(`/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 d(u(`/api/logs/errors/summary${n?`?${n}`:``}`))).items??[]}var ie=500,ae=class{_token;_callbacks;_abort;constructor(e,t){this._token=e,this._callbacks=t}connect(e,t){this.disconnect();let n=new AbortController;this._abort=n,this._consume(n,e,t)}async _consume(e,t,n){let r=new URL(u(`/api/logs/stream`));t?.length?r.searchParams.set(`levels`,t.join(`,`)):r.searchParams.set(`levels`,`trace,debug,info,warn,error,fatal`),n&&r.searchParams.set(`module`,n);try{let t=new Headers({Accept:`text/event-stream`});this._token&&t.set(`Authorization`,`Bearer ${this._token}`);let n=await fetch(r.toString(),{headers:t,signal:e.signal});if(!n.ok||!n.body)throw Error(`Log stream failed: ${n.status}`);let i=n.body.getReader(),a=new TextDecoder,o=``;for(;!e.signal.aborted;){let{done:e,value:t}=await i.read();if(e)break;o+=a.decode(t,{stream:!0});let n=o.indexOf(`
2
-
3
- `);for(;n>=0;)this._dispatchChunk(o.slice(0,n)),o=o.slice(n+2),n=o.indexOf(`
4
-
5
- `)}}catch(t){e.signal.aborted||this._callbacks.onError(t instanceof Error?t.message:`Log stream disconnected`)}finally{this._abort===e&&(this._abort=void 0)}}_dispatchChunk(e){let t=e.split(/\r?\n/).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(`
6
- `);if(t)try{let e=JSON.parse(t);if(e.type===`connected`){this._callbacks.onConnected();return}if(e.type===`heartbeat`)return;this._callbacks.onEntry(e)}catch{}}disconnect(){this._abort?.abort(),this._abort=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 Q=[`trace`,`debug`,`info`,`warn`,`error`,`fatal`];function se(e){let t=new Date(String(e.timestamp)).getTime();return Number.isFinite(t)?t:0}function ce(e){return e.toSorted((e,t)=>se(t)-se(e))}var le=new Set(Q),ue=[`error`,`fatal`],de=[`warn`,`error`,`fatal`],fe=[`info`,`warn`,`error`,`fatal`];function pe(e){if(!e)return new Set;let t=new Set;for(let n of e.split(`,`)){let e=n.trim();le.has(e)&&t.add(e)}return t}function me(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function he(e,t){return e.size===t.length?t.every(t=>e.has(t)):!1}function ge(e){return e.size===0?`all`:he(e,ue)?`errors`:he(e,de)?`warnPlus`:he(e,fe)?`infoPlus`:e.size===Q.length&&Q.every(t=>e.has(t))?`verbose`:`custom`}function _e(e){let t=ge(e);return t===`custom`?`other`:t}function ve(e){switch(e){case`all`:return new Set;case`errors`:return new Set(ue);case`warnPlus`:return new Set(de);case`infoPlus`:return new Set(fe);case`verbose`:return new Set(Q)}}function ye(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function be(e){return String(e.module||e.service||e.extension||`—`)}function xe(e){if(typeof e.message==`string`&&e.message)return e.message;try{return JSON.stringify(e)}catch{return``}}function Se(e){try{return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}catch{return e}}function Ce(e){try{return new Date(e).toLocaleString()}catch{return e}}function we(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Te(e){let t=e.trim();return t.length<=10?t:`${t.slice(0,8)}…`}function Ee(e){return String(e).toLowerCase()}function De(e){let t=e.phase??e.meta?.phase;return typeof t==`string`&&t.trim()?t:`—`}function Oe(e){return`${e.timestamp}-${e.requestId??``}-${e.message}`}function ke(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 Ae(e,t){if(t.selectedLevels.size>0&&!t.selectedLevels.has(e.level)||t.moduleFilter&&be(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,be(e),De(e),e.requestId,e.sessionKey,e.sessionId,ke(e)?.message,ke(e)?.stack].filter(Boolean).map(String).join(` `).toLowerCase().includes(n))return!1}return!0}function je(e,t){let n=[];for(let r of Q){let i=e[r]??0;i>0&&n.push(`${t[r]} ${i}`)}return n.join(` · `)}function Me(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 me(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&&me(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 Ne={logs:[],loading:!1,error:null,hasMore:!1,modules:[],files:[],stats:null,logDir:null};function Pe(e,t){switch(t.type){case`queryStart`:return{...e,loading:!0,error:null,logs:[]};case`querySuccess`:return{...e,loading:!1,logs:ce(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:ce([...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:ce(t.logs),hasMore:t.hasMore,stats:t.stats};case`appendLiveEntry`:return{...e,logs:ce(oe(e.logs,t.entry))};case`updateStats`:return{...e,stats:t.stats};case`refreshAllSuccess`:return{...e,loading:!1,logs:ce(t.logs),hasMore:t.hasMore,stats:t.stats,files:t.files}}}function Fe(e){let t=s(e).logs,n=c(e=>e.token),r=!!n,[a,o]=i(),l=(0,U.useRef)(a),[u,d]=(0,U.useReducer)(Me,void 0,()=>{let e=l.current,t=e.get(`q`)??``;return{searchInput:t,debouncedSearch:t.trim(),selectedLevels:pe(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`}}),[f,p]=(0,U.useReducer)(Pe,Ne),[m,h]=(0,U.useState)(null),[g,_]=(0,U.useState)(!1),[v,y]=(0,U.useState)(!1),[b,x]=(0,U.useState)(null),[S,C]=(0,U.useState)([]),[w,T]=(0,U.useState)(!1),{searchInput:E,debouncedSearch:D,selectedLevels:O,moduleFilter:k,requestIdFilter:j,sessionIdFilter:M,dateFrom:N,dateTo:P,autoRefresh:F}=u,{logs:I,loading:L,error:R,hasMore:z,modules:B,files:ee,stats:V,logDir:te}=f,H=(0,U.useCallback)(e=>d({type:`setSearchInput`,value:e}),[]),W=(0,U.useCallback)(e=>d({type:`setLevels`,value:e}),[]),G=(0,U.useCallback)(e=>d({type:`setModule`,value:e}),[]),X=(0,U.useCallback)(e=>d({type:`setRequestIdFilter`,value:e}),[]),Z=(0,U.useCallback)(e=>d({type:`setSessionIdFilter`,value:e}),[]),ie=(0,U.useCallback)(e=>d({type:`setDateFrom`,value:e}),[]),oe=(0,U.useCallback)(e=>d({type:`setDateTo`,value:e}),[]),Q=(0,U.useCallback)(e=>d({type:`setAutoRefresh`,value:e}),[]),se=(0,U.useMemo)(()=>_e(O),[O]),ce=e=>{if(e===`other`){y(!0);return}d({type:`setLevels`,value:ve(e)})},le=D.length>0||O.size>0||!!k||!!j||!!M||!!N||!!P,ue=+(D.length>0)+ +(O.size>0)+ +!!k+ +!!j+ +!!M+(N||P?1:0);(0,U.useEffect)(()=>{let e=setTimeout(()=>d({type:`setDebouncedSearch`,value:E.trim()}),300);return()=>clearTimeout(e)},[E]),(0,U.useEffect)(()=>{let e=a.get(`q`)??``;d({type:`syncFromUrl`,payload:{searchInput:e,debouncedSearch:e.trim(),selectedLevels:pe(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,U.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`),j?e.set(`requestId`,j):e.delete(`requestId`),M?e.set(`sessionId`,M):e.delete(`sessionId`),N?e.set(`from`,N):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,N,P,D,k,j,M,a,O,o]);let de=(0,U.useMemo)(()=>({q:D||void 0,level:O.size>0?Array.from(O):void 0,module:k||void 0,requestId:j||void 0,sessionId:M||void 0,from:N||void 0,to:P||void 0,limit:50}),[D,O,k,j,M,N,P]),fe=(0,U.useMemo)(()=>({debouncedSearch:D,selectedLevels:O,moduleFilter:k,requestIdFilter:j,sessionIdFilter:M,dateFrom:N,dateTo:P}),[D,O,k,j,M,N,P]),me=(0,U.useRef)(fe);return me.current=fe,(0,U.useEffect)(()=>{if(!r)return;let e=!1;return T(!0),re({from:N||void 0,to:P||void 0,limit:12}).then(t=>{e||C(t)}).catch(()=>{e||C([])}).finally(()=>{e||T(!1)}),()=>{e=!0}},[r,N,P]),(0,U.useEffect)(()=>{if(!r)return;let e=!1;return p({type:`queryStart`}),(async()=>{try{let t=await K({...de,offset:0});if(e)return;p({type:`querySuccess`,logs:t.logs,hasMore:t.logs.length===50})}catch(n){e||p({type:`queryError`,message:n instanceof Error?n.message:t.loadError,resetLogs:!0})}})(),()=>{e=!0}},[r,de,t.loadError]),(0,U.useEffect)(()=>{if(!r)return;let e=!1;return(async()=>{try{let[t,n,r]=await Promise.all([J(),Y(),q()]);e||p({type:`metaSuccess`,modules:t,stats:n,files:r})}catch{}})(),()=>{e=!0}},[r]),(0,U.useEffect)(()=>{if(!r||!g)return;let e=!1;return(async()=>{try{let[t,n]=await Promise.all([q(),ne()]);e||p({type:`filesSuccess`,files:t,logDir:n})}catch{e||p({type:`filesClear`})}})(),()=>{e=!0}},[r,g]),(0,U.useEffect)(()=>{if(!F||!r)return;let e=new ae(n??void 0,{onConnected:()=>{},onEntry:e=>{Ae(e,me.current)&&p({type:`appendLiveEntry`,entry:e})},onError:()=>{}});e.connect(O.size>0?Array.from(O):void 0,k||void 0);let t=window.setInterval(()=>{Y().then(e=>{p({type:`updateStats`,stats:e})}).catch(()=>{})},3e4);return()=>{e.disconnect(),clearInterval(t)}},[F,r,n,O,k]),(0,U.useEffect)(()=>{if(!b)return;let e=window.setTimeout(()=>x(null),2e3);return()=>clearTimeout(e)},[b]),{L:t,hasToken:r,logs:I,loading:L,error:R,hasMore:z,searchInput:E,setSearchInput:H,selectedLevels:O,setSelectedLevels:W,moduleFilter:k,setModuleFilter:G,requestIdFilter:j,sessionIdFilter:M,dateFrom:N,setDateFrom:ie,dateTo:P,setDateTo:oe,modules:B,files:ee,stats:V,selectedLog:m,setSelectedLog:h,filesOpen:g,setFilesOpen:_,filtersOpen:v,setFiltersOpen:y,logDir:te,autoRefresh:F,setAutoRefresh:Q,copiedDetail:b,setCopiedDetail:x,hasActiveFilters:le,activeFilterCount:ue,clearFilters:()=>d({type:`clearAll`}),toggleDialogLevel:e=>d({type:`toggleLevel`,level:e}),handleLoadMore:()=>{L||!z||(async()=>{p({type:`queryStart`});try{let e=await K({...de,offset:I.length});p({type:`appendSuccess`,logs:e.logs,hasMore:e.logs.length===50})}catch(e){p({type:`queryError`,message:e instanceof Error?e.message:t.loadError})}})()},refreshAll:()=>{(async()=>{p({type:`queryStart`});try{let e=await K({...de,offset:0}),[t,n]=await Promise.all([Y(),q()]);p({type:`refreshAllSuccess`,logs:e.logs,hasMore:e.logs.length===50,stats:t,files:n})}catch(e){p({type:`queryError`,message:e instanceof Error?e.message:t.loadError})}})()},levelSegment:se,handleLevelSegment:ce,filterByRequestId:(0,U.useCallback)(e=>{h(null),X(e)},[X]),filterBySessionId:(0,U.useCallback)(e=>{h(null),Z(e)},[Z]),filterByErrorSummary:(0,U.useCallback)(e=>{d({type:`setSearchInput`,value:e.errName}),d({type:`setDebouncedSearch`,value:e.errName}),e.module&&d({type:`setModule`,value:e.module}),d({type:`setLevels`,value:ve(`errors`)})},[]),openChatForSession:(0,U.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&&A({sessionId:n}).then(e=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:e.sessionKey}}))}).catch(()=>{})},[]),errorSummary:S,errorSummaryLoading:w}}var $=r();function Ie(e){let t=(0,W.c)(36),{L:n,items:r,loading:i,onSelectItem:o}=e,[s,c]=(0,U.useState)(!1);if(!i&&r.length===0)return null;let l;t[0]===r?l=t[1]:(l=r.reduce(Re,0),t[0]=r,t[1]=l);let u=l,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>c(Le),t[2]=d):d=t[2];let f;t[3]===n.errorSummaryTitle?f=t[4]:(f=(0,$.jsx)(`h2`,{className:`text-sm font-semibold tracking-tight text-fg`,children:n.errorSummaryTitle}),t[3]=n.errorSummaryTitle,t[4]=f);let p;t[5]===n.errorSummaryHint?p=t[6]:(p=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-fg-muted`,children:n.errorSummaryHint}),t[5]=n.errorSummaryHint,t[6]=p);let m;t[7]!==f||t[8]!==p?(m=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[f,p]}),t[7]=f,t[8]=p,t[9]=m):m=t[9];let h;t[10]!==r.length||t[11]!==i||t[12]!==u?(h=i?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(I,{className:`h-5 w-8 rounded-md`}),(0,$.jsx)(I,{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:[`×`,u]})]}),t[10]=r.length,t[11]=i,t[12]=u,t[13]=h):h=t[13];let g=s&&`rotate-180`,_;t[14]===g?_=t[15]:(_=a(`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)(k,{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]!==s||t[22]!==y||t[23]!==m?(b=(0,$.jsxs)(`button`,{type:`button`,onClick:d,"aria-expanded":s,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:[m,y]}),t[21]=s,t[22]=y,t[23]=m,t[24]=b):b=t[24];let x;t[25]!==n.module||t[26]!==n.phase||t[27]!==n.time||t[28]!==s||t[29]!==r||t[30]!==i||t[31]!==o?(x=s&&!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:()=>o?.(e),className:a(`flex w-full flex-col gap-1 px-4 py-2.5 text-left transition-colors hover:bg-surface-hover`,o&&`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,`: `,Se(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]=s,t[29]=r,t[30]=i,t[31]=o,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 Le(e){return!e}function Re(e,t){return e+t.count}function ze(e){let t=(0,W.c)(75),{log:n,labels:r,onFilterByRequestId:i,onFilterBySessionId:o,onOpenChat:s}=e,c=n.level??`info`,l=typeof n.requestId==`string`?n.requestId:``,u=typeof n.sessionKey==`string`?n.sessionKey:``,d=typeof n.sessionId==`string`?n.sessionId:``,f;t[0]===n?f=t[1]:(f=De(n),t[0]=n,t[1]=f);let p=f,m;t[2]===n?m=t[3]:(m=ke(n),t[2]=n,t[3]=m);let h=m,g=c===`error`||c===`fatal`,_;t[4]===r.message?_=t[5]:(_=(0,$.jsx)(`span`,{className:`text-xs font-sans font-medium text-fg-muted`,children:r.message}),t[4]=r.message,t[5]=_);let v=g&&`border-red-500/40`,y;t[6]===v?y=t[7]:(y=a(`mt-2 whitespace-pre-wrap break-words border border-edge bg-surface-base p-3 text-xs leading-relaxed text-fg dark:border-edge`,v),t[6]=v,t[7]=y);let b=n.message||`—`,x;t[8]!==y||t[9]!==b?(x=(0,$.jsx)(`pre`,{className:y,children:b}),t[8]=y,t[9]=b,t[10]=x):x=t[10];let S;t[11]!==_||t[12]!==x?(S=(0,$.jsxs)(`div`,{children:[_,x]}),t[11]=_,t[12]=x,t[13]=S):S=t[13];let C;t[14]!==h||t[15]!==r.stackTrace?(C=h?.stack?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`text-xs font-sans font-medium text-fg-muted`,children:r.stackTrace}),h.name?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-400`,children:h.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:h.stack})]}):null,t[14]=h,t[15]=r.stackTrace,t[16]=C):C=t[16];let w;t[17]===r.time?w=t[18]:(w=(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.time}),t[17]=r.time,t[18]=w);let T;t[19]===n.timestamp?T=t[20]:(T=(0,$.jsx)(`code`,{className:`break-all text-fg`,children:n.timestamp}),t[19]=n.timestamp,t[20]=T);let E;t[21]===r.level?E=t[22]:(E=(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.level}),t[21]=r.level,t[22]=E);let D=g&&`font-medium text-red-600 dark:text-red-400`,O;t[23]===D?O=t[24]:(O=a(`text-fg`,D),t[23]=D,t[24]=O);let k;t[25]===c?k=t[26]:(k=Ee(c),t[25]=c,t[26]=k);let A;t[27]!==O||t[28]!==k?(A=(0,$.jsx)(`span`,{className:O,children:k}),t[27]=O,t[28]=k,t[29]=A):A=t[29];let j;t[30]===r.module?j=t[31]:(j=(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.module}),t[30]=r.module,t[31]=j);let M;t[32]===n?M=t[33]:(M=be(n),t[32]=n,t[33]=M);let N;t[34]===M?N=t[35]:(N=(0,$.jsx)(`code`,{className:`break-all text-fg`,children:M}),t[34]=M,t[35]=N);let P;t[36]!==r.phase||t[37]!==p?(P=p===`—`?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:p})]}),t[36]=r.phase,t[37]=p,t[38]=P):P=t[38];let F;t[39]!==r.filterByRequestId||t[40]!==r.requestId||t[41]!==i||t[42]!==l?(F=l?(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:l}),i?(0,$.jsx)(V,{type:`button`,variant:`secondary`,className:`h-7 px-2 text-[11px]`,onClick:()=>i(l),children:r.filterByRequestId}):null]})]}):null,t[39]=r.filterByRequestId,t[40]=r.requestId,t[41]=i,t[42]=l,t[43]=F):F=t[43];let I;t[44]!==r.openChat||t[45]!==r.sessionKey||t[46]!==s||t[47]!==u?(I=u?(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:u}),s?(0,$.jsx)(V,{type:`button`,variant:`secondary`,className:`h-7 px-2 text-[11px]`,onClick:()=>s({sessionKey:u}),children:r.openChat}):null]})]}):null,t[44]=r.openChat,t[45]=r.sessionKey,t[46]=s,t[47]=u,t[48]=I):I=t[48];let L;t[49]!==r.filterBySessionId||t[50]!==r.openChat||t[51]!==r.sessionId||t[52]!==o||t[53]!==s||t[54]!==d?(L=d?(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:d}),o?(0,$.jsx)(V,{type:`button`,variant:`secondary`,className:`h-7 px-2 text-[11px]`,onClick:()=>o(d),children:r.filterBySessionId}):null,s?(0,$.jsx)(V,{type:`button`,variant:`secondary`,className:`h-7 px-2 text-[11px]`,onClick:()=>s({sessionId:d}),children:r.openChat}):null]})]}):null,t[49]=r.filterBySessionId,t[50]=r.openChat,t[51]=r.sessionId,t[52]=o,t[53]=s,t[54]=d,t[55]=L):L=t[55];let R;t[56]!==w||t[57]!==T||t[58]!==E||t[59]!==A||t[60]!==j||t[61]!==N||t[62]!==P||t[63]!==F||t[64]!==I||t[65]!==L?(R=(0,$.jsxs)(`div`,{className:`grid grid-cols-[5.5rem_1fr] gap-x-3 gap-y-2 text-xs`,children:[w,T,E,A,j,N,P,F,I,L]}),t[56]=w,t[57]=T,t[58]=E,t[59]=A,t[60]=j,t[61]=N,t[62]=P,t[63]=F,t[64]=I,t[65]=L,t[66]=R):R=t[66];let z;t[67]!==r.metadata||t[68]!==n.meta?(z=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]=z):z=t[69];let B;return t[70]!==R||t[71]!==z||t[72]!==S||t[73]!==C?(B=(0,$.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[S,C,R,z]}),t[70]=R,t[71]=z,t[72]=S,t[73]=C,t[74]=B):B=t[74],B}function Be(e){let t=(0,W.c)(50),{L:n,log:r,onClose:i,copiedDetail:s,onCopiedMessage:c,onCopiedJson:l,onFilterByRequestId:u,onFilterBySessionId:d,onOpenChat:m}=e,h=r!==null,_;t[0]===i?_=t[1]:(_=e=>!e&&i(),t[0]=i,t[1]=_);let C;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(y,{className:a(`xopc-dialog-overlay fixed inset-0 bg-scrim`,N)}),t[2]=C):C=t[2];let w;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=a(`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`,f,`dark:border-edge`),t[3]=w):w=t[3];let T;t[4]===n.details?T=t[5]:(T=(0,$.jsx)(te,{className:`text-base font-semibold tracking-tight text-fg`,children:n.details}),t[4]=n.details,t[5]=T);let E;t[6]!==n.copied||t[7]!==n.copyJson||t[8]!==n.copyMessage||t[9]!==s||t[10]!==r||t[11]!==l||t[12]!==c?(E=r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(V,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1 px-2 text-xs`,onClick:()=>{o(typeof r.message==`string`?r.message:``).then(e=>{e&&c()})},children:[(0,$.jsx)(v,{className:`size-3.5 shrink-0`,strokeWidth:1.75}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:s===`message`?n.copied:n.copyMessage})]}),(0,$.jsxs)(V,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1 px-2 text-xs`,onClick:()=>{o(JSON.stringify(r,null,2)).then(e=>{e&&l()})},children:[(0,$.jsx)(v,{className:`size-3.5 shrink-0`,strokeWidth:1.75}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:s===`json`?n.copied:n.copyJson})]})]}):null,t[6]=n.copied,t[7]=n.copyJson,t[8]=n.copyMessage,t[9]=s,t[10]=r,t[11]=l,t[12]=c,t[13]=E):E=t[13];let D;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(p,{className:`size-5`,strokeWidth:1.75}),t[14]=D):D=t[14];let O;t[15]===n.close?O=t[16]:(O=(0,$.jsx)(x,{asChild:!0,children:(0,$.jsx)(V,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":n.close,children:D})}),t[15]=n.close,t[16]=O);let k;t[17]!==E||t[18]!==O?(k=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[E,O]}),t[17]=E,t[18]=O,t[19]=k):k=t[19];let A;t[20]!==T||t[21]!==k?(A=(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:[T,k]}),t[20]=T,t[21]=k,t[22]=A):A=t[22];let j;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]!==u||t[38]!==d||t[39]!==m?(j=r?(0,$.jsx)(ze,{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:u,onFilterBySessionId:d,onOpenChat:m}):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]=u,t[38]=d,t[39]=m,t[40]=j):j=t[40];let M;t[41]===j?M=t[42]:(M=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4 font-mono text-sm leading-relaxed`,children:j}),t[41]=j,t[42]=M);let P;t[43]!==A||t[44]!==M?(P=(0,$.jsxs)(S,{children:[C,(0,$.jsxs)(g,{className:w,"aria-describedby":void 0,children:[A,M]})]}),t[43]=A,t[44]=M,t[45]=P):P=t[45];let F;return t[46]!==h||t[47]!==P||t[48]!==_?(F=(0,$.jsx)(b,{open:h,onOpenChange:_,children:P}),t[46]=h,t[47]=P,t[48]=_,t[49]=F):F=t[49],F}function Ve(e){let t=(0,W.c)(25),{L:n,open:r,onOpenChange:i,files:o,logDir:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(y,{className:a(`xopc-dialog-overlay fixed inset-0 bg-scrim`,N)}),t[0]=c):c=t[0];let l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=a(`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`,f,`dark:border-edge`),t[1]=l):l=t[1];let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(j,{className:`size-4 text-fg-muted`,strokeWidth:1.75}),t[2]=u):u=t[2];let d;t[3]===n.logFiles?d=t[4]:(d=(0,$.jsxs)(te,{className:`flex items-center gap-2 text-base font-semibold tracking-tight text-fg`,children:[u,n.logFiles]}),t[3]=n.logFiles,t[4]=d);let m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(p,{className:`size-5`,strokeWidth:1.75}),t[5]=m):m=t[5];let h;t[6]===n.close?h=t[7]:(h=(0,$.jsx)(x,{asChild:!0,children:(0,$.jsx)(V,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":n.close,children:m})}),t[6]=n.close,t[7]=h);let _;t[8]!==d||t[9]!==h?(_=(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:[d,h]}),t[8]=d,t[9]=h,t[10]=_):_=t[10];let v;t[11]!==n.filesEmpty||t[12]!==o?(v=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:o.length===0?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.filesEmpty}):(0,$.jsx)(`ul`,{className:`flex flex-col gap-2`,children:o.map(He)})}),t[11]=n.filesEmpty,t[12]=o,t[13]=v):v=t[13];let C;t[14]!==n.logDir||t[15]!==s?(C=s?(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:s})]}):null,t[14]=n.logDir,t[15]=s,t[16]=C):C=t[16];let w;t[17]!==_||t[18]!==v||t[19]!==C?(w=(0,$.jsxs)(S,{children:[c,(0,$.jsxs)(g,{className:l,children:[_,v,C]})]}),t[17]=_,t[18]=v,t[19]=C,t[20]=w):w=t[20];let T;return t[21]!==i||t[22]!==r||t[23]!==w?(T=(0,$.jsx)(b,{open:r,onOpenChange:i,children:w}),t[21]=i,t[22]=r,t[23]=w,t[24]=T):T=t[24],T}function He(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:we(e.size)}),(0,$.jsx)(`span`,{children:Ce(e.modified)})]})]},e.name)}function Ue(e){let t=(0,W.c)(68),{L:n,open:r,onOpenChange:i,dateFrom:o,onDateFromChange:s,dateTo:c,onDateToChange:l,selectedLevels:u,onToggleLevel:d}=e,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(y,{className:a(`xopc-dialog-overlay fixed inset-0 bg-scrim`,N)}),t[0]=m):m=t[0];let h;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h=a(`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`,f,`dark:border-edge`),t[1]=h):h=t[1];let _;t[2]===n.filtersDialogTitle?_=t[3]:(_=(0,$.jsx)(te,{className:`text-base font-semibold tracking-tight text-fg`,children:n.filtersDialogTitle}),t[2]=n.filtersDialogTitle,t[3]=_);let v;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(p,{className:`size-5`,strokeWidth:1.75}),t[4]=v):v=t[4];let C;t[5]===n.close?C=t[6]:(C=(0,$.jsx)(x,{asChild:!0,children:(0,$.jsx)(V,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":n.close,children:v})}),t[5]=n.close,t[6]=C);let w;t[7]!==_||t[8]!==C?(w=(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:[_,C]}),t[7]=_,t[8]=C,t[9]=w):w=t[9];let T;t[10]===n.filtersDialogDesc?T=t[11]:(T=(0,$.jsx)(`div`,{id:`log-filters-desc`,className:`sr-only`,children:n.filtersDialogDesc}),t[10]=n.filtersDialogDesc,t[11]=T);let E;t[12]===n.timeRange?E=t[13]:(E=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n.timeRange}),t[12]=n.timeRange,t[13]=E);let D;t[14]===n.from?D=t[15]:(D=(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]=D);let O;t[16]===s?O=t[17]:(O=e=>s(e.target.value),t[16]=s,t[17]=O);let k;t[18]!==o||t[19]!==O?(k=(0,$.jsx)(`input`,{id:`log-from-d`,type:`datetime-local`,value:o,onChange:O,className:`w-full rounded-xl border border-edge bg-surface-base p-2 text-sm text-fg dark:border-edge`}),t[18]=o,t[19]=O,t[20]=k):k=t[20];let A;t[21]!==k||t[22]!==D?(A=(0,$.jsxs)(`div`,{children:[D,k]}),t[21]=k,t[22]=D,t[23]=A):A=t[23];let j;t[24]===n.to?j=t[25]:(j=(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]=j);let M;t[26]===l?M=t[27]:(M=e=>l(e.target.value),t[26]=l,t[27]=M);let P;t[28]!==c||t[29]!==M?(P=(0,$.jsx)(`input`,{id:`log-to-d`,type:`datetime-local`,value:c,onChange:M,className:`w-full rounded-xl border border-edge bg-surface-base p-2 text-sm text-fg dark:border-edge`}),t[28]=c,t[29]=M,t[30]=P):P=t[30];let F;t[31]!==j||t[32]!==P?(F=(0,$.jsxs)(`div`,{children:[j,P]}),t[31]=j,t[32]=P,t[33]=F):F=t[33];let I;t[34]!==A||t[35]!==F?(I=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-col gap-3`,children:[A,F]}),t[34]=A,t[35]=F,t[36]=I):I=t[36];let L;t[37]===n.levelCustom?L=t[38]:(L=(0,$.jsx)(`p`,{className:`mt-6 text-xs font-medium text-fg-muted`,children:n.levelCustom}),t[37]=n.levelCustom,t[38]=L);let R;t[39]===n.levelCustomHint?R=t[40]:(R=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:n.levelCustomHint}),t[39]=n.levelCustomHint,t[40]=R);let z=n.level,B;t[41]!==n.levelNames||t[42]!==d||t[43]!==u?(B=Q.map(e=>(0,$.jsx)(`button`,{type:`button`,className:a(`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`,u.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:()=>d(e),children:n.levelNames[e]},e)),t[41]=n.levelNames,t[42]=d,t[43]=u,t[44]=B):B=t[44];let ee;t[45]!==n.level||t[46]!==B?(ee=(0,$.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,role:`group`,"aria-label":z,children:B}),t[45]=n.level,t[46]=B,t[47]=ee):ee=t[47];let H;t[48]!==I||t[49]!==L||t[50]!==R||t[51]!==ee||t[52]!==E?(H=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4`,children:[E,I,L,R,ee]}),t[48]=I,t[49]=L,t[50]=R,t[51]=ee,t[52]=E,t[53]=H):H=t[53];let U;t[54]===i?U=t[55]:(U=()=>i(!1),t[54]=i,t[55]=U);let G;t[56]!==n.filtersDone||t[57]!==U?(G=(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle px-4 py-3 dark:border-edge`,children:(0,$.jsx)(V,{type:`button`,className:`w-full rounded-xl`,onClick:U,children:n.filtersDone})}),t[56]=n.filtersDone,t[57]=U,t[58]=G):G=t[58];let K;t[59]!==H||t[60]!==G||t[61]!==w||t[62]!==T?(K=(0,$.jsxs)(S,{children:[m,(0,$.jsxs)(g,{className:h,"aria-describedby":`log-filters-desc`,children:[w,T,H,G]})]}),t[59]=H,t[60]=G,t[61]=w,t[62]=T,t[63]=K):K=t[63];let q;return t[64]!==i||t[65]!==r||t[66]!==K?(q=(0,$.jsx)(b,{open:r,onOpenChange:i,children:K}),t[64]=i,t[65]=r,t[66]=K,t[67]=q):q=t[67],q}var We=1;function Ge(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 Ke=`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`,qe=`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 Je({value:e,onChange:t,options:n,"aria-label":r,className:i,buttonClassName:o}){let s=(0,U.useRef)(null),c=(0,U.useRef)([]),[l,u]=(0,U.useState)({x:0,y:0,w:0,h:0}),[d,f]=(0,U.useState)(!1),[p,m]=(0,U.useState)(!1),h=(0,U.useCallback)(()=>{let t=s.current;if(!t)return;let r=n.findIndex(t=>t.value===e);if(r<0)return;let i=c.current[r];if(!i)return;let a=We,o=t.getBoundingClientRect(),l=i.getBoundingClientRect(),d=Ge(i,t),p,m;if(d)p=d.x,m=d.y;else{let e=getComputedStyle(t),n=parseFloat(e.borderLeftWidth)||0,r=parseFloat(e.borderTopWidth)||0;p=l.left-o.left-n,m=l.top-o.top-r}u({x:p+a,y:m+a,w:Math.max(0,l.width-a*2),h:Math.max(0,l.height-a*2)}),f(!0)},[n,e]),g=(0,U.useRef)(h);return g.current=h,(0,U.useLayoutEffect)(()=>{let e=requestAnimationFrame(()=>h());return()=>cancelAnimationFrame(e)},[h]),(0,U.useEffect)(()=>{let e=requestAnimationFrame(()=>{requestAnimationFrame(()=>m(!0))});return()=>cancelAnimationFrame(e)},[]),(0,U.useEffect)(()=>{let e=s.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:s,className:a(H,`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:a(Ke,`motion-reduce:!transition-none motion-reduce:!duration-0`,p&&`transition-[transform,width,height] duration-300 [transition-timing-function:cubic-bezier(0.32,0.72,0,1)]`),style:{width:l.w,height:l.h,transform:`translate3d(${l.x}px, ${l.y}px, 0)`,opacity:d&&l.w>0?1:0}}),n.map((n,r)=>{let i=n.icon,s=e===n.value;return(0,$.jsxs)(`button`,{ref:e=>{c.current[r]=e},type:`button`,"aria-pressed":s,title:n.title??n.label,onClick:()=>t(n.value),className:a(qe,s?`text-fg`:`text-fg-subtle`,o),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 Ye(e){let t=(0,W.c)(76),{L:n,levelSegment:r,onLevelSegment:i,searchInput:o,onSearchInputChange:s,moduleFilter:c,onModuleFilterChange:l,modules:u,onOpenFilters:d,activeFilterCount:f,hasActiveFilters:m,onClearFilters:h,autoRefresh:g}=e,v=n.filters,y;t[0]===n.presetAll?y=t[1]:(y={value:`all`,label:n.presetAll},t[0]=n.presetAll,t[1]=y);let b;t[2]===n.presetErrors?b=t[3]:(b={value:`errors`,label:n.presetErrors},t[2]=n.presetErrors,t[3]=b);let x;t[4]===n.presetWarnPlus?x=t[5]:(x={value:`warnPlus`,label:n.presetWarnPlus},t[4]=n.presetWarnPlus,t[5]=x);let S;t[6]===n.presetInfoPlus?S=t[7]:(S={value:`infoPlus`,label:n.presetInfoPlus},t[6]=n.presetInfoPlus,t[7]=S);let C;t[8]===n.presetVerbose?C=t[9]:(C={value:`verbose`,label:n.presetVerbose},t[8]=n.presetVerbose,t[9]=C);let O;t[10]===n.presetOther?O=t[11]:(O={value:`other`,label:n.presetOther},t[10]=n.presetOther,t[11]=O);let k;t[12]!==y||t[13]!==b||t[14]!==x||t[15]!==S||t[16]!==C||t[17]!==O?(k=[y,b,x,S,C,O],t[12]=y,t[13]=b,t[14]=x,t[15]=S,t[16]=C,t[17]=O,t[18]=k):k=t[18];let A;t[19]!==n.levelPresetAria||t[20]!==r||t[21]!==i||t[22]!==k?(A=(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)(Je,{"aria-label":n.levelPresetAria,value:r,onChange:i,options:k,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]=k,t[23]=A):A=t[23];let j;t[24]===n.searchPlaceholder?j=t[25]:(j=(0,$.jsx)(`span`,{className:`sr-only`,children:n.searchPlaceholder}),t[24]=n.searchPlaceholder,t[25]=j);let M;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(D,{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]=M):M=t[26];let N;t[27]===s?N=t[28]:(N=e=>s(e.target.value),t[27]=s,t[28]=N);let P=n.searchPlaceholder,F;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(F=a(`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`,L),t[29]=F):F=t[29];let I;t[30]!==n.searchPlaceholder||t[31]!==o||t[32]!==N?(I=(0,$.jsx)(`input`,{type:`search`,value:o,onChange:N,placeholder:P,autoComplete:`off`,spellCheck:!1,className:F}),t[30]=n.searchPlaceholder,t[31]=o,t[32]=N,t[33]=I):I=t[33];let R;t[34]!==j||t[35]!==I?(R=(0,$.jsxs)(`label`,{className:`relative min-w-0 flex-1 sm:min-w-[12rem]`,children:[j,M,I]}),t[34]=j,t[35]=I,t[36]=R):R=t[36];let z;t[37]===l?z=t[38]:(z=e=>l(e.target.value),t[37]=l,t[38]=z);let B=n.module,ee=n.module,te;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(te=a(E,`h-10 w-full min-w-0 rounded-md py-0 sm:w-[min(100%,14rem)] sm:shrink-0`),t[39]=te):te=t[39];let H;t[40]===n.allModules?H=t[41]:(H=(0,$.jsx)(T,{value:``,children:n.allModules}),t[40]=n.allModules,t[41]=H);let U;t[42]===u?U=t[43]:(U=u.map(Xe),t[42]=u,t[43]=U);let G;t[44]!==n.module||t[45]!==c||t[46]!==z||t[47]!==H||t[48]!==U?(G=(0,$.jsxs)(w,{id:`log-module`,value:c,onChange:z,"aria-label":B,title:ee,className:te,children:[H,U]}),t[44]=n.module,t[45]=c,t[46]=z,t[47]=H,t[48]=U,t[49]=G):G=t[49];let K;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(_,{className:`size-4`,strokeWidth:1.75}),t[50]=K):K=t[50];let q;t[51]===f?q=t[52]:(q=f>0?(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 text-xs tabular-nums text-fg-muted`,children:f}):null,t[51]=f,t[52]=q);let J;t[53]!==n.filtersMore||t[54]!==d||t[55]!==q?(J=(0,$.jsxs)(V,{type:`button`,variant:`secondary`,className:`h-10 min-h-[44px] gap-2 rounded-md sm:min-h-10`,onClick:d,children:[K,n.filtersMore,q]}),t[53]=n.filtersMore,t[54]=d,t[55]=q,t[56]=J):J=t[56];let Y;t[57]!==n.clear||t[58]!==m||t[59]!==h?(Y=m?(0,$.jsxs)(V,{type:`button`,variant:`ghost`,className:`h-10 min-h-[44px] gap-1 sm:min-h-10`,onClick:h,children:[(0,$.jsx)(p,{className:`size-4`,strokeWidth:1.75}),n.clear]}):null,t[57]=n.clear,t[58]=m,t[59]=h,t[60]=Y):Y=t[60];let ne;t[61]!==J||t[62]!==Y?(ne=(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]=ne):ne=t[63];let X;t[64]!==R||t[65]!==G||t[66]!==ne?(X=(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center`,children:[R,G,ne]}),t[64]=R,t[65]=G,t[66]=ne,t[67]=X):X=t[67];let Z;t[68]!==n.liveHint||t[69]!==g?(Z=g?(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:n.liveHint}):null,t[68]=n.liveHint,t[69]=g,t[70]=Z):Z=t[70];let re;return t[71]!==n.filters||t[72]!==X||t[73]!==Z||t[74]!==A?(re=(0,$.jsxs)(`section`,{className:`flex flex-col gap-3`,"aria-label":v,children:[A,X,Z]}),t[71]=n.filters,t[72]=X,t[73]=Z,t[74]=A,t[75]=re):re=t[75],re}function Xe(e){return(0,$.jsx)(T,{value:e,children:e},e)}function Ze(e){let t=(0,W.c)(20),{L:n,logs:r,loading:i,hasMore:o,onSelectLog:s,onLoadMore:c,onRefreshAll:l,onFilterByRequestId:u}=e,d;t[0]!==i||t[1]!==r.length?(d=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(Qe)}):null,t[0]=i,t[1]=r.length,t[2]=d):d=t[2];let f;t[3]!==n||t[4]!==i||t[5]!==r.length||t[6]!==l?(f=!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)(m,{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)(V,{type:`button`,variant:`secondary`,className:`mt-4 gap-2`,onClick:l,children:[(0,$.jsx)(P,{className:`size-4`,strokeWidth:1.75}),n.refresh]})]}):null,t[3]=n,t[4]=i,t[5]=r.length,t[6]=l,t[7]=f):f=t[7];let p;t[8]!==n||t[9]!==o||t[10]!==i||t[11]!==r||t[12]!==u||t[13]!==c||t[14]!==s?(p=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:[ye(n.showingCount,{count:String(r.length)}),o?(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=De(e),o=t===`error`||t===`fatal`;return(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>s(e),className:a(`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`,o&&`border-l-2 border-l-red-500/70`),children:[(0,$.jsx)(`span`,{className:`w-[5.25rem] shrink-0 tabular-nums text-fg-subtle`,children:Se(e.timestamp)}),(0,$.jsx)(`span`,{className:a(`w-[4.5rem] shrink-0 truncate`,o?`font-medium text-red-600 dark:text-red-400`:`text-fg-muted`),title:t,children:Ee(t)}),(0,$.jsx)(`span`,{className:`w-[4.5rem] shrink-0 truncate sm:w-[5.25rem]`,children:r?u?(0,$.jsx)(`span`,{role:`link`,tabIndex:0,className:`cursor-pointer text-accent hover:underline`,title:`${n.requestId}: ${r}`,onClick:e=>{e.stopPropagation(),u(r)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),u(r))},children:Te(r)}):(0,$.jsx)(`span`,{className:`text-fg-subtle`,title:`${n.requestId}: ${r}`,children:Te(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:be(e),children:be(e)}),(0,$.jsx)(`span`,{className:a(`min-w-0 flex-1 truncate`,`text-fg`),children:xe(e)})]})},Oe(e))})}),o?(0,$.jsx)(`div`,{className:`flex justify-center pt-1`,children:(0,$.jsxs)(V,{type:`button`,variant:`secondary`,className:`gap-2`,disabled:i,onClick:c,children:[i?(0,$.jsx)(P,{className:`size-4 animate-spin motion-reduce:animate-none`,strokeWidth:1.75}):(0,$.jsx)(k,{className:`size-4`,strokeWidth:1.75}),n.loadMore]})}):null]}):null,t[8]=n,t[9]=o,t[10]=i,t[11]=r,t[12]=u,t[13]=c,t[14]=s,t[15]=p):p=t[15];let h;return t[16]!==d||t[17]!==f||t[18]!==p?(h=(0,$.jsxs)($.Fragment,{children:[d,f,p]}),t[16]=d,t[17]=f,t[18]=p,t[19]=h):h=t[19],h}function Qe(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 $e(e){let t=(0,W.c)(8),{L:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(C,{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 et(e){return/[",\n\r]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function tt(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=>et(String(e))).join(`,`)});return[t.join(`,`),...n].join(`
7
- `)}function nt(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 rt(e,t){let n=new Date().toISOString().replace(/[:.]/g,`-`);if(t===`json`){nt(JSON.stringify(e,null,2),`xopc-logs-${n}.json`,`application/json`);return}nt(tt(e),`xopc-logs-${n}.csv`,`text/csv;charset=utf-8`)}function it(e){let t=(0,W.c)(32),{L:n,logs:r,disabled:i}=e,o=i||r.length===0,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(h,{className:`size-4`,strokeWidth:1.75}),t[0]=s):s=t[0];let c;t[1]===n.exportLogs?c=t[2]:(c=(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:n.exportLogs}),t[1]=n.exportLogs,t[2]=c);let l;t[3]!==n.exportLogs||t[4]!==o||t[5]!==c?(l=(0,$.jsx)(R,{asChild:!0,children:(0,$.jsxs)(V,{type:`button`,variant:`secondary`,className:`h-9 gap-2 px-3 text-xs`,disabled:o,title:n.exportLogs,children:[s,c]})}),t[3]=n.exportLogs,t[4]=o,t[5]=c,t[6]=l):l=t[6];let u;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=a(`w-52 rounded-xl border border-edge bg-surface-panel p-2 shadow-popover outline-none`,B,`dark:border-edge`),t[7]=u):u=t[7];let d;t[8]===n.exportLogs?d=t[9]:(d=(0,$.jsx)(`p`,{className:`px-2 py-1 text-xs font-medium text-fg`,children:n.exportLogs}),t[8]=n.exportLogs,t[9]=d);let f;t[10]===n.exportHint?f=t[11]:(f=(0,$.jsx)(`p`,{className:`px-2 pb-2 text-xs leading-5 text-fg-muted`,children:n.exportHint}),t[10]=n.exportHint,t[11]=f);let p;t[12]===r?p=t[13]:(p=()=>rt(r,`json`),t[12]=r,t[13]=p);let m;t[14]!==n.exportJson||t[15]!==p?(m=(0,$.jsx)(V,{type:`button`,variant:`ghost`,className:`h-8 justify-start px-2 text-xs`,onClick:p,children:n.exportJson}),t[14]=n.exportJson,t[15]=p,t[16]=m):m=t[16];let g;t[17]===r?g=t[18]:(g=()=>rt(r,`csv`),t[17]=r,t[18]=g);let _;t[19]!==n.exportCsv||t[20]!==g?(_=(0,$.jsx)(V,{type:`button`,variant:`ghost`,className:`h-8 justify-start px-2 text-xs`,onClick:g,children:n.exportCsv}),t[19]=n.exportCsv,t[20]=g,t[21]=_):_=t[21];let v;t[22]!==_||t[23]!==m?(v=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[m,_]}),t[22]=_,t[23]=m,t[24]=v):v=t[24];let y;t[25]!==v||t[26]!==d||t[27]!==f?(y=(0,$.jsx)(F,{children:(0,$.jsxs)(z,{side:`bottom`,align:`end`,sideOffset:6,className:u,children:[d,f,v]})}),t[25]=v,t[26]=d,t[27]=f,t[28]=y):y=t[28];let b;return t[29]!==y||t[30]!==l?(b=(0,$.jsxs)(O,{children:[l,y]}),t[29]=y,t[30]=l,t[31]=b):b=t[31],b}function at(e){let t=(0,W.c)(38),{L:n}=e,[r,i]=(0,U.useState)(!1),[o,s]=(0,U.useState)(`info`),[c,l]=(0,U.useState)(!1),[u,d]=(0,U.useState)(null),f,p;t[0]!==n.logLevelLoadError||t[1]!==r?(f=()=>{if(!r)return;let e=!1;return X().then(t=>{e||s(t)}).catch(t=>{e||d(t instanceof Error?t.message:n.logLevelLoadError)}),()=>{e=!0}},p=[r,n.logLevelLoadError],t[0]=n.logLevelLoadError,t[1]=r,t[2]=f,t[3]=p):(f=t[2],p=t[3]),(0,U.useEffect)(f,p);let m;t[4]===n.logLevelSaveError?m=t[5]:(m=e=>{l(!0),d(null),Z(e).then(e=>{s(e.current),i(!1)}).catch(e=>{d(e instanceof Error?e.message:n.logLevelSaveError)}).finally(()=>l(!1))},t[4]=n.logLevelSaveError,t[5]=m);let h=m,g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(ee,{className:`size-4`,strokeWidth:1.75}),t[6]=g):g=t[6];let _;t[7]===n.logLevelTitle?_=t[8]:(_=(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:n.logLevelTitle}),t[7]=n.logLevelTitle,t[8]=_);let v;t[9]===o?v=t[10]:(v=(0,$.jsx)(`span`,{className:`tabular-nums text-fg-muted`,children:o}),t[9]=o,t[10]=v);let y;t[11]!==n.logLevelTitle||t[12]!==_||t[13]!==v?(y=(0,$.jsx)(R,{asChild:!0,children:(0,$.jsxs)(V,{type:`button`,variant:`secondary`,className:`h-9 gap-2 px-3 text-xs`,title:n.logLevelTitle,children:[g,_,v]})}),t[11]=n.logLevelTitle,t[12]=_,t[13]=v,t[14]=y):y=t[14];let b;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=a(`w-56 rounded-xl border border-edge bg-surface-panel p-3 shadow-popover outline-none`,B,`dark:border-edge`),t[15]=b):b=t[15];let x;t[16]===n.logLevelTitle?x=t[17]:(x=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:n.logLevelTitle}),t[16]=n.logLevelTitle,t[17]=x);let S;t[18]===n.logLevelHint?S=t[19]:(S=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.logLevelHint}),t[18]=n.logLevelHint,t[19]=S);let C;t[20]!==n.levelNames||t[21]!==h||t[22]!==o||t[23]!==c?(C=Q.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,disabled:c,onClick:()=>h(e),className:a(`flex w-full items-center justify-between rounded-md px-2 py-1.5 text-left text-xs transition-colors`,o===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]=h,t[22]=o,t[23]=c,t[24]=C):C=t[24];let w;t[25]===C?w=t[26]:(w=(0,$.jsx)(`ul`,{className:`mt-3 flex flex-col gap-1`,children:C}),t[25]=C,t[26]=w);let T;t[27]===u?T=t[28]:(T=u?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-red-600 dark:text-red-400`,children:u}):null,t[27]=u,t[28]=T);let E;t[29]!==S||t[30]!==w||t[31]!==T||t[32]!==x?(E=(0,$.jsx)(F,{children:(0,$.jsxs)(z,{side:`bottom`,align:`end`,sideOffset:6,className:b,children:[x,S,w,T]})}),t[29]=S,t[30]=w,t[31]=T,t[32]=x,t[33]=E):E=t[33];let D;return t[34]!==r||t[35]!==E||t[36]!==y?(D=(0,$.jsxs)(O,{open:r,onOpenChange:i,children:[y,E]}),t[34]=r,t[35]=E,t[36]=y,t[37]=D):D=t[37],D}function ot(e){let t=(0,W.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 h;t[9]===n.refreshManual?h=t[10]:(h={value:`paused`,label:n.refreshManual},t[9]=n.refreshManual,t[10]=h);let g;t[11]===n.refreshLive?g=t[12]:(g={value:`live`,label:n.refreshLive},t[11]=n.refreshLive,t[12]=g);let _;t[13]!==h||t[14]!==g?(_=[h,g],t[13]=h,t[14]=g,t[15]=_):_=t[15];let v;t[16]!==n.refreshModeAria||t[17]!==p||t[18]!==m||t[19]!==_?(v=(0,$.jsx)(`div`,{className:`w-full sm:w-48`,children:(0,$.jsx)(Je,{"aria-label":n.refreshModeAria,value:p,onChange:m,options:_,buttonClassName:`h-8`})}),t[16]=n.refreshModeAria,t[17]=p,t[18]=m,t[19]=_,t[20]=v):v=t[20];let y;t[21]===n?y=t[22]:(y=(0,$.jsx)(at,{L:n}),t[21]=n,t[22]=y);let b;t[23]!==n||t[24]!==s||t[25]!==l?(b=(0,$.jsx)(it,{L:n,logs:l,disabled:s}),t[23]=n,t[24]=s,t[25]=l,t[26]=b):b=t[26];let x;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(j,{className:`size-4`,strokeWidth:1.75}),t[27]=x):x=t[27];let S;t[28]===a?S=t[29]:(S=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]=S);let C;t[30]!==n.logFiles||t[31]!==o||t[32]!==S?(C=(0,$.jsxs)(V,{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:[x,S]}),t[30]=n.logFiles,t[31]=o,t[32]=S,t[33]=C):C=t[33];let w;t[34]!==n.refresh||t[35]!==s||t[36]!==c?(w=(0,$.jsx)(M,{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]=w):w=t[37];let T;t[38]!==y||t[39]!==b||t[40]!==C||t[41]!==w?(T=(0,$.jsxs)(`div`,{className:`flex items-center gap-1 self-end sm:self-center`,children:[y,b,C,w]}),t[38]=y,t[39]=b,t[40]=C,t[41]=w,t[42]=T):T=t[42];let E;t[43]!==T||t[44]!==v?(E=(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:[v,T]}),t[43]=T,t[44]=v,t[45]=E):E=t[45];let D;return t[46]!==E||t[47]!==f?(D=(0,$.jsxs)(`header`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[f,E]}),t[46]=E,t[47]=f,t[48]=D):D=t[48],D}function st(e){let t=(0,W.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 o;t[2]!==n.levelNames||t[3]!==i?(o=je(i,n.levelNames),t[2]=n.levelNames,t[3]=i,t[4]=o):o=t[4];let s=o,c=r.runtime?.errorsLast24h;if(!s&&c==null)return null;let l;t[5]===n.statsRegion?l=t[6]:(l=(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.statsRegion}),t[5]=n.statsRegion,t[6]=l);let u;t[7]===s?u=t[8]:(u=s?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`mx-1.5 text-fg-subtle`,children:`·`}),(0,$.jsx)(`span`,{className:`tabular-nums`,children:s})]}):null,t[7]=s,t[8]=u);let d;t[9]!==n.runtimeErrors||t[10]!==c?(d=c!=null&&c>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,` `,c]})]}):null,t[9]=n.runtimeErrors,t[10]=c,t[11]=d):d=t[11];let f;t[12]!==l||t[13]!==u||t[14]!==d?(f=(0,$.jsx)(R,{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:[l,u,d]})}),t[12]=l,t[13]=u,t[14]=d,t[15]=f):f=t[15];let p;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(p=a(`w-[min(calc(100vw-2rem),20rem)] rounded-xl border border-edge bg-surface-panel p-3 shadow-popover outline-none`,B,`dark:border-edge`),t[16]=p):p=t[16];let m;t[17]===n.statsDetailTitle?m=t[18]:(m=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:n.statsDetailTitle}),t[17]=n.statsDetailTitle,t[18]=m);let h;t[19]===n.statsHint?h=t[20]:(h=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.statsHint}),t[19]=n.statsHint,t[20]=h);let g;t[21]!==n.levelNames||t[22]!==r.byLevel?(g=Q.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]=g):g=t[23];let _;t[24]===g?_=t[25]:(_=(0,$.jsx)(`ul`,{className:`mt-3 flex flex-col gap-1.5`,children:g}),t[24]=g,t[25]=_);let v;t[26]!==_||t[27]!==m||t[28]!==h?(v=(0,$.jsx)(F,{children:(0,$.jsxs)(z,{side:`bottom`,align:`start`,sideOffset:6,className:p,children:[m,h,_]})}),t[26]=_,t[27]=m,t[28]=h,t[29]=v):v=t[29];let y;return t[30]!==v||t[31]!==f?(y=(0,$.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,$.jsxs)(O,{children:[f,v]})}),t[30]=v,t[31]=f,t[32]=y):y=t[32],y}function ct(){let e=(0,W.c)(89),{L:t,hasToken:n,logs:r,loading:i,error:a,hasMore:o,searchInput:s,setSearchInput:c,selectedLevels:u,moduleFilter:d,setModuleFilter:f,dateFrom:p,setDateFrom:m,dateTo:h,setDateTo:g,modules:_,files:v,stats:y,selectedLog:b,setSelectedLog:x,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:V,errorSummary:te,errorSummaryLoading:H}=Fe(l(lt));if(!n){let n;return e[0]===t?n=e[1]:(n=(0,$.jsx)($e,{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 G;e[4]!==t||e[5]!==D||e[6]!==v.length||e[7]!==i||e[8]!==r||e[9]!==I||e[10]!==O||e[11]!==U?(G=(0,$.jsx)(ot,{L:t,autoRefresh:D,onAutoRefreshChange:O,fileCount:v.length,onOpenFiles:U,loading:i,onRefreshAll:I,logs:r}),e[4]=t,e[5]=D,e[6]=v.length,e[7]=i,e[8]=r,e[9]=I,e[10]=O,e[11]=U,e[12]=G):G=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]!==y?(q=y?(0,$.jsx)(st,{L:t,stats:y}):null,e[15]=t,e[16]=y,e[17]=q):q=e[17];let J;e[18]!==t||e[19]!==te||e[20]!==H||e[21]!==ee?(J=(0,$.jsx)(Ie,{L:t,items:te,loading:H,onSelectItem:ee}),e[18]=t,e[19]=te,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 ne;e[25]!==t||e[26]!==M||e[27]!==D||e[28]!==N||e[29]!==R||e[30]!==j||e[31]!==L||e[32]!==d||e[33]!==_||e[34]!==s||e[35]!==f||e[36]!==c||e[37]!==Y?(ne=(0,$.jsx)(Ye,{L:t,levelSegment:L,onLevelSegment:R,searchInput:s,onSearchInputChange:c,moduleFilter:d,onModuleFilterChange:f,modules:_,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]=d,e[33]=_,e[34]=s,e[35]=f,e[36]=c,e[37]=Y,e[38]=ne):ne=e[38];let X;e[39]!==t||e[40]!==z||e[41]!==F||e[42]!==o||e[43]!==i||e[44]!==r||e[45]!==I||e[46]!==x?(X=(0,$.jsx)(Ze,{L:t,logs:r,loading:i,hasMore:o,onSelectLog:x,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]=x,e[47]=X):X=e[47];let Z;e[48]!==t||e[49]!==p||e[50]!==h||e[51]!==w||e[52]!==u||e[53]!==m||e[54]!==g||e[55]!==T||e[56]!==P?(Z=(0,$.jsx)(Ue,{L:t,open:w,onOpenChange:T,dateFrom:p,onDateFromChange:m,dateTo:h,onDateToChange:g,selectedLevels:u,onToggleLevel:P}),e[48]=t,e[49]=p,e[50]=h,e[51]=w,e[52]=u,e[53]=m,e[54]=g,e[55]=T,e[56]=P,e[57]=Z):Z=e[57];let re;e[58]===x?re=e[59]:(re=()=>x(null),e[58]=x,e[59]=re);let ie,ae;e[60]===A?(ie=e[61],ae=e[62]):(ie=()=>A(`message`),ae=()=>A(`json`),e[60]=A,e[61]=ie,e[62]=ae);let oe;e[63]!==t||e[64]!==k||e[65]!==z||e[66]!==B||e[67]!==V||e[68]!==b||e[69]!==ie||e[70]!==ae||e[71]!==re?(oe=(0,$.jsx)(Be,{L:t,log:b,onClose:re,copiedDetail:k,onCopiedMessage:ie,onCopiedJson:ae,onFilterByRequestId:z,onFilterBySessionId:B,onOpenChat:V}),e[63]=t,e[64]=k,e[65]=z,e[66]=B,e[67]=V,e[68]=b,e[69]=ie,e[70]=ae,e[71]=re,e[72]=oe):oe=e[72];let Q;e[73]!==t||e[74]!==v||e[75]!==S||e[76]!==E||e[77]!==C?(Q=(0,$.jsx)(Ve,{L:t,open:S,onOpenChange:C,files:v,logDir:E}),e[73]=t,e[74]=v,e[75]=S,e[76]=E,e[77]=C,e[78]=Q):Q=e[78];let se;return e[79]!==G||e[80]!==oe||e[81]!==Q||e[82]!==K||e[83]!==q||e[84]!==J||e[85]!==ne||e[86]!==X||e[87]!==Z?(se=(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-6 px-3 py-6 sm:px-5 xl:px-6`,children:[G,K,q,J,ne,X,Z,oe,Q]}),e[79]=G,e[80]=oe,e[81]=Q,e[82]=K,e[83]=q,e[84]=J,e[85]=ne,e[86]=X,e[87]=Z,e[88]=se):se=e[88],se}function lt(e){return e.language}export{ct as LogsPage};
@@ -1 +0,0 @@
1
- import{si as e}from"./index-B5cSZcER.js";function t(t){let{children:n,fallback:r}=t,i=r===void 0?null:r;return e()?n:i}export{t};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,r as n}from"./locale-store-CQDaFvDN.js";import{ai as r}from"./index-B5cSZcER.js";var i=e({reloadSkills:()=>a});async function a(){let e=await t(n(`/api/skills/reload`),{method:`POST`});if(!e.ok)throw Error(await r(e))}export{i as n,a as t};
@@ -1 +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{l as i,t as a}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as o}from"./cn-BQ_8x0bT.js";import{t as s}from"./check-BODqo66o.js";import{t as c}from"./circle-alert-RzVebuX2.js";import{t as l}from"./messages--cnUi8Ld.js";import{n as u,r as d,s as f}from"./locale-store-CQDaFvDN.js";import{n as p}from"./activity-store-XA9328eM.js";import{Bc as m,Bo as h,Cl as g,Cs as _,Fo as v,Fs as y,Io as b,Lo as x,No as S,Po as C,Ps as w,R as T,Ro as E,Tu as D,Uc as O,Wl as k,Xc as A,Ys as j,ac as M,et as N,jl as ee,lo as P,ol as F,ou as te,qa as ne,ru as re,tu as ie,yc as ae,ys as I,yu as L,za as oe,zo as se}from"./index-B5cSZcER.js";var R=n(),z=e(t(),1),B=r(),V=6,H={info:{Icon:F,className:`text-accent-fg bg-accent-soft`},success:{Icon:ie,className:`text-success bg-success-soft`},warning:{Icon:w,className:`text-warning bg-warning-soft`},error:{Icon:c,className:`text-danger bg-danger-soft`}};function U(e,t){let n=Math.max(0,Math.round((Date.now()-e)/1e3));if(n<60)return t===`zh`?`刚刚`:`Just now`;let r=Math.round(n/60);if(r<60)return t===`zh`?`${r} 分钟前`:`${r}m ago`;let i=Math.round(r/60);if(i<24)return t===`zh`?`${i} 小时前`:`${i}h ago`;let a=Math.round(i/24);return t===`zh`?`${a} 天前`:`${a}d ago`}function W(e){let t=(0,R.c)(52),{item:n}=e,r=u(K),i;t[0]===r?i=t[1]:(i=l(r),t[0]=r,t[1]=i);let s=i.projectsPage.workHome,c=p(G),{Icon:d,className:f}=H[n.tone],m;t[2]===f?m=t[3]:(m=o(`mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-lg`,f),t[2]=f,t[3]=m);let h;t[4]!==d||t[5]!==n.status?(h=n.status===`running`?(0,B.jsx)(O,{className:`size-3.5 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,B.jsx)(d,{className:`size-3.5`,"aria-hidden":!0}),t[4]=d,t[5]=n.status,t[6]=h):h=t[6];let g;t[7]!==m||t[8]!==h?(g=(0,B.jsx)(`div`,{className:m,children:h}),t[7]=m,t[8]=h,t[9]=g):g=t[9];let v;t[10]===n.title?v=t[11]:(v=(0,B.jsx)(`h3`,{className:`min-w-0 flex-1 text-sm font-medium leading-5 text-fg`,children:n.title}),t[10]=n.title,t[11]=v);let y;t[12]!==s.activityUnread||t[13]!==n.read?(y=n.read?null:(0,B.jsx)(`span`,{className:`mt-1.5 size-1.5 shrink-0 rounded-full bg-accent`,"aria-label":s.activityUnread}),t[12]=s.activityUnread,t[13]=n.read,t[14]=y):y=t[14];let b;t[15]!==v||t[16]!==y?(b=(0,B.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[v,y]}),t[15]=v,t[16]=y,t[17]=b):b=t[17];let x;t[18]===n.message?x=t[19]:(x=n.message?(0,B.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.message}):null,t[18]=n.message,t[19]=x);let S;t[20]===n.source?S=t[21]:(S=n.source?(0,B.jsx)(`span`,{className:`max-w-48 truncate`,children:n.source}):null,t[20]=n.source,t[21]=S);let C;t[22]!==n.updatedAt||t[23]!==r?(C=U(n.updatedAt,r),t[22]=n.updatedAt,t[23]=r,t[24]=C):C=t[24];let w;t[25]===C?w=t[26]:(w=(0,B.jsx)(`span`,{children:C}),t[25]=C,t[26]=w);let T;t[27]===n.occurrences?T=t[28]:(T=n.occurrences>1?(0,B.jsxs)(`span`,{children:[`×`,n.occurrences]}):null,t[27]=n.occurrences,t[28]=T);let E;t[29]!==s.activityViewRelated||t[30]!==n.href?(E=n.href?(0,B.jsxs)(a,{to:n.href,className:`inline-flex items-center gap-0.5 font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[s.activityViewRelated,(0,B.jsx)(re,{className:`size-3`,"aria-hidden":!0})]}):null,t[29]=s.activityViewRelated,t[30]=n.href,t[31]=E):E=t[31];let D;t[32]!==w||t[33]!==T||t[34]!==E||t[35]!==S?(D=(0,B.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 flex-wrap items-center gap-x-2 text-[11px] text-fg-subtle`,children:[S,w,T,E]}),t[32]=w,t[33]=T,t[34]=E,t[35]=S,t[36]=D):D=t[36];let k;t[37]!==D||t[38]!==b||t[39]!==x?(k=(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,x,D]}),t[37]=D,t[38]=b,t[39]=x,t[40]=k):k=t[40];let A;t[41]!==n.id||t[42]!==c?(A=()=>c(n.id),t[41]=n.id,t[42]=c,t[43]=A):A=t[43];let j;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,B.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),t[44]=j):j=t[44];let M;t[45]!==s.activityRemove||t[46]!==A?(M=(0,B.jsx)(`button`,{type:`button`,className:`rounded-md p-1 text-fg-subtle opacity-0 transition-opacity hover:bg-surface-hover hover:text-fg group-hover:opacity-100 focus:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":s.activityRemove,onClick:A,children:j}),t[45]=s.activityRemove,t[46]=A,t[47]=M):M=t[47];let N;return t[48]!==k||t[49]!==M||t[50]!==g?(N=(0,B.jsxs)(`article`,{className:`group flex items-start gap-3 border-t border-edge-subtle px-1 py-3 first:border-t-0`,children:[g,k,M]}),t[48]=k,t[49]=M,t[50]=g,t[51]=N):N=t[51],N}function G(e){return e.remove}function K(e){return e.language}function ce(){let e=(0,R.c)(8),t=l(u(ue)).projectsPage.workHome,n=p($),r=p(Q),i=p(le),[a,o]=(0,z.useState)(!1),c;e[0]===n?c=e[1]:(c=n.filter(Z),e[0]=n,e[1]=c);let d=c.length,f;e[2]===n?f=e[3]:(f=n.filter(X),e[2]=n,e[3]=f);let m=f.length,h;e[4]!==a||e[5]!==n?(h=a?n:n.slice(0,V),e[4]=a,e[5]=n,e[6]=h):h=e[6];let g=h,_;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,B.jsx)(D,{className:`size-4 text-accent`,"aria-hidden":!0}),e[7]=_):_=e[7],(0,B.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,"aria-labelledby":`workbench-activity-title`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_,(0,B.jsx)(`h2`,{id:`workbench-activity-title`,className:`text-sm font-semibold text-fg`,children:t.activityTitle}),d>0?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:[(0,B.jsx)(O,{className:`size-3 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}),d,` `,t.running]}):m>0?(0,B.jsxs)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[m,` `,t.activityNew]}):null]}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.activityHint})]}),n.length>0?(0,B.jsxs)(`div`,{className:`flex items-center gap-1`,children:[m>0?(0,B.jsxs)(I,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:r,children:[(0,B.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),t.activityMarkRead]}):null,n.some(Y)?(0,B.jsxs)(I,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-fg-muted`,onClick:i,children:[(0,B.jsx)(y,{className:`size-3.5`,"aria-hidden":!0}),t.activityClearFinished]}):null]}):null]}),n.length>0?(0,B.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-panel px-3`,children:[g.map(J),n.length>V?(0,B.jsx)(`div`,{className:`border-t border-edge-subtle py-2 text-center`,children:(0,B.jsx)(I,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>o(q),children:a?t.activityShowLess:t.activityShowAll.replace(`{{count}}`,String(n.length))})}):null]}):(0,B.jsxs)(`div`,{className:`mt-4 flex min-h-28 flex-col items-center justify-center rounded-xl bg-surface-panel px-6 text-center`,children:[(0,B.jsx)(k,{className:`size-5 text-fg-subtle`,"aria-hidden":!0}),(0,B.jsx)(`p`,{className:`mt-2 text-sm font-medium text-fg`,children:t.activityEmpty}),(0,B.jsx)(`p`,{className:`mt-1 max-w-lg text-xs leading-5 text-fg-muted`,children:t.activityEmptyBody})]})]})}function q(e){return!e}function J(e){return(0,B.jsx)(W,{item:e},e.id)}function Y(e){return e.status===`done`}function X(e){return!e.read}function Z(e){return e.status===`running`}function le(e){return e.clearFinished}function Q(e){return e.markAllRead}function $(e){return e.items}function ue(e){return e.language}function de(e){return f(d(`/api/home${e?`?locale=${encodeURIComponent(e)}`:``}`))}function fe(e,t){return f(d(`/api/home/decisions/respond`),{method:`POST`,body:JSON.stringify({...e,decision:t})})}function pe(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function me(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:N(n)}function he(){let e=(0,R.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,B.jsx)(P,{className:`h-32 rounded-2xl`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,B.jsxs)(`div`,{className:`space-y-5`,"aria-busy":!0,children:[t,(0,B.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,B.jsx)(P,{className:`h-64 rounded-2xl`}),(0,B.jsx)(P,{className:`h-64 rounded-2xl`})]}),(0,B.jsx)(P,{className:`h-44 rounded-2xl`})]}),e[1]=n):n=e[1],n}function ge(e){let t=(0,R.c)(22),{item:n,statusLabel:r,needsAttention:i}=e,s=i===void 0?!1:i,c=`/work-items/${encodeURIComponent(n.id)}`,l=s?`border-warning/35 bg-warning-soft/25 hover:bg-warning-soft/40`:`border-edge-subtle bg-surface-panel hover:bg-surface-hover/55`,u;t[0]===l?u=t[1]:(u=o(`group block rounded-xl border p-3.5 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,l),t[0]=l,t[1]=u);let d;t[2]===n.title?d=t[3]:(d=(0,B.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.title}),t[2]=n.title,t[3]=d);let f;t[4]===n.projectName?f=t[5]:(f=(0,B.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.projectName}),t[4]=n.projectName,t[5]=f);let p;t[6]!==d||t[7]!==f?(p=(0,B.jsxs)(`div`,{className:`min-w-0`,children:[d,f]}),t[6]=d,t[7]=f,t[8]=p):p=t[8];let m;t[9]===r?m=t[10]:(m=(0,B.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:r}),t[9]=r,t[10]=m);let h;t[11]!==p||t[12]!==m?(h=(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[p,m]}),t[11]=p,t[12]=m,t[13]=h):h=t[13];let g;t[14]!==n.blockedReason||t[15]!==n.nextAction?(g=n.blockedReason||n.nextAction?(0,B.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.blockedReason||n.nextAction}):null,t[14]=n.blockedReason,t[15]=n.nextAction,t[16]=g):g=t[16];let _;return t[17]!==g||t[18]!==c||t[19]!==u||t[20]!==h?(_=(0,B.jsxs)(a,{to:c,className:u,children:[h,g]}),t[17]=g,t[18]=c,t[19]=u,t[20]=h,t[21]=_):_=t[21],_}function _e(e){let t=(0,R.c)(27),{item:n,kindLabel:r,reasonLabel:i,approveLabel:o,denyLabel:s,busy:c,onRespond:l}=e,u;t[0]===n.title?u=t[1]:(u=(0,B.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=u);let d=n.projectName||r,f;t[2]===d?f=t[3]:(f=(0,B.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:d}),t[2]=d,t[3]=f);let p;t[4]!==u||t[5]!==f?(p=(0,B.jsxs)(`div`,{className:`min-w-0`,children:[u,f]}),t[4]=u,t[5]=f,t[6]=p):p=t[6];let m;t[7]===i?m=t[8]:(m=(0,B.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-panel/80 px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:i}),t[7]=i,t[8]=m);let h;t[9]!==p||t[10]!==m?(h=(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[p,m]}),t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]===n.detail?g=t[13]:(g=n.detail?(0,B.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.detail}):null,t[12]=n.detail,t[13]=g);let _;t[14]!==n.href||t[15]!==h||t[16]!==g?(_=(0,B.jsxs)(a,{to:n.href,className:`group block focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[h,g]}),t[14]=n.href,t[15]=h,t[16]=g,t[17]=_):_=t[17];let v;t[18]!==o||t[19]!==c||t[20]!==s||t[21]!==n.response||t[22]!==l?(v=n.response?(0,B.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2 border-t border-warning/20 pt-3`,children:[(0,B.jsx)(I,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:c,onClick:()=>l(`deny`),children:s}),(0,B.jsx)(I,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:c,onClick:()=>l(`approve`),children:o})]}):null,t[18]=o,t[19]=c,t[20]=s,t[21]=n.response,t[22]=l,t[23]=v):v=t[23];let y;return t[24]!==_||t[25]!==v?(y=(0,B.jsxs)(`article`,{className:`rounded-xl border border-warning/35 bg-warning-soft/25 p-3.5 transition-colors hover:bg-warning-soft/40`,children:[_,v]}),t[24]=_,t[25]=v,t[26]=y):y=t[26],y}function ve(e){let t=(0,R.c)(19),{project:n,openLabel:r,noDescription:i}=e,o=`/projects/${encodeURIComponent(n.id)}`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,B.jsx)(g,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[0]=s):s=t[0];let c;t[1]===n.name?c=t[2]:(c=(0,B.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[s,(0,B.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.name})]}),t[1]=n.name,t[2]=c);let l;t[3]===r?l=t[4]:(l=(0,B.jsx)(L,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-label":r}),t[3]=r,t[4]=l);let u;t[5]!==c||t[6]!==l?(u=(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[c,l]}),t[5]=c,t[6]=l,t[7]=u):u=t[7];let d=n.description||n.brief||i,f;t[8]===d?f=t[9]:(f=(0,B.jsx)(`p`,{className:`mt-3 line-clamp-2 text-xs leading-5 text-fg-muted`,children:d}),t[8]=d,t[9]=f);let p=n.lastActiveAt??n.updatedAt,m;t[10]===p?m=t[11]:(m=me(p,``),t[10]=p,t[11]=m);let h;t[12]===m?h=t[13]:(h=(0,B.jsx)(`p`,{className:`mt-auto pt-3 text-[11px] text-fg-subtle`,children:m}),t[12]=m,t[13]=h);let _;return t[14]!==o||t[15]!==h||t[16]!==u||t[17]!==f?(_=(0,B.jsxs)(a,{to:o,className:`group flex min-h-32 flex-col rounded-xl border border-edge-subtle bg-surface-panel p-4 transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[u,f,h]}),t[14]=o,t[15]=h,t[16]=u,t[17]=f,t[18]=_):_=t[18],_}function ye(){let e=u(e=>e.language),t=l(e),n=t.projectsPage,r=i(),o=h(e=>e.setPageHeader),s=h(e=>e.clearPageHeader),[d,f]=(0,z.useState)(null),[p,g]=(0,z.useState)([]),[_,y]=(0,z.useState)(!0),[w,D]=(0,z.useState)(null),[O,N]=(0,z.useState)(null),[P,F]=(0,z.useState)(``),[re,L]=(0,z.useState)(!1),[R,V]=(0,z.useState)(`delegate`),[H,U]=(0,z.useState)(``),[W,G]=(0,z.useState)(!1),[K,q]=(0,z.useState)(null),J=(0,z.useCallback)(async()=>{y(!0),D(null);try{let[t,n]=await Promise.all([de(e),ne({limit:100,sortBy:`updatedAt`,sortOrder:`desc`})]);f(t),g(n.items)}catch(e){D(e instanceof Error?e.message:String(e))}finally{y(!1)}},[e]);(0,z.useEffect)(()=>{J()},[J]);let Y=(0,z.useMemo)(()=>{let e=P.trim().toLocaleLowerCase(),t=p.filter(e=>e.status!==`archived`);return e?t.filter(t=>[t.name,t.description,t.brief].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e))):t.slice(0,12)},[p,P]),X=(0,z.useMemo)(()=>d?.decisions??[],[d]),Z=(0,z.useMemo)(()=>d?.work.current.filter(e=>e.status!==`needs_input`&&e.status!==`in_review`&&e.status!==`blocked`).slice(0,10)??[],[d]),le=(0,z.useCallback)(async t=>{t.preventDefault();let n=H.trim();if(!(!n||W)){if(R===`watch`){let t=e===`zh`?`持续关注以下事项,在发生有意义的变化时通知我:\n${n}`:`Keep watching the following and notify me when something meaningfully changes:\n${n}`;U(``),L(!1),r(`/automations?draft=${encodeURIComponent(t)}&autogenerate=1`);return}G(!0),N(null);try{let t=await oe({outcome:n,uiLocale:e});U(``),L(!1),r(`/projects/${encodeURIComponent(t.project.id)}`)}catch(e){N(e instanceof Error?e.message:String(e))}finally{G(!1)}}},[R,W,e,r,H]),Q=(0,z.useMemo)(()=>(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsxs)(I,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>{V(`watch`),L(!0)},children:[(0,B.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),n.workHome.watch]}),(0,B.jsxs)(I,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>{V(`delegate`),L(!0)},children:[(0,B.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),n.workHome.delegate]})]}),[n.workHome.delegate,n.workHome.watch]),$=(0,z.useCallback)(async(e,t)=>{if(e.response){q(e.id),D(null);try{await fe(e.response,t),await J()}catch(e){D(e instanceof Error?e.message:String(e))}finally{q(null)}}},[J]);return(0,z.useLayoutEffect)(()=>(o({startExtra:null,main:(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,B.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.workHome.subtitle})]}),end:Q}),()=>s()),[s,Q,o,n.title,n.workHome.subtitle]),(0,B.jsxs)(`main`,{className:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,B.jsx)(S,{open:re,onOpenChange:e=>{L(e),e||N(null)},children:(0,B.jsxs)(E,{children:[(0,B.jsx)(x,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,B.jsxs)(v,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(26rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,B.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,B.jsx)(se,{className:`text-base font-semibold text-fg`,children:R===`watch`?n.workHome.watchTitle:n.workHome.delegateTitle}),(0,B.jsx)(b,{className:`mt-1 text-sm text-fg-muted`,children:R===`watch`?n.workHome.watchDescription:n.workHome.delegateDescription})]}),(0,B.jsxs)(`form`,{onSubmit:le,className:`flex min-h-0 flex-1 flex-col`,children:[(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 px-5 py-4`,children:[(0,B.jsxs)(`label`,{className:`grid gap-2 text-sm font-medium text-fg`,children:[R===`watch`?n.workHome.watchLabel:n.workHome.outcomeLabel,(0,B.jsx)(`textarea`,{className:`min-h-40 w-full resize-none rounded-xl border border-edge bg-surface-base p-3 text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,value:H,onChange:e=>U(e.target.value),placeholder:R===`watch`?n.workHome.watchPlaceholder:n.workHome.outcomePlaceholder,maxLength:12e3,disabled:W})]}),O?(0,B.jsx)(`p`,{className:`mt-3 rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:O}):null]}),(0,B.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge px-5 py-4`,children:[(0,B.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:R===`watch`?n.workHome.watchSetupHint:n.workHome.autoSetupHint}),(0,B.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,B.jsx)(C,{asChild:!0,children:(0,B.jsx)(I,{type:`button`,variant:`ghost`,children:n.cancel})}),(0,B.jsxs)(I,{type:`submit`,variant:`primary`,disabled:W||!H.trim(),children:[(0,B.jsx)(j,{className:`size-4`,"aria-hidden":!0}),W?n.workHome.delegating:R===`watch`?n.workHome.designWatch:n.workHome.delegate]})]})]})]})]})]})}),w?(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,B.jsx)(`span`,{children:w}),(0,B.jsx)(I,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void J(),children:n.workHome.retry})]}):null,_?(0,B.jsx)(he,{}):d?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{className:`relative overflow-hidden rounded-2xl border border-accent/15 bg-gradient-to-br from-accent-soft/70 via-surface-panel to-surface-panel p-5 sm:p-6`,children:[(0,B.jsx)(`div`,{className:`absolute -right-8 -top-12 size-40 rounded-full bg-accent/10 blur-3xl`,"aria-hidden":!0}),(0,B.jsxs)(`div`,{className:`relative flex flex-wrap items-end justify-between gap-4`,children:[(0,B.jsxs)(`div`,{className:`max-w-2xl`,children:[(0,B.jsx)(`div`,{className:`mb-3 flex size-10 items-center justify-center rounded-xl bg-accent text-white`,children:(0,B.jsx)(A,{className:`size-5`,"aria-hidden":!0})}),(0,B.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-wider text-accent`,children:n.workHome.briefingTitle}),(0,B.jsx)(`h2`,{className:`mt-1 text-xl font-semibold tracking-tight text-fg`,children:n.workHome.heroTitle}),(0,B.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:d.briefing.summary})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-xs`,children:[(0,B.jsx)(`span`,{className:`rounded-full bg-surface-panel/80 px-3 py-1.5 text-fg-muted`,children:pe(n.workHome.activeCount,{count:d.briefing.progress.movingCount})}),d.decisions.length>0?(0,B.jsx)(`span`,{className:`rounded-full bg-warning-soft px-3 py-1.5 text-fg`,children:pe(n.workHome.attentionCount,{count:d.decisions.length})}):null]})]})]}),d.work.current.length===0&&d.workflowRuns.active.length===0?(0,B.jsxs)(`section`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center`,children:[(0,B.jsx)(m,{className:`mx-auto size-6 text-accent`,"aria-hidden":!0}),(0,B.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.workHome.emptyTitle}),(0,B.jsx)(`p`,{className:`mx-auto mt-1 max-w-lg text-sm leading-6 text-fg-muted`,children:n.workHome.emptyBody}),(0,B.jsxs)(`div`,{className:`mt-4 flex justify-center gap-2`,children:[(0,B.jsx)(I,{type:`button`,variant:`primary`,onClick:()=>r(`/chat/new`),children:n.workHome.startChat}),(0,B.jsx)(I,{type:`button`,variant:`secondary`,onClick:()=>{V(`delegate`),L(!0)},children:n.workHome.startLongWork})]})]}):null,(0,B.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,B.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(c,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,B.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.workHome.needsYou})]}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.workHome.needsYouHint}),(0,B.jsx)(`div`,{className:`mt-4 space-y-2`,children:X.length?X.map(e=>(0,B.jsx)(_e,{item:e,kindLabel:n.workHome.decisionKinds[e.kind],reasonLabel:n.workHome.decisionReasons[e.reason],approveLabel:n.workHome.approve,denyLabel:n.workHome.deny,busy:K===e.id,onRespond:t=>void $(e,t)},e.id)):(0,B.jsx)(`p`,{className:`rounded-xl bg-surface-panel px-4 py-6 text-center text-sm text-fg-muted`,children:n.workHome.nothingNeedsYou})})]}),(0,B.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(k,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,B.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.workHome.continueTitle})]}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.workHome.continueHint}),(0,B.jsx)(`div`,{className:`mt-4 space-y-2`,children:Z.length?Z.map(e=>(0,B.jsx)(ge,{item:e,statusLabel:t.projectDetailPage.workItems.statuses[e.status]},e.id)):(0,B.jsx)(`p`,{className:`rounded-xl bg-surface-panel px-4 py-6 text-center text-sm text-fg-muted`,children:n.workHome.noCurrentWork})})]})]}),d.workflowRuns.active.length>0||d.upcomingAutomations.length>0?(0,B.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,B.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(j,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,B.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.workHome.processing})]}),(0,B.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[d.workflowRuns.active.map(e=>(0,B.jsxs)(a,{to:T(e.id),className:`flex items-center justify-between gap-3 rounded-xl bg-surface-panel p-3 text-sm hover:bg-surface-hover`,children:[(0,B.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.title}),(0,B.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.workHome.running})]},e.id)),d.workflowRuns.active.length===0?(0,B.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.workHome.nothingRunning}):null]})]}),(0,B.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(te,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,B.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.workHome.scheduled})]}),(0,B.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[d.upcomingAutomations.map(e=>(0,B.jsxs)(a,{to:`/automations`,className:`flex items-center justify-between gap-3 rounded-xl bg-surface-panel p-3 text-sm hover:bg-surface-hover`,children:[(0,B.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.name||e.action}),(0,B.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,children:me(e.nextRunAt,n.never)})]},e.id)),d.upcomingAutomations.length===0?(0,B.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.workHome.noScheduled}):null]})]})]}):null,d.briefing.wins.length>0?(0,B.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(ie,{className:`size-4 text-success`,"aria-hidden":!0}),(0,B.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.workHome.completed})]}),(0,B.jsx)(`div`,{className:`mt-3 grid gap-2 md:grid-cols-2 xl:grid-cols-3`,children:d.briefing.wins.map(e=>(0,B.jsxs)(a,{to:e.href,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3.5 transition-colors hover:bg-surface-hover/55`,children:[(0,B.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:n.workHome.winKinds[e.kind]})]},e.id))})]}):null,(0,B.jsx)(ce,{})]}):null,(0,B.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.workHome.spacesTitle}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.workHome.spacesHint})]}),(0,B.jsx)(a,{to:`/projects`,className:`text-xs font-medium text-accent hover:underline`,children:n.management.viewAll})]}),(0,B.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,B.jsxs)(`label`,{className:`relative block min-w-0`,children:[(0,B.jsx)(M,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,B.jsx)(`input`,{className:`h-9 w-52 rounded-lg border border-edge bg-surface-panel pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:P,onChange:e=>F(e.target.value),placeholder:n.searchPlaceholder,"aria-label":n.searchPlaceholder})]})}),(0,B.jsx)(`div`,{className:`mt-4 grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:Y.map(e=>(0,B.jsx)(ve,{project:e,openLabel:n.workHome.openSpace,noDescription:n.noDescription},e.id))}),!_&&Y.length===0?(0,B.jsx)(`p`,{className:`py-8 text-center text-sm text-fg-muted`,children:n.workHome.noSpaces}):null]})]})}export{ye as WorkPage};