@xopcai/xopc 0.0.282 → 0.0.283
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.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Cny5rATT.js → agent-avatar-dicebear-DQ74xqLi.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-OyQ8OVZv.js → agent-defaults-settings-panel-SElFkQd6.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-DJeh_Ewo.js → agents-DYazUaZ6.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-ZqQKaZEI.js → app-management-settings-panel-B42TpqIb.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CfXsQkKO.js → appearance-settings-D9Lfe7Sk.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-k-QnVhKW.js → apps-page-BzrodN8C.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-BrW53Hap.js → archive-plugin-BdmQwj4x.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-DkfFWHiS.js → attachment-load-B4S0_nji.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-preview-renderer-CfEDFYPE.js → attachment-preview-renderer-wzIchDSv.js} +4 -4
- package/dist/gateway/static/root/assets/attachment-process-heavy-Db4nTY5N.js +5 -0
- package/dist/gateway/static/root/assets/{automations-page-e-5we6kD.js → automations-page-B3TmHNjQ.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-DPnlkws1.js → automations-workspace--A4I0jMu.js} +1 -1
- package/dist/gateway/static/root/assets/binary-plugins-B3cXF_DP.js +2 -0
- package/dist/gateway/static/root/assets/{block-editor-CfeF1OmA.js → block-editor-05zyBXBe.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-DnsuWKRu.js → browser-automations-page-DRBA9nwe.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-C8xyhnxx.js → browser-settings-page-DDTXUNWK.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-CBllOLTT.js → capabilities-settings-panel-Ll5UeXq5.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-C-A-VUE2.js → channels-settings-BzL15bkU.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-C_Fw1R3A.js → chat-terminal-dock-Dx5KQyo5.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-CtsMo3H4.js → connectors-page-RPw1AOMb.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-CPFxjTrN.js → date-picker-CkDROZoe.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-C_5KqzjI.js → dependency-picker-Bl8HcvzL.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DLJsC5D6.js → desktop-pet-BcknAjbW.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BdI1iSgz.js → desktop-pet-settings-BuCpXQPm.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-BnvPLhc9.js → device-pairing-wizard-D0_tCX49.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-BNS_TkZQ.js → extension-debug-page-qRpb2FFa.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DMSDZ7Mb.js → extension-page-C7gs9wu4.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CeGCWMt0.js → extension-settings-page-CyJP1CMZ.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-DKOTYUma.js → gateway-settings-DOeeTdWE.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-gsdL_Yij.js → heartbeat-settings-CV6Dolcn.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-CbeAdS1T.js → home-page-Djw1H_Go.js} +1 -1
- package/dist/gateway/static/root/assets/{index-enFXJJCU.js → index-CHgOG1aR.js} +8 -8
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CCLtJ8s8.js → keyboard-shortcuts-settings-B3XqA41D.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-DzC6SrXj.js → local-app-workbench-page-BPqgyYJq.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-3LdgP3NO.js → local-apps-page-BcIVYp0J.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-DHClKtm6.js → logs-page-BHax3XlS.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-BaCo9Nuo.js → management-settings-DNFCdgzR.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-BMjJppvG.js → media-plugins-BDxNhoBC.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-panel-hYO2jNhL.js → note-detail-panel-Cs46LFXO.js} +3 -3
- package/dist/gateway/static/root/assets/{notes-page-BT66x22W.js → notes-page-BUkcn_0t.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-BCszXX_F.js → page-tabs-agH3a2PI.js} +1 -1
- package/dist/gateway/static/root/assets/pdf-runtime-DU_sMPjG.js +2 -0
- package/dist/gateway/static/root/assets/pdf.worker.min-B4E34YdZ.js +48 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-CyM0sanh.js → preview-open-alternatives-XEZ7zDOP.js} +1 -1
- package/dist/gateway/static/root/assets/{proactive-page-CVDGA5sB.js → proactive-page-Bn484J9v.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-Bp6TAMPM.js → project-detail-page-LcH21ixD.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-UhOIiDcg.js → projects-page-DelBiwyB.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-DJIkMFT4.js → remote-access-hub-3BjFYXCf.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BUFCgRdZ.js → runtime-tools-settings-panel-DErKZlVJ.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-B01ksA8M.js → schema-form-DhCmJQVJ.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-CQOAwPDt.js → sessions-page-CVFirgVd.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DyfBpqkY.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-DvnjZBa3.js → settings-form-section-Dg6chotg.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DZRkpbCh.js → settings-page-LyuN5N3M.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-DVaEiAVY.js → setup-status-panel-CrXhTzHr.js} +1 -1
- package/dist/gateway/static/root/assets/share-preview-page-CZvmf4Ob.js +2 -0
- package/dist/gateway/static/root/assets/{shares-settings-XiCqMDAe.js → shares-settings-DyM_D8hM.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-C3D8WanU.js → skill-reload-api-Bys58-15.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-CxMWwR6A.js → skills-page-sWNvFo6D.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-BryVNYll.js → skills-page.utils-Eu0WVHTS.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-mKFDe6aZ.js → system-settings-panel-DQKkM7B2.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-Cb0RZNcJ.js → task-detail-page-B18NcZQJ.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-FcI3wKy3.js → tunnel-api-TKQpPVd6.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-CDgdtjTC.js → use-autosave-CkVlrFk1.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-Cnshc-Un.js → user-model-page-ul-zr58b.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-Ce8cb5mN.js → voice-api-key-field-B12fFN-L.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CacFTtXe.js → work-discovery-overlay-CT9Zy36i.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-V-5HuEUq.js → workflow-run-setup-panel-BwefQliE.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-1OJimIfo.js → workflows-page-BY_AWs7S.js} +1 -1
- package/dist/gateway/static/root/index.html +1 -1
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +4 -4
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
- package/dist/src/agent/service.js +2 -2
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +3 -3
- package/dist/src/agent/tools/xopc-use-tool.js +2 -2
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +2 -2
- package/dist/src/auth/oauth/xopc-cloud.js +1 -1
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +3 -3
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/workflows.js +2 -2
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service.js +7 -7
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/tasks/home-query-service.js +2 -2
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/work-discovery/service.js +2 -2
- package/dist/src/workflows/service/workflow-run-service.js +2 -2
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/attachment-process-heavy-C5CqLCsX.js +0 -5
- package/dist/gateway/static/root/assets/binary-plugins-CWIswfXA.js +0 -2
- package/dist/gateway/static/root/assets/excel-worksheet-utils-DpdB-DjU.js +0 -1
- package/dist/gateway/static/root/assets/pdf.worker.min-CHFwMXne.mjs +0 -29
- package/dist/gateway/static/root/assets/settings-advanced-gate-CFuqbGI-.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-vz0UK56q.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{h as i}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{n as a,r as o}from"./popover-select-DGmMQt4t.js";import{t as s}from"./loader-circle-CifKLtgG.js";import{t as c}from"./message-square-fVE7Ghj1.js";import{t as l}from"./cn-JdwAhgNB.js";import{a as u,c as d,n as f,r as p}from"./locale-store-1urrBBCQ.js";import{t as m}from"./messages-DYFcjtmG.js";import{i as h,o as g}from"./vendor-swr-BIWyz7Rc.js";import{t as _}from"./button-BA45yciM.js";import{n as v,r as y}from"./gateway-config-swr-Cpmyrr6j.js";import{Ao as b,Gl as x,Lc as S,Ml as C,Oo as w,cu as T,ho as E,jo as D,kc as O,ko as k,na as A,yo as j}from"./index-enFXJJCU.js";import{n as ee,r as M,t as te}from"./settings-page-layout-DYelDcMV.js";import{n as ne}from"./settings-loading-skeleton-CAmWMaOT.js";import{n as re,t as ie}from"./use-autosave-CDgdtjTC.js";import{t as ae}from"./page-tabs-BCszXX_F.js";import{t as oe}from"./settings-advanced-gate-CFuqbGI-.js";import{i as se,n as ce,r as N,t as le}from"./channels-status-swr-DMYQNs-J.js";import{n as P,o as F,t as ue}from"./cron-expression-CjrWuy2m.js";import{t as I}from"./date-picker-CPFxjTrN.js";import{n as L,t as de}from"./tab-completion-input-D64VNmiA.js";var R=e(t(),1),z=n();function B(){return p(`/api/workspace/heartbeat-md`)}async function fe(){let e=await u(B());return typeof e.payload?.content==`string`?e.payload.content:``}function V(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function pe(e){let t=V(e)?e:{},n=V(t.gateway)?t.gateway:{},r=V(n.heartbeat)?n.heartbeat:{},i=r.activeHours,a=V(i)?i:null,o=a&&typeof a.start==`string`&&typeof a.end==`string`&&a.start&&a.end?{start:a.start,end:a.end,timezone:typeof a.timezone==`string`?a.timezone:``}:null;return{enabled:!!(r.enabled??!0),intervalMs:typeof r.intervalMs==`number`&&Number.isFinite(r.intervalMs)?r.intervalMs:18e5,includeSystemPromptSection:r.includeSystemPromptSection===!0,target:typeof r.target==`string`?r.target:``,targetChatId:typeof r.targetChatId==`string`?r.targetChatId:``,prompt:typeof r.prompt==`string`?r.prompt:``,ackMaxChars:typeof r.ackMaxChars==`number`&&Number.isFinite(r.ackMaxChars)?r.ackMaxChars:``,isolatedSession:!!r.isolatedSession,activeHours:o}}function H(e){let t={enabled:e.enabled,intervalMs:e.intervalMs,includeSystemPromptSection:e.includeSystemPromptSection};return e.target.trim()?t.target=e.target.trim():t.target=null,e.targetChatId.trim()?t.targetChatId=e.targetChatId.trim():t.targetChatId=null,e.prompt.trim()?t.prompt=e.prompt.trim():t.prompt=null,e.ackMaxChars===``||e.ackMaxChars===void 0?t.ackMaxChars=null:t.ackMaxChars=e.ackMaxChars,e.isolatedSession?t.isolatedSession=!0:t.isolatedSession=null,e.activeHours?.start?.trim()&&e.activeHours?.end?.trim()?t.activeHours={start:e.activeHours.start.trim(),end:e.activeHours.end.trim(),...e.activeHours.timezone.trim()?{timezone:e.activeHours.timezone.trim()}:{}}:t.activeHours=null,t}async function me(e){await u(p(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{heartbeat:H(e)}})}),v()}async function he(e){await u(p(`/api/workspace/heartbeat-md`),{method:`PUT`,body:JSON.stringify({content:e})}),g(B())}async function ge(e){await u(p(`/api/heartbeat/trigger`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?{reason:e}:{})})}var U=r(),W=Array.from({length:60},(e,t)=>t),G=l(b,`min-w-0 shrink text-xs sm:min-w-[7rem] sm:max-w-[11rem]`),_e=l(`h-9 w-14 shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1.5 text-center text-sm tabular-nums text-fg`,w),ve=l(`min-h-[2.5rem] w-full rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 font-mono text-xs text-fg`,w);function K(e){return{...e,intervalMinutesDraft:null,intervalHoursDraft:null}}function q(e){let{intervalMinutesDraft:t,intervalHoursDraft:n,...r}=e;return r}function J(e,t){switch(t.type){case`reset`:return K(t.state);case`replace`:return t.state}}function ye({value:e,onChange:t,labels:n,disabled:r,showHeading:i=!0}){let s=(0,R.useMemo)(()=>P(e),[e]),[c,u]=(0,R.useReducer)(J,s,K),d=(0,R.useRef)(e);d.current!==e&&(d.current=e,u({type:`reset`,state:s}));let f=(0,R.useCallback)(e=>{let n={...c,...e};u({type:`replace`,state:n});let r=q(n),i=q(c);Object.keys(r).some(e=>r[e]!==i[e])&&t(ue(r))},[t,c]),{mode:p,intervalKind:m,onceDate:h,intervalMinutes:g,intervalHours:_,minute:v,hour:y,weekDays:b,dayOfMonth:x,rawCron:S,intervalMinutesDraft:C,intervalHoursDraft:w}=c,T=`${String(y).padStart(2,`0`)}:${String(v).padStart(2,`0`)}`,E=e=>{if(!e)return;let[t,n]=e.split(`:`).map(e=>parseInt(e,10));Number.isNaN(t)||Number.isNaN(n)||f({minute:n,hour:t})},D=(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-nowrap items-center gap-2 overflow-x-auto pb-0.5`,children:[(0,U.jsxs)(a,{className:G,disabled:r,value:p,onChange:e=>{let t=e.target.value;f({mode:t})},"aria-label":n.scheduleTimeLabel,children:[(0,U.jsx)(o,{value:`no_repeat`,children:n.modeNoRepeat}),(0,U.jsx)(o,{value:`interval`,children:n.modeInterval}),(0,U.jsx)(o,{value:`hourly`,children:n.modeHourly}),(0,U.jsx)(o,{value:`daily`,children:n.modeDaily}),(0,U.jsx)(o,{value:`weekly`,children:n.modeWeekly}),(0,U.jsx)(o,{value:`monthly`,children:n.modeMonthly}),(0,U.jsx)(o,{value:`custom`,children:n.modeCustom})]}),p===`no_repeat`&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(I,{disabled:r,className:`h-9 min-w-[9.5rem] shrink-0 bg-surface-panel px-2`,value:h,onChange:e=>f({onceDate:e}),ariaLabel:n.modeNoRepeat}),(0,U.jsx)(F,{disabled:r,className:`min-w-[6.5rem] shrink-0`,triggerClassName:`h-9 border-edge-subtle px-2`,value:T,onChange:E,ariaLabel:n.scheduleTimeLabel})]}),p===`interval`&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(a,{className:l(G,`w-auto min-w-[5rem]`),disabled:r,value:m,onChange:e=>{let t=e.target.value;f({intervalKind:t,intervalMinutesDraft:null,intervalHoursDraft:null})},"aria-label":n.modeInterval,children:[(0,U.jsx)(o,{value:`minutes`,children:n.intervalKindMinutes}),(0,U.jsx)(o,{value:`hours`,children:n.intervalKindHours})]}),m===`minutes`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`input`,{type:`number`,min:1,max:59,disabled:r,className:_e,value:C??String(g),onChange:e=>{let t=e.target.value,n=parseInt(t,10),r={intervalMinutesDraft:t};Number.isFinite(n)&&n>=1&&n<=59&&(r.intervalMinutes=n),f(r)},onBlur:()=>{if(C===null)return;let e=parseInt(C,10);f({intervalMinutes:!Number.isFinite(e)||e<1?5:Math.min(59,Math.max(1,Math.round(e))),intervalMinutesDraft:null})},"aria-label":n.intervalMinutes}),(0,U.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`input`,{type:`number`,min:1,max:23,disabled:r,className:_e,value:w??String(_),onChange:e=>{let t=e.target.value,n=parseInt(t,10),r={intervalHoursDraft:t};Number.isFinite(n)&&n>=1&&n<=23&&(r.intervalHours=n),f(r)},onBlur:()=>{if(w===null)return;let e=parseInt(w,10);f({intervalHours:!Number.isFinite(e)||e<1?2:Math.min(23,Math.max(1,Math.round(e))),intervalHoursDraft:null})},"aria-label":n.intervalHours}),(0,U.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.hourUnit}),(0,U.jsx)(a,{className:l(G,`w-auto min-w-[4rem]`),disabled:r,value:v,onChange:e=>{f({minute:parseInt(e.target.value,10)})},"aria-label":n.minuteAtHour,children:W.map(e=>(0,U.jsx)(o,{value:e,children:String(e).padStart(2,`0`)},e))}),(0,U.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]})]}),p===`daily`&&(0,U.jsx)(F,{disabled:r,className:`min-w-[6.5rem] shrink-0`,triggerClassName:`h-9 border-edge-subtle px-2`,value:T,onChange:E,ariaLabel:n.scheduleTimeLabel}),p===`weekly`&&(0,U.jsx)(F,{disabled:r,className:`min-w-[6.5rem] shrink-0`,triggerClassName:`h-9 border-edge-subtle px-2`,value:T,onChange:E,ariaLabel:n.scheduleTimeLabel}),p===`monthly`&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(a,{className:l(G,`w-auto min-w-[4.5rem]`),disabled:r,value:x,onChange:e=>{f({dayOfMonth:parseInt(e.target.value,10)})},"aria-label":n.dayOfMonth,children:Array.from({length:31},(e,t)=>t+1).map(e=>(0,U.jsx)(o,{value:e,children:e},e))}),(0,U.jsx)(F,{disabled:r,className:`min-w-[6.5rem] shrink-0`,triggerClassName:`h-9 border-edge-subtle px-2`,value:T,onChange:E,ariaLabel:n.scheduleTimeLabel})]}),p===`hourly`&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(a,{className:l(G,`w-auto min-w-[4rem]`),disabled:r,value:v,onChange:e=>{f({minute:parseInt(e.target.value,10)})},"aria-label":n.minuteAtHour,children:W.map(e=>(0,U.jsx)(o,{value:e,children:String(e).padStart(2,`0`)},e))}),(0,U.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]})]}),O=p===`weekly`?(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1.5 pt-1`,role:`group`,"aria-label":n.modeWeekly,children:n.weekdays.map((e,t)=>{let n=b[t];return(0,U.jsx)(`button`,{type:`button`,disabled:r,className:l(`flex size-9 select-none items-center justify-center rounded-full border text-xs font-medium transition-colors`,n?`border-fg bg-fg text-surface-panel`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),"aria-pressed":n,onClick:()=>{let e=[...b];e[t]=!e[t],f({weekDays:e})},children:e},e)})}):null,k=p===`custom`?(0,U.jsxs)(`div`,{className:`pt-1`,children:[(0,U.jsx)(L,{disabled:r,className:ve,rows:2,spellCheck:!1,value:S,suggestion:`*/5 * * * *`,onAcceptSuggestion:e=>f({rawCron:e}),placeholder:`*/5 * * * *`,onChange:e=>{f({rawCron:e.target.value})},"aria-label":n.modeCustom}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.customCronHint})]}):null;return(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[i?(0,U.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.scheduleTimeLabel}):null,D,O,k]})}var Y=[3e4,6e4,3e5,6e5,9e5,18e5,36e5,72e5];new Set(Y);var X=l(`h-9 min-w-0 flex-1 rounded-lg border border-edge-subtle bg-surface-panel px-2.5 py-1.5 text-sm tabular-nums text-fg`,w),be=l(b,`h-9 max-w-[11rem] shrink-0 text-xs sm:max-w-[12rem]`);function xe(e,t){switch(e){case 3e4:return t.every30s;case 6e4:return t.every1min;case 3e5:return t.every5min;case 6e5:return t.every10min;case 9e5:return t.every15min;case 18e5:return t.every30min;case 36e5:return t.every1h;case 72e5:return t.every2h;default:return String(e)}}function Se({valueMs:e,onChangeMs:t,labels:n,disabled:r,presets:i=Y,minSeconds:s=1}){let c=(0,R.useMemo)(()=>new Set(i),[i]),l=(0,R.useMemo)(()=>c.has(e)?String(e):``,[c,e]),[u,d]=(0,R.useState)(null),f=(0,R.useRef)(e);f.current!==e&&(f.current=e,d(null));let p=Math.max(s,Math.round(e/1e3)),m=u===null?String(p):u;return(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.secondsLabel}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(`input`,{type:`number`,min:s,step:1,disabled:r,className:X,value:m,onChange:e=>{let n=e.target.value;d(n);let r=parseInt(n,10);Number.isFinite(r)&&r>=s&&t(r*1e3)},onBlur:()=>{if(u===null)return;let e=parseInt(u,10);t(!Number.isFinite(e)||e<s?s*1e3:e*1e3),d(null)}}),(0,U.jsxs)(a,{className:be,disabled:r,value:l,onChange:e=>{let n=e.target.value;n&&(t(parseInt(n,10)),d(null))},children:[(0,U.jsx)(o,{value:``,children:n.presets.custom}),i.map(e=>(0,U.jsx)(o,{value:String(e),children:xe(e,n.presets)},e))]})]})]})}var Ce=l(`mt-1 w-full rounded-lg border border-edge-subtle bg-surface-panel px-2.5 py-1.5 text-sm text-fg`,w),Z=()=>({start:`09:00`,end:`22:00`,timezone:``});function we(e){let t=(0,z.c)(61),{value:n,onChange:r,labels:i,disabled:a}=e;if(!n){let e;t[0]===r?e=t[1]:(e=()=>r(Z()),t[0]=r,t[1]=e);let n;return t[2]!==a||t[3]!==i.add||t[4]!==e?(n=(0,U.jsx)(_,{type:`button`,variant:`secondary`,className:`text-sm`,disabled:a,onClick:e,children:i.add}),t[2]=a,t[3]=i.add,t[4]=e,t[5]=n):n=t[5],n}let o;t[6]===i.start?o=t[7]:(o=(0,U.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:i.start}),t[6]=i.start,t[7]=o);let s;t[8]!==r||t[9]!==n?(s=e=>r({...n,start:e}),t[8]=r,t[9]=n,t[10]=s):s=t[10];let c;t[11]!==a||t[12]!==i.start||t[13]!==s||t[14]!==n.start?(c=(0,U.jsx)(F,{disabled:a,className:`mt-1 w-full`,triggerClassName:`h-9 border-edge-subtle px-2.5`,value:n.start,onChange:s,ariaLabel:i.start}),t[11]=a,t[12]=i.start,t[13]=s,t[14]=n.start,t[15]=c):c=t[15];let l;t[16]!==o||t[17]!==c?(l=(0,U.jsxs)(`label`,{className:`block min-w-0`,children:[o,c]}),t[16]=o,t[17]=c,t[18]=l):l=t[18];let u;t[19]===i.end?u=t[20]:(u=(0,U.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:i.end}),t[19]=i.end,t[20]=u);let d;t[21]!==r||t[22]!==n?(d=e=>r({...n,end:e}),t[21]=r,t[22]=n,t[23]=d):d=t[23];let f;t[24]!==a||t[25]!==i.end||t[26]!==d||t[27]!==n.end?(f=(0,U.jsx)(F,{disabled:a,className:`mt-1 w-full`,triggerClassName:`h-9 border-edge-subtle px-2.5`,value:n.end,onChange:d,ariaLabel:i.end}),t[24]=a,t[25]=i.end,t[26]=d,t[27]=n.end,t[28]=f):f=t[28];let p;t[29]!==u||t[30]!==f?(p=(0,U.jsxs)(`label`,{className:`block min-w-0`,children:[u,f]}),t[29]=u,t[30]=f,t[31]=p):p=t[31];let m;t[32]===i.timezone?m=t[33]:(m=(0,U.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:i.timezone}),t[32]=i.timezone,t[33]=m);let h;t[34]!==r||t[35]!==n?(h=e=>r({...n,timezone:e.target.value}),t[34]=r,t[35]=n,t[36]=h):h=t[36];let g;t[37]!==r||t[38]!==n?(g=e=>r({...n,timezone:e}),t[37]=r,t[38]=n,t[39]=g):g=t[39];let v;t[40]!==a||t[41]!==h||t[42]!==g||t[43]!==n.timezone?(v=(0,U.jsx)(de,{type:`text`,disabled:a,className:Ce,value:n.timezone,onChange:h,suggestion:`Asia/Shanghai`,onAcceptSuggestion:g,placeholder:`Asia/Shanghai`,autoComplete:`off`}),t[40]=a,t[41]=h,t[42]=g,t[43]=n.timezone,t[44]=v):v=t[44];let y;t[45]!==v||t[46]!==m?(y=(0,U.jsxs)(`label`,{className:`block min-w-0`,children:[m,v]}),t[45]=v,t[46]=m,t[47]=y):y=t[47];let b;t[48]!==y||t[49]!==l||t[50]!==p?(b=(0,U.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[l,p,y]}),t[48]=y,t[49]=l,t[50]=p,t[51]=b):b=t[51];let x;t[52]===r?x=t[53]:(x=()=>r(null),t[52]=r,t[53]=x);let S;t[54]!==a||t[55]!==i.clear||t[56]!==x?(S=(0,U.jsx)(_,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:a,onClick:x,children:i.clear}),t[54]=a,t[55]=i.clear,t[56]=x,t[57]=S):S=t[57];let C;return t[58]!==b||t[59]!==S?(C=(0,U.jsxs)(`div`,{className:`space-y-2`,children:[b,S]}),t[58]=b,t[59]=S,t[60]=C):C=t[60],C}function Q(e){let t=(0,z.c)(34),{disabled:n,label:r,hint:i,className:a}=e,o;t[0]===a?o=t[1]:(o=l(`flex flex-col gap-2`,a),t[0]=a,t[1]=o);let s;t[2]===r?s=t[3]:(s=r?(0,U.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r}):null,t[2]=r,t[3]=s);let c;t[4]!==n||t[5]!==r||t[6]!==e.kind||t[7]!==e.labels||t[8]!==e.onChange||t[9]!==e.value?(c=e.kind===`cron`?(0,U.jsx)(ye,{value:e.value,onChange:e.onChange,labels:e.labels,disabled:n,showHeading:!r}):null,t[4]=n,t[5]=r,t[6]=e.kind,t[7]=e.labels,t[8]=e.onChange,t[9]=e.value,t[10]=c):c=t[10];let u;t[11]!==n||t[12]!==e.kind||t[13]!==e.labels||t[14]!==e.minSeconds||t[15]!==e.onChangeMs||t[16]!==e.presets||t[17]!==e.valueMs?(u=e.kind===`interval`?(0,U.jsx)(Se,{valueMs:e.valueMs,onChangeMs:e.onChangeMs,labels:e.labels,disabled:n,presets:e.presets??Y,minSeconds:e.minSeconds}):null,t[11]=n,t[12]=e.kind,t[13]=e.labels,t[14]=e.minSeconds,t[15]=e.onChangeMs,t[16]=e.presets,t[17]=e.valueMs,t[18]=u):u=t[18];let d;t[19]!==n||t[20]!==e.kind||t[21]!==e.labels||t[22]!==e.onChange||t[23]!==e.value?(d=e.kind===`active-hours`?(0,U.jsx)(we,{value:e.value,onChange:e.onChange,labels:e.labels,disabled:n}):null,t[19]=n,t[20]=e.kind,t[21]=e.labels,t[22]=e.onChange,t[23]=e.value,t[24]=d):d=t[24];let f;t[25]===i?f=t[26]:(f=i?(0,U.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:i}):null,t[25]=i,t[26]=f);let p;return t[27]!==o||t[28]!==s||t[29]!==c||t[30]!==u||t[31]!==d||t[32]!==f?(p=(0,U.jsxs)(`div`,{className:o,children:[s,c,u,d,f]}),t[27]=o,t[28]=s,t[29]=c,t[30]=u,t[31]=d,t[32]=f,t[33]=p):p=t[33],p}function Te(){return l(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,D,`dark:border-edge`)}function Ee(){return l(b,k)}var De=[`schedule`,`delivery`,`prompt`,`document`],Oe={schedule:T,delivery:c,prompt:C,document:x};function ke(e){return e&&De.includes(e)?e:`schedule`}function Ae(e,t){return t===`schedule`?e.tabSchedule:t===`delivery`?e.tabDelivery:t===`prompt`?e.tabPrompt:e.tabDocument}function je(e,t){return t===`schedule`?e.scheduleTabHint:t===`delivery`?e.deliveryTabHint:t===`prompt`?e.promptTabHint:e.documentTabHint}function Me(e,t){switch(t.type){case`reset`:return{form:null,baseline:null};case`sync`:{let e=structuredClone(t.value);return{form:e,baseline:structuredClone(e)}}case`patch`:return{...e,form:e.form?{...e.form,...t.patch}:null};case`saved`:{let n=structuredClone(t.value);return{form:e.form&&JSON.stringify(e.form)!==JSON.stringify(t.value)?e.form:n,baseline:structuredClone(n)}}}}function Ne(e,t){switch(t.type){case`reset`:return{doc:``,baseline:``};case`sync`:return{doc:t.value,baseline:t.value};case`set`:return{...e,doc:t.value};case`saved`:return{doc:e.doc===t.value?t.value:e.doc,baseline:t.value}}}function Pe(e){if(!e||typeof e!=`object`||Array.isArray(e))return``;let t=e.agents;if(!t||typeof t!=`object`||Array.isArray(t))return``;let n=t;if(!Array.isArray(n.list))return``;let r=typeof n.default==`string`?n.default:``,i=n.list.find(e=>!e||typeof e!=`object`||Array.isArray(e)?!1:r?e.id===r:!0)??n.list[0];if(!i||typeof i!=`object`||Array.isArray(i))return``;let a=i.workspace;if(!a||typeof a!=`object`||Array.isArray(a))return``;let o=a.root;return typeof o==`string`?o:``}var Fe={triggerLoading:!1,triggerOk:!1,triggerError:null};function Ie(){let e=f(e=>e.language),t=m(e),n=t.heartbeatSettings,r=!!d(e=>e.sessionKey),[a,o]=i(),c=ke(a.get(`tab`)),u=(0,R.useCallback)(e=>{o(t=>{let n=new URLSearchParams(t);return e===`schedule`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},[o]),[p,g]=(0,R.useReducer)(Me,{form:null,baseline:null}),v=p.form,b=p.baseline,[x,C]=(0,R.useReducer)(Ne,{doc:``,baseline:``}),w=x.doc,T=x.baseline,[D,O]=(0,R.useReducer)(A,Fe),{triggerLoading:k,triggerOk:te,triggerError:ae}=D,N=(0,R.useRef)(!1),P=(0,R.useRef)(!1),F=(0,R.useRef)(v),ue=(0,R.useRef)(w);F.current=v,ue.current=w;let{data:I,error:L,isLoading:de,mutate:z}=y(r),{data:V,error:H,isLoading:W,mutate:G}=h(r?B():null,fe,{revalidateOnFocus:!1}),{data:_e=[]}=h(r?le():null,ce,{revalidateOnFocus:!1}),ve=(0,R.useMemo)(()=>Pe(I?.payload?.config),[I]),K=(0,R.useMemo)(()=>pe(I?.payload?.config??{}),[I]),q=(0,R.useMemo)(()=>!v||!b?!1:JSON.stringify(v)!==JSON.stringify(b),[v,b]),J=w!==T;(0,R.useEffect)(()=>{if(!r){g({type:`reset`}),N.current=!1;return}I!==void 0&&(N.current||g({type:`sync`,value:K}))},[r,I,K]),(0,R.useEffect)(()=>{if(!r){C({type:`reset`}),P.current=!1;return}V!==void 0&&(P.current||C({type:`sync`,value:V}))},[r,V]);let ye=L instanceof Error?L.message:L?String(L):H instanceof Error?H.message:H?String(H):null,Y=!!(r&&(I===void 0||V===void 0)&&!ye&&(de||W)),X=v?.target.trim()??``,{data:be,setData:xe}=E(()=>se(X),[r,X],{enabled:r&&X.length>0,initial:[],errorData:[]}),Se=(0,R.useCallback)(()=>{X&&se(X).then(xe)},[X,xe]),Ce=(0,R.useCallback)(async()=>{O({type:`patch`,patch:{triggerLoading:!0,triggerOk:!1,triggerError:null}});try{await ge(),O({type:`patch`,patch:{triggerOk:!0}}),window.setTimeout(()=>O({type:`patch`,patch:{triggerOk:!1}}),3e3)}catch(e){O({type:`patch`,patch:{triggerError:e instanceof Error?e.message:n.triggerError}})}finally{O({type:`patch`,patch:{triggerLoading:!1}})}},[n.triggerError]),Z=(0,R.useCallback)(e=>{N.current=!0,g({type:`patch`,patch:e})},[]),we=q||J,Q=ie({value:(0,R.useMemo)(()=>v?{form:v,doc:w,saveConfig:q,saveDoc:J}:null,[q,J,w,v]),dirty:we,onSave:(0,R.useCallback)(async e=>{try{e.saveConfig&&(await me(e.form),g({type:`saved`,value:e.form}),N.current=!!(F.current&&JSON.stringify(F.current)!==JSON.stringify(e.form))),e.saveDoc&&(await he(e.doc),C({type:`saved`,value:e.doc}),P.current=ue.current!==e.doc)}catch(t){throw Error(t instanceof Error?t.message:e.saveConfig?n.saveConfigError:n.saveDocError)}},[n.saveConfigError,n.saveDocError]),delayMs:J?900:500});return r?Y?(0,U.jsx)(M,{gap:`gap-6`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:(0,U.jsx)(ne,{sections:3})}):v?(0,U.jsxs)(M,{"aria-busy":Q.status===`saving`,"data-has-baseline":b?`1`:`0`,onBlurCapture:Q.onBlurCapture,children:[(0,U.jsx)(ee,{title:t.settingsSections.heartbeat,docsLink:j(e,`heartbeat`),docsLabel:n.docsLink,actions:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(re,{status:Q.status,error:Q.error}),(0,U.jsxs)(_,{type:`button`,variant:`secondary`,className:`inline-flex items-center gap-2`,disabled:k,onClick:()=>void Ce(),children:[k?(0,U.jsx)(s,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,U.jsx)(S,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),k?n.triggering:n.triggerNow]}),te?(0,U.jsx)(`span`,{className:`text-sm text-fg-muted`,children:n.triggered}):null]})}),(0,U.jsx)(oe,{children:ve?(0,U.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[n.workspaceLabel,`: `,(0,U.jsx)(`span`,{className:`font-mono text-fg-muted`,children:ve})]}):null}),Q.error?(0,U.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:Q.error}):null,ae?(0,U.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:ae}):null,(0,U.jsx)(Le,{h:n,activeTab:c,onChange:u}),(0,U.jsx)($,{h:n,id:`schedule`,activeTab:c,children:(0,U.jsx)(Re,{h:n,form:v,update:Z})}),(0,U.jsx)($,{h:n,id:`delivery`,activeTab:c,children:(0,U.jsx)(ze,{h:n,cron:t.cron,form:v,channels:_e,sessionChatIds:be,onRefreshChatIds:Se,update:Z,inputClassName:Te,selectClassName:Ee})}),(0,U.jsx)($,{h:n,id:`prompt`,activeTab:c,children:(0,U.jsx)(He,{h:n,form:v,update:Z,inputClassName:Te})}),(0,U.jsxs)($,{h:n,id:`document`,activeTab:c,children:[(0,U.jsx)(`p`,{className:`mb-3 text-xs text-fg-subtle`,children:n.docHint}),(0,U.jsx)(`textarea`,{className:l(Te(),`min-h-72 resize-y font-mono text-xs leading-relaxed`),value:w,onChange:e=>{P.current=!0,C({type:`set`,value:e.target.value})},spellCheck:!1,"aria-label":n.docSection,"data-doc-in-sync":w===T?`true`:`false`})]})]}):(0,U.jsxs)(M,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:[(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:ye??n.loadError}),(0,U.jsx)(_,{type:`button`,variant:`secondary`,onClick:()=>{z(),G()},children:n.retry})]}):(0,U.jsxs)(M,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:[(0,U.jsx)(ee,{title:t.settingsSections.heartbeat}),(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})]})}function Le(e){let t=(0,z.c)(7),{h:n,activeTab:r,onChange:i}=e,a;t[0]===n?a=t[1]:(a=De.map(e=>({id:e,label:Ae(n,e),icon:Oe[e]})),t[0]=n,t[1]=a);let o=a,s;return t[2]!==r||t[3]!==n.tabsAriaLabel||t[4]!==o||t[5]!==i?(s=(0,U.jsx)(ae,{items:o,activeTab:r,onChange:i,ariaLabel:n.tabsAriaLabel,tabIdPrefix:`heartbeat-settings-tab`,panelIdPrefix:`heartbeat-settings-panel`}),t[2]=r,t[3]=n.tabsAriaLabel,t[4]=o,t[5]=i,t[6]=s):s=t[6],s}function $(e){let t=(0,z.c)(14),{h:n,id:r,activeTab:i,children:a}=e,o;t[0]!==n||t[1]!==r?(o=Ae(n,r),t[0]=n,t[1]=r,t[2]=o):o=t[2];let s;t[3]!==n||t[4]!==r?(s=je(n,r),t[3]=n,t[4]=r,t[5]=s):s=t[5];let c;t[6]===a?c=t[7]:(c=(0,U.jsx)(`div`,{className:`space-y-4`,children:a}),t[6]=a,t[7]=c);let l;return t[8]!==i||t[9]!==r||t[10]!==o||t[11]!==s||t[12]!==c?(l=(0,U.jsx)(te,{id:r,activeTab:i,tabIdPrefix:`heartbeat-settings-tab`,panelIdPrefix:`heartbeat-settings-panel`,title:o,hint:s,children:c}),t[8]=i,t[9]=r,t[10]=o,t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function Re(e){let t=(0,z.c)(37),{h:n,form:r,update:i}=e,a;t[0]===i?a=t[1]:(a=e=>i({enabled:e.target.checked}),t[0]=i,t[1]=a);let o;t[2]!==r.enabled||t[3]!==a?(o=(0,U.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.enabled,onChange:a}),t[2]=r.enabled,t[3]=a,t[4]=o):o=t[4];let s;t[5]!==n.enable||t[6]!==o?(s=(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[o,n.enable]}),t[5]=n.enable,t[6]=o,t[7]=s):s=t[7];let c;t[8]===i?c=t[9]:(c=e=>i({intervalMs:e}),t[8]=i,t[9]=c);let l;t[10]!==n.intervalPresets||t[11]!==n.intervalSecondsLabel?(l={secondsLabel:n.intervalSecondsLabel,presets:n.intervalPresets},t[10]=n.intervalPresets,t[11]=n.intervalSecondsLabel,t[12]=l):l=t[12];let u=`${n.intervalHintPreset} ${n.intervalHint}`,d;t[13]!==r.intervalMs||t[14]!==n.interval||t[15]!==c||t[16]!==l||t[17]!==u?(d=(0,U.jsx)(Q,{kind:`interval`,label:n.interval,valueMs:r.intervalMs,onChangeMs:c,labels:l,hint:u}),t[13]=r.intervalMs,t[14]=n.interval,t[15]=c,t[16]=l,t[17]=u,t[18]=d):d=t[18];let f;t[19]===i?f=t[20]:(f=e=>i({activeHours:e}),t[19]=i,t[20]=f);let p;t[21]!==n.activeEnd||t[22]!==n.activeStart||t[23]!==n.activeTimezone||t[24]!==n.addActiveHours||t[25]!==n.clearActiveHours?(p={start:n.activeStart,end:n.activeEnd,timezone:n.activeTimezone,add:n.addActiveHours,clear:n.clearActiveHours},t[21]=n.activeEnd,t[22]=n.activeStart,t[23]=n.activeTimezone,t[24]=n.addActiveHours,t[25]=n.clearActiveHours,t[26]=p):p=t[26];let m;t[27]!==r.activeHours||t[28]!==n.activeHoursHint||t[29]!==n.activeHoursTitle||t[30]!==f||t[31]!==p?(m=(0,U.jsx)(Q,{kind:`active-hours`,label:n.activeHoursTitle,value:r.activeHours,onChange:f,labels:p,hint:n.activeHoursHint}),t[27]=r.activeHours,t[28]=n.activeHoursHint,t[29]=n.activeHoursTitle,t[30]=f,t[31]=p,t[32]=m):m=t[32];let h;return t[33]!==m||t[34]!==s||t[35]!==d?(h=(0,U.jsxs)(U.Fragment,{children:[s,d,m]}),t[33]=m,t[34]=s,t[35]=d,t[36]=h):h=t[36],h}function ze(e){let t=(0,z.c)(51),{h:n,cron:r,form:i,channels:s,sessionChatIds:c,onRefreshChatIds:u,update:d,inputClassName:f,selectClassName:p}=e,m;t[0]===s?m=t[1]:(m=new Set(s.map(Ve)),t[0]=s,t[1]=m);let h=m,g;t[2]===i.target?g=t[3]:(g=i.target.trim(),t[2]=i.target,t[3]=g);let v=g,y=!!(v&&!h.has(v)),b;t[4]===n.deliveryHint?b=t[5]:(b=(0,U.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.deliveryHint}),t[4]=n.deliveryHint,t[5]=b);let x;t[6]===r.channel?x=t[7]:(x=(0,U.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r.channel}),t[6]=r.channel,t[7]=x);let S;t[8]===p?S=t[9]:(S=p(),t[8]=p,t[9]=S);let C;t[10]===d?C=t[11]:(C=e=>{d({target:e.target.value.trim(),targetChatId:``})},t[10]=d,t[11]=C);let w;t[12]===n.channelNone?w=t[13]:(w=(0,U.jsx)(o,{value:``,children:n.channelNone}),t[12]=n.channelNone,t[13]=w);let T;t[14]!==n.customChannelSuffix||t[15]!==y||t[16]!==v?(T=y?(0,U.jsxs)(o,{value:v,children:[v,` (`,n.customChannelSuffix,`)`]}):null,t[14]=n.customChannelSuffix,t[15]=y,t[16]=v,t[17]=T):T=t[17];let E;t[18]===s?E=t[19]:(E=s.map(Be),t[18]=s,t[19]=E);let D;t[20]!==S||t[21]!==C||t[22]!==w||t[23]!==T||t[24]!==E||t[25]!==v?(D=(0,U.jsxs)(a,{className:S,value:v,onChange:C,children:[w,T,E]}),t[20]=S,t[21]=C,t[22]=w,t[23]=T,t[24]=E,t[25]=v,t[26]=D):D=t[26];let k;t[27]!==D||t[28]!==x?(k=(0,U.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[x,D]}),t[27]=D,t[28]=x,t[29]=k):k=t[29];let A;t[30]!==r.enterManuallyOrSelect||t[31]!==r.lastActiveLabels||t[32]!==r.noRecentChats||t[33]!==r.noRecentChatsOption||t[34]!==r.recipient||t[35]!==r.recipientPlaceholder||t[36]!==r.refreshList||t[37]!==r.refreshRecipientHint||t[38]!==r.selectRecipient||t[39]!==i.targetChatId||t[40]!==f||t[41]!==u||t[42]!==p||t[43]!==c||t[44]!==v||t[45]!==d?(A=v?(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r.recipient}),(0,U.jsxs)(_,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,title:r.refreshRecipientHint,onClick:u,children:[(0,U.jsx)(O,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),r.refreshList]})]}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(`input`,{type:`text`,className:l(f(),`min-w-0 flex-1`),value:i.targetChatId,onChange:e=>d({targetChatId:e.target.value}),placeholder:r.recipientPlaceholder,autoComplete:`off`}),(0,U.jsxs)(a,{className:l(p(),`max-w-40 shrink-0 text-xs`),value:i.targetChatId,onChange:e=>{let t=e.target.value;t&&d({targetChatId:t})},children:[(0,U.jsx)(o,{value:``,children:r.selectRecipient}),c.length>0?c.map(e=>(0,U.jsx)(o,{value:e.chatId,children:N(e,r.lastActiveLabels)},`${e.channel}-${e.chatId}`)):(0,U.jsx)(o,{value:``,disabled:!0,children:r.noRecentChatsOption})]})]}),(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:c.length>0?r.enterManuallyOrSelect:r.noRecentChats})]}):null,t[30]=r.enterManuallyOrSelect,t[31]=r.lastActiveLabels,t[32]=r.noRecentChats,t[33]=r.noRecentChatsOption,t[34]=r.recipient,t[35]=r.recipientPlaceholder,t[36]=r.refreshList,t[37]=r.refreshRecipientHint,t[38]=r.selectRecipient,t[39]=i.targetChatId,t[40]=f,t[41]=u,t[42]=p,t[43]=c,t[44]=v,t[45]=d,t[46]=A):A=t[46];let j;return t[47]!==k||t[48]!==A||t[49]!==b?(j=(0,U.jsxs)(U.Fragment,{children:[b,k,A]}),t[47]=k,t[48]=A,t[49]=b,t[50]=j):j=t[50],j}function Be(e){return(0,U.jsxs)(o,{value:e.name,disabled:!e.enabled,children:[e.name,` `,e.enabled?``:`(disabled)`]},e.name)}function Ve(e){return e.name}function He(e){let t=(0,z.c)(65),{h:n,form:r,update:i,inputClassName:a}=e,o;t[0]===i?o=t[1]:(o=e=>i({includeSystemPromptSection:e.target.checked}),t[0]=i,t[1]=o);let s;t[2]!==r.includeSystemPromptSection||t[3]!==o?(s=(0,U.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:r.includeSystemPromptSection,onChange:o}),t[2]=r.includeSystemPromptSection,t[3]=o,t[4]=s):s=t[4];let c;t[5]===n.includeSystemPromptSectionHint?c=t[6]:(c=(0,U.jsx)(`span`,{className:`mt-1 block text-xs text-fg-subtle`,children:n.includeSystemPromptSectionHint}),t[5]=n.includeSystemPromptSectionHint,t[6]=c);let u;t[7]!==n.includeSystemPromptSection||t[8]!==c?(u=(0,U.jsxs)(`span`,{children:[n.includeSystemPromptSection,c]}),t[7]=n.includeSystemPromptSection,t[8]=c,t[9]=u):u=t[9];let d;t[10]!==s||t[11]!==u?(d=(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[s,u]}),t[10]=s,t[11]=u,t[12]=d):d=t[12];let f;t[13]===n.prompt?f=t[14]:(f=(0,U.jsx)(`div`,{className:`mb-1 text-sm font-medium text-fg`,children:n.prompt}),t[13]=n.prompt,t[14]=f);let p;t[15]===a?p=t[16]:(p=l(a(),`min-h-36 resize-y font-mono text-xs`),t[15]=a,t[16]=p);let m;t[17]===i?m=t[18]:(m=e=>i({prompt:e.target.value}),t[17]=i,t[18]=m);let h;t[19]!==r.prompt||t[20]!==n.promptPlaceholder||t[21]!==p||t[22]!==m?(h=(0,U.jsx)(`textarea`,{className:p,value:r.prompt,onChange:m,placeholder:n.promptPlaceholder}),t[19]=r.prompt,t[20]=n.promptPlaceholder,t[21]=p,t[22]=m,t[23]=h):h=t[23];let g;t[24]===n.promptHint?g=t[25]:(g=(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:n.promptHint}),t[24]=n.promptHint,t[25]=g);let _;t[26]!==g||t[27]!==f||t[28]!==h?(_=(0,U.jsxs)(`div`,{children:[f,h,g]}),t[26]=g,t[27]=f,t[28]=h,t[29]=_):_=t[29];let v;t[30]===n.ackMaxChars?v=t[31]:(v=(0,U.jsx)(`div`,{className:`mb-1 text-sm font-medium text-fg`,children:n.ackMaxChars}),t[30]=n.ackMaxChars,t[31]=v);let y;t[32]===a?y=t[33]:(y=a(),t[32]=a,t[33]=y);let b=r.ackMaxChars===``?``:r.ackMaxChars,x;t[34]===i?x=t[35]:(x=e=>{let t=e.target.value;if(t===``){i({ackMaxChars:``});return}let n=parseInt(t,10);i({ackMaxChars:Number.isFinite(n)?n:``})},t[34]=i,t[35]=x);let S;t[36]!==n.ackDefaultPlaceholder||t[37]!==y||t[38]!==b||t[39]!==x?(S=(0,U.jsx)(`input`,{type:`number`,min:1,className:y,value:b,onChange:x,placeholder:n.ackDefaultPlaceholder}),t[36]=n.ackDefaultPlaceholder,t[37]=y,t[38]=b,t[39]=x,t[40]=S):S=t[40];let C;t[41]===n.ackMaxCharsHint?C=t[42]:(C=(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:n.ackMaxCharsHint}),t[41]=n.ackMaxCharsHint,t[42]=C);let w;t[43]!==v||t[44]!==S||t[45]!==C?(w=(0,U.jsxs)(`div`,{children:[v,S,C]}),t[43]=v,t[44]=S,t[45]=C,t[46]=w):w=t[46];let T;t[47]===i?T=t[48]:(T=e=>i({isolatedSession:e.target.checked}),t[47]=i,t[48]=T);let E;t[49]!==r.isolatedSession||t[50]!==T?(E=(0,U.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:r.isolatedSession,onChange:T}),t[49]=r.isolatedSession,t[50]=T,t[51]=E):E=t[51];let D;t[52]===n.isolatedSessionHint?D=t[53]:(D=(0,U.jsx)(`span`,{className:`mt-1 block text-xs text-fg-subtle`,children:n.isolatedSessionHint}),t[52]=n.isolatedSessionHint,t[53]=D);let O;t[54]!==n.isolatedSession||t[55]!==D?(O=(0,U.jsxs)(`span`,{children:[n.isolatedSession,D]}),t[54]=n.isolatedSession,t[55]=D,t[56]=O):O=t[56];let k;t[57]!==E||t[58]!==O?(k=(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[E,O]}),t[57]=E,t[58]=O,t[59]=k):k=t[59];let A;return t[60]!==_||t[61]!==w||t[62]!==k||t[63]!==d?(A=(0,U.jsxs)(U.Fragment,{children:[d,_,w,k]}),t[60]=_,t[61]=w,t[62]=k,t[63]=d,t[64]=A):A=t[64],A}export{Ie as HeartbeatSettingsPanel};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{h as i}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{n as a,r as o}from"./popover-select-DGmMQt4t.js";import{t as s}from"./loader-circle-CifKLtgG.js";import{t as c}from"./message-square-fVE7Ghj1.js";import{t as l}from"./cn-JdwAhgNB.js";import{a as u,c as d,n as f,r as p}from"./locale-store-1urrBBCQ.js";import{t as m}from"./messages-DYFcjtmG.js";import{i as h,o as g}from"./vendor-swr-BIWyz7Rc.js";import{t as _}from"./button-BA45yciM.js";import{n as v,r as y}from"./gateway-config-swr-Cpmyrr6j.js";import{Ao as b,Gl as x,Lc as S,Ml as C,Oo as w,cu as T,ho as E,jo as D,kc as O,ko as k,na as A,yo as j}from"./index-CHgOG1aR.js";import{n as ee,r as M,t as te}from"./settings-page-layout-DYelDcMV.js";import{n as ne}from"./settings-loading-skeleton-CAmWMaOT.js";import{n as re,t as ie}from"./use-autosave-CkVlrFk1.js";import{t as ae}from"./page-tabs-agH3a2PI.js";import{t as oe}from"./settings-advanced-gate-DyfBpqkY.js";import{i as se,n as ce,r as N,t as le}from"./channels-status-swr-DMYQNs-J.js";import{n as P,o as F,t as ue}from"./cron-expression-CjrWuy2m.js";import{t as I}from"./date-picker-CkDROZoe.js";import{n as L,t as de}from"./tab-completion-input-D64VNmiA.js";var R=e(t(),1),z=n();function B(){return p(`/api/workspace/heartbeat-md`)}async function fe(){let e=await u(B());return typeof e.payload?.content==`string`?e.payload.content:``}function V(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function pe(e){let t=V(e)?e:{},n=V(t.gateway)?t.gateway:{},r=V(n.heartbeat)?n.heartbeat:{},i=r.activeHours,a=V(i)?i:null,o=a&&typeof a.start==`string`&&typeof a.end==`string`&&a.start&&a.end?{start:a.start,end:a.end,timezone:typeof a.timezone==`string`?a.timezone:``}:null;return{enabled:!!(r.enabled??!0),intervalMs:typeof r.intervalMs==`number`&&Number.isFinite(r.intervalMs)?r.intervalMs:18e5,includeSystemPromptSection:r.includeSystemPromptSection===!0,target:typeof r.target==`string`?r.target:``,targetChatId:typeof r.targetChatId==`string`?r.targetChatId:``,prompt:typeof r.prompt==`string`?r.prompt:``,ackMaxChars:typeof r.ackMaxChars==`number`&&Number.isFinite(r.ackMaxChars)?r.ackMaxChars:``,isolatedSession:!!r.isolatedSession,activeHours:o}}function H(e){let t={enabled:e.enabled,intervalMs:e.intervalMs,includeSystemPromptSection:e.includeSystemPromptSection};return e.target.trim()?t.target=e.target.trim():t.target=null,e.targetChatId.trim()?t.targetChatId=e.targetChatId.trim():t.targetChatId=null,e.prompt.trim()?t.prompt=e.prompt.trim():t.prompt=null,e.ackMaxChars===``||e.ackMaxChars===void 0?t.ackMaxChars=null:t.ackMaxChars=e.ackMaxChars,e.isolatedSession?t.isolatedSession=!0:t.isolatedSession=null,e.activeHours?.start?.trim()&&e.activeHours?.end?.trim()?t.activeHours={start:e.activeHours.start.trim(),end:e.activeHours.end.trim(),...e.activeHours.timezone.trim()?{timezone:e.activeHours.timezone.trim()}:{}}:t.activeHours=null,t}async function me(e){await u(p(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{heartbeat:H(e)}})}),v()}async function he(e){await u(p(`/api/workspace/heartbeat-md`),{method:`PUT`,body:JSON.stringify({content:e})}),g(B())}async function ge(e){await u(p(`/api/heartbeat/trigger`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?{reason:e}:{})})}var U=r(),W=Array.from({length:60},(e,t)=>t),G=l(b,`min-w-0 shrink text-xs sm:min-w-[7rem] sm:max-w-[11rem]`),_e=l(`h-9 w-14 shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1.5 text-center text-sm tabular-nums text-fg`,w),ve=l(`min-h-[2.5rem] w-full rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 font-mono text-xs text-fg`,w);function K(e){return{...e,intervalMinutesDraft:null,intervalHoursDraft:null}}function q(e){let{intervalMinutesDraft:t,intervalHoursDraft:n,...r}=e;return r}function J(e,t){switch(t.type){case`reset`:return K(t.state);case`replace`:return t.state}}function ye({value:e,onChange:t,labels:n,disabled:r,showHeading:i=!0}){let s=(0,R.useMemo)(()=>P(e),[e]),[c,u]=(0,R.useReducer)(J,s,K),d=(0,R.useRef)(e);d.current!==e&&(d.current=e,u({type:`reset`,state:s}));let f=(0,R.useCallback)(e=>{let n={...c,...e};u({type:`replace`,state:n});let r=q(n),i=q(c);Object.keys(r).some(e=>r[e]!==i[e])&&t(ue(r))},[t,c]),{mode:p,intervalKind:m,onceDate:h,intervalMinutes:g,intervalHours:_,minute:v,hour:y,weekDays:b,dayOfMonth:x,rawCron:S,intervalMinutesDraft:C,intervalHoursDraft:w}=c,T=`${String(y).padStart(2,`0`)}:${String(v).padStart(2,`0`)}`,E=e=>{if(!e)return;let[t,n]=e.split(`:`).map(e=>parseInt(e,10));Number.isNaN(t)||Number.isNaN(n)||f({minute:n,hour:t})},D=(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-nowrap items-center gap-2 overflow-x-auto pb-0.5`,children:[(0,U.jsxs)(a,{className:G,disabled:r,value:p,onChange:e=>{let t=e.target.value;f({mode:t})},"aria-label":n.scheduleTimeLabel,children:[(0,U.jsx)(o,{value:`no_repeat`,children:n.modeNoRepeat}),(0,U.jsx)(o,{value:`interval`,children:n.modeInterval}),(0,U.jsx)(o,{value:`hourly`,children:n.modeHourly}),(0,U.jsx)(o,{value:`daily`,children:n.modeDaily}),(0,U.jsx)(o,{value:`weekly`,children:n.modeWeekly}),(0,U.jsx)(o,{value:`monthly`,children:n.modeMonthly}),(0,U.jsx)(o,{value:`custom`,children:n.modeCustom})]}),p===`no_repeat`&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(I,{disabled:r,className:`h-9 min-w-[9.5rem] shrink-0 bg-surface-panel px-2`,value:h,onChange:e=>f({onceDate:e}),ariaLabel:n.modeNoRepeat}),(0,U.jsx)(F,{disabled:r,className:`min-w-[6.5rem] shrink-0`,triggerClassName:`h-9 border-edge-subtle px-2`,value:T,onChange:E,ariaLabel:n.scheduleTimeLabel})]}),p===`interval`&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(a,{className:l(G,`w-auto min-w-[5rem]`),disabled:r,value:m,onChange:e=>{let t=e.target.value;f({intervalKind:t,intervalMinutesDraft:null,intervalHoursDraft:null})},"aria-label":n.modeInterval,children:[(0,U.jsx)(o,{value:`minutes`,children:n.intervalKindMinutes}),(0,U.jsx)(o,{value:`hours`,children:n.intervalKindHours})]}),m===`minutes`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`input`,{type:`number`,min:1,max:59,disabled:r,className:_e,value:C??String(g),onChange:e=>{let t=e.target.value,n=parseInt(t,10),r={intervalMinutesDraft:t};Number.isFinite(n)&&n>=1&&n<=59&&(r.intervalMinutes=n),f(r)},onBlur:()=>{if(C===null)return;let e=parseInt(C,10);f({intervalMinutes:!Number.isFinite(e)||e<1?5:Math.min(59,Math.max(1,Math.round(e))),intervalMinutesDraft:null})},"aria-label":n.intervalMinutes}),(0,U.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`input`,{type:`number`,min:1,max:23,disabled:r,className:_e,value:w??String(_),onChange:e=>{let t=e.target.value,n=parseInt(t,10),r={intervalHoursDraft:t};Number.isFinite(n)&&n>=1&&n<=23&&(r.intervalHours=n),f(r)},onBlur:()=>{if(w===null)return;let e=parseInt(w,10);f({intervalHours:!Number.isFinite(e)||e<1?2:Math.min(23,Math.max(1,Math.round(e))),intervalHoursDraft:null})},"aria-label":n.intervalHours}),(0,U.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.hourUnit}),(0,U.jsx)(a,{className:l(G,`w-auto min-w-[4rem]`),disabled:r,value:v,onChange:e=>{f({minute:parseInt(e.target.value,10)})},"aria-label":n.minuteAtHour,children:W.map(e=>(0,U.jsx)(o,{value:e,children:String(e).padStart(2,`0`)},e))}),(0,U.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]})]}),p===`daily`&&(0,U.jsx)(F,{disabled:r,className:`min-w-[6.5rem] shrink-0`,triggerClassName:`h-9 border-edge-subtle px-2`,value:T,onChange:E,ariaLabel:n.scheduleTimeLabel}),p===`weekly`&&(0,U.jsx)(F,{disabled:r,className:`min-w-[6.5rem] shrink-0`,triggerClassName:`h-9 border-edge-subtle px-2`,value:T,onChange:E,ariaLabel:n.scheduleTimeLabel}),p===`monthly`&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(a,{className:l(G,`w-auto min-w-[4.5rem]`),disabled:r,value:x,onChange:e=>{f({dayOfMonth:parseInt(e.target.value,10)})},"aria-label":n.dayOfMonth,children:Array.from({length:31},(e,t)=>t+1).map(e=>(0,U.jsx)(o,{value:e,children:e},e))}),(0,U.jsx)(F,{disabled:r,className:`min-w-[6.5rem] shrink-0`,triggerClassName:`h-9 border-edge-subtle px-2`,value:T,onChange:E,ariaLabel:n.scheduleTimeLabel})]}),p===`hourly`&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(a,{className:l(G,`w-auto min-w-[4rem]`),disabled:r,value:v,onChange:e=>{f({minute:parseInt(e.target.value,10)})},"aria-label":n.minuteAtHour,children:W.map(e=>(0,U.jsx)(o,{value:e,children:String(e).padStart(2,`0`)},e))}),(0,U.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]})]}),O=p===`weekly`?(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1.5 pt-1`,role:`group`,"aria-label":n.modeWeekly,children:n.weekdays.map((e,t)=>{let n=b[t];return(0,U.jsx)(`button`,{type:`button`,disabled:r,className:l(`flex size-9 select-none items-center justify-center rounded-full border text-xs font-medium transition-colors`,n?`border-fg bg-fg text-surface-panel`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),"aria-pressed":n,onClick:()=>{let e=[...b];e[t]=!e[t],f({weekDays:e})},children:e},e)})}):null,k=p===`custom`?(0,U.jsxs)(`div`,{className:`pt-1`,children:[(0,U.jsx)(L,{disabled:r,className:ve,rows:2,spellCheck:!1,value:S,suggestion:`*/5 * * * *`,onAcceptSuggestion:e=>f({rawCron:e}),placeholder:`*/5 * * * *`,onChange:e=>{f({rawCron:e.target.value})},"aria-label":n.modeCustom}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.customCronHint})]}):null;return(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[i?(0,U.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.scheduleTimeLabel}):null,D,O,k]})}var Y=[3e4,6e4,3e5,6e5,9e5,18e5,36e5,72e5];new Set(Y);var X=l(`h-9 min-w-0 flex-1 rounded-lg border border-edge-subtle bg-surface-panel px-2.5 py-1.5 text-sm tabular-nums text-fg`,w),be=l(b,`h-9 max-w-[11rem] shrink-0 text-xs sm:max-w-[12rem]`);function xe(e,t){switch(e){case 3e4:return t.every30s;case 6e4:return t.every1min;case 3e5:return t.every5min;case 6e5:return t.every10min;case 9e5:return t.every15min;case 18e5:return t.every30min;case 36e5:return t.every1h;case 72e5:return t.every2h;default:return String(e)}}function Se({valueMs:e,onChangeMs:t,labels:n,disabled:r,presets:i=Y,minSeconds:s=1}){let c=(0,R.useMemo)(()=>new Set(i),[i]),l=(0,R.useMemo)(()=>c.has(e)?String(e):``,[c,e]),[u,d]=(0,R.useState)(null),f=(0,R.useRef)(e);f.current!==e&&(f.current=e,d(null));let p=Math.max(s,Math.round(e/1e3)),m=u===null?String(p):u;return(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.secondsLabel}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(`input`,{type:`number`,min:s,step:1,disabled:r,className:X,value:m,onChange:e=>{let n=e.target.value;d(n);let r=parseInt(n,10);Number.isFinite(r)&&r>=s&&t(r*1e3)},onBlur:()=>{if(u===null)return;let e=parseInt(u,10);t(!Number.isFinite(e)||e<s?s*1e3:e*1e3),d(null)}}),(0,U.jsxs)(a,{className:be,disabled:r,value:l,onChange:e=>{let n=e.target.value;n&&(t(parseInt(n,10)),d(null))},children:[(0,U.jsx)(o,{value:``,children:n.presets.custom}),i.map(e=>(0,U.jsx)(o,{value:String(e),children:xe(e,n.presets)},e))]})]})]})}var Ce=l(`mt-1 w-full rounded-lg border border-edge-subtle bg-surface-panel px-2.5 py-1.5 text-sm text-fg`,w),Z=()=>({start:`09:00`,end:`22:00`,timezone:``});function we(e){let t=(0,z.c)(61),{value:n,onChange:r,labels:i,disabled:a}=e;if(!n){let e;t[0]===r?e=t[1]:(e=()=>r(Z()),t[0]=r,t[1]=e);let n;return t[2]!==a||t[3]!==i.add||t[4]!==e?(n=(0,U.jsx)(_,{type:`button`,variant:`secondary`,className:`text-sm`,disabled:a,onClick:e,children:i.add}),t[2]=a,t[3]=i.add,t[4]=e,t[5]=n):n=t[5],n}let o;t[6]===i.start?o=t[7]:(o=(0,U.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:i.start}),t[6]=i.start,t[7]=o);let s;t[8]!==r||t[9]!==n?(s=e=>r({...n,start:e}),t[8]=r,t[9]=n,t[10]=s):s=t[10];let c;t[11]!==a||t[12]!==i.start||t[13]!==s||t[14]!==n.start?(c=(0,U.jsx)(F,{disabled:a,className:`mt-1 w-full`,triggerClassName:`h-9 border-edge-subtle px-2.5`,value:n.start,onChange:s,ariaLabel:i.start}),t[11]=a,t[12]=i.start,t[13]=s,t[14]=n.start,t[15]=c):c=t[15];let l;t[16]!==o||t[17]!==c?(l=(0,U.jsxs)(`label`,{className:`block min-w-0`,children:[o,c]}),t[16]=o,t[17]=c,t[18]=l):l=t[18];let u;t[19]===i.end?u=t[20]:(u=(0,U.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:i.end}),t[19]=i.end,t[20]=u);let d;t[21]!==r||t[22]!==n?(d=e=>r({...n,end:e}),t[21]=r,t[22]=n,t[23]=d):d=t[23];let f;t[24]!==a||t[25]!==i.end||t[26]!==d||t[27]!==n.end?(f=(0,U.jsx)(F,{disabled:a,className:`mt-1 w-full`,triggerClassName:`h-9 border-edge-subtle px-2.5`,value:n.end,onChange:d,ariaLabel:i.end}),t[24]=a,t[25]=i.end,t[26]=d,t[27]=n.end,t[28]=f):f=t[28];let p;t[29]!==u||t[30]!==f?(p=(0,U.jsxs)(`label`,{className:`block min-w-0`,children:[u,f]}),t[29]=u,t[30]=f,t[31]=p):p=t[31];let m;t[32]===i.timezone?m=t[33]:(m=(0,U.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:i.timezone}),t[32]=i.timezone,t[33]=m);let h;t[34]!==r||t[35]!==n?(h=e=>r({...n,timezone:e.target.value}),t[34]=r,t[35]=n,t[36]=h):h=t[36];let g;t[37]!==r||t[38]!==n?(g=e=>r({...n,timezone:e}),t[37]=r,t[38]=n,t[39]=g):g=t[39];let v;t[40]!==a||t[41]!==h||t[42]!==g||t[43]!==n.timezone?(v=(0,U.jsx)(de,{type:`text`,disabled:a,className:Ce,value:n.timezone,onChange:h,suggestion:`Asia/Shanghai`,onAcceptSuggestion:g,placeholder:`Asia/Shanghai`,autoComplete:`off`}),t[40]=a,t[41]=h,t[42]=g,t[43]=n.timezone,t[44]=v):v=t[44];let y;t[45]!==v||t[46]!==m?(y=(0,U.jsxs)(`label`,{className:`block min-w-0`,children:[m,v]}),t[45]=v,t[46]=m,t[47]=y):y=t[47];let b;t[48]!==y||t[49]!==l||t[50]!==p?(b=(0,U.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[l,p,y]}),t[48]=y,t[49]=l,t[50]=p,t[51]=b):b=t[51];let x;t[52]===r?x=t[53]:(x=()=>r(null),t[52]=r,t[53]=x);let S;t[54]!==a||t[55]!==i.clear||t[56]!==x?(S=(0,U.jsx)(_,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:a,onClick:x,children:i.clear}),t[54]=a,t[55]=i.clear,t[56]=x,t[57]=S):S=t[57];let C;return t[58]!==b||t[59]!==S?(C=(0,U.jsxs)(`div`,{className:`space-y-2`,children:[b,S]}),t[58]=b,t[59]=S,t[60]=C):C=t[60],C}function Q(e){let t=(0,z.c)(34),{disabled:n,label:r,hint:i,className:a}=e,o;t[0]===a?o=t[1]:(o=l(`flex flex-col gap-2`,a),t[0]=a,t[1]=o);let s;t[2]===r?s=t[3]:(s=r?(0,U.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r}):null,t[2]=r,t[3]=s);let c;t[4]!==n||t[5]!==r||t[6]!==e.kind||t[7]!==e.labels||t[8]!==e.onChange||t[9]!==e.value?(c=e.kind===`cron`?(0,U.jsx)(ye,{value:e.value,onChange:e.onChange,labels:e.labels,disabled:n,showHeading:!r}):null,t[4]=n,t[5]=r,t[6]=e.kind,t[7]=e.labels,t[8]=e.onChange,t[9]=e.value,t[10]=c):c=t[10];let u;t[11]!==n||t[12]!==e.kind||t[13]!==e.labels||t[14]!==e.minSeconds||t[15]!==e.onChangeMs||t[16]!==e.presets||t[17]!==e.valueMs?(u=e.kind===`interval`?(0,U.jsx)(Se,{valueMs:e.valueMs,onChangeMs:e.onChangeMs,labels:e.labels,disabled:n,presets:e.presets??Y,minSeconds:e.minSeconds}):null,t[11]=n,t[12]=e.kind,t[13]=e.labels,t[14]=e.minSeconds,t[15]=e.onChangeMs,t[16]=e.presets,t[17]=e.valueMs,t[18]=u):u=t[18];let d;t[19]!==n||t[20]!==e.kind||t[21]!==e.labels||t[22]!==e.onChange||t[23]!==e.value?(d=e.kind===`active-hours`?(0,U.jsx)(we,{value:e.value,onChange:e.onChange,labels:e.labels,disabled:n}):null,t[19]=n,t[20]=e.kind,t[21]=e.labels,t[22]=e.onChange,t[23]=e.value,t[24]=d):d=t[24];let f;t[25]===i?f=t[26]:(f=i?(0,U.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:i}):null,t[25]=i,t[26]=f);let p;return t[27]!==o||t[28]!==s||t[29]!==c||t[30]!==u||t[31]!==d||t[32]!==f?(p=(0,U.jsxs)(`div`,{className:o,children:[s,c,u,d,f]}),t[27]=o,t[28]=s,t[29]=c,t[30]=u,t[31]=d,t[32]=f,t[33]=p):p=t[33],p}function Te(){return l(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,D,`dark:border-edge`)}function Ee(){return l(b,k)}var De=[`schedule`,`delivery`,`prompt`,`document`],Oe={schedule:T,delivery:c,prompt:C,document:x};function ke(e){return e&&De.includes(e)?e:`schedule`}function Ae(e,t){return t===`schedule`?e.tabSchedule:t===`delivery`?e.tabDelivery:t===`prompt`?e.tabPrompt:e.tabDocument}function je(e,t){return t===`schedule`?e.scheduleTabHint:t===`delivery`?e.deliveryTabHint:t===`prompt`?e.promptTabHint:e.documentTabHint}function Me(e,t){switch(t.type){case`reset`:return{form:null,baseline:null};case`sync`:{let e=structuredClone(t.value);return{form:e,baseline:structuredClone(e)}}case`patch`:return{...e,form:e.form?{...e.form,...t.patch}:null};case`saved`:{let n=structuredClone(t.value);return{form:e.form&&JSON.stringify(e.form)!==JSON.stringify(t.value)?e.form:n,baseline:structuredClone(n)}}}}function Ne(e,t){switch(t.type){case`reset`:return{doc:``,baseline:``};case`sync`:return{doc:t.value,baseline:t.value};case`set`:return{...e,doc:t.value};case`saved`:return{doc:e.doc===t.value?t.value:e.doc,baseline:t.value}}}function Pe(e){if(!e||typeof e!=`object`||Array.isArray(e))return``;let t=e.agents;if(!t||typeof t!=`object`||Array.isArray(t))return``;let n=t;if(!Array.isArray(n.list))return``;let r=typeof n.default==`string`?n.default:``,i=n.list.find(e=>!e||typeof e!=`object`||Array.isArray(e)?!1:r?e.id===r:!0)??n.list[0];if(!i||typeof i!=`object`||Array.isArray(i))return``;let a=i.workspace;if(!a||typeof a!=`object`||Array.isArray(a))return``;let o=a.root;return typeof o==`string`?o:``}var Fe={triggerLoading:!1,triggerOk:!1,triggerError:null};function Ie(){let e=f(e=>e.language),t=m(e),n=t.heartbeatSettings,r=!!d(e=>e.sessionKey),[a,o]=i(),c=ke(a.get(`tab`)),u=(0,R.useCallback)(e=>{o(t=>{let n=new URLSearchParams(t);return e===`schedule`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},[o]),[p,g]=(0,R.useReducer)(Me,{form:null,baseline:null}),v=p.form,b=p.baseline,[x,C]=(0,R.useReducer)(Ne,{doc:``,baseline:``}),w=x.doc,T=x.baseline,[D,O]=(0,R.useReducer)(A,Fe),{triggerLoading:k,triggerOk:te,triggerError:ae}=D,N=(0,R.useRef)(!1),P=(0,R.useRef)(!1),F=(0,R.useRef)(v),ue=(0,R.useRef)(w);F.current=v,ue.current=w;let{data:I,error:L,isLoading:de,mutate:z}=y(r),{data:V,error:H,isLoading:W,mutate:G}=h(r?B():null,fe,{revalidateOnFocus:!1}),{data:_e=[]}=h(r?le():null,ce,{revalidateOnFocus:!1}),ve=(0,R.useMemo)(()=>Pe(I?.payload?.config),[I]),K=(0,R.useMemo)(()=>pe(I?.payload?.config??{}),[I]),q=(0,R.useMemo)(()=>!v||!b?!1:JSON.stringify(v)!==JSON.stringify(b),[v,b]),J=w!==T;(0,R.useEffect)(()=>{if(!r){g({type:`reset`}),N.current=!1;return}I!==void 0&&(N.current||g({type:`sync`,value:K}))},[r,I,K]),(0,R.useEffect)(()=>{if(!r){C({type:`reset`}),P.current=!1;return}V!==void 0&&(P.current||C({type:`sync`,value:V}))},[r,V]);let ye=L instanceof Error?L.message:L?String(L):H instanceof Error?H.message:H?String(H):null,Y=!!(r&&(I===void 0||V===void 0)&&!ye&&(de||W)),X=v?.target.trim()??``,{data:be,setData:xe}=E(()=>se(X),[r,X],{enabled:r&&X.length>0,initial:[],errorData:[]}),Se=(0,R.useCallback)(()=>{X&&se(X).then(xe)},[X,xe]),Ce=(0,R.useCallback)(async()=>{O({type:`patch`,patch:{triggerLoading:!0,triggerOk:!1,triggerError:null}});try{await ge(),O({type:`patch`,patch:{triggerOk:!0}}),window.setTimeout(()=>O({type:`patch`,patch:{triggerOk:!1}}),3e3)}catch(e){O({type:`patch`,patch:{triggerError:e instanceof Error?e.message:n.triggerError}})}finally{O({type:`patch`,patch:{triggerLoading:!1}})}},[n.triggerError]),Z=(0,R.useCallback)(e=>{N.current=!0,g({type:`patch`,patch:e})},[]),we=q||J,Q=ie({value:(0,R.useMemo)(()=>v?{form:v,doc:w,saveConfig:q,saveDoc:J}:null,[q,J,w,v]),dirty:we,onSave:(0,R.useCallback)(async e=>{try{e.saveConfig&&(await me(e.form),g({type:`saved`,value:e.form}),N.current=!!(F.current&&JSON.stringify(F.current)!==JSON.stringify(e.form))),e.saveDoc&&(await he(e.doc),C({type:`saved`,value:e.doc}),P.current=ue.current!==e.doc)}catch(t){throw Error(t instanceof Error?t.message:e.saveConfig?n.saveConfigError:n.saveDocError)}},[n.saveConfigError,n.saveDocError]),delayMs:J?900:500});return r?Y?(0,U.jsx)(M,{gap:`gap-6`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:(0,U.jsx)(ne,{sections:3})}):v?(0,U.jsxs)(M,{"aria-busy":Q.status===`saving`,"data-has-baseline":b?`1`:`0`,onBlurCapture:Q.onBlurCapture,children:[(0,U.jsx)(ee,{title:t.settingsSections.heartbeat,docsLink:j(e,`heartbeat`),docsLabel:n.docsLink,actions:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(re,{status:Q.status,error:Q.error}),(0,U.jsxs)(_,{type:`button`,variant:`secondary`,className:`inline-flex items-center gap-2`,disabled:k,onClick:()=>void Ce(),children:[k?(0,U.jsx)(s,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,U.jsx)(S,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),k?n.triggering:n.triggerNow]}),te?(0,U.jsx)(`span`,{className:`text-sm text-fg-muted`,children:n.triggered}):null]})}),(0,U.jsx)(oe,{children:ve?(0,U.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[n.workspaceLabel,`: `,(0,U.jsx)(`span`,{className:`font-mono text-fg-muted`,children:ve})]}):null}),Q.error?(0,U.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:Q.error}):null,ae?(0,U.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:ae}):null,(0,U.jsx)(Le,{h:n,activeTab:c,onChange:u}),(0,U.jsx)($,{h:n,id:`schedule`,activeTab:c,children:(0,U.jsx)(Re,{h:n,form:v,update:Z})}),(0,U.jsx)($,{h:n,id:`delivery`,activeTab:c,children:(0,U.jsx)(ze,{h:n,cron:t.cron,form:v,channels:_e,sessionChatIds:be,onRefreshChatIds:Se,update:Z,inputClassName:Te,selectClassName:Ee})}),(0,U.jsx)($,{h:n,id:`prompt`,activeTab:c,children:(0,U.jsx)(He,{h:n,form:v,update:Z,inputClassName:Te})}),(0,U.jsxs)($,{h:n,id:`document`,activeTab:c,children:[(0,U.jsx)(`p`,{className:`mb-3 text-xs text-fg-subtle`,children:n.docHint}),(0,U.jsx)(`textarea`,{className:l(Te(),`min-h-72 resize-y font-mono text-xs leading-relaxed`),value:w,onChange:e=>{P.current=!0,C({type:`set`,value:e.target.value})},spellCheck:!1,"aria-label":n.docSection,"data-doc-in-sync":w===T?`true`:`false`})]})]}):(0,U.jsxs)(M,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:[(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:ye??n.loadError}),(0,U.jsx)(_,{type:`button`,variant:`secondary`,onClick:()=>{z(),G()},children:n.retry})]}):(0,U.jsxs)(M,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:[(0,U.jsx)(ee,{title:t.settingsSections.heartbeat}),(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})]})}function Le(e){let t=(0,z.c)(7),{h:n,activeTab:r,onChange:i}=e,a;t[0]===n?a=t[1]:(a=De.map(e=>({id:e,label:Ae(n,e),icon:Oe[e]})),t[0]=n,t[1]=a);let o=a,s;return t[2]!==r||t[3]!==n.tabsAriaLabel||t[4]!==o||t[5]!==i?(s=(0,U.jsx)(ae,{items:o,activeTab:r,onChange:i,ariaLabel:n.tabsAriaLabel,tabIdPrefix:`heartbeat-settings-tab`,panelIdPrefix:`heartbeat-settings-panel`}),t[2]=r,t[3]=n.tabsAriaLabel,t[4]=o,t[5]=i,t[6]=s):s=t[6],s}function $(e){let t=(0,z.c)(14),{h:n,id:r,activeTab:i,children:a}=e,o;t[0]!==n||t[1]!==r?(o=Ae(n,r),t[0]=n,t[1]=r,t[2]=o):o=t[2];let s;t[3]!==n||t[4]!==r?(s=je(n,r),t[3]=n,t[4]=r,t[5]=s):s=t[5];let c;t[6]===a?c=t[7]:(c=(0,U.jsx)(`div`,{className:`space-y-4`,children:a}),t[6]=a,t[7]=c);let l;return t[8]!==i||t[9]!==r||t[10]!==o||t[11]!==s||t[12]!==c?(l=(0,U.jsx)(te,{id:r,activeTab:i,tabIdPrefix:`heartbeat-settings-tab`,panelIdPrefix:`heartbeat-settings-panel`,title:o,hint:s,children:c}),t[8]=i,t[9]=r,t[10]=o,t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function Re(e){let t=(0,z.c)(37),{h:n,form:r,update:i}=e,a;t[0]===i?a=t[1]:(a=e=>i({enabled:e.target.checked}),t[0]=i,t[1]=a);let o;t[2]!==r.enabled||t[3]!==a?(o=(0,U.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.enabled,onChange:a}),t[2]=r.enabled,t[3]=a,t[4]=o):o=t[4];let s;t[5]!==n.enable||t[6]!==o?(s=(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[o,n.enable]}),t[5]=n.enable,t[6]=o,t[7]=s):s=t[7];let c;t[8]===i?c=t[9]:(c=e=>i({intervalMs:e}),t[8]=i,t[9]=c);let l;t[10]!==n.intervalPresets||t[11]!==n.intervalSecondsLabel?(l={secondsLabel:n.intervalSecondsLabel,presets:n.intervalPresets},t[10]=n.intervalPresets,t[11]=n.intervalSecondsLabel,t[12]=l):l=t[12];let u=`${n.intervalHintPreset} ${n.intervalHint}`,d;t[13]!==r.intervalMs||t[14]!==n.interval||t[15]!==c||t[16]!==l||t[17]!==u?(d=(0,U.jsx)(Q,{kind:`interval`,label:n.interval,valueMs:r.intervalMs,onChangeMs:c,labels:l,hint:u}),t[13]=r.intervalMs,t[14]=n.interval,t[15]=c,t[16]=l,t[17]=u,t[18]=d):d=t[18];let f;t[19]===i?f=t[20]:(f=e=>i({activeHours:e}),t[19]=i,t[20]=f);let p;t[21]!==n.activeEnd||t[22]!==n.activeStart||t[23]!==n.activeTimezone||t[24]!==n.addActiveHours||t[25]!==n.clearActiveHours?(p={start:n.activeStart,end:n.activeEnd,timezone:n.activeTimezone,add:n.addActiveHours,clear:n.clearActiveHours},t[21]=n.activeEnd,t[22]=n.activeStart,t[23]=n.activeTimezone,t[24]=n.addActiveHours,t[25]=n.clearActiveHours,t[26]=p):p=t[26];let m;t[27]!==r.activeHours||t[28]!==n.activeHoursHint||t[29]!==n.activeHoursTitle||t[30]!==f||t[31]!==p?(m=(0,U.jsx)(Q,{kind:`active-hours`,label:n.activeHoursTitle,value:r.activeHours,onChange:f,labels:p,hint:n.activeHoursHint}),t[27]=r.activeHours,t[28]=n.activeHoursHint,t[29]=n.activeHoursTitle,t[30]=f,t[31]=p,t[32]=m):m=t[32];let h;return t[33]!==m||t[34]!==s||t[35]!==d?(h=(0,U.jsxs)(U.Fragment,{children:[s,d,m]}),t[33]=m,t[34]=s,t[35]=d,t[36]=h):h=t[36],h}function ze(e){let t=(0,z.c)(51),{h:n,cron:r,form:i,channels:s,sessionChatIds:c,onRefreshChatIds:u,update:d,inputClassName:f,selectClassName:p}=e,m;t[0]===s?m=t[1]:(m=new Set(s.map(Ve)),t[0]=s,t[1]=m);let h=m,g;t[2]===i.target?g=t[3]:(g=i.target.trim(),t[2]=i.target,t[3]=g);let v=g,y=!!(v&&!h.has(v)),b;t[4]===n.deliveryHint?b=t[5]:(b=(0,U.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.deliveryHint}),t[4]=n.deliveryHint,t[5]=b);let x;t[6]===r.channel?x=t[7]:(x=(0,U.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r.channel}),t[6]=r.channel,t[7]=x);let S;t[8]===p?S=t[9]:(S=p(),t[8]=p,t[9]=S);let C;t[10]===d?C=t[11]:(C=e=>{d({target:e.target.value.trim(),targetChatId:``})},t[10]=d,t[11]=C);let w;t[12]===n.channelNone?w=t[13]:(w=(0,U.jsx)(o,{value:``,children:n.channelNone}),t[12]=n.channelNone,t[13]=w);let T;t[14]!==n.customChannelSuffix||t[15]!==y||t[16]!==v?(T=y?(0,U.jsxs)(o,{value:v,children:[v,` (`,n.customChannelSuffix,`)`]}):null,t[14]=n.customChannelSuffix,t[15]=y,t[16]=v,t[17]=T):T=t[17];let E;t[18]===s?E=t[19]:(E=s.map(Be),t[18]=s,t[19]=E);let D;t[20]!==S||t[21]!==C||t[22]!==w||t[23]!==T||t[24]!==E||t[25]!==v?(D=(0,U.jsxs)(a,{className:S,value:v,onChange:C,children:[w,T,E]}),t[20]=S,t[21]=C,t[22]=w,t[23]=T,t[24]=E,t[25]=v,t[26]=D):D=t[26];let k;t[27]!==D||t[28]!==x?(k=(0,U.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[x,D]}),t[27]=D,t[28]=x,t[29]=k):k=t[29];let A;t[30]!==r.enterManuallyOrSelect||t[31]!==r.lastActiveLabels||t[32]!==r.noRecentChats||t[33]!==r.noRecentChatsOption||t[34]!==r.recipient||t[35]!==r.recipientPlaceholder||t[36]!==r.refreshList||t[37]!==r.refreshRecipientHint||t[38]!==r.selectRecipient||t[39]!==i.targetChatId||t[40]!==f||t[41]!==u||t[42]!==p||t[43]!==c||t[44]!==v||t[45]!==d?(A=v?(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r.recipient}),(0,U.jsxs)(_,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,title:r.refreshRecipientHint,onClick:u,children:[(0,U.jsx)(O,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),r.refreshList]})]}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(`input`,{type:`text`,className:l(f(),`min-w-0 flex-1`),value:i.targetChatId,onChange:e=>d({targetChatId:e.target.value}),placeholder:r.recipientPlaceholder,autoComplete:`off`}),(0,U.jsxs)(a,{className:l(p(),`max-w-40 shrink-0 text-xs`),value:i.targetChatId,onChange:e=>{let t=e.target.value;t&&d({targetChatId:t})},children:[(0,U.jsx)(o,{value:``,children:r.selectRecipient}),c.length>0?c.map(e=>(0,U.jsx)(o,{value:e.chatId,children:N(e,r.lastActiveLabels)},`${e.channel}-${e.chatId}`)):(0,U.jsx)(o,{value:``,disabled:!0,children:r.noRecentChatsOption})]})]}),(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:c.length>0?r.enterManuallyOrSelect:r.noRecentChats})]}):null,t[30]=r.enterManuallyOrSelect,t[31]=r.lastActiveLabels,t[32]=r.noRecentChats,t[33]=r.noRecentChatsOption,t[34]=r.recipient,t[35]=r.recipientPlaceholder,t[36]=r.refreshList,t[37]=r.refreshRecipientHint,t[38]=r.selectRecipient,t[39]=i.targetChatId,t[40]=f,t[41]=u,t[42]=p,t[43]=c,t[44]=v,t[45]=d,t[46]=A):A=t[46];let j;return t[47]!==k||t[48]!==A||t[49]!==b?(j=(0,U.jsxs)(U.Fragment,{children:[b,k,A]}),t[47]=k,t[48]=A,t[49]=b,t[50]=j):j=t[50],j}function Be(e){return(0,U.jsxs)(o,{value:e.name,disabled:!e.enabled,children:[e.name,` `,e.enabled?``:`(disabled)`]},e.name)}function Ve(e){return e.name}function He(e){let t=(0,z.c)(65),{h:n,form:r,update:i,inputClassName:a}=e,o;t[0]===i?o=t[1]:(o=e=>i({includeSystemPromptSection:e.target.checked}),t[0]=i,t[1]=o);let s;t[2]!==r.includeSystemPromptSection||t[3]!==o?(s=(0,U.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:r.includeSystemPromptSection,onChange:o}),t[2]=r.includeSystemPromptSection,t[3]=o,t[4]=s):s=t[4];let c;t[5]===n.includeSystemPromptSectionHint?c=t[6]:(c=(0,U.jsx)(`span`,{className:`mt-1 block text-xs text-fg-subtle`,children:n.includeSystemPromptSectionHint}),t[5]=n.includeSystemPromptSectionHint,t[6]=c);let u;t[7]!==n.includeSystemPromptSection||t[8]!==c?(u=(0,U.jsxs)(`span`,{children:[n.includeSystemPromptSection,c]}),t[7]=n.includeSystemPromptSection,t[8]=c,t[9]=u):u=t[9];let d;t[10]!==s||t[11]!==u?(d=(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[s,u]}),t[10]=s,t[11]=u,t[12]=d):d=t[12];let f;t[13]===n.prompt?f=t[14]:(f=(0,U.jsx)(`div`,{className:`mb-1 text-sm font-medium text-fg`,children:n.prompt}),t[13]=n.prompt,t[14]=f);let p;t[15]===a?p=t[16]:(p=l(a(),`min-h-36 resize-y font-mono text-xs`),t[15]=a,t[16]=p);let m;t[17]===i?m=t[18]:(m=e=>i({prompt:e.target.value}),t[17]=i,t[18]=m);let h;t[19]!==r.prompt||t[20]!==n.promptPlaceholder||t[21]!==p||t[22]!==m?(h=(0,U.jsx)(`textarea`,{className:p,value:r.prompt,onChange:m,placeholder:n.promptPlaceholder}),t[19]=r.prompt,t[20]=n.promptPlaceholder,t[21]=p,t[22]=m,t[23]=h):h=t[23];let g;t[24]===n.promptHint?g=t[25]:(g=(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:n.promptHint}),t[24]=n.promptHint,t[25]=g);let _;t[26]!==g||t[27]!==f||t[28]!==h?(_=(0,U.jsxs)(`div`,{children:[f,h,g]}),t[26]=g,t[27]=f,t[28]=h,t[29]=_):_=t[29];let v;t[30]===n.ackMaxChars?v=t[31]:(v=(0,U.jsx)(`div`,{className:`mb-1 text-sm font-medium text-fg`,children:n.ackMaxChars}),t[30]=n.ackMaxChars,t[31]=v);let y;t[32]===a?y=t[33]:(y=a(),t[32]=a,t[33]=y);let b=r.ackMaxChars===``?``:r.ackMaxChars,x;t[34]===i?x=t[35]:(x=e=>{let t=e.target.value;if(t===``){i({ackMaxChars:``});return}let n=parseInt(t,10);i({ackMaxChars:Number.isFinite(n)?n:``})},t[34]=i,t[35]=x);let S;t[36]!==n.ackDefaultPlaceholder||t[37]!==y||t[38]!==b||t[39]!==x?(S=(0,U.jsx)(`input`,{type:`number`,min:1,className:y,value:b,onChange:x,placeholder:n.ackDefaultPlaceholder}),t[36]=n.ackDefaultPlaceholder,t[37]=y,t[38]=b,t[39]=x,t[40]=S):S=t[40];let C;t[41]===n.ackMaxCharsHint?C=t[42]:(C=(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:n.ackMaxCharsHint}),t[41]=n.ackMaxCharsHint,t[42]=C);let w;t[43]!==v||t[44]!==S||t[45]!==C?(w=(0,U.jsxs)(`div`,{children:[v,S,C]}),t[43]=v,t[44]=S,t[45]=C,t[46]=w):w=t[46];let T;t[47]===i?T=t[48]:(T=e=>i({isolatedSession:e.target.checked}),t[47]=i,t[48]=T);let E;t[49]!==r.isolatedSession||t[50]!==T?(E=(0,U.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:r.isolatedSession,onChange:T}),t[49]=r.isolatedSession,t[50]=T,t[51]=E):E=t[51];let D;t[52]===n.isolatedSessionHint?D=t[53]:(D=(0,U.jsx)(`span`,{className:`mt-1 block text-xs text-fg-subtle`,children:n.isolatedSessionHint}),t[52]=n.isolatedSessionHint,t[53]=D);let O;t[54]!==n.isolatedSession||t[55]!==D?(O=(0,U.jsxs)(`span`,{children:[n.isolatedSession,D]}),t[54]=n.isolatedSession,t[55]=D,t[56]=O):O=t[56];let k;t[57]!==E||t[58]!==O?(k=(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[E,O]}),t[57]=E,t[58]=O,t[59]=k):k=t[59];let A;return t[60]!==_||t[61]!==w||t[62]!==k||t[63]!==d?(A=(0,U.jsxs)(U.Fragment,{children:[d,_,w,k]}),t[60]=_,t[61]=w,t[62]=k,t[63]=d,t[64]=A):A=t[64],A}export{Ie as HeartbeatSettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
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,t as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as o}from"./plus-Q2yW6OE7.js";import{t as s}from"./x-B_N4OPjy.js";import{t as c}from"./cn-JdwAhgNB.js";import{n as l}from"./locale-store-1urrBBCQ.js";import{t as u}from"./messages-DYFcjtmG.js";import{a as d,i as f,n as p,o as m,r as h,s as g,t as _}from"./dist-BGTk37IG.js";import{i as v}from"./vendor-swr-BIWyz7Rc.js";import{t as y}from"./button-BA45yciM.js";import{t as b}from"./skeleton-BwbyijEw.js";import{As as x,Es as S,Fo as C,Hr as w,Jt as T,Ls as E,Vl as D,Wc as ee,bs as O,bu as k,ca as A,cn as j,go as M,ks as N,ln as P,mi as F,ni as I,nl as L,on as te,pc as ne,pi as re,r as ie,ri as ae,sn as R,wu as z,yu as oe}from"./index-enFXJJCU.js";import{n as se}from"./tab-completion-input-D64VNmiA.js";var B=n(),V=r(),H={meeting_preparation:{Icon:z,en:`Next meeting`,zh:`下一场会议`},project_momentum:{Icon:D,en:`Project momentum`,zh:`项目进展`},communication_follow_up:{Icon:L,en:`Waiting on a reply`,zh:`沟通跟进`}},ce={needs_decision:{en:`Needs your decision`,zh:`需要你决定`},prepared:{en:`Ready for you`,zh:`已为你准备好`},changed:{en:`Something changed`,zh:`出现了新变化`},following:{en:`Following quietly`,zh:`正在安静跟进`}};function U(e){let t=(0,B.c)(56),{scene:n,zh:r}=e,i=H[n.kind],o=ce[n.status],s=n.card?`/assistant-work?item=${encodeURIComponent(n.card.id)}`:n.object?.route??n.manageRoute,c=n.status===`needs_decision`?r?`查看并决定`:`Review and decide`:n.status===`prepared`?r?`查看准备结果`:`Open prepared work`:n.status===`changed`?r?`查看变化`:`Review change`:n.object?r?`打开${n.kind===`project_momentum`?`项目`:`相关内容`}`:`Open context`:r?`查看安排`:`View arrangement`,l;t[0]===i.Icon?l=t[1]:(l=(0,V.jsx)(`span`,{className:`mt-0.5 rounded-xl bg-accent-soft p-2 text-accent`,children:(0,V.jsx)(i.Icon,{className:`size-4`,"aria-hidden":!0})}),t[0]=i.Icon,t[1]=l);let u=r?i.zh:i.en,d;t[2]===u?d=t[3]:(d=(0,V.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:u}),t[2]=u,t[3]=d);let f=n.status===`following`?`text-xs text-fg-subtle`:`text-xs font-medium text-accent`,p=r?o.zh:o.en,m;t[4]!==f||t[5]!==p?(m=(0,V.jsx)(`span`,{className:f,children:p}),t[4]=f,t[5]=p,t[6]=m):m=t[6];let h;t[7]!==d||t[8]!==m?(h=(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[d,m]}),t[7]=d,t[8]=m,t[9]=h):h=t[9];let g;t[10]===n.title?g=t[11]:(g=(0,V.jsx)(`h3`,{className:`mt-1 font-semibold text-fg`,children:n.title}),t[10]=n.title,t[11]=g);let _;t[12]!==h||t[13]!==g?(_=(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[h,g]}),t[12]=h,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==l||t[16]!==_?(v=(0,V.jsxs)(`div`,{className:`flex items-start gap-3 border-b border-edge-subtle px-5 py-4`,children:[l,_]}),t[15]=l,t[16]=_,t[17]=v):v=t[17];let y=r?`现在`:`Now`,b;t[18]===y?b=t[19]:(b=(0,V.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:y}),t[18]=y,t[19]=b);let x;t[20]===n.moment?x=t[21]:(x=(0,V.jsx)(`p`,{className:`mt-1 text-sm font-medium text-fg`,children:n.moment}),t[20]=n.moment,t[21]=x);let S;t[22]!==b||t[23]!==x?(S=(0,V.jsxs)(`div`,{children:[b,x]}),t[22]=b,t[23]=x,t[24]=S):S=t[24];let C=n.status===`following`?r?`跟进要求`:`What the assistant remembers`:r?`为什么值得关注`:`Why it matters`,w;t[25]===C?w=t[26]:(w=(0,V.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:C}),t[25]=C,t[26]=w);let T=n.status===`following`?n.promise:n.relevance,E;t[27]===T?E=t[28]:(E=(0,V.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:T}),t[27]=T,t[28]=E);let D;t[29]!==w||t[30]!==E?(D=(0,V.jsxs)(`div`,{children:[w,E]}),t[29]=w,t[30]=E,t[31]=D):D=t[31];let ee=r?`助理已经做了什么`:`What your assistant did`,O;t[32]===ee?O=t[33]:(O=(0,V.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:ee}),t[32]=ee,t[33]=O);let k;t[34]===n.help?k=t[35]:(k=(0,V.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:n.help}),t[34]=n.help,t[35]=k);let A;t[36]!==O||t[37]!==k?(A=(0,V.jsxs)(`div`,{className:`rounded-xl bg-surface-hover px-4 py-3`,children:[O,k]}),t[36]=O,t[37]=k,t[38]=A):A=t[38];let j;t[39]!==c||t[40]!==s?(j=(0,V.jsx)(a,{className:`text-sm font-medium text-accent`,to:s,children:c}),t[39]=c,t[40]=s,t[41]=j):j=t[41];let M=r?`调整助理跟进`:`Adjust arrangement`,N;t[42]!==n.manageRoute||t[43]!==M?(N=(0,V.jsx)(a,{className:`text-xs text-fg-subtle hover:text-fg`,to:n.manageRoute,children:M}),t[42]=n.manageRoute,t[43]=M,t[44]=N):N=t[44];let P;t[45]!==j||t[46]!==N?(P=(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[j,N]}),t[45]=j,t[46]=N,t[47]=P):P=t[47];let F;t[48]!==S||t[49]!==D||t[50]!==A||t[51]!==P?(F=(0,V.jsxs)(`div`,{className:`space-y-4 px-5 py-4`,children:[S,D,A,P]}),t[48]=S,t[49]=D,t[50]=A,t[51]=P,t[52]=F):F=t[52];let I;return t[53]!==v||t[54]!==F?(I=(0,V.jsxs)(`article`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:[v,F]}),t[53]=v,t[54]=F,t[55]=I):I=t[55],I}function le(e){let t=(0,B.c)(42),{compact:n}=e,r=n===void 0?!1:n,i=l(W)===`zh`,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={refreshInterval:15e3},t[0]=o):o=t[0];let s=v(`/api/proactive/overview`,T,o);if(s.isLoading){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,V.jsx)(b,{className:`h-44 rounded-2xl`}),t[1]=e):e=t[1],e}if(s.error){let e=String(s.error),n;return t[2]===e?n=t[3]:(n=(0,V.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:e}),t[2]=e,t[3]=n),n}let c;t[4]===s.data?.scenes?c=t[5]:(c=s.data?.scenes??[],t[4]=s.data?.scenes,t[5]=c);let u=c;if(!u.length){let e=r?`px-4 text-center`:`rounded-2xl border border-edge bg-surface-panel p-6`,n=r?`text-sm font-medium text-fg-muted`:`font-medium text-fg`,a=i?`今天没有需要你接手的变化`:`Nothing needs your attention today`,o;t[6]!==n||t[7]!==a?(o=(0,V.jsx)(`h2`,{className:n,children:a}),t[6]=n,t[7]=a,t[8]=o):o=t[8];let s=r?`mx-auto mt-2 max-w-lg text-xs leading-5 text-fg-subtle`:`mt-2 text-sm text-fg-muted`,c=i?`继续工作即可。需要持续关注的事,可以直接在项目或对话里交给助理。`:`Keep working. You can ask the assistant to follow something from its project or conversation.`,l;t[9]!==s||t[10]!==c?(l=(0,V.jsx)(`p`,{className:s,children:c}),t[9]=s,t[10]=c,t[11]=l):l=t[11];let u;return t[12]!==l||t[13]!==e||t[14]!==o?(u=(0,V.jsxs)(`section`,{className:e,children:[o,l]}),t[12]=l,t[13]=e,t[14]=o,t[15]=u):u=t[15],u}let d;t[16]!==r||t[17]!==u?(d=r?u.slice(0,3):u,t[16]=r,t[17]=u,t[18]=d):d=t[18];let f=d,p=i?`正在发生的事`:`What is happening`,m;t[19]===p?m=t[20]:(m=(0,V.jsx)(`h2`,{id:`proactive-scenes-title`,className:`text-sm font-semibold text-fg`,children:p}),t[19]=p,t[20]=m);let h=i?`助理跟进`:`Assistant follow-ups`,g;t[21]===h?g=t[22]:(g=(0,V.jsx)(a,{className:`text-xs text-fg-subtle hover:text-accent`,to:`/assistant-work`,children:h}),t[21]=h,t[22]=g);let _;t[23]!==m||t[24]!==g?(_=(0,V.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3 px-1`,children:[m,g]}),t[23]=m,t[24]=g,t[25]=_):_=t[25];let y;if(t[26]!==f||t[27]!==i){let e;t[29]===i?e=t[30]:(e=e=>(0,V.jsx)(U,{scene:e,zh:i},e.id),t[29]=i,t[30]=e),y=f.map(e),t[26]=f,t[27]=i,t[28]=y}else y=t[28];let x;t[31]===y?x=t[32]:(x=(0,V.jsx)(`div`,{className:`space-y-3`,children:y}),t[31]=y,t[32]=x);let S;t[33]!==r||t[34]!==u.length||t[35]!==f.length||t[36]!==i?(S=r&&u.length>f.length&&(0,V.jsx)(a,{className:`mt-3 block text-sm text-accent`,to:`/assistant-work`,children:i?`还有 ${u.length-f.length} 个场景`:`${u.length-f.length} more scenes`}),t[33]=r,t[34]=u.length,t[35]=f.length,t[36]=i,t[37]=S):S=t[37];let C;return t[38]!==x||t[39]!==S||t[40]!==_?(C=(0,V.jsxs)(`section`,{"aria-labelledby":`proactive-scenes-title`,children:[_,x,S]}),t[38]=x,t[39]=S,t[40]=_,t[41]=C):C=t[41],C}function W(e){return e.language}var G=e(t(),1),ue=12e3;function K(e){let t=(0,B.c)(106),{variant:n,inputId:r,inputRef:i,intent:a,labels:o,attachments:s,isDragging:l,attachmentBusy:u,attachmentsFull:d,voice:f,chat:p,cancelAction:m,onIntentChange:h,onPickFiles:g,onRemoveAttachment:_,onPaste:v,onDragOver:b,onDragLeave:x,onDrop:S,onSubmit:C}=e,w=n===`inline`,T;t[0]!==s||t[1]!==a?(T=!!a.trim()||s.length>0,t[0]=s,t[1]=a,t[2]=T):T=t[2];let E=T,D=f.voiceActive&&f.phase!==`error`,O;t[3]!==C||t[4]!==f.voiceActive?(O=e=>{if(f.voiceActive){e.preventDefault();return}C(e)},t[3]=C,t[4]=f.voiceActive,t[5]=O):O=t[5];let k=w?`mx-auto mt-6 w-full overflow-hidden rounded-xl border border-edge bg-surface-base p-2 text-left shadow-surface transition-colors focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15 sm:mt-8`:`flex min-h-0 flex-1 flex-col`,A;t[6]===k?A=t[7]:(A=c(`relative`,k),t[6]=k,t[7]=A);let M;t[8]!==w||t[9]!==l||t[10]!==o.dropFiles?(M=l?(0,V.jsx)(`div`,{className:c(`pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-accent-soft/90 text-sm font-medium text-accent-fg backdrop-blur-[1px]`,w&&`rounded-2xl`),children:o.dropFiles}):null,t[8]=w,t[9]=l,t[10]=o.dropFiles,t[11]=M):M=t[11];let N=!w&&`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,P;t[12]===N?P=t[13]:(P=c(N),t[12]=N,t[13]=P);let F=w?`sr-only`:`mb-2 shrink-0 text-sm font-medium text-fg`,I;t[14]!==r||t[15]!==o.intentLabel||t[16]!==F?(I=(0,V.jsx)(`label`,{htmlFor:r,className:F,children:o.intentLabel}),t[14]=r,t[15]=o.intentLabel,t[16]=F,t[17]=I):I=t[17];let L;t[18]!==u||t[19]!==p||t[20]!==f.audioLevel||t[21]!==f.cancelVoiceInput||t[22]!==f.confirmVoiceInput||t[23]!==f.elapsedLabel||t[24]!==f.error||t[25]!==f.finalTranscript||t[26]!==f.partialTranscript||t[27]!==f.phase||t[28]!==f.retryVoiceInput||t[29]!==f.settingsRequired||t[30]!==f.voiceActive?(L=f.voiceActive?(0,V.jsx)(j,{phase:f.phase,elapsedLabel:f.elapsedLabel,audioLevel:f.audioLevel,partialTranscript:f.partialTranscript,finalTranscript:f.finalTranscript,error:f.error,settingsRequired:f.settingsRequired,disabled:u,chat:p,onCancel:f.cancelVoiceInput,onConfirm:f.confirmVoiceInput,onRetry:f.retryVoiceInput}):null,t[18]=u,t[19]=p,t[20]=f.audioLevel,t[21]=f.cancelVoiceInput,t[22]=f.confirmVoiceInput,t[23]=f.elapsedLabel,t[24]=f.error,t[25]=f.finalTranscript,t[26]=f.partialTranscript,t[27]=f.phase,t[28]=f.retryVoiceInput,t[29]=f.settingsRequired,t[30]=f.voiceActive,t[31]=L):L=t[31];let te=D&&`hidden`,ie=w?`min-h-24 bg-transparent px-3 py-2`:`min-h-32 flex-1 rounded-xl border border-edge bg-surface-base p-3 focus:border-accent focus:ring-2 focus:ring-accent/20`,R;t[32]!==te||t[33]!==ie?(R=c(`w-full resize-none text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle`,te,ie),t[32]=te,t[33]=ie,t[34]=R):R=t[34];let z;t[35]===h?z=t[36]:(z=e=>h(e.target.value),t[35]=h,t[36]=z);let oe=!w,H;t[37]!==r||t[38]!==i||t[39]!==a||t[40]!==o.intentPlaceholder||t[41]!==o.intentSuggestion||t[42]!==h||t[43]!==v||t[44]!==R||t[45]!==z||t[46]!==oe?(H=(0,V.jsx)(se,{ref:i,id:r,className:R,value:a,onChange:z,onPaste:v,suggestion:o.intentSuggestion,onAcceptSuggestion:h,onKeyDown:de,placeholder:o.intentPlaceholder,maxLength:ue,autoFocus:oe}),t[37]=r,t[38]=i,t[39]=a,t[40]=o.intentPlaceholder,t[41]=o.intentSuggestion,t[42]=h,t[43]=v,t[44]=R,t[45]=z,t[46]=oe,t[47]=H):H=t[47];let ce=w?`border-b-0 bg-transparent px-3 pb-2 pt-0`:`mt-3 border-b-0 bg-transparent px-0 pb-0`,U;t[48]!==s||t[49]!==_||t[50]!==ce?(U=(0,V.jsx)(re,{attachments:s,topPadded:!1,onRemove:_,className:ce}),t[48]=s,t[49]=_,t[50]=ce,t[51]=U):U=t[51];let le;t[52]!==w||t[53]!==a.length||t[54]!==o.shortcut?(le=w?null:(0,V.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,V.jsx)(`span`,{children:o.shortcut}),(0,V.jsxs)(`span`,{className:`tabular-nums`,children:[a.length.toLocaleString(),` / `,ue.toLocaleString()]})]}),t[52]=w,t[53]=a.length,t[54]=o.shortcut,t[55]=le):le=t[55];let W;t[56]!==L||t[57]!==H||t[58]!==U||t[59]!==le||t[60]!==P||t[61]!==I?(W=(0,V.jsxs)(`div`,{className:P,children:[I,L,H,U,le]}),t[56]=L,t[57]=H,t[58]=U,t[59]=le,t[60]=P,t[61]=I,t[62]=W):W=t[62];let G=w?`border-edge-subtle px-1 pt-2`:`border-edge px-5 py-4`,K;t[63]===G?K=t[64]:(K=c(`flex shrink-0 items-center gap-2 border-t`,G),t[63]=G,t[64]=K);let q=!w&&`mr-auto`,fe;t[65]===q?fe=t[66]:(fe=c(`flex items-center gap-1`,q),t[65]=q,t[66]=fe);let pe=u||d,me;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,V.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t[67]=me):me=t[67];let J;t[68]!==o.attachTitle||t[69]!==g||t[70]!==pe?(J=(0,V.jsx)(y,{type:`button`,variant:`ghost`,className:`size-9 rounded-lg p-0`,disabled:pe,title:o.attachTitle,"aria-label":o.attachTitle,onClick:g,children:me}),t[68]=o.attachTitle,t[69]=g,t[70]=pe,t[71]=J):J=t[71];let Y;t[72]!==u||t[73]!==p||t[74]!==f.startVoiceInput||t[75]!==f.voiceActive?(Y=f.voiceActive?null:(0,V.jsx)(ae,{disabled:u,chat:p,onStart:f.startVoiceInput}),t[72]=u,t[73]=p,t[74]=f.startVoiceInput,t[75]=f.voiceActive,t[76]=Y):Y=t[76];let X;t[77]!==fe||t[78]!==J||t[79]!==Y?(X=(0,V.jsxs)(`div`,{className:fe,children:[J,Y]}),t[77]=fe,t[78]=J,t[79]=Y,t[80]=X):X=t[80];let Z;t[81]!==m||t[82]!==w||t[83]!==o.shortcut?(Z=w?(0,V.jsx)(`span`,{className:`hidden text-[11px] text-fg-subtle sm:inline`,children:o.shortcut}):m,t[81]=m,t[82]=w,t[83]=o.shortcut,t[84]=Z):Z=t[84];let he=w?`ml-auto h-9 rounded-lg px-3.5 text-xs`:`min-w-32`,Q=!E||u||f.voiceActive,$=w?`size-3.5`:`size-4`,ge;t[85]===$?ge=t[86]:(ge=(0,V.jsx)(ne,{className:$,"aria-hidden":!0}),t[85]=$,t[86]=ge);let _e;t[87]!==o.submit||t[88]!==he||t[89]!==Q||t[90]!==ge?(_e=(0,V.jsxs)(y,{type:`submit`,variant:`primary`,className:he,disabled:Q,children:[ge,o.submit]}),t[87]=o.submit,t[88]=he,t[89]=Q,t[90]=ge,t[91]=_e):_e=t[91];let ve;t[92]!==K||t[93]!==X||t[94]!==Z||t[95]!==_e?(ve=(0,V.jsxs)(`div`,{className:K,children:[X,Z,_e]}),t[92]=K,t[93]=X,t[94]=Z,t[95]=_e,t[96]=ve):ve=t[96];let ye;return t[97]!==x||t[98]!==b||t[99]!==S||t[100]!==O||t[101]!==W||t[102]!==ve||t[103]!==A||t[104]!==M?(ye=(0,V.jsxs)(`form`,{onSubmit:O,onDragOver:b,onDragLeave:x,onDrop:S,className:A,children:[M,W,ve]}),t[97]=x,t[98]=b,t[99]=S,t[100]=O,t[101]=W,t[102]=ve,t[103]=A,t[104]=M,t[105]=ye):ye=t[105],ye}function de(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}function q(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function fe(){let e=(0,B.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,V.jsxs)(`div`,{className:`space-y-8`,"aria-busy":!0,children:[(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(b,{className:`h-10 w-3/5 rounded-xl`}),(0,V.jsx)(b,{className:`h-5 w-4/5 rounded-lg`})]}),(0,V.jsx)(b,{className:`h-64 rounded-2xl`}),(0,V.jsx)(b,{className:`h-32 rounded-xl`})]}),e[0]=t):t=e[0],t}function pe(e){let t=(0,B.c)(33),{item:n,busy:r,recommendationLabel:i,dueLabel:a,failureLabel:o,locale:s,onAction:c}=e,l;t[0]!==a||t[1]!==n.dueAt||t[2]!==s?(l=n.dueAt?`${a} ${w(new Date(n.dueAt),s)}`:null,t[0]=a,t[1]=n.dueAt,t[2]=s,t[3]=l):l=t[3];let u=l,d=n.kind===`failure`?o:u,f;t[4]===d?f=t[5]:(f=d?(0,V.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs font-medium text-warning`,children:[(0,V.jsx)(`span`,{className:`size-1.5 rounded-full bg-warning`,"aria-hidden":!0}),(0,V.jsx)(`span`,{children:d})]}):null,t[4]=d,t[5]=f);let p=!n.openAction,m;t[6]!==n.id||t[7]!==n.openAction||t[8]!==c?(m=()=>n.openAction&&c(n.openAction,n.id),t[6]=n.id,t[7]=n.openAction,t[8]=c,t[9]=m):m=t[9];let h;t[10]===n.title?h=t[11]:(h=(0,V.jsx)(`span`,{className:`block text-lg font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[10]=n.title,t[11]=h);let g;t[12]===n.summary?g=t[13]:(g=(0,V.jsx)(`span`,{className:`mt-1.5 block text-sm leading-6 text-fg-muted`,children:n.summary}),t[12]=n.summary,t[13]=g);let _;t[14]!==p||t[15]!==m||t[16]!==h||t[17]!==g?(_=(0,V.jsxs)(`button`,{type:`button`,className:`block w-full text-left outline-none focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:p,onClick:m,children:[h,g]}),t[14]=p,t[15]=m,t[16]=h,t[17]=g,t[18]=_):_=t[18];let v;t[19]!==n.recommendation||t[20]!==i?(v=n.recommendation?(0,V.jsxs)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:[(0,V.jsxs)(`span`,{className:`font-semibold text-fg`,children:[i,`:`]}),n.recommendation]}):null,t[19]=n.recommendation,t[20]=i,t[21]=v):v=t[21];let b;t[22]!==r||t[23]!==n.id||t[24]!==n.primaryAction||t[25]!==n.secondaryActions||t[26]!==c?(b=n.primaryAction||n.secondaryActions.length>0?(0,V.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[n.primaryAction?(0,V.jsx)(y,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3.5 text-xs`,disabled:r,onClick:()=>c(n.primaryAction,n.id),children:n.primaryAction.label}):null,n.secondaryActions.map(e=>(0,V.jsx)(y,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3.5 text-xs shadow-none`,disabled:r,onClick:()=>c(e,n.id),children:e.label},`${e.type}:${e.label}`))]}):null,t[22]=r,t[23]=n.id,t[24]=n.primaryAction,t[25]=n.secondaryActions,t[26]=c,t[27]=b):b=t[27];let x;return t[28]!==f||t[29]!==_||t[30]!==v||t[31]!==b?(x=(0,V.jsxs)(`article`,{className:`px-5 py-5 sm:px-6 sm:py-6`,children:[f,_,v,b]}),t[28]=f,t[29]=_,t[30]=v,t[31]=b,t[32]=x):x=t[32],x}function me(e){let t=(0,B.c)(26),{item:n,onAction:r}=e,i;t[0]===n.kind?i=t[1]:(i=n.kind===`scheduled`?(0,V.jsx)(z,{className:`size-4`,"aria-hidden":!0}):(0,V.jsx)(`span`,{className:`size-1.5 rounded-full bg-success`,"aria-hidden":!0}),t[0]=n.kind,t[1]=i);let a=i,o=!n.openAction,s;t[2]!==n.id||t[3]!==n.openAction||t[4]!==r?(s=()=>n.openAction&&r(n.openAction,n.id),t[2]=n.id,t[3]=n.openAction,t[4]=r,t[5]=s):s=t[5];let c;t[6]===a?c=t[7]:(c=(0,V.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center text-fg-subtle`,children:a}),t[6]=a,t[7]=c);let l;t[8]===n.title?l=t[9]:(l=(0,V.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:n.title}),t[8]=n.title,t[9]=l);let u;t[10]===n.summary?u=t[11]:(u=(0,V.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.summary}),t[10]=n.summary,t[11]=u);let d;t[12]!==l||t[13]!==u?(d=(0,V.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[l,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14];let f;t[15]===n.statusLabel?f=t[16]:(f=n.statusLabel?(0,V.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.statusLabel}):null,t[15]=n.statusLabel,t[16]=f);let p;t[17]===n.openAction?p=t[18]:(p=n.openAction?(0,V.jsx)(k,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[17]=n.openAction,t[18]=p);let m;return t[19]!==o||t[20]!==s||t[21]!==c||t[22]!==d||t[23]!==f||t[24]!==p?(m=(0,V.jsxs)(`button`,{type:`button`,className:`flex min-h-16 w-full items-center gap-3 py-3 text-left outline-none hover:text-fg focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:o,onClick:s,children:[c,d,f,p]}),t[19]=o,t[20]=s,t[21]=c,t[22]=d,t[23]=f,t[24]=p,t[25]=m):m=t[25],m}function J(){let e=l(e=>e.language),t=u(e),n=t.projectsPage,r=E(e),a=i(),c=M(e=>e.setPageHeader),b=M(e=>e.clearPageHeader),[w,D]=(0,G.useState)(null),[ee,k]=(0,G.useState)(!0),[j,L]=(0,G.useState)(null),[ne,re]=(0,G.useState)(!1),[ae,z]=(0,G.useState)(``),[se,B]=(0,G.useState)(null),[H,ce]=(0,G.useState)(!1),U=I({chat:t.chat}),W=(0,G.useRef)(null),ue=C({disabled:H,chat:t.chat,onTranscript:e=>{z(t=>P(t,e)),window.setTimeout(()=>W.current?.focus(),0)}}),{phase:de,voiceActive:J,startVoiceInput:Y,cancelVoiceInput:X,confirmVoiceInput:Z,retryVoiceInput:he}=ue,Q=(0,G.useCallback)(async(t=!1)=>{t&&k(!0),L(null);try{let t=await S(e);D({...t,needsUser:t.needsUser.filter(e=>e.primaryAction?.type!==`review_judgment`&&e.openAction?.type!==`review_judgment`),background:t.background.filter(e=>e.primaryAction?.type!==`review_judgment`&&e.openAction?.type!==`review_judgment`)})}catch(e){L(e instanceof Error?e.message:String(e))}finally{k(!1)}},[e]);(0,G.useEffect)(()=>{Q(!0)},[Q]),(0,G.useEffect)(()=>{let e,t=t=>{e!==void 0&&window.clearTimeout(e),e=window.setTimeout(()=>{e=void 0,Q()},t)},n=()=>t(100),r=()=>t(750),i=[`session-created`,`agent-run-started`,`agent-run-ended`,`automation-run-completed`,`workflow-run-updated`,`workflow-run-error`],a=[`session-updated`,`session-transcript-updated`];return i.forEach(e=>window.addEventListener(e,n)),a.forEach(e=>window.addEventListener(e,r)),()=>{i.forEach(e=>window.removeEventListener(e,n)),a.forEach(e=>window.removeEventListener(e,r)),e!==void 0&&window.clearTimeout(e)}},[Q]);let $=(0,G.useCallback)(async e=>{if(!(e.length===0||H)){ce(!0);try{await U.processFiles(e)}finally{ce(!1)}}},[H,U.processFiles]),ge=(0,G.useCallback)(async e=>{let t=F(e.clipboardData);t.length!==0&&(e.preventDefault(),await $(t))},[$]),_e=(0,G.useCallback)(e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,U.setIsDragging(!0))},[U.setIsDragging]),ve=(0,G.useCallback)(e=>{let t=e.relatedTarget;(!(t instanceof Node)||!e.currentTarget.contains(t))&&U.setIsDragging(!1)},[U.setIsDragging]),ye=(0,G.useCallback)(async e=>{e.preventDefault(),U.setIsDragging(!1),await $(Array.from(e.dataTransfer.files))},[U.setIsDragging,$]),be=(0,G.useCallback)(e=>{e.preventDefault();let t=U.wireAttachmentsPayload(),n=A(ae,t.length>0?ie(t):void 0,{projectScope:`none`});n&&(re(!1),z(``),U.clearAttachments(),a(n))},[U.clearAttachments,U.wireAttachmentsPayload,ae,a]),xe=U.attachments.length>=10,Se={attachTitle:xe?q(t.chat.maxAttachmentsReached,{max:10}):`${t.chat.attachFile} (${U.attachments.length}/10)`,dropFiles:t.chat.dropFiles,intentLabel:r.intentLabel,intentPlaceholder:r.intentPlaceholder,intentSuggestion:r.intentSuggestion,shortcut:n.home.submitShortcut,submit:r.newWork},Ce=v(`/api/proactive/overview`,T,{refreshInterval:15e3}),we=!!Ce.data?.scenes.some(e=>e.status===`prepared`),Te=!!Ce.data?.scenes.some(e=>e.status===`changed`),Ee=!!Ce.data?.scenes.some(e=>e.status===`following`),De=!!Ce.data?.scenes.length,Oe=!!(w&&w.needsUser.length===0&&w.backgroundCount===0&&Ce.data&&!De),ke=Oe||ne;(0,G.useEffect)(()=>{!ke&&J&&X()},[X,ke,J]),(0,G.useEffect)(()=>{let e=e=>{let t=e.detail?.target;t&&t!==`chat`||!ke||H||(e.preventDefault(),de===`recording`?Z():de===`idle`?(W.current?.focus(),Y()):de===`error`&&he())},t=e=>{let t=e.detail?.target;t&&t!==`chat`||!ke||!J||(e.preventDefault(),X(),W.current?.focus())};return window.addEventListener(R,e),window.addEventListener(te,t),()=>{window.removeEventListener(R,e),window.removeEventListener(te,t)}},[H,X,ke,Z,he,Y,J,de]);let Ae=(0,G.useCallback)(e=>{e||X(),re(e)},[X]),je=(0,G.useMemo)(()=>Oe?null:(0,V.jsxs)(y,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>re(!0),children:[(0,V.jsx)(o,{className:`size-4`,"aria-hidden":!0}),r.newWork]}),[r.newWork,Oe]),Me=(0,G.useCallback)((e,t)=>{if(e.type===`open`){a(e.href);return}if(e.type===`review_judgment`){a(`/assistant-work?item=${encodeURIComponent(e.itemId)}`);return}B(t),L(null),(async()=>{try{e.type===`connector_decision`?await N({kind:`connector_approval`,approvalId:e.approvalId},e.decision):e.type===`retry_run`?await x({kind:e.subjectKind,runId:e.runId}):e.type===`acknowledge_run`&&await O({kind:e.subjectKind,runId:e.runId}),await Q()}catch(e){L(e instanceof Error?e.message:String(e))}finally{B(null)}})()},[Q,a]);(0,G.useLayoutEffect)(()=>(c({startExtra:null,main:(0,V.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:je}),()=>b()),[b,je,c,n.title]);let Ne=(w?.needsUser.length??0)+(Ce.data?.scenes.filter(e=>e.status===`needs_decision`).length??0),Pe=w?.backgroundCount??0,Fe=Ne>0?q(n.home.attentionTitle,{count:Ne}):we?e===`zh`?`助理准备好了这些`:`Your assistant prepared these`:Te?e===`zh`?`有一些值得知道的变化`:`A few changes are worth knowing`:Pe>0?n.home.clearTitle:Ee?e===`zh`?`助理在跟进你交代的事`:`Your assistant is following through`:Ce.data?n.home.idleTitle:e===`zh`?`今天的工作`:`Your work today`,Ie=Ne>0?Pe>0?q(n.home.attentionIntroWithBackground,{count:Pe}):n.home.attentionIntro:we?e===`zh`?`成果已经整理好,可以直接查看或继续办理。`:`The results are ready to review or continue.`:Te?e===`zh`?`这里是可能影响你当前工作的最新变化。`:`These changes may affect your current work.`:Pe>0?q(n.home.clearIntro,{count:Pe}):Ee?e===`zh`?`助理记着这些事项,有实质进展时会带回来。`:`Your assistant remembers these items and will bring back useful progress.`:Ce.data?n.home.idleIntro:e===`zh`?`正在核对已交代的事项。`:`Checking your delegated work.`;return(0,V.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[920px] flex-1 flex-col px-4 py-8 sm:px-6 lg:px-8 lg:py-12`,children:[(0,V.jsx)(`input`,{ref:U.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{let t=e.target.files;t&&$(Array.from(t)),e.target.value=``}}),(0,V.jsx)(_,{open:ne,onOpenChange:Ae,children:(0,V.jsxs)(m,{children:[(0,V.jsx)(d,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,V.jsxs)(h,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(31rem,calc(100dvh-1.5rem))] w-[min(36rem,calc(100vw-1.5rem))] -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,V.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(g,{className:`text-base font-semibold text-fg`,children:r.dialogTitle}),(0,V.jsx)(f,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r.dialogDescription})]}),(0,V.jsx)(p,{asChild:!0,children:(0,V.jsx)(y,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,title:n.cancel,"aria-label":n.cancel,children:(0,V.jsx)(s,{className:`size-4`,"aria-hidden":!0})})})]}),(0,V.jsx)(K,{variant:`dialog`,inputId:`new-conversation-intent`,inputRef:W,intent:ae,labels:{...Se,submit:r.submit},attachments:U.attachments,isDragging:U.isDragging,attachmentBusy:H,attachmentsFull:xe,voice:ue,chat:t.chat,cancelAction:(0,V.jsx)(p,{asChild:!0,children:(0,V.jsx)(y,{type:`button`,variant:`ghost`,children:n.cancel})}),onIntentChange:z,onPickFiles:()=>U.fileInputRef.current?.click(),onRemoveAttachment:U.removeAttachment,onPaste:e=>void ge(e),onDragOver:_e,onDragLeave:ve,onDrop:e=>void ye(e),onSubmit:be})]})]})}),j?(0,V.jsxs)(`div`,{className:`mb-6 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,V.jsx)(`span`,{children:j}),(0,V.jsx)(y,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void Q(),children:n.home.retry})]}):null,ee?(0,V.jsx)(fe,{}):w?(0,V.jsxs)(`div`,{className:Oe?`mx-auto my-auto w-full max-w-[640px]`:`w-full`,children:[(0,V.jsxs)(`section`,{className:Oe?`w-full text-center`:`max-w-3xl`,children:[(0,V.jsx)(`h2`,{className:`text-3xl font-semibold leading-tight tracking-[-0.035em] text-fg sm:text-4xl`,children:Fe}),(0,V.jsx)(`p`,{className:Oe?`mx-auto mt-3 max-w-xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`:`mt-3 max-w-2xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`,children:Ie}),Oe?(0,V.jsx)(K,{variant:`inline`,inputId:`idle-conversation-intent`,inputRef:W,intent:ae,labels:Se,attachments:U.attachments,isDragging:U.isDragging,attachmentBusy:H,attachmentsFull:xe,voice:ue,chat:t.chat,onIntentChange:z,onPickFiles:()=>U.fileInputRef.current?.click(),onRemoveAttachment:U.removeAttachment,onPaste:e=>void ge(e),onDragOver:_e,onDragLeave:ve,onDrop:e=>void ye(e),onSubmit:be}):null]}),w.needsUser.length>0?(0,V.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-needs-user-title`,children:[(0,V.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 px-1`,children:[(0,V.jsx)(oe,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,V.jsx)(`h2`,{id:`home-needs-user-title`,className:`text-sm font-semibold text-fg`,children:n.home.needsUserTitle})]}),(0,V.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base`,children:w.needsUser.map(t=>(0,V.jsx)(pe,{item:t,busy:se===t.id,recommendationLabel:n.home.recommendationLabel,dueLabel:n.home.dueLabel,failureLabel:r.runAttention,locale:e,onAction:Me},t.id))})]}):null,(0,V.jsx)(`section`,{className:Oe?`mt-6 sm:mt-8`:`mt-10`,children:(0,V.jsx)(le,{compact:!0})}),w.background.length>0?(0,V.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-background-title`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-1`,children:[(0,V.jsx)(`h2`,{id:`home-background-title`,className:`text-sm font-semibold text-fg`,children:n.home.backgroundTitle}),(0,V.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:q(n.home.backgroundCount,{count:w.backgroundCount})})]}),(0,V.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle border-y border-edge-subtle`,children:w.background.map(e=>(0,V.jsx)(me,{item:e,onAction:Me},e.id))})]}):null]}):null]})}export{J as HomePage};
|
|
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,t as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as o}from"./plus-Q2yW6OE7.js";import{t as s}from"./x-B_N4OPjy.js";import{t as c}from"./cn-JdwAhgNB.js";import{n as l}from"./locale-store-1urrBBCQ.js";import{t as u}from"./messages-DYFcjtmG.js";import{a as d,i as f,n as p,o as m,r as h,s as g,t as _}from"./dist-BGTk37IG.js";import{i as v}from"./vendor-swr-BIWyz7Rc.js";import{t as y}from"./button-BA45yciM.js";import{t as b}from"./skeleton-BwbyijEw.js";import{As as x,Es as S,Fo as C,Hr as w,Jt as T,Ls as E,Vl as D,Wc as ee,bs as O,bu as k,ca as A,cn as j,go as M,ks as N,ln as P,mi as F,ni as I,nl as L,on as te,pc as ne,pi as re,r as ie,ri as ae,sn as R,wu as z,yu as oe}from"./index-CHgOG1aR.js";import{n as se}from"./tab-completion-input-D64VNmiA.js";var B=n(),V=r(),H={meeting_preparation:{Icon:z,en:`Next meeting`,zh:`下一场会议`},project_momentum:{Icon:D,en:`Project momentum`,zh:`项目进展`},communication_follow_up:{Icon:L,en:`Waiting on a reply`,zh:`沟通跟进`}},ce={needs_decision:{en:`Needs your decision`,zh:`需要你决定`},prepared:{en:`Ready for you`,zh:`已为你准备好`},changed:{en:`Something changed`,zh:`出现了新变化`},following:{en:`Following quietly`,zh:`正在安静跟进`}};function U(e){let t=(0,B.c)(56),{scene:n,zh:r}=e,i=H[n.kind],o=ce[n.status],s=n.card?`/assistant-work?item=${encodeURIComponent(n.card.id)}`:n.object?.route??n.manageRoute,c=n.status===`needs_decision`?r?`查看并决定`:`Review and decide`:n.status===`prepared`?r?`查看准备结果`:`Open prepared work`:n.status===`changed`?r?`查看变化`:`Review change`:n.object?r?`打开${n.kind===`project_momentum`?`项目`:`相关内容`}`:`Open context`:r?`查看安排`:`View arrangement`,l;t[0]===i.Icon?l=t[1]:(l=(0,V.jsx)(`span`,{className:`mt-0.5 rounded-xl bg-accent-soft p-2 text-accent`,children:(0,V.jsx)(i.Icon,{className:`size-4`,"aria-hidden":!0})}),t[0]=i.Icon,t[1]=l);let u=r?i.zh:i.en,d;t[2]===u?d=t[3]:(d=(0,V.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:u}),t[2]=u,t[3]=d);let f=n.status===`following`?`text-xs text-fg-subtle`:`text-xs font-medium text-accent`,p=r?o.zh:o.en,m;t[4]!==f||t[5]!==p?(m=(0,V.jsx)(`span`,{className:f,children:p}),t[4]=f,t[5]=p,t[6]=m):m=t[6];let h;t[7]!==d||t[8]!==m?(h=(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[d,m]}),t[7]=d,t[8]=m,t[9]=h):h=t[9];let g;t[10]===n.title?g=t[11]:(g=(0,V.jsx)(`h3`,{className:`mt-1 font-semibold text-fg`,children:n.title}),t[10]=n.title,t[11]=g);let _;t[12]!==h||t[13]!==g?(_=(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[h,g]}),t[12]=h,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==l||t[16]!==_?(v=(0,V.jsxs)(`div`,{className:`flex items-start gap-3 border-b border-edge-subtle px-5 py-4`,children:[l,_]}),t[15]=l,t[16]=_,t[17]=v):v=t[17];let y=r?`现在`:`Now`,b;t[18]===y?b=t[19]:(b=(0,V.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:y}),t[18]=y,t[19]=b);let x;t[20]===n.moment?x=t[21]:(x=(0,V.jsx)(`p`,{className:`mt-1 text-sm font-medium text-fg`,children:n.moment}),t[20]=n.moment,t[21]=x);let S;t[22]!==b||t[23]!==x?(S=(0,V.jsxs)(`div`,{children:[b,x]}),t[22]=b,t[23]=x,t[24]=S):S=t[24];let C=n.status===`following`?r?`跟进要求`:`What the assistant remembers`:r?`为什么值得关注`:`Why it matters`,w;t[25]===C?w=t[26]:(w=(0,V.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:C}),t[25]=C,t[26]=w);let T=n.status===`following`?n.promise:n.relevance,E;t[27]===T?E=t[28]:(E=(0,V.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:T}),t[27]=T,t[28]=E);let D;t[29]!==w||t[30]!==E?(D=(0,V.jsxs)(`div`,{children:[w,E]}),t[29]=w,t[30]=E,t[31]=D):D=t[31];let ee=r?`助理已经做了什么`:`What your assistant did`,O;t[32]===ee?O=t[33]:(O=(0,V.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:ee}),t[32]=ee,t[33]=O);let k;t[34]===n.help?k=t[35]:(k=(0,V.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:n.help}),t[34]=n.help,t[35]=k);let A;t[36]!==O||t[37]!==k?(A=(0,V.jsxs)(`div`,{className:`rounded-xl bg-surface-hover px-4 py-3`,children:[O,k]}),t[36]=O,t[37]=k,t[38]=A):A=t[38];let j;t[39]!==c||t[40]!==s?(j=(0,V.jsx)(a,{className:`text-sm font-medium text-accent`,to:s,children:c}),t[39]=c,t[40]=s,t[41]=j):j=t[41];let M=r?`调整助理跟进`:`Adjust arrangement`,N;t[42]!==n.manageRoute||t[43]!==M?(N=(0,V.jsx)(a,{className:`text-xs text-fg-subtle hover:text-fg`,to:n.manageRoute,children:M}),t[42]=n.manageRoute,t[43]=M,t[44]=N):N=t[44];let P;t[45]!==j||t[46]!==N?(P=(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[j,N]}),t[45]=j,t[46]=N,t[47]=P):P=t[47];let F;t[48]!==S||t[49]!==D||t[50]!==A||t[51]!==P?(F=(0,V.jsxs)(`div`,{className:`space-y-4 px-5 py-4`,children:[S,D,A,P]}),t[48]=S,t[49]=D,t[50]=A,t[51]=P,t[52]=F):F=t[52];let I;return t[53]!==v||t[54]!==F?(I=(0,V.jsxs)(`article`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:[v,F]}),t[53]=v,t[54]=F,t[55]=I):I=t[55],I}function le(e){let t=(0,B.c)(42),{compact:n}=e,r=n===void 0?!1:n,i=l(W)===`zh`,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={refreshInterval:15e3},t[0]=o):o=t[0];let s=v(`/api/proactive/overview`,T,o);if(s.isLoading){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,V.jsx)(b,{className:`h-44 rounded-2xl`}),t[1]=e):e=t[1],e}if(s.error){let e=String(s.error),n;return t[2]===e?n=t[3]:(n=(0,V.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:e}),t[2]=e,t[3]=n),n}let c;t[4]===s.data?.scenes?c=t[5]:(c=s.data?.scenes??[],t[4]=s.data?.scenes,t[5]=c);let u=c;if(!u.length){let e=r?`px-4 text-center`:`rounded-2xl border border-edge bg-surface-panel p-6`,n=r?`text-sm font-medium text-fg-muted`:`font-medium text-fg`,a=i?`今天没有需要你接手的变化`:`Nothing needs your attention today`,o;t[6]!==n||t[7]!==a?(o=(0,V.jsx)(`h2`,{className:n,children:a}),t[6]=n,t[7]=a,t[8]=o):o=t[8];let s=r?`mx-auto mt-2 max-w-lg text-xs leading-5 text-fg-subtle`:`mt-2 text-sm text-fg-muted`,c=i?`继续工作即可。需要持续关注的事,可以直接在项目或对话里交给助理。`:`Keep working. You can ask the assistant to follow something from its project or conversation.`,l;t[9]!==s||t[10]!==c?(l=(0,V.jsx)(`p`,{className:s,children:c}),t[9]=s,t[10]=c,t[11]=l):l=t[11];let u;return t[12]!==l||t[13]!==e||t[14]!==o?(u=(0,V.jsxs)(`section`,{className:e,children:[o,l]}),t[12]=l,t[13]=e,t[14]=o,t[15]=u):u=t[15],u}let d;t[16]!==r||t[17]!==u?(d=r?u.slice(0,3):u,t[16]=r,t[17]=u,t[18]=d):d=t[18];let f=d,p=i?`正在发生的事`:`What is happening`,m;t[19]===p?m=t[20]:(m=(0,V.jsx)(`h2`,{id:`proactive-scenes-title`,className:`text-sm font-semibold text-fg`,children:p}),t[19]=p,t[20]=m);let h=i?`助理跟进`:`Assistant follow-ups`,g;t[21]===h?g=t[22]:(g=(0,V.jsx)(a,{className:`text-xs text-fg-subtle hover:text-accent`,to:`/assistant-work`,children:h}),t[21]=h,t[22]=g);let _;t[23]!==m||t[24]!==g?(_=(0,V.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3 px-1`,children:[m,g]}),t[23]=m,t[24]=g,t[25]=_):_=t[25];let y;if(t[26]!==f||t[27]!==i){let e;t[29]===i?e=t[30]:(e=e=>(0,V.jsx)(U,{scene:e,zh:i},e.id),t[29]=i,t[30]=e),y=f.map(e),t[26]=f,t[27]=i,t[28]=y}else y=t[28];let x;t[31]===y?x=t[32]:(x=(0,V.jsx)(`div`,{className:`space-y-3`,children:y}),t[31]=y,t[32]=x);let S;t[33]!==r||t[34]!==u.length||t[35]!==f.length||t[36]!==i?(S=r&&u.length>f.length&&(0,V.jsx)(a,{className:`mt-3 block text-sm text-accent`,to:`/assistant-work`,children:i?`还有 ${u.length-f.length} 个场景`:`${u.length-f.length} more scenes`}),t[33]=r,t[34]=u.length,t[35]=f.length,t[36]=i,t[37]=S):S=t[37];let C;return t[38]!==x||t[39]!==S||t[40]!==_?(C=(0,V.jsxs)(`section`,{"aria-labelledby":`proactive-scenes-title`,children:[_,x,S]}),t[38]=x,t[39]=S,t[40]=_,t[41]=C):C=t[41],C}function W(e){return e.language}var G=e(t(),1),ue=12e3;function K(e){let t=(0,B.c)(106),{variant:n,inputId:r,inputRef:i,intent:a,labels:o,attachments:s,isDragging:l,attachmentBusy:u,attachmentsFull:d,voice:f,chat:p,cancelAction:m,onIntentChange:h,onPickFiles:g,onRemoveAttachment:_,onPaste:v,onDragOver:b,onDragLeave:x,onDrop:S,onSubmit:C}=e,w=n===`inline`,T;t[0]!==s||t[1]!==a?(T=!!a.trim()||s.length>0,t[0]=s,t[1]=a,t[2]=T):T=t[2];let E=T,D=f.voiceActive&&f.phase!==`error`,O;t[3]!==C||t[4]!==f.voiceActive?(O=e=>{if(f.voiceActive){e.preventDefault();return}C(e)},t[3]=C,t[4]=f.voiceActive,t[5]=O):O=t[5];let k=w?`mx-auto mt-6 w-full overflow-hidden rounded-xl border border-edge bg-surface-base p-2 text-left shadow-surface transition-colors focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15 sm:mt-8`:`flex min-h-0 flex-1 flex-col`,A;t[6]===k?A=t[7]:(A=c(`relative`,k),t[6]=k,t[7]=A);let M;t[8]!==w||t[9]!==l||t[10]!==o.dropFiles?(M=l?(0,V.jsx)(`div`,{className:c(`pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-accent-soft/90 text-sm font-medium text-accent-fg backdrop-blur-[1px]`,w&&`rounded-2xl`),children:o.dropFiles}):null,t[8]=w,t[9]=l,t[10]=o.dropFiles,t[11]=M):M=t[11];let N=!w&&`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,P;t[12]===N?P=t[13]:(P=c(N),t[12]=N,t[13]=P);let F=w?`sr-only`:`mb-2 shrink-0 text-sm font-medium text-fg`,I;t[14]!==r||t[15]!==o.intentLabel||t[16]!==F?(I=(0,V.jsx)(`label`,{htmlFor:r,className:F,children:o.intentLabel}),t[14]=r,t[15]=o.intentLabel,t[16]=F,t[17]=I):I=t[17];let L;t[18]!==u||t[19]!==p||t[20]!==f.audioLevel||t[21]!==f.cancelVoiceInput||t[22]!==f.confirmVoiceInput||t[23]!==f.elapsedLabel||t[24]!==f.error||t[25]!==f.finalTranscript||t[26]!==f.partialTranscript||t[27]!==f.phase||t[28]!==f.retryVoiceInput||t[29]!==f.settingsRequired||t[30]!==f.voiceActive?(L=f.voiceActive?(0,V.jsx)(j,{phase:f.phase,elapsedLabel:f.elapsedLabel,audioLevel:f.audioLevel,partialTranscript:f.partialTranscript,finalTranscript:f.finalTranscript,error:f.error,settingsRequired:f.settingsRequired,disabled:u,chat:p,onCancel:f.cancelVoiceInput,onConfirm:f.confirmVoiceInput,onRetry:f.retryVoiceInput}):null,t[18]=u,t[19]=p,t[20]=f.audioLevel,t[21]=f.cancelVoiceInput,t[22]=f.confirmVoiceInput,t[23]=f.elapsedLabel,t[24]=f.error,t[25]=f.finalTranscript,t[26]=f.partialTranscript,t[27]=f.phase,t[28]=f.retryVoiceInput,t[29]=f.settingsRequired,t[30]=f.voiceActive,t[31]=L):L=t[31];let te=D&&`hidden`,ie=w?`min-h-24 bg-transparent px-3 py-2`:`min-h-32 flex-1 rounded-xl border border-edge bg-surface-base p-3 focus:border-accent focus:ring-2 focus:ring-accent/20`,R;t[32]!==te||t[33]!==ie?(R=c(`w-full resize-none text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle`,te,ie),t[32]=te,t[33]=ie,t[34]=R):R=t[34];let z;t[35]===h?z=t[36]:(z=e=>h(e.target.value),t[35]=h,t[36]=z);let oe=!w,H;t[37]!==r||t[38]!==i||t[39]!==a||t[40]!==o.intentPlaceholder||t[41]!==o.intentSuggestion||t[42]!==h||t[43]!==v||t[44]!==R||t[45]!==z||t[46]!==oe?(H=(0,V.jsx)(se,{ref:i,id:r,className:R,value:a,onChange:z,onPaste:v,suggestion:o.intentSuggestion,onAcceptSuggestion:h,onKeyDown:de,placeholder:o.intentPlaceholder,maxLength:ue,autoFocus:oe}),t[37]=r,t[38]=i,t[39]=a,t[40]=o.intentPlaceholder,t[41]=o.intentSuggestion,t[42]=h,t[43]=v,t[44]=R,t[45]=z,t[46]=oe,t[47]=H):H=t[47];let ce=w?`border-b-0 bg-transparent px-3 pb-2 pt-0`:`mt-3 border-b-0 bg-transparent px-0 pb-0`,U;t[48]!==s||t[49]!==_||t[50]!==ce?(U=(0,V.jsx)(re,{attachments:s,topPadded:!1,onRemove:_,className:ce}),t[48]=s,t[49]=_,t[50]=ce,t[51]=U):U=t[51];let le;t[52]!==w||t[53]!==a.length||t[54]!==o.shortcut?(le=w?null:(0,V.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,V.jsx)(`span`,{children:o.shortcut}),(0,V.jsxs)(`span`,{className:`tabular-nums`,children:[a.length.toLocaleString(),` / `,ue.toLocaleString()]})]}),t[52]=w,t[53]=a.length,t[54]=o.shortcut,t[55]=le):le=t[55];let W;t[56]!==L||t[57]!==H||t[58]!==U||t[59]!==le||t[60]!==P||t[61]!==I?(W=(0,V.jsxs)(`div`,{className:P,children:[I,L,H,U,le]}),t[56]=L,t[57]=H,t[58]=U,t[59]=le,t[60]=P,t[61]=I,t[62]=W):W=t[62];let G=w?`border-edge-subtle px-1 pt-2`:`border-edge px-5 py-4`,K;t[63]===G?K=t[64]:(K=c(`flex shrink-0 items-center gap-2 border-t`,G),t[63]=G,t[64]=K);let q=!w&&`mr-auto`,fe;t[65]===q?fe=t[66]:(fe=c(`flex items-center gap-1`,q),t[65]=q,t[66]=fe);let pe=u||d,me;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,V.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t[67]=me):me=t[67];let J;t[68]!==o.attachTitle||t[69]!==g||t[70]!==pe?(J=(0,V.jsx)(y,{type:`button`,variant:`ghost`,className:`size-9 rounded-lg p-0`,disabled:pe,title:o.attachTitle,"aria-label":o.attachTitle,onClick:g,children:me}),t[68]=o.attachTitle,t[69]=g,t[70]=pe,t[71]=J):J=t[71];let Y;t[72]!==u||t[73]!==p||t[74]!==f.startVoiceInput||t[75]!==f.voiceActive?(Y=f.voiceActive?null:(0,V.jsx)(ae,{disabled:u,chat:p,onStart:f.startVoiceInput}),t[72]=u,t[73]=p,t[74]=f.startVoiceInput,t[75]=f.voiceActive,t[76]=Y):Y=t[76];let X;t[77]!==fe||t[78]!==J||t[79]!==Y?(X=(0,V.jsxs)(`div`,{className:fe,children:[J,Y]}),t[77]=fe,t[78]=J,t[79]=Y,t[80]=X):X=t[80];let Z;t[81]!==m||t[82]!==w||t[83]!==o.shortcut?(Z=w?(0,V.jsx)(`span`,{className:`hidden text-[11px] text-fg-subtle sm:inline`,children:o.shortcut}):m,t[81]=m,t[82]=w,t[83]=o.shortcut,t[84]=Z):Z=t[84];let he=w?`ml-auto h-9 rounded-lg px-3.5 text-xs`:`min-w-32`,Q=!E||u||f.voiceActive,$=w?`size-3.5`:`size-4`,ge;t[85]===$?ge=t[86]:(ge=(0,V.jsx)(ne,{className:$,"aria-hidden":!0}),t[85]=$,t[86]=ge);let _e;t[87]!==o.submit||t[88]!==he||t[89]!==Q||t[90]!==ge?(_e=(0,V.jsxs)(y,{type:`submit`,variant:`primary`,className:he,disabled:Q,children:[ge,o.submit]}),t[87]=o.submit,t[88]=he,t[89]=Q,t[90]=ge,t[91]=_e):_e=t[91];let ve;t[92]!==K||t[93]!==X||t[94]!==Z||t[95]!==_e?(ve=(0,V.jsxs)(`div`,{className:K,children:[X,Z,_e]}),t[92]=K,t[93]=X,t[94]=Z,t[95]=_e,t[96]=ve):ve=t[96];let ye;return t[97]!==x||t[98]!==b||t[99]!==S||t[100]!==O||t[101]!==W||t[102]!==ve||t[103]!==A||t[104]!==M?(ye=(0,V.jsxs)(`form`,{onSubmit:O,onDragOver:b,onDragLeave:x,onDrop:S,className:A,children:[M,W,ve]}),t[97]=x,t[98]=b,t[99]=S,t[100]=O,t[101]=W,t[102]=ve,t[103]=A,t[104]=M,t[105]=ye):ye=t[105],ye}function de(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}function q(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function fe(){let e=(0,B.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,V.jsxs)(`div`,{className:`space-y-8`,"aria-busy":!0,children:[(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(b,{className:`h-10 w-3/5 rounded-xl`}),(0,V.jsx)(b,{className:`h-5 w-4/5 rounded-lg`})]}),(0,V.jsx)(b,{className:`h-64 rounded-2xl`}),(0,V.jsx)(b,{className:`h-32 rounded-xl`})]}),e[0]=t):t=e[0],t}function pe(e){let t=(0,B.c)(33),{item:n,busy:r,recommendationLabel:i,dueLabel:a,failureLabel:o,locale:s,onAction:c}=e,l;t[0]!==a||t[1]!==n.dueAt||t[2]!==s?(l=n.dueAt?`${a} ${w(new Date(n.dueAt),s)}`:null,t[0]=a,t[1]=n.dueAt,t[2]=s,t[3]=l):l=t[3];let u=l,d=n.kind===`failure`?o:u,f;t[4]===d?f=t[5]:(f=d?(0,V.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs font-medium text-warning`,children:[(0,V.jsx)(`span`,{className:`size-1.5 rounded-full bg-warning`,"aria-hidden":!0}),(0,V.jsx)(`span`,{children:d})]}):null,t[4]=d,t[5]=f);let p=!n.openAction,m;t[6]!==n.id||t[7]!==n.openAction||t[8]!==c?(m=()=>n.openAction&&c(n.openAction,n.id),t[6]=n.id,t[7]=n.openAction,t[8]=c,t[9]=m):m=t[9];let h;t[10]===n.title?h=t[11]:(h=(0,V.jsx)(`span`,{className:`block text-lg font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[10]=n.title,t[11]=h);let g;t[12]===n.summary?g=t[13]:(g=(0,V.jsx)(`span`,{className:`mt-1.5 block text-sm leading-6 text-fg-muted`,children:n.summary}),t[12]=n.summary,t[13]=g);let _;t[14]!==p||t[15]!==m||t[16]!==h||t[17]!==g?(_=(0,V.jsxs)(`button`,{type:`button`,className:`block w-full text-left outline-none focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:p,onClick:m,children:[h,g]}),t[14]=p,t[15]=m,t[16]=h,t[17]=g,t[18]=_):_=t[18];let v;t[19]!==n.recommendation||t[20]!==i?(v=n.recommendation?(0,V.jsxs)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:[(0,V.jsxs)(`span`,{className:`font-semibold text-fg`,children:[i,`:`]}),n.recommendation]}):null,t[19]=n.recommendation,t[20]=i,t[21]=v):v=t[21];let b;t[22]!==r||t[23]!==n.id||t[24]!==n.primaryAction||t[25]!==n.secondaryActions||t[26]!==c?(b=n.primaryAction||n.secondaryActions.length>0?(0,V.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[n.primaryAction?(0,V.jsx)(y,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3.5 text-xs`,disabled:r,onClick:()=>c(n.primaryAction,n.id),children:n.primaryAction.label}):null,n.secondaryActions.map(e=>(0,V.jsx)(y,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3.5 text-xs shadow-none`,disabled:r,onClick:()=>c(e,n.id),children:e.label},`${e.type}:${e.label}`))]}):null,t[22]=r,t[23]=n.id,t[24]=n.primaryAction,t[25]=n.secondaryActions,t[26]=c,t[27]=b):b=t[27];let x;return t[28]!==f||t[29]!==_||t[30]!==v||t[31]!==b?(x=(0,V.jsxs)(`article`,{className:`px-5 py-5 sm:px-6 sm:py-6`,children:[f,_,v,b]}),t[28]=f,t[29]=_,t[30]=v,t[31]=b,t[32]=x):x=t[32],x}function me(e){let t=(0,B.c)(26),{item:n,onAction:r}=e,i;t[0]===n.kind?i=t[1]:(i=n.kind===`scheduled`?(0,V.jsx)(z,{className:`size-4`,"aria-hidden":!0}):(0,V.jsx)(`span`,{className:`size-1.5 rounded-full bg-success`,"aria-hidden":!0}),t[0]=n.kind,t[1]=i);let a=i,o=!n.openAction,s;t[2]!==n.id||t[3]!==n.openAction||t[4]!==r?(s=()=>n.openAction&&r(n.openAction,n.id),t[2]=n.id,t[3]=n.openAction,t[4]=r,t[5]=s):s=t[5];let c;t[6]===a?c=t[7]:(c=(0,V.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center text-fg-subtle`,children:a}),t[6]=a,t[7]=c);let l;t[8]===n.title?l=t[9]:(l=(0,V.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:n.title}),t[8]=n.title,t[9]=l);let u;t[10]===n.summary?u=t[11]:(u=(0,V.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.summary}),t[10]=n.summary,t[11]=u);let d;t[12]!==l||t[13]!==u?(d=(0,V.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[l,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14];let f;t[15]===n.statusLabel?f=t[16]:(f=n.statusLabel?(0,V.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.statusLabel}):null,t[15]=n.statusLabel,t[16]=f);let p;t[17]===n.openAction?p=t[18]:(p=n.openAction?(0,V.jsx)(k,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[17]=n.openAction,t[18]=p);let m;return t[19]!==o||t[20]!==s||t[21]!==c||t[22]!==d||t[23]!==f||t[24]!==p?(m=(0,V.jsxs)(`button`,{type:`button`,className:`flex min-h-16 w-full items-center gap-3 py-3 text-left outline-none hover:text-fg focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:o,onClick:s,children:[c,d,f,p]}),t[19]=o,t[20]=s,t[21]=c,t[22]=d,t[23]=f,t[24]=p,t[25]=m):m=t[25],m}function J(){let e=l(e=>e.language),t=u(e),n=t.projectsPage,r=E(e),a=i(),c=M(e=>e.setPageHeader),b=M(e=>e.clearPageHeader),[w,D]=(0,G.useState)(null),[ee,k]=(0,G.useState)(!0),[j,L]=(0,G.useState)(null),[ne,re]=(0,G.useState)(!1),[ae,z]=(0,G.useState)(``),[se,B]=(0,G.useState)(null),[H,ce]=(0,G.useState)(!1),U=I({chat:t.chat}),W=(0,G.useRef)(null),ue=C({disabled:H,chat:t.chat,onTranscript:e=>{z(t=>P(t,e)),window.setTimeout(()=>W.current?.focus(),0)}}),{phase:de,voiceActive:J,startVoiceInput:Y,cancelVoiceInput:X,confirmVoiceInput:Z,retryVoiceInput:he}=ue,Q=(0,G.useCallback)(async(t=!1)=>{t&&k(!0),L(null);try{let t=await S(e);D({...t,needsUser:t.needsUser.filter(e=>e.primaryAction?.type!==`review_judgment`&&e.openAction?.type!==`review_judgment`),background:t.background.filter(e=>e.primaryAction?.type!==`review_judgment`&&e.openAction?.type!==`review_judgment`)})}catch(e){L(e instanceof Error?e.message:String(e))}finally{k(!1)}},[e]);(0,G.useEffect)(()=>{Q(!0)},[Q]),(0,G.useEffect)(()=>{let e,t=t=>{e!==void 0&&window.clearTimeout(e),e=window.setTimeout(()=>{e=void 0,Q()},t)},n=()=>t(100),r=()=>t(750),i=[`session-created`,`agent-run-started`,`agent-run-ended`,`automation-run-completed`,`workflow-run-updated`,`workflow-run-error`],a=[`session-updated`,`session-transcript-updated`];return i.forEach(e=>window.addEventListener(e,n)),a.forEach(e=>window.addEventListener(e,r)),()=>{i.forEach(e=>window.removeEventListener(e,n)),a.forEach(e=>window.removeEventListener(e,r)),e!==void 0&&window.clearTimeout(e)}},[Q]);let $=(0,G.useCallback)(async e=>{if(!(e.length===0||H)){ce(!0);try{await U.processFiles(e)}finally{ce(!1)}}},[H,U.processFiles]),ge=(0,G.useCallback)(async e=>{let t=F(e.clipboardData);t.length!==0&&(e.preventDefault(),await $(t))},[$]),_e=(0,G.useCallback)(e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,U.setIsDragging(!0))},[U.setIsDragging]),ve=(0,G.useCallback)(e=>{let t=e.relatedTarget;(!(t instanceof Node)||!e.currentTarget.contains(t))&&U.setIsDragging(!1)},[U.setIsDragging]),ye=(0,G.useCallback)(async e=>{e.preventDefault(),U.setIsDragging(!1),await $(Array.from(e.dataTransfer.files))},[U.setIsDragging,$]),be=(0,G.useCallback)(e=>{e.preventDefault();let t=U.wireAttachmentsPayload(),n=A(ae,t.length>0?ie(t):void 0,{projectScope:`none`});n&&(re(!1),z(``),U.clearAttachments(),a(n))},[U.clearAttachments,U.wireAttachmentsPayload,ae,a]),xe=U.attachments.length>=10,Se={attachTitle:xe?q(t.chat.maxAttachmentsReached,{max:10}):`${t.chat.attachFile} (${U.attachments.length}/10)`,dropFiles:t.chat.dropFiles,intentLabel:r.intentLabel,intentPlaceholder:r.intentPlaceholder,intentSuggestion:r.intentSuggestion,shortcut:n.home.submitShortcut,submit:r.newWork},Ce=v(`/api/proactive/overview`,T,{refreshInterval:15e3}),we=!!Ce.data?.scenes.some(e=>e.status===`prepared`),Te=!!Ce.data?.scenes.some(e=>e.status===`changed`),Ee=!!Ce.data?.scenes.some(e=>e.status===`following`),De=!!Ce.data?.scenes.length,Oe=!!(w&&w.needsUser.length===0&&w.backgroundCount===0&&Ce.data&&!De),ke=Oe||ne;(0,G.useEffect)(()=>{!ke&&J&&X()},[X,ke,J]),(0,G.useEffect)(()=>{let e=e=>{let t=e.detail?.target;t&&t!==`chat`||!ke||H||(e.preventDefault(),de===`recording`?Z():de===`idle`?(W.current?.focus(),Y()):de===`error`&&he())},t=e=>{let t=e.detail?.target;t&&t!==`chat`||!ke||!J||(e.preventDefault(),X(),W.current?.focus())};return window.addEventListener(R,e),window.addEventListener(te,t),()=>{window.removeEventListener(R,e),window.removeEventListener(te,t)}},[H,X,ke,Z,he,Y,J,de]);let Ae=(0,G.useCallback)(e=>{e||X(),re(e)},[X]),je=(0,G.useMemo)(()=>Oe?null:(0,V.jsxs)(y,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>re(!0),children:[(0,V.jsx)(o,{className:`size-4`,"aria-hidden":!0}),r.newWork]}),[r.newWork,Oe]),Me=(0,G.useCallback)((e,t)=>{if(e.type===`open`){a(e.href);return}if(e.type===`review_judgment`){a(`/assistant-work?item=${encodeURIComponent(e.itemId)}`);return}B(t),L(null),(async()=>{try{e.type===`connector_decision`?await N({kind:`connector_approval`,approvalId:e.approvalId},e.decision):e.type===`retry_run`?await x({kind:e.subjectKind,runId:e.runId}):e.type===`acknowledge_run`&&await O({kind:e.subjectKind,runId:e.runId}),await Q()}catch(e){L(e instanceof Error?e.message:String(e))}finally{B(null)}})()},[Q,a]);(0,G.useLayoutEffect)(()=>(c({startExtra:null,main:(0,V.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:je}),()=>b()),[b,je,c,n.title]);let Ne=(w?.needsUser.length??0)+(Ce.data?.scenes.filter(e=>e.status===`needs_decision`).length??0),Pe=w?.backgroundCount??0,Fe=Ne>0?q(n.home.attentionTitle,{count:Ne}):we?e===`zh`?`助理准备好了这些`:`Your assistant prepared these`:Te?e===`zh`?`有一些值得知道的变化`:`A few changes are worth knowing`:Pe>0?n.home.clearTitle:Ee?e===`zh`?`助理在跟进你交代的事`:`Your assistant is following through`:Ce.data?n.home.idleTitle:e===`zh`?`今天的工作`:`Your work today`,Ie=Ne>0?Pe>0?q(n.home.attentionIntroWithBackground,{count:Pe}):n.home.attentionIntro:we?e===`zh`?`成果已经整理好,可以直接查看或继续办理。`:`The results are ready to review or continue.`:Te?e===`zh`?`这里是可能影响你当前工作的最新变化。`:`These changes may affect your current work.`:Pe>0?q(n.home.clearIntro,{count:Pe}):Ee?e===`zh`?`助理记着这些事项,有实质进展时会带回来。`:`Your assistant remembers these items and will bring back useful progress.`:Ce.data?n.home.idleIntro:e===`zh`?`正在核对已交代的事项。`:`Checking your delegated work.`;return(0,V.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[920px] flex-1 flex-col px-4 py-8 sm:px-6 lg:px-8 lg:py-12`,children:[(0,V.jsx)(`input`,{ref:U.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{let t=e.target.files;t&&$(Array.from(t)),e.target.value=``}}),(0,V.jsx)(_,{open:ne,onOpenChange:Ae,children:(0,V.jsxs)(m,{children:[(0,V.jsx)(d,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,V.jsxs)(h,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(31rem,calc(100dvh-1.5rem))] w-[min(36rem,calc(100vw-1.5rem))] -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,V.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(g,{className:`text-base font-semibold text-fg`,children:r.dialogTitle}),(0,V.jsx)(f,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r.dialogDescription})]}),(0,V.jsx)(p,{asChild:!0,children:(0,V.jsx)(y,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,title:n.cancel,"aria-label":n.cancel,children:(0,V.jsx)(s,{className:`size-4`,"aria-hidden":!0})})})]}),(0,V.jsx)(K,{variant:`dialog`,inputId:`new-conversation-intent`,inputRef:W,intent:ae,labels:{...Se,submit:r.submit},attachments:U.attachments,isDragging:U.isDragging,attachmentBusy:H,attachmentsFull:xe,voice:ue,chat:t.chat,cancelAction:(0,V.jsx)(p,{asChild:!0,children:(0,V.jsx)(y,{type:`button`,variant:`ghost`,children:n.cancel})}),onIntentChange:z,onPickFiles:()=>U.fileInputRef.current?.click(),onRemoveAttachment:U.removeAttachment,onPaste:e=>void ge(e),onDragOver:_e,onDragLeave:ve,onDrop:e=>void ye(e),onSubmit:be})]})]})}),j?(0,V.jsxs)(`div`,{className:`mb-6 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,V.jsx)(`span`,{children:j}),(0,V.jsx)(y,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void Q(),children:n.home.retry})]}):null,ee?(0,V.jsx)(fe,{}):w?(0,V.jsxs)(`div`,{className:Oe?`mx-auto my-auto w-full max-w-[640px]`:`w-full`,children:[(0,V.jsxs)(`section`,{className:Oe?`w-full text-center`:`max-w-3xl`,children:[(0,V.jsx)(`h2`,{className:`text-3xl font-semibold leading-tight tracking-[-0.035em] text-fg sm:text-4xl`,children:Fe}),(0,V.jsx)(`p`,{className:Oe?`mx-auto mt-3 max-w-xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`:`mt-3 max-w-2xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`,children:Ie}),Oe?(0,V.jsx)(K,{variant:`inline`,inputId:`idle-conversation-intent`,inputRef:W,intent:ae,labels:Se,attachments:U.attachments,isDragging:U.isDragging,attachmentBusy:H,attachmentsFull:xe,voice:ue,chat:t.chat,onIntentChange:z,onPickFiles:()=>U.fileInputRef.current?.click(),onRemoveAttachment:U.removeAttachment,onPaste:e=>void ge(e),onDragOver:_e,onDragLeave:ve,onDrop:e=>void ye(e),onSubmit:be}):null]}),w.needsUser.length>0?(0,V.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-needs-user-title`,children:[(0,V.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 px-1`,children:[(0,V.jsx)(oe,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,V.jsx)(`h2`,{id:`home-needs-user-title`,className:`text-sm font-semibold text-fg`,children:n.home.needsUserTitle})]}),(0,V.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base`,children:w.needsUser.map(t=>(0,V.jsx)(pe,{item:t,busy:se===t.id,recommendationLabel:n.home.recommendationLabel,dueLabel:n.home.dueLabel,failureLabel:r.runAttention,locale:e,onAction:Me},t.id))})]}):null,(0,V.jsx)(`section`,{className:Oe?`mt-6 sm:mt-8`:`mt-10`,children:(0,V.jsx)(le,{compact:!0})}),w.background.length>0?(0,V.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-background-title`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-1`,children:[(0,V.jsx)(`h2`,{id:`home-background-title`,className:`text-sm font-semibold text-fg`,children:n.home.backgroundTitle}),(0,V.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:q(n.home.backgroundCount,{count:w.backgroundCount})})]}),(0,V.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle border-y border-edge-subtle`,children:w.background.map(e=>(0,V.jsx)(me,{item:e,onAction:Me},e.id))})]}):null]}):null]})}export{J as HomePage};
|