botmux 3.18.6 → 3.18.7
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/.runtime-build-id +1 -1
- package/dist/adapters/backend/riff-backend.d.ts +158 -0
- package/dist/adapters/backend/riff-backend.d.ts.map +1 -1
- package/dist/adapters/backend/riff-backend.js +330 -7
- package/dist/adapters/backend/riff-backend.js.map +1 -1
- package/dist/adapters/backend/sandbox.d.ts +42 -0
- package/dist/adapters/backend/sandbox.d.ts.map +1 -1
- package/dist/adapters/backend/sandbox.js +95 -5
- package/dist/adapters/backend/sandbox.js.map +1 -1
- package/dist/adapters/cli/codex-app.d.ts.map +1 -1
- package/dist/adapters/cli/codex-app.js +2 -1
- package/dist/adapters/cli/codex-app.js.map +1 -1
- package/dist/adapters/cli/dsh.d.ts.map +1 -1
- package/dist/adapters/cli/dsh.js +2 -1
- package/dist/adapters/cli/dsh.js.map +1 -1
- package/dist/adapters/cli/mir.d.ts.map +1 -1
- package/dist/adapters/cli/mir.js +2 -1
- package/dist/adapters/cli/mir.js.map +1 -1
- package/dist/adapters/cli/mira.d.ts.map +1 -1
- package/dist/adapters/cli/mira.js +2 -1
- package/dist/adapters/cli/mira.js.map +1 -1
- package/dist/adapters/hook-command.d.ts +3 -5
- package/dist/adapters/hook-command.d.ts.map +1 -1
- package/dist/adapters/hook-command.js +59 -13
- package/dist/adapters/hook-command.js.map +1 -1
- package/dist/autostart.d.ts +76 -0
- package/dist/autostart.d.ts.map +1 -1
- package/dist/autostart.js +105 -28
- package/dist/autostart.js.map +1 -1
- package/dist/bot-registry.d.ts +12 -0
- package/dist/bot-registry.d.ts.map +1 -1
- package/dist/bot-registry.js +43 -3
- package/dist/bot-registry.js.map +1 -1
- package/dist/cli/dashboard-command.d.ts +142 -0
- package/dist/cli/dashboard-command.d.ts.map +1 -1
- package/dist/cli/dashboard-command.js +160 -0
- package/dist/cli/dashboard-command.js.map +1 -1
- package/dist/cli/dashboard-endpoint.d.ts +66 -0
- package/dist/cli/dashboard-endpoint.d.ts.map +1 -1
- package/dist/cli/dashboard-endpoint.js +144 -30
- package/dist/cli/dashboard-endpoint.js.map +1 -1
- package/dist/cli/send-dispatch.d.ts +2 -0
- package/dist/cli/send-dispatch.d.ts.map +1 -1
- package/dist/cli/send-dispatch.js +8 -2
- package/dist/cli/send-dispatch.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +270 -38
- package/dist/cli.js.map +1 -1
- package/dist/core/binary-self-update.d.ts +7 -0
- package/dist/core/binary-self-update.d.ts.map +1 -1
- package/dist/core/binary-self-update.js +17 -0
- package/dist/core/binary-self-update.js.map +1 -1
- package/dist/core/command-handler.d.ts.map +1 -1
- package/dist/core/command-handler.js +52 -1
- package/dist/core/command-handler.js.map +1 -1
- package/dist/core/cost-calculator.d.ts +9 -1
- package/dist/core/cost-calculator.d.ts.map +1 -1
- package/dist/core/cost-calculator.js +5 -0
- package/dist/core/cost-calculator.js.map +1 -1
- package/dist/core/passthrough-commands.d.ts.map +1 -1
- package/dist/core/passthrough-commands.js +1 -1
- package/dist/core/passthrough-commands.js.map +1 -1
- package/dist/core/self-spawn.d.ts +46 -1
- package/dist/core/self-spawn.d.ts.map +1 -1
- package/dist/core/self-spawn.js +57 -0
- package/dist/core/self-spawn.js.map +1 -1
- package/dist/core/worker-pool.d.ts.map +1 -1
- package/dist/core/worker-pool.js +81 -5
- package/dist/core/worker-pool.js.map +1 -1
- package/dist/daemon.d.ts.map +1 -1
- package/dist/daemon.js +93 -0
- package/dist/daemon.js.map +1 -1
- package/dist/dashboard/autostart-api.d.ts.map +1 -1
- package/dist/dashboard/autostart-api.js +16 -3
- package/dist/dashboard/autostart-api.js.map +1 -1
- package/dist/dashboard/bot-onboarding.d.ts +2 -1
- package/dist/dashboard/bot-onboarding.d.ts.map +1 -1
- package/dist/dashboard/bot-onboarding.js +22 -6
- package/dist/dashboard/bot-onboarding.js.map +1 -1
- package/dist/dashboard/bot-payload.d.ts +1 -0
- package/dist/dashboard/bot-payload.d.ts.map +1 -1
- package/dist/dashboard/bot-payload.js +3 -0
- package/dist/dashboard/bot-payload.js.map +1 -1
- package/dist/dashboard/connector-api.d.ts.map +1 -1
- package/dist/dashboard/connector-api.js +28 -0
- package/dist/dashboard/connector-api.js.map +1 -1
- package/dist/dashboard/trigger-api.d.ts.map +1 -1
- package/dist/dashboard/trigger-api.js +33 -21
- package/dist/dashboard/trigger-api.js.map +1 -1
- package/dist/dashboard/web/bot-defaults-page.d.ts.map +1 -1
- package/dist/dashboard/web/bot-defaults-page.js +12 -2
- package/dist/dashboard/web/bot-defaults-page.js.map +1 -1
- package/dist/dashboard/web/bot-defaults.d.ts +2 -0
- package/dist/dashboard/web/bot-defaults.d.ts.map +1 -1
- package/dist/dashboard/web/bot-defaults.js.map +1 -1
- package/dist/dashboard/web/bot-onboarding.d.ts +40 -1
- package/dist/dashboard/web/bot-onboarding.d.ts.map +1 -1
- package/dist/dashboard/web/bot-onboarding.js +52 -2
- package/dist/dashboard/web/bot-onboarding.js.map +1 -1
- package/dist/dashboard/web/i18n.d.ts.map +1 -1
- package/dist/dashboard/web/i18n.js +2 -0
- package/dist/dashboard/web/i18n.js.map +1 -1
- package/dist/dashboard/webhook-routes.d.ts.map +1 -1
- package/dist/dashboard/webhook-routes.js +272 -30
- package/dist/dashboard/webhook-routes.js.map +1 -1
- package/dist/dashboard-web/app.js +1 -1
- package/dist/dashboard-web/chunks/{agent-workbench-dock-page-XHJUYFGN.js → agent-workbench-dock-page-6LC422N6.js} +1 -1
- package/dist/dashboard-web/chunks/{agent-workbench-page-FLKTLIRM.js → agent-workbench-page-RSAWY7O2.js} +1 -1
- package/dist/dashboard-web/chunks/{bot-defaults-page-XMGLZZ2E.js → bot-defaults-page-67RAWCSQ.js} +1 -1
- package/dist/dashboard-web/chunks/{chunk-TLG45URB.js → chunk-IA5KMD5O.js} +1 -1
- package/dist/dashboard-web/chunks/{chunk-BU3Q6XC6.js → chunk-K232GT3M.js} +2 -2
- package/dist/dashboard-web/chunks/chunk-MMLTCXHP.js +10 -0
- package/dist/dashboard-web/chunks/{chunk-ECFC7UG2.js → chunk-R3LJUCEO.js} +1 -1
- package/dist/dashboard-web/chunks/{chunk-Z67OSM5P.js → chunk-YJA3KY3J.js} +1 -1
- package/dist/dashboard-web/chunks/{connectors-page-WDM4CEAU.js → connectors-page-DJCTHSFB.js} +1 -1
- package/dist/dashboard-web/chunks/{feedback-page-GMJ4FLJ4.js → feedback-page-O7SZRKNM.js} +1 -1
- package/dist/dashboard-web/chunks/{groups-page-L4ZJNWVR.js → groups-page-7PONUYHE.js} +1 -1
- package/dist/dashboard-web/chunks/{insights-page-7LUJU2CX.js → insights-page-J6DAAJ6D.js} +1 -1
- package/dist/dashboard-web/chunks/{monitor-room-7LZUJQPF.js → monitor-room-F3QNEW7N.js} +1 -1
- package/dist/dashboard-web/chunks/{monitoring-page-AUSXMPYO.js → monitoring-page-JHDD2VS2.js} +1 -1
- package/dist/dashboard-web/chunks/{office-page-6ZU6MAZN.js → office-page-MMTN4IKD.js} +1 -1
- package/dist/dashboard-web/chunks/{overview-page-QBC5CIYH.js → overview-page-IQ2UJAJP.js} +1 -1
- package/dist/dashboard-web/chunks/{roles-page-QO3YCA7D.js → roles-page-FNI4MGX6.js} +1 -1
- package/dist/dashboard-web/chunks/{schedules-page-YNGSKDQW.js → schedules-page-6PUU63KS.js} +1 -1
- package/dist/dashboard-web/chunks/{sessions-page-BWR4UB6X.js → sessions-page-O4N72EXT.js} +4 -4
- package/dist/dashboard-web/chunks/{settings-page-2IRIS3FP.js → settings-page-G7B3STUF.js} +1 -1
- package/dist/dashboard-web/chunks/{skills-page-5RZPM6HJ.js → skills-page-CEWKQOIG.js} +1 -1
- package/dist/dashboard-web/chunks/{team-federation-page-KERG6LKC.js → team-federation-page-NUP4VK4H.js} +1 -1
- package/dist/dashboard-web/chunks/{v3-page-766CBD7H.js → v3-page-M4XF6D5Z.js} +1 -1
- package/dist/dashboard-web/chunks/{whiteboards-page-2M6XZD5C.js → whiteboards-page-L755NZX6.js} +1 -1
- package/dist/dashboard-web/style.css +13 -0
- package/dist/dashboard.js +3 -0
- package/dist/dashboard.js.map +1 -1
- package/dist/global-config.d.ts +3 -0
- package/dist/global-config.d.ts.map +1 -1
- package/dist/global-config.js +10 -3
- package/dist/global-config.js.map +1 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +19 -1
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/zh.d.ts.map +1 -1
- package/dist/i18n/zh.js +19 -1
- package/dist/i18n/zh.js.map +1 -1
- package/dist/im/lark/api-gate.d.ts +53 -0
- package/dist/im/lark/api-gate.d.ts.map +1 -0
- package/dist/im/lark/api-gate.js +322 -0
- package/dist/im/lark/api-gate.js.map +1 -0
- package/dist/im/lark/audio-transcribe.d.ts +23 -0
- package/dist/im/lark/audio-transcribe.d.ts.map +1 -0
- package/dist/im/lark/audio-transcribe.js +126 -0
- package/dist/im/lark/audio-transcribe.js.map +1 -0
- package/dist/im/lark/card-builder.d.ts +6 -0
- package/dist/im/lark/card-builder.d.ts.map +1 -1
- package/dist/im/lark/card-builder.js +53 -1
- package/dist/im/lark/card-builder.js.map +1 -1
- package/dist/im/lark/card-handler.d.ts +10 -0
- package/dist/im/lark/card-handler.d.ts.map +1 -1
- package/dist/im/lark/card-handler.js +68 -1
- package/dist/im/lark/card-handler.js.map +1 -1
- package/dist/im/lark/client.d.ts.map +1 -1
- package/dist/im/lark/client.js +247 -224
- package/dist/im/lark/client.js.map +1 -1
- package/dist/im/lark/event-dispatcher.d.ts.map +1 -1
- package/dist/im/lark/event-dispatcher.js +34 -3
- package/dist/im/lark/event-dispatcher.js.map +1 -1
- package/dist/im/lark/message-parser.d.ts +16 -0
- package/dist/im/lark/message-parser.d.ts.map +1 -1
- package/dist/im/lark/message-parser.js +31 -0
- package/dist/im/lark/message-parser.js.map +1 -1
- package/dist/services/budget-tracker.d.ts +61 -0
- package/dist/services/budget-tracker.d.ts.map +1 -0
- package/dist/services/budget-tracker.js +306 -0
- package/dist/services/budget-tracker.js.map +1 -0
- package/dist/services/connector-store.d.ts +16 -0
- package/dist/services/connector-store.d.ts.map +1 -1
- package/dist/services/connector-store.js.map +1 -1
- package/dist/services/failed-turn-retry.d.ts +43 -0
- package/dist/services/failed-turn-retry.d.ts.map +1 -0
- package/dist/services/failed-turn-retry.js +50 -0
- package/dist/services/failed-turn-retry.js.map +1 -0
- package/dist/services/model-pricing.d.ts +80 -0
- package/dist/services/model-pricing.d.ts.map +1 -0
- package/dist/services/model-pricing.js +182 -0
- package/dist/services/model-pricing.js.map +1 -0
- package/dist/services/session-store.d.ts.map +1 -1
- package/dist/services/session-store.js +13 -3
- package/dist/services/session-store.js.map +1 -1
- package/dist/services/trigger-types.d.ts +10 -0
- package/dist/services/trigger-types.d.ts.map +1 -1
- package/dist/services/trigger-types.js.map +1 -1
- package/dist/services/usage-ledger.d.ts +10 -0
- package/dist/services/usage-ledger.d.ts.map +1 -1
- package/dist/services/usage-ledger.js +36 -0
- package/dist/services/usage-ledger.js.map +1 -1
- package/dist/services/voice/asr.d.ts +17 -0
- package/dist/services/voice/asr.d.ts.map +1 -0
- package/dist/services/voice/asr.js +64 -0
- package/dist/services/voice/asr.js.map +1 -0
- package/dist/services/voice/index.d.ts +17 -2
- package/dist/services/voice/index.d.ts.map +1 -1
- package/dist/services/voice/index.js +43 -0
- package/dist/services/voice/index.js.map +1 -1
- package/dist/services/voice/types.d.ts +15 -0
- package/dist/services/voice/types.d.ts.map +1 -1
- package/dist/services/webhook-idempotency.d.ts +134 -0
- package/dist/services/webhook-idempotency.d.ts.map +1 -0
- package/dist/services/webhook-idempotency.js +265 -0
- package/dist/services/webhook-idempotency.js.map +1 -0
- package/dist/setup/app-name.d.ts +1 -0
- package/dist/setup/app-name.d.ts.map +1 -1
- package/dist/setup/app-name.js +7 -0
- package/dist/setup/app-name.js.map +1 -1
- package/dist/setup/bot-config-editor.d.ts +28 -0
- package/dist/setup/bot-config-editor.d.ts.map +1 -1
- package/dist/setup/bot-config-editor.js +73 -0
- package/dist/setup/bot-config-editor.js.map +1 -1
- package/dist/setup/open-platform-automation.d.ts +26 -0
- package/dist/setup/open-platform-automation.d.ts.map +1 -1
- package/dist/setup/open-platform-automation.js +90 -1
- package/dist/setup/open-platform-automation.js.map +1 -1
- package/dist/setup/open-platform-outcome.d.ts.map +1 -1
- package/dist/setup/open-platform-outcome.js +8 -2
- package/dist/setup/open-platform-outcome.js.map +1 -1
- package/dist/types.d.ts +20 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/usage-limit-tracker.d.ts +29 -9
- package/dist/utils/usage-limit-tracker.d.ts.map +1 -1
- package/dist/utils/usage-limit-tracker.js +122 -14
- package/dist/utils/usage-limit-tracker.js.map +1 -1
- package/dist/worker.js +27 -6
- package/dist/worker.js.map +1 -1
- package/dist/workflows/definition.d.ts +56 -56
- package/dist/workflows/events/payloads.d.ts +2 -2
- package/dist/workflows/events/schema.d.ts +430 -430
- package/dist/workflows/migration/v2-run-archive-schema.d.ts +2 -2
- package/dist/workflows/v3/run-envelope.d.ts +56 -56
- package/package.json +9 -8
- package/scripts/postinstall-bin.mjs +25 -0
- package/dist/dashboard-web/chunks/chunk-NJCJR3U2.js +0 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as kt,b as _e,d as xt}from"./chunks/chunk-2PVRDXEL.js";import{a as Et,b as Mt}from"./chunks/chunk-Z67OSM5P.js";import{b as $e}from"./chunks/chunk-SZOB6VK2.js";import{a as bt}from"./chunks/chunk-BD3PZGH2.js";import{b as Ue}from"./chunks/chunk-G5ZS2YUS.js";import{b as Be}from"./chunks/chunk-OXSVWLER.js";import{a as me,b as wt,c as yt}from"./chunks/chunk-NJCJR3U2.js";import"./chunks/chunk-KTQ7B6ZR.js";import{c as Ie}from"./chunks/chunk-CEUCNZFJ.js";import{i as gt,j as vt}from"./chunks/chunk-NYY66DNC.js";import"./chunks/chunk-ECFC7UG2.js";import{a as ue,b as lt}from"./chunks/chunk-QITAMHW6.js";import{G as pt,I as ht,L as mt,M as he,c as pe,u as He,v as ct,w as f,x as s,y as dt,z as ut}from"./chunks/chunk-BU3Q6XC6.js";import{a as yn,b as kn}from"./chunks/chunk-ARROO6TE.js";import{c as Y,d as wn,e as ft}from"./chunks/chunk-3YZFAHNK.js";var nn=Y(yn(),1),on=Y(kn(),1),l=Y(wn(),1);var ze="botmux:close-theme-menu",xn={palette:'<circle cx="13.5" cy="6.5" r=".5" fill="currentColor"/><circle cx="17.5" cy="10.5" r=".5" fill="currentColor"/><circle cx="8.5" cy="7.5" r=".5" fill="currentColor"/><circle cx="6.5" cy="12.5" r=".5" fill="currentColor"/><path d="M12 2a10 10 0 0 0 0 20h1.7a2.3 2.3 0 0 0 1.6-4c-.5-.5-.2-1.3.5-1.3H17a5 5 0 0 0 5-5 9.7 9.7 0 0 0-10-9.7z"/>',monitor:'<rect width="20" height="14" x="2" y="3" rx="2"/><line x1="8" x2="16" y1="21" y2="21"/><line x1="12" x2="12" y1="17" y2="21"/>',sun:'<circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/>',moon:'<path d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"/>',cpu:'<path d="M12 20v2"/><path d="M12 2v2"/><path d="M17 20v2"/><path d="M17 2v2"/><path d="M2 12h2"/><path d="M2 17h2"/><path d="M2 7h2"/><path d="M20 12h2"/><path d="M20 17h2"/><path d="M20 7h2"/><path d="M7 20v2"/><path d="M7 2v2"/><rect x="4" y="4" width="16" height="16" rx="2"/><rect x="8" y="8" width="8" height="8" rx="1"/>',zap:'<path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"/>',chevron:'<path d="m6 9 6 6 6-6"/>'},Nt=[{labelKey:"theme.base",options:[{value:"system",labelKey:"status.system",icon:"monitor"},{value:"light",labelKey:"status.light",icon:"sun"},{value:"dark",labelKey:"status.dark",icon:"moon"}]},{labelKey:"theme.skins",options:[{value:"cyber",labelKey:"skin.cyber",icon:"cpu"},{value:"fallout",labelKey:"skin.fallout",icon:"zap"}]}],Rt=Nt.flatMap(e=>e.options),L=!1,Z=null,Q=null,En=70,Mn=120;function Ke(e){return`<svg class="tm-svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${xn[e]??""}</svg>`}function Rn(e){return e.replace(/[&<>"]/g,n=>({"&":"&","<":"<",">":">",'"':"""})[n])}function Lt(){let e=document.getElementById("theme-menu"),n=document.getElementById("theme-menu-btn"),o=document.getElementById("theme-menu-pop");if(!e||!n||!o||e.dataset.themeMenuInit==="1")return;e.dataset.themeMenuInit="1",o.innerHTML=Nt.map(u=>`<div class="tm-group" data-label-key="${u.labelKey}"></div>`+u.options.map(m=>`<button type="button" class="tm-item" role="option" data-value="${m.value}"><span class="tm-ic">${Ke(m.icon)}</span><span class="tm-label" data-label-key="${m.labelKey}"></span></button>`).join("")).join("");let a=()=>{if(!L)return;let u=n.getBoundingClientRect(),m=12,k=Math.min(Math.max(o.offsetWidth||216,216),Math.max(0,window.innerWidth-m*2)),w=m+k/2,g=window.innerWidth-m-k/2,x=u.left+u.width/2,y=Math.min(Math.max(x,w),Math.max(w,g)),O=Math.max(180,window.innerHeight-u.bottom-20);o.style.setProperty("--theme-menu-pop-left",`${Math.round(y)}px`),o.style.setProperty("--theme-menu-pop-top",`${Math.round(u.bottom+8)}px`),o.style.setProperty("--theme-menu-pop-max-height",`${Math.round(O)}px`)},r=u=>{Z!=null&&(window.clearTimeout(Z),Z=null),Q!=null&&(window.clearTimeout(Q),Q=null),L=u,n.setAttribute("aria-expanded",String(L)),document.body.classList.toggle("theme-menu-open",L),L?(o.hidden=!1,a(),window.requestAnimationFrame(()=>e.classList.add("open"))):(e.classList.remove("open"),Q=window.setTimeout(()=>{Q=null,L||(o.hidden=!0)},Mn))},d=()=>r(!0),p=()=>{Z==null&&(Z=window.setTimeout(()=>r(!1),En))},h=u=>{u.pointerType!=="touch"&&d()},c=u=>{u.pointerType!=="touch"&&p()};e.addEventListener("pointerenter",h),e.addEventListener("pointerleave",c),o.addEventListener("pointerenter",h),o.addEventListener("pointerleave",c),n.addEventListener("click",u=>{u.stopPropagation(),r(!L)}),n.addEventListener("focus",()=>{n.matches(":focus-visible")&&d()}),e.addEventListener("focusout",u=>{let m=u.relatedTarget;(!(m instanceof Node)||!e.contains(m))&&p()}),o.addEventListener("click",u=>{let m=u.target.closest(".tm-item");m&&(f.setTheme(m.dataset.value??"system"),r(!1))}),document.addEventListener("click",u=>{L&&!e.contains(u.target)&&r(!1)}),document.addEventListener("pointermove",u=>{if(!L||u.pointerType==="touch")return;let m=u.target;m instanceof Node&&e.contains(m)||p()}),document.addEventListener("keydown",u=>{u.key==="Escape"&&L&&r(!1)}),window.addEventListener("resize",a),window.addEventListener("scroll",a,!0),window.addEventListener(ze,()=>{L&&r(!1)}),Fe()}function Fe(){let e=document.getElementById("theme-menu-btn");if(!e)return;let n=Rt.find(o=>o.value===f.theme)??Rt[0];e.innerHTML=`<span class="tm-ic">${Ke("palette")}</span><span class="tm-current">${Rn(s(n.labelKey))}</span><span class="tm-chev">${Ke("chevron")}</span>`,document.querySelectorAll("#theme-menu-pop [data-label-key]").forEach(o=>{o.textContent=s(o.dataset.labelKey??"")}),document.querySelectorAll("#theme-menu-pop .tm-item").forEach(o=>{o.classList.toggle("active",o.dataset.value===f.theme)})}function v(e,n,o,a,r=!1){return{id:e,routePrefix:n,rerenderOnUiChange:r,load:async()=>(await o())[a]}}var Nn=[v("agent-workbench-dock","#/agent-workbench-dock",()=>import("./chunks/agent-workbench-dock-page-XHJUYFGN.js"),"renderAgentWorkbenchDockPage"),v("agent-workbench","#/agent-workbench",()=>import("./chunks/agent-workbench-page-FLKTLIRM.js"),"renderAgentWorkbenchPage"),{id:"plugins",routePrefix:"#/plugins",rerenderOnUiChange:!1,load:async()=>{let e=await import("./chunks/plugin-page-AKQZFAC4.js");return n=>e.renderPluginPage(n)}},v("workflows","#/workflows",()=>import("./chunks/v3-page-766CBD7H.js"),"renderV3RunsPage"),v("groups","#/groups",()=>import("./chunks/groups-page-L4ZJNWVR.js"),"renderGroupsPage"),v("settings","#/settings",()=>import("./chunks/settings-page-2IRIS3FP.js"),"renderSettingsPage"),v("bot-defaults","#/bot-defaults",()=>import("./chunks/bot-defaults-page-XMGLZZ2E.js"),"renderBotDefaultsPage"),v("skills","#/skills",()=>import("./chunks/skills-page-5RZPM6HJ.js"),"renderSkillsPage"),v("customization","#/customization",()=>import("./chunks/customization-page-VQJAEDZY.js"),"renderCustomizationPage"),v("connectors-logs","#/connectors/logs",()=>import("./chunks/connectors-page-WDM4CEAU.js"),"renderConnectorsLogsPage"),v("webhook-logs","#/webhook-logs",()=>import("./chunks/connectors-page-WDM4CEAU.js"),"renderConnectorsLogsPage"),v("connectors","#/connectors",()=>import("./chunks/connectors-page-WDM4CEAU.js"),"renderConnectorsPage"),v("team-manage","#/team/manage",()=>import("./chunks/team-federation-page-KERG6LKC.js"),"renderTeamManagePage"),v("team","#/team",()=>import("./chunks/team-federation-page-KERG6LKC.js"),"renderTeamFederationPage"),v("roles-profile","#/roles/profile",()=>import("./chunks/roles-page-QO3YCA7D.js"),"renderRoleProfilesPage"),v("roles","#/roles",()=>import("./chunks/roles-page-QO3YCA7D.js"),"renderRolesPage"),v("schedules","#/schedules",()=>import("./chunks/schedules-page-YNGSKDQW.js"),"renderSchedulesPage"),v("whiteboards","#/whiteboards",()=>import("./chunks/whiteboards-page-2M6XZD5C.js"),"renderWhiteboardsPage"),v("monitoring","#/monitoring",()=>import("./chunks/monitoring-page-AUSXMPYO.js"),"renderMonitoringPage"),v("sessions","#/sessions",()=>import("./chunks/sessions-page-BWR4UB6X.js"),"renderSessionsPage"),v("monitor-room","#/monitor-room",()=>import("./chunks/monitor-room-7LZUJQPF.js"),"renderMonitorRoomPage",!0),v("office","#/office",()=>import("./chunks/office-page-6ZU6MAZN.js"),"renderOfficePage"),v("insights","#/insights",()=>import("./chunks/insights-page-7LUJU2CX.js"),"renderInsightsPage"),v("feedback","#/feedback",()=>import("./chunks/feedback-page-GMJ4FLJ4.js"),"renderFeedbackPage")];function Tt(e){return Nn.find(n=>n.exact?e===n.routePrefix:e.startsWith(n.routePrefix))}async function St(){let e=await import("./chunks/overview-page-QBC5CIYH.js");return n=>e.renderOverviewPage(n)}function Pt(){return{seq:0,pageDispose:null,rerenderOnUiChange:!0}}function Ot(e){let n=++e.seq;return e.pageDispose&&(e.pageDispose(),e.pageDispose=null),n}function Ct(e,n){return n===e.seq}async function At(e,n,o,a,r={}){let d=await a();if(!Ct(e,n))return!1;let p=d(o);return Ct(e,n)?(e.pageDispose=typeof p=="function"?p:null,e.rerenderOnUiChange=r.rerenderOnUiChange??!0,!0):(typeof p=="function"&&p(),!1)}var Ln="botmux.dashboard.stale-chunk-reload.v1:",Tn=/Failed to fetch dynamically imported module|Importing a module script failed|error loading dynamically imported module|dynamically imported module/i,Sn=/\b(?:https?:\/\/|\/assets\/)\S+?\.js\b/;function Dt(e){return e instanceof Error?`${e.name}: ${e.message}`:String(e)}function Ht(e){return Tn.test(Dt(e))}function Cn(e,n){let r=Dt(e).match(Sn)?.[0]||`${n.href}|${n.hash}`;return`${Ln}${r.slice(-240)}`}function Pn(e,n){if(!Ht(e))return!1;let o=Cn(e,n);try{if(n.sessionStorage.getItem(o)==="1")return!1;n.sessionStorage.setItem(o,"1")}catch{return!1}return n.reload(),!0}function It(e,n){if(!Ht(e))return!1;let o;try{o=n.getSessionStorage()}catch{return!1}return Pn(e,{...n,sessionStorage:o})}var On=new Set(["auto","scroll","overlay"]),fe=28,P=3,K=6,Bt=!1,zt=null,Ut=new WeakMap,A=new Map,$t=null,_t=null,We=0,Ve=0,ee=null;function An(e){return e.closest("dialog[open]")??document.body}function Dn(e){let n=Ut.get(e);if(n?.isConnected)return n;let o=document.createElement("div");return o.className="floating-scrollbar-layer",o.setAttribute("aria-hidden","true"),e.appendChild(o),Ut.set(e,o),o}function Hn(e){return On.has(e)}function qe(e,n){let o=getComputedStyle(e),a=n==="y"?o.overflowY:o.overflowX;return Hn(a)?n==="y"?e.scrollHeight-e.clientHeight>1:e.scrollWidth-e.clientWidth>1:!1}function In(e){if(!e.isConnected||e.closest("[hidden]"))return!1;let n=e.getBoundingClientRect();return n.width>0&&n.height>0&&n.bottom>0&&n.right>0&&n.top<window.innerHeight&&n.left<window.innerWidth}function Bn(e){return[e,...Array.from(e.querySelectorAll("*"))].filter(o=>In(o)&&(qe(o,"x")||qe(o,"y")))}function be(e){e.hideTimer!==void 0&&window.clearTimeout(e.hideTimer),e.track.remove()}function Un(e,n){let o=A.get(e);o||(o={},A.set(e,o));let a=o[n],r=An(e),d=Dn(r);if(a?.track.parentElement===d)return a;a&&be(a);let p=document.createElement("div"),h=document.createElement("div");p.className=`floating-scrollbar floating-scrollbar-${n}`,h.className="floating-scrollbar-thumb",p.appendChild(h),d.appendChild(p);let c={target:e,axis:n,track:p,thumb:h,hideTimer:void 0};return o[n]=c,c}function je(e,n=!1){e.track.classList.add("is-visible"),e.hideTimer!==void 0&&window.clearTimeout(e.hideTimer),e.hideTimer=n?void 0:window.setTimeout(()=>{e.track.classList.remove("is-visible","is-active"),e.hideTimer=void 0},900)}function $n(e){let{target:n,axis:o,track:a,thumb:r}=e,d=n.getBoundingClientRect();if(o==="y"){let w=Math.max(0,d.top+P),g=Math.min(window.innerHeight,d.bottom-P),x=Math.max(0,g-w);if(x<fe||n.scrollHeight<=n.clientHeight){a.hidden=!0;return}let y=Math.max(fe,Math.round(x*n.clientHeight/n.scrollHeight)),O=Math.max(1,n.scrollHeight-n.clientHeight),B=Math.round((x-y)*n.scrollTop/O);a.hidden=!1,a.style.left=`${Math.min(window.innerWidth-K-P,Math.max(P,d.right-K-P))}px`,a.style.top=`${w}px`,a.style.width=`${K}px`,a.style.height=`${x}px`,r.style.width="100%",r.style.height=`${y}px`,r.style.transform=`translate3d(0, ${B}px, 0)`;return}let p=Math.max(0,d.left+P),h=Math.min(window.innerWidth,d.right-P),c=Math.max(0,h-p);if(c<fe||n.scrollWidth<=n.clientWidth){a.hidden=!0;return}let u=Math.max(fe,Math.round(c*n.clientWidth/n.scrollWidth)),m=Math.max(1,n.scrollWidth-n.clientWidth),k=Math.round((c-u)*n.scrollLeft/m);a.hidden=!1,a.style.left=`${p}px`,a.style.top=`${Math.min(window.innerHeight-K-P,Math.max(P,d.bottom-K-P))}px`,a.style.width=`${c}px`,a.style.height=`${K}px`,r.style.width=`${u}px`,r.style.height="100%",r.style.transform=`translate3d(${k}px, 0, 0)`}function z(){We||(We=window.requestAnimationFrame(()=>{We=0,Kn()}))}function _n(){Ve||(Ve=window.setTimeout(()=>{Ve=0,z()},120))}function Kn(){let e=zt;if(!e)return;let n=new Set(Bn(e));for(let[o,a]of A)n.has(o)||(a.x&&be(a.x),a.y&&be(a.y),A.delete(o));for(let o of n){let a=o===ee;for(let r of["x","y"]){let d=A.get(o);if(!qe(o,r)){let h=d?.[r];h&&(be(h),delete d?.[r]);continue}let p=Un(o,r);$n(p),a&&je(p,!0)}}}function zn(e){if(!(e instanceof HTMLElement))return;let n=A.get(e);if(n)for(let o of Object.values(n))o&&(o.track.classList.add("is-active"),je(o))}function Fn(e){for(let n=e;n;n=n.parentElement)if(n instanceof HTMLElement&&A.has(n))return n;return null}function Kt(e){if(ee===e)return;let n=ee?A.get(ee):void 0;if(ee=e,n)for(let a of Object.values(n))a?.track.classList.remove("is-visible");let o=e?A.get(e):void 0;if(o)for(let a of Object.values(o))a&&je(a,!0)}function Ft(e){Bt||(Bt=!0,zt=e,document.documentElement.classList.add("floating-scrollbars-on"),$t=typeof ResizeObserver>"u"?null:new ResizeObserver(z),$t?.observe(e),_t=new MutationObserver(n=>{for(let o of n){let a=o.target;if(!(a instanceof Element&&a.closest(".floating-scrollbar-layer"))){_n();return}}}),_t.observe(e,{attributes:!0,attributeFilter:["class","style","hidden","open"],childList:!0,subtree:!0}),document.addEventListener("scroll",n=>{zn(n.target),z()},!0),window.addEventListener("resize",z),window.addEventListener("hashchange",z),document.addEventListener("pointermove",n=>{Kt(Fn(document.elementFromPoint(n.clientX,n.clientY)))}),document.addEventListener("pointerleave",()=>Kt(null)),z())}var Wt=!1,F=null,ge=null,W=null;function qt(){if(F)return F;let e=document.createElement("div");return e.className="icon-tip",e.setAttribute("role","tooltip"),e.style.display="none",document.body.appendChild(e),F=e,e}function Wn(e){let n=qt(),o=gt(e,document.body);return n.parentNode!==o&&o.appendChild(n),n}function Vn(e){let n=qt(),o=e.getBoundingClientRect(),a=n.offsetWidth,r=n.offsetHeight,d=8,p=o.top<r+d+4,h=o.left+o.width/2-a/2;h=Math.min(Math.max(h,6),window.innerWidth-a-6);let c=p?o.bottom+d:o.top-r-d;n.style.left=`${Math.round(h)}px`,n.style.top=`${Math.round(c)}px`,n.dataset.placement=p?"bottom":"top"}function te(){W&&(clearTimeout(W),W=null),ge=null,F&&(F.style.display="none",F.classList.remove("show"))}function Vt(e){let n=e.getAttribute("data-tip");if(!n)return;ge=e;let o=Wn(e);o.textContent=n,o.style.display="block",o.classList.remove("show"),Vn(e),requestAnimationFrame(()=>{ge===e&&o.classList.add("show")})}function Ge(e){return e instanceof Element?e.closest("[data-tip]"):null}function jt(){Wt||typeof document>"u"||(Wt=!0,document.addEventListener("pointerover",e=>{let n=Ge(e.target);!n||n===ge||(W&&clearTimeout(W),W=setTimeout(()=>Vt(n),120))}),document.addEventListener("pointerout",e=>{let n=Ge(e.target);if(!n)return;let o=e.relatedTarget instanceof Element?e.relatedTarget:null;o&&(o===n||n.contains(o))||te()}),document.addEventListener("focusin",e=>{let n=Ge(e.target);n&&Vt(n)}),document.addEventListener("focusout",te),document.addEventListener("click",te,!0),window.addEventListener("scroll",te,!0),window.addEventListener("resize",te))}function ve(e,n){if(e)try{let o=new URL(e);if(!["http:","https:"].includes(o.protocol)||o.username||o.password)return;let a=n.startsWith("#/")&&n.length<=4096&&!/[\u0000-\u001f\u007f]/.test(n)?n:"#/";return o.searchParams.set("next",`/${a}`),o.toString()}catch{return}}var t=Y(ft(),1),qn=["roles","role-profiles","bot-defaults","skills","customization","plugins","team","connectors","insights","feedback","whiteboards"],Gt=[{id:"overview",href:"#/",labelKey:"nav.overview",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:"1.5",y:"1.5",width:"5.4",height:"5.4",rx:"1.5"}),(0,t.jsx)("rect",{x:"9.1",y:"1.5",width:"5.4",height:"5.4",rx:"1.5"}),(0,t.jsx)("rect",{x:"1.5",y:"9.1",width:"5.4",height:"5.4",rx:"1.5"}),(0,t.jsx)("rect",{x:"9.1",y:"9.1",width:"5.4",height:"5.4",rx:"1.5"})]})},{id:"sessions",href:"#/sessions",labelKey:"nav.sessions",icon:(0,t.jsx)("path",{d:"M2 3.5h12v7H6l-3 3v-3H2z"})},{id:"agent-workbench",href:"#/agent-workbench",labelKey:"nav.workbench",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:"2",y:"3",width:"12",height:"10",rx:"1.5"}),(0,t.jsx)("path",{d:"M4.5 6.5l2 1.5-2 1.5M8 10h3"})]})},{id:"groups",href:"#/groups",labelKey:"nav.groups",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:"5.6",cy:"5.8",r:"2.4"}),(0,t.jsx)("circle",{cx:"11",cy:"6.8",r:"1.9"}),(0,t.jsx)("path",{d:"M1.8 13.2c.5-2.4 2-3.6 3.8-3.6s3.3 1.2 3.8 3.6M9.8 12.6c.4-1.7 1.5-2.6 2.8-2.6 1 0 1.9.5 2.4 1.6"})]})},{id:"roles",href:"#/roles",labelKey:"nav.roles",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M8 1.8l5.2 2v3.4c0 3.4-2.2 5.9-5.2 7-3-1.1-5.2-3.6-5.2-7V3.8z"}),(0,t.jsx)("path",{d:"M5.8 8l1.6 1.6 2.8-3"})]})},{id:"monitoring",href:"#/monitoring",labelKey:"nav.monitoring",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M2 9.2h2.3l1.3-4.8 2.5 8.4 1.8-5.1h4.1"}),(0,t.jsx)("path",{d:"M2 2.5h12v11H2z"})]})},{id:"insights",href:"#/insights",labelKey:"nav.insights",manage:!0,icon:(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("path",{d:"M2 2v12h12M5 11V7M8.5 11V4.5M12 11V8.5"})})},{id:"feedback",href:"#/feedback",labelKey:"nav.feedback",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M2.2 3.2h11.6v8H8l-3.2 2.6v-2.6H2.2z"}),(0,t.jsx)("path",{d:"M5 6.2h6M5 8.3h4"})]})},{id:"workflows",href:"#/workflows",labelKey:"nav.workflows",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:"3.4",cy:"3.6",r:"1.9"}),(0,t.jsx)("circle",{cx:"3.4",cy:"12.4",r:"1.9"}),(0,t.jsx)("circle",{cx:"12.6",cy:"8",r:"1.9"}),(0,t.jsx)("path",{d:"M5.2 4.4l5.6 2.8M5.2 11.6l5.6-2.8"})]})},{id:"schedules",href:"#/schedules",labelKey:"nav.schedules",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:"8",cy:"8",r:"6.2"}),(0,t.jsx)("path",{d:"M8 4.5V8l2.4 1.6"})]})},{id:"whiteboards",href:"#/whiteboards",labelKey:"nav.whiteboards",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:"2.2",y:"2.2",width:"11.6",height:"11.6",rx:"2"}),(0,t.jsx)("path",{d:"M4.8 5.2h6.4M4.8 8h6.4M4.8 10.8h4"})]})},{id:"office",href:"#/office",labelKey:"nav.office",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:"3",y:"4",width:"10",height:"7",rx:"2"}),(0,t.jsx)("circle",{cx:"6",cy:"7.5",r:"1"}),(0,t.jsx)("circle",{cx:"10",cy:"7.5",r:"1"}),(0,t.jsx)("path",{d:"M8 4V2M4.5 11v2M11.5 11v2"})]})},{id:"bot-defaults",href:"#/bot-defaults",labelKey:"nav.botDefaults",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:"2.5",y:"5",width:"11",height:"8",rx:"2"}),(0,t.jsx)("circle",{cx:"5.8",cy:"9",r:"1"}),(0,t.jsx)("circle",{cx:"10.2",cy:"9",r:"1"}),(0,t.jsx)("path",{d:"M8 5V2.5M5.5 13v1.2M10.5 13v1.2"})]})},{id:"skills",href:"#/skills",labelKey:"nav.skills",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M3 2.5h10v3H3zM3 7h10v6.5H3z"}),(0,t.jsx)("path",{d:"M5.4 9.2h5.2M5.4 11.2h3.8"})]})},{id:"customization",href:"#/customization",labelKey:"nav.customization",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M11.5 2.5l2 2-7 7-2.6.6.6-2.6z"}),(0,t.jsx)("path",{d:"M2.5 13.5h5"})]})},{id:"plugins",href:"#/plugins",label:"\u63D2\u4EF6",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M6.4 1.8h3.2v3h2.8v3.2H9.6v2.8H6.4V8H3.6V4.8h2.8z"}),(0,t.jsx)("path",{d:"M2.2 11.8h11.6v2.4H2.2z"})]})},{id:"team",href:"#/team",labelKey:"nav.team",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:"8",cy:"8",r:"6.2"}),(0,t.jsx)("path",{d:"M1.8 8h12.4M8 1.8c-2 1.8-2 10.6 0 12.4 2-1.8 2-10.6 0-12.4z"})]})},{id:"connectors",href:"#/connectors",labelKey:"nav.connectors",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M5.5 6.5v-3a2.5 2.5 0 0 1 5 0v3"}),(0,t.jsx)("rect",{x:"3.5",y:"6.5",width:"9",height:"7",rx:"2"})]})},{id:"settings",href:"#/settings",labelKey:"nav.settings",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M8 1.75 9.35 2.05 10 3.28l1.38.3 1.04-.96.96.96-.96 1.04.3 1.38 1.23.65L14.25 8l-.3 1.35-1.23.65-.3 1.38.96 1.04-.96.96-1.04-.96-1.38.3-.65 1.23L8 14.25l-1.35-.3L6 12.72l-1.38-.3-1.04.96-.96-.96.96-1.04-.3-1.38-1.23-.65L1.75 8l.3-1.35 1.23-.65.3-1.38-.96-1.04.96-.96 1.04.96 1.38-.3.65-1.23z"}),(0,t.jsx)("circle",{cx:"8",cy:"8",r:"2"})]})}],jn=[{id:"overview",labelKey:"nav.group.overview",items:["overview"]},{id:"collab",labelKey:"nav.group.collab",items:["sessions","agent-workbench","groups","schedules","workflows","office"]},{id:"workforce",labelKey:"nav.group.workforce",items:["roles","skills","customization","bot-defaults"]},{id:"analytics",labelKey:"nav.group.analytics",items:["monitoring","insights","feedback"]},{id:"manage",labelKey:"nav.group.manage",items:["connectors","team","plugins","whiteboards","settings"]}],oe=[],T=!0,ye=!1,Ee=location.hash||"#/",V=null,ae=!1,re=null,ke=null,an=null,xe=null,rn=null,I=Pt(),sn="botmux.ownerAvatar.v1",Gn=new Set(["working","analyzing","active","starting"]),Qe="botmux:auth-expired",Me;function ne(e){return(0,t.jsx)("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:e})}function Xt(e){return e.labelKey?s(e.labelKey):e.label??""}function Xn(e,n){let o=n||"#/";return e.id==="plugins"&&oe.some(a=>a.href===o||o.startsWith(`${a.href}?`)||o.startsWith(`${a.href}/`))?!1:e.id==="sessions"&&(o==="#/monitor-room"||o.startsWith("#/monitor-room?")||o.startsWith("#/monitor-room/"))||e.id==="connectors"&&(o==="#/webhook-logs"||o.startsWith("#/webhook-logs?")||o.startsWith("#/webhook-logs/"))?!0:e.href===o||e.href!=="#/"&&(o.startsWith(`${e.href}?`)||o.startsWith(`${e.href}/`))}function Jn(){let e=_e()?Gt.filter(o=>o.id!=="workflows"):Gt;if(oe.length===0)return e;let n=e.findIndex(o=>o.id==="plugins");return n<0?[...e,...oe]:[...e.slice(0,n+1),...oe,...e.slice(n+1)]}function Yn(e){let n=[];return Xn(e,Ee)&&n.push("active"),e.id==="settings"&&ae&&n.push("nav-has-update"),n.length?n.join(" "):void 0}function Zn(e){return(0,t.jsxs)("a",{href:e.href,"data-route":e.id,className:[Yn(e),e.plugin?"sidebar-plugin-item":""].filter(Boolean).join(" ")||void 0,title:e.plugin?Xt(e):void 0,children:[ne(e.icon),(0,t.jsx)("span",{className:"sidebar-nav-label",children:Xt(e)}),e.id==="settings"&&ae?(0,t.jsx)(vt,{className:"nav-update-tip",label:Yt(),trigger:(0,t.jsx)("span",{className:"nav-update-dot","aria-hidden":"true"}),preventClick:!1,focusable:!1,children:Yt()}):null]})}function ln(){let e=pe(new URLSearchParams(location.search).get("locale"));if(e)return e;let n=location.hash.indexOf("?");return n<0?null:pe(new URLSearchParams(location.hash.slice(n+1)).get("locale"))}function Jt(){let e=ln();return!e||e===f.locale?!1:(f.setLocale(e),!0)}function Qn(){let e=location.hash.indexOf("?");return e<0?null:{path:location.hash.slice(0,e)||"#/",params:new URLSearchParams(location.hash.slice(e+1))}}function eo(){let e=Qn(),n=e?.params.get("open");if(!e||!n||n!=="bot-onboarding"&&n!=="create-session")return!1;e.params.delete("open");let o=e.params.toString();return history.replaceState(null,"",o?`${e.path}?${o}`:e.path),n==="bot-onboarding"?window.dispatchEvent(new Event(me)):$e(),!0}function Yt(){let e=re?`v${re}`:"";return ke==="runtime"?s("update.navRuntimeBadgeTitle",{version:e}):s("update.navBadgeTitle",{version:e})}function Zt(e){xe=e}function Xe(){if(xe)return xe;let e=document.getElementById("root");if(!e)throw new Error("dashboard root is not mounted");return xe=e,e}function to(){return(0,l.useEffect)(()=>{Lt()},[]),(0,l.useEffect)(()=>{Fe()}),(0,t.jsxs)("div",{className:"theme-menu",id:"theme-menu",children:[(0,t.jsx)("button",{type:"button",className:"theme-menu-btn",id:"theme-menu-btn","aria-haspopup":"listbox","aria-expanded":"false","aria-label":"Theme",children:(0,t.jsx)("span",{className:"tm-ic",children:(0,t.jsxs)("svg",{className:"tm-svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor"}),(0,t.jsx)("path",{d:"M12 2a10 10 0 0 0 0 20h1.7a2.3 2.3 0 0 0 1.6-4c-.5-.5-.2-1.3.5-1.3H17a5 5 0 0 0 5-5 9.7 9.7 0 0 0-10-9.7z"})]})})}),(0,t.jsx)("div",{className:"theme-menu-pop",id:"theme-menu-pop",role:"listbox",hidden:!0})]})}function no(){let e=[...ue.sessions.values()],n=e.filter(c=>c.status!=="closed"),o=n.map(c=>({s:c,reason:mt(c)})).filter(c=>!!c.reason).sort((c,u)=>he(c.s)-he(u.s)),a=new Set(o.map(c=>String(c.s.sessionId??""))),r=n.filter(c=>Gn.has(String(c.status))&&!a.has(String(c.sessionId??""))).length,d=o[0]??null,p=Mt(e).filter(c=>c.online||c.active.length>0).length,h=Math.max(0,n.length-o.length-r);return{working:r,attention:o.length,idle:h,onlineBots:p,attentionNotice:d?{count:o.length,time:ut(he(d.s)),bot:ht(d.s),reason:d.reason}:null}}function we(e){return(0,t.jsxs)("div",{className:`topbar-status-row${e.hot?" topbar-status-row-hot":""}`,children:[(0,t.jsx)("span",{children:e.label}),(0,t.jsx)("b",{className:e.value>0?"status-count-on":void 0,children:e.value})]})}function oo(e){let{attention:n,idle:o,working:a}=e.summary,r=a+n+o,d=r===0?"conic-gradient(var(--border) 0 360deg)":(()=>{let p=a/r*360,h=p+n/r*360;return`conic-gradient(var(--accent) 0 ${p}deg, var(--warning) ${p}deg ${h}deg, var(--success) ${h}deg 360deg)`})();return(0,t.jsxs)("div",{className:"topbar-status-donut-wrap","aria-hidden":"true",children:[(0,t.jsx)("div",{className:"topbar-status-donut",style:{background:d}}),(0,t.jsxs)("div",{className:"topbar-status-donut-center",children:[(0,t.jsx)("b",{children:r}),(0,t.jsx)("span",{children:s("overview.openSessions")})]})]})}function Je(){window.dispatchEvent(new Event(ze))}function ao(e){let{autoOpen:n=!1,summary:o}=e,[a,r]=(0,l.useState)(!1),[d,p]=(0,l.useState)(!1),[h,c]=(0,l.useState)(!1),u=(0,l.useRef)(null),m=n&&!d,k=a||m;return(0,l.useEffect)(()=>{n||p(!1)},[n]),(0,l.useEffect)(()=>{if(!k)return;let g=x=>{let y=x.target;y instanceof Node&&u.current?.contains(y)||(r(!1),p(!0))};return document.addEventListener("pointerdown",g),()=>document.removeEventListener("pointerdown",g)},[k]),(0,t.jsxs)("div",{ref:u,className:`topbar-status-menu${m?" topbar-status-auto-open":""}${a?" is-open":""}${h?" suppress-hover":""}`,onPointerEnter:Je,onPointerLeave:()=>c(!1),onFocusCapture:Je,onBlur:g=>{let x=g.relatedTarget;(!(x instanceof Node)||!g.currentTarget.contains(x))&&r(!1)},onKeyDown:g=>{g.key==="Escape"&&(r(!1),p(!0),c(!0),g.currentTarget.querySelector("#status")?.focus())},children:[(0,t.jsx)("button",{type:"button",id:"status",className:"connection-status","aria-haspopup":"true","aria-expanded":k,onClick:()=>{if(Je(),k){r(!1),p(!0),c(!0);return}c(!1),r(!0)},children:s("overview.sessionOverview")}),(0,t.jsxs)("div",{className:"topbar-status-pop",children:[o.attentionNotice?(0,t.jsxs)("a",{className:"topbar-attention-notice",href:"#/sessions",children:[(0,t.jsx)("span",{className:"topbar-attention-dot","aria-hidden":"true"}),(0,t.jsxs)("span",{className:"topbar-attention-copy",children:[(0,t.jsx)("b",{children:s("strip.pending",{count:o.attentionNotice.count})}),(0,t.jsx)("small",{children:s("strip.longestCompact",{time:o.attentionNotice.time,bot:o.attentionNotice.bot,reason:o.attentionNotice.reason})})]}),(0,t.jsx)("span",{className:"topbar-attention-action",children:s("strip.handle")})]}):null,(0,t.jsxs)("div",{className:"topbar-status-list",children:[(0,t.jsx)(we,{label:s("overview.workingSessions"),value:o.working}),(0,t.jsx)(we,{label:s("overview.idleSessions"),value:o.idle}),(0,t.jsx)(we,{label:s("overview.attention"),value:o.attention,hot:o.attention>0}),(0,t.jsx)(we,{label:s("overview.onlineBots"),value:o.onlineBots})]}),(0,t.jsx)(oo,{summary:o})]})]})}function Qt(e){if(!e.open)return null;let n=!!e.loginUrl;return(0,t.jsx)("div",{id:"auth-expired-overlay",className:"auth-expired-overlay",role:"presentation",onClick:o=>{o.target===o.currentTarget&&e.onClose()},children:(0,t.jsxs)("div",{className:"auth-expired-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"auth-expired-title",children:[(0,t.jsx)("h2",{id:"auth-expired-title",children:n?"\u767B\u5F55 Dashboard":"\u8BBF\u95EE\u94FE\u63A5\u5DF2\u5931\u6548"}),(0,t.jsx)("p",{children:n?"\u5F53\u524D\u6D4F\u89C8\u5668\u5C1A\u672A\u767B\u5F55\u3002\u70B9\u51FB\u540E\u5C06\u901A\u8FC7 Botmux \u5E73\u53F0\u6821\u9A8C\u673A\u5668 owner \u6743\u9650\uFF0C\u5E76\u8FD4\u56DE\u5F53\u524D\u9875\u9762\uFF1B\u65E0\u6743\u9650\u8D26\u53F7\u4ECD\u4F1A\u88AB\u62D2\u7EDD\u3002":"\u5F53\u524D\u94FE\u63A5/\u8BBF\u95EE\u5DF2\u5931\u6548\uFF0C\u8BF7\u4F7F\u7528\u6700\u65B0\u6388\u6743\u94FE\u63A5\u91CD\u65B0\u8FDB\u5165\uFF08\u8FD0\u884C botmux dashboard \u83B7\u53D6\uFF09\u3002"}),(0,t.jsxs)("div",{className:"auth-expired-actions",children:[e.loginUrl?(0,t.jsx)("a",{id:"dashboard-one-click-login",className:"auth-login-link primary",href:e.loginUrl,target:"_top",rel:"noopener",children:"\u4E00\u952E\u767B\u5F55"}):null,(0,t.jsx)("button",{id:"auth-expired-dismiss",type:"button",className:n?"secondary":"primary",onClick:e.onClose,children:n?"\u6682\u4E0D\u767B\u5F55":"\u77E5\u9053\u4E86"})]})]})})}function ro(e){let n=new Date(e);if(Number.isNaN(n.getTime()))return e.slice(0,10);try{return new Intl.DateTimeFormat(f.locale==="zh"?"zh-CN":"en-US",{year:"numeric",month:"numeric",day:"numeric"}).format(n)}catch{return e.slice(0,10)}}async function en(){let e=await fetch("/__selfcheck",{cache:"no-store"}),n=await e.text();if(!e.ok||!n)throw new Error(s("update.healthCheckFailed"));return n}function so(e){let{status:n}=e,[o,a]=(0,l.useState)(!1),[r,d]=(0,l.useState)("idle"),[p,h]=(0,l.useState)(0),[c,u]=(0,l.useState)(!1),[m,k]=(0,l.useState)(!1),[w,g]=(0,l.useState)(""),[x,y]=(0,l.useState)(!1),[O,B]=(0,l.useState)(!1),[E,Re]=(0,l.useState)(!1),[q,ie]=(0,l.useState)(!1),[j,nt]=(0,l.useState)([]),[M,Ne]=(0,l.useState)(null),[D,Le]=(0,l.useState)(null),S=(0,l.useRef)(!1),G=(0,l.useRef)(null),le=(0,l.useRef)(null),ot=(0,l.useRef)(null),Te=(0,l.useRef)(null),Se=(0,l.useRef)(null),[X,at]=(0,l.useState)(null),dn=()=>{G.current!==null&&(window.clearTimeout(G.current),G.current=null)},Ce=()=>{le.current!==null&&(window.clearInterval(le.current),le.current=null)};if((0,l.useEffect)(()=>{S.current=!1,d("idle"),h(0),u(!1),k(!1),g(""),y(!1),B(!1),Re(!1),ie(!1),nt([]),Ne(null),Le(null)},[n?.current,n?.latest]),(0,l.useEffect)(()=>{if(Ce(),r==="idle"||r==="error"){h(0);return}let i=r==="updating"?50:95;return r==="restarting"&&h(b=>Math.max(b,50)),le.current=window.setInterval(()=>{h(b=>b>=i?i:b+Math.max(.5,(i-b)*.08))},400),()=>Ce()},[r]),(0,l.useEffect)(()=>{n&&k(n.versionLookupOk===!1)},[n]),(0,l.useEffect)(()=>{o||y(!1)},[o]),(0,l.useEffect)(()=>{if(!o||!X)return;let i=window.requestAnimationFrame(()=>{Se.current?.querySelector('button:not([disabled]), a[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')?.focus()});return()=>window.cancelAnimationFrame(i)},[o,X!==null]),(0,l.useEffect)(()=>{if(!o){at(null);return}let i=()=>{let b=Te.current;if(!b)return;let R=b.getBoundingClientRect(),C=Math.min(340,Math.max(0,window.innerWidth-32)),$=Math.max(16,Math.min(R.left,window.innerWidth-C-16));at({top:R.bottom+8,left:$})};return i(),window.addEventListener("resize",i),document.addEventListener("scroll",i,!0),()=>{window.removeEventListener("resize",i),document.removeEventListener("scroll",i,!0)}},[o]),(0,l.useEffect)(()=>()=>{dn(),Ce()},[]),(0,l.useEffect)(()=>{if(!o)return;let i=R=>{let C=R.target;ot.current?.contains(C)||Se.current?.contains(C)||a(!1)},b=R=>{R.key==="Escape"&&(a(!1),Te.current?.focus())};return document.addEventListener("pointerdown",i),document.addEventListener("keydown",b),()=>{document.removeEventListener("pointerdown",i),document.removeEventListener("keydown",b)}},[o]),!n)return null;let U=n.behind&&!!n.latest,Pe=!n.latest,Oe=U&&n.updateSupported&&!n.localDevInstall&&n.node.ok,rt=(n.rollbackSupported??n.updateSupported)&&!n.localDevInstall&&n.node.ok,H=r==="updating"||r==="restarting",st=2*Math.PI*20,un=st*(1-Math.max(2,Math.round(p))/100),pn=n.updateCommand??"botmux update",Ae=`v${n.current}`,hn=n.latest?`v${n.latest}`:"",mn=n.localDevInstall?s("update.localDev"):n.updateSupported?n.node.ok?"":s("update.nodeWarn",{version:n.node.version,required:n.node.required}):s("update.unsupportedInstall"),it=i=>{let b=Date.now(),R=async()=>{try{let C=await fetch("/__selfcheck",{cache:"no-store"}),$=await C.text();if(C.ok&&$&&$!==i){location.reload();return}}catch{}if(Date.now()-b>9e4){S.current=!1,d("error"),g(s("update.restartSlow"));return}G.current=window.setTimeout(()=>{R()},2e3)};G.current=window.setTimeout(()=>{R()},3e3)},fn=async()=>{if(U){if(!Oe){a(!1),location.hash="#/settings";return}if(!S.current){S.current=!0,Le(null),k(!1),g("");try{let i=await en(),b=await Ue(fetch,d);if(b.bootstrapRequired){S.current=!1,d("error"),g(s("update.bootstrapRequired"));return}if(!b.restarted){S.current=!1,d("error"),g(s("update.restartFailed",{detail:b.restartError??"unknown"}));return}it(i)}catch(i){S.current=!1,d("error"),g(i instanceof Error?i.message:String(i))}}}},De=async(i=!1)=>{if(E)return!q;Re(!0),ie(!1);try{let b=await fetch(`/api/update/versions${i?"?refresh=1":""}`,{cache:"no-store"}),R=await b.json().catch(()=>null);if(!R||!Array.isArray(R.versions))throw new Error("Invalid rollback versions response");let C=R.versions.filter(_=>{if(!_||typeof _!="object")return!1;let J=_;return typeof J.version=="string"&&(typeof J.publishedAt=="string"||J.publishedAt===null)}).slice(0,3);nt(C),Ne(_=>C.some(J=>J.version===_)?_:null),B(!0);let $=b.ok&&R.ok===!0;return ie(!$),$}catch{return B(!0),ie(!0),!1}finally{Re(!1)}},bn=async()=>{if(!(!M||!rt||E||S.current)){S.current=!0,Le(M),k(!1),g("");try{let i=await en();await Ue(fetch,d,M),it(i)}catch(i){S.current=!1,d("error"),g(i instanceof Error?i.message:String(i))}}},gn=async()=>{if(!(c||H)){u(!0),k(!1);try{let i=await e.onRefresh();x&&await De(!0),k(!i)}finally{u(!1)}}},ce=r==="updating"?D?s("update.rollbackInstalling",{version:D}):s("update.updating",{command:pn}):r==="restarting"?D?s("update.rollbackRestarting",{version:D}):s("update.restarting"):r==="error"?D?s("update.rollbackFailed",{detail:w}):s("update.updateFailed",{detail:w}):m?s("update.topbarRefreshFailed"):U?Oe?s("update.versionUpgradePrompt",{version:hn}):mn:n.latest?s("update.upToDate"):s("update.checkUnavailable"),vn=Oe?r==="error"?s("update.topbarRetry"):r==="idle"?s("update.topbarAction"):s("update.topbarWorking"):s("update.topbarReview"),de=r==="error"||m&&Pe?{className:"is-error",symbol:"!"}:U?{className:"has-update",symbol:"\u2191"}:Pe?{className:"is-unknown",symbol:"?"}:{className:"is-current",symbol:"\u2713"};return(0,t.jsxs)("div",{ref:ot,className:`dashboard-version-control${o?" is-open":""}`,children:[(0,t.jsxs)("button",{ref:Te,type:"button",className:`dashboard-version-chip${U?" has-update":""}${Pe?" is-unknown":""}${r==="error"?" is-error":""}`,"aria-haspopup":"dialog","aria-expanded":o,"aria-label":`${Ae}. ${ce}`,title:ce,onClick:()=>a(i=>!i),children:[(0,t.jsx)("span",{children:Ae}),(0,t.jsx)("span",{className:`dashboard-version-state ${de.className}`,"aria-hidden":"true",children:de.symbol})]}),o&&X&&typeof document<"u"?(0,nn.createPortal)((0,t.jsxs)("section",{ref:Se,className:"dashboard-version-popover",role:"dialog","aria-modal":"false","aria-labelledby":"dashboard-version-title",style:{top:X.top,left:X.left},children:[(0,t.jsxs)("header",{className:"dashboard-version-popover-head",children:[(0,t.jsx)("strong",{id:"dashboard-version-title",children:s("update.current")}),(0,t.jsxs)("div",{className:"dashboard-version-head-actions",children:[(0,t.jsx)("button",{type:"button",className:`dashboard-version-refresh${c?" is-refreshing":""}`,"aria-label":s(c?"update.topbarRefreshing":"update.topbarRefresh"),title:s(c?"update.topbarRefreshing":"update.topbarRefresh"),disabled:c||E||H,onClick:()=>{gn()},children:(0,t.jsxs)("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M13.2 5.7A5.8 5.8 0 1 0 13 10.8"}),(0,t.jsx)("path",{d:"M13.2 2.8v2.9h-2.9"})]})}),(0,t.jsx)("button",{type:"button",className:"dashboard-version-close","aria-label":s("update.topbarClose"),onClick:()=>a(!1),children:"\xD7"})]})]}),(0,t.jsxs)("div",{className:"dashboard-version-popover-body",children:[(0,t.jsxs)("div",{className:"dashboard-version-current",children:[(0,t.jsx)("strong",{children:Ae}),H?(0,t.jsxs)("span",{className:"dashboard-version-ring",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(p),"aria-label":ce,children:[(0,t.jsxs)("svg",{viewBox:"0 0 44 44",width:"44",height:"44","aria-hidden":"true",children:[(0,t.jsx)("defs",{children:(0,t.jsxs)("linearGradient",{id:"dvr-grad",x1:"0%",y1:"100%",x2:"100%",y2:"0%",children:[(0,t.jsx)("stop",{offset:"0%",stopColor:"var(--brand-accent-cyan)"}),(0,t.jsx)("stop",{offset:"55%",stopColor:"var(--accent)"}),(0,t.jsx)("stop",{offset:"100%",stopColor:"var(--brand-accent-pink)"})]})}),(0,t.jsx)("circle",{className:"dvr-track",cx:"22",cy:"22",r:"20"}),(0,t.jsx)("circle",{className:"dvr-arc",cx:"22",cy:"22",r:"20",style:{strokeDasharray:st,strokeDashoffset:un}})]}),(0,t.jsxs)("span",{className:"dvr-pct",children:[Math.round(p),"%"]})]}):(0,t.jsx)("span",{className:de.className,"aria-hidden":"true",children:de.symbol})]}),(0,t.jsx)("p",{className:`dashboard-version-message${r==="error"||m?" is-error":""}`,role:r==="error"||m?"alert":"status","aria-live":"polite",children:ce}),(0,t.jsxs)("a",{className:"dashboard-version-release-link",href:"https://github.com/deepcoldy/botmux/releases",target:"_blank",rel:"noopener noreferrer",children:[(0,t.jsx)("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M8 1.5a6.5 6.5 0 0 0-2.1 12.65c.33.06.45-.14.45-.32v-1.26c-1.84.4-2.23-.78-2.23-.78-.3-.76-.73-.96-.73-.96-.6-.41.05-.4.05-.4.66.05 1 .68 1 .68.59 1 1.54.72 1.92.55.06-.42.23-.72.42-.88-1.47-.17-3.02-.74-3.02-3.28 0-.72.26-1.32.68-1.78-.07-.17-.3-.84.07-1.75 0 0 .56-.18 1.79.68A6.2 6.2 0 0 1 8 4.63a6.2 6.2 0 0 1 1.71.22c1.23-.86 1.79-.68 1.79-.68.37.91.14 1.58.07 1.75.42.46.68 1.06.68 1.78 0 2.55-1.55 3.11-3.03 3.28.24.21.45.61.45 1.23v1.62c0 .18.12.38.46.32A6.5 6.5 0 0 0 8 1.5Z"})}),(0,t.jsx)("span",{children:s("update.changelogViewOnGitHub")})]}),(U||x)&&n.installs.multiple?(0,t.jsxs)("details",{className:"dashboard-version-installs",children:[(0,t.jsx)("summary",{children:s("update.multiInstallWarn")}),(0,t.jsx)("ul",{children:n.installs.entries.map(i=>(0,t.jsx)("li",{children:i.binPath},i.binPath))})]}):null,rt?(0,t.jsxs)("details",{className:"dashboard-version-rollback",open:x,"aria-busy":E,onToggle:i=>{let b=i.currentTarget.open;y(b),b&&!O&&!E&&De()},children:[(0,t.jsxs)("summary",{children:[(0,t.jsxs)("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"8",cy:"8",r:"5.5"}),(0,t.jsx)("path",{d:"M8 4.8V8l2.2 1.3"})]}),(0,t.jsx)("span",{children:s("update.rollbackTitle")}),(0,t.jsx)("span",{className:"dashboard-version-rollback-chevron","aria-hidden":"true",children:"\u2304"})]}),(0,t.jsxs)("div",{className:"dashboard-version-rollback-body",children:[E&&j.length===0?(0,t.jsxs)("p",{className:"dashboard-version-rollback-status",role:"status","aria-live":"polite",children:[(0,t.jsx)("span",{className:"dashboard-update-spinner","aria-hidden":"true"}),s("update.rollbackLoading")]}):null,q?(0,t.jsxs)("p",{className:"dashboard-version-rollback-load-error",role:"alert",children:[(0,t.jsx)("span",{children:s("update.rollbackLoadFailed")}),(0,t.jsx)("button",{type:"button",disabled:E,onClick:()=>{De(!0)},children:s("update.rollbackRetry")})]}):null,O&&!E&&!q&&j.length===0?(0,t.jsx)("p",{className:"dashboard-version-rollback-status",children:s("update.rollbackEmpty")}):null,j.length>0?(0,t.jsxs)("fieldset",{disabled:H||E||q,children:[(0,t.jsx)("legend",{children:s("update.rollbackHint")}),(0,t.jsx)("div",{className:"dashboard-version-rollback-options",children:j.map(i=>(0,t.jsxs)("label",{className:M===i.version?"is-selected":"",children:[(0,t.jsx)("input",{type:"radio",name:"dashboard-rollback-version",value:i.version,checked:M===i.version,onChange:()=>Ne(i.version)}),(0,t.jsxs)("strong",{children:["v",i.version]}),i.publishedAt?(0,t.jsx)("time",{dateTime:i.publishedAt,children:ro(i.publishedAt)}):null]},i.version))})]}):null,M?(0,t.jsxs)("p",{id:"dashboard-version-rollback-risk",className:"dashboard-version-rollback-risk",role:"note",children:[(0,t.jsxs)("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M7.1 2.3 1.8 12a1 1 0 0 0 .9 1.5h10.6a1 1 0 0 0 .9-1.5L8.9 2.3a1 1 0 0 0-1.8 0Z"}),(0,t.jsx)("path",{d:"M8 5.5v3.6M8 11.6h.01"})]}),(0,t.jsxs)("span",{children:[s("update.rollbackRisk",{version:M})," ",(0,t.jsx)("a",{href:`https://github.com/deepcoldy/botmux/releases/tag/v${encodeURIComponent(M)}`,target:"_blank",rel:"noopener noreferrer","aria-label":s("update.rollbackReleaseNotesA11y",{version:M}),children:s("update.rollbackReleaseNotes",{version:M})})]})]}):null,j.length>0?(0,t.jsxs)("button",{type:"button",className:"dashboard-version-rollback-action",disabled:!M||E||q||H,"aria-describedby":M?"dashboard-version-rollback-risk":void 0,onClick:()=>{bn()},children:[H&&D?(0,t.jsx)("span",{className:"dashboard-update-spinner","aria-hidden":"true"}):null,M?r==="error"&&D===M?s("update.rollbackRetry"):s("update.rollbackAction",{version:M}):s("update.rollbackSelect")]}):null]})]}):null]}),U&&!x&&!D?(0,t.jsxs)("footer",{className:"dashboard-version-popover-actions",children:[(0,t.jsx)("button",{type:"button",className:"dashboard-version-secondary",onClick:()=>a(!1),children:H?s("update.topbarClose"):s("update.topbarLater")}),(0,t.jsx)("button",{type:"button",className:"dashboard-version-primary",disabled:H,onClick:()=>{fn()},children:vn})]}):null]}),document.body):null]})}function io(){let e=no(),[n,o]=(0,l.useState)(!1),[a,r]=(0,l.useState)(!1),[d,p]=(0,l.useState)(!1),h=(0,l.useRef)(e.attention),c=(0,l.useRef)(null),u=()=>{c.current!==null&&(window.clearTimeout(c.current),c.current=null)};(0,l.useEffect)(()=>{let w=()=>o(!0);return window.addEventListener(me,w),()=>window.removeEventListener(me,w)},[]),(0,l.useEffect)(()=>{let w=()=>r(!0);return window.addEventListener(Qe,w),se&&r(!0),()=>window.removeEventListener(Qe,w)},[]),(0,l.useEffect)(()=>()=>u(),[]),(0,l.useEffect)(()=>{let w=h.current;if(h.current=e.attention,e.attention===0){u(),p(!1);return}w!==0||document.body.classList.contains("theme-menu-open")||(p(!0),u(),c.current=window.setTimeout(()=>{c.current=null,p(!1)},4e3))},[e.attention]);let m=()=>{se=!1,r(!1)},k=_e()?Ee.startsWith("#/agent-workbench-dock")?"dock":Ee.startsWith("#/agent-workbench")?"appCenter":null:null;return k?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"workbench-route-host","data-workbench-surface":k,children:(0,t.jsx)("main",{id:"root",ref:Zt})}),(0,t.jsx)(Qt,{open:a,loginUrl:ve(Me,location.hash),onClose:m}),(0,t.jsx)(Be,{}),(0,t.jsx)(Ie,{})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"aurora","aria-hidden":"true",children:[(0,t.jsx)("i",{className:"a1"}),(0,t.jsx)("i",{className:"a2"}),(0,t.jsx)("i",{className:"a3"})]}),(0,t.jsxs)("div",{className:"app-shell",children:[(0,t.jsxs)("header",{className:"topbar",children:[(0,t.jsx)("div",{className:"topbar-left",children:(0,t.jsxs)("div",{className:"topbar-brand-block",children:[(0,t.jsxs)("a",{className:"brand",href:"#/",children:[(0,t.jsx)("span",{className:"brand-mark","aria-hidden":"true",children:(0,t.jsx)("img",{className:"brand-logo-img",src:"/assets/brand-logo.png",alt:"",decoding:"sync",loading:"eager",fetchPriority:"high"})}),(0,t.jsx)("strong",{className:"brand-wordmark",children:"Botmux"}),(0,t.jsx)("span",{className:"brand-product",children:"Dashboard"})]}),(0,t.jsx)(so,{status:an,onRefresh:()=>et(!0)})]})}),(0,t.jsxs)("div",{className:"topbar-actions",children:[(0,t.jsx)(ao,{summary:e,autoOpen:d}),(0,t.jsxs)("div",{className:"topbar-tool-group",children:[(0,t.jsx)("button",{type:"button",className:"topbar-locale-toggle","aria-label":f.locale==="zh"?"Switch to English":"\u5207\u6362\u5230\u4E2D\u6587",title:f.locale==="zh"?"Switch to English":"\u5207\u6362\u5230\u4E2D\u6587",onClick:()=>lo(f.locale==="zh"?"en":"zh"),children:f.locale==="zh"?"CN":"EN"}),(0,t.jsx)(to,{}),(0,t.jsxs)("a",{className:"topbar-docs-link",href:"https://deepcoldy.github.io/botmux/",target:"_blank",rel:"noopener noreferrer",title:s("nav.docs"),"aria-label":s("nav.docs"),children:[ne((0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:"2.2",y:"2.2",width:"11.6",height:"11.6",rx:"2"}),(0,t.jsx)("path",{d:"M4.8 5.2h6.4M4.8 8h6.4M4.8 10.8h4"})]})),(0,t.jsx)("span",{children:s("nav.docs")})]})]}),(0,t.jsxs)("span",{className:"topbar-owner",title:V?.name,"aria-label":V?.name??"Owner",children:[(0,t.jsx)("span",{className:"topbar-owner-placeholder","aria-hidden":"true",children:ne((0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:"8",cy:"6",r:"2.4"}),(0,t.jsx)("path",{d:"M3.7 13c.7-2.5 2.2-3.7 4.3-3.7s3.6 1.2 4.3 3.7"})]}))}),V?.avatarUrl?(0,t.jsx)("img",{className:"topbar-owner-img",src:V.avatarUrl,alt:"",decoding:"async",referrerPolicy:"no-referrer",onError:w=>{w.currentTarget.remove()}}):null]})]})]}),(0,t.jsxs)("div",{className:"chrome-body",children:[(0,t.jsxs)("aside",{className:"sidebar",children:[T?(0,t.jsxs)("div",{className:"sidebar-create-actions",children:[(0,t.jsxs)("button",{type:"button",className:"sidebar-create-btn",onClick:()=>$e(),children:[ne((0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M2 3.5h12v7H6l-3 3v-3H2z"}),(0,t.jsx)("path",{d:"M8 4.9v4.2M5.9 7h4.2"})]})),(0,t.jsx)("span",{className:"sidebar-nav-label",children:s("nav.createSession")})]}),(0,t.jsxs)("button",{type:"button",className:"sidebar-create-btn",onClick:()=>{wt()},children:[ne((0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:"2.5",y:"6",width:"11",height:"7.5",rx:"2"}),(0,t.jsx)("circle",{cx:"5.8",cy:"9.75",r:"1"}),(0,t.jsx)("circle",{cx:"10.2",cy:"9.75",r:"1"}),(0,t.jsx)("path",{d:"M8 6V3.8M6.3 1.9h3.4"})]})),(0,t.jsx)("span",{className:"sidebar-nav-label",children:s("nav.createBot")})]})]}):null,(0,t.jsx)("nav",{className:"sidebar-nav","aria-label":"Dashboard",children:(()=>{let w=Jn().filter(y=>T||!y.manage),g=new Map(w.map(y=>[y.id,y])),x=w.filter(y=>y.plugin);return jn.map(y=>{let O=y.items.flatMap(B=>{let E=g.get(B);return E?E.id==="plugins"?[E,...x]:[E]:[]});return O.length===0?null:(0,t.jsxs)("div",{className:"nav-group",children:[(0,t.jsx)("div",{className:"nav-group-title",children:s(y.labelKey)}),O.map(Zn)]},y.id)})})()})]}),(0,t.jsxs)("div",{className:"workspace",children:[(0,t.jsx)("dialog",{id:"create-session-modal",className:"create-session-modal"}),(0,t.jsx)(yt,{open:n,onClose:()=>o(!1)}),(0,t.jsx)("main",{id:"root",ref:Zt})]})]})]}),(0,t.jsx)(Qt,{open:a,loginUrl:ve(Me,location.hash),onClose:m}),(0,t.jsx)(Be,{}),(0,t.jsx)(Ie,{})]})}function N(){rn?.render((0,t.jsx)(io,{}))}function lo(e){f.setLocale(e),ho(e)}var se=!1;function cn(e){let n=!!ve(e,location.hash),o=n&&Me!==e;n&&(Me=e),se&&o&&N(),!se&&(se=!0,window.dispatchEvent(new Event(Qe)))}var Ye;function co(){let e=document.getElementById("readonly-toast");e||(e=document.createElement("div"),e.id="readonly-toast",e.style.cssText="position:fixed;left:50%;bottom:28px;transform:translateX(-50%);z-index:9999;background:var(--fg,#1f2329);color:var(--bg,#fff);padding:10px 18px;border-radius:var(--radius-lg);font-size:13px;box-shadow:0 8px 24px rgba(0,0,0,.25)",document.body.appendChild(e)),e.textContent="\u5F53\u524D\u662F\u53EA\u8BFB\u8BBF\u95EE\uFF0C\u6B64\u64CD\u4F5C\u9700\u8981\u6388\u6743\u94FE\u63A5\uFF08\u8FD0\u884C botmux dashboard \u83B7\u53D6\uFF09",e.style.display="block",Ye&&window.clearTimeout(Ye),Ye=window.setTimeout(()=>{e.style.display="none"},4e3)}var tt=window.fetch.bind(window);window.fetch=async function(...n){let o=await tt(...n);if(o.status===401){if(o.headers.get("x-botmux-auth-scope")==="workbench")return o;let a=o.headers.get("x-botmux-login-url")??void 0,r=(n[1]?.method??"GET").toUpperCase();a||(r==="GET"||r==="HEAD")&&!ye?cn(a):co()}return o};async function uo(){try{let e=await tt("/api/workbench/capabilities",{cache:"no-store"});f.workbenchCapabilities=e.ok?ct(await e.json()):He}catch{f.workbenchCapabilities=He}}async function po(){let e=uo();try{let n=await tt("/api/settings");if(n.ok){let o=await n.json();T=!!o.authed,f.authed=T,f.workbenchAuthed=T,ye=!!(o.settings&&o.settings.publicReadOnly),f.publicReadOnly=ye;let a=ln()??pe(o.lang);a&&f.setLocale(a)}else if(n.status===401&&n.headers.get("x-botmux-auth-scope")==="workbench")T=!1,f.authed=!1,f.workbenchAuthed=!0,ye=!1,f.publicReadOnly=!1;else if(n.status===401){T=!1,f.authed=!1,f.workbenchAuthed=!1;let o=n.headers.get("x-botmux-login-url")??void 0;cn(o)}}catch{}await e}async function tn(){try{let e=await fetch("/api/plugins/dashboard");if(!e.ok)return;let n=await e.json();oe=(Array.isArray(n?.plugins)?n.plugins:[]).filter(a=>a.pinned===!0&&typeof a.route=="string").map(a=>({id:`plugin:${a.pluginId}:${a.id}`,href:a.route,label:a.displayName||a.pluginId,manage:!0,plugin:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M5.2 2.2h5.6v3.1l1.7 1.7-1.4 1.4-1-1v6.4H5.9V7.4l-1 1L3.5 7l1.7-1.7z"}),(0,t.jsx)("path",{d:"M8 13.8v1"})]})})),N()}catch{}}async function ho(e){if(T)try{await fetch("/api/settings",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({lang:e})})}catch{}}async function et(e=!1){if(!T)return!1;try{let n=await fetch(`/api/update/status${e?"?refresh=1":""}`,{cache:"no-store"});if(!n.ok)return!1;let o=await n.json();an=o;let a=Array.isArray(o.cliUpdates)?o.cliUpdates.find(r=>r?.updateAvailable===!0&&r?.latest):null;return o.behind===!0&&o.latest?(ae=!0,ke="botmux",re=String(o.latest)):a?(ae=!0,ke="runtime",re=String(a.latest)):(ae=!1,ke=null,re=null),N(),o.versionLookupOk!==!1}catch{return!1}}function mo(e){e.innerHTML='<section class="auth-required" style="max-width:520px;margin:64px auto;text-align:center;background:var(--surface);color:var(--fg);border:1px solid var(--border);border-radius:var(--radius-lg);padding:40px 36px;box-shadow:0 8px 28px rgba(0,0,0,.12)"><h2 style="margin:0 0 12px;font-size:20px;color:var(--fg)">\u6B64\u9875\u9700\u8981\u6388\u6743\u94FE\u63A5</h2><p style="margin:0 0 24px;line-height:1.7;color:var(--muted);font-size:14px">\u4F60\u5F53\u524D\u662F\u53EA\u8BFB\u8BBF\u95EE\uFF0C\u7BA1\u7406\u9875\uFF08\u7FA4\u89D2\u8272 / Profiles / Bot \u914D\u7F6E / \u56E2\u961F / Webhook\uFF09\u9700\u8981\u6388\u6743\u94FE\u63A5\u3002\u8FD0\u884C <code>botmux dashboard</code> \u83B7\u53D6\u6700\u65B0\u94FE\u63A5\u540E\u5373\u53EF\u7BA1\u7406\u3002</p><a href="#/" style="display:inline-block;padding:8px 22px;background:var(--accent);color:var(--on-accent);border-radius:var(--radius-lg);text-decoration:none;font-size:14px">\u8FD4\u56DE\u603B\u89C8</a></section>'}async function Ze(){let e=Ot(I),n=location.hash||"#/";Ee=n,N();let o=xt(n);if(o){window.location.replace(o);return}if(!T&&qn.some(a=>n.startsWith("#/"+a))){mo(Xe()),I.rerenderOnUiChange=!0;return}if(n.startsWith("#/v3")){window.location.replace(`#/workflows${n.slice(4)}`);return}else if(n.startsWith("#/legacy-workflow")){window.location.replace("#/workflows");return}else if(/^#\/workflows(?:\/|-)catalog(?:[/?].*)?$/.test(n)){window.location.replace("#/workflows");return}if(n.startsWith("#/role-profiles")){window.location.replace(`#/roles/profile${n.slice(15)}`);return}try{let a=Tt(n);await At(I,e,Xe(),a?a.load:St,{rerenderOnUiChange:a?a.rerenderOnUiChange:!1}),e===I.seq&&T&&eo()}catch(a){if(e!==I.seq||It(a,{href:window.location.href,hash:n,getSessionStorage:()=>window.sessionStorage,reload:()=>window.location.reload()}))return;Xe().innerHTML=`<section class="page"><div class="empty">Dashboard route failed: ${dt(String(a))}</div></section>`,I.pageDispose=null,I.rerenderOnUiChange=!0}}function fo(){try{let e=JSON.parse(window.localStorage.getItem(sn)??"null");if(e?.avatarUrl)return{avatarUrl:String(e.avatarUrl),name:e.name?String(e.name):void 0}}catch{}return null}function bo(){V=fo(),N(),fetch("/api/owner-profile").then(e=>e.ok?e.json():null).then(e=>{if(!(!e?.ok||!e.avatarUrl)){V={avatarUrl:String(e.avatarUrl),name:e.name?String(e.name):void 0};try{window.localStorage.setItem(sn,JSON.stringify({avatarUrl:e.avatarUrl,name:e.name??""}))}catch{}N()}}).catch(()=>{})}(async()=>{let e=kt(window.location.href);e&&window.history.replaceState(window.history.state,"",e),f.init(),Jt();let n=document.getElementById("app-root");if(!n)throw new Error("missing dashboard app root");Ft(n),jt(),rn=(0,on.createRoot)(n),N(),f.on(()=>{N(),I.rerenderOnUiChange&&Ze()}),ue.on(()=>{N()}),await po(),N(),window.addEventListener(bt,()=>{tn()}),tn(),et(),window.setInterval(()=>{document.hidden||et()},30*6e4),bo();try{await lt({canReadSchedules:()=>f.authed||f.publicReadOnly})}catch(o){console.error("botmux dashboard bootstrap failed",o),ue.setOnline(!1)}pt().then(N),Et().then(N),window.addEventListener("hashchange",()=>{Jt()||Ze()}),Ze()})();export{cn as showAuthExpiredOverlay,co as showReadOnlyToast};
|
|
1
|
+
import{a as kt,b as _e,d as xt}from"./chunks/chunk-2PVRDXEL.js";import{a as Et,b as Mt}from"./chunks/chunk-YJA3KY3J.js";import{b as $e}from"./chunks/chunk-SZOB6VK2.js";import{a as bt}from"./chunks/chunk-BD3PZGH2.js";import{b as Ue}from"./chunks/chunk-G5ZS2YUS.js";import{b as Be}from"./chunks/chunk-OXSVWLER.js";import{a as me,b as wt,c as yt}from"./chunks/chunk-MMLTCXHP.js";import"./chunks/chunk-KTQ7B6ZR.js";import{c as Ie}from"./chunks/chunk-CEUCNZFJ.js";import{i as gt,j as vt}from"./chunks/chunk-NYY66DNC.js";import"./chunks/chunk-R3LJUCEO.js";import{a as ue,b as lt}from"./chunks/chunk-QITAMHW6.js";import{G as pt,I as ht,L as mt,M as he,c as pe,u as He,v as ct,w as f,x as s,y as dt,z as ut}from"./chunks/chunk-K232GT3M.js";import{a as yn,b as kn}from"./chunks/chunk-ARROO6TE.js";import{c as Y,d as wn,e as ft}from"./chunks/chunk-3YZFAHNK.js";var nn=Y(yn(),1),on=Y(kn(),1),l=Y(wn(),1);var ze="botmux:close-theme-menu",xn={palette:'<circle cx="13.5" cy="6.5" r=".5" fill="currentColor"/><circle cx="17.5" cy="10.5" r=".5" fill="currentColor"/><circle cx="8.5" cy="7.5" r=".5" fill="currentColor"/><circle cx="6.5" cy="12.5" r=".5" fill="currentColor"/><path d="M12 2a10 10 0 0 0 0 20h1.7a2.3 2.3 0 0 0 1.6-4c-.5-.5-.2-1.3.5-1.3H17a5 5 0 0 0 5-5 9.7 9.7 0 0 0-10-9.7z"/>',monitor:'<rect width="20" height="14" x="2" y="3" rx="2"/><line x1="8" x2="16" y1="21" y2="21"/><line x1="12" x2="12" y1="17" y2="21"/>',sun:'<circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/>',moon:'<path d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"/>',cpu:'<path d="M12 20v2"/><path d="M12 2v2"/><path d="M17 20v2"/><path d="M17 2v2"/><path d="M2 12h2"/><path d="M2 17h2"/><path d="M2 7h2"/><path d="M20 12h2"/><path d="M20 17h2"/><path d="M20 7h2"/><path d="M7 20v2"/><path d="M7 2v2"/><rect x="4" y="4" width="16" height="16" rx="2"/><rect x="8" y="8" width="8" height="8" rx="1"/>',zap:'<path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"/>',chevron:'<path d="m6 9 6 6 6-6"/>'},Nt=[{labelKey:"theme.base",options:[{value:"system",labelKey:"status.system",icon:"monitor"},{value:"light",labelKey:"status.light",icon:"sun"},{value:"dark",labelKey:"status.dark",icon:"moon"}]},{labelKey:"theme.skins",options:[{value:"cyber",labelKey:"skin.cyber",icon:"cpu"},{value:"fallout",labelKey:"skin.fallout",icon:"zap"}]}],Rt=Nt.flatMap(e=>e.options),L=!1,Z=null,Q=null,En=70,Mn=120;function Ke(e){return`<svg class="tm-svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${xn[e]??""}</svg>`}function Rn(e){return e.replace(/[&<>"]/g,n=>({"&":"&","<":"<",">":">",'"':"""})[n])}function Lt(){let e=document.getElementById("theme-menu"),n=document.getElementById("theme-menu-btn"),o=document.getElementById("theme-menu-pop");if(!e||!n||!o||e.dataset.themeMenuInit==="1")return;e.dataset.themeMenuInit="1",o.innerHTML=Nt.map(u=>`<div class="tm-group" data-label-key="${u.labelKey}"></div>`+u.options.map(m=>`<button type="button" class="tm-item" role="option" data-value="${m.value}"><span class="tm-ic">${Ke(m.icon)}</span><span class="tm-label" data-label-key="${m.labelKey}"></span></button>`).join("")).join("");let a=()=>{if(!L)return;let u=n.getBoundingClientRect(),m=12,k=Math.min(Math.max(o.offsetWidth||216,216),Math.max(0,window.innerWidth-m*2)),w=m+k/2,g=window.innerWidth-m-k/2,x=u.left+u.width/2,y=Math.min(Math.max(x,w),Math.max(w,g)),O=Math.max(180,window.innerHeight-u.bottom-20);o.style.setProperty("--theme-menu-pop-left",`${Math.round(y)}px`),o.style.setProperty("--theme-menu-pop-top",`${Math.round(u.bottom+8)}px`),o.style.setProperty("--theme-menu-pop-max-height",`${Math.round(O)}px`)},r=u=>{Z!=null&&(window.clearTimeout(Z),Z=null),Q!=null&&(window.clearTimeout(Q),Q=null),L=u,n.setAttribute("aria-expanded",String(L)),document.body.classList.toggle("theme-menu-open",L),L?(o.hidden=!1,a(),window.requestAnimationFrame(()=>e.classList.add("open"))):(e.classList.remove("open"),Q=window.setTimeout(()=>{Q=null,L||(o.hidden=!0)},Mn))},d=()=>r(!0),p=()=>{Z==null&&(Z=window.setTimeout(()=>r(!1),En))},h=u=>{u.pointerType!=="touch"&&d()},c=u=>{u.pointerType!=="touch"&&p()};e.addEventListener("pointerenter",h),e.addEventListener("pointerleave",c),o.addEventListener("pointerenter",h),o.addEventListener("pointerleave",c),n.addEventListener("click",u=>{u.stopPropagation(),r(!L)}),n.addEventListener("focus",()=>{n.matches(":focus-visible")&&d()}),e.addEventListener("focusout",u=>{let m=u.relatedTarget;(!(m instanceof Node)||!e.contains(m))&&p()}),o.addEventListener("click",u=>{let m=u.target.closest(".tm-item");m&&(f.setTheme(m.dataset.value??"system"),r(!1))}),document.addEventListener("click",u=>{L&&!e.contains(u.target)&&r(!1)}),document.addEventListener("pointermove",u=>{if(!L||u.pointerType==="touch")return;let m=u.target;m instanceof Node&&e.contains(m)||p()}),document.addEventListener("keydown",u=>{u.key==="Escape"&&L&&r(!1)}),window.addEventListener("resize",a),window.addEventListener("scroll",a,!0),window.addEventListener(ze,()=>{L&&r(!1)}),Fe()}function Fe(){let e=document.getElementById("theme-menu-btn");if(!e)return;let n=Rt.find(o=>o.value===f.theme)??Rt[0];e.innerHTML=`<span class="tm-ic">${Ke("palette")}</span><span class="tm-current">${Rn(s(n.labelKey))}</span><span class="tm-chev">${Ke("chevron")}</span>`,document.querySelectorAll("#theme-menu-pop [data-label-key]").forEach(o=>{o.textContent=s(o.dataset.labelKey??"")}),document.querySelectorAll("#theme-menu-pop .tm-item").forEach(o=>{o.classList.toggle("active",o.dataset.value===f.theme)})}function v(e,n,o,a,r=!1){return{id:e,routePrefix:n,rerenderOnUiChange:r,load:async()=>(await o())[a]}}var Nn=[v("agent-workbench-dock","#/agent-workbench-dock",()=>import("./chunks/agent-workbench-dock-page-6LC422N6.js"),"renderAgentWorkbenchDockPage"),v("agent-workbench","#/agent-workbench",()=>import("./chunks/agent-workbench-page-RSAWY7O2.js"),"renderAgentWorkbenchPage"),{id:"plugins",routePrefix:"#/plugins",rerenderOnUiChange:!1,load:async()=>{let e=await import("./chunks/plugin-page-AKQZFAC4.js");return n=>e.renderPluginPage(n)}},v("workflows","#/workflows",()=>import("./chunks/v3-page-M4XF6D5Z.js"),"renderV3RunsPage"),v("groups","#/groups",()=>import("./chunks/groups-page-7PONUYHE.js"),"renderGroupsPage"),v("settings","#/settings",()=>import("./chunks/settings-page-G7B3STUF.js"),"renderSettingsPage"),v("bot-defaults","#/bot-defaults",()=>import("./chunks/bot-defaults-page-67RAWCSQ.js"),"renderBotDefaultsPage"),v("skills","#/skills",()=>import("./chunks/skills-page-CEWKQOIG.js"),"renderSkillsPage"),v("customization","#/customization",()=>import("./chunks/customization-page-VQJAEDZY.js"),"renderCustomizationPage"),v("connectors-logs","#/connectors/logs",()=>import("./chunks/connectors-page-DJCTHSFB.js"),"renderConnectorsLogsPage"),v("webhook-logs","#/webhook-logs",()=>import("./chunks/connectors-page-DJCTHSFB.js"),"renderConnectorsLogsPage"),v("connectors","#/connectors",()=>import("./chunks/connectors-page-DJCTHSFB.js"),"renderConnectorsPage"),v("team-manage","#/team/manage",()=>import("./chunks/team-federation-page-NUP4VK4H.js"),"renderTeamManagePage"),v("team","#/team",()=>import("./chunks/team-federation-page-NUP4VK4H.js"),"renderTeamFederationPage"),v("roles-profile","#/roles/profile",()=>import("./chunks/roles-page-FNI4MGX6.js"),"renderRoleProfilesPage"),v("roles","#/roles",()=>import("./chunks/roles-page-FNI4MGX6.js"),"renderRolesPage"),v("schedules","#/schedules",()=>import("./chunks/schedules-page-6PUU63KS.js"),"renderSchedulesPage"),v("whiteboards","#/whiteboards",()=>import("./chunks/whiteboards-page-L755NZX6.js"),"renderWhiteboardsPage"),v("monitoring","#/monitoring",()=>import("./chunks/monitoring-page-JHDD2VS2.js"),"renderMonitoringPage"),v("sessions","#/sessions",()=>import("./chunks/sessions-page-O4N72EXT.js"),"renderSessionsPage"),v("monitor-room","#/monitor-room",()=>import("./chunks/monitor-room-F3QNEW7N.js"),"renderMonitorRoomPage",!0),v("office","#/office",()=>import("./chunks/office-page-MMTN4IKD.js"),"renderOfficePage"),v("insights","#/insights",()=>import("./chunks/insights-page-J6DAAJ6D.js"),"renderInsightsPage"),v("feedback","#/feedback",()=>import("./chunks/feedback-page-O7SZRKNM.js"),"renderFeedbackPage")];function Tt(e){return Nn.find(n=>n.exact?e===n.routePrefix:e.startsWith(n.routePrefix))}async function St(){let e=await import("./chunks/overview-page-IQ2UJAJP.js");return n=>e.renderOverviewPage(n)}function Pt(){return{seq:0,pageDispose:null,rerenderOnUiChange:!0}}function Ot(e){let n=++e.seq;return e.pageDispose&&(e.pageDispose(),e.pageDispose=null),n}function Ct(e,n){return n===e.seq}async function At(e,n,o,a,r={}){let d=await a();if(!Ct(e,n))return!1;let p=d(o);return Ct(e,n)?(e.pageDispose=typeof p=="function"?p:null,e.rerenderOnUiChange=r.rerenderOnUiChange??!0,!0):(typeof p=="function"&&p(),!1)}var Ln="botmux.dashboard.stale-chunk-reload.v1:",Tn=/Failed to fetch dynamically imported module|Importing a module script failed|error loading dynamically imported module|dynamically imported module/i,Sn=/\b(?:https?:\/\/|\/assets\/)\S+?\.js\b/;function Dt(e){return e instanceof Error?`${e.name}: ${e.message}`:String(e)}function Ht(e){return Tn.test(Dt(e))}function Cn(e,n){let r=Dt(e).match(Sn)?.[0]||`${n.href}|${n.hash}`;return`${Ln}${r.slice(-240)}`}function Pn(e,n){if(!Ht(e))return!1;let o=Cn(e,n);try{if(n.sessionStorage.getItem(o)==="1")return!1;n.sessionStorage.setItem(o,"1")}catch{return!1}return n.reload(),!0}function It(e,n){if(!Ht(e))return!1;let o;try{o=n.getSessionStorage()}catch{return!1}return Pn(e,{...n,sessionStorage:o})}var On=new Set(["auto","scroll","overlay"]),fe=28,P=3,K=6,Bt=!1,zt=null,Ut=new WeakMap,A=new Map,$t=null,_t=null,We=0,Ve=0,ee=null;function An(e){return e.closest("dialog[open]")??document.body}function Dn(e){let n=Ut.get(e);if(n?.isConnected)return n;let o=document.createElement("div");return o.className="floating-scrollbar-layer",o.setAttribute("aria-hidden","true"),e.appendChild(o),Ut.set(e,o),o}function Hn(e){return On.has(e)}function qe(e,n){let o=getComputedStyle(e),a=n==="y"?o.overflowY:o.overflowX;return Hn(a)?n==="y"?e.scrollHeight-e.clientHeight>1:e.scrollWidth-e.clientWidth>1:!1}function In(e){if(!e.isConnected||e.closest("[hidden]"))return!1;let n=e.getBoundingClientRect();return n.width>0&&n.height>0&&n.bottom>0&&n.right>0&&n.top<window.innerHeight&&n.left<window.innerWidth}function Bn(e){return[e,...Array.from(e.querySelectorAll("*"))].filter(o=>In(o)&&(qe(o,"x")||qe(o,"y")))}function be(e){e.hideTimer!==void 0&&window.clearTimeout(e.hideTimer),e.track.remove()}function Un(e,n){let o=A.get(e);o||(o={},A.set(e,o));let a=o[n],r=An(e),d=Dn(r);if(a?.track.parentElement===d)return a;a&&be(a);let p=document.createElement("div"),h=document.createElement("div");p.className=`floating-scrollbar floating-scrollbar-${n}`,h.className="floating-scrollbar-thumb",p.appendChild(h),d.appendChild(p);let c={target:e,axis:n,track:p,thumb:h,hideTimer:void 0};return o[n]=c,c}function je(e,n=!1){e.track.classList.add("is-visible"),e.hideTimer!==void 0&&window.clearTimeout(e.hideTimer),e.hideTimer=n?void 0:window.setTimeout(()=>{e.track.classList.remove("is-visible","is-active"),e.hideTimer=void 0},900)}function $n(e){let{target:n,axis:o,track:a,thumb:r}=e,d=n.getBoundingClientRect();if(o==="y"){let w=Math.max(0,d.top+P),g=Math.min(window.innerHeight,d.bottom-P),x=Math.max(0,g-w);if(x<fe||n.scrollHeight<=n.clientHeight){a.hidden=!0;return}let y=Math.max(fe,Math.round(x*n.clientHeight/n.scrollHeight)),O=Math.max(1,n.scrollHeight-n.clientHeight),B=Math.round((x-y)*n.scrollTop/O);a.hidden=!1,a.style.left=`${Math.min(window.innerWidth-K-P,Math.max(P,d.right-K-P))}px`,a.style.top=`${w}px`,a.style.width=`${K}px`,a.style.height=`${x}px`,r.style.width="100%",r.style.height=`${y}px`,r.style.transform=`translate3d(0, ${B}px, 0)`;return}let p=Math.max(0,d.left+P),h=Math.min(window.innerWidth,d.right-P),c=Math.max(0,h-p);if(c<fe||n.scrollWidth<=n.clientWidth){a.hidden=!0;return}let u=Math.max(fe,Math.round(c*n.clientWidth/n.scrollWidth)),m=Math.max(1,n.scrollWidth-n.clientWidth),k=Math.round((c-u)*n.scrollLeft/m);a.hidden=!1,a.style.left=`${p}px`,a.style.top=`${Math.min(window.innerHeight-K-P,Math.max(P,d.bottom-K-P))}px`,a.style.width=`${c}px`,a.style.height=`${K}px`,r.style.width=`${u}px`,r.style.height="100%",r.style.transform=`translate3d(${k}px, 0, 0)`}function z(){We||(We=window.requestAnimationFrame(()=>{We=0,Kn()}))}function _n(){Ve||(Ve=window.setTimeout(()=>{Ve=0,z()},120))}function Kn(){let e=zt;if(!e)return;let n=new Set(Bn(e));for(let[o,a]of A)n.has(o)||(a.x&&be(a.x),a.y&&be(a.y),A.delete(o));for(let o of n){let a=o===ee;for(let r of["x","y"]){let d=A.get(o);if(!qe(o,r)){let h=d?.[r];h&&(be(h),delete d?.[r]);continue}let p=Un(o,r);$n(p),a&&je(p,!0)}}}function zn(e){if(!(e instanceof HTMLElement))return;let n=A.get(e);if(n)for(let o of Object.values(n))o&&(o.track.classList.add("is-active"),je(o))}function Fn(e){for(let n=e;n;n=n.parentElement)if(n instanceof HTMLElement&&A.has(n))return n;return null}function Kt(e){if(ee===e)return;let n=ee?A.get(ee):void 0;if(ee=e,n)for(let a of Object.values(n))a?.track.classList.remove("is-visible");let o=e?A.get(e):void 0;if(o)for(let a of Object.values(o))a&&je(a,!0)}function Ft(e){Bt||(Bt=!0,zt=e,document.documentElement.classList.add("floating-scrollbars-on"),$t=typeof ResizeObserver>"u"?null:new ResizeObserver(z),$t?.observe(e),_t=new MutationObserver(n=>{for(let o of n){let a=o.target;if(!(a instanceof Element&&a.closest(".floating-scrollbar-layer"))){_n();return}}}),_t.observe(e,{attributes:!0,attributeFilter:["class","style","hidden","open"],childList:!0,subtree:!0}),document.addEventListener("scroll",n=>{zn(n.target),z()},!0),window.addEventListener("resize",z),window.addEventListener("hashchange",z),document.addEventListener("pointermove",n=>{Kt(Fn(document.elementFromPoint(n.clientX,n.clientY)))}),document.addEventListener("pointerleave",()=>Kt(null)),z())}var Wt=!1,F=null,ge=null,W=null;function qt(){if(F)return F;let e=document.createElement("div");return e.className="icon-tip",e.setAttribute("role","tooltip"),e.style.display="none",document.body.appendChild(e),F=e,e}function Wn(e){let n=qt(),o=gt(e,document.body);return n.parentNode!==o&&o.appendChild(n),n}function Vn(e){let n=qt(),o=e.getBoundingClientRect(),a=n.offsetWidth,r=n.offsetHeight,d=8,p=o.top<r+d+4,h=o.left+o.width/2-a/2;h=Math.min(Math.max(h,6),window.innerWidth-a-6);let c=p?o.bottom+d:o.top-r-d;n.style.left=`${Math.round(h)}px`,n.style.top=`${Math.round(c)}px`,n.dataset.placement=p?"bottom":"top"}function te(){W&&(clearTimeout(W),W=null),ge=null,F&&(F.style.display="none",F.classList.remove("show"))}function Vt(e){let n=e.getAttribute("data-tip");if(!n)return;ge=e;let o=Wn(e);o.textContent=n,o.style.display="block",o.classList.remove("show"),Vn(e),requestAnimationFrame(()=>{ge===e&&o.classList.add("show")})}function Ge(e){return e instanceof Element?e.closest("[data-tip]"):null}function jt(){Wt||typeof document>"u"||(Wt=!0,document.addEventListener("pointerover",e=>{let n=Ge(e.target);!n||n===ge||(W&&clearTimeout(W),W=setTimeout(()=>Vt(n),120))}),document.addEventListener("pointerout",e=>{let n=Ge(e.target);if(!n)return;let o=e.relatedTarget instanceof Element?e.relatedTarget:null;o&&(o===n||n.contains(o))||te()}),document.addEventListener("focusin",e=>{let n=Ge(e.target);n&&Vt(n)}),document.addEventListener("focusout",te),document.addEventListener("click",te,!0),window.addEventListener("scroll",te,!0),window.addEventListener("resize",te))}function ve(e,n){if(e)try{let o=new URL(e);if(!["http:","https:"].includes(o.protocol)||o.username||o.password)return;let a=n.startsWith("#/")&&n.length<=4096&&!/[\u0000-\u001f\u007f]/.test(n)?n:"#/";return o.searchParams.set("next",`/${a}`),o.toString()}catch{return}}var t=Y(ft(),1),qn=["roles","role-profiles","bot-defaults","skills","customization","plugins","team","connectors","insights","feedback","whiteboards"],Gt=[{id:"overview",href:"#/",labelKey:"nav.overview",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:"1.5",y:"1.5",width:"5.4",height:"5.4",rx:"1.5"}),(0,t.jsx)("rect",{x:"9.1",y:"1.5",width:"5.4",height:"5.4",rx:"1.5"}),(0,t.jsx)("rect",{x:"1.5",y:"9.1",width:"5.4",height:"5.4",rx:"1.5"}),(0,t.jsx)("rect",{x:"9.1",y:"9.1",width:"5.4",height:"5.4",rx:"1.5"})]})},{id:"sessions",href:"#/sessions",labelKey:"nav.sessions",icon:(0,t.jsx)("path",{d:"M2 3.5h12v7H6l-3 3v-3H2z"})},{id:"agent-workbench",href:"#/agent-workbench",labelKey:"nav.workbench",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:"2",y:"3",width:"12",height:"10",rx:"1.5"}),(0,t.jsx)("path",{d:"M4.5 6.5l2 1.5-2 1.5M8 10h3"})]})},{id:"groups",href:"#/groups",labelKey:"nav.groups",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:"5.6",cy:"5.8",r:"2.4"}),(0,t.jsx)("circle",{cx:"11",cy:"6.8",r:"1.9"}),(0,t.jsx)("path",{d:"M1.8 13.2c.5-2.4 2-3.6 3.8-3.6s3.3 1.2 3.8 3.6M9.8 12.6c.4-1.7 1.5-2.6 2.8-2.6 1 0 1.9.5 2.4 1.6"})]})},{id:"roles",href:"#/roles",labelKey:"nav.roles",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M8 1.8l5.2 2v3.4c0 3.4-2.2 5.9-5.2 7-3-1.1-5.2-3.6-5.2-7V3.8z"}),(0,t.jsx)("path",{d:"M5.8 8l1.6 1.6 2.8-3"})]})},{id:"monitoring",href:"#/monitoring",labelKey:"nav.monitoring",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M2 9.2h2.3l1.3-4.8 2.5 8.4 1.8-5.1h4.1"}),(0,t.jsx)("path",{d:"M2 2.5h12v11H2z"})]})},{id:"insights",href:"#/insights",labelKey:"nav.insights",manage:!0,icon:(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("path",{d:"M2 2v12h12M5 11V7M8.5 11V4.5M12 11V8.5"})})},{id:"feedback",href:"#/feedback",labelKey:"nav.feedback",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M2.2 3.2h11.6v8H8l-3.2 2.6v-2.6H2.2z"}),(0,t.jsx)("path",{d:"M5 6.2h6M5 8.3h4"})]})},{id:"workflows",href:"#/workflows",labelKey:"nav.workflows",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:"3.4",cy:"3.6",r:"1.9"}),(0,t.jsx)("circle",{cx:"3.4",cy:"12.4",r:"1.9"}),(0,t.jsx)("circle",{cx:"12.6",cy:"8",r:"1.9"}),(0,t.jsx)("path",{d:"M5.2 4.4l5.6 2.8M5.2 11.6l5.6-2.8"})]})},{id:"schedules",href:"#/schedules",labelKey:"nav.schedules",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:"8",cy:"8",r:"6.2"}),(0,t.jsx)("path",{d:"M8 4.5V8l2.4 1.6"})]})},{id:"whiteboards",href:"#/whiteboards",labelKey:"nav.whiteboards",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:"2.2",y:"2.2",width:"11.6",height:"11.6",rx:"2"}),(0,t.jsx)("path",{d:"M4.8 5.2h6.4M4.8 8h6.4M4.8 10.8h4"})]})},{id:"office",href:"#/office",labelKey:"nav.office",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:"3",y:"4",width:"10",height:"7",rx:"2"}),(0,t.jsx)("circle",{cx:"6",cy:"7.5",r:"1"}),(0,t.jsx)("circle",{cx:"10",cy:"7.5",r:"1"}),(0,t.jsx)("path",{d:"M8 4V2M4.5 11v2M11.5 11v2"})]})},{id:"bot-defaults",href:"#/bot-defaults",labelKey:"nav.botDefaults",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:"2.5",y:"5",width:"11",height:"8",rx:"2"}),(0,t.jsx)("circle",{cx:"5.8",cy:"9",r:"1"}),(0,t.jsx)("circle",{cx:"10.2",cy:"9",r:"1"}),(0,t.jsx)("path",{d:"M8 5V2.5M5.5 13v1.2M10.5 13v1.2"})]})},{id:"skills",href:"#/skills",labelKey:"nav.skills",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M3 2.5h10v3H3zM3 7h10v6.5H3z"}),(0,t.jsx)("path",{d:"M5.4 9.2h5.2M5.4 11.2h3.8"})]})},{id:"customization",href:"#/customization",labelKey:"nav.customization",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M11.5 2.5l2 2-7 7-2.6.6.6-2.6z"}),(0,t.jsx)("path",{d:"M2.5 13.5h5"})]})},{id:"plugins",href:"#/plugins",label:"\u63D2\u4EF6",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M6.4 1.8h3.2v3h2.8v3.2H9.6v2.8H6.4V8H3.6V4.8h2.8z"}),(0,t.jsx)("path",{d:"M2.2 11.8h11.6v2.4H2.2z"})]})},{id:"team",href:"#/team",labelKey:"nav.team",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:"8",cy:"8",r:"6.2"}),(0,t.jsx)("path",{d:"M1.8 8h12.4M8 1.8c-2 1.8-2 10.6 0 12.4 2-1.8 2-10.6 0-12.4z"})]})},{id:"connectors",href:"#/connectors",labelKey:"nav.connectors",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M5.5 6.5v-3a2.5 2.5 0 0 1 5 0v3"}),(0,t.jsx)("rect",{x:"3.5",y:"6.5",width:"9",height:"7",rx:"2"})]})},{id:"settings",href:"#/settings",labelKey:"nav.settings",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M8 1.75 9.35 2.05 10 3.28l1.38.3 1.04-.96.96.96-.96 1.04.3 1.38 1.23.65L14.25 8l-.3 1.35-1.23.65-.3 1.38.96 1.04-.96.96-1.04-.96-1.38.3-.65 1.23L8 14.25l-1.35-.3L6 12.72l-1.38-.3-1.04.96-.96-.96.96-1.04-.3-1.38-1.23-.65L1.75 8l.3-1.35 1.23-.65.3-1.38-.96-1.04.96-.96 1.04.96 1.38-.3.65-1.23z"}),(0,t.jsx)("circle",{cx:"8",cy:"8",r:"2"})]})}],jn=[{id:"overview",labelKey:"nav.group.overview",items:["overview"]},{id:"collab",labelKey:"nav.group.collab",items:["sessions","agent-workbench","groups","schedules","workflows","office"]},{id:"workforce",labelKey:"nav.group.workforce",items:["roles","skills","customization","bot-defaults"]},{id:"analytics",labelKey:"nav.group.analytics",items:["monitoring","insights","feedback"]},{id:"manage",labelKey:"nav.group.manage",items:["connectors","team","plugins","whiteboards","settings"]}],oe=[],T=!0,ye=!1,Ee=location.hash||"#/",V=null,ae=!1,re=null,ke=null,an=null,xe=null,rn=null,I=Pt(),sn="botmux.ownerAvatar.v1",Gn=new Set(["working","analyzing","active","starting"]),Qe="botmux:auth-expired",Me;function ne(e){return(0,t.jsx)("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:e})}function Xt(e){return e.labelKey?s(e.labelKey):e.label??""}function Xn(e,n){let o=n||"#/";return e.id==="plugins"&&oe.some(a=>a.href===o||o.startsWith(`${a.href}?`)||o.startsWith(`${a.href}/`))?!1:e.id==="sessions"&&(o==="#/monitor-room"||o.startsWith("#/monitor-room?")||o.startsWith("#/monitor-room/"))||e.id==="connectors"&&(o==="#/webhook-logs"||o.startsWith("#/webhook-logs?")||o.startsWith("#/webhook-logs/"))?!0:e.href===o||e.href!=="#/"&&(o.startsWith(`${e.href}?`)||o.startsWith(`${e.href}/`))}function Jn(){let e=_e()?Gt.filter(o=>o.id!=="workflows"):Gt;if(oe.length===0)return e;let n=e.findIndex(o=>o.id==="plugins");return n<0?[...e,...oe]:[...e.slice(0,n+1),...oe,...e.slice(n+1)]}function Yn(e){let n=[];return Xn(e,Ee)&&n.push("active"),e.id==="settings"&&ae&&n.push("nav-has-update"),n.length?n.join(" "):void 0}function Zn(e){return(0,t.jsxs)("a",{href:e.href,"data-route":e.id,className:[Yn(e),e.plugin?"sidebar-plugin-item":""].filter(Boolean).join(" ")||void 0,title:e.plugin?Xt(e):void 0,children:[ne(e.icon),(0,t.jsx)("span",{className:"sidebar-nav-label",children:Xt(e)}),e.id==="settings"&&ae?(0,t.jsx)(vt,{className:"nav-update-tip",label:Yt(),trigger:(0,t.jsx)("span",{className:"nav-update-dot","aria-hidden":"true"}),preventClick:!1,focusable:!1,children:Yt()}):null]})}function ln(){let e=pe(new URLSearchParams(location.search).get("locale"));if(e)return e;let n=location.hash.indexOf("?");return n<0?null:pe(new URLSearchParams(location.hash.slice(n+1)).get("locale"))}function Jt(){let e=ln();return!e||e===f.locale?!1:(f.setLocale(e),!0)}function Qn(){let e=location.hash.indexOf("?");return e<0?null:{path:location.hash.slice(0,e)||"#/",params:new URLSearchParams(location.hash.slice(e+1))}}function eo(){let e=Qn(),n=e?.params.get("open");if(!e||!n||n!=="bot-onboarding"&&n!=="create-session")return!1;e.params.delete("open");let o=e.params.toString();return history.replaceState(null,"",o?`${e.path}?${o}`:e.path),n==="bot-onboarding"?window.dispatchEvent(new Event(me)):$e(),!0}function Yt(){let e=re?`v${re}`:"";return ke==="runtime"?s("update.navRuntimeBadgeTitle",{version:e}):s("update.navBadgeTitle",{version:e})}function Zt(e){xe=e}function Xe(){if(xe)return xe;let e=document.getElementById("root");if(!e)throw new Error("dashboard root is not mounted");return xe=e,e}function to(){return(0,l.useEffect)(()=>{Lt()},[]),(0,l.useEffect)(()=>{Fe()}),(0,t.jsxs)("div",{className:"theme-menu",id:"theme-menu",children:[(0,t.jsx)("button",{type:"button",className:"theme-menu-btn",id:"theme-menu-btn","aria-haspopup":"listbox","aria-expanded":"false","aria-label":"Theme",children:(0,t.jsx)("span",{className:"tm-ic",children:(0,t.jsxs)("svg",{className:"tm-svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor"}),(0,t.jsx)("path",{d:"M12 2a10 10 0 0 0 0 20h1.7a2.3 2.3 0 0 0 1.6-4c-.5-.5-.2-1.3.5-1.3H17a5 5 0 0 0 5-5 9.7 9.7 0 0 0-10-9.7z"})]})})}),(0,t.jsx)("div",{className:"theme-menu-pop",id:"theme-menu-pop",role:"listbox",hidden:!0})]})}function no(){let e=[...ue.sessions.values()],n=e.filter(c=>c.status!=="closed"),o=n.map(c=>({s:c,reason:mt(c)})).filter(c=>!!c.reason).sort((c,u)=>he(c.s)-he(u.s)),a=new Set(o.map(c=>String(c.s.sessionId??""))),r=n.filter(c=>Gn.has(String(c.status))&&!a.has(String(c.sessionId??""))).length,d=o[0]??null,p=Mt(e).filter(c=>c.online||c.active.length>0).length,h=Math.max(0,n.length-o.length-r);return{working:r,attention:o.length,idle:h,onlineBots:p,attentionNotice:d?{count:o.length,time:ut(he(d.s)),bot:ht(d.s),reason:d.reason}:null}}function we(e){return(0,t.jsxs)("div",{className:`topbar-status-row${e.hot?" topbar-status-row-hot":""}`,children:[(0,t.jsx)("span",{children:e.label}),(0,t.jsx)("b",{className:e.value>0?"status-count-on":void 0,children:e.value})]})}function oo(e){let{attention:n,idle:o,working:a}=e.summary,r=a+n+o,d=r===0?"conic-gradient(var(--border) 0 360deg)":(()=>{let p=a/r*360,h=p+n/r*360;return`conic-gradient(var(--accent) 0 ${p}deg, var(--warning) ${p}deg ${h}deg, var(--success) ${h}deg 360deg)`})();return(0,t.jsxs)("div",{className:"topbar-status-donut-wrap","aria-hidden":"true",children:[(0,t.jsx)("div",{className:"topbar-status-donut",style:{background:d}}),(0,t.jsxs)("div",{className:"topbar-status-donut-center",children:[(0,t.jsx)("b",{children:r}),(0,t.jsx)("span",{children:s("overview.openSessions")})]})]})}function Je(){window.dispatchEvent(new Event(ze))}function ao(e){let{autoOpen:n=!1,summary:o}=e,[a,r]=(0,l.useState)(!1),[d,p]=(0,l.useState)(!1),[h,c]=(0,l.useState)(!1),u=(0,l.useRef)(null),m=n&&!d,k=a||m;return(0,l.useEffect)(()=>{n||p(!1)},[n]),(0,l.useEffect)(()=>{if(!k)return;let g=x=>{let y=x.target;y instanceof Node&&u.current?.contains(y)||(r(!1),p(!0))};return document.addEventListener("pointerdown",g),()=>document.removeEventListener("pointerdown",g)},[k]),(0,t.jsxs)("div",{ref:u,className:`topbar-status-menu${m?" topbar-status-auto-open":""}${a?" is-open":""}${h?" suppress-hover":""}`,onPointerEnter:Je,onPointerLeave:()=>c(!1),onFocusCapture:Je,onBlur:g=>{let x=g.relatedTarget;(!(x instanceof Node)||!g.currentTarget.contains(x))&&r(!1)},onKeyDown:g=>{g.key==="Escape"&&(r(!1),p(!0),c(!0),g.currentTarget.querySelector("#status")?.focus())},children:[(0,t.jsx)("button",{type:"button",id:"status",className:"connection-status","aria-haspopup":"true","aria-expanded":k,onClick:()=>{if(Je(),k){r(!1),p(!0),c(!0);return}c(!1),r(!0)},children:s("overview.sessionOverview")}),(0,t.jsxs)("div",{className:"topbar-status-pop",children:[o.attentionNotice?(0,t.jsxs)("a",{className:"topbar-attention-notice",href:"#/sessions",children:[(0,t.jsx)("span",{className:"topbar-attention-dot","aria-hidden":"true"}),(0,t.jsxs)("span",{className:"topbar-attention-copy",children:[(0,t.jsx)("b",{children:s("strip.pending",{count:o.attentionNotice.count})}),(0,t.jsx)("small",{children:s("strip.longestCompact",{time:o.attentionNotice.time,bot:o.attentionNotice.bot,reason:o.attentionNotice.reason})})]}),(0,t.jsx)("span",{className:"topbar-attention-action",children:s("strip.handle")})]}):null,(0,t.jsxs)("div",{className:"topbar-status-list",children:[(0,t.jsx)(we,{label:s("overview.workingSessions"),value:o.working}),(0,t.jsx)(we,{label:s("overview.idleSessions"),value:o.idle}),(0,t.jsx)(we,{label:s("overview.attention"),value:o.attention,hot:o.attention>0}),(0,t.jsx)(we,{label:s("overview.onlineBots"),value:o.onlineBots})]}),(0,t.jsx)(oo,{summary:o})]})]})}function Qt(e){if(!e.open)return null;let n=!!e.loginUrl;return(0,t.jsx)("div",{id:"auth-expired-overlay",className:"auth-expired-overlay",role:"presentation",onClick:o=>{o.target===o.currentTarget&&e.onClose()},children:(0,t.jsxs)("div",{className:"auth-expired-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"auth-expired-title",children:[(0,t.jsx)("h2",{id:"auth-expired-title",children:n?"\u767B\u5F55 Dashboard":"\u8BBF\u95EE\u94FE\u63A5\u5DF2\u5931\u6548"}),(0,t.jsx)("p",{children:n?"\u5F53\u524D\u6D4F\u89C8\u5668\u5C1A\u672A\u767B\u5F55\u3002\u70B9\u51FB\u540E\u5C06\u901A\u8FC7 Botmux \u5E73\u53F0\u6821\u9A8C\u673A\u5668 owner \u6743\u9650\uFF0C\u5E76\u8FD4\u56DE\u5F53\u524D\u9875\u9762\uFF1B\u65E0\u6743\u9650\u8D26\u53F7\u4ECD\u4F1A\u88AB\u62D2\u7EDD\u3002":"\u5F53\u524D\u94FE\u63A5/\u8BBF\u95EE\u5DF2\u5931\u6548\uFF0C\u8BF7\u4F7F\u7528\u6700\u65B0\u6388\u6743\u94FE\u63A5\u91CD\u65B0\u8FDB\u5165\uFF08\u8FD0\u884C botmux dashboard \u83B7\u53D6\uFF09\u3002"}),(0,t.jsxs)("div",{className:"auth-expired-actions",children:[e.loginUrl?(0,t.jsx)("a",{id:"dashboard-one-click-login",className:"auth-login-link primary",href:e.loginUrl,target:"_top",rel:"noopener",children:"\u4E00\u952E\u767B\u5F55"}):null,(0,t.jsx)("button",{id:"auth-expired-dismiss",type:"button",className:n?"secondary":"primary",onClick:e.onClose,children:n?"\u6682\u4E0D\u767B\u5F55":"\u77E5\u9053\u4E86"})]})]})})}function ro(e){let n=new Date(e);if(Number.isNaN(n.getTime()))return e.slice(0,10);try{return new Intl.DateTimeFormat(f.locale==="zh"?"zh-CN":"en-US",{year:"numeric",month:"numeric",day:"numeric"}).format(n)}catch{return e.slice(0,10)}}async function en(){let e=await fetch("/__selfcheck",{cache:"no-store"}),n=await e.text();if(!e.ok||!n)throw new Error(s("update.healthCheckFailed"));return n}function so(e){let{status:n}=e,[o,a]=(0,l.useState)(!1),[r,d]=(0,l.useState)("idle"),[p,h]=(0,l.useState)(0),[c,u]=(0,l.useState)(!1),[m,k]=(0,l.useState)(!1),[w,g]=(0,l.useState)(""),[x,y]=(0,l.useState)(!1),[O,B]=(0,l.useState)(!1),[E,Re]=(0,l.useState)(!1),[q,ie]=(0,l.useState)(!1),[j,nt]=(0,l.useState)([]),[M,Ne]=(0,l.useState)(null),[D,Le]=(0,l.useState)(null),S=(0,l.useRef)(!1),G=(0,l.useRef)(null),le=(0,l.useRef)(null),ot=(0,l.useRef)(null),Te=(0,l.useRef)(null),Se=(0,l.useRef)(null),[X,at]=(0,l.useState)(null),dn=()=>{G.current!==null&&(window.clearTimeout(G.current),G.current=null)},Ce=()=>{le.current!==null&&(window.clearInterval(le.current),le.current=null)};if((0,l.useEffect)(()=>{S.current=!1,d("idle"),h(0),u(!1),k(!1),g(""),y(!1),B(!1),Re(!1),ie(!1),nt([]),Ne(null),Le(null)},[n?.current,n?.latest]),(0,l.useEffect)(()=>{if(Ce(),r==="idle"||r==="error"){h(0);return}let i=r==="updating"?50:95;return r==="restarting"&&h(b=>Math.max(b,50)),le.current=window.setInterval(()=>{h(b=>b>=i?i:b+Math.max(.5,(i-b)*.08))},400),()=>Ce()},[r]),(0,l.useEffect)(()=>{n&&k(n.versionLookupOk===!1)},[n]),(0,l.useEffect)(()=>{o||y(!1)},[o]),(0,l.useEffect)(()=>{if(!o||!X)return;let i=window.requestAnimationFrame(()=>{Se.current?.querySelector('button:not([disabled]), a[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')?.focus()});return()=>window.cancelAnimationFrame(i)},[o,X!==null]),(0,l.useEffect)(()=>{if(!o){at(null);return}let i=()=>{let b=Te.current;if(!b)return;let R=b.getBoundingClientRect(),C=Math.min(340,Math.max(0,window.innerWidth-32)),$=Math.max(16,Math.min(R.left,window.innerWidth-C-16));at({top:R.bottom+8,left:$})};return i(),window.addEventListener("resize",i),document.addEventListener("scroll",i,!0),()=>{window.removeEventListener("resize",i),document.removeEventListener("scroll",i,!0)}},[o]),(0,l.useEffect)(()=>()=>{dn(),Ce()},[]),(0,l.useEffect)(()=>{if(!o)return;let i=R=>{let C=R.target;ot.current?.contains(C)||Se.current?.contains(C)||a(!1)},b=R=>{R.key==="Escape"&&(a(!1),Te.current?.focus())};return document.addEventListener("pointerdown",i),document.addEventListener("keydown",b),()=>{document.removeEventListener("pointerdown",i),document.removeEventListener("keydown",b)}},[o]),!n)return null;let U=n.behind&&!!n.latest,Pe=!n.latest,Oe=U&&n.updateSupported&&!n.localDevInstall&&n.node.ok,rt=(n.rollbackSupported??n.updateSupported)&&!n.localDevInstall&&n.node.ok,H=r==="updating"||r==="restarting",st=2*Math.PI*20,un=st*(1-Math.max(2,Math.round(p))/100),pn=n.updateCommand??"botmux update",Ae=`v${n.current}`,hn=n.latest?`v${n.latest}`:"",mn=n.localDevInstall?s("update.localDev"):n.updateSupported?n.node.ok?"":s("update.nodeWarn",{version:n.node.version,required:n.node.required}):s("update.unsupportedInstall"),it=i=>{let b=Date.now(),R=async()=>{try{let C=await fetch("/__selfcheck",{cache:"no-store"}),$=await C.text();if(C.ok&&$&&$!==i){location.reload();return}}catch{}if(Date.now()-b>9e4){S.current=!1,d("error"),g(s("update.restartSlow"));return}G.current=window.setTimeout(()=>{R()},2e3)};G.current=window.setTimeout(()=>{R()},3e3)},fn=async()=>{if(U){if(!Oe){a(!1),location.hash="#/settings";return}if(!S.current){S.current=!0,Le(null),k(!1),g("");try{let i=await en(),b=await Ue(fetch,d);if(b.bootstrapRequired){S.current=!1,d("error"),g(s("update.bootstrapRequired"));return}if(!b.restarted){S.current=!1,d("error"),g(s("update.restartFailed",{detail:b.restartError??"unknown"}));return}it(i)}catch(i){S.current=!1,d("error"),g(i instanceof Error?i.message:String(i))}}}},De=async(i=!1)=>{if(E)return!q;Re(!0),ie(!1);try{let b=await fetch(`/api/update/versions${i?"?refresh=1":""}`,{cache:"no-store"}),R=await b.json().catch(()=>null);if(!R||!Array.isArray(R.versions))throw new Error("Invalid rollback versions response");let C=R.versions.filter(_=>{if(!_||typeof _!="object")return!1;let J=_;return typeof J.version=="string"&&(typeof J.publishedAt=="string"||J.publishedAt===null)}).slice(0,3);nt(C),Ne(_=>C.some(J=>J.version===_)?_:null),B(!0);let $=b.ok&&R.ok===!0;return ie(!$),$}catch{return B(!0),ie(!0),!1}finally{Re(!1)}},bn=async()=>{if(!(!M||!rt||E||S.current)){S.current=!0,Le(M),k(!1),g("");try{let i=await en();await Ue(fetch,d,M),it(i)}catch(i){S.current=!1,d("error"),g(i instanceof Error?i.message:String(i))}}},gn=async()=>{if(!(c||H)){u(!0),k(!1);try{let i=await e.onRefresh();x&&await De(!0),k(!i)}finally{u(!1)}}},ce=r==="updating"?D?s("update.rollbackInstalling",{version:D}):s("update.updating",{command:pn}):r==="restarting"?D?s("update.rollbackRestarting",{version:D}):s("update.restarting"):r==="error"?D?s("update.rollbackFailed",{detail:w}):s("update.updateFailed",{detail:w}):m?s("update.topbarRefreshFailed"):U?Oe?s("update.versionUpgradePrompt",{version:hn}):mn:n.latest?s("update.upToDate"):s("update.checkUnavailable"),vn=Oe?r==="error"?s("update.topbarRetry"):r==="idle"?s("update.topbarAction"):s("update.topbarWorking"):s("update.topbarReview"),de=r==="error"||m&&Pe?{className:"is-error",symbol:"!"}:U?{className:"has-update",symbol:"\u2191"}:Pe?{className:"is-unknown",symbol:"?"}:{className:"is-current",symbol:"\u2713"};return(0,t.jsxs)("div",{ref:ot,className:`dashboard-version-control${o?" is-open":""}`,children:[(0,t.jsxs)("button",{ref:Te,type:"button",className:`dashboard-version-chip${U?" has-update":""}${Pe?" is-unknown":""}${r==="error"?" is-error":""}`,"aria-haspopup":"dialog","aria-expanded":o,"aria-label":`${Ae}. ${ce}`,title:ce,onClick:()=>a(i=>!i),children:[(0,t.jsx)("span",{children:Ae}),(0,t.jsx)("span",{className:`dashboard-version-state ${de.className}`,"aria-hidden":"true",children:de.symbol})]}),o&&X&&typeof document<"u"?(0,nn.createPortal)((0,t.jsxs)("section",{ref:Se,className:"dashboard-version-popover",role:"dialog","aria-modal":"false","aria-labelledby":"dashboard-version-title",style:{top:X.top,left:X.left},children:[(0,t.jsxs)("header",{className:"dashboard-version-popover-head",children:[(0,t.jsx)("strong",{id:"dashboard-version-title",children:s("update.current")}),(0,t.jsxs)("div",{className:"dashboard-version-head-actions",children:[(0,t.jsx)("button",{type:"button",className:`dashboard-version-refresh${c?" is-refreshing":""}`,"aria-label":s(c?"update.topbarRefreshing":"update.topbarRefresh"),title:s(c?"update.topbarRefreshing":"update.topbarRefresh"),disabled:c||E||H,onClick:()=>{gn()},children:(0,t.jsxs)("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M13.2 5.7A5.8 5.8 0 1 0 13 10.8"}),(0,t.jsx)("path",{d:"M13.2 2.8v2.9h-2.9"})]})}),(0,t.jsx)("button",{type:"button",className:"dashboard-version-close","aria-label":s("update.topbarClose"),onClick:()=>a(!1),children:"\xD7"})]})]}),(0,t.jsxs)("div",{className:"dashboard-version-popover-body",children:[(0,t.jsxs)("div",{className:"dashboard-version-current",children:[(0,t.jsx)("strong",{children:Ae}),H?(0,t.jsxs)("span",{className:"dashboard-version-ring",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(p),"aria-label":ce,children:[(0,t.jsxs)("svg",{viewBox:"0 0 44 44",width:"44",height:"44","aria-hidden":"true",children:[(0,t.jsx)("defs",{children:(0,t.jsxs)("linearGradient",{id:"dvr-grad",x1:"0%",y1:"100%",x2:"100%",y2:"0%",children:[(0,t.jsx)("stop",{offset:"0%",stopColor:"var(--brand-accent-cyan)"}),(0,t.jsx)("stop",{offset:"55%",stopColor:"var(--accent)"}),(0,t.jsx)("stop",{offset:"100%",stopColor:"var(--brand-accent-pink)"})]})}),(0,t.jsx)("circle",{className:"dvr-track",cx:"22",cy:"22",r:"20"}),(0,t.jsx)("circle",{className:"dvr-arc",cx:"22",cy:"22",r:"20",style:{strokeDasharray:st,strokeDashoffset:un}})]}),(0,t.jsxs)("span",{className:"dvr-pct",children:[Math.round(p),"%"]})]}):(0,t.jsx)("span",{className:de.className,"aria-hidden":"true",children:de.symbol})]}),(0,t.jsx)("p",{className:`dashboard-version-message${r==="error"||m?" is-error":""}`,role:r==="error"||m?"alert":"status","aria-live":"polite",children:ce}),(0,t.jsxs)("a",{className:"dashboard-version-release-link",href:"https://github.com/deepcoldy/botmux/releases",target:"_blank",rel:"noopener noreferrer",children:[(0,t.jsx)("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M8 1.5a6.5 6.5 0 0 0-2.1 12.65c.33.06.45-.14.45-.32v-1.26c-1.84.4-2.23-.78-2.23-.78-.3-.76-.73-.96-.73-.96-.6-.41.05-.4.05-.4.66.05 1 .68 1 .68.59 1 1.54.72 1.92.55.06-.42.23-.72.42-.88-1.47-.17-3.02-.74-3.02-3.28 0-.72.26-1.32.68-1.78-.07-.17-.3-.84.07-1.75 0 0 .56-.18 1.79.68A6.2 6.2 0 0 1 8 4.63a6.2 6.2 0 0 1 1.71.22c1.23-.86 1.79-.68 1.79-.68.37.91.14 1.58.07 1.75.42.46.68 1.06.68 1.78 0 2.55-1.55 3.11-3.03 3.28.24.21.45.61.45 1.23v1.62c0 .18.12.38.46.32A6.5 6.5 0 0 0 8 1.5Z"})}),(0,t.jsx)("span",{children:s("update.changelogViewOnGitHub")})]}),(U||x)&&n.installs.multiple?(0,t.jsxs)("details",{className:"dashboard-version-installs",children:[(0,t.jsx)("summary",{children:s("update.multiInstallWarn")}),(0,t.jsx)("ul",{children:n.installs.entries.map(i=>(0,t.jsx)("li",{children:i.binPath},i.binPath))})]}):null,rt?(0,t.jsxs)("details",{className:"dashboard-version-rollback",open:x,"aria-busy":E,onToggle:i=>{let b=i.currentTarget.open;y(b),b&&!O&&!E&&De()},children:[(0,t.jsxs)("summary",{children:[(0,t.jsxs)("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"8",cy:"8",r:"5.5"}),(0,t.jsx)("path",{d:"M8 4.8V8l2.2 1.3"})]}),(0,t.jsx)("span",{children:s("update.rollbackTitle")}),(0,t.jsx)("span",{className:"dashboard-version-rollback-chevron","aria-hidden":"true",children:"\u2304"})]}),(0,t.jsxs)("div",{className:"dashboard-version-rollback-body",children:[E&&j.length===0?(0,t.jsxs)("p",{className:"dashboard-version-rollback-status",role:"status","aria-live":"polite",children:[(0,t.jsx)("span",{className:"dashboard-update-spinner","aria-hidden":"true"}),s("update.rollbackLoading")]}):null,q?(0,t.jsxs)("p",{className:"dashboard-version-rollback-load-error",role:"alert",children:[(0,t.jsx)("span",{children:s("update.rollbackLoadFailed")}),(0,t.jsx)("button",{type:"button",disabled:E,onClick:()=>{De(!0)},children:s("update.rollbackRetry")})]}):null,O&&!E&&!q&&j.length===0?(0,t.jsx)("p",{className:"dashboard-version-rollback-status",children:s("update.rollbackEmpty")}):null,j.length>0?(0,t.jsxs)("fieldset",{disabled:H||E||q,children:[(0,t.jsx)("legend",{children:s("update.rollbackHint")}),(0,t.jsx)("div",{className:"dashboard-version-rollback-options",children:j.map(i=>(0,t.jsxs)("label",{className:M===i.version?"is-selected":"",children:[(0,t.jsx)("input",{type:"radio",name:"dashboard-rollback-version",value:i.version,checked:M===i.version,onChange:()=>Ne(i.version)}),(0,t.jsxs)("strong",{children:["v",i.version]}),i.publishedAt?(0,t.jsx)("time",{dateTime:i.publishedAt,children:ro(i.publishedAt)}):null]},i.version))})]}):null,M?(0,t.jsxs)("p",{id:"dashboard-version-rollback-risk",className:"dashboard-version-rollback-risk",role:"note",children:[(0,t.jsxs)("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M7.1 2.3 1.8 12a1 1 0 0 0 .9 1.5h10.6a1 1 0 0 0 .9-1.5L8.9 2.3a1 1 0 0 0-1.8 0Z"}),(0,t.jsx)("path",{d:"M8 5.5v3.6M8 11.6h.01"})]}),(0,t.jsxs)("span",{children:[s("update.rollbackRisk",{version:M})," ",(0,t.jsx)("a",{href:`https://github.com/deepcoldy/botmux/releases/tag/v${encodeURIComponent(M)}`,target:"_blank",rel:"noopener noreferrer","aria-label":s("update.rollbackReleaseNotesA11y",{version:M}),children:s("update.rollbackReleaseNotes",{version:M})})]})]}):null,j.length>0?(0,t.jsxs)("button",{type:"button",className:"dashboard-version-rollback-action",disabled:!M||E||q||H,"aria-describedby":M?"dashboard-version-rollback-risk":void 0,onClick:()=>{bn()},children:[H&&D?(0,t.jsx)("span",{className:"dashboard-update-spinner","aria-hidden":"true"}):null,M?r==="error"&&D===M?s("update.rollbackRetry"):s("update.rollbackAction",{version:M}):s("update.rollbackSelect")]}):null]})]}):null]}),U&&!x&&!D?(0,t.jsxs)("footer",{className:"dashboard-version-popover-actions",children:[(0,t.jsx)("button",{type:"button",className:"dashboard-version-secondary",onClick:()=>a(!1),children:H?s("update.topbarClose"):s("update.topbarLater")}),(0,t.jsx)("button",{type:"button",className:"dashboard-version-primary",disabled:H,onClick:()=>{fn()},children:vn})]}):null]}),document.body):null]})}function io(){let e=no(),[n,o]=(0,l.useState)(!1),[a,r]=(0,l.useState)(!1),[d,p]=(0,l.useState)(!1),h=(0,l.useRef)(e.attention),c=(0,l.useRef)(null),u=()=>{c.current!==null&&(window.clearTimeout(c.current),c.current=null)};(0,l.useEffect)(()=>{let w=()=>o(!0);return window.addEventListener(me,w),()=>window.removeEventListener(me,w)},[]),(0,l.useEffect)(()=>{let w=()=>r(!0);return window.addEventListener(Qe,w),se&&r(!0),()=>window.removeEventListener(Qe,w)},[]),(0,l.useEffect)(()=>()=>u(),[]),(0,l.useEffect)(()=>{let w=h.current;if(h.current=e.attention,e.attention===0){u(),p(!1);return}w!==0||document.body.classList.contains("theme-menu-open")||(p(!0),u(),c.current=window.setTimeout(()=>{c.current=null,p(!1)},4e3))},[e.attention]);let m=()=>{se=!1,r(!1)},k=_e()?Ee.startsWith("#/agent-workbench-dock")?"dock":Ee.startsWith("#/agent-workbench")?"appCenter":null:null;return k?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"workbench-route-host","data-workbench-surface":k,children:(0,t.jsx)("main",{id:"root",ref:Zt})}),(0,t.jsx)(Qt,{open:a,loginUrl:ve(Me,location.hash),onClose:m}),(0,t.jsx)(Be,{}),(0,t.jsx)(Ie,{})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"aurora","aria-hidden":"true",children:[(0,t.jsx)("i",{className:"a1"}),(0,t.jsx)("i",{className:"a2"}),(0,t.jsx)("i",{className:"a3"})]}),(0,t.jsxs)("div",{className:"app-shell",children:[(0,t.jsxs)("header",{className:"topbar",children:[(0,t.jsx)("div",{className:"topbar-left",children:(0,t.jsxs)("div",{className:"topbar-brand-block",children:[(0,t.jsxs)("a",{className:"brand",href:"#/",children:[(0,t.jsx)("span",{className:"brand-mark","aria-hidden":"true",children:(0,t.jsx)("img",{className:"brand-logo-img",src:"/assets/brand-logo.png",alt:"",decoding:"sync",loading:"eager",fetchPriority:"high"})}),(0,t.jsx)("strong",{className:"brand-wordmark",children:"Botmux"}),(0,t.jsx)("span",{className:"brand-product",children:"Dashboard"})]}),(0,t.jsx)(so,{status:an,onRefresh:()=>et(!0)})]})}),(0,t.jsxs)("div",{className:"topbar-actions",children:[(0,t.jsx)(ao,{summary:e,autoOpen:d}),(0,t.jsxs)("div",{className:"topbar-tool-group",children:[(0,t.jsx)("button",{type:"button",className:"topbar-locale-toggle","aria-label":f.locale==="zh"?"Switch to English":"\u5207\u6362\u5230\u4E2D\u6587",title:f.locale==="zh"?"Switch to English":"\u5207\u6362\u5230\u4E2D\u6587",onClick:()=>lo(f.locale==="zh"?"en":"zh"),children:f.locale==="zh"?"CN":"EN"}),(0,t.jsx)(to,{}),(0,t.jsxs)("a",{className:"topbar-docs-link",href:"https://deepcoldy.github.io/botmux/",target:"_blank",rel:"noopener noreferrer",title:s("nav.docs"),"aria-label":s("nav.docs"),children:[ne((0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:"2.2",y:"2.2",width:"11.6",height:"11.6",rx:"2"}),(0,t.jsx)("path",{d:"M4.8 5.2h6.4M4.8 8h6.4M4.8 10.8h4"})]})),(0,t.jsx)("span",{children:s("nav.docs")})]})]}),(0,t.jsxs)("span",{className:"topbar-owner",title:V?.name,"aria-label":V?.name??"Owner",children:[(0,t.jsx)("span",{className:"topbar-owner-placeholder","aria-hidden":"true",children:ne((0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:"8",cy:"6",r:"2.4"}),(0,t.jsx)("path",{d:"M3.7 13c.7-2.5 2.2-3.7 4.3-3.7s3.6 1.2 4.3 3.7"})]}))}),V?.avatarUrl?(0,t.jsx)("img",{className:"topbar-owner-img",src:V.avatarUrl,alt:"",decoding:"async",referrerPolicy:"no-referrer",onError:w=>{w.currentTarget.remove()}}):null]})]})]}),(0,t.jsxs)("div",{className:"chrome-body",children:[(0,t.jsxs)("aside",{className:"sidebar",children:[T?(0,t.jsxs)("div",{className:"sidebar-create-actions",children:[(0,t.jsxs)("button",{type:"button",className:"sidebar-create-btn",onClick:()=>$e(),children:[ne((0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M2 3.5h12v7H6l-3 3v-3H2z"}),(0,t.jsx)("path",{d:"M8 4.9v4.2M5.9 7h4.2"})]})),(0,t.jsx)("span",{className:"sidebar-nav-label",children:s("nav.createSession")})]}),(0,t.jsxs)("button",{type:"button",className:"sidebar-create-btn",onClick:()=>{wt()},children:[ne((0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:"2.5",y:"6",width:"11",height:"7.5",rx:"2"}),(0,t.jsx)("circle",{cx:"5.8",cy:"9.75",r:"1"}),(0,t.jsx)("circle",{cx:"10.2",cy:"9.75",r:"1"}),(0,t.jsx)("path",{d:"M8 6V3.8M6.3 1.9h3.4"})]})),(0,t.jsx)("span",{className:"sidebar-nav-label",children:s("nav.createBot")})]})]}):null,(0,t.jsx)("nav",{className:"sidebar-nav","aria-label":"Dashboard",children:(()=>{let w=Jn().filter(y=>T||!y.manage),g=new Map(w.map(y=>[y.id,y])),x=w.filter(y=>y.plugin);return jn.map(y=>{let O=y.items.flatMap(B=>{let E=g.get(B);return E?E.id==="plugins"?[E,...x]:[E]:[]});return O.length===0?null:(0,t.jsxs)("div",{className:"nav-group",children:[(0,t.jsx)("div",{className:"nav-group-title",children:s(y.labelKey)}),O.map(Zn)]},y.id)})})()})]}),(0,t.jsxs)("div",{className:"workspace",children:[(0,t.jsx)("dialog",{id:"create-session-modal",className:"create-session-modal"}),(0,t.jsx)(yt,{open:n,onClose:()=>o(!1)}),(0,t.jsx)("main",{id:"root",ref:Zt})]})]})]}),(0,t.jsx)(Qt,{open:a,loginUrl:ve(Me,location.hash),onClose:m}),(0,t.jsx)(Be,{}),(0,t.jsx)(Ie,{})]})}function N(){rn?.render((0,t.jsx)(io,{}))}function lo(e){f.setLocale(e),ho(e)}var se=!1;function cn(e){let n=!!ve(e,location.hash),o=n&&Me!==e;n&&(Me=e),se&&o&&N(),!se&&(se=!0,window.dispatchEvent(new Event(Qe)))}var Ye;function co(){let e=document.getElementById("readonly-toast");e||(e=document.createElement("div"),e.id="readonly-toast",e.style.cssText="position:fixed;left:50%;bottom:28px;transform:translateX(-50%);z-index:9999;background:var(--fg,#1f2329);color:var(--bg,#fff);padding:10px 18px;border-radius:var(--radius-lg);font-size:13px;box-shadow:0 8px 24px rgba(0,0,0,.25)",document.body.appendChild(e)),e.textContent="\u5F53\u524D\u662F\u53EA\u8BFB\u8BBF\u95EE\uFF0C\u6B64\u64CD\u4F5C\u9700\u8981\u6388\u6743\u94FE\u63A5\uFF08\u8FD0\u884C botmux dashboard \u83B7\u53D6\uFF09",e.style.display="block",Ye&&window.clearTimeout(Ye),Ye=window.setTimeout(()=>{e.style.display="none"},4e3)}var tt=window.fetch.bind(window);window.fetch=async function(...n){let o=await tt(...n);if(o.status===401){if(o.headers.get("x-botmux-auth-scope")==="workbench")return o;let a=o.headers.get("x-botmux-login-url")??void 0,r=(n[1]?.method??"GET").toUpperCase();a||(r==="GET"||r==="HEAD")&&!ye?cn(a):co()}return o};async function uo(){try{let e=await tt("/api/workbench/capabilities",{cache:"no-store"});f.workbenchCapabilities=e.ok?ct(await e.json()):He}catch{f.workbenchCapabilities=He}}async function po(){let e=uo();try{let n=await tt("/api/settings");if(n.ok){let o=await n.json();T=!!o.authed,f.authed=T,f.workbenchAuthed=T,ye=!!(o.settings&&o.settings.publicReadOnly),f.publicReadOnly=ye;let a=ln()??pe(o.lang);a&&f.setLocale(a)}else if(n.status===401&&n.headers.get("x-botmux-auth-scope")==="workbench")T=!1,f.authed=!1,f.workbenchAuthed=!0,ye=!1,f.publicReadOnly=!1;else if(n.status===401){T=!1,f.authed=!1,f.workbenchAuthed=!1;let o=n.headers.get("x-botmux-login-url")??void 0;cn(o)}}catch{}await e}async function tn(){try{let e=await fetch("/api/plugins/dashboard");if(!e.ok)return;let n=await e.json();oe=(Array.isArray(n?.plugins)?n.plugins:[]).filter(a=>a.pinned===!0&&typeof a.route=="string").map(a=>({id:`plugin:${a.pluginId}:${a.id}`,href:a.route,label:a.displayName||a.pluginId,manage:!0,plugin:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M5.2 2.2h5.6v3.1l1.7 1.7-1.4 1.4-1-1v6.4H5.9V7.4l-1 1L3.5 7l1.7-1.7z"}),(0,t.jsx)("path",{d:"M8 13.8v1"})]})})),N()}catch{}}async function ho(e){if(T)try{await fetch("/api/settings",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({lang:e})})}catch{}}async function et(e=!1){if(!T)return!1;try{let n=await fetch(`/api/update/status${e?"?refresh=1":""}`,{cache:"no-store"});if(!n.ok)return!1;let o=await n.json();an=o;let a=Array.isArray(o.cliUpdates)?o.cliUpdates.find(r=>r?.updateAvailable===!0&&r?.latest):null;return o.behind===!0&&o.latest?(ae=!0,ke="botmux",re=String(o.latest)):a?(ae=!0,ke="runtime",re=String(a.latest)):(ae=!1,ke=null,re=null),N(),o.versionLookupOk!==!1}catch{return!1}}function mo(e){e.innerHTML='<section class="auth-required" style="max-width:520px;margin:64px auto;text-align:center;background:var(--surface);color:var(--fg);border:1px solid var(--border);border-radius:var(--radius-lg);padding:40px 36px;box-shadow:0 8px 28px rgba(0,0,0,.12)"><h2 style="margin:0 0 12px;font-size:20px;color:var(--fg)">\u6B64\u9875\u9700\u8981\u6388\u6743\u94FE\u63A5</h2><p style="margin:0 0 24px;line-height:1.7;color:var(--muted);font-size:14px">\u4F60\u5F53\u524D\u662F\u53EA\u8BFB\u8BBF\u95EE\uFF0C\u7BA1\u7406\u9875\uFF08\u7FA4\u89D2\u8272 / Profiles / Bot \u914D\u7F6E / \u56E2\u961F / Webhook\uFF09\u9700\u8981\u6388\u6743\u94FE\u63A5\u3002\u8FD0\u884C <code>botmux dashboard</code> \u83B7\u53D6\u6700\u65B0\u94FE\u63A5\u540E\u5373\u53EF\u7BA1\u7406\u3002</p><a href="#/" style="display:inline-block;padding:8px 22px;background:var(--accent);color:var(--on-accent);border-radius:var(--radius-lg);text-decoration:none;font-size:14px">\u8FD4\u56DE\u603B\u89C8</a></section>'}async function Ze(){let e=Ot(I),n=location.hash||"#/";Ee=n,N();let o=xt(n);if(o){window.location.replace(o);return}if(!T&&qn.some(a=>n.startsWith("#/"+a))){mo(Xe()),I.rerenderOnUiChange=!0;return}if(n.startsWith("#/v3")){window.location.replace(`#/workflows${n.slice(4)}`);return}else if(n.startsWith("#/legacy-workflow")){window.location.replace("#/workflows");return}else if(/^#\/workflows(?:\/|-)catalog(?:[/?].*)?$/.test(n)){window.location.replace("#/workflows");return}if(n.startsWith("#/role-profiles")){window.location.replace(`#/roles/profile${n.slice(15)}`);return}try{let a=Tt(n);await At(I,e,Xe(),a?a.load:St,{rerenderOnUiChange:a?a.rerenderOnUiChange:!1}),e===I.seq&&T&&eo()}catch(a){if(e!==I.seq||It(a,{href:window.location.href,hash:n,getSessionStorage:()=>window.sessionStorage,reload:()=>window.location.reload()}))return;Xe().innerHTML=`<section class="page"><div class="empty">Dashboard route failed: ${dt(String(a))}</div></section>`,I.pageDispose=null,I.rerenderOnUiChange=!0}}function fo(){try{let e=JSON.parse(window.localStorage.getItem(sn)??"null");if(e?.avatarUrl)return{avatarUrl:String(e.avatarUrl),name:e.name?String(e.name):void 0}}catch{}return null}function bo(){V=fo(),N(),fetch("/api/owner-profile").then(e=>e.ok?e.json():null).then(e=>{if(!(!e?.ok||!e.avatarUrl)){V={avatarUrl:String(e.avatarUrl),name:e.name?String(e.name):void 0};try{window.localStorage.setItem(sn,JSON.stringify({avatarUrl:e.avatarUrl,name:e.name??""}))}catch{}N()}}).catch(()=>{})}(async()=>{let e=kt(window.location.href);e&&window.history.replaceState(window.history.state,"",e),f.init(),Jt();let n=document.getElementById("app-root");if(!n)throw new Error("missing dashboard app root");Ft(n),jt(),rn=(0,on.createRoot)(n),N(),f.on(()=>{N(),I.rerenderOnUiChange&&Ze()}),ue.on(()=>{N()}),await po(),N(),window.addEventListener(bt,()=>{tn()}),tn(),et(),window.setInterval(()=>{document.hidden||et()},30*6e4),bo();try{await lt({canReadSchedules:()=>f.authed||f.publicReadOnly})}catch(o){console.error("botmux dashboard bootstrap failed",o),ue.setOnline(!1)}pt().then(N),Et().then(N),window.addEventListener("hashchange",()=>{Jt()||Ze()}),Ze()})();export{cn as showAuthExpiredOverlay,co as showReadOnlyToast};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as V,K as _,L as J,M,b as m,c as C,h as f,i as L,k as R,l as N,m as x,n as D,o as H,p as T,s as P,x as E}from"./chunk-
|
|
1
|
+
import{A as V,K as _,L as J,M,b as m,c as C,h as f,i as L,k as R,l as N,m as x,n as D,o as H,p as T,s as P,x as E}from"./chunk-IA5KMD5O.js";import"./chunk-OWUXOKFE.js";import"./chunk-ZJVTGU5X.js";import{a as v}from"./chunk-R3LJUCEO.js";import"./chunk-QITAMHW6.js";import{w as k}from"./chunk-K232GT3M.js";import{c as S}from"./chunk-ARROO6TE.js";import{c as r,d as A,e as d}from"./chunk-3YZFAHNK.js";var h=r(A(),1);var s=r(A(),1);var e=r(d(),1);function G(n){let t=L(n);return t["needs-you"][0]?.sessionId??t.active[0]?.sessionId??t.recent[0]?.sessionId??null}function O(n){let t=(0,s.useMemo)(()=>n.api??P(),[n.api]);E();let[c,l]=(0,s.useState)(n.initialSessionId??G(n.sessions)),[i,B]=(0,s.useState)(n.h5Context??null),o=n.sessions.find(a=>a.sessionId===c)??null,F=n.targetOrigin??(typeof window>"u"?"https://dashboard.invalid":window.location.origin),X=n.location??(typeof window>"u"?null:window.location);(0,s.useEffect)(()=>{if(n.h5Context!==void 0)return;let a=new AbortController;return t.getH5Context(a.signal).then(B),()=>a.abort()},[t,n.h5Context]);let z=a=>{l(a);let I=m("dock",a);n.onRouteChange?n.onRouteChange(I):typeof window<"u"&&window.history.replaceState(window.history.state,"",I)},p=o&&i?.enabled?H({appId:i.appId,brand:i.brand,surface:"main",targetOrigin:F,sessionId:o.sessionId}):null,U=J(),g=o?R(o,X):null,q=o?N(o):null,u=!!g&&!q&&(U||!n.authenticated),b=M({api:t,sessionId:o?.sessionId??"",enabled:u}),W=u?b.link?.url??null:g,y=o?x(o):null;return(0,e.jsxs)("main",{className:"agent-workbench-dock","data-surface":"sidebar",style:{minWidth:350},children:[(0,e.jsxs)("header",{className:"wb-dock-header",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("span",{"aria-hidden":"true",children:"\u25D6"}),(0,e.jsx)("strong",{children:"\u4F1A\u8BDD\u575E"})]}),(0,e.jsx)("span",{className:n.online?"is-online":"is-offline",children:n.online?"\u25CF \u5728\u7EBF":"\u25CB \u79BB\u7EBF"}),(0,e.jsx)(V,{standingLink:n.manageAuthed===!0,api:t})]}),(0,e.jsx)(_,{sessions:n.sessions,selectedSessionId:c,locale:n.locale,now:n.now,online:n.online,onSelect:z}),(0,e.jsx)("section",{className:"wb-dock-actions","aria-live":"polite",children:o?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"wb-dock-selected",children:[(0,e.jsx)("strong",{title:f(o),children:f(o)}),(0,e.jsxs)("span",{children:[o.botName||o.larkAppId||"Bot"," \xB7 ",o.status]})]}),n.authenticated?p?(0,e.jsx)("a",{className:"wb-primary-action",href:p,children:"\u6253\u5F00\u5B8C\u6574\u5DE5\u4F5C\u53F0"}):(0,e.jsx)("a",{className:"wb-primary-action",href:m("main",o.sessionId),target:"_top",children:"\u6253\u5F00\u5B8C\u6574\u5DE5\u4F5C\u53F0"}):(0,e.jsx)("a",{className:"wb-primary-action",href:T(i?.entryPath??"/auth/feishu","dock",o.sessionId),children:"\u767B\u5F55\u540E\u7EE7\u7EED"}),(0,e.jsxs)("div",{className:"wb-dock-action-grid",children:[o.chatId?(0,e.jsx)("a",{href:o.feishuChatLink||D(o.chatId,i?.brand),target:"_blank",rel:"noopener",children:"\u6253\u5F00\u804A\u5929"}):(0,e.jsx)("span",{"aria-disabled":"true",children:"\u65E0\u804A\u5929"}),W?(0,e.jsx)("a",{href:W,target:"_blank",rel:"noopener noreferrer",children:"\u7EC8\u7AEF\u94FE\u63A5"}):u?b.phase==="failed"?(0,e.jsx)("button",{type:"button",onClick:b.retry,children:"\u7EC8\u7AEF\u91CD\u8BD5"}):(0,e.jsx)("span",{"aria-disabled":"true",children:"\u7EC8\u7AEF\u51C6\u5907\u4E2D\u2026"}):(0,e.jsx)("span",{"aria-disabled":"true",children:"\u65E0\u7EC8\u7AEF"}),y?(0,e.jsx)("a",{href:y,target:"_blank",rel:"noopener noreferrer",children:"\u7F51\u9875\u94FE\u63A5"}):(0,e.jsx)("span",{"aria-disabled":"true",children:"\u65E0\u7F51\u9875\u9884\u89C8"})]})]}):(0,e.jsx)("p",{children:"\u8BF7\u9009\u62E9\u4E00\u4E2A\u4F1A\u8BDD\u3002"})}),(0,e.jsx)("footer",{children:"\u8F7B\u91CF\u4F1A\u8BDD\u575E \xB7 \u7EC8\u7AEF/\u7F51\u9875\u8BF7\u5728\u5B8C\u6574\u5DE5\u4F5C\u53F0\u67E5\u770B \xB7 \u804A\u5929\u4F7F\u7528\u98DE\u4E66\u539F\u751F\u7A97\u53E3"})]})}var w=r(d(),1);function K(){let n=v(),[t,c]=(0,h.useState)(Date.now());(0,h.useEffect)(()=>{let i=window.setInterval(()=>c(Date.now()),3e4);return()=>window.clearInterval(i)},[]);let l=C(window.location.hash);return(0,w.jsx)(O,{sessions:[...n.sessions.values()],online:n.online,authenticated:k.workbenchAuthed,manageAuthed:k.authed,initialSessionId:l?.surface==="dock"?l.sessionId:null,locale:"zh-CN",now:t})}function re(n){return S(n,(0,w.jsx)(K,{}))}export{re as renderAgentWorkbenchDockPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as on,B as le,C as rn,D as an,E as sn,F as ve,G as ln,H as cn,I as dn,J as un,K as mn,L as bn,M as fn,a as se,b as $e,c as Be,d as Ge,e as Re,f as Xe,g as Ae,h as ye,i as qe,j as Me,k as Ue,l as ze,m as ge,q as Je,r as xe,s as Ve,t as je,u as Ye,v as Qe,w as Ze,x as en,y as nn,z as tn}from"./chunk-TLG45URB.js";import"./chunk-OWUXOKFE.js";import"./chunk-ZJVTGU5X.js";import{a as Oe}from"./chunk-ECFC7UG2.js";import"./chunk-QITAMHW6.js";import{w as pe}from"./chunk-BU3Q6XC6.js";import{c as Ke}from"./chunk-ARROO6TE.js";import{c as H,d as Pe,e as te}from"./chunk-3YZFAHNK.js";var We=H(Pe(),1);var d=H(Pe(),1);var i=H(Pe(),1);function pn(){return{phase:"loading",authoritative:null,observeEpoch:0,observeIssueEpoch:0,observeIssuedDuringWrite:!1,writeEpoch:0,pending:null,mayWrite:!1,error:null,frameGeneration:0,reconcileNonce:0}}function hn(e){return e.mode==="controlled"&&e.owned?"controlled":"readonly"}function ce(e){return e?.mode==="controlled"&&e.owned}function yn(e){return e.phase==="taking-over"||e.phase==="releasing"}function gn(e){return e.phase==="readonly"||e.phase==="controlled"}function wn(e){return e.observeIssueEpoch<e.writeEpoch||e.observeIssuedDuringWrite}function vn(e){return e.phase==="unknown"&&e.mayWrite}function kn(e){switch(e.phase){case"loading":return"loading";case"unknown":return"unknown";case"controlled":return"controlled";case"readonly":return"readonly";default:return ce(e.authoritative)?"controlled":"readonly"}}function Tn(e,n){switch(n.type){case"observe-start":return{...e,observeEpoch:n.epoch,observeIssueEpoch:e.writeEpoch,observeIssuedDuringWrite:e.pending!==null,phase:n.source==="load"&&!e.pending?"loading":e.phase};case"observe-settled":{if(n.epoch!==e.observeEpoch||e.pending||wn(e))return e;let r=ce(e.authoritative)&&!ce(n.control);return{...e,phase:hn(n.control),authoritative:n.control,mayWrite:ce(n.control),error:e.error?.from==="write"?e.error:null,frameGeneration:e.frameGeneration+(r?1:0)}}case"observe-failed":{if(n.epoch!==e.observeEpoch||e.pending||wn(e))return e;let r={text:n.error,from:"observe"};return!e.authoritative&&n.canHoldLease?{...e,phase:"unknown",mayWrite:!0,error:r}:e.authoritative?{...e,error:r}:{...e,phase:"readonly",authoritative:{mode:"readonly",owned:!1},mayWrite:!1,error:r}}case"settle-readonly":return e.phase==="readonly"&&e.authoritative?.mode==="readonly"&&!e.pending&&!e.mayWrite&&!e.error?e:{...e,phase:"readonly",authoritative:{mode:"readonly",owned:!1},pending:null,mayWrite:!1,error:null};case"write-start":return{...e,writeEpoch:n.epoch,pending:{action:n.action,epoch:n.epoch},phase:n.action==="takeover"?"taking-over":"releasing",mayWrite:!0,error:null};case"write-settled":return n.epoch!==e.writeEpoch?e:{...e,phase:hn(n.control),authoritative:n.control,pending:null,mayWrite:ce(n.control),error:null,frameGeneration:e.frameGeneration+1};case"write-failed":return n.epoch!==e.writeEpoch?e:{...e,phase:"unknown",pending:null,mayWrite:!0,error:{text:n.error,from:"write"},reconcileNonce:e.reconcileNonce+1};default:return e}}var Wn="botmux:wb-terminal-write",de=new Map;function Sn(e,n){let r=de.get(e);return r||(r=new Set,de.set(e,r)),r.add(n),()=>{let c=de.get(e);c&&(c.delete(n),c.size===0&&de.delete(e))}}function Cn(e){return(de.get(e)?.size??0)>0}function ue(e,n=0){return{sessionId:e,mode:"loading",fixed:!1,toggleOnly:!1,busy:!1,generation:n}}function In(e,n){return e?e.sessionId===n?e:ue(n):null}function En(e,n){return e&&e.busy&&e.sessionId===n?e:!e||e.sessionId!==n?ue(n):e.toggleOnly||e.mode!=="controlled"?null:ue(n,e.generation+1)}function Ln(e,n){return!e||e.sessionId!==n.sessionId||e.mode===n.mode&&e.fixed===n.fixed&&e.toggleOnly===n.toggleOnly&&e.busy===n.busy?e:{...e,mode:n.mode,fixed:n.fixed,toggleOnly:n.toggleOnly,busy:n.busy}}var o=H(te(),1);function _n(e){try{let n=e?.contentWindow?.document?.getElementById("status")?.textContent?.trim();return n==="connected"?"connected":n==="disconnected"?"disconnected":"unknown"}catch{return"unknown"}}function Fn(e){try{let r=e?.contentWindow?.wsHasWrite;return r===!0?"writable":r===!1?"readonly":"unknown"}catch{return"unknown"}}function Dn(e){if(!e||typeof e!="object")return null;let n=e;return n.type!==Wn?null:n.write===null?"unknown":typeof n.write=="boolean"?n.write?"writable":"readonly":null}var Pn=1e3,Hn=8;function Kn(e){let{enabled:n,frameKey:r,sessionId:c}=e,[f,p]=(0,i.useState)(!1),[y,l]=(0,i.useState)(null),u=(0,i.useRef)(!1),v=(0,i.useRef)(e.read);(0,i.useEffect)(()=>{v.current=e.read}),(0,i.useEffect)(()=>{u.current=!1,p(!1)},[c]),(0,i.useEffect)(()=>{if(!n||u.current||y!==r)return;let S=0,T=setInterval(()=>{let k=v.current();if(k==="connected"){u.current=!0,p(!1),clearInterval(T);return}if(k!=="disconnected"){S=0;return}S+=1,S>=Hn&&p(!0)},Pn);return()=>clearInterval(T)},[n,r,y]);let _=(0,i.useCallback)(()=>l(r),[r]);return{blocked:n&&f,onFrameLoad:n?_:void 0}}var On=5;function $n(e){let{enabled:n,frameKey:r}=e,[c,f]=(0,i.useState)("unknown"),p=(0,i.useRef)(e.read);return(0,i.useEffect)(()=>{p.current=e.read}),(0,i.useEffect)(()=>{if(!n)return;f("unknown");let y=0,l=()=>{let v=p.current();return v==="unknown"?!1:(f(v),!0)};if(l())return;let u=setInterval(()=>{y+=1,(l()||y>=On)&&clearInterval(u)},Pn);return()=>clearInterval(u)},[n,r]),n?c:"unknown"}function Bn(e){let{enabled:n,frameKey:r}=e,[c,f]=(0,i.useState)({write:"unknown",live:!1}),p=(0,i.useRef)(e.frame);return(0,i.useEffect)(()=>{p.current=e.frame}),(0,i.useEffect)(()=>{if(f({write:"unknown",live:!1}),!n||typeof window>"u"||!window.addEventListener)return;let y=l=>{let u=p.current()?.contentWindow;if(!u||l.source!==u)return;let v=Dn(l.data);v!==null&&f({write:v,live:!0})};return window.addEventListener("message",y),()=>window.removeEventListener("message",y)},[n,r]),n?c:{write:"unknown",live:!1}}function Gn(){try{return typeof window>"u"?void 0:window.location?.href}catch{return}}function Te(e){return e instanceof xe?{authentication_required:"\u9700\u8981\u767B\u5F55\u8BA4\u8BC1",session_not_active:"\u4F1A\u8BDD\u5DF2\u4E0D\u518D\u6D3B\u8DC3",daemon_offline:"\u6240\u5C5E daemon \u5DF2\u79BB\u7EBF",terminal_unavailable:"\u7EC8\u7AEF\u4E0D\u53EF\u7528",control_busy:"\u53E6\u4E00\u4E2A\u6D4F\u89C8\u5668\u6B63\u5728\u63A7\u5236\u8BE5\u7EC8\u7AEF",preview_not_registered:"\u672A\u6CE8\u518C\u7F51\u9875\u9884\u89C8",control_request_timeout:"\u63A7\u5236\u6743\u8BF7\u6C42\u8D85\u65F6"}[e.code]??e.code.replaceAll("_"," "):e instanceof Error?e.message:String(e)}var Xn=1e4;async function qn(e,n=Xn){let r=new AbortController,c,f=new Promise((p,y)=>{c=setTimeout(()=>{try{r.abort()}catch{}y(new xe(504,"control_request_timeout"))},n)});f.catch(()=>{});try{return await Promise.race([e(r.signal),f])}finally{c!==void 0&&clearTimeout(c)}}function Un(e){let n=(0,i.useRef)(null);return(0,i.useEffect)(()=>{try{n.current?.focus?.()}catch{}},[]),(0,o.jsxs)("div",{ref:n,tabIndex:-1,className:"wb-pane-empty wb-control-unknown",role:"status",children:[(0,o.jsx)("span",{"aria-hidden":"true",children:"\u25C7"}),(0,o.jsx)("strong",{children:"\u63A7\u5236\u6743\u72B6\u6001\u672A\u77E5"}),(0,o.jsx)("p",{children:"\u6CA1\u6709\u62FF\u5230\u786E\u8BA4\uFF0C\u8FD9\u5757\u7EC8\u7AEF\u53EF\u80FD\u4ECD\u7136\u53EF\u5199\u3002\u5DF2\u65AD\u5F00\u7EC8\u7AEF\u753B\u9762\u6321\u4F4F\u8F93\u5165\uFF0C\u6B63\u5728\u91CD\u65B0\u786E\u8BA4\u3002"}),(0,o.jsx)("button",{type:"button",onClick:e.onRetry,children:"\u7ACB\u5373\u91CD\u8BD5"})]})}function Rn(e){let[n,r]=(0,i.useReducer)(Tn,void 0,pn),c=(0,i.useRef)(0),f=(0,i.useRef)(0),p=(0,i.useRef)(!0);(0,i.useEffect)(()=>(p.current=!0,()=>{p.current=!1}),[]);let y=Ue(e.session,e.location),l=ze(e.session),u=bn(),{link:v,phase:_,retry:S}=fn({api:e.api,sessionId:e.session.sessionId,enabled:!l&&(u||!e.authenticated)}),T=v?v.url:null,k=!l&&u?T:e.authenticated?y:T,g=e.session.sessionId,I=(0,i.useCallback)(async(w,t)=>{if(!y||l||!e.authenticated){r({type:"settle-readonly"});return}let a=++c.current;r({type:"observe-start",epoch:a,source:w});try{let m=await e.api.getTerminalControl(g,t);r({type:"observe-settled",epoch:a,control:m})}catch(m){if(t?.aborted)return;r({type:"observe-failed",epoch:a,error:Te(m),canHoldLease:e.capabilities.canControl&&!u})}},[l,e.api,e.authenticated,e.capabilities.canControl,g,y,u]);(0,i.useEffect)(()=>{let w=new AbortController;I("load",w.signal);let t=setInterval(()=>{I("poll",w.signal)},15e3);return()=>{c.current+=1,clearInterval(t),w.abort()}},[I]);let K=n.authoritative?.expiresAt;(0,i.useEffect)(()=>{if(n.phase!=="controlled"||!K)return;let w=setTimeout(()=>{I("poll")},Math.max(0,K-Date.now())+25);return()=>clearTimeout(w)},[K,n.phase,I]),(0,i.useEffect)(()=>{if(n.reconcileNonce===0)return;let w=new AbortController;return I("reconcile",w.signal),()=>w.abort()},[n.reconcileNonce,I]);let B=(0,i.useRef)(null);(0,i.useEffect)(()=>{if(e.autoTakeControl===void 0||!e.authenticated||!e.capabilities.canControl||u||!gn(n))return;let w=n.authoritative;!w||w.fixed||B.current!==g&&(B.current=g,w.mode==="controlled"&&w.owned&&L("release"))});let M=(0,i.useRef)(new Map),b=()=>{let w=[...M.current.values()];return M.current.clear(),w},C=(0,i.useCallback)(async w=>{for(let t of w)Cn(t.sessionId)||await e.api.releaseTerminal(t.sessionId,void 0,t.acquisitionId).catch(()=>{})},[e.api]),E=(0,i.useRef)(0),L=async w=>{let t=++f.current,a=w==="takeover"?Je():void 0;a&&M.current.set(a,{sessionId:g,acquisitionId:a}),E.current+=1,r({type:"write-start",epoch:t,action:w});try{let m=await qn(W=>w==="takeover"?e.api.takeoverTerminal(g,W,a):e.api.releaseTerminal(g,W));if((w==="release"||m.fixed===!0)&&M.current.clear(),!p.current){C(b());return}r({type:"write-settled",epoch:t,control:m})}catch(m){if(!p.current){C(b());return}r({type:"write-failed",epoch:t,error:Te(m)})}finally{E.current-=1}};(0,i.useEffect)(()=>{n.authoritative?.fixed===!0&&M.current.clear()},[n.authoritative]);let O=(0,i.useRef)(C);(0,i.useEffect)(()=>{O.current=C}),(0,i.useEffect)(()=>()=>{if(E.current>0)return;let w=[...M.current.values()];w.length!==0&&(M.current.clear(),Promise.resolve().then(()=>O.current(w)))},[g]);let me=(0,i.useRef)({});(0,i.useEffect)(()=>{if(n.mayWrite)return Sn(g,me.current)},[n.mayWrite,g]);let G=(0,i.useRef)(null),be=(0,i.useRef)(0),oe=(0,i.useRef)(void 0);oe.current!==k&&(oe.current!==void 0&&(be.current+=1),oe.current=k);let z=`${g}-${n.frameGeneration}-l${be.current}`,X=e.readFrameStatus??_n,h=Kn({enabled:u,sessionId:g,frameKey:z,read:()=>X(G.current)}),J=e.readFrameWrite??Fn,Se=$n({enabled:u,frameKey:z,read:()=>J(G.current)}),P=Bn({enabled:u,frameKey:z,frame:()=>G.current}),fe=P.live?P.write:Se,{appearance:q,skin:V}=Ze(),R=(0,i.useCallback)(()=>{Qe(G.current,k,q.termStyle,V,Gn())},[q.termStyle,k,V]);(0,i.useEffect)(()=>{R()},[R]);let Fe=(0,i.useCallback)(()=>{h.onFrameLoad?.(),R()},[h,R]),U=n.authoritative,j=yn(n),Y=U?.fixed===!0,re=!l&&!!y&&e.authenticated&&e.capabilities.canControl&&!u&&!Y,he=fe!=="unknown"?fe:Y?"unknown":"readonly",A=u?he==="writable"?"controlled":he==="readonly"?"readonly":"unknown":kn(n),F=A==="controlled",Ce=F?"\u53EF\u8F93\u5165":A==="unknown"?"\u672A\u77E5":A==="loading"?"\u68C0\u67E5\u4E2D":"\u53EA\u8BFB",Ie=F?"is-controlled":A==="unknown"?"is-unknown":A==="loading"?"is-checking":"is-readonly",Ee=F?"\u25C6":A==="unknown"?"\u25C7":A==="loading"?"\u22EF":"\u25CC",ie=!u&&vn(n),Le=!l&&!!y&&!u&&e.authenticated&&e.capabilities.canControl,we=n.phase==="loading"&&Le,ae=ie||we,Q=e.onControlModeChange,Z=!re;(0,i.useEffect)(()=>{Q?.({sessionId:g,mode:A,fixed:Y,toggleOnly:Z,busy:j})},[j,Y,Q,A,g,Z]);let ee=F&&U?.expiresAt?Me(U.expiresAt,e.now,"zh-CN"):null;return(0,o.jsxs)("section",{className:`wb-pane wb-terminal-pane ${je(q.termStyle)}`,style:Ye(q.termStyle,V),"aria-label":"\u7EC8\u7AEF\u9762\u677F",children:[(0,o.jsxs)("header",{className:"wb-pane-titlebar",children:[(0,o.jsxs)("div",{className:"wb-pane-identity",children:[(0,o.jsx)("span",{className:"wb-pane-glyph","aria-hidden":"true",children:"\u203A_"}),(0,o.jsx)("strong",{children:"\u7EC8\u7AEF"}),(0,o.jsxs)("span",{className:`wb-mode-chip ${Ie}`,children:[(0,o.jsx)("span",{"aria-hidden":"true",children:Ee}),Ce]}),ee?(0,o.jsx)("span",{className:"wb-lease-time",children:`${ee}\u5230\u671F`}):null]}),(0,o.jsx)(nn,{termStyle:q.termStyle}),(0,o.jsxs)("div",{className:"wb-pane-actions",children:[k?(0,o.jsx)("a",{href:k,target:"_blank",rel:"noopener noreferrer",children:"\u65B0\u6807\u7B7E\u9875\u6253\u5F00"}):null,re?F?(0,o.jsx)("button",{type:"button",disabled:j,onClick:()=>{L("release")},children:"\u91CA\u653E\u8F93\u5165"}):(0,o.jsx)("button",{type:"button",disabled:j,onClick:()=>{L("takeover")},children:"\u63A5\u7BA1\u8F93\u5165"}):null]})]}),(0,o.jsx)("div",{className:"wb-pane-feedback",role:"status","aria-live":"polite",children:u?F?"\u5F53\u524D\u8EAB\u4EFD\u5728\u624B\u673A\u7AEF\u4E5F\u53EF\u76F4\u63A5\u8F93\u5165\u3002":A==="unknown"?"\u53EA\u8BFB\u94FE\u63A5\u67E5\u770B\u4E2D\uFF0C\u80FD\u5426\u8F93\u5165\u4EE5\u7EC8\u7AEF\u9875\u5185\u7684\u63D0\u793A\u4E3A\u51C6\u3002":"\u53EA\u8BFB\u67E5\u770B\u4E2D\u3002\u624B\u673A\u7AEF\u4E3A\u53EA\u8BFB\u89C6\u56FE\uFF0C\u9700\u8981\u8F93\u5165\u8BF7\u5728\u7535\u8111\u4E0A\u64CD\u4F5C\u3002":n.phase==="loading"?"\u6B63\u5728\u68C0\u67E5\u7EC8\u7AEF\u6743\u9650\u2026":n.phase==="taking-over"?"\u6B63\u5728\u63A5\u7BA1\u8F93\u5165\u2026":n.phase==="releasing"?"\u6B63\u5728\u91CA\u653E\u8F93\u5165\u2026":n.error?`${n.error.text}${n.phase==="unknown"?"\uFF1B\u63A7\u5236\u6743\u72B6\u6001\u672A\u77E5\uFF0C\u6B63\u5728\u91CD\u65B0\u786E\u8BA4\u2026":""}`:n.phase==="unknown"?"\u63A7\u5236\u6743\u72B6\u6001\u672A\u77E5\uFF0C\u6B63\u5728\u91CD\u65B0\u786E\u8BA4\u2026":U?.fixed?"\u5E73\u53F0\u6240\u6709\u8005\u8EAB\u4EFD\u5DF2\u767B\u5F55\uFF0C\u53EF\u76F4\u63A5\u8F93\u5165\u3002":F?"\u5DF2\u63A5\u7BA1\uFF0C\u53EF\u952E\u76D8\u8F93\u5165\u3002":e.authenticated&&e.capabilities.canControl?"\u53EA\u8BFB\u67E5\u770B\u4E2D\uFF0C\u70B9\u300C\u63A5\u7BA1\u8F93\u5165\u300D\u53EF\u64CD\u4F5C\u3002":e.authenticated?"\u53EA\u8BFB\u67E5\u770B\u4E2D\uFF0C\u5F53\u524D\u8EAB\u4EFD\u4E0D\u53EF\u63A5\u7BA1\u8F93\u5165\u3002":"\u53EA\u8BFB\u67E5\u770B\u3002\u767B\u5F55 Dashboard \u540E\u53EF\u63A5\u7BA1\u3002"}),(0,o.jsx)("div",{className:"wb-pane-frame-shell",children:l?(0,o.jsxs)("div",{className:"wb-pane-empty",children:[(0,o.jsx)("span",{"aria-hidden":"true",children:"\u2197"}),(0,o.jsx)("strong",{children:"\u5916\u90E8 Riff \u7EC8\u7AEF"}),(0,o.jsx)("p",{children:"\u8BE5\u540E\u7AEF\u4E0D\u5728\u5DE5\u4F5C\u53F0\u9762\u677F\u5185\u5C55\u793A\u3002"}),(0,o.jsx)("a",{href:l,target:"_blank",rel:"noopener noreferrer",children:"\u6253\u5F00\u5916\u90E8\u7EC8\u7AEF"})]}):k?(0,o.jsxs)(o.Fragment,{children:[ae?null:(0,o.jsx)("iframe",{ref:G,className:"wb-pane-frame",src:k,title:`\u7EC8\u7AEF \u2014 ${ye(e.session)}`,allow:"clipboard-read; clipboard-write",referrerPolicy:"no-referrer",onLoad:Fe},z),h.blocked&&!ae?(0,o.jsxs)("div",{className:"wb-pane-empty wb-ws-blocked",role:"status",children:[(0,o.jsx)("span",{"aria-hidden":"true",children:"\u26A0"}),(0,o.jsx)("strong",{children:"\u7EC8\u7AEF\u5B9E\u65F6\u8FDE\u63A5\u672A\u5EFA\u7ACB"}),(0,o.jsx)("p",{children:"\u5F53\u524D\u6D4F\u89C8\u5668\u73AF\u5883\u9650\u5236\u4E86\u975E\u52A0\u5BC6\u7684\u5B9E\u65F6\u8FDE\u63A5\uFF08iOS \u5185\u5E38\u89C1\uFF09\u3002\u53EF\u5C1D\u8BD5\u7528\u7CFB\u7EDF\u6D4F\u89C8\u5668\u6253\u5F00\uFF0C\u6216\u5728\u7535\u8111\u4E0A\u67E5\u770B\u3002"}),(0,o.jsx)("a",{href:k,target:"_blank",rel:"noopener",children:"\u5728\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00"}),(0,o.jsx)("p",{children:"\u98DE\u4E66\u5185\u53EF\u901A\u8FC7\u53F3\u4E0A\u89D2 \u22EF \u83DC\u5355\u9009\u62E9\u300C\u5728\u6D4F\u89C8\u5668\u6253\u5F00\u300D\u3002"})]}):null,ie?(0,o.jsx)(Un,{onRetry:()=>{I("reconcile")}}):null,!ie&&we?(0,o.jsxs)("div",{className:"wb-pane-empty wb-control-checking",role:"status",children:[(0,o.jsx)("span",{"aria-hidden":"true",children:"\u22EF"}),(0,o.jsx)("strong",{children:"\u6B63\u5728\u786E\u8BA4\u7EC8\u7AEF\u63A7\u5236\u6743"}),(0,o.jsx)("p",{children:"\u786E\u8BA4\u4E4B\u524D\u5148\u4E0D\u63A5\u5165\u7EC8\u7AEF\u753B\u9762\uFF0C\u907F\u514D\u5728\u4E0D\u77E5\u9053\u80FD\u4E0D\u80FD\u5199\u7684\u60C5\u51B5\u4E0B\u628A\u8F93\u5165\u6253\u8FDB\u53BB\u3002"})]}):null]}):(u||!e.authenticated)&&!l&&y?_==="failed"?(0,o.jsxs)("div",{className:"wb-pane-empty",role:"status",children:[(0,o.jsx)("span",{"aria-hidden":"true",children:"\u26A0"}),(0,o.jsx)("strong",{children:"\u53EA\u8BFB\u94FE\u63A5\u83B7\u53D6\u5931\u8D25"}),(0,o.jsx)("p",{children:"\u767B\u5F55\u6001\u53EF\u80FD\u5DF2\u8FC7\u671F\uFF0C\u6216\u8BE5\u4F1A\u8BDD\u7684\u7EC8\u7AEF\u670D\u52A1\u672A\u6CE8\u518C\u3002\u7A0D\u540E\u4F1A\u81EA\u52A8\u91CD\u8BD5\u3002"}),(0,o.jsx)("button",{type:"button",onClick:S,children:"\u91CD\u8BD5"})]}):(0,o.jsxs)("div",{className:"wb-pane-empty",role:"status",children:[(0,o.jsx)("span",{"aria-hidden":"true",children:"\u203A_"}),(0,o.jsx)("strong",{children:"\u6B63\u5728\u83B7\u53D6\u53EA\u8BFB\u7EC8\u7AEF\u94FE\u63A5\u2026"})]}):(0,o.jsxs)("div",{className:"wb-pane-empty",role:"status",children:[(0,o.jsx)("span",{"aria-hidden":"true",children:"\u25A1"}),(0,o.jsx)("strong",{children:"\u7EC8\u7AEF\u4E0D\u53EF\u7528"}),(0,o.jsx)("p",{children:e.session.status==="closed"?"\u4F1A\u8BDD\u5DF2\u5173\u95ED\u3002":"\u8BE5\u4F1A\u8BDD\u5C1A\u672A\u63D0\u4F9B\u7EC8\u7AEF\u5165\u53E3\u3002"})]})})]})}var ke={mode:"preview",label:"\u9884\u89C8",securityNotice:"\u4EA4\u4E92\u906E\u7F69\u7528\u4E8E\u9632\u8BEF\u89E6\uFF0C\u4E0D\u662F\u5E94\u7528\u7EA7\u5B89\u5168\u8FB9\u754C\u3002"};function An(e){let n=ge(e.session),[r,c]=(0,i.useState)(ke),[f,p]=(0,i.useState)("loading"),[y,l]=(0,i.useState)("\u9884\u89C8\u6A21\u5F0F\u5DF2\u9501\u5B9A\u3002"),[u,v]=(0,i.useState)(0),_=(0,i.useRef)("preview"),S=(0,i.useRef)(0),T=(0,i.useRef)(0),k=(0,i.useCallback)((b,C)=>{let E=_.current;_.current=b.mode,c(b),p("ready"),E==="interactive"&&b.mode==="preview"?l(C==="poll"?"\u957F\u65F6\u95F4\u65E0\u64CD\u4F5C\uFF0C\u5DF2\u91CD\u65B0\u9501\u5B9A\u3002":"\u5DF2\u91CD\u65B0\u9501\u5B9A\u3002"):b.mode==="interactive"?l("\u5DF2\u5F00\u542F\u4EA4\u4E92\uFF0C\u6301\u7EED\u64CD\u4F5C\u81EA\u52A8\u7EED\u671F\uFF0815 \u5206\u949F\uFF09\u3002"):l("\u9884\u89C8\u6A21\u5F0F\u5DF2\u9501\u5B9A\u3002")},[]),g=(0,i.useCallback)(async(b,C)=>{let E=++T.current;if(!n){c(ke),p("ready");return}try{let L=await e.api.getPreviewInteraction(e.session.sessionId,C);if(E!==T.current)return;k(L,b)}catch(L){if(C?.aborted||E!==T.current)return;_.current="preview",c(ke),l(`\u5DF2\u5B89\u5168\u9501\u5B9A\uFF1A${Te(L)}`),p("error")}},[k,n,e.api,e.session.sessionId]);(0,i.useEffect)(()=>{let b=new AbortController;p("loading"),g("load",b.signal);let C=setInterval(()=>{(typeof document>"u"||!document.hidden)&&g("poll",b.signal)},15e3);return()=>{T.current+=1,clearInterval(C),b.abort()}},[g]),(0,i.useEffect)(()=>{if(r.mode!=="interactive"||!r.idleExpiresAt)return;let b=setTimeout(()=>{g("poll")},Math.max(0,r.idleExpiresAt-Date.now())+25);return()=>clearTimeout(b)},[r.idleExpiresAt,r.mode,g]);let I=async b=>{let C=++T.current;p("busy");try{let E=b==="unlock"?await e.api.unlockPreview(e.session.sessionId):b==="lock"?await e.api.lockPreview(e.session.sessionId):await e.api.touchPreview(e.session.sessionId);if(C!==T.current)return;k(E,"action"),(b==="unlock"||b==="lock")&&v(L=>L+1)}catch(E){if(C!==T.current)return;_.current="preview",c(ke),l(`\u5DF2\u5B89\u5168\u9501\u5B9A\uFF1A${Te(E)}`),p("error")}},K=b=>{typeof Element<"u"&&b.target instanceof Element&&b.target.closest(".wb-pane-titlebar")||r.mode!=="interactive"||Date.now()-S.current<2e4||(S.current=Date.now(),I("activity"))},B=r.mode==="interactive"&&r.idleExpiresAt?Me(r.idleExpiresAt,e.now,"zh-CN"):null,M=r.mode==="interactive"?"\u53EF\u4EA4\u4E92":"\u9884\u89C8";return(0,o.jsxs)("section",{className:"wb-pane wb-web-pane","aria-label":"\u7F51\u9875\u9884\u89C8\u9762\u677F",onPointerDown:K,onKeyDown:K,children:[(0,o.jsxs)("header",{className:"wb-pane-titlebar",children:[(0,o.jsxs)("div",{className:"wb-pane-identity",children:[(0,o.jsx)("span",{className:"wb-pane-glyph","aria-hidden":"true",children:"\u25CE"}),(0,o.jsx)("strong",{children:"\u7F51\u9875"}),(0,o.jsxs)("span",{className:`wb-mode-chip ${r.mode==="interactive"?"is-interactive":"is-preview"}`,children:[(0,o.jsx)("span",{"aria-hidden":"true",children:r.mode==="interactive"?"\u25C6":"\u25C9"}),M]}),B?(0,o.jsx)("span",{className:"wb-lease-time",children:`${B}\u91CD\u65B0\u9501\u5B9A`}):null]}),(0,o.jsxs)("div",{className:"wb-pane-actions",children:[n?(0,o.jsx)("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:"\u65B0\u6807\u7B7E\u9875\u6253\u5F00"}):null,n&&e.authenticated&&e.capabilities.canInteract?r.mode==="interactive"?(0,o.jsx)("button",{type:"button",disabled:f==="busy",onClick:()=>{I("lock")},children:"\u7ACB\u5373\u9501\u5B9A"}):(0,o.jsx)("button",{type:"button",disabled:f==="busy",onClick:()=>{I("unlock")},children:"\u5F00\u542F\u4EA4\u4E92"}):null]})]}),(0,o.jsxs)("div",{className:"wb-pane-feedback",role:"status","aria-live":"polite",children:[(0,o.jsxs)("strong",{children:[M,":"]})," ",y," ",(0,o.jsx)("span",{title:r.securityNotice,children:r.securityNotice})]}),(0,o.jsx)("div",{className:"wb-pane-frame-shell",children:n?(0,o.jsx)("iframe",{className:"wb-pane-frame",src:n,"data-interaction-generation":u,title:`\u7F51\u9875\u9884\u89C8 \u2014 ${ye(e.session)} \u2014 ${M}`,allow:"clipboard-read; clipboard-write",referrerPolicy:"no-referrer"},`${e.session.sessionId}-${u}`):(0,o.jsxs)("div",{className:"wb-pane-empty",role:"status",children:[(0,o.jsx)("span",{"aria-hidden":"true",children:"\u25CE"}),(0,o.jsx)("strong",{children:"\u672A\u6CE8\u518C\u7F51\u9875\u9884\u89C8"}),(0,o.jsxs)("p",{children:["\u5728\u8BE5\u4F1A\u8BDD\u5185\u8FD0\u884C ",(0,o.jsx)("code",{children:"botmux preview <\u7AEF\u53E3>"})," \u6CE8\u518C\u9884\u89C8\u3002"]})]})})]})}function Ne(e){let n=e.session,r=[["\u4F1A\u8BDD ID",n.sessionId],["\u72B6\u6001",n.status],["\u673A\u5668\u4EBA",n.botName||n.larkAppId||"\u2014"],["CLI",n.cliId||"unknown"],["\u4ED3\u5E93",n.repoName||n.workingDir||"\u2014"],["\u5206\u652F",n.gitBranch||"\u2014"],["\u7FA4\u804A",n.chatDisplayName||n.chatId||"\u2014"],["\u8303\u56F4",n.scope||"thread"]];return(0,o.jsxs)("div",{className:"wb-info-content",children:[(0,o.jsx)("h2",{children:ye(n)}),(0,o.jsx)("dl",{children:r.map(([c,f])=>(0,o.jsxs)("div",{children:[(0,o.jsx)("dt",{children:c}),(0,o.jsx)("dd",{title:String(f),children:String(f)})]},c))})]})}var s=H(te(),1),Mn=250,jn=250,Yn=new Set(["starting","working","analyzing"]);function Qn(){return typeof window>"u"?null:window.location}function Zn(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function et(e){let[n,r]=(0,d.useState)(e??(typeof window>"u"?1440:window.innerWidth));return(0,d.useEffect)(()=>{if(e!==void 0){r(e);return}let c=()=>r(window.innerWidth);return c(),window.addEventListener("resize",c,{passive:!0}),()=>window.removeEventListener("resize",c)},[e]),n}function nt(e){let n=qe(e);return n["needs-you"][0]?.sessionId??n.active[0]?.sessionId??n.recent[0]?.sessionId??null}function tt(e,n){return{...e,...n,version:1,railWidth:Ge(Number(n.railWidth??e.railWidth)),splitRatio:Re(Number(n.splitRatio??e.splitRatio))}}function xn(e){let n=(0,d.useMemo)(()=>e.api??Ve(),[e.api]),r=e.storage===void 0?Zn():e.storage,c=e.location===void 0?Qn():e.location,f=e.now??Date.now(),p=et(e.viewportWidth),y=e.initialSessionId??nt(e.sessions),[l,u]=(0,d.useState)(y),[v,_]=(0,d.useState)(()=>{let t=y?le(y,r):le("",null),a=an(r);return{sessionId:y,layout:a?{...t,railWidth:a.railWidth,railCollapsed:a.railCollapsed}:t}}),[S,T]=(0,d.useState)("sessions"),k=(0,d.useRef)(null),g=(0,d.useRef)(e.initialSessionId),I=(0,d.useRef)(f);I.current=f;let K=(0,d.useRef)(f),[B,M]=(0,d.useState)(()=>dn(r)??"status"),[b,C]=(0,d.useState)(()=>{let t=ln(r);if(t)return t;let a={};for(let m of e.sessions)se(m.sessionId)&&(a[m.sessionId]=f);return ve({seen:a,unread:{}})}),E=(0,d.useRef)(new Map),[L,O]=(0,d.useState)(null),me=L?.sessionId??null,[G,be]=(0,d.useState)(!1),oe=t=>{O(a=>En(a,t))},z=(0,d.useCallback)(t=>{t.fixed&&be(!0),O(a=>Ln(a,t))},[]),X=(0,d.useMemo)(()=>e.sessions.find(t=>t.sessionId===me)??null,[e.sessions,me]),h=(0,d.useMemo)(()=>e.sessions.find(t=>t.sessionId===l)??null,[e.sessions,l]),J=!!h&&ge(h)!==null,Se=(0,d.useMemo)(()=>J?["workspace","preview","info"]:["workspace","info"],[J]),P=v.layout,fe=en().appearance.termStyle,[q,V]=(0,d.useState)(!1),R=Xe(p,P),Fe=R.chatMode==="native-split"&&P.chatRequested,U=R.railCollapsed,j=U?40:P.railWidth;(0,d.useEffect)(()=>{let t=g.current!==e.initialSessionId;g.current=e.initialSessionId,!(!t||e.initialSessionId===void 0)&&u(e.initialSessionId)},[e.initialSessionId]),(0,d.useEffect)(()=>{v.sessionId!==l&&_(t=>{let a=l?le(l,r):le("",null);return{sessionId:l,layout:{...a,railWidth:t.layout.railWidth,railCollapsed:t.layout.railCollapsed}}})},[v.sessionId,l,r]),(0,d.useEffect)(()=>{S==="preview"&&!J&&T("workspace")},[S,J]),(0,d.useEffect)(()=>{let t=v.sessionId;if(!t)return;let a=v.layout,m=setTimeout(()=>{rn(t,a,r)},Mn);return()=>clearTimeout(m)},[v,r]),(0,d.useEffect)(()=>{let t={railWidth:P.railWidth,railCollapsed:P.railCollapsed},a=setTimeout(()=>{sn(r,t)},Mn);return()=>clearTimeout(a)},[P.railWidth,P.railCollapsed,r]),(0,d.useEffect)(()=>{let t=E.current,a=new Map,m=[];for(let x of e.sessions){let N=x.sessionId;if(!se(N))continue;let $=String(x.status??"");a.set(N,$);let D=t.get(N);D&&Yn.has(D)&&$==="idle"&&N!==l&&m.push(N)}if(E.current=a,m.length===0)return;let W=I.current;C(x=>{let N={...x.unread};for(let $ of m)N[$]=W;return ve({seen:x.seen,unread:N})})},[e.sessions,l]),(0,d.useEffect)(()=>{let t=b,a=setTimeout(()=>{cn(r,t)},jn);return()=>clearTimeout(a)},[b,r]);let Y=(0,d.useMemo)(()=>{let t=new Set;for(let a of e.sessions){let m=a.sessionId;if(!se(m)||m===l||a.status==="closed")continue;let W=b.seen[m],x=b.unread[m];if(x!==void 0&&x>=(W??0)){t.add(m);continue}Ae(a)>(W??K.current)&&t.add(m)}return t},[e.sessions,b,l]),re=t=>{if(!se(t))return;let a=e.sessions.find(W=>W.sessionId===t),m=Math.max(I.current,a?Ae(a):0);C(W=>{if(W.seen[t]===m&&W.unread[t]===void 0)return W;let x={...W.unread};return delete x[t],ve({seen:{...W.seen,[t]:m},unread:x})})},he=t=>{M(t),un(r,t)},A=t=>{_(a=>({...a,layout:tt(a.layout,t)}))},F=t=>{re(t),u(t);let a=$e("main",t);e.onRouteChange?e.onRouteChange(a):typeof window<"u"&&window.history.replaceState(window.history.state,"",a)},Ce=t=>{F(t),O(a=>In(a,t))},Ie=t=>{F(t),oe(t),T("workspace")},Ee=t=>{t.preventDefault();let a=t.currentTarget;a.setPointerCapture?.(t.pointerId);let m=k.current;m?.classList.add("is-rail-dragging");let W=t.clientX,x=P.railWidth,N=W,$=W,D=0,De=()=>{D=0,$=N,A({railWidth:x+$-W})},He=Nn=>{N=Nn.clientX,D===0&&(D=window.requestAnimationFrame(De))},ne=()=>{D!==0&&(window.cancelAnimationFrame(D),D=0),N!==$&&De(),m?.classList.remove("is-rail-dragging"),window.removeEventListener("pointermove",He),window.removeEventListener("pointerup",ne),window.removeEventListener("pointercancel",ne),a.removeEventListener("lostpointercapture",ne)};window.addEventListener("pointermove",He),window.addEventListener("pointerup",ne),window.addEventListener("pointercancel",ne),a.addEventListener("lostpointercapture",ne)},ie=t=>{t.key!=="ArrowLeft"&&t.key!=="ArrowRight"||(t.preventDefault(),A({railWidth:P.railWidth+(t.key==="ArrowLeft"?-8:8)}))},Le=t=>{t.key==="/"&&!(t.target instanceof HTMLInputElement)&&!(t.target instanceof HTMLTextAreaElement)&&(t.preventDefault(),k.current?.querySelector(".wb-session-search input")?.focus())},we={"--wb-rail-width":`${j}px`},ae=R.mode==="desktop"?()=>A({railCollapsed:!P.railCollapsed}):void 0,Q=!!ae&&U,Z=(0,s.jsx)(mn,{sessions:e.sessions,selectedSessionId:l,collapsed:Q,locale:e.locale,now:f,online:e.online,chatFollowNavigates:R.mode!=="mobile",unreadIds:Y,dimension:B,onDimensionChange:he,onSeen:re,onLocate:e.capabilities.canLocate?t=>n.locateSession(t):void 0,fixedTerminal:G,terminalBusySessionId:L?.busy?L.sessionId:null,onOpenAppearance:R.mode==="mobile"?()=>V(!0):void 0,onSelect:t=>{if(Ce(t),R.mode==="mobile"){O(a=>a&&a.sessionId===t?a:ue(t)),T("workspace");return}},onOpenTerminal:Ie,onToggleCollapsed:ae}),ee=h?(0,s.jsxs)("section",{className:"wb-workspace","aria-label":`\u5DE5\u4F5C\u53F0 \u2014 ${h.title||h.sessionId}`,children:[(0,s.jsxs)("header",{className:"wb-workspace-header",children:[(0,s.jsx)("div",{className:"wb-workspace-title",children:(0,s.jsxs)("span",{children:[(0,s.jsx)("strong",{title:String(h.title||h.sessionId),children:String(h.title||h.sessionId)}),(0,s.jsxs)("small",{children:[h.botName||h.larkAppId||"Bot"," \xB7 ",h.cliId||"\u672A\u77E5"," \xB7 ",h.repoName||"\u65E0\u4ED3\u5E93"]})]})}),(0,s.jsxs)("div",{className:"wb-workspace-controls",children:[X?(0,s.jsx)("button",{type:"button",className:"wb-layout-level wb-terminal-toggle","aria-pressed":"true",title:"\u5173\u95ED\u7EC8\u7AEF\u9762\u677F",onClick:()=>O(null),children:"\u5173\u95ED\u7EC8\u7AEF \u2715"}):null,R.mode!=="mobile"?(0,s.jsx)(on,{standingLink:e.manageAuthed===!0,api:n}):null]})]}),(0,s.jsx)("div",{className:"wb-pane-stack",children:X?(0,s.jsx)(Rn,{session:X,api:n,authenticated:e.authenticated,capabilities:e.capabilities,now:f,location:c,autoTakeControl:!1,onControlModeChange:z},`${X.sessionId}:${L?.generation??0}`):(0,s.jsxs)("div",{className:"wb-pane-placeholder",role:"status",children:[(0,s.jsx)("span",{"aria-hidden":"true",children:"\u203A_"}),(0,s.jsx)("p",{children:"\u5728\u5DE6\u4FA7\u4F1A\u8BDD\u884C\u70B9\u51FB\u7EC8\u7AEF\u56FE\u6807\u6253\u5F00\u7EC8\u7AEF"})]})})]}):(0,s.jsxs)("section",{className:"wb-workspace wb-no-selection","aria-live":"polite",children:[(0,s.jsx)("span",{"aria-hidden":"true",children:"\u2301"}),(0,s.jsx)("h2",{children:l?"\u4F1A\u8BDD\u4E0D\u5B58\u5728":"\u9009\u62E9\u4E00\u4E2A\u4F1A\u8BDD"}),(0,s.jsx)("p",{children:l?"\u8BE5\u4F1A\u8BDD\u5DF2\u7ED3\u675F\u6216\u88AB\u6E05\u7406":"\u4ECE\u5DE6\u4FA7\u5217\u8868\u9009\u62E9\u4F1A\u8BDD\uFF0C\u67E5\u770B\u7EC8\u7AEF\u6216\u7F51\u9875\u9884\u89C8"})]}),w=S==="sessions"?Z:S==="info"&&h?(0,s.jsx)("main",{className:"wb-mobile-info",children:(0,s.jsx)(Ne,{session:h})}):ee;return(0,s.jsx)("main",{ref:k,className:"agent-workbench-page","data-surface":"appCenter","data-term-style":fe,"data-responsive-step":R.step,"data-demo":e.demo?"true":void 0,style:we,onKeyDown:Le,children:R.mode==="mobile"?(0,s.jsxs)("div",{className:"wb-mobile-stack",children:[S==="sessions"?Z:(0,s.jsxs)("div",{className:"wb-mobile-detail",children:[(0,s.jsxs)("div",{className:"wb-mobile-detail-bar",children:[(0,s.jsx)("button",{type:"button",className:"wb-mobile-back",onClick:()=>T("sessions"),children:"\u2039 \u4F1A\u8BDD\u5217\u8868"}),h?(0,s.jsx)("span",{className:"wb-mobile-detail-title",title:String(h.title||h.sessionId),children:String(h.title||h.sessionId)}):null,(0,s.jsx)("span",{className:"wb-mobile-detail-seg",children:Se.map(t=>(0,s.jsx)("button",{type:"button","aria-current":S===t?"page":void 0,onClick:()=>T(t),children:t==="workspace"?"\u7EC8\u7AEF":t==="preview"?"\u7F51\u9875":"\u4FE1\u606F"},t))})]}),S==="info"&&h?(0,s.jsx)("main",{className:"wb-mobile-info",children:(0,s.jsx)(Ne,{session:h})}):S==="preview"&&h?(0,s.jsx)("main",{className:"wb-mobile-preview",children:(0,s.jsx)(An,{session:h,api:n,authenticated:e.authenticated,capabilities:e.capabilities,now:f})}):ee]}),(0,s.jsx)(tn,{open:q,onClose:()=>V(!1),standingLink:e.manageAuthed===!0,api:n})]}):(0,s.jsxs)("div",{className:`wb-desktop-layout${Q?" is-rail-collapsed":""}${X?"":" is-terminal-closed"}`,children:[Z,Q?null:(0,s.jsx)("button",{type:"button",className:"wb-rail-separator",role:"separator","aria-label":"\u8C03\u6574\u5217\u8868\u5BBD\u5EA6","aria-orientation":"vertical","aria-valuemin":176,"aria-valuemax":460,"aria-valuenow":P.railWidth,onPointerDown:Ee,onKeyDown:ie,children:(0,s.jsx)("span",{"aria-hidden":"true",children:"\u22EE"})}),ee]})})}var _e=H(te(),1);function ot(){let e=Oe(),[n,r]=(0,We.useState)(Date.now());(0,We.useEffect)(()=>{let f=window.setInterval(()=>r(Date.now()),3e4);return()=>window.clearInterval(f)},[]);let c=Be(window.location.hash);return(0,_e.jsx)(xn,{sessions:[...e.sessions.values()],online:e.online,authenticated:pe.workbenchAuthed,capabilities:pe.workbenchCapabilities,manageAuthed:pe.authed,initialSessionId:c?.surface==="main"?c.sessionId:null,locale:"zh-CN",now:n})}function It(e){return Ke(e,(0,_e.jsx)(ot,{}))}export{It as renderAgentWorkbenchPage};
|
|
1
|
+
import{A as on,B as le,C as rn,D as an,E as sn,F as ve,G as ln,H as cn,I as dn,J as un,K as mn,L as bn,M as fn,a as se,b as $e,c as Be,d as Ge,e as Re,f as Xe,g as Ae,h as ye,i as qe,j as Me,k as Ue,l as ze,m as ge,q as Je,r as xe,s as Ve,t as je,u as Ye,v as Qe,w as Ze,x as en,y as nn,z as tn}from"./chunk-IA5KMD5O.js";import"./chunk-OWUXOKFE.js";import"./chunk-ZJVTGU5X.js";import{a as Oe}from"./chunk-R3LJUCEO.js";import"./chunk-QITAMHW6.js";import{w as pe}from"./chunk-K232GT3M.js";import{c as Ke}from"./chunk-ARROO6TE.js";import{c as H,d as Pe,e as te}from"./chunk-3YZFAHNK.js";var We=H(Pe(),1);var d=H(Pe(),1);var i=H(Pe(),1);function pn(){return{phase:"loading",authoritative:null,observeEpoch:0,observeIssueEpoch:0,observeIssuedDuringWrite:!1,writeEpoch:0,pending:null,mayWrite:!1,error:null,frameGeneration:0,reconcileNonce:0}}function hn(e){return e.mode==="controlled"&&e.owned?"controlled":"readonly"}function ce(e){return e?.mode==="controlled"&&e.owned}function yn(e){return e.phase==="taking-over"||e.phase==="releasing"}function gn(e){return e.phase==="readonly"||e.phase==="controlled"}function wn(e){return e.observeIssueEpoch<e.writeEpoch||e.observeIssuedDuringWrite}function vn(e){return e.phase==="unknown"&&e.mayWrite}function kn(e){switch(e.phase){case"loading":return"loading";case"unknown":return"unknown";case"controlled":return"controlled";case"readonly":return"readonly";default:return ce(e.authoritative)?"controlled":"readonly"}}function Tn(e,n){switch(n.type){case"observe-start":return{...e,observeEpoch:n.epoch,observeIssueEpoch:e.writeEpoch,observeIssuedDuringWrite:e.pending!==null,phase:n.source==="load"&&!e.pending?"loading":e.phase};case"observe-settled":{if(n.epoch!==e.observeEpoch||e.pending||wn(e))return e;let r=ce(e.authoritative)&&!ce(n.control);return{...e,phase:hn(n.control),authoritative:n.control,mayWrite:ce(n.control),error:e.error?.from==="write"?e.error:null,frameGeneration:e.frameGeneration+(r?1:0)}}case"observe-failed":{if(n.epoch!==e.observeEpoch||e.pending||wn(e))return e;let r={text:n.error,from:"observe"};return!e.authoritative&&n.canHoldLease?{...e,phase:"unknown",mayWrite:!0,error:r}:e.authoritative?{...e,error:r}:{...e,phase:"readonly",authoritative:{mode:"readonly",owned:!1},mayWrite:!1,error:r}}case"settle-readonly":return e.phase==="readonly"&&e.authoritative?.mode==="readonly"&&!e.pending&&!e.mayWrite&&!e.error?e:{...e,phase:"readonly",authoritative:{mode:"readonly",owned:!1},pending:null,mayWrite:!1,error:null};case"write-start":return{...e,writeEpoch:n.epoch,pending:{action:n.action,epoch:n.epoch},phase:n.action==="takeover"?"taking-over":"releasing",mayWrite:!0,error:null};case"write-settled":return n.epoch!==e.writeEpoch?e:{...e,phase:hn(n.control),authoritative:n.control,pending:null,mayWrite:ce(n.control),error:null,frameGeneration:e.frameGeneration+1};case"write-failed":return n.epoch!==e.writeEpoch?e:{...e,phase:"unknown",pending:null,mayWrite:!0,error:{text:n.error,from:"write"},reconcileNonce:e.reconcileNonce+1};default:return e}}var Wn="botmux:wb-terminal-write",de=new Map;function Sn(e,n){let r=de.get(e);return r||(r=new Set,de.set(e,r)),r.add(n),()=>{let c=de.get(e);c&&(c.delete(n),c.size===0&&de.delete(e))}}function Cn(e){return(de.get(e)?.size??0)>0}function ue(e,n=0){return{sessionId:e,mode:"loading",fixed:!1,toggleOnly:!1,busy:!1,generation:n}}function In(e,n){return e?e.sessionId===n?e:ue(n):null}function En(e,n){return e&&e.busy&&e.sessionId===n?e:!e||e.sessionId!==n?ue(n):e.toggleOnly||e.mode!=="controlled"?null:ue(n,e.generation+1)}function Ln(e,n){return!e||e.sessionId!==n.sessionId||e.mode===n.mode&&e.fixed===n.fixed&&e.toggleOnly===n.toggleOnly&&e.busy===n.busy?e:{...e,mode:n.mode,fixed:n.fixed,toggleOnly:n.toggleOnly,busy:n.busy}}var o=H(te(),1);function _n(e){try{let n=e?.contentWindow?.document?.getElementById("status")?.textContent?.trim();return n==="connected"?"connected":n==="disconnected"?"disconnected":"unknown"}catch{return"unknown"}}function Fn(e){try{let r=e?.contentWindow?.wsHasWrite;return r===!0?"writable":r===!1?"readonly":"unknown"}catch{return"unknown"}}function Dn(e){if(!e||typeof e!="object")return null;let n=e;return n.type!==Wn?null:n.write===null?"unknown":typeof n.write=="boolean"?n.write?"writable":"readonly":null}var Pn=1e3,Hn=8;function Kn(e){let{enabled:n,frameKey:r,sessionId:c}=e,[f,p]=(0,i.useState)(!1),[y,l]=(0,i.useState)(null),u=(0,i.useRef)(!1),v=(0,i.useRef)(e.read);(0,i.useEffect)(()=>{v.current=e.read}),(0,i.useEffect)(()=>{u.current=!1,p(!1)},[c]),(0,i.useEffect)(()=>{if(!n||u.current||y!==r)return;let S=0,T=setInterval(()=>{let k=v.current();if(k==="connected"){u.current=!0,p(!1),clearInterval(T);return}if(k!=="disconnected"){S=0;return}S+=1,S>=Hn&&p(!0)},Pn);return()=>clearInterval(T)},[n,r,y]);let _=(0,i.useCallback)(()=>l(r),[r]);return{blocked:n&&f,onFrameLoad:n?_:void 0}}var On=5;function $n(e){let{enabled:n,frameKey:r}=e,[c,f]=(0,i.useState)("unknown"),p=(0,i.useRef)(e.read);return(0,i.useEffect)(()=>{p.current=e.read}),(0,i.useEffect)(()=>{if(!n)return;f("unknown");let y=0,l=()=>{let v=p.current();return v==="unknown"?!1:(f(v),!0)};if(l())return;let u=setInterval(()=>{y+=1,(l()||y>=On)&&clearInterval(u)},Pn);return()=>clearInterval(u)},[n,r]),n?c:"unknown"}function Bn(e){let{enabled:n,frameKey:r}=e,[c,f]=(0,i.useState)({write:"unknown",live:!1}),p=(0,i.useRef)(e.frame);return(0,i.useEffect)(()=>{p.current=e.frame}),(0,i.useEffect)(()=>{if(f({write:"unknown",live:!1}),!n||typeof window>"u"||!window.addEventListener)return;let y=l=>{let u=p.current()?.contentWindow;if(!u||l.source!==u)return;let v=Dn(l.data);v!==null&&f({write:v,live:!0})};return window.addEventListener("message",y),()=>window.removeEventListener("message",y)},[n,r]),n?c:{write:"unknown",live:!1}}function Gn(){try{return typeof window>"u"?void 0:window.location?.href}catch{return}}function Te(e){return e instanceof xe?{authentication_required:"\u9700\u8981\u767B\u5F55\u8BA4\u8BC1",session_not_active:"\u4F1A\u8BDD\u5DF2\u4E0D\u518D\u6D3B\u8DC3",daemon_offline:"\u6240\u5C5E daemon \u5DF2\u79BB\u7EBF",terminal_unavailable:"\u7EC8\u7AEF\u4E0D\u53EF\u7528",control_busy:"\u53E6\u4E00\u4E2A\u6D4F\u89C8\u5668\u6B63\u5728\u63A7\u5236\u8BE5\u7EC8\u7AEF",preview_not_registered:"\u672A\u6CE8\u518C\u7F51\u9875\u9884\u89C8",control_request_timeout:"\u63A7\u5236\u6743\u8BF7\u6C42\u8D85\u65F6"}[e.code]??e.code.replaceAll("_"," "):e instanceof Error?e.message:String(e)}var Xn=1e4;async function qn(e,n=Xn){let r=new AbortController,c,f=new Promise((p,y)=>{c=setTimeout(()=>{try{r.abort()}catch{}y(new xe(504,"control_request_timeout"))},n)});f.catch(()=>{});try{return await Promise.race([e(r.signal),f])}finally{c!==void 0&&clearTimeout(c)}}function Un(e){let n=(0,i.useRef)(null);return(0,i.useEffect)(()=>{try{n.current?.focus?.()}catch{}},[]),(0,o.jsxs)("div",{ref:n,tabIndex:-1,className:"wb-pane-empty wb-control-unknown",role:"status",children:[(0,o.jsx)("span",{"aria-hidden":"true",children:"\u25C7"}),(0,o.jsx)("strong",{children:"\u63A7\u5236\u6743\u72B6\u6001\u672A\u77E5"}),(0,o.jsx)("p",{children:"\u6CA1\u6709\u62FF\u5230\u786E\u8BA4\uFF0C\u8FD9\u5757\u7EC8\u7AEF\u53EF\u80FD\u4ECD\u7136\u53EF\u5199\u3002\u5DF2\u65AD\u5F00\u7EC8\u7AEF\u753B\u9762\u6321\u4F4F\u8F93\u5165\uFF0C\u6B63\u5728\u91CD\u65B0\u786E\u8BA4\u3002"}),(0,o.jsx)("button",{type:"button",onClick:e.onRetry,children:"\u7ACB\u5373\u91CD\u8BD5"})]})}function Rn(e){let[n,r]=(0,i.useReducer)(Tn,void 0,pn),c=(0,i.useRef)(0),f=(0,i.useRef)(0),p=(0,i.useRef)(!0);(0,i.useEffect)(()=>(p.current=!0,()=>{p.current=!1}),[]);let y=Ue(e.session,e.location),l=ze(e.session),u=bn(),{link:v,phase:_,retry:S}=fn({api:e.api,sessionId:e.session.sessionId,enabled:!l&&(u||!e.authenticated)}),T=v?v.url:null,k=!l&&u?T:e.authenticated?y:T,g=e.session.sessionId,I=(0,i.useCallback)(async(w,t)=>{if(!y||l||!e.authenticated){r({type:"settle-readonly"});return}let a=++c.current;r({type:"observe-start",epoch:a,source:w});try{let m=await e.api.getTerminalControl(g,t);r({type:"observe-settled",epoch:a,control:m})}catch(m){if(t?.aborted)return;r({type:"observe-failed",epoch:a,error:Te(m),canHoldLease:e.capabilities.canControl&&!u})}},[l,e.api,e.authenticated,e.capabilities.canControl,g,y,u]);(0,i.useEffect)(()=>{let w=new AbortController;I("load",w.signal);let t=setInterval(()=>{I("poll",w.signal)},15e3);return()=>{c.current+=1,clearInterval(t),w.abort()}},[I]);let K=n.authoritative?.expiresAt;(0,i.useEffect)(()=>{if(n.phase!=="controlled"||!K)return;let w=setTimeout(()=>{I("poll")},Math.max(0,K-Date.now())+25);return()=>clearTimeout(w)},[K,n.phase,I]),(0,i.useEffect)(()=>{if(n.reconcileNonce===0)return;let w=new AbortController;return I("reconcile",w.signal),()=>w.abort()},[n.reconcileNonce,I]);let B=(0,i.useRef)(null);(0,i.useEffect)(()=>{if(e.autoTakeControl===void 0||!e.authenticated||!e.capabilities.canControl||u||!gn(n))return;let w=n.authoritative;!w||w.fixed||B.current!==g&&(B.current=g,w.mode==="controlled"&&w.owned&&L("release"))});let M=(0,i.useRef)(new Map),b=()=>{let w=[...M.current.values()];return M.current.clear(),w},C=(0,i.useCallback)(async w=>{for(let t of w)Cn(t.sessionId)||await e.api.releaseTerminal(t.sessionId,void 0,t.acquisitionId).catch(()=>{})},[e.api]),E=(0,i.useRef)(0),L=async w=>{let t=++f.current,a=w==="takeover"?Je():void 0;a&&M.current.set(a,{sessionId:g,acquisitionId:a}),E.current+=1,r({type:"write-start",epoch:t,action:w});try{let m=await qn(W=>w==="takeover"?e.api.takeoverTerminal(g,W,a):e.api.releaseTerminal(g,W));if((w==="release"||m.fixed===!0)&&M.current.clear(),!p.current){C(b());return}r({type:"write-settled",epoch:t,control:m})}catch(m){if(!p.current){C(b());return}r({type:"write-failed",epoch:t,error:Te(m)})}finally{E.current-=1}};(0,i.useEffect)(()=>{n.authoritative?.fixed===!0&&M.current.clear()},[n.authoritative]);let O=(0,i.useRef)(C);(0,i.useEffect)(()=>{O.current=C}),(0,i.useEffect)(()=>()=>{if(E.current>0)return;let w=[...M.current.values()];w.length!==0&&(M.current.clear(),Promise.resolve().then(()=>O.current(w)))},[g]);let me=(0,i.useRef)({});(0,i.useEffect)(()=>{if(n.mayWrite)return Sn(g,me.current)},[n.mayWrite,g]);let G=(0,i.useRef)(null),be=(0,i.useRef)(0),oe=(0,i.useRef)(void 0);oe.current!==k&&(oe.current!==void 0&&(be.current+=1),oe.current=k);let z=`${g}-${n.frameGeneration}-l${be.current}`,X=e.readFrameStatus??_n,h=Kn({enabled:u,sessionId:g,frameKey:z,read:()=>X(G.current)}),J=e.readFrameWrite??Fn,Se=$n({enabled:u,frameKey:z,read:()=>J(G.current)}),P=Bn({enabled:u,frameKey:z,frame:()=>G.current}),fe=P.live?P.write:Se,{appearance:q,skin:V}=Ze(),R=(0,i.useCallback)(()=>{Qe(G.current,k,q.termStyle,V,Gn())},[q.termStyle,k,V]);(0,i.useEffect)(()=>{R()},[R]);let Fe=(0,i.useCallback)(()=>{h.onFrameLoad?.(),R()},[h,R]),U=n.authoritative,j=yn(n),Y=U?.fixed===!0,re=!l&&!!y&&e.authenticated&&e.capabilities.canControl&&!u&&!Y,he=fe!=="unknown"?fe:Y?"unknown":"readonly",A=u?he==="writable"?"controlled":he==="readonly"?"readonly":"unknown":kn(n),F=A==="controlled",Ce=F?"\u53EF\u8F93\u5165":A==="unknown"?"\u672A\u77E5":A==="loading"?"\u68C0\u67E5\u4E2D":"\u53EA\u8BFB",Ie=F?"is-controlled":A==="unknown"?"is-unknown":A==="loading"?"is-checking":"is-readonly",Ee=F?"\u25C6":A==="unknown"?"\u25C7":A==="loading"?"\u22EF":"\u25CC",ie=!u&&vn(n),Le=!l&&!!y&&!u&&e.authenticated&&e.capabilities.canControl,we=n.phase==="loading"&&Le,ae=ie||we,Q=e.onControlModeChange,Z=!re;(0,i.useEffect)(()=>{Q?.({sessionId:g,mode:A,fixed:Y,toggleOnly:Z,busy:j})},[j,Y,Q,A,g,Z]);let ee=F&&U?.expiresAt?Me(U.expiresAt,e.now,"zh-CN"):null;return(0,o.jsxs)("section",{className:`wb-pane wb-terminal-pane ${je(q.termStyle)}`,style:Ye(q.termStyle,V),"aria-label":"\u7EC8\u7AEF\u9762\u677F",children:[(0,o.jsxs)("header",{className:"wb-pane-titlebar",children:[(0,o.jsxs)("div",{className:"wb-pane-identity",children:[(0,o.jsx)("span",{className:"wb-pane-glyph","aria-hidden":"true",children:"\u203A_"}),(0,o.jsx)("strong",{children:"\u7EC8\u7AEF"}),(0,o.jsxs)("span",{className:`wb-mode-chip ${Ie}`,children:[(0,o.jsx)("span",{"aria-hidden":"true",children:Ee}),Ce]}),ee?(0,o.jsx)("span",{className:"wb-lease-time",children:`${ee}\u5230\u671F`}):null]}),(0,o.jsx)(nn,{termStyle:q.termStyle}),(0,o.jsxs)("div",{className:"wb-pane-actions",children:[k?(0,o.jsx)("a",{href:k,target:"_blank",rel:"noopener noreferrer",children:"\u65B0\u6807\u7B7E\u9875\u6253\u5F00"}):null,re?F?(0,o.jsx)("button",{type:"button",disabled:j,onClick:()=>{L("release")},children:"\u91CA\u653E\u8F93\u5165"}):(0,o.jsx)("button",{type:"button",disabled:j,onClick:()=>{L("takeover")},children:"\u63A5\u7BA1\u8F93\u5165"}):null]})]}),(0,o.jsx)("div",{className:"wb-pane-feedback",role:"status","aria-live":"polite",children:u?F?"\u5F53\u524D\u8EAB\u4EFD\u5728\u624B\u673A\u7AEF\u4E5F\u53EF\u76F4\u63A5\u8F93\u5165\u3002":A==="unknown"?"\u53EA\u8BFB\u94FE\u63A5\u67E5\u770B\u4E2D\uFF0C\u80FD\u5426\u8F93\u5165\u4EE5\u7EC8\u7AEF\u9875\u5185\u7684\u63D0\u793A\u4E3A\u51C6\u3002":"\u53EA\u8BFB\u67E5\u770B\u4E2D\u3002\u624B\u673A\u7AEF\u4E3A\u53EA\u8BFB\u89C6\u56FE\uFF0C\u9700\u8981\u8F93\u5165\u8BF7\u5728\u7535\u8111\u4E0A\u64CD\u4F5C\u3002":n.phase==="loading"?"\u6B63\u5728\u68C0\u67E5\u7EC8\u7AEF\u6743\u9650\u2026":n.phase==="taking-over"?"\u6B63\u5728\u63A5\u7BA1\u8F93\u5165\u2026":n.phase==="releasing"?"\u6B63\u5728\u91CA\u653E\u8F93\u5165\u2026":n.error?`${n.error.text}${n.phase==="unknown"?"\uFF1B\u63A7\u5236\u6743\u72B6\u6001\u672A\u77E5\uFF0C\u6B63\u5728\u91CD\u65B0\u786E\u8BA4\u2026":""}`:n.phase==="unknown"?"\u63A7\u5236\u6743\u72B6\u6001\u672A\u77E5\uFF0C\u6B63\u5728\u91CD\u65B0\u786E\u8BA4\u2026":U?.fixed?"\u5E73\u53F0\u6240\u6709\u8005\u8EAB\u4EFD\u5DF2\u767B\u5F55\uFF0C\u53EF\u76F4\u63A5\u8F93\u5165\u3002":F?"\u5DF2\u63A5\u7BA1\uFF0C\u53EF\u952E\u76D8\u8F93\u5165\u3002":e.authenticated&&e.capabilities.canControl?"\u53EA\u8BFB\u67E5\u770B\u4E2D\uFF0C\u70B9\u300C\u63A5\u7BA1\u8F93\u5165\u300D\u53EF\u64CD\u4F5C\u3002":e.authenticated?"\u53EA\u8BFB\u67E5\u770B\u4E2D\uFF0C\u5F53\u524D\u8EAB\u4EFD\u4E0D\u53EF\u63A5\u7BA1\u8F93\u5165\u3002":"\u53EA\u8BFB\u67E5\u770B\u3002\u767B\u5F55 Dashboard \u540E\u53EF\u63A5\u7BA1\u3002"}),(0,o.jsx)("div",{className:"wb-pane-frame-shell",children:l?(0,o.jsxs)("div",{className:"wb-pane-empty",children:[(0,o.jsx)("span",{"aria-hidden":"true",children:"\u2197"}),(0,o.jsx)("strong",{children:"\u5916\u90E8 Riff \u7EC8\u7AEF"}),(0,o.jsx)("p",{children:"\u8BE5\u540E\u7AEF\u4E0D\u5728\u5DE5\u4F5C\u53F0\u9762\u677F\u5185\u5C55\u793A\u3002"}),(0,o.jsx)("a",{href:l,target:"_blank",rel:"noopener noreferrer",children:"\u6253\u5F00\u5916\u90E8\u7EC8\u7AEF"})]}):k?(0,o.jsxs)(o.Fragment,{children:[ae?null:(0,o.jsx)("iframe",{ref:G,className:"wb-pane-frame",src:k,title:`\u7EC8\u7AEF \u2014 ${ye(e.session)}`,allow:"clipboard-read; clipboard-write",referrerPolicy:"no-referrer",onLoad:Fe},z),h.blocked&&!ae?(0,o.jsxs)("div",{className:"wb-pane-empty wb-ws-blocked",role:"status",children:[(0,o.jsx)("span",{"aria-hidden":"true",children:"\u26A0"}),(0,o.jsx)("strong",{children:"\u7EC8\u7AEF\u5B9E\u65F6\u8FDE\u63A5\u672A\u5EFA\u7ACB"}),(0,o.jsx)("p",{children:"\u5F53\u524D\u6D4F\u89C8\u5668\u73AF\u5883\u9650\u5236\u4E86\u975E\u52A0\u5BC6\u7684\u5B9E\u65F6\u8FDE\u63A5\uFF08iOS \u5185\u5E38\u89C1\uFF09\u3002\u53EF\u5C1D\u8BD5\u7528\u7CFB\u7EDF\u6D4F\u89C8\u5668\u6253\u5F00\uFF0C\u6216\u5728\u7535\u8111\u4E0A\u67E5\u770B\u3002"}),(0,o.jsx)("a",{href:k,target:"_blank",rel:"noopener",children:"\u5728\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00"}),(0,o.jsx)("p",{children:"\u98DE\u4E66\u5185\u53EF\u901A\u8FC7\u53F3\u4E0A\u89D2 \u22EF \u83DC\u5355\u9009\u62E9\u300C\u5728\u6D4F\u89C8\u5668\u6253\u5F00\u300D\u3002"})]}):null,ie?(0,o.jsx)(Un,{onRetry:()=>{I("reconcile")}}):null,!ie&&we?(0,o.jsxs)("div",{className:"wb-pane-empty wb-control-checking",role:"status",children:[(0,o.jsx)("span",{"aria-hidden":"true",children:"\u22EF"}),(0,o.jsx)("strong",{children:"\u6B63\u5728\u786E\u8BA4\u7EC8\u7AEF\u63A7\u5236\u6743"}),(0,o.jsx)("p",{children:"\u786E\u8BA4\u4E4B\u524D\u5148\u4E0D\u63A5\u5165\u7EC8\u7AEF\u753B\u9762\uFF0C\u907F\u514D\u5728\u4E0D\u77E5\u9053\u80FD\u4E0D\u80FD\u5199\u7684\u60C5\u51B5\u4E0B\u628A\u8F93\u5165\u6253\u8FDB\u53BB\u3002"})]}):null]}):(u||!e.authenticated)&&!l&&y?_==="failed"?(0,o.jsxs)("div",{className:"wb-pane-empty",role:"status",children:[(0,o.jsx)("span",{"aria-hidden":"true",children:"\u26A0"}),(0,o.jsx)("strong",{children:"\u53EA\u8BFB\u94FE\u63A5\u83B7\u53D6\u5931\u8D25"}),(0,o.jsx)("p",{children:"\u767B\u5F55\u6001\u53EF\u80FD\u5DF2\u8FC7\u671F\uFF0C\u6216\u8BE5\u4F1A\u8BDD\u7684\u7EC8\u7AEF\u670D\u52A1\u672A\u6CE8\u518C\u3002\u7A0D\u540E\u4F1A\u81EA\u52A8\u91CD\u8BD5\u3002"}),(0,o.jsx)("button",{type:"button",onClick:S,children:"\u91CD\u8BD5"})]}):(0,o.jsxs)("div",{className:"wb-pane-empty",role:"status",children:[(0,o.jsx)("span",{"aria-hidden":"true",children:"\u203A_"}),(0,o.jsx)("strong",{children:"\u6B63\u5728\u83B7\u53D6\u53EA\u8BFB\u7EC8\u7AEF\u94FE\u63A5\u2026"})]}):(0,o.jsxs)("div",{className:"wb-pane-empty",role:"status",children:[(0,o.jsx)("span",{"aria-hidden":"true",children:"\u25A1"}),(0,o.jsx)("strong",{children:"\u7EC8\u7AEF\u4E0D\u53EF\u7528"}),(0,o.jsx)("p",{children:e.session.status==="closed"?"\u4F1A\u8BDD\u5DF2\u5173\u95ED\u3002":"\u8BE5\u4F1A\u8BDD\u5C1A\u672A\u63D0\u4F9B\u7EC8\u7AEF\u5165\u53E3\u3002"})]})})]})}var ke={mode:"preview",label:"\u9884\u89C8",securityNotice:"\u4EA4\u4E92\u906E\u7F69\u7528\u4E8E\u9632\u8BEF\u89E6\uFF0C\u4E0D\u662F\u5E94\u7528\u7EA7\u5B89\u5168\u8FB9\u754C\u3002"};function An(e){let n=ge(e.session),[r,c]=(0,i.useState)(ke),[f,p]=(0,i.useState)("loading"),[y,l]=(0,i.useState)("\u9884\u89C8\u6A21\u5F0F\u5DF2\u9501\u5B9A\u3002"),[u,v]=(0,i.useState)(0),_=(0,i.useRef)("preview"),S=(0,i.useRef)(0),T=(0,i.useRef)(0),k=(0,i.useCallback)((b,C)=>{let E=_.current;_.current=b.mode,c(b),p("ready"),E==="interactive"&&b.mode==="preview"?l(C==="poll"?"\u957F\u65F6\u95F4\u65E0\u64CD\u4F5C\uFF0C\u5DF2\u91CD\u65B0\u9501\u5B9A\u3002":"\u5DF2\u91CD\u65B0\u9501\u5B9A\u3002"):b.mode==="interactive"?l("\u5DF2\u5F00\u542F\u4EA4\u4E92\uFF0C\u6301\u7EED\u64CD\u4F5C\u81EA\u52A8\u7EED\u671F\uFF0815 \u5206\u949F\uFF09\u3002"):l("\u9884\u89C8\u6A21\u5F0F\u5DF2\u9501\u5B9A\u3002")},[]),g=(0,i.useCallback)(async(b,C)=>{let E=++T.current;if(!n){c(ke),p("ready");return}try{let L=await e.api.getPreviewInteraction(e.session.sessionId,C);if(E!==T.current)return;k(L,b)}catch(L){if(C?.aborted||E!==T.current)return;_.current="preview",c(ke),l(`\u5DF2\u5B89\u5168\u9501\u5B9A\uFF1A${Te(L)}`),p("error")}},[k,n,e.api,e.session.sessionId]);(0,i.useEffect)(()=>{let b=new AbortController;p("loading"),g("load",b.signal);let C=setInterval(()=>{(typeof document>"u"||!document.hidden)&&g("poll",b.signal)},15e3);return()=>{T.current+=1,clearInterval(C),b.abort()}},[g]),(0,i.useEffect)(()=>{if(r.mode!=="interactive"||!r.idleExpiresAt)return;let b=setTimeout(()=>{g("poll")},Math.max(0,r.idleExpiresAt-Date.now())+25);return()=>clearTimeout(b)},[r.idleExpiresAt,r.mode,g]);let I=async b=>{let C=++T.current;p("busy");try{let E=b==="unlock"?await e.api.unlockPreview(e.session.sessionId):b==="lock"?await e.api.lockPreview(e.session.sessionId):await e.api.touchPreview(e.session.sessionId);if(C!==T.current)return;k(E,"action"),(b==="unlock"||b==="lock")&&v(L=>L+1)}catch(E){if(C!==T.current)return;_.current="preview",c(ke),l(`\u5DF2\u5B89\u5168\u9501\u5B9A\uFF1A${Te(E)}`),p("error")}},K=b=>{typeof Element<"u"&&b.target instanceof Element&&b.target.closest(".wb-pane-titlebar")||r.mode!=="interactive"||Date.now()-S.current<2e4||(S.current=Date.now(),I("activity"))},B=r.mode==="interactive"&&r.idleExpiresAt?Me(r.idleExpiresAt,e.now,"zh-CN"):null,M=r.mode==="interactive"?"\u53EF\u4EA4\u4E92":"\u9884\u89C8";return(0,o.jsxs)("section",{className:"wb-pane wb-web-pane","aria-label":"\u7F51\u9875\u9884\u89C8\u9762\u677F",onPointerDown:K,onKeyDown:K,children:[(0,o.jsxs)("header",{className:"wb-pane-titlebar",children:[(0,o.jsxs)("div",{className:"wb-pane-identity",children:[(0,o.jsx)("span",{className:"wb-pane-glyph","aria-hidden":"true",children:"\u25CE"}),(0,o.jsx)("strong",{children:"\u7F51\u9875"}),(0,o.jsxs)("span",{className:`wb-mode-chip ${r.mode==="interactive"?"is-interactive":"is-preview"}`,children:[(0,o.jsx)("span",{"aria-hidden":"true",children:r.mode==="interactive"?"\u25C6":"\u25C9"}),M]}),B?(0,o.jsx)("span",{className:"wb-lease-time",children:`${B}\u91CD\u65B0\u9501\u5B9A`}):null]}),(0,o.jsxs)("div",{className:"wb-pane-actions",children:[n?(0,o.jsx)("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:"\u65B0\u6807\u7B7E\u9875\u6253\u5F00"}):null,n&&e.authenticated&&e.capabilities.canInteract?r.mode==="interactive"?(0,o.jsx)("button",{type:"button",disabled:f==="busy",onClick:()=>{I("lock")},children:"\u7ACB\u5373\u9501\u5B9A"}):(0,o.jsx)("button",{type:"button",disabled:f==="busy",onClick:()=>{I("unlock")},children:"\u5F00\u542F\u4EA4\u4E92"}):null]})]}),(0,o.jsxs)("div",{className:"wb-pane-feedback",role:"status","aria-live":"polite",children:[(0,o.jsxs)("strong",{children:[M,":"]})," ",y," ",(0,o.jsx)("span",{title:r.securityNotice,children:r.securityNotice})]}),(0,o.jsx)("div",{className:"wb-pane-frame-shell",children:n?(0,o.jsx)("iframe",{className:"wb-pane-frame",src:n,"data-interaction-generation":u,title:`\u7F51\u9875\u9884\u89C8 \u2014 ${ye(e.session)} \u2014 ${M}`,allow:"clipboard-read; clipboard-write",referrerPolicy:"no-referrer"},`${e.session.sessionId}-${u}`):(0,o.jsxs)("div",{className:"wb-pane-empty",role:"status",children:[(0,o.jsx)("span",{"aria-hidden":"true",children:"\u25CE"}),(0,o.jsx)("strong",{children:"\u672A\u6CE8\u518C\u7F51\u9875\u9884\u89C8"}),(0,o.jsxs)("p",{children:["\u5728\u8BE5\u4F1A\u8BDD\u5185\u8FD0\u884C ",(0,o.jsx)("code",{children:"botmux preview <\u7AEF\u53E3>"})," \u6CE8\u518C\u9884\u89C8\u3002"]})]})})]})}function Ne(e){let n=e.session,r=[["\u4F1A\u8BDD ID",n.sessionId],["\u72B6\u6001",n.status],["\u673A\u5668\u4EBA",n.botName||n.larkAppId||"\u2014"],["CLI",n.cliId||"unknown"],["\u4ED3\u5E93",n.repoName||n.workingDir||"\u2014"],["\u5206\u652F",n.gitBranch||"\u2014"],["\u7FA4\u804A",n.chatDisplayName||n.chatId||"\u2014"],["\u8303\u56F4",n.scope||"thread"]];return(0,o.jsxs)("div",{className:"wb-info-content",children:[(0,o.jsx)("h2",{children:ye(n)}),(0,o.jsx)("dl",{children:r.map(([c,f])=>(0,o.jsxs)("div",{children:[(0,o.jsx)("dt",{children:c}),(0,o.jsx)("dd",{title:String(f),children:String(f)})]},c))})]})}var s=H(te(),1),Mn=250,jn=250,Yn=new Set(["starting","working","analyzing"]);function Qn(){return typeof window>"u"?null:window.location}function Zn(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function et(e){let[n,r]=(0,d.useState)(e??(typeof window>"u"?1440:window.innerWidth));return(0,d.useEffect)(()=>{if(e!==void 0){r(e);return}let c=()=>r(window.innerWidth);return c(),window.addEventListener("resize",c,{passive:!0}),()=>window.removeEventListener("resize",c)},[e]),n}function nt(e){let n=qe(e);return n["needs-you"][0]?.sessionId??n.active[0]?.sessionId??n.recent[0]?.sessionId??null}function tt(e,n){return{...e,...n,version:1,railWidth:Ge(Number(n.railWidth??e.railWidth)),splitRatio:Re(Number(n.splitRatio??e.splitRatio))}}function xn(e){let n=(0,d.useMemo)(()=>e.api??Ve(),[e.api]),r=e.storage===void 0?Zn():e.storage,c=e.location===void 0?Qn():e.location,f=e.now??Date.now(),p=et(e.viewportWidth),y=e.initialSessionId??nt(e.sessions),[l,u]=(0,d.useState)(y),[v,_]=(0,d.useState)(()=>{let t=y?le(y,r):le("",null),a=an(r);return{sessionId:y,layout:a?{...t,railWidth:a.railWidth,railCollapsed:a.railCollapsed}:t}}),[S,T]=(0,d.useState)("sessions"),k=(0,d.useRef)(null),g=(0,d.useRef)(e.initialSessionId),I=(0,d.useRef)(f);I.current=f;let K=(0,d.useRef)(f),[B,M]=(0,d.useState)(()=>dn(r)??"status"),[b,C]=(0,d.useState)(()=>{let t=ln(r);if(t)return t;let a={};for(let m of e.sessions)se(m.sessionId)&&(a[m.sessionId]=f);return ve({seen:a,unread:{}})}),E=(0,d.useRef)(new Map),[L,O]=(0,d.useState)(null),me=L?.sessionId??null,[G,be]=(0,d.useState)(!1),oe=t=>{O(a=>En(a,t))},z=(0,d.useCallback)(t=>{t.fixed&&be(!0),O(a=>Ln(a,t))},[]),X=(0,d.useMemo)(()=>e.sessions.find(t=>t.sessionId===me)??null,[e.sessions,me]),h=(0,d.useMemo)(()=>e.sessions.find(t=>t.sessionId===l)??null,[e.sessions,l]),J=!!h&&ge(h)!==null,Se=(0,d.useMemo)(()=>J?["workspace","preview","info"]:["workspace","info"],[J]),P=v.layout,fe=en().appearance.termStyle,[q,V]=(0,d.useState)(!1),R=Xe(p,P),Fe=R.chatMode==="native-split"&&P.chatRequested,U=R.railCollapsed,j=U?40:P.railWidth;(0,d.useEffect)(()=>{let t=g.current!==e.initialSessionId;g.current=e.initialSessionId,!(!t||e.initialSessionId===void 0)&&u(e.initialSessionId)},[e.initialSessionId]),(0,d.useEffect)(()=>{v.sessionId!==l&&_(t=>{let a=l?le(l,r):le("",null);return{sessionId:l,layout:{...a,railWidth:t.layout.railWidth,railCollapsed:t.layout.railCollapsed}}})},[v.sessionId,l,r]),(0,d.useEffect)(()=>{S==="preview"&&!J&&T("workspace")},[S,J]),(0,d.useEffect)(()=>{let t=v.sessionId;if(!t)return;let a=v.layout,m=setTimeout(()=>{rn(t,a,r)},Mn);return()=>clearTimeout(m)},[v,r]),(0,d.useEffect)(()=>{let t={railWidth:P.railWidth,railCollapsed:P.railCollapsed},a=setTimeout(()=>{sn(r,t)},Mn);return()=>clearTimeout(a)},[P.railWidth,P.railCollapsed,r]),(0,d.useEffect)(()=>{let t=E.current,a=new Map,m=[];for(let x of e.sessions){let N=x.sessionId;if(!se(N))continue;let $=String(x.status??"");a.set(N,$);let D=t.get(N);D&&Yn.has(D)&&$==="idle"&&N!==l&&m.push(N)}if(E.current=a,m.length===0)return;let W=I.current;C(x=>{let N={...x.unread};for(let $ of m)N[$]=W;return ve({seen:x.seen,unread:N})})},[e.sessions,l]),(0,d.useEffect)(()=>{let t=b,a=setTimeout(()=>{cn(r,t)},jn);return()=>clearTimeout(a)},[b,r]);let Y=(0,d.useMemo)(()=>{let t=new Set;for(let a of e.sessions){let m=a.sessionId;if(!se(m)||m===l||a.status==="closed")continue;let W=b.seen[m],x=b.unread[m];if(x!==void 0&&x>=(W??0)){t.add(m);continue}Ae(a)>(W??K.current)&&t.add(m)}return t},[e.sessions,b,l]),re=t=>{if(!se(t))return;let a=e.sessions.find(W=>W.sessionId===t),m=Math.max(I.current,a?Ae(a):0);C(W=>{if(W.seen[t]===m&&W.unread[t]===void 0)return W;let x={...W.unread};return delete x[t],ve({seen:{...W.seen,[t]:m},unread:x})})},he=t=>{M(t),un(r,t)},A=t=>{_(a=>({...a,layout:tt(a.layout,t)}))},F=t=>{re(t),u(t);let a=$e("main",t);e.onRouteChange?e.onRouteChange(a):typeof window<"u"&&window.history.replaceState(window.history.state,"",a)},Ce=t=>{F(t),O(a=>In(a,t))},Ie=t=>{F(t),oe(t),T("workspace")},Ee=t=>{t.preventDefault();let a=t.currentTarget;a.setPointerCapture?.(t.pointerId);let m=k.current;m?.classList.add("is-rail-dragging");let W=t.clientX,x=P.railWidth,N=W,$=W,D=0,De=()=>{D=0,$=N,A({railWidth:x+$-W})},He=Nn=>{N=Nn.clientX,D===0&&(D=window.requestAnimationFrame(De))},ne=()=>{D!==0&&(window.cancelAnimationFrame(D),D=0),N!==$&&De(),m?.classList.remove("is-rail-dragging"),window.removeEventListener("pointermove",He),window.removeEventListener("pointerup",ne),window.removeEventListener("pointercancel",ne),a.removeEventListener("lostpointercapture",ne)};window.addEventListener("pointermove",He),window.addEventListener("pointerup",ne),window.addEventListener("pointercancel",ne),a.addEventListener("lostpointercapture",ne)},ie=t=>{t.key!=="ArrowLeft"&&t.key!=="ArrowRight"||(t.preventDefault(),A({railWidth:P.railWidth+(t.key==="ArrowLeft"?-8:8)}))},Le=t=>{t.key==="/"&&!(t.target instanceof HTMLInputElement)&&!(t.target instanceof HTMLTextAreaElement)&&(t.preventDefault(),k.current?.querySelector(".wb-session-search input")?.focus())},we={"--wb-rail-width":`${j}px`},ae=R.mode==="desktop"?()=>A({railCollapsed:!P.railCollapsed}):void 0,Q=!!ae&&U,Z=(0,s.jsx)(mn,{sessions:e.sessions,selectedSessionId:l,collapsed:Q,locale:e.locale,now:f,online:e.online,chatFollowNavigates:R.mode!=="mobile",unreadIds:Y,dimension:B,onDimensionChange:he,onSeen:re,onLocate:e.capabilities.canLocate?t=>n.locateSession(t):void 0,fixedTerminal:G,terminalBusySessionId:L?.busy?L.sessionId:null,onOpenAppearance:R.mode==="mobile"?()=>V(!0):void 0,onSelect:t=>{if(Ce(t),R.mode==="mobile"){O(a=>a&&a.sessionId===t?a:ue(t)),T("workspace");return}},onOpenTerminal:Ie,onToggleCollapsed:ae}),ee=h?(0,s.jsxs)("section",{className:"wb-workspace","aria-label":`\u5DE5\u4F5C\u53F0 \u2014 ${h.title||h.sessionId}`,children:[(0,s.jsxs)("header",{className:"wb-workspace-header",children:[(0,s.jsx)("div",{className:"wb-workspace-title",children:(0,s.jsxs)("span",{children:[(0,s.jsx)("strong",{title:String(h.title||h.sessionId),children:String(h.title||h.sessionId)}),(0,s.jsxs)("small",{children:[h.botName||h.larkAppId||"Bot"," \xB7 ",h.cliId||"\u672A\u77E5"," \xB7 ",h.repoName||"\u65E0\u4ED3\u5E93"]})]})}),(0,s.jsxs)("div",{className:"wb-workspace-controls",children:[X?(0,s.jsx)("button",{type:"button",className:"wb-layout-level wb-terminal-toggle","aria-pressed":"true",title:"\u5173\u95ED\u7EC8\u7AEF\u9762\u677F",onClick:()=>O(null),children:"\u5173\u95ED\u7EC8\u7AEF \u2715"}):null,R.mode!=="mobile"?(0,s.jsx)(on,{standingLink:e.manageAuthed===!0,api:n}):null]})]}),(0,s.jsx)("div",{className:"wb-pane-stack",children:X?(0,s.jsx)(Rn,{session:X,api:n,authenticated:e.authenticated,capabilities:e.capabilities,now:f,location:c,autoTakeControl:!1,onControlModeChange:z},`${X.sessionId}:${L?.generation??0}`):(0,s.jsxs)("div",{className:"wb-pane-placeholder",role:"status",children:[(0,s.jsx)("span",{"aria-hidden":"true",children:"\u203A_"}),(0,s.jsx)("p",{children:"\u5728\u5DE6\u4FA7\u4F1A\u8BDD\u884C\u70B9\u51FB\u7EC8\u7AEF\u56FE\u6807\u6253\u5F00\u7EC8\u7AEF"})]})})]}):(0,s.jsxs)("section",{className:"wb-workspace wb-no-selection","aria-live":"polite",children:[(0,s.jsx)("span",{"aria-hidden":"true",children:"\u2301"}),(0,s.jsx)("h2",{children:l?"\u4F1A\u8BDD\u4E0D\u5B58\u5728":"\u9009\u62E9\u4E00\u4E2A\u4F1A\u8BDD"}),(0,s.jsx)("p",{children:l?"\u8BE5\u4F1A\u8BDD\u5DF2\u7ED3\u675F\u6216\u88AB\u6E05\u7406":"\u4ECE\u5DE6\u4FA7\u5217\u8868\u9009\u62E9\u4F1A\u8BDD\uFF0C\u67E5\u770B\u7EC8\u7AEF\u6216\u7F51\u9875\u9884\u89C8"})]}),w=S==="sessions"?Z:S==="info"&&h?(0,s.jsx)("main",{className:"wb-mobile-info",children:(0,s.jsx)(Ne,{session:h})}):ee;return(0,s.jsx)("main",{ref:k,className:"agent-workbench-page","data-surface":"appCenter","data-term-style":fe,"data-responsive-step":R.step,"data-demo":e.demo?"true":void 0,style:we,onKeyDown:Le,children:R.mode==="mobile"?(0,s.jsxs)("div",{className:"wb-mobile-stack",children:[S==="sessions"?Z:(0,s.jsxs)("div",{className:"wb-mobile-detail",children:[(0,s.jsxs)("div",{className:"wb-mobile-detail-bar",children:[(0,s.jsx)("button",{type:"button",className:"wb-mobile-back",onClick:()=>T("sessions"),children:"\u2039 \u4F1A\u8BDD\u5217\u8868"}),h?(0,s.jsx)("span",{className:"wb-mobile-detail-title",title:String(h.title||h.sessionId),children:String(h.title||h.sessionId)}):null,(0,s.jsx)("span",{className:"wb-mobile-detail-seg",children:Se.map(t=>(0,s.jsx)("button",{type:"button","aria-current":S===t?"page":void 0,onClick:()=>T(t),children:t==="workspace"?"\u7EC8\u7AEF":t==="preview"?"\u7F51\u9875":"\u4FE1\u606F"},t))})]}),S==="info"&&h?(0,s.jsx)("main",{className:"wb-mobile-info",children:(0,s.jsx)(Ne,{session:h})}):S==="preview"&&h?(0,s.jsx)("main",{className:"wb-mobile-preview",children:(0,s.jsx)(An,{session:h,api:n,authenticated:e.authenticated,capabilities:e.capabilities,now:f})}):ee]}),(0,s.jsx)(tn,{open:q,onClose:()=>V(!1),standingLink:e.manageAuthed===!0,api:n})]}):(0,s.jsxs)("div",{className:`wb-desktop-layout${Q?" is-rail-collapsed":""}${X?"":" is-terminal-closed"}`,children:[Z,Q?null:(0,s.jsx)("button",{type:"button",className:"wb-rail-separator",role:"separator","aria-label":"\u8C03\u6574\u5217\u8868\u5BBD\u5EA6","aria-orientation":"vertical","aria-valuemin":176,"aria-valuemax":460,"aria-valuenow":P.railWidth,onPointerDown:Ee,onKeyDown:ie,children:(0,s.jsx)("span",{"aria-hidden":"true",children:"\u22EE"})}),ee]})})}var _e=H(te(),1);function ot(){let e=Oe(),[n,r]=(0,We.useState)(Date.now());(0,We.useEffect)(()=>{let f=window.setInterval(()=>r(Date.now()),3e4);return()=>window.clearInterval(f)},[]);let c=Be(window.location.hash);return(0,_e.jsx)(xn,{sessions:[...e.sessions.values()],online:e.online,authenticated:pe.workbenchAuthed,capabilities:pe.workbenchCapabilities,manageAuthed:pe.authed,initialSessionId:c?.surface==="main"?c.sessionId:null,locale:"zh-CN",now:n})}function It(e){return Ke(e,(0,_e.jsx)(ot,{}))}export{It as renderAgentWorkbenchPage};
|
package/dist/dashboard-web/chunks/{bot-defaults-page-XMGLZZ2E.js → bot-defaults-page-67RAWCSQ.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h,l as i,m as j,n as k,o as l,p as m,q as n,r as o}from"./chunk-
|
|
1
|
+
import{d as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h,l as i,m as j,n as k,o as l,p as m,q as n,r as o}from"./chunk-MMLTCXHP.js";import"./chunk-KTQ7B6ZR.js";import"./chunk-CEUCNZFJ.js";import"./chunk-NYY66DNC.js";import"./chunk-R3LJUCEO.js";import"./chunk-QITAMHW6.js";import"./chunk-K232GT3M.js";import"./chunk-ARROO6TE.js";import"./chunk-3YZFAHNK.js";export{a as BOT_DEFAULTS_TABS,c as BdTabGrid,g as BotAgentSection,f as BotDefaultsPage,b as BotDefaultsTabs,j as CardBehaviorSection,k as CodexAppDisplaySection,h as DASHBOARD_MAX_TURN_TIMEOUT_MS,l as EnvelopeInjectionSection,n as GrantSection,d as ModelPickerField,m as SessionGroupTagRow,e as buildSubstituteTarget,i as effectiveAccess,o as renderBotDefaultsPage};
|